!function(){var e,t,i,n,r,s,o,a,l={1243:function(e,t,i){"use strict";var n={};i.r(n),i.d(n,{Lq:function(){return Dm},Mt:function(){return Am},sF:function(){return Im},q4:function(){return Kv},Zx:function(){return Vm},zT:function(){return jm},QS:function(){return Lm}});var r={};i.r(r),i.d(r,{B:function(){return ky},KQ:function(){return Fy},ji:function(){return dy},jK:function(){return yy},gb:function(){return wy},Vm:function(){return Cy}});var s=i(38450),o=i(94573),a=i(74208),l=i(3204);class c{}class u{}class d{}class h{}class p{}function f(e){return t=>null==t?null:t.map(t=>e(t))}function v(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:f(e=>i.deserializer(e))}))}static record(e,t,i){return new m(e,t,Object.assign(Object.assign({},i),{deserializer:v(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:f(e=>i.deserializer(e))}))}static record(e,t,i){return new k(e,t,Object.assign(Object.assign({},i),{deserializer:v(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"),Y=new C("userDecryptionOptions","disk"),W=(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("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"})),fe=new C("popupStyle","disk"),ve=(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("premiumBannerReprompt","disk",{web:"disk-local"}),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("vaultBrowserIntroCarousel","disk")),Ne=new C("vaultAtRiskPasswords","memory"),Ve=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 Ye{static create(){return new Ye([])}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 Ye([...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 We=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 We(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 ft 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 vt=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 vt(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all([...t.map(({userId:t,account:i})=>function(t,i){return vt(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 vt(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all([...t.map(({userId:t,account:i})=>function(t,i){return vt(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 Yt 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 Wt=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 Wt(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all([...t.map(({userId:t,account:i})=>function(t,i){return Wt(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 Wt(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all([...t.map(({userId:t,account:i})=>function(t,i){return Wt(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 fi={key:"locale",stateDefinition:{name:"translation"}};class vi 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(fi,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(fi);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(fi,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 f=null===(l=null==i?void 0:i.profile)||void 0===l?void 0:l.apiKeyClientId;null!=f&&("web-disk-local"!==e.type&&(yield e.setToUser(t,Gi,f)),delete i.profile.apiKeyClientId,u=!0);const v=null===(c=null==i?void 0:i.keys)||void 0===c?void 0:c.apiKeyClientSecret;null!=v&&("web-disk-local"!==e.type&&(yield e.setToUser(t,Li,v)),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 Yi 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 Wi,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"}(Wi||(Wi={})),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 fn 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 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 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 vn(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all([...t.map(({userId:t,account:i})=>function(t){return vn(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 vn(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all([...t.map(({userId:t,account:i})=>function(t){return vn(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 Yn={key:"storedEmail",stateDefinition:{name:"loginEmail"}};class Wn 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(Yn,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(Yn);n&&(t||(t={}),i=!0,t.rememberedEmail=n,yield e.setToGlobal(Yn,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 fr 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 vr=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 vr(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all([...t.map(({userId:t,account:i})=>function(t,i){return vr(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 vr(this,void 0,void 0,function*(){const t=yield e.getAccounts();yield Promise.all([...t.map(({userId:t,account:i})=>function(t,i){return vr(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 Yr={stateDefinition:{name:"generator"},key:"generatorSettings"},Wr={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,Yr))&&void 0!==n?n:{},s=Object.assign(r,i.generator);yield Promise.all([e.setToUser(t,Yr,s),e.setToUser(t,Hr,i.passphrase),e.setToUser(t,Wr,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 fs={name:"desktopSettings"},vs={key:"browserIntegrationEnabled",stateDefinition:fs},ms={key:"browserIntegrationFingerprintEnabled",stateDefinition:fs},gs={key:"minimizeOnCopy",stateDefinition:fs};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(vs,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(vs),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(vs)}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 Ys 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 Ws=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 Hs extends Je{migrate(e){return Ws(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 Ws(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 Ws(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 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())})};class Zs 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 Js(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=>Js(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 Qs=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 eo extends Je{constructor(){super(0,io)}shouldMigrate(e){return Promise.resolve(e.currentVersionro(this,void 0,void 0,function*(){return{userId:e,account:yield this.get(e)}})))})}getKnownUserIds(){return ro(this,void 0,void 0,function*(){return this.currentVersion<60?function(e){return ro(this,void 0,void 0,function*(){var t;return null!==(t=yield e.get("authenticatedAccounts"))&&void 0!==t?t:[]})}(this.storageService):function(e){return ro(this,void 0,void 0,function*(){const t=yield e.get(oo({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.")}():oo(e)}}function oo(e){return`global_${e.stateDefinition.name}_${e.key}`}class ao{}var lo=i(34040),co=i(44500),uo=i(81714),ho=i(72245),po=i(22485),fo=i(37567),vo=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 mo{constructor(e,t,i){this.keyDefinition=e,this.activeUserId$=t,this.singleUserStateProvider=i,this.combinedState$=this.activeUserId$.pipe((0,co.n)(e=>null!=e?this.singleUserStateProvider.get(e,this.keyDefinition).combinedState$:uo.t)),this.state$=this.combinedState$.pipe((0,l.T)(([e,t])=>t))}update(e){return vo(this,arguments,void 0,function*(e,t={}){const i=yield(0,ho._)(this.activeUserId$.pipe((0,po.w)({first:1e3,with:()=>(0,fo.$)(()=>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 go=i(98908),yo=i(73276),bo=i(83892),wo=i(3097),So=i(72737),ko=i(8029),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 Co{constructor(e,t,i){this.parentState$=e,this.deriveDefinition=t,this.dependencies=i,this.forcedValueSubject=new go.B,this.storageKey=t.storageKey;const n=this.parentState$.pipe((0,yo.H)(e=>Io(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,bo.h)(this.forcedValueSubject,n).pipe((0,wo.u)({connector:()=>new So.m(1),resetOnRefCountZero:()=>(0,ko.O)(this.deriveDefinition.cleanupDelayMs)}))}forceValue(e){return Io(this,void 0,void 0,function*(){return this.forcedValueSubject.next(e),e})}}var To=i(69194),Po=i(43008),Fo=i(36359),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())})};function xo(e,t,i){return Ro(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 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,n){this.key=e,this.storageService=t,this.keyDefinition=i,this.logService=n;const r=t.updates$.pipe((0,To.p)(t=>t.key===e),(0,co.n)(n=>Ao(this,void 0,void 0,function*(){return"remove"===n.updateType?null:yield xo(e,t,i.deserializer)})));let s=(0,bo.h)((0,Po.v)(()=>xo(e,t,i.deserializer)),r);i.debug.enableRetrievalLogging&&(s=s.pipe((0,Fo.M)({next:t=>{this.logService.info(`Retrieving '${e}' from storage, value is ${null==t?"null":"non-null"}`)}}))),0!==i.cleanupDelayMs&&(s=s.pipe((0,wo.u)({connector:()=>new So.m(1),resetOnRefCountZero:()=>(0,ko.O)(i.cleanupDelayMs)}))),this.state$=s}update(e){return Ao(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 Ao(this,void 0,void 0,function*(){const i=yield this.getStateForUpdate(),n=null!=t.combineLatestWith?yield(0,ho._)(t.combineLatestWith.pipe((0,po.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 Ao(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 Ao(this,void 0,void 0,function*(){return yield xo(this.key,this.storageService,this.keyDefinition.deserializer)})}}class Eo extends Do{constructor(e,t,i){super(function(e){return`global_${e.stateDefinition.name}_${e.key}`}(e),t,e,i)}}var $o=i(33338),Oo=i(93695),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())})};class Mo extends Do{constructor(e,t,i,n,r){super(t.buildKey(e),i,t,r),this.userId=e,this.stateEventRegistrarService=n,this.combinedState$=(0,$o.z)([(0,Oo.of)(e),this.state$])}doStorageSave(e,t){const i=Object.create(null,{doStorageSave:{get:()=>super.doStorageSave}});return Uo(this,void 0,void 0,function*(){yield i.doStorageSave.call(this,e,t),yield this.stateEventRegistrarService.registerEvents(this.keyDefinition)})}}var No=i(58363),Vo=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 Bo=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 jo{constructor(e,t,i){this.state$=e.pipe((0,yo.H)(e=>Bo(this,void 0,void 0,function*(){return yield t.derive(e,i)})))}forceValue(e){return Promise.resolve(e)}}class Go{}class Lo{}var zo=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 _o="global",Ko="_user_auto",Xo="_user_biometric",qo="DuckDuckGoSharedKey";var Yo=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 Wo=m.array(ie,"lock",{deserializer:e=>e}),Ho=m.array(ie,"logout",{deserializer:e=>e});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())})};var Zo=i(25479),Qo=i(30082),ea=i(48479);const ta=["/","-","."," "],ia="\\"+ta.join("\\").replace(" ","s"),na=(new RegExp(`[${ia}]`,"g"),new RegExp(`[^\\d${ia}]`,"g"),new RegExp("^(([1]{1}[0-2]{1})|(0?[1-9]{1}))$"),new RegExp("^2[0-1]{1}\\d{2}$"),null),ra=10,sa=20,oa=30,aa=60,la=120,ca=300,ua="autofill",da="copy-password",ha="copy-totp",pa=0,fa=1,va=2,ma="Chrome",ga="Opera",ya="Edge",ba="Vivaldi",wa="Unknown",Sa={Chrome:"chrome://extensions/shortcuts",Opera:"opera://extensions/shortcuts",Edge:"edge://extensions/shortcuts",Vivaldi:"vivaldi://extensions/shortcuts",Unknown:"https://bitwarden.com/help/keyboard-shortcuts"},ka={Chrome:"chrome://settings/autofill",Opera:"opera://settings/autofill",Edge:"edge://settings/passwords",Vivaldi:"vivaldi://settings/autofill",Unknown:"https://bitwarden.com/help/disable-browser-autofill/"},Ia="autofill_login";var Ca,Ta;!function(e){e.Web="web",e.Browser="browser",e.Desktop="desktop",e.Cli="cli"}(Ca||(Ca={})),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"}(Ta||(Ta={}));const Pa={[Ta.Android]:{category:"mobile",platform:"Android"},[Ta.iOS]:{category:"mobile",platform:"iOS"},[Ta.AndroidAmazon]:{category:"mobile",platform:"Amazon"},[Ta.ChromeExtension]:{category:"extension",platform:"Chrome"},[Ta.FirefoxExtension]:{category:"extension",platform:"Firefox"},[Ta.OperaExtension]:{category:"extension",platform:"Opera"},[Ta.EdgeExtension]:{category:"extension",platform:"Edge"},[Ta.VivaldiExtension]:{category:"extension",platform:"Vivaldi"},[Ta.SafariExtension]:{category:"extension",platform:"Safari"},[Ta.ChromeBrowser]:{category:"webApp",platform:"Chrome"},[Ta.FirefoxBrowser]:{category:"webApp",platform:"Firefox"},[Ta.OperaBrowser]:{category:"webApp",platform:"Opera"},[Ta.EdgeBrowser]:{category:"webApp",platform:"Edge"},[Ta.IEBrowser]:{category:"webApp",platform:"IE"},[Ta.SafariBrowser]:{category:"webApp",platform:"Safari"},[Ta.VivaldiBrowser]:{category:"webApp",platform:"Vivaldi"},[Ta.DuckDuckGoBrowser]:{category:"webApp",platform:"DuckDuckGo"},[Ta.UnknownBrowser]:{category:"webApp",platform:"Unknown"},[Ta.WindowsDesktop]:{category:"desktop",platform:"Windows"},[Ta.MacOsDesktop]:{category:"desktop",platform:"macOS"},[Ta.LinuxDesktop]:{category:"desktop",platform:"Linux"},[Ta.UWP]:{category:"desktop",platform:"Windows UWP"},[Ta.WindowsCLI]:{category:"cli",platform:"Windows"},[Ta.MacOsCLI]:{category:"cli",platform:"macOS"},[Ta.LinuxCLI]:{category:"cli",platform:"Linux"},[Ta.SDK]:{category:"sdk",platform:""},[Ta.Server]:{category:"server",platform:""}};var Fa,Ra,xa,Aa,Da,Ea;!function(e){e[e.SCIM=1]="SCIM",e[e.DomainVerification=2]="DomainVerification",e[e.PublicApi=3]="PublicApi"}(Fa||(Fa={})),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.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.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"}(Ra||(Ra={})),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"}(xa||(xa={})),function(e){e.Integration="integration",e.SDK="sdk",e.SSO="sso",e.SCIM="scim",e.BWDC="bwdc",e.EVENT="event",e.DEVICE="device"}(Aa||(Aa={})),function(e){e[e.One=1]="One",e[e.Latest=1]="Latest"}(Da||(Da={})),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"}(Ea||(Ea={}));const $a=Object.freeze({KdfChange:0});function Oa(){return-1!==navigator.userAgent.indexOf(" Safari/")&&-1===navigator.userAgent.indexOf(" Chrome/")&&-1===navigator.userAgent.indexOf(" Chromium/")}class Ua{}var Ma=i(70891),Na=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 Va extends Ua{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 Ma.yU(()=>globalThis.clearTimeout(i))}setInterval(e,t,i){this.validateRegisteredTask(e);const n=globalThis.setInterval(()=>this.triggerTask(e),t);return new Ma.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 Na(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 Ba="loginStrategySessionTimeout",ja="eventUploadsInterval",Ga="vaultTimeoutCheckInterval";class La{static sendMessageToApp(e,t=null,i=!1){return tl.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 _a;!function(e){e[e.Debug=0]="Debug",e[e.Info=1]="Info",e[e.Warning=2]="Warning",e[e.Error=3]="Error"}(_a||(_a={}));class Ka{constructor(e,t=null){this.isDev=e,this.filter=t,this.timersMap=new Map}debug(e,...t){this.isDev&&this.write(_a.Debug,e,...t)}info(e,...t){this.write(_a.Info,e,...t)}warning(e,...t){this.write(_a.Warning,e,...t)}error(e,...t){this.write(_a.Error,e,...t)}write(e,t,...i){if(null==this.filter||!this.filter(e))switch(e){case _a.Debug:case _a.Info:console.log(t,...i);break;case _a.Warning:console.warn(t,...i);break;case _a.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 Xa=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 qa{static copy(e,t){return Xa(this,void 0,void 0,function*(){if(qa.isClipboardApiSupported(e,"writeText"))try{yield e.navigator.clipboard.writeText(t)}catch(i){qa.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 Xa(this,void 0,void 0,function*(){if(!qa.isClipboardApiSupported(e,"readText"))return this.useLegacyReadMethod(e);try{return yield e.navigator.clipboard.readText()}catch(t){return qa.consoleLogService.debug(`Error reading from clipboard using the clipboard API, attempting legacy method: ${t}`),this.useLegacyReadMethod(e)}})}static useLegacyCopyMethod(e,t){if(!qa.isLegacyClipboardMethodSupported(e,"copy"))return void qa.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){qa.consoleLogService.warning(`Error writing to clipboard: ${e}`)}finally{e.document.body.removeChild(i)}}static useLegacyReadMethod(e){if(!qa.isLegacyClipboardMethodSupported(e,"paste"))return qa.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){qa.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)}}qa.consoleLogService=new Ka(!1);var Ya=qa,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())})};class Ha{constructor(e,t,i){this.clipboardWriteCallback=e,this.globalContext=t,this.offscreenDocumentService=i}static getDevice(e){return this.deviceCache||(Ha.isFirefox()?this.deviceCache=Ta.FirefoxExtension:Ha.isOpera(e)?this.deviceCache=Ta.OperaExtension:Ha.isEdge()?this.deviceCache=Ta.EdgeExtension:Ha.isVivaldi()?this.deviceCache=Ta.VivaldiExtension:Ha.isChrome(e)?this.deviceCache=Ta.ChromeExtension:Ha.isSafari(e)&&(this.deviceCache=Ta.SafariExtension)),this.deviceCache}getDevice(){return Ha.getDevice(this.globalContext)}getDeviceString(){return Ta[this.getDevice()].toLowerCase().replace("extension","")}getClientType(){return Ca.Browser}static isFirefox(){return-1!==navigator.userAgent.indexOf(" Firefox/")||-1!==navigator.userAgent.indexOf(" Gecko/")}isFirefox(){return this.getDevice()===Ta.FirefoxExtension}static isChrome(e){return e.chrome&&-1!==navigator.userAgent.indexOf(" Chrome/")}isChrome(){return this.getDevice()===Ta.ChromeExtension}static isEdge(){return-1!==navigator.userAgent.indexOf(" Edg/")}isEdge(){return this.getDevice()===Ta.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()===Ta.OperaExtension}static isVivaldi(){return-1!==navigator.userAgent.indexOf(" Vivaldi/")}isVivaldi(){return this.getDevice()===Ta.VivaldiExtension}static isSafari(e){return!Ha.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()===Ta.SafariExtension}isChromium(){return this.isChrome()||this.isEdge()||this.isOpera()||this.isVivaldi()}static shouldApplySafariHeightFix(e){var t;if(Ha.getDevice(e)!==Ta.SafariExtension)return!1;const i=Ha.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 Wa(this,void 0,void 0,function*(){return this.isSafari()?tl.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){tl.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()?La.sendMessageToApp("copyToClipboard",e).then(s):(this.isChrome()&&""===e&&(e="\0"),tl.isManifestVersion(3)&&this.offscreenDocumentService.offscreenApiSupported()?this.triggerOffscreenCopyToClipboard(e).then(s):Ya.copy(i,e).then(s))}readFromClipboard(e){return Wa(this,void 0,void 0,function*(){const t=(null==e?void 0:e.window)||this.globalContext;return this.isSafari()?yield La.sendMessageToApp("readFromClipboard"):tl.isManifestVersion(3)&&this.offscreenDocumentService.offscreenApiSupported()?yield this.triggerOffscreenReadFromClipboard():yield Ya.read(t)})}supportsSecureStorage(){return!1}getAutofillKeyboardShortcut(){return Wa(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===Ia).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===Ia).shortcut))),e})}packageType(){return Wa(this,void 0,void 0,function*(){switch(this.getDevice()){case Ta.ChromeExtension:return"Chrome Extension";case Ta.FirefoxExtension:return"Firefox Extension";case Ta.OperaExtension:return"Opera Extension";case Ta.EdgeExtension:return"Edge Extension";case Ta.VivaldiExtension:return"Vivaldi Extension";case Ta.SafariExtension:return"Safari Extension";default:return"Unknown Browser Extension"}})}triggerOffscreenCopyToClipboard(e){return Wa(this,void 0,void 0,function*(){yield this.offscreenDocumentService.withDocument([chrome.offscreen.Reason.CLIPBOARD],"Write text to the clipboard.",()=>Wa(this,void 0,void 0,function*(){yield tl.sendMessageWithResponse("offscreenCopyToClipboard",{text:e})}))})}triggerOffscreenReadFromClipboard(){return Wa(this,void 0,void 0,function*(){const e=yield this.offscreenDocumentService.withDocument([chrome.offscreen.Reason.CLIPBOARD],"Read text from the clipboard.",()=>Wa(this,void 0,void 0,function*(){return yield tl.sendMessageWithResponse("offscreenReadFromClipboard")}));return"string"==typeof e?e:""})}}Ha.deviceCache=null;var Ja=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 Za;function Qa(e,t){return Ja(this,void 0,void 0,function*(){return Za||(Za=function(){var e,t;const i=new Ka(!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""===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("")?/^(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 f(e){return Array.isArray(e)?e:[e]}function v(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 Ja(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=>Ja(this,void 0,void 0,function*(){return"string"==typeof i&&(i={file:i}),o?"file"in i?chrome.scripting.insertCSS({target:v(e,t,r),files:[i.file]}):chrome.scripting.insertCSS({target:v(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 Ja(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:v(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 Ja(this,arguments,void 0,function*(e,t,i={}){const n=f(e);yield Promise.all(n.map(e=>Ja(this,void 0,void 0,function*(){return w(p(e),t,i)})))})}function w(e,t){return Ja(this,arguments,void 0,function*({frameId:e,tabId:t,allFrames:i},n,r={}){const s=f(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 Ja(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 Ja(this,void 0,void 0,function*(){return n.permissions.contains({origins:[new URL(e).origin+"/*"]})})}return(e,t)=>Ja(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=>Ja(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),f=h(...null!=c?c:[]),v=(e,t,...i)=>Ja(this,[e,t,...i],void 0,function*(e,t,i=0){p.test(e)&&!f.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)=>Ja(this,[e,t,i],void 0,function*(e,{status:t},{url:i}){"loading"===t&&i&&v(i,e)}),g=e=>Ja(this,[e],void 0,function*({tabId:e,frameId:t,url:i}){v(i,e,t)});a?tl.addListener(chrome.webNavigation.onCommitted,g):tl.addListener(chrome.tabs.onUpdated,m);const y={unregister(){return Ja(this,void 0,void 0,function*(){a?chrome.webNavigation.onCommitted.removeListener(g):chrome.tabs.onUpdated.removeListener(m)})}};return"function"==typeof t&&t(y),y})}()),Za(e,t)})}var el=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 tl{static get manifestVersion(){return chrome.runtime.getManifest().manifest_version}static isManifestVersion(e){return tl.manifestVersion===e}static senderIsInternal(e,t){var i,n;if(!(null==e?void 0:e.origin))return null==t||t.warning("[BrowserApi] Message sender has no origin"),!1;const r="undefined"!=typeof chrome&&(null===(i=chrome.runtime)||void 0===i?void 0:i.getURL(""))||"undefined"!=typeof browser&&(null===(n=browser.runtime)||void 0===n?void 0:n.getURL(""))||"";if(!r)return null==t||t.warning("[BrowserApi] Unable to determine extension URL"),!1;const s=e.origin.replace(/\/$/,"").toLowerCase(),o=r.replace(/\/$/,"").toLowerCase();return s.startsWith(o)?"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 (${s}) does not match extension URL (${o})`),!1)}static getWindows(){return el(this,void 0,void 0,function*(){return new Promise(e=>chrome.windows.getAll({populate:!0},e))})}static getWindow(e){return el(this,void 0,void 0,function*(){return e?yield tl.getWindowById(e):tl.getCurrentWindow()})}static getCurrentWindow(){return el(this,void 0,void 0,function*(){return new Promise(e=>chrome.windows.getCurrent({populate:!0},e))})}static getWindowById(e){return el(this,void 0,void 0,function*(){return new Promise(t=>chrome.windows.get(e,{populate:!0},t))})}static createWindow(e){return el(this,void 0,void 0,function*(){return new Promise(t=>{chrome.windows.create(e,e=>el(this,void 0,void 0,function*(){if(!tl.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 el(this,void 0,void 0,function*(){return new Promise(t=>chrome.windows.remove(e,()=>t()))})}static updateWindowProperties(e,t){return el(this,void 0,void 0,function*(){return new Promise(i=>chrome.windows.update(e,t,()=>{i()}))})}static focusWindow(e){return el(this,void 0,void 0,function*(){yield tl.updateWindowProperties(e,{focused:!0})})}static getTabFromCurrentWindowId(){return el(this,void 0,void 0,function*(){return yield tl.tabsQueryFirstCurrentWindowForSafari({active:!0,windowId:chrome.windows.WINDOW_ID_CURRENT})})}static getBrowserClientVendor(e){switch(Ha.getDevice(e)){case Ta.ChromeExtension:case Ta.ChromeBrowser:return ma;case Ta.OperaExtension:case Ta.OperaBrowser:return ga;case Ta.EdgeExtension:case Ta.EdgeBrowser:return ya;case Ta.VivaldiExtension:case Ta.VivaldiBrowser:return ba;default:return wa}}static getTab(e){return el(this,void 0,void 0,function*(){return e?tl.isManifestVersion(3)?yield chrome.tabs.get(e):new Promise(t=>chrome.tabs.get(e,e=>{t(e)})):null})}static getTabFromCurrentWindow(){return el(this,void 0,void 0,function*(){return yield tl.tabsQueryFirstCurrentWindowForSafari({active:!0,currentWindow:!0})})}static getActiveTabs(){return el(this,void 0,void 0,function*(){return yield tl.tabsQuery({active:!0})})}static getCurrentTab(){return el(this,void 0,void 0,function*(){return tl.isManifestVersion(3)?yield chrome.tabs.getCurrent():new Promise(e=>chrome.tabs.getCurrent(t=>{e(t)}))})}static closeTab(e){return el(this,void 0,void 0,function*(){e&&(tl.isWebExtensionsApi?yield browser.tabs.remove(e).catch(e=>{throw new Error("[BrowserApi] Failed to remove current tab: "+e.message)}):tl.isChromeApi&&(yield chrome.tabs.remove(e).catch(e=>{throw new Error("[BrowserApi] Failed to remove current tab: "+e.message)})))})}static navigateTabToUrl(e,t){return el(this,void 0,void 0,function*(){e&&(tl.isWebExtensionsApi?yield browser.tabs.update(e,{url:t.href}).catch(e=>{throw new Error("Failed to navigate tab to URL: "+e.message)}):tl.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 el(this,void 0,void 0,function*(){return new Promise(t=>{chrome.tabs.query(e,e=>{t(e)})})})}static tabsQueryFirst(e){return el(this,void 0,void 0,function*(){const t=yield tl.tabsQuery(e);return t.length>0?t[0]:null})}static tabsQueryFirstCurrentWindowForSafari(e){return el(this,void 0,void 0,function*(){var t;if(!tl.isSafariApi)return yield tl.tabsQueryFirst(e);const i=(yield tl.getCurrentWindow()).id,n=yield tl.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),tl.tabSendMessage(e,n)}static tabSendMessage(e,t){return el(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 tl.isWebExtensionsApi?browser.runtime.getURL(e):tl.isChromeApi?chrome.runtime.getURL(e):void 0}static onWindowCreated(e){return el(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===tl.getBackgroundPage()}static getExtensionViews(e){return void 0===chrome.extension.getViews?[]:chrome.extension.getViews(e)}static isPopupOpen(){return el(this,void 0,void 0,function*(){return Promise.resolve(tl.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 el(this,void 0,void 0,function*(){return new Promise(t=>chrome.webNavigation.getFrame(e,t))})}static getAllFrameDetails(e){return el(this,void 0,void 0,function*(){return new Promise(t=>chrome.webNavigation.getAllFrames({tabId:e},t))})}static messageListener(e,t){tl.addListener(chrome.runtime.onMessage,t)}static messageListener$(){return new ea.c(e=>{const t=t=>{e.next(t)};return tl.addListener(chrome.runtime.onMessage,t),()=>tl.removeListener(chrome.runtime.onMessage,t)})}static storageChangeListener(e){tl.addListener(chrome.storage.onChanged,e)}static addListener(e,t){e.addListener(t),tl.isSafariApi&&!tl.isBackgroundPage(self)&&(tl.trackedChromeEventListeners.push([e,t]),tl.setupUnloadListeners())}static removeListener(e,t){if(e.removeListener(t),tl.isSafariApi&&!tl.isBackgroundPage(self)){const e=tl.trackedChromeEventListeners.findIndex(([e,i])=>i==t);-1!==e&&tl.trackedChromeEventListeners.splice(e,1)}}static setupUnloadListeners(){self.addEventListener("pagehide",()=>{for(const[e,t]of tl.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 el(this,void 0,void 0,function*(){chrome.tabs.update(e,{active:!0,highlighted:!0})})}static closePopup(e){tl.isWebExtensionsApi&&tl.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=tl.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 tl.isWebExtensionsApi?browser.runtime.connectNative(e):tl.isChromeApi?chrome.runtime.connectNative(e):void 0}static requestPermission(e){return tl.isWebExtensionsApi?browser.permissions.request(e):new Promise(t=>{chrome.permissions.request(e,t)})}static permissionsGranted(e){return el(this,void 0,void 0,function*(){return new Promise(t=>chrome.permissions.contains({permissions:e},e=>t(e)))})}static getPlatformInfo(){return tl.isWebExtensionsApi?browser.runtime.getPlatformInfo():new Promise(e=>{chrome.runtime.getPlatformInfo(e)})}static getBrowserAction(){return tl.isManifestVersion(3)?chrome.action:chrome.browserAction}static getSidebarAction(e){var t;const i=Ha.getDevice(e);return i===Ta.FirefoxExtension?browser.sidebarAction:i===Ta.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(tl.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 el(this,void 0,void 0,function*(){if(!(yield tl.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 el(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 el(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 Qa(e)})}static registerContentScriptsMv3(e){return el(this,void 0,void 0,function*(){yield chrome.scripting.registerContentScripts(e)})}static unregisterContentScriptsMv3(e){return el(this,void 0,void 0,function*(){yield chrome.scripting.unregisterContentScripts(e)})}}tl.isWebExtensionsApi="undefined"!=typeof browser,tl.isSafariApi=Oa(),tl.isChromeApi=!tl.isSafariApi&&"undefined"!=typeof chrome,tl.isFirefoxOnAndroid=-1!==navigator.userAgent.indexOf("Firefox/")&&-1!==navigator.userAgent.indexOf("Android"),tl.trackedChromeEventListeners=[];var il=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 nl=Object.freeze({default:380,wide:480,"extra-wide":600});class rl{static inSidebar(e){return rl.urlContainsSearchParams(e,"uilocation","sidebar")}static inPopout(e){return rl.urlContainsSearchParams(e,"uilocation","popout")}static isInTab(){return il(this,void 0,void 0,function*(){var e;const t=null===(e=yield tl.getCurrentTab())||void 0===e?void 0:e.id;if(null==t)return!1;return tl.getExtensionViews({tabId:t,type:"tab"}).length>0})}static inSingleActionPopout(e,t){return rl.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 il(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!tl.getBackgroundPage()||tl.isManifestVersion(3)}static openPopout(e){return il(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(nl.default,"undefined"==typeof document?nl.default:document.body.clientWidth),height:630},a=o.width,l=yield tl.getWindow(i),c=Object.assign(Object.assign(Object.assign({left:l.left+l.width-a-15,top:l.top+90},o),s),{url:rl.buildPopoutUrl(e,n)});if((yield rl.isSingleActionPopoutOpen(n,c,r))&&!r)return;const u="mac"===(yield tl.getPlatformInfo()).os,d="fullscreen"===l.state&&u;d&&(yield tl.updateWindowProperties(l.id,{state:"maximized"}),yield new Promise(e=>setTimeout(e,1e3)));const h=yield tl.createWindow(c);return d&&(yield tl.updateWindowProperties(h.id,{focused:!0})),h})}static closeSingleActionPopout(e){return il(this,arguments,void 0,function*(e,t=0){const i=chrome.runtime.getURL("popup/index.html"),n=yield tl.tabsQuery({url:`${i}*`});for(const i of n)i.url.includes(`singleActionPopout=${e}`)&&setTimeout(()=>tl.removeWindow(i.windowId),t)})}static openCurrentPagePopout(e){return il(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 rl.openPopout(`${n.pathname}${r}`),rl.inPopup(e)&&tl.closePopup(e)})}static waitForAllPopupsClose(){return il(this,arguments,void 0,function*(e=1e3){yield(0,ho._)((0,Zo.Y)(100).pipe((0,co.n)(()=>tl.isPopupOpen()),(0,Qo.v)(e=>e,!0),(0,To.p)(e=>!e),(0,po.w)({first:e,with:()=>(0,Oo.of)(!0)})))})}static isSingleActionPopoutOpen(e,t){return il(this,arguments,void 0,function*(e,t,i=!1){if(!e)return!1;const n=chrome.runtime.getURL("popup/index.html"),r=(yield tl.tabsQuery({url:`${n}*`})).filter(t=>t.url.includes(`singleActionPopout=${e}`));if(0===r.length)return!1;if(!i){const e=r.shift();yield tl.updateWindowProperties(e.windowId,{focused:!0,width:t.width,height:t.height,top:t.top,left:t.left})}return r.forEach(e=>tl.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 sl=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 ol=new m(fe,"popup-width",{deserializer:e=>e});class al{constructor(){this.state=(0,a.WQX)(d).get(ol),this.width$=this.state.state$.pipe((0,l.T)(e=>null!=e?e:"default"))}setWidth(e){return sl(this,void 0,void 0,function*(){yield this.state.update(()=>e)})}init(){return sl(this,void 0,void 0,function*(){this.width$.subscribe(e=>{al.setStyle(e),localStorage.setItem(al.LocalStorageKey,e)})})}setHeight(){return sl(this,void 0,void 0,function*(){const e=yield rl.isInTab(),t=window.innerHeight,i=window.screen.availHeight-100,n=i<600?i:t;!rl.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){var t;if(!rl.inPopup(window))return;const i=null!==(t=nl[e])&&void 0!==t?t:nl.default;document.body.style.minWidth=`${i}px`}static initBodyWidthFromLocalStorage(){const e=localStorage.getItem(al.LocalStorageKey);this.setStyle(e)}}al.LocalStorageKey="bw-popup-width",al.ɵfac=function(e){return new(e||al)},al.ɵprov=a.jDH({token:al,factory:al.ɵfac,providedIn:"root"});var ll=i(60989),cl=i(34003),ul=i(45795),dl=i(43380),hl=i(94251),pl=i(77468),fl=i(51757),vl=i(71458),ml=i(82630),gl=i(28846),yl=i(33812),bl=i(33277),wl=i(83731),Sl=i(50147);function kl({element:e,title:t,label:i}){t&&e.setAttribute("title",t),i&&e.setAttribute("aria-label",i)}class Il{}class Cl{}class Tl{}class Pl extends Tl{}function Fl(e,t){if(1&e&&(yl.j41(0,"span",4),yl.EFF(1),yl.k0s()),2&e){const e=yl.XpG();yl.R7$(),yl.JRh(e.title)}}class Rl{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"]}}}Rl.ɵfac=function(e){return new(e||Rl)(yl.rXU(Pl))},Rl.ɵcmp=yl.VBU({type:Rl,selectors:[["bit-spinner"]],hostVars:2,hostBindings:function(e,t){2&e&&yl.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(),yl.j41(0,"svg",0),yl.nrm(1,"circle",1)(2,"circle",2),yl.k0s(),yl.DNE(3,Fl,2,1,"span",3)),2&e&&(yl.R7$(3),yl.Y8G("ngIf",t.sr))},dependencies:[pl.MD,pl.bT],encapsulation:2});var xl=i(37831);const Al=[{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 Dl(e,t){if(1&e&&yl.EFF(0),2&e){const e=yl.XpG(2);yl.JRh(e.tooltipData.content())}}function El(e,t){if(1&e&&(yl.rj2(0,"div",0)(1,"div",1),yl.SdG(2,0,null,Dl,1,1),yl.eux()()),2&e){const e=yl.XpG();yl.BMQ("data-position",e.tooltipData.tooltipPosition())("data-visible",e.tooltipData.isVisible()),yl.R7$(),yl.Avn("id",e.tooltipData.id())}}const $l=new a.nKC("TOOLTIP_DATA");class Ol{constructor(){this.templateRef=o.ebz.required(yl.C4Q),this.elementRef=(0,a.WQX)(yl.aKT),this.tooltipData=(0,a.WQX)($l)}}Ol.ɵfac=function(e){return new(e||Ol)},Ol.ɵcmp=yl.VBU({type:Ol,selectors:[["bit-tooltip"]],viewQuery:function(e,t){1&e&&yl.wEZ(t.templateRef,yl.C4Q,5),2&e&&yl.NyB()},ngContentSelectors:["*"],decls:1,vars:1,consts:[[1,"bit-tooltip-container"],["role","tooltip",1,"bit-tooltip",3,"id"]],template:function(e,t){1&e&&(yl.NAR(),yl.nVh(0,El,4,3,"div",0)),2&e&&yl.vxM(t.tooltipData.content()?0:-1)},dependencies:[pl.MD],encapsulation:2});class Ul{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)(yl.aKT),this.overlay=(0,a.WQX)(dl.hJ),this.viewContainerRef=(0,a.WQX)(yl.c1b),this.positionStrategy=this.overlay.position().flexibleConnectedTo(this.elementRef).withFlexibleDimensions(!1).withPush(!0),this.tooltipId="bit-tooltip-"+Ul.nextId++,this.currentDescribedByIds=this.elementRef.nativeElement.getAttribute("aria-describedby")||null,this.tooltipPortal=new xl.A8(Ol,this.viewContainerRef,a.zZn.create({providers:[{provide:$l,useValue:{content:this.tooltipContent,isVisible:this.isVisible,tooltipPosition:this.tooltipPosition,id:(0,a.vPA)(this.tooltipId)}}]})),this.destroyTooltip=()=>{var e;null===(e=this.overlayRef)||void 0===e||e.dispose(),this.overlayRef=void 0,this.isVisible.set(!1)},this.showTooltip=()=>{this.overlayRef||(this.overlayRef=this.overlay.create(Object.assign(Object.assign({},this.defaultPopoverConfig),{positionStrategy:this.positionStrategy})),this.overlayRef.attach(this.tooltipPortal)),setTimeout(()=>{this.isVisible.set(!0)},800)},this.hideTooltip=()=>{this.destroyTooltip()},this.resolvedDescribedByIds=(0,bl.EW)(()=>this.addTooltipToDescribedby()?this.currentDescribedByIds?`${this.currentDescribedByIds||""} ${this.tooltipId}`:this.tooltipId:this.currentDescribedByIds)}computePositions(e){const t=Al.find(t=>t.id===e);return t?[t,...Al]:Al}get defaultPopoverConfig(){return{hasBackdrop:!1,scrollStrategy:this.overlay.scrollStrategies.reposition()}}ngOnInit(){this.positionStrategy.withPositions(this.computePositions(this.tooltipPosition()))}}function Ml(e,t){(0,wl.br)(t).pipe((0,wl.pQ)()).subscribe(t=>{t?(e.removeAttribute("disabled"),e.setAttribute("aria-disabled","true")):e.removeAttribute("aria-disabled")})}Ul.nextId=0,Ul.ɵfac=function(e){return new(e||Ul)},Ul.ɵdir=yl.FsC({type:Ul,selectors:[["","bitTooltip",""]],hostVars:1,hostBindings:function(e,t){1&e&&yl.bIt("mouseenter",function(){return t.showTooltip()})("mouseleave",function(){return t.hideTooltip()})("focus",function(){return t.showTooltip()})("blur",function(){return t.hideTooltip()}),2&e&&yl.BMQ("aria-describedby",t.resolvedDescribedByIds())},inputs:{tooltipContent:[1,"bitTooltip","tooltipContent"],tooltipPosition:[1,"tooltipPosition"],addTooltipToDescribedby:[1,"addTooltipToDescribedby"]},outputs:{tooltipContent:"bitTooltipChange"}});class Nl{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)}}Nl.ɵfac=function(e){return new(e||Nl)(a.KVO(a.qQL),a.KVO(yl.SKi))},Nl.ɵprov=a.jDH({token:Nl,factory:Nl.ɵfac,providedIn:"root"});class Vl{constructor(){this.ariaDisabledClickCaptureService=(0,a.WQX)(Nl)}}Vl.ɵfac=function(e){return new(e||Vl)},Vl.ɵdir=yl.FsC({type:Vl,hostVars:1,hostBindings:function(e,t){2&e&&yl.BMQ("bit-aria-disable",!0)}});const Bl=e=>({"tw-invisible":e}),jl=["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"],Gl={contrast:["!tw-text-contrast","tw-border-transparent","hover:!tw-bg-hover-contrast","focus-visible:before:tw-ring-text-contrast",...jl],main:["!tw-text-main","focus-visible:before:tw-ring-primary-600",...jl],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",...jl],primary:["!tw-text-primary-600","focus-visible:before:tw-ring-primary-600",...jl],danger:["!tw-text-danger-600","focus-visible:before:tw-ring-primary-600",...jl],"nav-contrast":["!tw-text-alt2","hover:!tw-bg-hover-contrast","focus-visible:before:tw-ring-text-alt2",...jl]},Ll={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(Gl[this.buttonType()]).concat(Ll[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)(yl.aKT),this.tooltip=(0,a.WQX)(Ul,{host:!0,optional:!0}),this.label=(0,o.hFB)(),this.iconClass=(0,bl.EW)(()=>[this.icon(),"!tw-m-0"]),this.disabledAttr=(0,bl.EW)(()=>null!=this.disabled()&&!1!==this.disabled()||this.loading()),this.showDisabledStyles=(0,bl.EW)(()=>this.showLoadingStyle()||this.disabledAttr()&&!1===this.loading()),this.loading=(0,o.geq)(!1),this.showLoadingStyle=(0,wl.ot)((0,wl.br)(this.loading).pipe((0,Sl.s)(e=>(0,Zo.Y)(e?75:0)))),this.disabled=(0,o.geq)(!1);const e=this.elementRef.nativeElement;Ml(e,this.disabledAttr);const t=e.getAttribute("title");(0,bl.QZ)(()=>{var e;kl({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=yl.VBU({type:zl,selectors:[["button","bitIconButton","",5,"button","bitButton",""]],hostVars:3,hostBindings:function(e,t){2&e&&(yl.BMQ("bitIconButton",t.icon()),yl.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:[yl.Jv_([{provide:Il,useExisting:zl},{provide:Cl,useExisting:zl}]),yl.nM4([Vl,{directive:Ul,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&&(yl.j41(0,"span",0)(1,"span",1),yl.nrm(2,"i",2),yl.k0s(),yl.j41(3,"span",3),yl.nrm(4,"bit-spinner",4),yl.k0s()()),2&e&&(yl.R7$(),yl.Y8G("ngClass",yl.eq3(3,Bl,t.showLoadingStyle())),yl.R7$(),yl.Y8G("ngClass",t.iconClass()),yl.R7$(),yl.Y8G("ngClass",yl.eq3(5,Bl,!t.showLoadingStyle())))},dependencies:[pl.YU,Rl],encapsulation:2});class _l{}_l.ɵfac=function(e){return new(e||_l)},_l.ɵmod=yl.$C({type:_l}),_l.ɵinj=a.G2t({imports:[zl]});class Kl{}Kl.ɵfac=function(e){return new(e||Kl)},Kl.ɵmod=yl.$C({type:Kl}),Kl.ɵinj=a.G2t({imports:[pl.MD,pl.MD]});class Xl{}Xl.ɵfac=function(e){return new(e||Xl)},Xl.ɵmod=yl.$C({type:Xl}),Xl.ɵinj=a.G2t({});const ql={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"]},Yl={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 Wl{constructor(){this.bitTypography=o.hFB.required(),this.noMargin=(0,o.hFB)(!1,{transform:o.L39})}get classList(){return ql[this.bitTypography()].concat(this.noMargin()?[]:Yl[this.bitTypography()])}}Wl.ɵfac=function(e){return new(e||Wl)},Wl.ɵdir=yl.FsC({type:Wl,selectors:[["","bitTypography",""]],hostVars:2,hostBindings:function(e,t){2&e&&yl.HbH(t.classList)},inputs:{bitTypography:[1,"bitTypography"],noMargin:[1,"noMargin"]}});class Hl{constructor(e){this.i18nService=e}transform(e,t,i,n){return this.i18nService.t(e,t,i,n)}}function Jl(e,t){1&e&&(yl.j41(0,"p",3),yl.EFF(1),yl.k0s()),2&e&&(yl.R7$(),yl.JRh(t))}function Zl(e,t){if(1&e&&(yl.j41(0,"p",4),yl.EFF(1),yl.k0s()),2&e){const e=t.$implicit;yl.R7$(),yl.SpI(" ",e," ")}}Hl.ɵfac=function(e){return new(e||Hl)(yl.rXU(Pl,16))},Hl.ɵpipe=yl.EJ8({name:"i18n",type:Hl,pure:!0});const Ql={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 ec{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 yl.bkB}get iconClass(){return Ql[this.variant()].icon}get bgColor(){return Ql[this.variant()].bgColor}get messageArray(){const e=this.message();return Array.isArray(e)?e:[e]}}ec.ɵfac=function(e){return new(e||ec)},ec.ɵcmp=yl.VBU({type:ec,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&&(yl.j41(0,"div")(1,"div",0),yl.nrm(2,"i",1),yl.j41(3,"div")(4,"span",2),yl.EFF(5),yl.nI1(6,"i18n"),yl.k0s(),yl.nVh(7,Jl,2,1,"p",3),yl.Z7z(8,Zl,2,1,"p",4,yl.fX1),yl.k0s(),yl.j41(10,"button",5),yl.nI1(11,"i18n"),yl.bIt("click",function(){return t.onClose.emit()}),yl.k0s()(),yl.nrm(12,"div",6),yl.k0s()),2&e){let e;yl.HbH(yl.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)),yl.BMQ("role","error"===t.variant()?"alert":null),yl.R7$(2),yl.HbH(yl.VkB("bwi tw-text-xl tw-py-1.5 tw-px-2.5 ",t.iconClass)),yl.R7$(3),yl.JRh(yl.bMT(6,12,t.variant())),yl.R7$(2),yl.vxM((e=t.title())?7:-1,e),yl.R7$(),yl.Dyx(t.messageArray),yl.R7$(2),yl.Y8G("label",yl.bMT(11,14,"close")),yl.R7$(2),yl.xc7("width",t.progressWidth()+"%")}},dependencies:[Kl,_l,zl,Xl,Wl,Hl],encapsulation:2});class tc extends ml.y8{constructor(e,t){super(e,t)}}tc.ɵfac=function(e){return new(e||tc)(yl.rXU(ml.tw),yl.rXU(ml.sn))},tc.ɵcmp=yl.VBU({type:tc,selectors:[["ng-component"]],features:[yl.Vt3],decls:1,vars:4,consts:[[3,"onClose","title","variant","message","progressWidth"]],template:function(e,t){1&e&&(yl.j41(0,"bit-toast",0),yl.bIt("onClose",function(){return t.remove()}),yl.k0s()),2&e&&yl.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:[ec],encapsulation:2,data:{animation:[(0,gl.hZ)("flyInOut",[(0,gl.wk)("inactive",(0,gl.iF)({opacity:0})),(0,gl.wk)("active",(0,gl.iF)({opacity:1})),(0,gl.wk)("removed",(0,gl.iF)({opacity:0})),(0,gl.kY)("inactive => active",(0,gl.i0)("{{ easeTime }}ms {{ easing }}")),(0,gl.kY)("active => removed",(0,gl.i0)("{{ easeTime }}ms {{ easing }}"))])]}});class ic{static forRoot(e={}){return{ngModule:ic,providers:[{provide:ml.lt,useValue:{default:nc,config:e}}]}}}ic.ɵfac=function(e){return new(e||ic)},ic.ɵmod=yl.$C({type:ic}),ic.ɵinj=a.G2t({imports:[tc]});const nc=Object.assign(Object.assign({},ml.H5),{toastComponent:tc,tapToDismiss:!1,timeOut:5e3,extendedTimeOut:2e3,maxOpened:5,autoDismiss:!0,progressBar:!0});class rc{}rc.ɵfac=function(e){return new(e||rc)},rc.ɵmod=yl.$C({type:rc}),rc.ɵinj=a.G2t({});class sc extends a.nKC{}class oc{}const ac=["*",[["bit-label"]],[["bit-hint"]]],lc=e=>[e];function cc(e,t){1&e&&(yl.j41(0,"span",3),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()),2&e&&(yl.R7$(),yl.SpI(" (",yl.bMT(2,1,"required"),")"))}function uc(e,t){1&e&&(yl.j41(0,"span",4),yl.SdG(1,2),yl.k0s())}function dc(e,t){if(1&e&&(yl.j41(0,"div",5),yl.nrm(1,"i",6),yl.EFF(2),yl.k0s()),2&e){const e=yl.XpG();yl.R7$(2),yl.SpI(" ",e.displayError," ")}}class hc{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(oc)}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}}hc.ɵfac=function(e){return new(e||hc)(yl.rXU(Pl))},hc.ɵcmp=yl.VBU({type:hc,selectors:[["bit-form-control"]],contentQueries:function(e,t,i){1&e&&yl.C6U(i,t.formControl,oc,5),2&e&&yl.NyB()},hostVars:2,hostBindings:function(e,t){2&e&&yl.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&&(yl.NAR(ac),yl.j41(0,"label",0),yl.SdG(1),yl.j41(2,"span",1)(3,"span",2),yl.SdG(4,1),yl.nVh(5,cc,3,3,"span",3),yl.k0s(),yl.nVh(6,uc,2,0,"span",4),yl.k0s()(),yl.nVh(7,dc,3,1,"div",5)),2&e&&(yl.Y8G("ngClass",yl.eq3(5,lc,t.formControl().disabled?"tw-cursor-auto":"tw-cursor-pointer")),yl.R7$(2),yl.Y8G("ngClass",t.formControl().disabled?"tw-text-muted":"tw-text-main"),yl.R7$(3),yl.vxM(t.required?5:-1),yl.R7$(),yl.vxM(t.hasError?-1:6),yl.R7$(),yl.vxM(t.hasError?7:-1))},dependencies:[pl.YU,Wl,Hl],encapsulation:2});const pc=["*",[["","slot","end"]]],fc=e=>({"tw-truncate":e});function vc(e,t){1&e&&yl.SdG(0,1)}function mc(e,t){1&e&&yl.eu8(0)}function gc(e,t){if(1&e&&yl.DNE(0,mc,1,0,"ng-container",2),2&e){yl.XpG();const e=yl.sdS(1);yl.Y8G("ngTemplateOutlet",e)}}function yc(e,t){1&e&&yl.eu8(0)}function bc(e,t){if(1&e&&yl.DNE(0,yc,1,0,"ng-container",2),2&e){yl.XpG();const e=yl.sdS(1);yl.Y8G("ngTemplateOutlet",e)}}let wc=0;class Sc{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-"+wc++)}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}}Sc.ɵfac=function(e){return new(e||Sc)(yl.rXU(yl.aKT),yl.rXU(hc,8))},Sc.ɵcmp=yl.VBU({type:Sc,selectors:[["bit-label"]],hostVars:4,hostBindings:function(e,t){2&e&&(yl.Avn("id",t.id())("title",t.title),yl.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&&(yl.NAR(pc),yl.DNE(0,vc,1,0,"ng-template",null,0,yl.C5r),yl.j41(2,"span",1),yl.SdG(3),yl.nVh(4,gc,1,1,"ng-container"),yl.k0s(),yl.nVh(5,bc,1,1,"ng-container")),2&e&&(yl.R7$(2),yl.Y8G("ngClass",yl.eq3(3,fc,!t.isInsideFormControl)),yl.R7$(2),yl.vxM(t.isInsideFormControl?4:-1),yl.R7$(),yl.vxM(t.isInsideFormControl?-1:5))},dependencies:[pl.MD,pl.YU,pl.T3],encapsulation:2});class kc{}kc.ɵfac=function(e){return new(e||kc)},kc.ɵmod=yl.$C({type:kc}),kc.ɵinj=a.G2t({imports:[Sc]});let Ic=0;class Cc{constructor(e){this.ngControl=e,this.id=(0,o.hFB)("bit-radio-input-"+Ic++),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(fl.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]]}}Cc.ɵfac=function(e){return new(e||Cc)(yl.rXU(fl.vO,10))},Cc.ɵcmp=yl.VBU({type:Cc,selectors:[["input","type","radio","bitRadio",""]],hostVars:4,hostBindings:function(e,t){2&e&&(yl.Avn("id",t.id())("disabled",t.disabled),yl.HbH(t.inputClasses))},inputs:{id:[1,"id"],disabledInput:[1,"disabled","disabledInput"]},features:[yl.Jv_([{provide:oc,useExisting:Cc}])],attrs:["type","radio","bitRadio",""],decls:0,vars:0,template:function(e,t){},encapsulation:2});const Tc=[[["bit-label"]],"*",[["bit-hint"]]];function Pc(e,t){1&e&&(yl.j41(0,"span",2),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()),2&e&&(yl.R7$(),yl.SpI(" (",yl.bMT(2,1,"required"),")"))}function Fc(e,t){1&e&&yl.eu8(0)}function Rc(e,t){if(1&e&&(yl.j41(0,"fieldset")(1,"legend",1),yl.SdG(2),yl.nVh(3,Pc,3,3,"span",2),yl.k0s(),yl.DNE(4,Fc,1,0,"ng-container",3),yl.k0s()),2&e){const e=yl.XpG(),t=yl.sdS(3);yl.R7$(3),yl.vxM(e.required?3:-1),yl.R7$(),yl.Y8G("ngTemplateOutlet",t)}}function xc(e,t){1&e&&yl.eu8(0)}function Ac(e,t){if(1&e&&yl.DNE(0,xc,1,0,"ng-container",3),2&e){yl.XpG();const e=yl.sdS(3);yl.Y8G("ngTemplateOutlet",e)}}function Dc(e,t){1&e&&(yl.j41(0,"div"),yl.SdG(1,1),yl.k0s(),yl.SdG(2,2,["ngProjectAs","bit-hint",5,["bit-hint"]]))}let Ec=0;class $c{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-"+Ec++),this.classList=["tw-block","tw-mb-4"],this.label=(0,o.sbv)(Sc),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(fl.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)}}$c.ɵfac=function(e){return new(e||$c)(yl.rXU(fl.vO,10))},$c.ɵcmp=yl.VBU({type:$c,selectors:[["bit-radio-group"]],contentQueries:function(e,t,i){1&e&&yl.C6U(i,t.label,Sc,5),2&e&&yl.NyB()},hostVars:4,hostBindings:function(e,t){2&e&&(yl.Avn("id",t.id()),yl.BMQ("role",t.role),yl.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&&(yl.NAR(Tc),yl.nVh(0,Rc,5,2,"fieldset"),yl.nVh(1,Ac,1,1,"ng-container"),yl.DNE(2,Dc,3,0,"ng-template",null,0,yl.C5r)),2&e&&(yl.vxM(t.label()?0:-1),yl.R7$(),yl.vxM(t.label()?-1:1))},dependencies:[pl.T3,Hl],encapsulation:2});const Oc=[[["bit-label"]],[["bit-hint"]]];let Uc=0;class Mc{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-"+Uc++),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()}}Mc.ɵfac=function(e){return new(e||Mc)(yl.rXU($c))},Mc.ɵcmp=yl.VBU({type:Mc,selectors:[["bit-radio-button"]],hostVars:3,hostBindings:function(e,t){2&e&&(yl.Avn("id",t.id()),yl.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&&(yl.NAR(Oc),yl.j41(0,"bit-form-control",0)(1,"input",1),yl.bIt("change",function(){return t.onInputChange()})("blur",function(){return t.onBlur()}),yl.k0s(),yl.SdG(2,0,["ngProjectAs","bit-label",5,["bit-label"]]),yl.SdG(3,1,["ngProjectAs","bit-hint",5,["bit-hint"]]),yl.k0s()),2&e&&(yl.Y8G("inline",!t.block),yl.R7$(),yl.Y8G("id",t.inputId)("disabled",t.groupDisabled||t.disabled())("value",t.value())("checked",t.selected))},dependencies:[kc,hc,Cc],encapsulation:2});class Nc{}Nc.ɵfac=function(e){return new(e||Nc)},Nc.ɵmod=yl.$C({type:Nc}),Nc.ɵinj=a.G2t({imports:[kc,Mc,kc]});class Vc{}Vc.ɵfac=function(e){return new(e||Vc)},Vc.ɵmod=yl.$C({type:Vc}),Vc.ɵinj=a.G2t({});var Bc=i(39180),jc=i(97658);const Gc=e=>({"tw-truncate tw-block":e}),Lc={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 _c{constructor(){this.el=(0,a.WQX)(yl.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,bl.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(Lc[this.variant()]).concat(this.hasHoverEffects?[...zc[this.variant()],"tw-min-w-10"]:[]).concat(this.truncate()?this.maxWidthClass():[])),this.titleAttr=(0,bl.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}}_c.ɵfac=function(e){return new(e||_c)},_c.ɵcmp=yl.VBU({type:_c,selectors:[["span","bitBadge",""],["a","bitBadge",""],["button","bitBadge",""]],hostVars:3,hostBindings:function(e,t){2&e&&(yl.BMQ("title",t.titleAttr()),yl.HbH(t.classList()))},inputs:{title:[1,"title"],variant:[1,"variant"],truncate:[1,"truncate"],maxWidthClass:[1,"maxWidthClass"]},features:[yl.Jv_([{provide:Cl,useExisting:_c}])],attrs:["bitBadge",""],ngContentSelectors:["*"],decls:2,vars:3,consts:[[3,"ngClass"]],template:function(e,t){1&e&&(yl.NAR(),yl.j41(0,"span",0),yl.SdG(1),yl.k0s()),2&e&&yl.Y8G("ngClass",yl.eq3(1,Gc,t.truncate()))},dependencies:[pl.MD,pl.YU],encapsulation:2,changeDetection:0});class Kc{}Kc.ɵfac=function(e){return new(e||Kc)},Kc.ɵmod=yl.$C({type:Kc}),Kc.ɵinj=a.G2t({imports:[_c]});class Xc{}function qc(e,t){1&e&&yl.nrm(0,"bit-spinner")}function Yc(e,t){if(1&e&&yl.nrm(0,"i",8),2&e){const e=yl.XpG().item;yl.HbH(yl.VkB("bwi bwi-fw ",e.icon))}}function Wc(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",4),yl.bIt("click",function(){const t=a.eBV(e),i=t.item,n=t.clear;return a.Njj(n(i))}),yl.nVh(1,Yc,1,3,"i",5),yl.j41(2,"span",6),yl.EFF(3),yl.k0s(),yl.nrm(4,"i",7),yl.k0s()}if(2&e){const e=t.item,i=yl.XpG();yl.Y8G("disabled",i.disabled),yl.R7$(),yl.vxM(null!=e.icon?1:-1),yl.R7$(2),yl.SpI(" ",e.labelName," ")}}function Hc(e,t){1&e&&yl.nrm(0,"i",11)}function Jc(e,t){if(1&e&&yl.nrm(0,"i",8),2&e){const e=yl.XpG().item;yl.HbH(yl.VkB("bwi bwi-fw ",e.icon))}}function Zc(e,t){if(1&e&&(yl.j41(0,"div",9)(1,"div",10),yl.nVh(2,Hc,1,0,"i",11),yl.k0s(),yl.j41(3,"div",12),yl.nVh(4,Jc,1,3,"i",5),yl.k0s(),yl.j41(5,"div",13),yl.EFF(6),yl.k0s()()),2&e){const e=t.item,i=yl.XpG();yl.R7$(2),yl.vxM(i.isSelected(e)?2:-1),yl.R7$(2),yl.vxM(null!=e.icon?4:-1),yl.R7$(2),yl.SpI(" ",e.listName," ")}}let Qc=0;class eu{constructor(e,t){this.i18nService=e,this.ngControl=t,this.select=o.ebz.required(jc.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-"+Qc++,this.onItemsConfirmed=new yl.bkB,this.keyDown=e=>{const t=this.select();return!(!t.isOpen()&&"Enter"===e.key&&!(0,Bc.rp)(e))&&(!(t.isOpen()&&"Escape"===e.key&&!(0,Bc.rp)(e))||(this.selectedItems=[],t.close(),e.stopPropagation(),!1))},this.id=(0,o.hFB)("bit-multi-select-"+Qc++),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(fl.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]]}}eu.ɵfac=function(e){return new(e||eu)(yl.rXU(Pl),yl.rXU(fl.vO,10))},eu.ɵcmp=yl.VBU({type:eu,selectors:[["bit-multi-select"]],viewQuery:function(e,t){1&e&&yl.wEZ(t.select,jc.vr,5),2&e&&yl.NyB()},hostVars:3,hostBindings:function(e,t){2&e&&(yl.Avn("id",t.id()),yl.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:[yl.Jv_([{provide:Xc,useExisting:eu}])],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&&(yl.j41(0,"ng-select",0),yl.nI1(1,"i18n"),yl.nI1(2,"i18n"),yl.mxI("ngModelChange",function(e){return yl.DH7(t.selectedItems,e)||(t.selectedItems=e),e}),yl.bIt("ngModelChange",function(e){return t.onChange(e)})("blur",function(){return t.onBlur()})("close",function(){return t.onDropdownClosed()}),yl.DNE(3,qc,1,0,"ng-template",1)(4,Wc,5,3,"ng-template",2)(5,Zc,7,3,"ng-template",3),yl.k0s()),2&e&&(yl.Y8G("notFoundText",yl.mNQ(yl.bMT(1,15,"multiSelectNotFound")))("clearAllText",yl.mNQ(yl.bMT(2,17,"multiSelectClearAll")))("items",t.baseItems()),yl.R50("ngModel",t.selectedItems),yl.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:[jc.MQ,jc.vr,jc.Uq,jc.ZZ,jc.QQ,fl.X1,fl.BC,fl.YN,fl.vS,Kc,_c,Rl,Hl],encapsulation:2});class tu{}tu.ɵfac=function(e){return new(e||tu)},tu.ɵmod=yl.$C({type:tu}),tu.ɵinj=a.G2t({imports:[eu]});let iu=0;class nu{constructor(){this.id="bit-hint-"+iu++}}nu.ɵfac=function(e){return new(e||nu)},nu.ɵdir=yl.FsC({type:nu,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&&yl.Avn("id",t.id)}});let ru=0;function su(e){return["tw-border","!tw-border-solid",e?"tw-border-danger-600":"tw-border-secondary-500","focus:tw-outline-none"]}class ou{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(...su(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(fl.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-"+ru++),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"]}}ou.ɵfac=function(e){return new(e||ou)(yl.rXU(fl.vO,10),yl.rXU(yl.SKi),yl.rXU(yl.aKT),yl.rXU(Du,8))},ou.ɵdir=yl.FsC({type:ou,selectors:[["input","bitInput",""],["select","bitInput",""],["textarea","bitInput",""]],hostVars:8,hostBindings:function(e,t){1&e&&yl.bIt("input",function(){return t.onInput()}),2&e&&(yl.Avn("id",t.id())("required",t.required),yl.BMQ("type",t.type())("spellcheck",t.spellcheck())("aria-describedby",t.ariaDescribedBy)("aria-invalid",t.ariaInvalid),yl.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:[yl.Jv_([{provide:Xc,useExisting:ou}])]});let au=0;class lu{constructor(e){this.i18nService=e,this.id="bit-error-"+au++,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}}}lu.ɵfac=function(e){return new(e||lu)(yl.rXU(Pl))},lu.ɵcmp=yl.VBU({type:lu,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&&yl.Avn("id",t.id)},inputs:{error:[1,"error"]},decls:2,vars:1,consts:[[1,"bwi","bwi-error"]],template:function(e,t){1&e&&(yl.Hgh(0,"i",0),yl.EFF(1)),2&e&&(yl.R7$(),yl.SpI(" ",t.displayError))},encapsulation:2});const cu=["prefixContainer"],uu=["suffixContainer"],du=["*",[["bit-label"]],[["","bitPrefix",""]],[["","bitSuffix",""]],[["bit-hint"]]],hu=(e,t)=>[e,t],pu=(e,t)=>({"tw-border-secondary-300/50 tw-border-b tw-pb-[2px]":e,"tw-border-transparent tw-pb-[3px]":t});function fu(e,t){1&e&&yl.SdG(0)}function vu(e,t){1&e&&yl.SdG(0,1)}function mu(e,t){1&e&&yl.SdG(0,2)}function gu(e,t){1&e&&yl.SdG(0,3)}function yu(e,t){1&e&&yl.eu8(0)}function bu(e,t){1&e&&(yl.j41(0,"span",15),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()),2&e&&(yl.R7$(),yl.SpI(" (",yl.bMT(2,1,"required"),")"))}function wu(e,t){1&e&&yl.eu8(0)}function Su(e,t){1&e&&yl.eu8(0)}function ku(e,t){1&e&&yl.eu8(0)}function Iu(e,t){if(1&e&&(yl.j41(0,"div",6)(1,"div",9)(2,"div",10),yl.nrm(3,"div",11),yl.j41(4,"div",12)(5,"label",13),yl.DNE(6,yu,1,0,"ng-container",14),yl.nVh(7,bu,3,3,"span",15),yl.k0s()(),yl.nrm(8,"div",16),yl.k0s()(),yl.j41(9,"div",17)(10,"div",18,4),yl.DNE(12,wu,1,0,"ng-container",14),yl.k0s(),yl.j41(13,"div",19),yl.DNE(14,Su,1,0,"ng-container",14),yl.k0s(),yl.j41(15,"div",20,5),yl.DNE(17,ku,1,0,"ng-container",14),yl.k0s()()()),2&e){const e=yl.XpG(),t=yl.sdS(1),i=yl.sdS(3),n=yl.sdS(5),r=yl.sdS(7);yl.R7$(3),yl.Y8G("ngClass",e.inputBorderClasses),yl.R7$(),yl.Y8G("ngClass",e.inputBorderClasses),yl.R7$(),yl.BMQ("for",e.input().labelForId),yl.R7$(),yl.Y8G("ngTemplateOutlet",i),yl.R7$(),yl.vxM(e.input().required?7:-1),yl.R7$(),yl.Y8G("ngClass",e.inputBorderClasses),yl.R7$(2),yl.Y8G("hidden",!e.prefixHasChildren()),yl.R7$(2),yl.Y8G("ngTemplateOutlet",n),yl.R7$(),yl.Y8G("ngClass",yl.l_i(12,hu,e.prefixHasChildren()?"":"tw-rounded-s-lg tw-ps-3",e.suffixHasChildren()?"":"tw-rounded-e-lg tw-pe-3")),yl.R7$(),yl.Y8G("ngTemplateOutlet",t),yl.R7$(),yl.Y8G("hidden",!e.suffixHasChildren()),yl.R7$(2),yl.Y8G("ngTemplateOutlet",r)}}function Cu(e,t){1&e&&yl.eu8(0)}function Tu(e,t){1&e&&yl.eu8(0)}function Pu(e,t){1&e&&yl.eu8(0)}function Fu(e,t){1&e&&yl.eu8(0)}function Ru(e,t){if(1&e&&(yl.j41(0,"div",7)(1,"label",21),yl.DNE(2,Cu,1,0,"ng-container",14),yl.k0s(),yl.j41(3,"div",22)(4,"div",23,4),yl.DNE(6,Tu,1,0,"ng-container",14),yl.k0s(),yl.j41(7,"div",24),yl.DNE(8,Pu,1,0,"ng-container",14),yl.k0s(),yl.j41(9,"div",25,5),yl.DNE(11,Fu,1,0,"ng-container",14),yl.k0s()()()),2&e){const e=yl.XpG(),t=yl.sdS(1),i=yl.sdS(3),n=yl.sdS(5),r=yl.sdS(7);yl.R7$(),yl.BMQ("for",e.input().labelForId),yl.R7$(),yl.Y8G("ngTemplateOutlet",i),yl.R7$(),yl.Y8G("ngClass",yl.l_i(8,pu,!e.disableReadOnlyBorder,e.disableReadOnlyBorder)),yl.R7$(),yl.Y8G("hidden",!e.prefixHasChildren()),yl.R7$(2),yl.Y8G("ngTemplateOutlet",n),yl.R7$(2),yl.Y8G("ngTemplateOutlet",t),yl.R7$(),yl.Y8G("hidden",!e.suffixHasChildren()),yl.R7$(2),yl.Y8G("ngTemplateOutlet",r)}}function xu(e,t){1&e&&yl.SdG(0,4)}function Au(e,t){if(1&e&&yl.nrm(0,"bit-error",8),2&e){const e=yl.XpG();yl.Y8G("error",e.input().error)}}class Du{constructor(){this.input=o.sbv.required(Xc),this.hint=(0,o.sbv)(nu),this.label=(0,o.sbv)(Sc),this.prefixContainer=(0,o.ebz)("prefixContainer"),this.suffixContainer=(0,o.ebz)("suffixContainer"),this.error=(0,o.ebz)(lu),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 su(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)}}Du.ɵfac=function(e){return new(e||Du)},Du.ɵcmp=yl.VBU({type:Du,selectors:[["bit-form-field"]],contentQueries:function(e,t,i){1&e&&(yl.C6U(i,t.input,Xc,5),yl.C6U(i,t.hint,nu,5),yl.C6U(i,t.label,Sc,5)),2&e&&yl.NyB(3)},viewQuery:function(e,t){1&e&&(yl.wEZ(t.prefixContainer,cu,5),yl.wEZ(t.suffixContainer,uu,5),yl.wEZ(t.error,lu,5)),2&e&&yl.NyB(3)},hostVars:2,hostBindings:function(e,t){1&e&&yl.bIt("focusin",function(e){return t.onFocusIn(e.target)})("focusout",function(){return t.onFocusOut()}),2&e&&yl.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&&(yl.NAR(du),yl.DNE(0,fu,1,0,"ng-template",null,0,yl.C5r)(2,vu,1,0,"ng-template",null,1,yl.C5r)(4,mu,1,0,"ng-template",null,2,yl.C5r)(6,gu,1,0,"ng-template",null,3,yl.C5r),yl.nVh(8,Iu,18,15,"div",6)(9,Ru,12,11,"div",7),yl.nVh(10,xu,1,0)(11,Au,1,1,"bit-error",8)),2&e){let e;yl.R7$(8),yl.vxM(t.readOnly?9:8),yl.R7$(2),yl.vxM(!1===(e=t.input().hasError)?10:!0===e?11:-1)}},dependencies:[pl.MD,pl.YU,pl.T3,lu,Hl],encapsulation:2});class Eu{}Eu.ɵfac=function(e){return new(e||Eu)},Eu.ɵmod=yl.$C({type:Eu}),Eu.ɵinj=a.G2t({imports:[kc,Vc,tu,Du,kc,Vc,tu]});function $u(e,t){1&e&&yl.SdG(0)}class Ou{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 Uu(e,t){if(1&e&&yl.nrm(0,"i",6),2&e){const e=yl.XpG().item;yl.HbH(yl.VkB("bwi bwi-fw ",e.icon))}}function Mu(e,t){if(1&e&&(yl.j41(0,"div",2)(1,"div",3),yl.nVh(2,Uu,1,3,"i",4),yl.k0s(),yl.j41(3,"div",5),yl.EFF(4),yl.k0s()()),2&e){const e=t.item;yl.Y8G("title",e.label),yl.R7$(2),yl.vxM(null!=e.icon?2:-1),yl.R7$(2),yl.SpI(" ",e.label," ")}}Ou.ɵfac=function(e){return new(e||Ou)},Ou.ɵcmp=yl.VBU({type:Ou,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&&(yl.NAR(),yl.PeT(0,$u,1,0,"ng-template"))},encapsulation:2});let Nu=0;class Vu{constructor(e,t){this.i18nService=e,this.ngControl=t,this.select=o.ebz.required(jc.vr),this.items=(0,o.geq)(),this.placeholder=(0,o.hFB)(this.i18nService.t("selectPlaceholder")),this.closed=new yl.bkB,this.selectedValue=(0,a.vPA)(void 0),this.selectedOption=(0,bl.EW)(()=>this.findSelectedOption(this.items(),this.selectedValue())),this.searchInputId="bit-select-search-input-"+Nu++,this.classes=["tw-block","tw-w-full","tw-h-full"],this.id=(0,o.hFB)("bit-multi-select-"+Nu++),this.onKeyDown=e=>(this.select().isOpen()&&"Escape"===e.key&&!(0,Bc.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(fl.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()}}Vu.ɵfac=function(e){return new(e||Vu)(yl.rXU(Pl),yl.rXU(fl.vO,10))},Vu.ɵcmp=yl.VBU({type:Vu,selectors:[["bit-select"]],contentQueries:function(e,t,i){if(1&e&&yl.wni(i,Ou,4),2&e){let e;yl.mGM(e=yl.lsd())&&(t.options=e)}},viewQuery:function(e,t){1&e&&yl.wEZ(t.select,jc.vr,5),2&e&&yl.NyB()},hostVars:6,hostBindings:function(e,t){2&e&&(yl.Avn("id",t.id()),yl.BMQ("disabled",t.disabledAttr)("aria-describedby",t.ariaDescribedBy)("required",t.required),yl.HbH(t.classes))},inputs:{items:[1,"items"],placeholder:[1,"placeholder"],disabled:"disabled",id:[1,"id"],required:"required"},outputs:{items:"itemsChange",closed:"closed"},features:[yl.Jv_([{provide:Xc,useExisting:Vu}])],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&&(yl.j41(0,"ng-select",0),yl.bIt("ngModelChange",function(e){return t.onChange(e)})("blur",function(){return t.onBlur()})("close",function(){return t.onClose()}),yl.DNE(1,Mu,5,3,"ng-template",1),yl.k0s()),2&e){let e;yl.Y8G("ngModel",t.selectedOption())("disabled",t.disabled)("placeholder",t.placeholder())("items",t.items())("labelForId",t.labelForId)("clearable",!1)("keyDownFn",t.onKeyDown),yl.BMQ("aria-label",null!==(i=null==(e=t.selectedOption())?null:e.label)&&void 0!==i?i:t.placeholder())}},dependencies:[jc.MQ,jc.vr,jc.Uq,fl.X1,fl.BC,fl.YN,fl.vS],encapsulation:2});class Bu{}Bu.ɵfac=function(e){return new(e||Bu)},Bu.ɵmod=yl.$C({type:Bu}),Bu.ɵinj=a.G2t({imports:[Vu]});const ju=e=>({"tw-invisible":e});function Gu(e,t){1&e&&(yl.j41(0,"span",2),yl.nrm(1,"bit-spinner",3),yl.k0s())}const Lu=["focus-visible:tw-ring-2","focus-visible:tw-ring-offset-2","focus-visible:tw-ring-primary-600","focus-visible:tw-z-10"],zu={small:["tw-py-1","tw-px-3","tw-text-sm"],default:["tw-py-1.5","tw-px-3"]},_u={primary:["tw-border-primary-600","tw-bg-primary-600","!tw-text-contrast","hover:tw-bg-primary-700","hover:tw-border-primary-700",...Lu],secondary:["tw-bg-transparent","tw-border-primary-600","!tw-text-primary-600","hover:tw-bg-hover-default",...Lu],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",...Lu],dangerPrimary:["tw-border-danger-600","tw-bg-danger-600","!tw-text-contrast","hover:tw-bg-danger-700","hover:tw-border-danger-700",...Lu],unstyled:[]};class Ku{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(_u[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(zu[this.size()||"default"])}constructor(){this.disabledAttr=(0,bl.EW)(()=>null!=this.disabled()&&!1!==this.disabled()||this.loading()),this.showDisabledStyles=(0,bl.EW)(()=>this.showLoadingStyle()||this.disabledAttr()&&!1===this.loading()),this.buttonType=(0,o.hFB)("secondary"),this.size=(0,o.hFB)("default"),this.block=(0,o.hFB)(!1,{transform:o.L39}),this.loading=(0,o.geq)(!1),this.showLoadingStyle=(0,wl.ot)((0,wl.br)(this.loading).pipe((0,Sl.s)(e=>(0,Zo.Y)(e?75:0)))),this.disabled=(0,o.geq)(!1),this.el=(0,a.WQX)(yl.aKT),Ml(this.el.nativeElement,this.disabledAttr)}}Ku.ɵfac=function(e){return new(e||Ku)},Ku.ɵcmp=yl.VBU({type:Ku,selectors:[["button","bitButton",""],["a","bitButton",""]],hostVars:2,hostBindings:function(e,t){2&e&&yl.HbH(t.classList)},inputs:{buttonType:[1,"buttonType"],size:[1,"size"],block:[1,"block"],loading:[1,"loading"],disabled:[1,"disabled"]},outputs:{loading:"loadingChange",disabled:"disabledChange"},features:[yl.Jv_([{provide:Il,useExisting:Ku}]),yl.nM4([Vl])],attrs:["bitButton",""],ngContentSelectors:["*"],decls:4,vars:4,consts:[[1,"tw-relative"],[3,"ngClass"],[1,"tw-absolute","tw-inset-0","tw-flex","tw-items-center","tw-justify-center"],["size","fill","noColor",""]],template:function(e,t){1&e&&(yl.NAR(),yl.j41(0,"span",0)(1,"span",1),yl.SdG(2),yl.k0s(),yl.nVh(3,Gu,2,0,"span",2),yl.k0s()),2&e&&(yl.R7$(),yl.Y8G("ngClass",yl.eq3(2,ju,t.showLoadingStyle())),yl.R7$(2),yl.vxM(t.showLoadingStyle()?3:-1))},dependencies:[pl.YU,Rl],encapsulation:2});class Xu{}Xu.ɵfac=function(e){return new(e||Xu)},Xu.ɵmod=yl.$C({type:Xu}),Xu.ɵinj=a.G2t({imports:[Ku]});const qu=e=>[e],Yu=(e,t)=>[e,t];function Wu(e,t){if(1&e&&yl.nrm(0,"i",1),2&e){yl.XpG();const e=yl.r8f(1),t=yl.r8f(2);yl.Y8G("ngClass",yl.l_i(1,Yu,t,e?"tw-top-[3px] tw-self-start":"tw-top-[1px]"))}}function Hu(e,t){if(1&e&&(yl.j41(0,"header",3),yl.EFF(1),yl.k0s()),2&e){const e=yl.XpG(),t=yl.r8f(1);yl.Y8G("id",yl.mNQ(e.titleId)),yl.R7$(),yl.SpI(" ",t," ")}}const Ju={success:"bwi-check-circle",info:"bwi-info-circle",warning:"bwi-exclamation-triangle",danger:"bwi-error",default:"bwi-star"},Zu={warning:"warning",danger:"error"};let Qu=0;class ed{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,bl.EW)(()=>void 0===this.icon()?Ju[this.type()]:this.icon()),this.titleComputed=(0,bl.EW)(()=>{const e=this.title();if(null===e)return;const t=this.type();return null==e&&null!=Zu[t]?this.i18nService.t(Zu[t]):e}),this.titleId="bit-callout-title-"+Qu++,this.calloutClass=(0,bl.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"}})}}ed.ɵfac=function(e){return new(e||ed)(yl.rXU(Pl))},ed.ɵcmp=yl.VBU({type:ed,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&&(yl.NAR(),yl.j41(0,"aside",0),yl.SS7(1)(2),yl.nVh(3,Wu,1,4,"i",1),yl.j41(4,"div",2),yl.nVh(5,Hu,2,3,"header",3),yl.j41(6,"div",4),yl.SdG(7),yl.k0s()()()),2&e){yl.Y8G("ngClass",yl.eq3(6,qu,t.calloutClass())),yl.BMQ("aria-labelledby",t.titleId),yl.R7$();const e=yl.bH3(t.titleComputed());yl.R7$();const i=yl.bH3(t.iconComputed());yl.R7$(),yl.vxM(i?3:-1),yl.R7$(2),yl.vxM(e?5:-1)}},dependencies:[Kl,pl.YU,Xl,Wl],encapsulation:2});class td{}td.ɵfac=function(e){return new(e||td)},td.ɵmod=yl.$C({type:td}),td.ɵinj=a.G2t({imports:[ed]});class id{}id.ɵfac=function(e){return new(e||id)},id.ɵmod=yl.$C({type:id}),id.ɵinj=a.G2t({});var nd=i(81525),rd=i(79026),sd=i(12610),od=i(50037),ad=i(79243);const ld=(e,t,i=1)=>((e,t)=>new ea.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,sd.Z)(null),(0,od.Z)(0,rd.X),(0,ad.Q)(rd.X),(0,l.T)(t=>t?!t.isIntersecting:e.scrollHeight>e.clientHeight),(0,lo.F)());var cd,ud=i(23649);class dd{}!function(e){e[e.LoggedOut=0]="LoggedOut",e[e.Locked=1]="Locked",e[e.Unlocked=2]="Unlocked"}(cd||(cd={}));class hd{constructor(){this._portal=(0,a.vPA)(void 0),this.portal=this._portal.asReadonly()}open(e){this._portal.set(e)}close(e){e===this.portal()&&this._portal.set(void 0)}}hd.ɵfac=function(e){return new(e||hd)},hd.ɵprov=a.jDH({token:hd,factory:hd.ɵfac,providedIn:"root"});const pd={sm:640,md:768,lg:1024,xl:1280,"2xl":1536};var fd=i(16878),vd=i(75811),md=i(55318),gd=i(58803),yd=i(97763),bd=i(90934),wd=i(45202);const Sd="undefined"==typeof self?i(10967):null;class kd{static init(){kd.inited||(kd.inited=!0,kd.isNode=void 0!==wd&&null!=wd.release&&"node"===wd.release.name,kd.isBrowser="undefined"!=typeof window,kd.isMobileBrowser=kd.isBrowser&&this.isMobile(window),kd.isAppleMobileBrowser=kd.isBrowser&&this.isAppleMobile(window),kd.isNode?kd.global=i.g:kd.isBrowser?kd.global=window:kd.global=self)}static fromB64ToArray(e){if(null==e)return null;if(kd.isNode)return new Uint8Array(Buffer.from(e,"base64"));{const t=kd.global.atob(e),i=new Uint8Array(t.length);for(let e=0;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{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}static isGuid(e){return RegExp(kd.guidRegex,"i").test(e)}static getHostname(e){if(kd.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,bd.EW)(e,{validHosts:this.validHosts});if(null!=t)return t}catch(e){return null}return null}static getHost(e){const t=kd.getUrl(e);try{return null!=t&&""!==t.host?t.host:null}catch(e){return null}}static getDomain(e){if(kd.isNullOrWhitespace(e))return null;if((e=e.trim()).startsWith("data:"))return null;if(e.startsWith("about:"))return null;try{const t=(0,bd.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=kd.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(),kd.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>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 gd.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,Oo.of)(void 0).pipe((0,co.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!=Sd?new Sd.URL(e):new URL(e)}catch(e){}return null}}function Id(e){let t;try{t=e()}catch(e){return(0,fo.$)(()=>e)}return kd.isPromise(t)?(0,md.H)(t):t instanceof ea.c?t:(0,Oo.of)(t)}kd.inited=!1,kd.isNode=!1,kd.isBrowser=!0,kd.isMobileBrowser=!1,kd.isAppleMobileBrowser=!1,kd.global=null,kd.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,kd.validHosts=["localhost"],kd.originalMinimumPasswordLength=8,kd.minimumPasswordLength=12,kd.DomainMatchBlacklist=new Map([["google.com",new Set(["script.google.com"])]]),kd.guidRegex=/^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/,kd.init();class Cd{}class Td{constructor(e,t,i){this.formGroupDirective=e,this.destroyRef=(0,a.WQX)(a.abz),this._loading$=new fd.t(!1),this._disabled$=new fd.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,To.p)(()=>!this.disabled),(0,co.n)(()=>{const e=Id(this.handler());return this.loading=!0,e.pipe((0,vd.W)(e=>(null==i||i.error(`Async submit exception: ${e}`),null==t||t.showError(e),(0,Oo.of)(void 0))))}),(0,wl.pQ)()).subscribe({next:()=>this.loading=!1,complete:()=>this.loading=!1})}ngOnInit(){var e;null===(e=this.formGroupDirective.statusChanges)||void 0===e||e.pipe((0,wl.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)}}Td.ɵfac=function(e){return new(e||Td)(yl.rXU(fl.j4),yl.rXU(Cd,8),yl.rXU(za,8))},Td.ɵdir=yl.FsC({type:Td,selectors:[["","formGroup","","bitSubmit",""]],inputs:{handler:[1,"bitSubmit","handler"],allowDisabledFormSubmit:[1,"allowDisabledFormSubmit"]}});var Pd=i(96070),Fd=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 Rd{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 fd.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 Fd(this,void 0,void 0,function*(){!this.handler()||this.loading||this.disabled||this.buttonComponent.disabled()||(this.loading=!0,Id(this.handler()).pipe((0,Fo.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,Pd.j)(()=>this.loading=!1),(0,wl.pQ)(this.destroyRef)).subscribe())})}}Rd.ɵfac=function(e){return new(e||Rd)(yl.rXU(Il),yl.rXU(Cd,8),yl.rXU(za,8))},Rd.ɵdir=yl.FsC({type:Rd,selectors:[["","bitAction",""]],hostBindings:function(e,t){1&e&&yl.bIt("click",function(){return t.onClick()})},inputs:{handler:[1,"bitAction","handler"]},outputs:{handler:"bitActionChange"}});class xd{constructor(e,t,i){this.type=(0,o.hFB)(),this.disabled=(0,o.hFB)(),t&&e&&(t.loading$.pipe((0,wl.pQ)()).subscribe(t=>{"submit"===this.type()?e.loading.set(t):e.disabled.set(this.disabled()||t)}),t.disabled$.pipe((0,wl.pQ)()).subscribe(t=>{const i=this.disabled();!1!==i&&e.disabled.set(i||t)})),t&&i&&(i.loading$.pipe((0,wl.pQ)()).subscribe(e=>{t.disabled=e}),t.disabled$.pipe((0,wl.pQ)()).subscribe(e=>{i.disabled=e}))}}xd.ɵfac=function(e){return new(e||xd)(yl.rXU(Il),yl.rXU(Td,8),yl.rXU(Rd,8))},xd.ɵdir=yl.FsC({type:xd,selectors:[["button","bitFormButton",""]],inputs:{type:[1,"type"],disabled:[1,"disabled"]}});const Ad=(0,gl.hZ)("fadeIn",[(0,gl.kY)(":enter",[(0,gl.iF)({opacity:0,transform:"translateY(-50px)"}),(0,gl.Os)([(0,gl.i0)("0.15s linear",(0,gl.iF)({opacity:1})),(0,gl.i0)("0.3s ease-out",(0,gl.iF)({transform:"none"}))])])]);let Dd=0;class Ed{constructor(e){this.dialogRef=e,this.id="bit-dialog-title-"+Dd++,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)})}}Ed.ɵfac=function(e){return new(e||Ed)(yl.rXU(nd.ce,8))},Ed.ɵdir=yl.FsC({type:Ed,selectors:[["","bitDialogTitleContainer",""]],hostVars:1,hostBindings:function(e,t){2&e&&yl.Avn("id",t.id)},inputs:{simple:[1,"simple"]}});const $d=[[["","bitDialogTitle",""]],[["","bitDialogContent",""]],[["","bitDialogFooter",""]],[["","bitDialogIcon",""]]];function Od(e,t){1&e&&yl.SdG(0,3)}function Ud(e,t){1&e&&yl.nrm(0,"i",5)}function Md(e,t){if(1&e&&yl.nVh(0,Od,1,0)(1,Ud,1,0,"i",5),2&e){const e=yl.XpG();yl.vxM(e.hasIcon?0:1)}}class Nd{}Nd.ɵfac=function(e){return new(e||Nd)},Nd.ɵdir=yl.FsC({type:Nd,selectors:[["","bitDialogIcon",""]]});class Vd{constructor(){this.hideIcon=(0,o.hFB)(!1,{transform:o.L39})}get hasIcon(){return null!=this.icon}}Vd.ɵfac=function(e){return new(e||Vd)},Vd.ɵcmp=yl.VBU({type:Vd,selectors:[["bit-simple-dialog"]],contentQueries:function(e,t,i){if(1&e&&yl.wni(i,Nd,5),2&e){let e;yl.mGM(e=yl.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&&(yl.NAR($d),yl.j41(0,"div",0)(1,"div",1),yl.nVh(2,Md,2,1),yl.j41(3,"h1",2),yl.SdG(4),yl.k0s()(),yl.j41(5,"div",3),yl.SdG(6,1),yl.k0s(),yl.j41(7,"div",4),yl.SdG(8,2),yl.k0s()()),2&e&&(yl.Y8G("@fadeIn",void 0),yl.R7$(2),yl.vxM(t.hideIcon()?-1:2))},dependencies:[Ed,Wl],encapsulation:2,data:{animation:[Ad]}});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=yl.RV6();yl.j41(0,"button",7),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.dialogRef.close(!1))}),yl.EFF(1),yl.k0s()}if(2&e){const e=yl.XpG();yl.R7$(),yl.SpI(" ",e.cancelButtonText," ")}}const Gd={primary:"bwi-business",success:"bwi-star",info:"bwi-info-circle",warning:"bwi-exclamation-triangle",danger:"bwi-error"},Ld={primary:"tw-text-primary-600",success:"tw-text-success",info:"tw-text-info",warning:"tw-text-warning",danger:"tw-text-danger"};class zd{get iconClasses(){var e;return[null!==(e=this.simpleDialogOpts.icon)&&void 0!==e?e:Gd[this.simpleDialogOpts.type],Ld[this.simpleDialogOpts.type]]}constructor(e,t,i){this.dialogRef=e,this.i18nService=t,this.simpleDialogOpts=i,this.formGroup=new fl.gE({}),this.showCancelButton=null!==this.simpleDialogOpts.cancelButtonText,this.accept=()=>Bd(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}}zd.ɵfac=function(e){return new(e||zd)(yl.rXU(nd.ce),yl.rXU(Pl),yl.rXU(nd.Qs))},zd.ɵcmp=yl.VBU({type:zd,selectors:[["ng-component"]],decls:11,vars:8,consts:[[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&&(yl.j41(0,"form",0)(1,"bit-simple-dialog"),yl.nrm(2,"i",1),yl.j41(3,"span",2),yl.EFF(4),yl.k0s(),yl.j41(5,"div",3),yl.EFF(6),yl.k0s(),yl.qex(7,4),yl.j41(8,"button",5),yl.EFF(9),yl.k0s(),yl.nVh(10,jd,2,1,"button",6),yl.bVm(),yl.k0s()()),2&e&&(yl.Y8G("formGroup",t.formGroup)("bitSubmit",t.accept),yl.R7$(2),yl.HbH(t.iconClasses),yl.R7$(2),yl.JRh(t.title),yl.R7$(2),yl.JRh(t.content),yl.R7$(3),yl.SpI(" ",t.acceptButtonText," "),yl.R7$(),yl.vxM(t.showCancelButton?10:-1))},dependencies:[fl.X1,fl.qT,fl.cb,fl.j4,Td,Vd,Nd,Ku,xd],encapsulation:2});var _d=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 Kd{enable(){document.body.classList.add("tw-overflow-hidden")}disable(){document.body.classList.remove("tw-overflow-hidden")}attach(){}detach(){}}class Xd{}class qd extends dl.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: ${pd[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 Yd extends dl.qC{constructor(){super(),this.centerHorizontally().centerVertically()}}class Wd{constructor(e){this.drawerService=e,this.isDrawer=!0,this._closed=new go.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 Hd{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 Jd{constructor(){this.dialog=(0,a.WQX)(nd.lG),this.drawerService=(0,a.WQX)(hd),this.injector=(0,a.WQX)(a.zZn),this.router=(0,a.WQX)(ud.Ix,{optional:!0}),this.authService=(0,a.WQX)(dd,{optional:!0}),this.i18nService=(0,a.WQX)(Pl),this.backDropClasses=["tw-fixed","tw-bg-black","tw-bg-opacity-30","tw-inset-0"],this.defaultScrollStrategy=new Kd,this.activeDrawer=null,this.router&&this.authService&&this.router.events.pipe((0,To.p)(e=>e instanceof ud.wF),(0,co.n)(()=>this.authService.getAuthStatus()),(0,To.p)(e=>e!==cd.Unlocked),(0,wl.pQ)()).subscribe(()=>this.closeAll())}open(e,t){var i;const n=new Hd,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 qd,injector:r},t);return n.cdkDialogRefBase=this.dialog.open(e,s),n}openDrawer(e,t){var i;null===(i=this.activeDrawer)||void 0===i||i.close(),this.activeDrawer=new Wd(this.drawerService);const n=new xl.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 _d(this,void 0,void 0,function*(){const t=this.openSimpleDialogRef(e);return(0,ho._)(t.closed.pipe((0,l.T)(e=>!!e)))})}openSimpleDialogRef(e){return this.open(zd,{data:e,disableClose:e.disableClose,positionStrategy:new Yd})}closeAll(){return this.dialog.closeAll()}closeDrawer(){var e;return null===(e=this.activeDrawer)||void 0===e?void 0:e.close()}createInjector(e){return a.zZn.create({providers:[{provide:nd.Qs,useValue:e.data},{provide:Xd,useValue:e.dialogRef},{provide:nd.ce,useValue:e.dialogRef}],parent:this.injector})}}Jd.ɵfac=function(e){return new(e||Jd)},Jd.ɵprov=a.jDH({token:Jd,factory:Jd.ɵfac});class Zd{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())}}Zd.ɵfac=function(e){return new(e||Zd)(yl.rXU(nd.ce,8))},Zd.ɵdir=yl.FsC({type:Zd,selectors:[["","bitDialogClose",""]],hostVars:1,hostBindings:function(e,t){1&e&&yl.bIt("click",function(){return t.close()}),2&e&&yl.BMQ("disabled",t.disableClose)},inputs:{dialogResult:[1,"bitDialogClose","dialogResult"]}});const Qd=["scrollBottom"],eh=[[["","bitDialogTitle",""]],[["","bitDialogHeaderEnd",""]],[["","bitDialogContent",""]],[["","bitDialogFooter",""]]],th=(e,t)=>[e,t],ih=(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}),nh=(e,t,i)=>({"tw-min-h-60":e,"tw-bg-background":t,"tw-bg-background-alt":i}),rh=(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}),sh=(e,t)=>({"tw-border-transparent":e,"tw-border-secondary-100":t}),oh=(e,t)=>({"tw-px-6 tw-py-4":e,"tw-p-4 has-[[biticonbutton]]:tw-pe-2":t});function ah(e,t){1&e&&(yl.j41(0,"span",4),yl.EFF(1),yl.k0s()),2&e&&(yl.R7$(),yl.SpI(" ",t," "))}function lh(e,t){1&e&&(yl.nrm(0,"button",6),yl.nI1(1,"i18n")),2&e&&yl.Y8G("label",yl.bMT(1,1,"close"))}function ch(e,t){1&e&&(yl.j41(0,"div",8),yl.nrm(1,"bit-spinner"),yl.k0s())}class uh{constructor(){this.destroyRef=(0,a.WQX)(a.abz),this.scrollableBody=o.ebz.required(hl.uv),this.scrollBottom=o.ebz.required("scrollBottom"),this.dialogRef=(0,a.WQX)(Xd,{optional:!0}),this.bodyHasScrolledFrom=(e=>{const t=null!=e?e:(0,a.vPA)((0,a.WQX)(hl.uv)),i=(0,wl.br)(t).pipe((0,co.n)(e=>e.elementScrolled().pipe((0,sd.Z)(null),(0,l.T)(()=>({top:e.measureScrollOffset("top")>0,bottom:e.measureScrollOffset("bottom")>1})))));return(0,wl.ot)(i,{initialValue:{top:!1,bottom:!1}})})(this.scrollableBody),this.scrollableBody$=(0,wl.br)(this.scrollableBody),this.scrollBottom$=(0,wl.br)(this.scrollBottom),this.isScrollable$=(0,$o.z)([this.scrollableBody$,this.scrollBottom$]).pipe((0,co.n)(([e,t])=>ld(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.classes=(0,bl.EW)(()=>{var e,t;const i=(null===(e=this.dialogRef)||void 0===e?void 0:e.isDrawer)?["tw-h-full","md:tw-w-[23rem]"]:["md:tw-p-4","tw-w-screen","tw-max-h-[90vh]"],n=this.disableAnimations()||this.animationCompleted()||(null===(t=this.dialogRef)||void 0===t?void 0:t.isDrawer)?[]:"small"===this.dialogSize()?["tw-animate-slide-down"]:["tw-animate-slide-up","md:tw-animate-slide-down"];return["tw-flex","tw-flex-col","tw-w-screen",this.width,...i,...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())}get width(){switch(this.dialogSize()){case"small":return"md:tw-max-w-sm";case"large":return"md:tw-max-w-3xl";default:return"md:tw-max-w-xl"}}onAnimationEnd(){this.animationCompleted.set(!0)}}uh.ɵfac=function(e){return new(e||uh)},uh.ɵcmp=yl.VBU({type:uh,selectors:[["bit-dialog"]],viewQuery:function(e,t){1&e&&(yl.wEZ(t.scrollableBody,hl.uv,5),yl.wEZ(t.scrollBottom,Qd,5)),2&e&&yl.NyB(2)},hostVars:2,hostBindings:function(e,t){1&e&&yl.bIt("keydown.esc",function(e){return t.handleEsc(e)})("animationend",function(){return t.onAnimationEnd()}),2&e&&yl.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:20,vars:35,consts:[["scrollBottom",""],["cdkTrapFocus","","cdkTrapFocusAutoCapture","",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","","cdkFocusInitial","","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){if(1&e&&(yl.NAR(eh),yl.j41(0,"section",1)(1,"header",2)(2,"h2",3),yl.EFF(3),yl.nVh(4,ah,2,1,"span",4),yl.SdG(5),yl.k0s(),yl.j41(6,"div",5),yl.SdG(7,1),yl.nVh(8,lh,2,3,"button",6),yl.k0s()(),yl.j41(9,"div",7),yl.nVh(10,ch,2,0,"div",8),yl.j41(11,"div",9),yl.SdG(12,2),yl.nrm(13,"div",null,0),yl.k0s()(),yl.SS7(15),yl.nI1(16,"async"),yl.nrm(17,"div",10),yl.j41(18,"footer",11),yl.SdG(19,3),yl.k0s()()),2&e){let e;const i=null==t.dialogRef?null:t.dialogRef.isDrawer;yl.Y8G("ngClass",yl.l_i(12,th,t.width,i?"tw-h-full tw-border-t-0":"tw-rounded-t-xl md:tw-rounded-xl tw-shadow-lg"));const n=t.bodyHasScrolledFrom().top;yl.R7$(),yl.Y8G("ngClass",yl.ziG(15,ih,!i,i,n,!n)),yl.R7$(2),yl.SpI(" ",t.title()," "),yl.R7$(),yl.vxM((e=t.subtitle())?4:-1,e),yl.R7$(4),yl.vxM(null!=t.dialogRef&&t.dialogRef.disableClose?-1:8),yl.R7$(),yl.Y8G("ngClass",yl.sMw(20,nh,t.loading(),"default"===t.background(),"alt"===t.background())),yl.R7$(),yl.vxM(t.loading()?10:-1),yl.R7$(),yl.Y8G("ngClass",yl.ziG(24,rh,!t.disablePadding(),!t.loading(),t.loading(),"alt"===t.background()));const r=yl.bMT(16,10,t.isScrollable$),s=!t.bodyHasScrolledFrom().top&&r||t.bodyHasScrolledFrom().bottom;yl.R7$(6),yl.Y8G("ngClass",yl.l_i(29,sh,!s,s)),yl.R7$(),yl.Y8G("ngClass",yl.l_i(32,oh,i,!i))}},dependencies:[pl.MD,pl.YU,Ed,Wl,zl,Zd,ll.kB,hl.uv,Rl,pl.Jj,Hl],encapsulation:2});class dh{}dh.ɵfac=function(e){return new(e||dh)},dh.ɵmod=yl.$C({type:dh}),dh.ɵinj=a.G2t({providers:[Jd],imports:[nd.Ph,uh,nd.Ph]});var hh=i(31436);class ph{constructor(){this.scrollableRef=(0,a.vPA)(null),this.scrollableRef$=(0,wl.br)(this.scrollableRef)}}ph.ɵfac=function(e){return new(e||ph)},ph.ɵprov=a.jDH({token:ph,factory:ph.ɵfac,providedIn:"root"});class fh{constructor(){this.ref=(0,a.WQX)(yl.aKT),this.service=(0,a.WQX)(ph),this.service.scrollableRef.set(this.ref)}ngOnDestroy(){this.service.scrollableRef.set(null)}}fh.ɵfac=function(e){return new(e||fh)},fh.ɵdir=yl.FsC({type:fh,selectors:[["","bitScrollLayoutHost",""]],hostAttrs:[1,"cdk-virtual-scrollable"]});class vh extends hl.fI{constructor(){super(),this.service=(0,a.WQX)(ph),(0,bl.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,To.p)(e=>null!==e),(0,co.n)(e=>(0,hh.R)(e.nativeElement,"scroll")))}getElementRef(){return this.service.scrollableRef()}measureBoundingClientRectWithScrollOffset(e){return this.service.scrollableRef().nativeElement.getBoundingClientRect()[e]-this.measureScrollOffset(e)}}vh.ɵfac=function(e){return new(e||vh)},vh.ɵdir=yl.FsC({type:vh,selectors:[["","bitScrollLayout",""]],features:[yl.Jv_([{provide:hl.qy,useExisting:vh}]),yl.Vt3]});class mh{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]}}mh.ɵfac=function(e){return new(e||mh)},mh.ɵdir=yl.FsC({type:mh,selectors:[["tr","bitRow",""]],hostVars:2,hostBindings:function(e,t){2&e&&yl.HbH(t.classList)},inputs:{alignContent:[1,"alignContent"]}});var gh=i(93585);const yh=[[["","header",""]]],bh=e=>({$implicit:e});function wh(e,t){1&e&&yl.eu8(0)}class Sh{constructor(e){this.template=e}}Sh.ɵfac=function(e){return new(e||Sh)(yl.rXU(yl.C4Q))},Sh.ɵdir=yl.FsC({type:Sh,selectors:[["ng-template","body",""]]});class kh{constructor(){this.dataSource=(0,o.hFB)(),this.layout=(0,o.hFB)("auto"),this.templateVariable=(0,o.sbv)(Sh),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,gh.y)(e)){this._initialized=!0;const t=e.connect();this.rows$=t}}ngOnDestroy(){const e=this.dataSource();(0,gh.y)(e)&&e.disconnect()}}kh.ɵfac=function(e){return new(e||kh)},kh.ɵcmp=yl.VBU({type:kh,selectors:[["bit-table"]],contentQueries:function(e,t,i){1&e&&yl.C6U(i,t.templateVariable,Sh,5),2&e&&yl.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&&(yl.NAR(yh),yl.j41(0,"table",0)(1,"thead",1),yl.SdG(2),yl.k0s(),yl.j41(3,"tbody"),yl.DNE(4,wh,1,0,"ng-container",2),yl.k0s()()),2&e&&(yl.Y8G("ngClass",t.tableClass),yl.R7$(4),yl.Y8G("ngTemplateOutlet",t.templateVariable().template)("ngTemplateOutletContext",yl.eq3(3,bh,t.rows$)))},dependencies:[pl.MD,pl.YU,pl.T3],encapsulation:2});const Ih=[[["","header",""]]],Ch=e=>({paddingBottom:e}),Th=e=>({$implicit:e});function Ph(e,t){1&e&&yl.eu8(0)}function Fh(e,t){if(1&e&&(yl.j41(0,"tr",4),yl.DNE(1,Ph,1,0,"ng-container",5),yl.k0s()),2&e){const e=t.$implicit,i=yl.XpG();yl.R7$(),yl.Y8G("ngTemplateOutlet",i.rowDef().template)("ngTemplateOutletContext",yl.eq3(2,Th,e))}}class Rh{constructor(e){this.template=e}}Rh.ɵfac=function(e){return new(e||Rh)(yl.rXU(yl.C4Q))},Rh.ɵdir=yl.FsC({type:Rh,selectors:[["","bitRowDef",""]]});class xh extends kh{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)(Rh),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()}}xh.ɵfac=function(e){return new(e||xh)(yl.rXU(yl.SKi),yl.rXU(yl.aKT))},xh.ɵcmp=yl.VBU({type:xh,selectors:[["bit-table-scroll"]],contentQueries:function(e,t,i){1&e&&yl.C6U(i,t.rowDef,Rh,5),2&e&&yl.NyB()},inputs:{rowSize:[1,"rowSize"],trackBy:[1,"trackBy"]},features:[yl.Jv_([{provide:kh,useExisting:xh}]),yl.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&&(yl.NAR(Ih),yl.j41(0,"cdk-virtual-scroll-viewport",0)(1,"table",1)(2,"thead",2)(3,"tr"),yl.SdG(4),yl.k0s()(),yl.j41(5,"tbody"),yl.DNE(6,Fh,2,4,"tr",3),yl.k0s()()()),2&e&&(yl.Y8G("itemSize",t.rowSize())("ngStyle",yl.eq3(6,Ch,t.headerHeight+"px")),yl.R7$(),yl.Y8G("ngClass",t.tableClass),yl.R7$(5),yl.Y8G("cdkVirtualForOf",t.rows$)("cdkVirtualForTrackBy",t.trackBy())("cdkVirtualForTemplateCacheSize",0))},dependencies:[pl.MD,pl.YU,pl.T3,pl.B3,hl.d6,hl.yg,hl.E$,mh,vh],encapsulation:2});class Ah{}Ah.ɵfac=function(e){return new(e||Ah)},Ah.ɵmod=yl.$C({type:Ah}),Ah.ɵinj=a.G2t({imports:[pl.MD,hl.E9,kh,xh]});class Dh{}Dh.ɵfac=function(e){return new(e||Dh)},Dh.ɵmod=yl.$C({type:Dh}),Dh.ɵinj=a.G2t({});class Eh{}Eh.ɵfac=function(e){return new(e||Eh)},Eh.ɵmod=yl.$C({type:Eh}),Eh.ɵinj=a.G2t({});class $h{}$h.ɵfac=function(e){return new(e||$h)},$h.ɵmod=yl.$C({type:$h}),$h.ɵinj=a.G2t({});class Oh{}Oh.ɵfac=function(e){return new(e||Oh)},Oh.ɵmod=yl.$C({type:Oh}),Oh.ɵinj=a.G2t({});const Uh={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 Mh{transform(e,t){let i=Uh[t];null==i&&(i=Uh.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(" ")}}Mh.ɵfac=function(e){return new(e||Mh)},Mh.ɵpipe=yl.EJ8({name:"creditCardNumber",type:Mh,pure:!0,standalone:!1});class Nh{transform(e,t,i){return`${e} ${1===e?t:i}`}}Nh.ɵfac=function(e){return new(e||Nh)},Nh.ɵpipe=yl.EJ8({name:"pluralize",type:Nh,pure:!0});class Vh{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}))}}Vh.ɵfac=function(e){return new(e||Vh)},Vh.ɵpipe=yl.EJ8({name:"search",type:Vh,pure:!0,standalone:!1});class Bh{transform(e){return null==e||null==e.name&&null==e.email?null:null==e.name||""===e.name.trim()?e.email:e.name}}var jh,Gh,Lh,zh,_h,Kh,Xh,qh,Yh,Wh,Hh;Bh.ɵfac=function(e){return new(e||Bh)},Bh.ɵpipe=yl.EJ8({name:"userName",type:Bh,pure:!0,standalone:!1}),function(e){e[e.Default=0]="Default",e[e.BillingSync=1]="BillingSync",e[e.Scim=2]="Scim"}(jh||(jh={})),function(e){e[e.CloudBillingSync=1]="CloudBillingSync",e[e.Scim=2]="Scim"}(Gh||(Gh={})),function(e){e[e.Invited=0]="Invited",e[e.Accepted=1]="Accepted",e[e.Confirmed=2]="Confirmed",e[e.Revoked=-1]="Revoked"}(Lh||(Lh={})),function(e){e[e.Owner=0]="Owner",e[e.Admin=1]="Admin",e[e.User=2]="User",e[e.Custom=4]="Custom"}(zh||(zh={})),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"}(_h||(_h={})),function(e){e[e.Msp=0]="Msp",e[e.Reseller=1]="Reseller",e[e.BusinessUnit=2]="BusinessUnit"}(Kh||(Kh={})),function(e){e[e.Invited=0]="Invited",e[e.Accepted=1]="Accepted",e[e.Confirmed=2]="Confirmed",e[e.Revoked=-1]="Revoked"}(Xh||(Xh={})),function(e){e[e.ProviderAdmin=0]="ProviderAdmin",e[e.ServiceUser=1]="ServiceUser"}(qh||(qh={})),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"}(Yh||(Yh={})),function(e){e[e.Pending=0]="Pending",e[e.Created=1]="Created",e[e.Billable=2]="Billable"}(Wh||(Wh={}));class Jh{constructor(e){this.i18nService=e}transform(e){if(null==e)return this.i18nService.t("unknown");switch(e){case zh.Owner:return this.i18nService.t("owner");case zh.Admin:return this.i18nService.t("admin");case zh.User:return this.i18nService.t("user");case zh.Custom:return this.i18nService.t("custom")}}}Jh.ɵfac=function(e){return new(e||Jh)(yl.rXU(Pl,16))},Jh.ɵpipe=yl.EJ8({name:"userType",type:Jh,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"}(Hh||(Hh={}));const Zh={[Hh.AesCbc256_B64]:2,[Hh.AesCbc256_HmacSha256_B64]:3,[Hh.Rsa2048_OaepSha256_B64]:1,[Hh.Rsa2048_OaepSha1_B64]:1,[Hh.Rsa2048_OaepSha256_HmacSha256_B64]:2,[Hh.Rsa2048_OaepSha1_HmacSha256_B64]:2,[Hh.CoseEncrypt0]:1};var Qh,ep,tp;!function(e){e[e.Direct=0]="Direct",e[e.Azure=1]="Azure"}(Qh||(Qh={})),function(e){e[e.ServerAuthorization=1]="ServerAuthorization",e[e.LocalAuthorization=2]="LocalAuthorization"}(ep||(ep={})),function(e){e.Local="local",e.Memory="memory",e.Session="session"}(tp||(tp={}));class ip{}var np,rp,sp;!function(e){e.Both="both",e.Disk="disk",e.Memory="memory"}(np||(np={}));class op{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"}(rp||(rp={})),function(e){e.System="system",e.Light="light",e.Dark="dark"}(sp||(sp={}));const ap={System:"system",Light:"light",Dark:"dark"};var lp=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 cp="[error: cannot decrypt]";class up{constructor(e,t,i,n){null!=t?this.initFromData(e,t,i,n):this.initFromEncryptedString(e)}get ivBytes(){return null==this.iv?null:kd.fromB64ToArray(this.iv)}get macBytes(){return null==this.mac?null:kd.fromB64ToArray(this.mac)}get dataBytes(){return null==this.data?null:kd.fromB64ToArray(this.data)}toSdk(){return this.encryptedString}toJSON(){return this.encryptedString}static fromJSON(e){return null==e?null:new up(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}=up.parseEncryptedString(this.encryptedString);if(this.encryptionType=t,i.length===Zh[t])switch(t){case Hh.AesCbc256_HmacSha256_B64:this.iv=i[0],this.data=i[1],this.mac=i[2];break;case Hh.AesCbc256_B64:this.iv=i[0],this.data=i[1];break;case Hh.Rsa2048_OaepSha256_B64:case Hh.Rsa2048_OaepSha1_B64:this.data=i[0];break;case Hh.Rsa2048_OaepSha256_HmacSha256_B64:case Hh.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=Hh.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&&Zh[t]===i.length}decrypt(e){return lp(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=kd.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=cp}return this.decryptedValue})}getKeyForDecryption(e){return lp(this,void 0,void 0,function*(){const t=kd.getContainerService().getKeyService();return null!=e?yield t.getOrgKey(e):yield t.getUserKey()})}}const dp=new k(Ve,"biometricUnlockEnabled",{deserializer:e=>e,clearOn:[]}),hp=new k(Ve,"clientKeyHalf",{deserializer:e=>e,clearOn:["logout"]}),pp=m.record(Ve,"promptCancelled",{deserializer:e=>e}),fp=new k(Ve,"promptAutomatically",{deserializer:e=>e,clearOn:[]}),vp=new m(Ve,"fingerprintValidated",{deserializer:e=>e}),mp=new m(Ve,"lastProcessReload",{deserializer:e=>new Date(e)});var gp,yp,bp=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 wp{}function Sp(e){return null==e?null:new up(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"}(gp||(gp={})),function(e){e.AuthenticateWithBiometrics="authenticateWithBiometrics",e.GetBiometricsStatus="getBiometricsStatus",e.UnlockWithBiometricsForUser="unlockWithBiometricsForUser",e.GetBiometricsStatusForUser="getBiometricsStatusForUser",e.CanEnableBiometricUnlock="canEnableBiometricUnlock"}(yp||(yp={}));class kp{supportsBiometric(){throw new Error("Method not implemented.")}}class Ip extends Error{constructor(){super("Failed to decrypt the user's private key.")}}class Cp{}var Tp=i(69636),Pp=i(27442),Fp=i(96718),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())})};class xp{static fromData(e){switch(e.type){case"organization":return new Ap(e.key);case"provider":return new Dp(e.key,e.providerId);default:return null}}static isProviderEncrypted(e){return"provider"===e.toData().type}}class Ap{constructor(e){this.key=e}decrypt(e,t){return Rp(this,void 0,void 0,function*(){return yield e.decapsulateKeyUnsigned(this.encryptedOrganizationKey,t)})}get encryptedOrganizationKey(){return new up(this.key)}toData(){return{type:"organization",key:this.key}}}class Dp{constructor(e,t){this.key=e,this.providerId=t}decrypt(e,t){return Rp(this,void 0,void 0,function*(){const i=yield e.unwrapSymmetricKey(new up(this.key),t[this.providerId]);if(null==i)throw new Error("Failed to decrypt organization key");return i})}get encryptedOrganizationKey(){return new up(this.key)}toData(){return{type:"provider",key:this.key,providerId:this.providerId}}}class Ep{}var $p=i(99969),Op=i(80909),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())})};const Mp=m.record(D,"accounts",{deserializer:e=>Object.assign(Object.assign({},e),{creationDate:e.creationDate?new Date(e.creationDate):void 0})}),Np=new m(D,"activeAccountId",{deserializer:e=>e}),Vp=m.record(D,"activity",{deserializer:e=>new Date(e)}),Bp=new k(D,"verifyNewDeviceLogin",{deserializer:e=>e,clearOn:["logout"]}),jp={email:"",emailVerified:!1,name:void 0,creationDate:void 0},Gp=(0,l.T)(e=>{if(null==e)throw new Error("Null or undefined account");return e.id}),Lp=(0,l.T)(e=>{var t;return null!==(t=null==e?void 0:e.id)&&void 0!==t?t:null});var 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{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 up(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 zp(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 Kp extends _p{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 Kp;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 Xp{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 Xp,e)}}class qp extends _p{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 qp(new Xp(e))}static fromListResponse(e){return e.data.map(e=>qp.fromResponse(e))}}class Yp extends _p{constructor(){super(...arguments),this.autoEnrollEnabled=!1}}const Wp=k.record(P,"policies",{deserializer:e=>e,clearOn:["logout"]});var 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=(0,l.T)(e=>{var t;return null!==(t=e.at(0))&&void 0!==t?t:void 0});var Zp;!function(e){e.Lock="lock",e.LogOut="logOut"}(Zp||(Zp={}));const Qp="never",ef="onRestart",tf="onLocked",nf="onSleep",rf="onIdle",sf="custom",of=0,af=1,lf=480;function cf(e){return"number"==typeof e}const uf=new k(W,"vaultTimeoutAction",{deserializer:e=>e,clearOn:[]}),df=new k(W,"vaultTimeout",{deserializer:e=>e,clearOn:[]});var hf=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 pf{}var ff=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 vf{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(Ga,()=>this.checkVaultTimeout())}init(e){return ff(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(Ga,1e4)}checkVaultTimeout(){return ff(this,void 0,void 0,function*(){const e=yield this.platformUtilsService.isPopupOpen();yield(0,ho._)((0,$o.z)([this.accountService.activeAccount$,this.accountService.accountActivity$]).pipe((0,yo.H)(t=>ff(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 ff(this,void 0,void 0,function*(){if(n&&e===i)return!1;const r=yield this.authService.getAuthStatus(e);if(r===cd.Locked||r===cd.LoggedOut)return!1;const s=yield(0,ho._)(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 ff(this,void 0,void 0,function*(){(yield(0,ho._)(this.vaultTimeoutSettingsService.getVaultTimeoutActionByUserId$(e)))===Zp.LogOut?yield this.logoutService.logout(e,"vaultTimeout"):yield this.lockService.lock(e)})}}const mf=["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 gf{constructor(e){if(null==e)throw new Error("Must provide key");if(32===e.byteLength)this.innerKey={type:Hh.AesCbc256_B64,encryptionKey:e},this.keyB64=this.toBase64();else if(64===e.byteLength)this.innerKey={type:Hh.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:Hh.CoseEncrypt0,encryptionKey:e},this.keyB64=this.toBase64()}}toJSON(){return{keyB64:this.keyB64}}inner(){return this.innerKey}toBase64(){return kd.fromBufferToB64(this.toEncoded())}toEncoded(){if(this.innerKey.type===Hh.AesCbc256_B64)return this.innerKey.encryptionKey;if(this.innerKey.type===Hh.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===Hh.CoseEncrypt0)return this.innerKey.encryptionKey;throw new Error("Unsupported encryption type.")}static fromString(e){if(null==e)return null;const t=kd.fromB64ToArray(e);return new gf(t)}static fromJSON(e){return gf.fromString(null==e?void 0:e.keyB64)}}const yf=k.record(Le,"organizationKeys",{deserializer:e=>e,clearOn:["logout"]}),bf=k.record(Le,"providerKeys",{deserializer:e=>e,clearOn:["logout"]}),wf=new k(Le,"everHadUserKey",{deserializer:e=>e,clearOn:["logout"]}),Sf=new k(Le,"privateKey",{deserializer:e=>e,clearOn:["logout"]}),kf=new k(ze,"userKey",{deserializer:e=>gf.fromJSON(e),clearOn:["logout","lock"]}),If=new k(Le,"userSigningKey",{deserializer:e=>e,clearOn:["logout"]}),Cf=new k(Le,"userSignedPublicKey",{deserializer:e=>e,clearOn:["logout"]});var Tf,Pf=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 Ff{constructor(e,t,i,n,r,s,o,a,l,c){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.activeUserOrgKeys$=this.stateProvider.activeUserId$.pipe((0,co.n)(e=>null!=e?this.orgKeys$(e):uo.t),(0,To.p)(e=>null!=e),(0,lo.F)(),(0,Pp.t)({bufferSize:1,refCount:!1}))}setUserKey(e,t){return Pf(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(kf,e,t),yield this.stateProvider.setUserState(wf,!0,t),yield this.storeAdditionalKeys(e,t);if(null==(yield(0,ho._)(this.userKey$(t).pipe((0,To.p)(e=>null!=e)))))throw new Error("Failed to set user key")})}setUserKeys(e,t,i){return Pf(this,void 0,void 0,function*(){if(null==e)throw new Error("No userKey provided. Lock the user to clear the key");if(null==t)throw new Error("No encPrivateKey provided.");if(null==i)throw new Error("No userId provided.");if(null==(yield this.decryptPrivateKey(t,e)))throw new Ip;yield this.setUserKey(e,i),yield this.setPrivateKey(t,i)})}refreshAdditionalKeys(e){return Pf(this,void 0,void 0,function*(){if(null==e)throw new Error("UserId is required.");const t=yield(0,ho._)(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,wf).state$.pipe((0,l.T)(e=>null!=e&&e))}getInMemoryUserKeyFor$(e){return this.stateProvider.getUserState$(kf,e)}getUserKey(e){return Pf(this,void 0,void 0,function*(){return yield(0,ho._)(this.stateProvider.getUserState$(kf,e))})}getUserKeyFromStorage(e,t){return Pf(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 Pf(this,void 0,void 0,function*(){return null!=e&&null!=(yield(0,ho._)(this.stateProvider.getUserState$(kf,e)))})}makeUserKey(e){return Pf(this,void 0,void 0,function*(){if(null==e){const t=yield(0,ho._)(this.stateProvider.activeUserId$);if(null==t)throw new Error("No active user id found.");e=yield(0,ho._)(this.masterPasswordService.masterKey$(t))}if(null==e)throw new Error("No Master Key found.");const t=yield this.keyGenerationService.createKey(512);return this.buildProtectedSymmetricKey(e,t)})}makeUserKeyV1(){return Pf(this,void 0,void 0,function*(){return yield this.keyGenerationService.createKey(512)})}clearUserKey(e){return Pf(this,void 0,void 0,function*(){null!=e&&(yield this.stateProvider.setUserState(kf,null,e),yield this.clearAllStoredUserKeys(e))})}clearStoredUserKey(e){return Pf(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 Pf(this,void 0,void 0,function*(){if(null==t)throw new Error("User ID is required.");const i=yield(0,ho._)(this.masterPasswordService.masterKey$(t));if(null!=i)return i;const n=yield(0,ho._)(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,ho._)(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 Pf(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 Pf(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 Pf(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===ep.LocalAuthorization?2:1,r=yield this.cryptoFunctionService.pbkdf2(t.inner().encryptionKey,e,"sha256",n);return kd.fromBufferToB64(r)})}compareKeyHash(e,t,i){return Pf(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,ho._)(this.masterPasswordService.masterKeyHash$(i));if(null==n)return!1;const r=yield this.hashMasterKey(e,t,ep.LocalAuthorization);return null!=r&&n===r})}setOrgKeys(e,t,i){return Pf(this,void 0,void 0,function*(){yield this.stateProvider.getUser(i,yf).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 Pf(this,void 0,void 0,function*(){return yield(0,ho._)(this.activeUserOrgKeys$.pipe((0,l.T)(t=>{var i;return null!==(i=t[e])&&void 0!==i?i:null})))})}makeDataEncKey(e){return Pf(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 Pf(this,void 0,void 0,function*(){null!=e&&(yield this.stateProvider.setUserState(yf,null,e))})}setProviderKeys(e,t){return Pf(this,void 0,void 0,function*(){yield this.stateProvider.getUser(t,bf).update(()=>{const t={};return e.forEach(e=>{t[e.id]=e.key}),t})})}providerKeys$(e){return this.userPrivateKey$(e).pipe((0,co.n)(t=>null==t?(0,Oo.of)(null):this.providerKeysHelper$(e,t)))}clearProviderKeys(e){return Pf(this,void 0,void 0,function*(){null!=e&&(yield this.stateProvider.setUserState(bf,null,e))})}makeOrgKey(e){return Pf(this,void 0,void 0,function*(){if(null==e)throw new Error("UserId is required");const t=yield(0,ho._)(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]})}setPrivateKey(e,t){return Pf(this,void 0,void 0,function*(){null!=e&&(yield this.stateProvider.getUser(t,Sf).update(()=>e))})}getFingerprint(e,t){return Pf(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 Pf(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[kd.fromBufferToB64(t[0]),yield this.encryptService.wrapDecapsulationKey(t[1],e)]})}clearKeyPair(e){return Pf(this,void 0,void 0,function*(){yield this.stateProvider.setUserState(Sf,null,e)})}clearSigningKey(e){return Pf(this,void 0,void 0,function*(){yield this.stateProvider.setUserState(If,null,e)})}makeSendKey(e){return Pf(this,void 0,void 0,function*(){return yield this.keyGenerationService.deriveKeyFromMaterial(e,"bitwarden-send","send")})}makeCipherKey(){return Pf(this,void 0,void 0,function*(){return yield this.keyGenerationService.createKey(512)})}clearKeys(e){return Pf(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.clearKeyPair(e),yield this.clearSigningKey(e),yield this.stateProvider.setUserState(wf,null,e)})}randomNumber(e,t){return Pf(this,void 0,void 0,function*(){let i=0;const n=t-e+1,r=Math.ceil(Math.log2(n));if(r>53)throw new Error("We cannot generate numbers larger than 53 bits.");const s=Math.ceil(r/8),o=Math.pow(2,r)-1,a=new Uint8Array(yield this.cryptoFunctionService.randomBytes(s));let l=8*(s-1);for(let e=0;e=n?this.randomNumber(e,t):e+i})}validateUserKey(e,t){return Pf(this,void 0,void 0,function*(){if(null==e)return!1;try{const i=yield(0,ho._)(this.stateProvider.getUser(t,Sf).state$);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 Pf(this,void 0,void 0,function*(){if(null==e)throw new Error("UserId is required.");if(null!=(yield(0,ho._)(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.stateProvider.getUser(e,Sf).update(()=>n.encryptedString),{userKey:t,publicKey:i,privateKey:n}})}storeAdditionalKeys(e,t){return Pf(this,void 0,void 0,function*(){(yield this.shouldStoreKey(rp.Auto,t))?yield this.stateService.setUserKeyAutoUnlock(e.keyB64,{userId:t}):yield this.stateService.setUserKeyAutoUnlock(null,{userId:t})})}shouldStoreKey(e,t){return Pf(this,void 0,void 0,function*(){let i=!1;switch(e){case rp.Auto:{const e=yield(0,ho._)(this.stateProvider.getUserState$(df,t).pipe((0,To.p)(e=>null!=e)));i=e==Qp;break}}return i})}getKeyFromStorage(e,t){return Pf(this,void 0,void 0,function*(){if(e===rp.Auto){const e=yield this.stateService.getUserKeyAutoUnlock({userId:t});if(e)return new gf(kd.fromB64ToArray(e))}return null})}clearAllStoredUserKeys(e){return Pf(this,void 0,void 0,function*(){yield this.stateService.setUserKeyAutoUnlock(null,{userId:e})})}hashPhrase(e){return Pf(this,arguments,void 0,function*(e,t=64){const i=Math.log(mf.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=Tp.fromArray(r,256);for(;n--;){const e=o.mod(mf.length);o=o.divide(mf.length),s.push(mf[e])}return s})}buildProtectedSymmetricKey(e,t){return Pf(this,void 0,void 0,function*(){let i;if(e.inner().type===Hh.AesCbc256_B64){const n=yield this.keyGenerationService.stretchKey(e);i=yield this.encryptService.wrapSymmetricKey(t,n)}else{if(e.inner().type!==Hh.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,kf).state$}userPublicKey$(e){return this.userPrivateKey$(e).pipe((0,co.n)(e=>Pf(this,void 0,void 0,function*(){return yield this.derivePublicKey(e)})))}derivePublicKey(e){return Pf(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,co.n)(e=>Pf(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.stateProvider.getUser(e,Sf).state$}userPrivateKeyHelper$(e){return this.userKey$(e).pipe((0,co.n)(t=>null==t?(0,Oo.of)(null):this.stateProvider.getUser(e,Sf).state$.pipe((0,co.n)(i=>Pf(this,void 0,void 0,function*(){try{return yield this.decryptPrivateKey(i,t)}catch(t){throw this.logService.error("Failed to decrypt private key for user ",e,t),t}})),(0,l.T)(e=>({userKey:t,userPrivateKey:e})))))}decryptPrivateKey(e,t){return Pf(this,void 0,void 0,function*(){return null==e?null:yield this.encryptService.unwrapDecapsulationKey(new up(e),t)})}providerKeysHelper$(e,t){return this.stateProvider.getUser(e,bf).state$.pipe((i=(e,i)=>Pf(this,void 0,void 0,function*(){return yield this.encryptService.decapsulateKeyUnsigned(new up(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,co.n)(e=>null==e?(0,Oo.of)(null):0===Object.keys(e).length?(0,Oo.of)({}):(0,Fp.p)(e)));var i}setUserSigningKey(e,t){return Pf(this,void 0,void 0,function*(){if(null==e)throw new Error("No user signing key provided.");if(null==t)throw new Error("No userId provided.");yield this.stateProvider.setUserState(If,e,t)})}userSigningKey$(e){return this.stateProvider.getUser(e,If).state$.pipe((0,l.T)(e=>null==e?null:e))}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,co.n)(t=>null==t?(0,Oo.of)({}):(0,$o.z)([this.stateProvider.getUser(e,yf).state$,this.providerKeysHelper$(e,t)]).pipe((0,co.n)(e=>Pf(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=xp.fromData(e[t]);if(null==s)continue;let o;if(xp.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,vd.W)(t=>(this.logService.error(`Failed to get encrypted organization keys for user ${e}`,t),(0,Oo.of)({}))))))}cipherDecryptionKeys$(e){var t;return null===(t=this.userPrivateKeyHelper$(e))||void 0===t?void 0:t.pipe((0,co.n)(t=>{if(null==t)return(0,Oo.of)(null);const i=t.userPrivateKey;return null==i?(0,Oo.of)({userKey:t.userKey,orgKeys:null}):(0,$o.z)([this.stateProvider.getUser(e,yf).state$,this.providerKeysHelper$(e,i)]).pipe((0,co.n)(e=>Pf(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=xp.fromData(e[r]);if(null==s)continue;let o;if(xp.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})))}))}setSignedPublicKey(e,t){return Pf(this,void 0,void 0,function*(){yield this.stateProvider.setUserState(Cf,e,t)})}userSignedPublicKey$(e){return this.stateProvider.getUserState$(Cf,e)}}class Rf{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"}(Tf||(Tf={}));class xf{constructor(e){this.kdfType=Tf.PBKDF2_SHA256,this.iterations=null!=e?e:xf.ITERATIONS.defaultValue}validateKdfConfigForSetting(){if(!xf.ITERATIONS.inRange(this.iterations))throw new Error(`PBKDF2 iterations must be between ${xf.ITERATIONS.min} and ${xf.ITERATIONS.max}`)}validateKdfConfigForPrelogin(){if(xf.PRELOGIN_ITERATIONS_MIN>this.iterations)throw new Error(`PBKDF2 iterations must be at least ${xf.PRELOGIN_ITERATIONS_MIN}, but was ${this.iterations}; possible pre-login downgrade attack detected.`)}static fromJSON(e){return new xf(e.iterations)}toSdkConfig(){return{pBKDF2:{iterations:this.iterations}}}}xf.ITERATIONS=new Rf(6e5,2e6,6e5),xf.PRELOGIN_ITERATIONS_MIN=5e3;class Af{constructor(e,t,i){this.kdfType=Tf.Argon2id,this.iterations=null!=e?e:Af.ITERATIONS.defaultValue,this.memory=null!=t?t:Af.MEMORY.defaultValue,this.parallelism=null!=i?i:Af.PARALLELISM.defaultValue}validateKdfConfigForSetting(){if(!Af.ITERATIONS.inRange(this.iterations))throw new Error(`Argon2 iterations must be between ${Af.ITERATIONS.min} and ${Af.ITERATIONS.max}`);if(!Af.MEMORY.inRange(this.memory))throw new Error(`Argon2 memory must be between ${Af.MEMORY.min} MiB and ${Af.MEMORY.max} MiB`);if(!Af.PARALLELISM.inRange(this.parallelism))throw new Error(`Argon2 parallelism must be between ${Af.PARALLELISM.min} and ${Af.PARALLELISM.max}.`)}validateKdfConfigForPrelogin(){if(Af.PRELOGIN_ITERATIONS_MIN>this.iterations)throw new Error(`Argon2 iterations must be at least ${Af.PRELOGIN_ITERATIONS_MIN}, but was ${this.iterations}; possible pre-login downgrade attack detected.`);if(Af.PRELOGIN_MEMORY_MIN>this.memory)throw new Error(`Argon2 memory must be at least ${Af.PRELOGIN_MEMORY_MIN} MiB, but was ${this.memory} MiB; possible pre-login downgrade attack detected.`);if(Af.PRELOGIN_PARALLELISM_MIN>this.parallelism)throw new Error(`Argon2 parallelism must be at least ${Af.PRELOGIN_PARALLELISM_MIN}, but was ${this.parallelism}; possible pre-login downgrade attack detected.`)}static fromJSON(e){return new Af(e.iterations,e.memory,e.parallelism)}toSdkConfig(){return{argon2id:{iterations:this.iterations,memory:this.memory,parallelism:this.parallelism}}}}function Df(e){if("pBKDF2"in e)return new xf(e.pBKDF2.iterations);if("argon2id"in e)return new Af(e.argon2id.iterations,e.argon2id.memory,e.argon2id.parallelism);throw new Error("Unsupported KDF type")}Af.MEMORY=new Rf(16,1024,64),Af.PARALLELISM=new Rf(1,16,4),Af.ITERATIONS=new Rf(2,10,3),Af.PRELOGIN_MEMORY_MIN=16,Af.PRELOGIN_PARALLELISM_MIN=1,Af.PRELOGIN_ITERATIONS_MIN=2;const Ef=new xf(xf.ITERATIONS.defaultValue);class $f{}var Of=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 Uf=new k(_e,"kdfConfig",{deserializer:e=>null==e?null:e.kdfType===Tf.PBKDF2_SHA256?xf.fromJSON(e):Af.fromJSON(e),clearOn:["logout"]});class Mf{}var Nf;!function(e){e.CreateDefaultLocation="pm-19467-create-default-location",e.AutoConfirm="pm-19934-auto-confirm-organization-users",e.BlockClaimedDomainAccountCreation="pm-28297-block-uninvited-claimed-domain-registration",e.IncreaseBulkReinviteLimitForCloud="pm-28251-increase-bulk-reinvite-limit-for-cloud",e.PM23801_PrefetchPasswordPrelogin="pm-23801-prefetch-password-prelogin",e.MacOsNativeCredentialSync="macos-native-credential-sync",e.WindowsDesktopAutotype="windows-desktop-autotype",e.WindowsDesktopAutotypeGA="windows-desktop-autotype-ga",e.TrialPaymentOptional="PM-8163-trial-payment",e.PM24032_NewNavigationPremiumUpgradeButton="pm-24032-new-navigation-premium-upgrade-button",e.PM25379_UseNewOrganizationMetadataStructure="pm-25379-use-new-organization-metadata-structure",e.PM24996_ImplementUpgradeFromFreeDialog="pm-24996-implement-upgrade-from-free-dialog",e.PM26793_FetchPremiumPriceFromPricingService="pm-26793-fetch-premium-price-from-pricing-service",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.PrivateKeyRegeneration="pm-12241-private-key-regeneration",e.EnrollAeadOnKeyRotation="enroll-aead-on-key-rotation",e.ForceUpdateKDFSettings="pm-18021-force-update-kdf-settings",e.PM25174_DisableType0Decryption="pm-25174-disable-type-0-decryption",e.LinuxBiometricsV2="pm-26340-linux-biometrics-v2",e.UnlockWithMasterPasswordUnlockData="pm-23246-unlock-with-master-password-unlock-data",e.NoLogoutOnKdfChange="pm-23995-no-logout-on-kdf-change",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.DesktopSendUIRefresh="desktop-send-ui-refresh",e.UseSdkPasswordGenerators="pm-19976-use-sdk-password-generators",e.ChromiumImporterWithABE="pm-25855-chromium-importer-abe",e.SendUIRefresh="pm-28175-send-ui-refresh",e.SendEmailOTP="pm-19051-send-email-verification",e.EventManagementForDataDogAndCrowdStrike="event-management-for-datadog-and-crowdstrike",e.PhishingDetection="phishing-detection",e.PM22887_RiskInsightsActivityTab="pm-22887-risk-insights-activity-tab",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.RiskInsightsForPremium="pm-23904-risk-insights-for-premium",e.VaultLoadingSkeletons="pm-25081-vault-skeleton-loaders",e.BrowserPremiumSpotlight="pm-23384-browser-premium-spotlight",e.MigrateMyVaultToMyItems="pm-20558-migrate-myvault-to-myitems",e.IpcChannelFramework="ipc-channel-framework",e.InactiveUserServerNotification="pm-25130-receive-push-notifications-for-inactive-users",e.PushNotificationsWhenLocked="pm-19388-push-notifications-when-locked",e.PM19148_InnovationArchive="pm-19148-innovation-archive",e.DesktopUiMigrationMilestone1="desktop-ui-migration-milestone-1",e.RouterFocusManagement="router-focus-management"}(Nf||(Nf={}));const Vf=!1,Bf={[Nf.CreateDefaultLocation]:Vf,[Nf.AutoConfirm]:Vf,[Nf.BlockClaimedDomainAccountCreation]:Vf,[Nf.IncreaseBulkReinviteLimitForCloud]:Vf,[Nf.MacOsNativeCredentialSync]:Vf,[Nf.WindowsDesktopAutotype]:Vf,[Nf.WindowsDesktopAutotypeGA]:Vf,[Nf.DesktopSendUIRefresh]:Vf,[Nf.UseSdkPasswordGenerators]:Vf,[Nf.ChromiumImporterWithABE]:Vf,[Nf.SendUIRefresh]:Vf,[Nf.SendEmailOTP]:Vf,[Nf.EventManagementForDataDogAndCrowdStrike]:Vf,[Nf.PhishingDetection]:Vf,[Nf.PM22887_RiskInsightsActivityTab]:Vf,[Nf.CipherKeyEncryption]:Vf,[Nf.PM19941MigrateCipherDomainToSdk]:Vf,[Nf.PM22134SdkCipherListView]:Vf,[Nf.PM22136_SdkCipherEncryption]:Vf,[Nf.RiskInsightsForPremium]:Vf,[Nf.VaultLoadingSkeletons]:Vf,[Nf.BrowserPremiumSpotlight]:Vf,[Nf.MigrateMyVaultToMyItems]:Vf,[Nf.PM23801_PrefetchPasswordPrelogin]:Vf,[Nf.TrialPaymentOptional]:Vf,[Nf.PM24032_NewNavigationPremiumUpgradeButton]:Vf,[Nf.PM25379_UseNewOrganizationMetadataStructure]:Vf,[Nf.PM24996_ImplementUpgradeFromFreeDialog]:Vf,[Nf.PM26793_FetchPremiumPriceFromPricingService]:Vf,[Nf.PM23713_PremiumBadgeOpensNewPremiumUpgradeDialog]:Vf,[Nf.PM26462_Milestone_3]:Vf,[Nf.PM23341_Milestone_2]:Vf,[Nf.PrivateKeyRegeneration]:Vf,[Nf.EnrollAeadOnKeyRotation]:Vf,[Nf.ForceUpdateKDFSettings]:Vf,[Nf.PM25174_DisableType0Decryption]:Vf,[Nf.LinuxBiometricsV2]:Vf,[Nf.UnlockWithMasterPasswordUnlockData]:Vf,[Nf.NoLogoutOnKdfChange]:Vf,[Nf.DataRecoveryTool]:Vf,[Nf.ConsolidatedSessionTimeoutComponent]:Vf,[Nf.PM27279_V2RegistrationTdeJit]:Vf,[Nf.IpcChannelFramework]:Vf,[Nf.InactiveUserServerNotification]:Vf,[Nf.PushNotificationsWhenLocked]:Vf,[Nf.PM19148_InnovationArchive]:Vf,[Nf.DesktopUiMigrationMilestone1]:Vf,[Nf.RouterFocusManagement]:Vf};function jf(e,t){return null==(null==e?void 0:e.featureStates)||null==e.featureStates[t]?Bf[t]:e.featureStates[t]}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())})};class Lf{}var zf=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 _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())})};class Kf{constructor(e){this.keyService=e}transform(e,t){return _f(this,void 0,void 0,function*(){try{"string"==typeof e&&(e=kd.fromB64ToArray(e));const i=yield this.keyService.getFingerprint(t,e);return null!=i?i.join("-"):""}catch(e){return""}})}}Kf.ɵfac=function(e){return new(e||Kf)(yl.rXU(Cp,16))},Kf.ɵpipe=yl.EJ8({name:"fingerprint",type:Kf,pure:!0,standalone:!1});class Xf{constructor(e){this.i18nService=e}transform(e,t,i,n){return this.i18nService.t(e,t,i,n)}}Xf.ɵfac=function(e){return new(e||Xf)(yl.rXU(Pl,16))},Xf.ɵpipe=yl.EJ8({name:"i18n",type:Xf,pure:!0,standalone:!1});class qf{}qf.ɵfac=function(e){return new(e||qf)},qf.ɵmod=yl.$C({type:qf}),qf.ɵinj=a.G2t({providers:[Mh,pl.vh,Xf,Vh,Bh,Jh,Kf,Nh],imports:[ic.forRoot({maxOpened:5,autoDismiss:!0,closeButton:!0}),pl.MD,fl.YN,fl.X1,rc,Nc,Eu,Bu,Xu,td,id,dh,Xl,Ah,Dh,Eh,_l,$h,Oh,$h,ic]});class Yf{constructor(e){this.data=e}static open(e,t){return e.open(Yf,{data:t,positionStrategy:new Yd})}}Yf.ɵfac=function(e){return new(e||Yf)(yl.rXU(nd.Qs))},Yf.ɵcmp=yl.VBU({type:Yf,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&&(yl.j41(0,"bit-simple-dialog"),yl.nrm(1,"i",0),yl.j41(2,"span",1)(3,"strong"),yl.EFF(4),yl.nI1(5,"i18n"),yl.k0s()(),yl.j41(6,"span",2),yl.EFF(7),yl.k0s(),yl.qex(8,3),yl.j41(9,"a",4),yl.EFF(10),yl.nI1(11,"i18n"),yl.nrm(12,"i",5),yl.k0s(),yl.j41(13,"button",6),yl.EFF(14),yl.nI1(15,"i18n"),yl.k0s(),yl.bVm(),yl.k0s()),2&e&&(yl.R7$(4),yl.SpI("",yl.bMT(5,4,"yourAccountsFingerprint"),":"),yl.R7$(3),yl.SpI(" ",t.data.fingerprint.join("-")," "),yl.R7$(3),yl.SpI(" ",yl.bMT(11,6,"learnMore")," "),yl.R7$(4),yl.SpI(" ",yl.bMT(15,8,"close")," "))},dependencies:[qf,Xu,Ku,dh,Zd,Nd,Vd,Xf],encapsulation:2});class Wf{}var Hf=i(77789);const Jf=e=>({width:e});function Zf(e,t){if(1&e&&(yl.j41(0,"div",2)(1,"div",3),yl.EFF(2," "),yl.k0s(),yl.j41(3,"div",4),yl.EFF(4),yl.k0s()()),2&e){const e=yl.XpG();yl.R7$(4),yl.JRh(e.textContent)}}const Qf={small:["tw-h-1"],default:["tw-h-4"],large:["tw-h-6"]},ev={danger:["tw-bg-danger-600"],primary:["tw-bg-primary-600"],success:["tw-bg-success-600"],warning:["tw-bg-warning-600"]};class tv{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(Qf[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(Qf[this.size()]).concat(ev[this.bgColor()])}get textContent(){return this.text()||this.barWidth()+"%"}}tv.ɵfac=function(e){return new(e||tv)},tv.ɵcmp=yl.VBU({type:tv,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&&(yl.j41(0,"div",0)(1,"div",1),yl.nVh(2,Zf,5,1,"div",2),yl.k0s()()),2&e&&(yl.Y8G("ngClass",t.outerBarStyles),yl.R7$(),yl.Y8G("ngClass",t.innerBarStyles)("ngStyle",yl.eq3(5,Jf,t.barWidth()+"%")),yl.BMQ("aria-valuenow",t.barWidth()),yl.R7$(),yl.vxM(t.displayText?2:-1))},dependencies:[pl.MD,pl.YU,pl.B3],encapsulation:2});class iv{}iv.ɵfac=function(e){return new(e||iv)},iv.ɵmod=yl.$C({type:iv}),iv.ɵinj=a.G2t({imports:[tv]});class nv{set password(e){this.updatePasswordStrength(e)}constructor(e,t){this.i18nService=e,this.passwordStrengthService=t,this.size="default",this.showText=!1,this.passwordStrengthScore=new yl.bkB,this.passwordScoreTextWithColor=new yl.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)}}nv.ɵfac=function(e){return new(e||nv)(yl.rXU(Pl),yl.rXU(Wf))},nv.ɵcmp=yl.VBU({type:nv,selectors:[["tools-password-strength"]],inputs:{size:"size",showText:"showText",email:"email",name:"name",password:"password"},outputs:{passwordStrengthScore:"passwordStrengthScore",passwordScoreTextWithColor:"passwordScoreTextWithColor"},features:[yl.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&&(yl.nrm(0,"bit-progress",0),yl.j41(1,"div",1),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s()),2&e&&(yl.Y8G("size",t.size)("text",t.text)("bgColor",t.color)("showText",t.showText)("barWidth",t.scoreWidth),yl.R7$(2),yl.SpI(" ",yl.i5U(3,6,"passwordStrengthScore",t.text),"\n"))},dependencies:[pl.MD,qf,iv,tv,Xf],encapsulation:2});class rv{}class sv{}const ov=Object.freeze({catchallType:"random",catchallDomain:"",website:null});const av=function(){const e=Object.freeze({min:3,max:20});return Object.freeze({numWords:e})}();const lv=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})}(),cv=Object.freeze({wordCapitalize:!1,wordIncludeNumber:!1,website:null}),uv=Object.freeze({numWords:6,wordSeparator:"-",capitalize:!1,includeNumber:!1}),dv=Object.freeze({length:14,minLength:lv.length.min,ambiguous:!0,uppercase:!0,minUppercase:1,lowercase:!0,minLowercase:1,number:!0,minNumber:1,special:!1,minSpecial:0}),hv=Object.freeze({subaddressType:"random",subaddressEmail:"",website:null}),pv=Object.freeze({addyio:"addyio",bitwarden:"bitwarden",duckduckgo:"duckduckgo",fastmail:"fastmail",forwardemail:"forwardemail",mozilla:"mozilla",simplelogin:"simplelogin"});class fv{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 vv{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 mv{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 gv=Object.freeze({token:"",domain:"",baseUrl:""}),yv=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]}}),bv=Object.freeze({defaultSettings:gv,createForwardingEmail:yv,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 fv,state:me,initial:gv,options:{deserializer:e=>e,clearOn:["logout"]}},import:{key:"forwarder.AddyIo.local.import",target:"object",format:"plain",classifier:new vv(["token","baseUrl","domain"]),state:ge,options:{deserializer:e=>e,clearOn:["logout","lock"]}}},settings:new k(me,"addyIoForwarder",{deserializer:e=>e,clearOn:[]}),importBuffer:new mv(me,"addyIoBuffer",{deserializer:e=>e,clearOn:["logout"]})}),wv=Object.freeze({id:pv.addyio,name:"Addy.io",extends:["forwarder"],selfHost:"maybe",baseUrl:"https://app.addy.io",authenticate(e,t){return{Authorization:"Bearer "+t.authenticationToken()}},forwarder:bv}),Sv=Object.freeze({token:""}),kv=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`]}}),Iv=Object.freeze({defaultSettings:Sv,createForwardingEmail:kv,request:["token"],settingsConstraints:{token:{required:!0}},local:{settings:{key:"duckDuckGoForwarder",target:"object",format:"secret-state",frame:512,classifier:new fv,state:me,initial:Sv,options:{deserializer:e=>e,clearOn:["logout"]}},import:{key:"forwarder.DuckDuckGo.local.import",target:"object",format:"plain",classifier:new vv(["token"]),state:ge,options:{deserializer:e=>e,clearOn:["logout","lock"]}}},settings:new k(me,"duckDuckGoForwarder",{deserializer:e=>e,clearOn:[]}),importBuffer:new mv(me,"duckDuckGoBuffer",{deserializer:e=>e,clearOn:["logout"]})}),Cv=Object.freeze({id:pv.duckduckgo,name:"DuckDuckGo",baseUrl:"https://quack.duckduckgo.com/api",selfHost:"never",extends:["forwarder"],authenticate(e,t){return{Authorization:"Bearer "+t.authenticationToken()}},forwarder:Iv}),Tv=Object.freeze({domain:"",prefix:"",token:""}),Pv=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()]}}),Fv=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]}}}),Rv=Object.freeze({defaultSettings:Tv,createForwardingEmail:Fv,getAccountId:Pv,request:["token"],settingsConstraints:{token:{required:!0},domain:{required:!0},prefix:{}},local:{settings:{key:"fastmailForwarder",target:"object",format:"secret-state",frame:512,classifier:new fv,state:me,initial:Tv,options:{deserializer:e=>e,clearOn:["logout"]}},import:{key:"forwarder.Fastmail.local.import",target:"object",format:"plain",classifier:new vv(["token"]),state:ge,options:{deserializer:e=>e,clearOn:["logout","lock"]}}},settings:new k(me,"fastmailForwarder",{deserializer:e=>e,clearOn:[]}),importBuffer:new mv(me,"fastmailBuffer",{deserializer:e=>e,clearOn:["logout"]})}),xv=Object.freeze({id:pv.fastmail,name:"Fastmail",baseUrl:"https://api.fastmail.com",selfHost:"maybe",extends:["forwarder"],authenticate(e,t){return{Authorization:"Bearer "+t.authenticationToken()}},forwarder:Rv}),Av=Object.freeze({token:""}),Dv=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]}}),Ev=Object.freeze({defaultSettings:Av,createForwardingEmail:Dv,request:["token"],settingsConstraints:{token:{required:!0}},local:{settings:{key:"firefoxRelayForwarder",target:"object",format:"secret-state",frame:512,classifier:new fv,state:me,initial:Av,options:{deserializer:e=>e,clearOn:["logout"]}},import:{key:"forwarder.Firefox.local.import",target:"object",format:"plain",classifier:new vv(["token"]),state:ge,options:{deserializer:e=>e,clearOn:["logout","lock"]}}},settings:new k(me,"firefoxRelayForwarder",{deserializer:e=>e,clearOn:[]}),importBuffer:new mv(me,"firefoxRelayBuffer",{deserializer:e=>e,clearOn:["logout"]})}),$v=Object.freeze({id:pv.mozilla,name:"Firefox Relay",baseUrl:"https://relay.firefox.com/api",selfHost:"never",extends:["forwarder"],authenticate(e,t){return{Authorization:"Token "+t.authenticationToken()}},forwarder:Ev}),Ov=Object.freeze({token:"",domain:""}),Uv=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()}`]}}),Mv=Object.freeze({defaultSettings:Ov,request:["token","domain"],settingsConstraints:{token:{required:!0},domain:{required:!0}},local:{settings:{key:"forwardEmailForwarder",target:"object",format:"secret-state",frame:512,classifier:new fv,state:me,initial:Ov,options:{deserializer:e=>e,clearOn:["logout"]}},import:{key:"forwarder.ForwardEmail.local.import",target:"object",format:"plain",classifier:new vv(["token","domain"]),state:ge,options:{deserializer:e=>e,clearOn:["logout","lock"]}}},settings:new k(me,"forwardEmailForwarder",{deserializer:e=>e,clearOn:[]}),importBuffer:new mv(me,"forwardEmailBuffer",{deserializer:e=>e,clearOn:["logout"]}),createForwardingEmail:Uv}),Nv=Object.freeze({id:pv.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:Mv}),Vv=Object.freeze({token:"",domain:"",baseUrl:""}),Bv=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]}}),jv=Object.freeze({defaultSettings:Vv,createForwardingEmail:Bv,request:["token","baseUrl"],settingsConstraints:{token:{required:!0}},local:{settings:{key:"simpleLoginForwarder",target:"object",format:"secret-state",frame:512,classifier:new fv,state:me,initial:Vv,options:{deserializer:e=>e,clearOn:["logout"]}},import:{key:"forwarder.SimpleLogin.local.import",target:"object",format:"plain",classifier:new vv(["token","baseUrl"]),state:ge,options:{deserializer:e=>e,clearOn:["logout","lock"]}}},settings:new k(me,"simpleLoginForwarder",{deserializer:e=>e,clearOn:[]}),importBuffer:new mv(me,"simpleLoginBuffer",{deserializer:e=>e,clearOn:["logout"]})}),Gv=Object.freeze({id:pv.simplelogin,name:"SimpleLogin",selfHost:"maybe",extends:["forwarder"],baseUrl:"https://app.simplelogin.io",authenticate(e,t){return{Authentication:t.authenticationToken()}},forwarder:jv}),Lv=Object.freeze({AddyIo:wv,DuckDuckGo:Cv,Fastmail:xv,FirefoxRelay:$v,ForwardEmail:Nv,SimpleLogin:Gv}),zv=new Map(Object.values(Lv).map(e=>[e.id,e]));var _v=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 Kv{constructor(e){this.keyService=e}pick(e){return _v(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 _v(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){r+=(yield this.keyService.randomNumber(1,9)).toString()}return r})}shuffle(e,t){return _v(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 _v(this,void 0,void 0,function*(){let t="";const i="abcdefghijklmnopqrstuvwxyz1234567890";for(let n=0;nt)})}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 Xv(this,void 0,void 0,function*(){const i=yield(0,ho._)(this.evaluator$(e)),n=i.applyPolicy(t);return i.sanitize(n)})}generate(e){return Xv(this,void 0,void 0,function*(){return yield this.strategy.generate(e)})}}var Yv=i(14928),Wv=i(88507),Hv=i(96141),Jv=i(14803),Zv=i(45505),Qv=i(39444),em=i(43219),tm=i(11891),im=i(61687),nm=i(21991),rm=i(57886),sm=i(8131),om=i(32097);function am(e){return e}function lm(e,t){return{expectedValue:e,actualValue:t}}function cm(e=am,t=lm){return(0,Zv.F)((0,sd.Z)(null),(0,Qv.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 um(e,t){return(0,l.T)(i=>(null!=i?i:[]).reduce(e,structuredClone(t)))}function dm(){return(0,lo.F)((e,t)=>{let i=!0;for(const n in t)i&&(i=e[n]===t[n]);return i})}function hm(e){if(Array.isArray(e)){const t=e.filter(e=>!!e).map(e=>e.pipe((0,em.w)(),(0,tm.q)(!0)));return(0,im.O)(t)}return e.pipe((0,em.w)(),(0,tm.q)(!0))}function pm(e){const t=Array.isArray(e)?e:[e];return(0,Zv.F)((0,nm.N)(e=>{const i=new So.m(1);return e.subscribe(i),(0,rm.x)((0,Wv.y)(t).pipe((0,Yv.$)(),(0,em.w)()),i).pipe((0,Jv.Q)(hm(i)))}))}function fm(...e){return(0,nm.N)(t=>{const i=new So.m(1);t.subscribe(i);const n=e.map(e=>{const t=new So.m(1);return e.subscribe(t),t});return(0,rm.x)((0,Wv.y)(n).pipe((0,Yv.$)(),(0,em.w)()),i).pipe((0,sm.E)(...n),(0,Jv.Q)(hm(i)))})}function vm(e){return(0,Zv.F)((null==e?void 0:e.distinct)?(0,lo.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 mm(e,t){return(0,Zv.F)((0,om.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,To.p)(e=>!!e))}function gm(e){const t=Reflect.ownKeys(e);for(const i of t){const t=e[i];t&&"object"==typeof t&&gm(t)}return Object.freeze(e)}const ym=Object.freeze({password:"password",passphrase:"passphrase",username:"username",catchall:"catchall",plusAddress:"subaddress"}),bm=Object.freeze({password:"password",username:"username",email:"email"}),wm=Object.freeze({account:"account"}),Sm=gm({[bm.password]:[ym.password,ym.passphrase],[bm.username]:[ym.username],[bm.email]:[ym.catchall,ym.plusAddress]});class km{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=kd.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=kd.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 Im extends km{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 Cm{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 Cm(e.credential,e.category,e.generationDate)}toJSON(){return{credential:this.credential,category:this.category,generationDate:this.generationDate.valueOf()}}}function Tm(e){const t=e.split("");return Object.freeze(t)}const Pm=Tm("!@#$%^&*"),Fm=Object.freeze({Full:Object.freeze({Uppercase:Tm("ABCDEFGHIJKLMNOPQRSTUVWXYZ"),Lowercase:Tm("abcdefghijklmnopqrstuvwxyz"),Digit:Tm("0123456789"),Special:Pm}),Unmistakable:Object.freeze({Uppercase:Tm("ABCDEFGHJKLMNPQRSTUVWXYZ"),Lowercase:Tm("abcdefghijkmnopqrstuvwxyz"),Digit:Tm("23456789"),Special:Pm})}),Rm=new RegExp("(?[^@+]+)(?\\+.+)?(?@.+)");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 Am{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=Rm.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:mf,o=[];for(let e=0;e{let n=t.get(i);if(void 0===n){const r=e();n=new fd.t(Object.assign({},r)),t.set(i,n)}return n.asObservable()}}function $m(e,t){return i=>t.getUser(i,e)}const Om=(...e)=>(null!=e?e:[]).reduce((e,t)=>e+(null!=t?t:0),0);function Um(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,dv.uppercase,dv.minUppercase),lowercase:n(e.lowercase,e.minLowercase,dv.lowercase,dv.minLowercase),digits:n(e.number,e.minNumber,dv.number,dv.minNumber),special:n(e.special,e.minSpecial,dv.special,dv.minSpecial),ambiguous:null!==(t=e.ambiguous)&&void 0!==t?t:dv.ambiguous,all:0},s=Om(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 Mm(e){var t,i,n,r;const s=null!==(t=e.numWords)&&void 0!==t?t:uv.numWords;return{numberOfWords:Math.max(s,av.numWords.min),capitalize:null!==(i=e.capitalize)&&void 0!==i?i:uv.capitalize,number:null!==(n=e.includeNumber)&&void 0!==n?n:uv.includeNumber,separator:null!==(r=e.wordSeparator)&&void 0!==r?r:uv.wordSeparator}}var Nm=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 Vm{constructor(e,t){this.randomizer=e,this.currentTime=t}randomAscii(e){return Nm(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?Fm.Full:Fm.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 Nm(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!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:mf,l=[];for(let e=0;e.+)");class _m{constructor(e){var t;if(this.constraints={},!e)return void(this.domain="");const i=zm.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 Km=gm({id:ym.catchall,type:bm.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 Am(e.randomizer)}},profiles:{[wm.account]:{type:"core",storage:{key:"catchallGeneratorSettings",target:"object",format:"plain",classifier:new vv(["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 _m(null!==(i=t.email)&&void 0!==i?i:"")}}}}});var Xm=Km;class qm{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 Ym=gm({id:ym.plusAddress,type:bm.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 Am(e.randomizer)}},profiles:{[wm.account]:{type:"core",storage:{key:"subaddressGeneratorSettings",target:"object",format:"plain",classifier:new vv(["subaddressType","subaddressEmail"]),state:me,initial:{subaddressType:"random",subaddressEmail:""},options:{deserializer(e){return e},clearOn:["logout"]}},constraints:{default:{},create(e,t){var i;return new qm(null!==(i=t.email)&&void 0!==i?i:"")}}}}});var Wm=Ym;class Hm{get policy(){return{}}get policyInEffect(){return!1}applyPolicy(e){return e}sanitize(e){return e}}const Jm={min:0,max:0},Zm={min:1},Qm={requiredValue:!0};function eg(e,t){var i;const n=Om(...t.map(e=>null==e?void 0:e.min));return ig(Math.max(null!==(i=null==e?void 0:e.min)&&void 0!==i?i:0,n),e)}function tg(e,t){return e?t:void 0}function ig(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 ng(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 rg(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 sg(e,t){return(null==t?void 0:t.readonly)?t.requiredValue:e}function og(e){return tg(e,function(e,t){if(!e)return t;const i=Object.assign({},null!=t?t:{});return i.readonly=!0,i}(e,Qm))}class ag{constructor(e){this.constraints=e}adjust(e){const t=Object.assign(Object.assign({},null!=e?e:dv),{length:ng(e.length,this.constraints.length),lowercase:sg(e.lowercase,this.constraints.lowercase),uppercase:sg(e.uppercase,this.constraints.uppercase),number:sg(e.number,this.constraints.number),special:sg(e.special,this.constraints.special),minLowercase:ng(e.minLowercase,this.constraints.minLowercase),minUppercase:ng(e.minUppercase,this.constraints.minUppercase),minNumber:ng(e.minNumber,this.constraints.minNumber),minSpecial:ng(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 lg{constructor(e,t){this.defaults=t;const i=tg(e.useLowercase,Zm),n=tg(e.useUppercase,Zm),r=ig(e.numberCount||e.useNumbers&&Zm.min,t.minNumber),s=ig(e.specialCount||e.useSpecial&&Zm.min,t.minSpecial),o=eg(ig(e.minLength,t.length),[i,n,r,s]);this.constraints=Object.freeze({policyInEffect:cg(e,t),lowercase:og(e.useLowercase),uppercase:og(e.useUppercase),number:og(e.useNumbers),special:og(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:tg(c,null!==(s=this.constraints.minLowercase)&&void 0!==s?s:Zm),minUppercase:tg(u,null!==(o=this.constraints.minUppercase)&&void 0!==o?o:Zm),minNumber:null!==(a=tg(d,this.constraints.minNumber))&&void 0!==a?a:Jm,minSpecial:null!==(l=tg(h,this.constraints.minSpecial))&&void 0!==l?l:Jm});p.length=eg(this.constraints.length,[ig(e.minNumber,p.minNumber),ig(e.minSpecial,p.minSpecial),ig(e.minLowercase,p.minLowercase),ig(e.minUppercase,p.minUppercase)]);return new ag(p)}}function cg(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 ug{constructor(e){var t,i;this.policy=structuredClone(e),this.numWords=(t=e.minNumberWords,i=av.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>av.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:uv.wordSeparator;return Object.assign(Object.assign({},e),{wordSeparator:n})}}class dg{constructor(e,t){this.policy=e,this.defaults=t,this.constraints={policyInEffect:hg(e,t),wordSeparator:{minLength:0,maxLength:1},capitalize:og(e.capitalize),includeNumber:og(e.includeNumber),numWords:ig(e.minNumberWords,t.numWords)}}adjust(e){return{wordSeparator:rg(e.wordSeparator,this.constraints.wordSeparator,{fillString:uv.wordSeparator}),capitalize:sg(e.capitalize,this.constraints.capitalize),includeNumber:sg(e.includeNumber,this.constraints.includeNumber),numWords:ng(e.numWords,this.constraints.numWords)}}fix(e){return e}}function hg(e,t){return[e.capitalize,e.includeNumber,e.minNumberWords>t.numWords.min].includes(!0)}class pg{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,lv.minDigits),this.minSpecialCharacters=t(e.specialCount,lv.minSpecialCharacters);const i=this.minDigits.min+this.minSpecialCharacters.min,n=e.minLength>0?e.minLength:lv.length.min,r=Math.max(n,i,lv.length.min);this.length={min:r,max:Math.max(lv.length.max,r)}}get policyInEffect(){return[this.policy.useUppercase,this.policy.useLowercase,this.policy.useNumbers,this.policy.useSpecial,this.policy.minLength>lv.length.min,this.policy.numberCount>lv.minDigits.min,this.policy.specialCount>lv.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 fg(e,t){var i;return t.type!==_h.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 vg(e,t){var i,n,r;return t.type===_h.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 mg{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 gg={id:ym.passphrase,type:bm.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 Vm(e.randomizer,e.now):new jm(e.sdk,e.now)}},profiles:{[wm.account]:{type:"core",storage:{key:"passphraseGeneratorSettings",target:"object",format:"plain",classifier:new vv(["numWords","wordSeparator","capitalize","includeNumber"]),state:me,initial:{numWords:6,wordSeparator:"-",capitalize:!1,includeNumber:!1},options:{deserializer(e){return e},clearOn:["logout"]}},constraints:{type:_h.PasswordGenerator,default:{wordSeparator:{maxLength:1},numWords:{min:3,max:20,recommendation:6}},create(e,t){const i=e.reduce(fg,{minNumberWords:0,capitalize:!1,includeNumber:!1});return new dg(i,t.defaultConstraints)}}}}};var yg=gm({id:ym.password,type:bm.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 Vm(e.randomizer,e.now):new jm(e.sdk,e.now)}},profiles:{[wm.account]:{type:"core",storage:{key:"passwordGeneratorSettings",target:"object",format:"plain",classifier:new vv(["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:_h.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(vg,{minLength:0,useUppercase:!1,useLowercase:!1,useNumbers:!1,numberCount:0,useSpecial:!1,specialCount:0});return new lg(i,t.defaultConstraints)}}}}});const bg=new Proxy(Object.freeze({}),{get(){return{}}});class wg{constructor(){this.constraints=bg}calibrate(){return this}adjust(e){return e}fix(e){return e}}var Sg=gm({id:ym.username,type:bm.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 Lm(e.randomizer)}},profiles:{[wm.account]:{type:"core",storage:{key:"effUsernameGeneratorSettings",target:"object",format:"plain",classifier:new vv(["wordCapitalize","wordIncludeNumber"]),state:me,initial:{wordCapitalize:!1,wordIncludeNumber:!1,website:null},options:{deserializer:e=>e,clearOn:["logout"]}},constraints:{default:{},create(e,t){return new wg}}}}});class kg{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 Ig{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 Cg=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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,i){this.configuration=e,this.client=t,this.i18nService=i}generate(e,t){return Cg(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 Cm(s,bm.email,Date.now())})}createContext(e,t){return new Im(e,t,this.i18nService)}createForwardingAddress(e,t){const i=this.createContext(e,t);return new kg(e,i)}getAccountId(e,t){if(!e.forwarder.getAccountId)return null;const i=this.createContext(e,t);return new Ig(e,i)}}function Pg(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:bm.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=zv.get(e);return t&&"forwarder"in t?t:null}(e.product.vendor.id);return new Tg(i,t.client,t.i18nService)}},profiles:{[wm.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 wg}}}}};return n}function Fg(e){return Sm.password.includes(e)}function Rg(e){return Sm.username.includes(e)}function xg(e){return!(!e||"object"!=typeof e||!("forwarder"in e))}function Ag(e){return Sm.email.includes(e)||xg(e)}function Dg(e,t){return e===t||!(!xg(e)||!xg(t))&&e.forwarder===t.forwarder}const Eg=Object.freeze({catchall:Xm,plusAddress:Wm,passphrase:gg,password:yg,effWordList:Sg}),$g=Sm,Og=Object.freeze(Object.values(ym)),Ug=Object.freeze(Object.values(bm));function Mg(e){return!!e.algorithm}function Ng(e){return!!e.type}const Vg=18e4;var Bg=i(12916),jg=i(62179);function Gg(e){return!!e&&"id"in e&&"secret"in e&&"disclosed"in e&&"string"==typeof e.secret&&"object"==typeof e.disclosed}function Lg(e){return e&&"calibrate"in e}var zg=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 _g="$^$ALWAYS_UPDATE_KLUDGE_PROPERTY$^$";class Kg extends ea.c{constructor(e,t,i){var n,r,s;super(),this.key=e,this.providers=t,this.context=i,this.input=new So.m(1),this.output=new So.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 fd.t(!0)).pipe((0,lo.F)()),a=i.account$.pipe(vm({name:()=>`${this.contextId} { account$ }`,distinct(e,t){return e.id===t.id}}),(0,Pp.t)({refCount:!0,bufferSize:1})),c=this.encryptor(a),u=(null!==(r=this.context.constraints$)&&void 0!==r?r:function(){const e=new wg;return new fd.t(e)}()).pipe((0,vd.W)(e=>(this.log.error(e,"constraints$ dependency failed; using last-known constraints"),$p.w)),(0,Pp.t)({refCount:!0,bufferSize:1})),d=(null!==(s=this.context.dependencies$)&&void 0!==s?s:new fd.t(null)).pipe((0,Pp.t)({refCount:!0,bufferSize:1})),h=a.pipe((0,Fo.M)(e=>this.log.debug({accountId:e.id},"loading user state")),(0,l.T)(e=>this.providers.state.getUser(e.id,this.stateKey)),(0,Pp.t)({refCount:!0,bufferSize:1}));this.outputSubscription=h.pipe((0,co.n)(e=>e.state$),(0,l.T)(e=>(e&&"object"==typeof e&&_g in e&&delete e[_g],e)),this.declassify(c),this.adjust((0,Op.v)(u)),(0,Jv.Q)(hm(a))).subscribe(this.output);const p=new So.m(1);this.output.pipe((0,Bg.H)(),(0,l.T)(e=>e.state)).subscribe(p);const f=(0,rm.x)(this.input.pipe(this.when(o),this.adjust(fm(u)),this.prepareUpdate(this,d)),p.pipe(this.fix(u),this.prepareUpdate(p,d)));this.inputSubscription=f.pipe(this.classify(c),(0,sm.E)(h),(0,Jv.Q)(hm([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,Fo.M)(()=>this.log.debug("encryptor constructed")),(0,l.T)(({encryptor:e})=>e),(0,Pp.t)({refCount:!0,bufferSize:1}))}when(e){return(0,Zv.F)((0,Op.v)(e.pipe((0,lo.F)())),(0,Fo.M)(([e,t])=>this.log.debug({when:t},"when status")),(0,To.p)(([e,t])=>!!t),(0,l.T)(([e])=>e))}prepareUpdate(e,t){return i=>(0,rm.x)(e.pipe((0,Yv.$)(),(0,l.T)(e=>[e,null])),i.pipe((0,l.T)(e=>e.state),(0,sm.E)(t))).pipe((0,om.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,jg.i)(1),(0,l.T)(([e])=>e),(0,lo.F)())}adjust(e){return(0,Zv.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=Lg(t)?t.calibrate(n):t,s=r.adjust(n);return this.log.debug("adjusted"),{constraints:r.constraints,state:s}}))}fix(e){return(0,Zv.F)((0,Op.v)(e),(0,l.T)(([e,t])=>{this.log.debug("fixing");const i=Lg(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,Zv.F)(this.mapToClassifiedFormat(),(0,Op.v)(e),(0,yo.H)(e=>zg(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=up.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=>Gg(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 Gg(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,Zv.F)(fm(e),(0,yo.H)(e=>zg(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,Zv.F)(pm(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,lo.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)[_g]=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 Xg=new k(me,"credentialPreferences",{deserializer:e=>{var t;const i=null!==(t=e)&&void 0!==t?t:{};for(const e in $g){const t=e;if(i[t])i[t].updated=new Date(i[t].updated);else{const[e]=$g[t];i[t]={algorithm:e,updated:new Date}}}return i},clearOn:["logout"]});class qg{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=Pg(i)}else t=this._metadata.get(e);return t||this.log.panic({algorithm:e},"metadata not found"),t}types(){return Ug}algorithms(e){let t;if(Ng(e)){let i=[];e.type===bm.email&&(i=Array.from(this.site.extensions.keys()).map(e=>({forwarder:e}))),t=$g[e.type].concat(i)}else Mg(e)&&xg(e.algorithm)?t=this.site.extensions.has(e.algorithm.forwarder)?[e.algorithm]:[]:Mg(e)?t=Og.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),vm(),(0,Pp.t)({bufferSize:1,refCount:!0})),i=t.pipe((0,co.n)(e=>{const i=this.application.policy.policiesByType$(_h.PasswordGenerator,e).pipe((0,l.T)(e=>function(e){const t=e.filter(e=>e.type===_h.PasswordGenerator&&e.enabled).reduce((e,t)=>{var i;return"password"===e?e:null!==(i=t.data.overridePasswordType)&&void 0!==i?i:e},null),i=[...$g[bm.email],...$g[bm.username]];return t?i.push(t):i.push(...$g[bm.password]),i}(e).filter(e=>this._metadata.has(e)).sort()),mm(e=>new Set(e),{key:e=>e.join(":")}),(0,lo.F)(),(0,Jv.Q)(hm(t)));return i}),(0,l.T)(e=>function(t){return xg(t)||e.has(t)}));return i}algorithms$(e,t){if(Ng(e)){const{type:i}=e;return this.isAvailable$(t).pipe((0,l.T)(e=>this.algorithms({type:i}).filter(e)))}if(Mg(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,Pp.t)({bufferSize:1,refCount:!0}));return this.preferences({account$:i}).pipe((0,l.T)(t=>t[e].algorithm),(0,lo.F)())}preferences(e){const t=e.account$.pipe((0,Pp.t)({bufferSize:1,refCount:!0})),i=this.isAvailable$({account$:t}).pipe((0,l.T)(e=>new mg(this.algorithms.bind(this),e,this.system)));return new Kg(Xg,this.system,{account$:t,constraints$:i})}}class Yg{constructor(e,t){this.providers=e,this.policyService=t,this.log=e.log({type:"GeneratorProfileProvider"})}settings(e,t){const i=t.account$.pipe((0,Pp.t)({bufferSize:1,refCount:!0})),n=this.constraints$(e,{account$:i});return new Kg(e.storage,this.providers,{constraints$:n,account$:i})}constraints$(e,t){const i=t.account$.pipe((0,Pp.t)({bufferSize:1,refCount:!0})),n=i.pipe((0,lo.F)((e,t)=>e.email===t.email&&e.emailVerified===t.emailVerified),(0,co.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,Oo.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,lo.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,Fo.M)(e=>this.log.debug(e,"constraints updated")));return s}),(0,Jv.Q)(hm(i)));return n}}function Wg(e){return(0,Zv.F)(um(e.combine,e.disabledValue),dm(),(0,l.T)(e.createEvaluator))}function Hg(){return()=>(0,Zv.F)((0,l.T)(e=>new Hm))}class Jg{}var Zg=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 Qg extends Jg{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 Zg(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 Zg(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 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=null){this.key=t,this.output=i,this.bufferedState=e.getUser(i.userId,t.toKeyDefinition());const r=(0,rm.x)((0,Oo.of)(null),this.bufferedState.state$).pipe((0,l.T)(e=>null!==(null!=e?e:null))),s=(null!=n?n:(0,Oo.of)(!0)).pipe((0,l.T)(e=>[t.shouldOverwrite(e),e])),o=(0,$o.z)([r,s]).pipe((0,yo.H)(e=>ey(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,bo.h)(o,a).pipe((0,To.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 ey(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 ey(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 iy{}const ny=Object.freeze({padding:"0",divider:"|",hasInvalidPadding:/[^0]/});class ry extends iy{constructor(e){super(),this.frameSize=e}pack(e){const t=JSON.stringify(e),i=kd.fromUtf8ToB64(t),n=JSON.stringify(this.frameSize),r=2*ny.divider.length,s=i.length+n.length+r,o=this.frameSize-s%this.frameSize;return`${n}|${i}|${ny.padding.repeat(o)}`}unpack(e){const t=e.indexOf(ny.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(ny.divider);if(r==t)throw new Error("missing json object");const s=r+1;if(e.slice(s).match(ny.hasInvalidPadding))throw new Error("invalid padding");const o=e.slice(n,r),a=kd.fromB64ToUtf8(o);return JSON.parse(a)}}class sy{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 sy(e,t,i,n,e=>[[null,e]],([[,e]])=>e)}static array(e,t,i,n){return new sy(e,t,i,n,e=>e.map((e,t)=>[t,e]),e=>e.map(([,e])=>e))}static record(e,t,i,n){return new sy(e,t,i,n,e=>Object.entries(e),e=>Object.fromEntries(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())})};class ay{constructor(e,t,i,n){this.key=e,this.$encryptor=t,this.encryptedState=n.getUser(i,e.toEncryptedStateKey()),this.combinedState$=(0,$o.z)([this.encryptedState.combinedState$,this.$encryptor]).pipe((0,yo.H)(e=>oy(this,[e],void 0,function*([[e,t],i]){return[e,yield this.declassifyAll(i,t)]})),(0,wo.u)({connector:()=>new So.m(1),resetOnRefCountZero:()=>{var t;return(0,ko.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 ay(t,n,e,i)}declassifyItem(e,t){return oy(this,arguments,void 0,function*(e,{id:t,secret:i,disclosed:n}){const r=up.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 oy(this,void 0,void 0,function*(){if(null==t)return null;const i=t.map(t=>oy(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 oy(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 oy(this,void 0,void 0,function*(){if(null==t)return null;const i=this.key.deconstruct(t).map(t=>oy(this,void 0,void 0,function*(){return this.classifyItem(e,t)}));return yield Promise.all(i)})}update(e){return oy(this,arguments,void 0,function*(e,t=null){var i,n,r;const s=(0,$o.z)([null!==(i=null==t?void 0:t.combineLatestWith)&&void 0!==i?i:(0,Oo.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 ly{}class cy{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 uy=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 dy extends ly{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=_h.PasswordGenerator,this.defaults$=Em(()=>this.configuration.forwarder.defaultSettings),this.toEvaluator=Hg(),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=>uy(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 ry(512),i=this.keyService.userKey$(e).pipe((0,l.T)(i=>i?new Qg(e,this.encryptService,i,t):null),(0,To.p)(e=>!!e)),n=new cy,r=sy.value(this.key.stateDefinition,this.key.key,n,{deserializer:e=>this.key.deserializer(e),cleanupDelayMs:this.key.cleanupDelayMs,clearOn:this.key.clearOn}),s=ay.from(e,r,this.stateProvider,i),o=this.keyService.userKey$(e).pipe((0,l.T)(e=>null!==e));return new ty(this.stateProvider,this.rolloverKey,s,o)}createContext(e,t){return new Im(e,t,this.i18nService)}createForwardingAddress(e,t){const i=this.createContext(e,t);return new kg(e,i)}getAccountId(e,t){if(!e.forwarder.getAccountId)return null;const i=this.createContext(e,t);return new Ig(e,i)}}const hy=new k(me,"passwordGeneratorSettings",{deserializer:e=>e,clearOn:[]}),py=new k(me,"passphraseGeneratorSettings",{deserializer:e=>e,clearOn:[]}),fy=new k(me,"effUsernameGeneratorSettings",{deserializer:e=>e,clearOn:[]}),vy=new k(me,"catchallGeneratorSettings",{deserializer:e=>e,clearOn:[]}),my=new k(me,"subaddressGeneratorSettings",{deserializer:e=>e,clearOn:[]});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){this.randomizer=e,this.stateProvider=t,this.durableState=$m(py,this.stateProvider),this.defaults$=Em(()=>uv),this.policy=_h.PasswordGenerator}toEvaluator(){return Wg({type:_h.PasswordGenerator,disabledValue:Object.freeze({minNumberWords:0,capitalize:!1,includeNumber:!1}),combine:fg,createEvaluator:e=>new ug(e)})}generate(e){return gy(this,void 0,void 0,function*(){const t=Mm(e);return this.randomizer.randomEffLongWords(t)})}}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())})};class wy{constructor(e,t){this.randomizer=e,this.stateProvider=t,this.durableState=$m(hy,this.stateProvider),this.defaults$=Em(()=>dv),this.policy=_h.PasswordGenerator}toEvaluator(){return Wg({type:_h.PasswordGenerator,disabledValue:{minLength:0,useUppercase:!1,useLowercase:!1,useNumbers:!1,numberCount:0,useSpecial:!1,specialCount:0},combine:vg,createEvaluator:e=>new pg(e)})}generate(e){return by(this,void 0,void 0,function*(){const t=Um(e);return yield this.randomizer.randomAscii(t)})}}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 ky{constructor(e,t,i,n=ov){this.emailCalculator=e,this.emailRandomizer=t,this.stateProvider=i,this.defaultOptions=n,this.durableState=$m(vy,this.stateProvider),this.defaults$=Em(()=>this.defaultOptions),this.toEvaluator=Hg(),this.policy=_h.PasswordGenerator}generate(e){return Sy(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 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=hv){this.emailCalculator=e,this.emailRandomizer=t,this.stateProvider=i,this.defaultOptions=n,this.durableState=$m(my,this.stateProvider),this.defaults$=Em(()=>this.defaultOptions),this.toEvaluator=Hg(),this.policy=_h.PasswordGenerator}generate(e){return Iy(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 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())})};const Py=Object.freeze({enabled:4,disabled:0});class Fy{constructor(e,t,i=cv){this.randomizer=e,this.stateProvider=t,this.defaultOptions=i,this.durableState=$m(fy,this.stateProvider),this.defaults$=Em(()=>this.defaultOptions),this.toEvaluator=Hg(),this.policy=_h.PasswordGenerator}generate(e){return Ty(this,void 0,void 0,function*(){var t,i;const n=(null!==(t=e.wordCapitalize)&&void 0!==t?t:cv.wordCapitalize)?"TitleCase":"lowercase",r=(null!==(i=e.wordIncludeNumber)&&void 0!==i?i:cv.wordIncludeNumber)?Py.enabled:Py.disabled;return yield this.randomizer.randomWords({numberOfWords:1,casing:n,digits:r})})}}class Ry{constructor(e,t){this.password=e,this.date=t}}class xy{}class Ay{constructor(e,t,i){this.credential=e,this.category=t,this.generationDate="number"==typeof i?new Date(i):i}static fromJSON(e){return new Ay(e.credential,e.category,e.generationDate)}toJSON(){return{credential:this.credential,category:this.category,generationDate:this.generationDate.valueOf()}}}class Dy{constructor(e,t){this.disclosed=e,this.excluded=t}static allSecret(){const e=Object.freeze([]),t=Object.freeze([]);return new Dy(e,t)}disclose(e){const t=[...this.disclosed,e];return new Dy(Object.freeze(t),this.excluded)}exclude(e){const t=[...this.excluded,e];return new Dy(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 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())})};const $y=sy.array(me,"localGeneratorHistory",Dy.allSecret(),{deserializer:Ay.fromJSON,clearOn:["logout"]}),Oy=new mv(me,"localGeneratorHistoryBuffer",{deserializer(e){const t=e;return null==t?void 0:t.map(e=>new Ry(e.password,e.date))},isValid(e){return Ey(this,void 0,void 0,function*(){return!!e.length})},map(e,t){return Ey(this,void 0,void 0,function*(){return(yield t.decrypt(e)).map(e=>new Ay(e.password,"password",e.date))})},clearOn:["logout"]});var Uy=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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{constructor(e,t,i){this.userId=e,this.keyService=t,this.encryptService=i}decrypt(e){return Uy(this,void 0,void 0,function*(){const t=yield(0,ho._)(this.keyService.userKey$(this.userId));if(null==t)throw new Error("No user key found for decryption");const i=(null!=e?e:[]).map(e=>Uy(this,void 0,void 0,function*(){const i=new up(e.password),n=yield this.encryptService.decryptString(i,t);return new Ry(n,e.date)}));return yield Promise.all(i)})}}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 Vy 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)=>Ny(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 Ay(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)=>Ny(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=>Ny(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 ry(2048),i=this.keyService.userKey$(e).pipe((0,l.T)(i=>i?new Qg(e,this.encryptService,i,t):null),(0,To.p)(e=>!!e)),n=ay.from(e,$y,this.stateProvider,i),r=new My(e,this.keyService,this.encryptService),s=this.keyService.userKey$(e).pipe((0,l.T)(e=>e&&r));return new ty(this.stateProvider,Oy,n,s)}}const By=Object.freeze({type:"password",username:"word",forwarder:""});class jy{constructor(e){this.policy=e}get policyInEffect(){var e;return $g[bm.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:By.type})}}function Gy(e,t){if(!(t.type===_h.PasswordGenerator&&t.enabled))return e;return"password"!==e.overridePasswordType&&t.data.overridePasswordType?Object.assign(Object.assign({},e),{overridePasswordType:t.data.overridePasswordType}):e}const Ly=Object.freeze({overridePasswordType:null}),zy=new k(me,"generatorSettings",{deserializer:e=>e,clearOn:["logout"]});var _y=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 Ky{constructor(e,t){this.stateProvider=e,this.policy=t}options$(e){return this.stateProvider.getUserState$(zy,e)}defaults$(e){return new fd.t(Object.assign({},By))}evaluator$(e){return this.policy.policiesByType$(_h.PasswordGenerator,e).pipe(um(Gy,Ly),dm(),(0,l.T)(e=>new jy(e)))}enforcePolicy(e,t){return _y(this,void 0,void 0,function*(){const i=yield(0,ho._)(this.evaluator$(e)),n=i.applyPolicy(t);return i.sanitize(n)})}saveOptions(e,t){return _y(this,void 0,void 0,function*(){yield this.stateProvider.setUserState(zy,t,e)})}}class Xy extends _p{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 Xy;return Object.assign(e,this),e}}var qy=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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,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,yo.H)(t=>(0,rm.x)((0,Oo.of)([null,null,[null,-1],null,null,[null,-1],null,null,[null,-1]]),(0,$o.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,Qv.J)(),(0,l.T)(function([e,t]){const[,,[,i],,,[,n],,,[,r]]=e,[s,o,[a,l],c,u,[d,h],p,f,[v,m]]=t;return[s,o,a,c,u,d,p,f,v,i{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 Xy,i.policy,s.policy,l.policy)]}))}getOptions(){return qy(this,void 0,void 0,function*(){return yield(0,ho._)(this.getOptions$())})}enforcePasswordGeneratorPoliciesOnOptions(e){return qy(this,void 0,void 0,function*(){const t=this.accountService.activeAccount$.pipe((0,yo.H)(e=>(0,Wv.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 Xy,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,ho._)(t);return[Object.assign(e,i),n]})}saveOptions(e){return qy(this,void 0,void 0,function*(){const t=this.toStoredOptions(e),i=yield(0,ho._)(this.accountService.activeAccount$),n=(0,Wv.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,ho._)(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,yo.H)(e=>this.history.credentials$(e.id)),(0,po.w)({each:1e3,with(){return[]}}),(0,l.T)(e=>e.map(Wy)));return(0,ho._)(e)}addHistory(e){return qy(this,void 0,void 0,function*(){const t=yield(0,ho._)(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,To.p)(e=>!!(null==e?void 0:e.id)),(0,yo.H)(e=>this.history.clear(e.id)),(0,po.w)({each:1e3,with(){return[]}}),(0,l.T)(e=>e.map(Wy)));return(0,ho._)(e)}}function Wy(e){return new Ry(e.credential,e.generationDate.valueOf())}const{jK:Hy,gb:Jy}=r,{q4:Zy,Zx:Qy}=n,eb=qv;class tb{}var ib=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 nb{constructor(e,t){this.api=e,this.i18n=t}fetchJson(e,t){return ib(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 ib(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 ib(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 rb=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 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())})};class ob{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 rb.AddyIo.id:case pv.addyio:return this.addyIo.generate(t.forwarders.addyIo);case rb.DuckDuckGo.id:return this.duckDuckGo.generate(t.forwarders.duckDuckGo);case rb.Fastmail.id:return this.fastmail.generate(t.forwarders.fastmail);case rb.FirefoxRelay.id:case pv.mozilla:return this.firefoxRelay.generate(t.forwarders.firefoxRelay);case rb.ForwardEmail.id:return this.forwardEmail.generate(t.forwarders.forwardEmail);case rb.SimpleLogin.id:return this.simpleLogin.generate(t.forwarders.simpleLogin)}}getOptions$(){return this.accountService.activeAccount$.pipe((0,yo.H)(e=>(0,$o.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,f,v,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!=f?f:v,forwardEmail:null!=m?m:g,simpleLogin:null!=y?y:b}})))}getOptions(){return(0,ho._)(this.getOptions$())}saveOptions(e){return sb(this,void 0,void 0,function*(){const t=this.toStoredOptions(e),i=yield(0,ho._)(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 sb(this,void 0,void 0,function*(){const i=(0,Wv.y)(this.navigation.options$(e),this.navigation.defaults$(e)).pipe((0,l.T)(([e,t])=>null!=e?e:t));let n=yield(0,ho._)(i);n=Object.assign(n,t.generator),yield this.navigation.saveOptions(e,n)})}saveGeneratorOptions(e,t,i){return sb(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 sb(this,void 0,void 0,function*(){switch(t){case rb.AddyIo.id:case pv.addyio:return yield this.addyIo.saveOptions(e,i.forwarders.addyIo),!0;case rb.DuckDuckGo.id:return yield this.duckDuckGo.saveOptions(e,i.forwarders.duckDuckGo),!0;case rb.Fastmail.id:return yield this.fastmail.saveOptions(e,i.forwarders.fastmail),!0;case rb.FirefoxRelay.id:case pv.mozilla:return yield this.firefoxRelay.saveOptions(e,i.forwarders.firefoxRelay),!0;case rb.ForwardEmail.id:return yield this.forwardEmail.saveOptions(e,i.forwarders.forwardEmail),!0;case rb.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{q4:ab,QS:lb,Mt:cb,Lq:ub}=n,db=qv,{B:hb,Vm:pb,KQ:fb,ji:vb}=r;function mb(e,t){if(1&e&&(yl.j41(0,"li"),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()),2&e){const e=yl.XpG(2);yl.R7$(),yl.SpI(" ",yl.i5U(2,1,"policyInEffectMinComplexity",e.getPasswordScoreAlertDisplay())," ")}}function gb(e,t){if(1&e&&(yl.j41(0,"li"),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()),2&e){const e=yl.XpG(2);yl.R7$(),yl.SpI(" ",yl.i5U(2,1,"policyInEffectMinLength",null==e.policy?null:e.policy.minLength.toString())," ")}}function yb(e,t){1&e&&(yl.j41(0,"li"),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()),2&e&&(yl.R7$(),yl.SpI(" ",yl.bMT(2,1,"policyInEffectUppercase")," "))}function bb(e,t){1&e&&(yl.j41(0,"li"),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()),2&e&&(yl.R7$(),yl.SpI(" ",yl.bMT(2,1,"policyInEffectLowercase")," "))}function wb(e,t){1&e&&(yl.j41(0,"li"),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()),2&e&&(yl.R7$(),yl.SpI(" ",yl.bMT(2,1,"policyInEffectNumbers")," "))}function Sb(e,t){1&e&&(yl.j41(0,"li"),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()),2&e&&(yl.R7$(),yl.SpI(" ",yl.i5U(2,1,"policyInEffectSpecial","!@#$%^&*")," "))}function kb(e,t){if(1&e&&(yl.j41(0,"ul",1),yl.DNE(1,mb,3,4,"li",2)(2,gb,3,4,"li",2)(3,yb,3,3,"li",2)(4,bb,3,3,"li",2)(5,wb,3,3,"li",2)(6,Sb,3,4,"li",2),yl.k0s()),2&e){const e=yl.XpG();yl.R7$(),yl.Y8G("ngIf",(null==e.policy?null:e.policy.minComplexity)>0),yl.R7$(),yl.Y8G("ngIf",(null==e.policy?null:e.policy.minLength)>0),yl.R7$(),yl.Y8G("ngIf",null==e.policy?null:e.policy.requireUpper),yl.R7$(),yl.Y8G("ngIf",null==e.policy?null:e.policy.requireLower),yl.R7$(),yl.Y8G("ngIf",null==e.policy?null:e.policy.requireNumbers),yl.R7$(),yl.Y8G("ngIf",null==e.policy?null:e.policy.requireSpecial)}}class Ib{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 Cb;function Tb(e,t,i,n,r="controlB"){return s=>{if(!(s instanceof fl.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===Cb.InputsShouldMatch?c?d():u():e===Cb.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}}}Ib.ɵfac=function(e){return new(e||Ib)(yl.rXU(Pl))},Ib.ɵcmp=yl.VBU({type:Ib,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&&(yl.j41(0,"bit-callout"),yl.EFF(1),yl.nI1(2,"i18n"),yl.DNE(3,kb,7,6,"ul",0),yl.k0s()),2&e&&(yl.R7$(),yl.SpI(" ",yl.bMT(2,2,t.message)," "),yl.R7$(2),yl.Y8G("ngIf",t.policy))},dependencies:[pl.MD,pl.bT,qf,td,ed,Xf],encapsulation:2}),function(e){e[e.InputsShouldMatch=0]="InputsShouldMatch",e[e.InputsShouldNotMatch=1]="InputsShouldNotMatch"}(Cb||(Cb={}));class Pb{}class Fb{}const Rb=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 xb{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:Rb(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})}}xb.ɵfac=function(e){return new(e||xb)(a.KVO(ml.tw))},xb.ɵprov=a.jDH({token:xb,factory:xb.ɵfac,providedIn:"root"});class Ab{}class Db extends Ab{}class Eb{}class $b{}class Ob extends $b{}class Ub{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(fl.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 Mb(e,t){if(1&e&&(yl.Hgh(0,"i",0),yl.EFF(1),yl.nI1(2,"i18n")),2&e){const e=yl.XpG();yl.R7$(),yl.SpI(" ",yl.i5U(2,1,"fieldsNeedAttention",e.errorString)," ")}}Ub.ɵfac=function(e){return new(e||Ub)(yl.rXU(fl.vO,10))},Ub.ɵcmp=yl.VBU({type:Ub,selectors:[["input","type","checkbox","bitCheckbox",""]],hostVars:7,hostBindings:function(e,t){2&e&&(yl.Avn("disabled",t.disabled),yl.HbH(t.inputClasses),yl.xc7("--mask-image",t.maskImage)("--indeterminate-mask-image",t.indeterminateImage))},inputs:{disabledInput:[1,"disabled","disabledInput"]},features:[yl.Jv_([{provide:oc,useExisting:Ub}])],attrs:["type","checkbox","bitCheckbox",""],decls:0,vars:0,template:function(e,t){},encapsulation:2});class Nb{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 fl.J3?e+this.getErrorCount(t):null==t.errors||!t.dirty&&t.untouched?e:e+Object.keys(t.errors).length,0)}}Nb.ɵfac=function(e){return new(e||Nb)},Nb.ɵcmp=yl.VBU({type:Nb,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&&yl.nVh(0,Mb,3,4),2&e&&yl.vxM(t.errorCount>0?0:-1)},dependencies:[Hl],encapsulation:2});class Vb{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 yl.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))}}Vb.ɵfac=function(e){return new(e||Vb)(yl.rXU(zl,1),yl.rXU(Du),yl.rXU(Pl))},Vb.ɵdir=yl.FsC({type:Vb,selectors:[["","bitPasswordInputToggle",""]],hostVars:3,hostBindings:function(e,t){1&e&&yl.bIt("click",function(){return t.onClick()}),2&e&&yl.BMQ("aria-pressed",t.toggled())("title",t.title)("aria-label",t.label)},inputs:{toggled:[1,"toggled"]},outputs:{toggled:"toggledChange",toggledChange:"toggledChange"},features:[yl.OA$]});class Bb{constructor(e){this.iconButtonComponent=e,this.classList=["tw-text-muted"]}ngOnInit(){this.iconButtonComponent&&this.iconButtonComponent.size.set("small")}}Bb.ɵfac=function(e){return new(e||Bb)(yl.rXU(zl,8))},Bb.ɵdir=yl.FsC({type:Bb,selectors:[["","bitSuffix",""]],hostVars:2,hostBindings:function(e,t){2&e&&yl.HbH(t.classList)}});class jb{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,bl.QZ)(()=>{kl({element:this.el.nativeElement,title:null!=t?t:this.title(),label:null!=i?i:this.title()})})}}jb.ɵfac=function(e){return new(e||jb)(yl.rXU(yl.aKT))},jb.ɵdir=yl.FsC({type:jb,selectors:[["","appA11yTitle",""]],inputs:{title:[1,"appA11yTitle","title"]}});const Gb={primary:["!tw-text-primary-600","hover:!tw-text-primary-700","focus-visible:before:tw-ring-primary-600"],secondary:["!tw-text-main","hover:!tw-text-main","focus-visible:before:tw-ring-primary-600"],contrast:["!tw-text-contrast","hover:!tw-text-contrast","focus-visible:before:tw-ring-text-contrast"],light:["!tw-text-alt2","hover:!tw-text-alt2","focus-visible:before:tw-ring-text-alt2"]},Lb=["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","hover:tw-underline","hover:tw-decoration-1","disabled:tw-no-underline","disabled:tw-cursor-not-allowed","disabled:!tw-text-secondary-300","disabled:hover:!tw-text-secondary-300","disabled:hover:tw-no-underline","focus-visible:tw-outline-none","focus-visible:tw-underline","focus-visible:tw-decoration-1","tw-relative","before:tw-content-['']","before:tw-block","before:tw-absolute","before:-tw-inset-x-[0.1em]","before:tw-rounded-md","before:tw-transition","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-secondary-300","aria-disabled:hover:!tw-text-secondary-300","aria-disabled:hover:tw-no-underline"];class zb{constructor(){this.linkType=(0,o.hFB)("primary")}}zb.ɵfac=function(e){return new(e||zb)},zb.ɵdir=yl.FsC({type:zb,inputs:{linkType:[1,"linkType"]}});class _b extends zb{get classList(){var e;return["before:-tw-inset-y-[0.125rem]"].concat(Lb).concat(null!==(e=Gb[this.linkType()])&&void 0!==e?e:[])}}_b.ɵfac=(()=>{let e;return function(t){return(e||(e=yl.xGo(_b)))(t||_b)}})(),_b.ɵdir=yl.FsC({type:_b,selectors:[["a","bitLink",""]],hostVars:2,hostBindings:function(e,t){2&e&&yl.HbH(t.classList)},features:[yl.Vt3]});class Kb extends zb{get classList(){var e;return["before:-tw-inset-y-[0.25rem]"].concat(Lb).concat(null!==(e=Gb[this.linkType()])&&void 0!==e?e:[])}constructor(){super(),this.el=(0,a.WQX)(yl.aKT),this.disabled=(0,o.hFB)(!1,{transform:o.L39}),Ml(this.el.nativeElement,this.disabled)}}Kb.ɵfac=function(e){return new(e||Kb)},Kb.ɵdir=yl.FsC({type:Kb,selectors:[["button","bitLink",""]],hostVars:2,hostBindings:function(e,t){2&e&&yl.HbH(t.classList)},inputs:{disabled:[1,"disabled"]},features:[yl.nM4([Vl]),yl.Vt3]});var Xb,qb=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 Yb(e,t){if(1&e&&yl.nrm(0,"auth-password-callout",13),2&e){const e=yl.XpG();yl.Y8G("message",e.flow===e.InputPasswordFlow.ChangePasswordDelegation?"changePasswordDelegationMasterPasswordPolicyInEffect":"masterPasswordPolicyInEffect")("policy",e.masterPasswordPolicyOptions)}}function Wb(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"bit-form-field")(1,"bit-label"),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.nrm(4,"input",14),yl.j41(5,"button",8),yl.mxI("toggledChange",function(t){a.eBV(e);const i=yl.XpG();return yl.DH7(i.showPassword,t)||(i.showPassword=t),a.Njj(t)}),yl.k0s()()}if(2&e){const e=yl.XpG();yl.R7$(2),yl.JRh(yl.bMT(3,2,"currentMasterPass")),yl.R7$(3),yl.R50("toggled",e.showPassword)}}function Hb(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",15),yl.nI1(1,"i18n"),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.generatePassword())}),yl.k0s()}2&e&&yl.Y8G("label",yl.bMT(1,1,"generatePassword"))}function Jb(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",16),yl.nI1(1,"i18n"),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.copy())}),yl.k0s()}2&e&&yl.Y8G("label",yl.mNQ(yl.bMT(1,2,"copyPassword")))}function Zb(e,t){if(1&e&&(yl.j41(0,"bit-hint")(1,"span",17),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.EFF(4),yl.nI1(5,"i18n"),yl.k0s()),2&e){const e=yl.XpG();yl.R7$(2),yl.SpI("",yl.bMT(3,3,"important")," "),yl.R7$(2),yl.Lme(" ",yl.bMT(5,5,"masterPassImportant")," ",e.minPasswordLengthMsg,". ")}}function Qb(e,t){if(1&e&&(yl.qex(0),yl.j41(1,"bit-form-field")(2,"bit-label"),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s(),yl.nrm(5,"input",18),yl.j41(6,"bit-hint"),yl.EFF(7),yl.nI1(8,"i18n"),yl.k0s()(),yl.j41(9,"bit-form-control"),yl.nrm(10,"input",19),yl.j41(11,"bit-label"),yl.EFF(12),yl.nI1(13,"i18n"),yl.k0s()(),yl.bVm()),2&e){const e=yl.XpG();yl.R7$(3),yl.JRh(yl.bMT(4,3,"masterPassHintLabel")),yl.R7$(4),yl.SpI(" ",yl.brH(8,5,"masterPassHintText",e.formGroup.value.newPasswordHint.length.toString(),e.maxHintLength.toString())," "),yl.R7$(5),yl.JRh(yl.bMT(13,9,"checkForBreaches"))}}function ew(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"bit-form-control")(1,"input",20),yl.bIt("change",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.rotateUserKeyClicked())}),yl.k0s(),yl.j41(2,"bit-label"),yl.EFF(3),yl.nI1(4,"i18n"),yl.j41(5,"a",21),yl.nI1(6,"i18n"),yl.nrm(7,"i",22),yl.k0s()()()}2&e&&(yl.R7$(3),yl.SpI(" ",yl.bMT(4,3,"rotateAccountEncKey")," "),yl.R7$(2),yl.Y8G("appA11yTitle",yl.mNQ(yl.bMT(6,5,"impactOfRotatingYourEncryptionKey"))))}function tw(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",26),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG(2);return a.Njj(t.onSecondaryButtonClick.emit())}),yl.EFF(1),yl.k0s()}if(2&e){const e=yl.XpG(2);yl.Y8G("loading",e.loading),yl.R7$(),yl.SpI(" ",e.secondaryButtonTextStr," ")}}function iw(e,t){if(1&e&&(yl.j41(0,"div",23)(1,"button",24),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.DNE(4,tw,2,2,"button",25),yl.k0s()),2&e){const e=yl.XpG();yl.Y8G("ngClass",e.inlineButtons?"tw-flex-row":"tw-flex-col"),yl.R7$(),yl.Y8G("loading",e.loading),yl.R7$(),yl.SpI(" ",e.primaryButtonTextStr||yl.bMT(3,4,"setMasterPassword")," "),yl.R7$(2),yl.Y8G("ngIf",e.secondaryButtonText)}}function nw(e,t){if(1&e&&yl.nrm(0,"bit-error-summary",27),2&e){const e=yl.XpG();yl.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"}(Xb||(Xb={}));class rw{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){this.auditService=e,this.cipherService=t,this.dialogService=i,this.formBuilder=n,this.i18nService=r,this.kdfConfigService=s,this.keyService=o,this.masterPasswordService=a,this.passwordGenerationService=l,this.platformUtilsService=c,this.policyService=u,this.toastService=d,this.validationService=h,this.passwordStrengthComponent=void 0,this.onPasswordFormSubmit=new yl.bkB,this.onSecondaryButtonClick=new yl.bkB,this.isSubmitting=new yl.bkB,this.loading=!1,this.inlineButtons=!1,this.primaryButtonTextStr="",this.secondaryButtonTextStr="",this.InputPasswordFlow=Xb,this.kdfConfig=null,this.minHintLength=0,this.maxHintLength=50,this.minPasswordLength=kd.minimumPasswordLength,this.minPasswordMsg="",this.passwordStrengthScore=0,this.showErrorSummary=!1,this.showPassword=!1,this.formGroup=this.formBuilder.nonNullable.group({newPassword:this.formBuilder.nonNullable.control("",[fl.k0.required,fl.k0.minLength(this.minPasswordLength)]),newPasswordConfirm:this.formBuilder.nonNullable.control("",fl.k0.required)},{validators:[Tb(Cb.InputsShouldMatch,"newPassword","newPasswordConfirm",this.i18nService.t("masterPassDoesntMatch"))]}),this.submit=()=>qb(this,void 0,void 0,function*(){var e,t,i,n,r,s,o;try{if(this.isSubmitting.emit(!0),this.verifyFlow(),this.formGroup.markAllAsTouched(),this.formGroup.invalid)return void(this.showErrorSummary=!0);const a=null!==(t=null===(e=this.formGroup.controls.currentPassword)||void 0===e?void 0:e.value)&&void 0!==t?t:"",l=this.formGroup.controls.newPassword.value,c=null!==(n=null===(i=this.formGroup.controls.newPasswordHint)||void 0===i?void 0:i.value)&&void 0!==n?n:"",u=null===(s=null===(r=this.formGroup.controls.checkForBreaches)||void 0===r?void 0:r.value)||void 0===s||s;if(this.flow===Xb.ChangePasswordDelegation)return yield this.handleChangePasswordDelegationFlow(l);if(!this.email)throw new Error("Email is required to create master key.");if(this.flow===Xb.SetInitialPasswordAccountRegistration)this.kdfConfig=Ef;else{if(!this.userId)throw new Error("userId not passed down");this.kdfConfig=yield(0,ho._)(this.kdfConfigService.getKdfConfig$(this.userId))}if(null==this.kdfConfig)throw new Error("KdfConfig is required to create master key.");const d=null!=this.userId?yield(0,ho._)(this.masterPasswordService.saltForUser$(this.userId)):this.masterPasswordService.emailToSalt(this.email);if(null==d)throw new Error("Salt is required to create master key.");if(this.flow===Xb.ChangePassword||this.flow===Xb.ChangePasswordWithOptionalUserKeyRotation){if(!(yield this.verifyCurrentPassword(a,this.kdfConfig)))return}if(!(yield this.verifyNewPassword(l,this.passwordStrengthScore,u)))return;const h=yield this.keyService.makeMasterKey(l,this.email,this.kdfConfig),p=yield this.keyService.hashMasterKey(l,h,ep.ServerAuthorization),f={newPassword:l,salt:d,newMasterKey:h,newServerMasterKeyHash:p,newLocalMasterKeyHash:yield this.keyService.hashMasterKey(l,h,ep.LocalAuthorization),newPasswordHint:c,kdfConfig:this.kdfConfig};if(this.flow===Xb.ChangePassword||this.flow===Xb.ChangePasswordWithOptionalUserKeyRotation){const e=yield this.keyService.makeMasterKey(a,this.email,this.kdfConfig),t=yield this.keyService.hashMasterKey(a,e,ep.ServerAuthorization),i=yield this.keyService.hashMasterKey(a,e,ep.LocalAuthorization);f.currentPassword=a,f.currentMasterKey=e,f.currentServerMasterKeyHash=t,f.currentLocalMasterKeyHash=i}return this.flow===Xb.ChangePasswordWithOptionalUserKeyRotation&&(f.rotateUserKey=null===(o=this.formGroup.controls.rotateUserKey)||void 0===o?void 0:o.value),this.onPasswordFormSubmit.emit(f),f}catch(e){this.validationService.showError(e)}finally{this.isSubmitting.emit(!1)}})}ngOnInit(){this.addFormFieldsIfNecessary(),this.setButtonText()}addFormFieldsIfNecessary(){this.flow!==Xb.ChangePasswordDelegation&&(this.formGroup.addControl("newPasswordHint",this.formBuilder.nonNullable.control("",[fl.k0.minLength(this.minHintLength),fl.k0.maxLength(this.maxHintLength)])),this.formGroup.addValidators([Tb(Cb.InputsShouldNotMatch,"newPassword","newPasswordHint",this.i18nService.t("hintEqualsPassword"))]),this.formGroup.addControl("checkForBreaches",this.formBuilder.nonNullable.control(!0))),this.flow!==Xb.ChangePassword&&this.flow!==Xb.ChangePasswordWithOptionalUserKeyRotation||(this.formGroup.addControl("currentPassword",this.formBuilder.nonNullable.control("",fl.k0.required)),this.formGroup.addValidators([Tb(Cb.InputsShouldNotMatch,"currentPassword","newPassword",this.i18nService.t("yourNewPasswordCannotBeTheSameAsYourCurrentPassword"))])),this.flow===Xb.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===Xb.SetInitialPasswordAccountRegistration||this.flow===Xb.ChangePasswordDelegation)&&this.userId)throw new Error("There should be no active account userId passed down in a this flow.");if(this.flow!==Xb.SetInitialPasswordAccountRegistration&&this.flow!==Xb.ChangePasswordDelegation&&!this.userId)throw new Error("This flow requires that an active account userId be passed down.");if(this.flow===Xb.ChangePasswordDelegation&&this.email)throw new Error("There should be no email passed down in this flow.");if(this.flow!==Xb.ChangePasswordDelegation&&!this.email)throw new Error("This flow requires that an email be passed down.")}handleChangePasswordDelegationFlow(e){return qb(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 qb(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 qb(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 qb(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;enull==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&&(yl.j41(0,"form",0),yl.DNE(1,Yb,1,2,"auth-password-callout",1)(2,Wb,6,4,"bit-form-field",2),yl.j41(3,"div",3)(4,"bit-form-field",4)(5,"bit-label"),yl.EFF(6),yl.nI1(7,"i18n"),yl.nI1(8,"i18n"),yl.k0s(),yl.nrm(9,"input",5),yl.DNE(10,Hb,2,3,"button",6)(11,Jb,2,4,"button",7),yl.j41(12,"button",8),yl.mxI("toggledChange",function(e){return yl.DH7(t.showPassword,e)||(t.showPassword=e),e}),yl.k0s(),yl.DNE(13,Zb,6,7,"bit-hint",2),yl.k0s(),yl.j41(14,"tools-password-strength",9),yl.bIt("passwordStrengthScore",function(e){return t.getPasswordStrengthScore(e)}),yl.k0s()(),yl.j41(15,"bit-form-field")(16,"bit-label"),yl.EFF(17),yl.nI1(18,"i18n"),yl.nI1(19,"i18n"),yl.k0s(),yl.nrm(20,"input",10),yl.j41(21,"button",8),yl.mxI("toggledChange",function(e){return yl.DH7(t.showPassword,e)||(t.showPassword=e),e}),yl.k0s()(),yl.DNE(22,Qb,14,11,"ng-container",2)(23,ew,8,7,"bit-form-control",2)(24,iw,5,6,"div",11)(25,nw,1,1,"bit-error-summary",12),yl.k0s()),2&e&&(yl.Y8G("formGroup",t.formGroup)("bitSubmit",t.submit),yl.R7$(),yl.Y8G("ngIf",t.masterPasswordPolicyOptions),yl.R7$(),yl.Y8G("ngIf",t.flow===t.InputPasswordFlow.ChangePassword||t.flow===t.InputPasswordFlow.ChangePasswordWithOptionalUserKeyRotation),yl.R7$(2),yl.Y8G("disableMargin",!0),yl.R7$(2),yl.JRh(t.flow===t.InputPasswordFlow.SetInitialPasswordAccountRegistration||t.flow===t.InputPasswordFlow.SetInitialPasswordAuthedUser?yl.bMT(7,19,"masterPassword"):yl.bMT(8,21,"newMasterPass")),yl.R7$(4),yl.Y8G("ngIf",t.flow===t.InputPasswordFlow.ChangePasswordDelegation),yl.R7$(),yl.Y8G("ngIf",t.flow===t.InputPasswordFlow.ChangePasswordDelegation),yl.R7$(),yl.R50("toggled",t.showPassword),yl.R7$(),yl.Y8G("ngIf",t.flow!==t.InputPasswordFlow.ChangePasswordDelegation),yl.R7$(),yl.Y8G("showText",!0)("email",t.email)("password",t.formGroup.controls.newPassword.value),yl.R7$(3),yl.JRh(t.flow===t.InputPasswordFlow.SetInitialPasswordAccountRegistration||t.flow===t.InputPasswordFlow.SetInitialPasswordAuthedUser?yl.bMT(18,23,"confirmMasterPassword"):yl.bMT(19,25,"confirmNewMasterPass")),yl.R7$(4),yl.R50("toggled",t.showPassword),yl.R7$(),yl.Y8G("ngIf",t.flow!==t.InputPasswordFlow.ChangePasswordDelegation),yl.R7$(),yl.Y8G("ngIf",t.flow===t.InputPasswordFlow.ChangePasswordWithOptionalUserKeyRotation),yl.R7$(),yl.Y8G("ngIf",t.flow!==t.InputPasswordFlow.ChangePasswordDelegation),yl.R7$(),yl.Y8G("ngIf",t.showErrorSummary))},dependencies:[rc,xd,Td,Xu,Ku,id,Ub,Eu,hc,Sc,nu,ou,Nb,Du,Vb,Bb,_l,zl,Vc,qf,jb,Ib,nv,fl.X1,fl.qT,fl.me,fl.Zm,fl.BC,fl.cb,fl.j4,fl.JD,Oh,_b,Kl,pl.YU,pl.bT,Hl],encapsulation:2});var sw=i(6056);class ow{constructor(e){this.svg=e}}class aw extends Error{constructor(){super("Dynamic content in icons is not allowed due to risk of user-injected XSS.")}}function lw(e,...t){if(t.length>0)throw new aw;return new ow(e[0])}const cw=lw` `,uw=lw` `;class dw{}class hw{}class pw{}class fw{}class vw extends fw{}class mw{}class gw{}class yw{}var bw;!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"}(bw||(bw={}));class ww{constructor(e=null,t=null,i=!1){this.provider=e,this.token=t,this.remember=i}}class Sw{constructor(e){this.id=e.id,this.rawId=kd.fromBufferToUrlB64(e.rawId),this.type=e.type,this.extensions={}}}class kw extends Sw{constructor(e){if(super(e),!(e.response instanceof AuthenticatorAssertionResponse))throw new Error("Invalid authenticator response");this.response={authenticatorData:kd.fromBufferToUrlB64(e.response.authenticatorData),signature:kd.fromBufferToUrlB64(e.response.signature),clientDataJSON:kd.fromBufferToUrlB64(e.response.clientDataJSON),userHandle:kd.fromBufferToUrlB64(e.response.userHandle)}}static fromJSON(e){return Object.assign(Object.create(kw.prototype),e)}}class Iw{constructor(e,t,i,n){this.email=e,this.masterPassword=t,this.twoFactor=i,this.masterPasswordPoliciesFromOrgInvite=n,this.type=bw.Password}}class Cw{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=bw.Sso}}class Tw{constructor(e,t,i,n,r,s,o){this.email=e,this.accessCode=t,this.authRequestId=i,this.decryptedUserKey=n,this.decryptedMasterKey=r,this.decryptedMasterKeyHash=s,this.twoFactor=o,this.type=bw.AuthRequest}static fromJSON(e){return Object.assign(new Tw(e.email,e.accessCode,e.authRequestId,null,null,e.decryptedMasterKeyHash,e.twoFactor?new ww(e.twoFactor.provider,e.twoFactor.token,e.twoFactor.remember):e.twoFactor),{decryptedUserKey:gf.fromJSON(e.decryptedUserKey),decryptedMasterKey:gf.fromJSON(e.decryptedMasterKey)})}}class Pw{constructor(e,t,i){this.token=e,this.deviceResponse=t,this.prfKey=i,this.type=bw.WebAuthn}static fromJSON(e){return new Pw(e.token,Object.assign(Object.create(kw.prototype),e.deviceResponse),gf.fromJSON(e.prfKey))}}class Fw{static fromResponse(e){var t;if(null==e)return;const i=new Fw;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 Fw,e)}}class Rw{static fromResponse(e){var t,i,n,r;if(null==e)return;const s=new Rw;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 Rw,e)}}class xw{static fromIdentityTokenResponse(e){if(null==e)throw new Error("User Decryption Options are required for client initialization. Response is nullish.");const t=new xw;if(!e.userDecryptionOptions)throw new Error("User Decryption Options are required for client initialization. userDecryptionOptions is missing in response.");{const i=e.userDecryptionOptions;t.hasMasterPassword=i.hasMasterPassword,t.trustedDeviceOption=Rw.fromResponse(i.trustedDeviceOption),t.keyConnectorOption=Fw.fromResponse(i.keyConnectorOption)}return t}static fromJSON(e){const t=Object.assign(new xw,e);return t.trustedDeviceOption=Rw.fromJSON(null==e?void 0:e.trustedDeviceOption),t.keyConnectorOption=Fw.fromJSON(null==e?void 0:e.keyConnectorOption),t}}var Aw=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 Dw=new m(M,"loginEmail",{deserializer:e=>e}),Ew=new m(U,"storedEmail",{deserializer:e=>e});class $w{constructor(e,t,i){this.accountService=e,this.authService=t,this.stateProvider=i,this.loginEmailState=this.stateProvider.getGlobal(Dw),this.storedEmailState=this.stateProvider.getGlobal(Ew),this.addingAccount$=this.authService.authStatuses$.pipe((0,co.n)(e=>Aw(this,void 0,void 0,function*(){const t=yield(0,ho._)(this.accountService.activeAccount$);return t&&delete e[t.id],Object.values(e).some(e=>e!==cd.LoggedOut)}))),this.loginEmail$=this.loginEmailState.state$,this.rememberedEmail$=this.storedEmailState.state$.pipe((0,co.n)(e=>Aw(this,void 0,void 0,function*(){return(yield(0,ho._)(this.addingAccount$))?null:e})))}setLoginEmail(e){return Aw(this,void 0,void 0,function*(){yield this.loginEmailState.update(t=>e)})}clearLoginEmail(){return Aw(this,void 0,void 0,function*(){yield this.loginEmailState.update(e=>null)})}setRememberedEmailChoice(e,t){return Aw(this,void 0,void 0,function*(){t?yield this.storedEmailState.update(t=>e):yield this.storedEmailState.update(e=>null)})}clearRememberedEmail(){return Aw(this,void 0,void 0,function*(){yield this.storedEmailState.update(e=>null)})}}class Ow{constructor(e){this.email=e}}class Uw{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 Mw extends Uw{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 Nw{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(Nw.prototype),e)}}class Vw{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 Bw extends Vw{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(Bw.prototype),e,{device:e.device?Nw.fromJSON(e.device):void 0,twoFactor:e.twoFactor?Object.assign(new ww,e.twoFactor):void 0})}}var jw,Gw;!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"}(jw||(jw={}));class Lw{constructor(){this.twoFactorProviders=null}get requiresTwoFactor(){return null!=this.twoFactorProviders}get requiresSso(){return!kd.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"}(Gw||(Gw={}));class zw extends Uw{constructor(e){var t;super(e),this.deviceVerified=null!==(t=this.getResponseProperty("DeviceVerified"))&&void 0!==t&&t}}class _w extends Uw{constructor(e){super(e),this.ssoOrganizationIdentifier=this.getResponseProperty("SsoOrganizationIdentifier")}}class Kw{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 Xw{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=kd.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 qw{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 Yw{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 Xw(e.publicKeyEncryptionKeyPair),"signatureKeyPair"in e&&"object"==typeof e.signatureKeyPair&&null!=e.signatureKeyPair&&(this.signatureKeyPair=new qw(e.signatureKeyPair)),"securityState"in e&&"object"==typeof e.securityState&&null!=e.securityState&&(this.securityState=new Kw(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 Ww extends Uw{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 Hw extends Uw{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===Tf.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 Tf.Argon2id:return new Af(this.iterations,this.memory,this.parallelism);case Tf.PBKDF2_SHA256:return new xf(this.iterations)}}}class Jw{constructor(e,t,i){this.salt=e,this.kdf=t,this.masterKeyWrappedUserKey=i}static fromSdk(e){return new Jw(e.salt,Df(e.kdf),e.masterKeyWrappedUserKey)}toJSON(){return{salt:this.salt,kdf:this.kdf,masterKeyWrappedUserKey:this.masterKeyWrappedUserKey}}static fromJSON(e){return null==e?null:new Jw(e.salt,e.kdf.kdfType===Tf.PBKDF2_SHA256?xf.fromJSON(e.kdf):Af.fromJSON(e.kdf),e.masterKeyWrappedUserKey)}}function Zw(e){return{salt:e.salt,kdf:Df(e.kdf),masterPasswordAuthenticationHash:e.masterPasswordAuthenticationHash}}class Qw extends Uw{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 Hw(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 Jw(this.salt,this.kdf.toKdfConfig(),this.masterKeyWrappedUserKey)}}class eS extends Uw{constructor(e){super(e),this.keyConnectorUrl=this.getResponseProperty("KeyConnectorUrl")}}class tS extends Uw{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 up(this.getResponseProperty("EncryptedPrivateKey"))),e.EncryptedUserKey&&(this.encryptedUserKey=new up(this.getResponseProperty("EncryptedUserKey")))}}class iS extends Uw{constructor(e){super(e),e.EncryptedPrivateKey&&(this.encryptedPrivateKey=new up(this.getResponseProperty("EncryptedPrivateKey"))),e.EncryptedUserKey&&(this.encryptedUserKey=new up(this.getResponseProperty("EncryptedUserKey")))}}class nS extends Uw{constructor(e){super(e),this.hasMasterPassword=this.getResponseProperty("HasMasterPassword");const t=this.getResponseProperty("MasterPasswordUnlock");null!=t&&"object"==typeof t&&(this.masterPasswordUnlock=new Qw(t)),e.TrustedDeviceOption&&(this.trustedDeviceOption=new tS(this.getResponseProperty("TrustedDeviceOption"))),e.KeyConnectorOption&&(this.keyConnectorOption=new eS(this.getResponseProperty("KeyConnectorOption"))),e.WebAuthnPrfOption&&(this.webAuthnPrfOption=new iS(this.getResponseProperty("WebAuthnPrfOption")))}}class rS extends Uw{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 Yw(this.getResponseProperty("AccountKeys")));const s=this.getResponseProperty("Key");s&&(this.key=new up(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==Tf.PBKDF2_SHA256?new xf(a):new Af(a,l,c),this.forcePasswordReset=this.getResponseProperty("ForcePasswordReset"),this.apiUseKeyConnector=this.getResponseProperty("ApiUseKeyConnector"),this.masterPasswordPolicy=new Ww(this.getResponseProperty("MasterPasswordPolicy"));const u=this.getResponseProperty("UserDecryptionOptions");null!=u&&"object"==typeof u&&(this.userDecryptionOptions=new nS(u))}hasMasterKeyEncryptedUserKey(){return Boolean(this.key)}}class sS extends Uw{constructor(e){super(e),this.twoFactorProviders=this.getResponseProperty("TwoFactorProviders"),this.twoFactorProviders2=this.getResponseProperty("TwoFactorProviders2"),this.masterPasswordPolicy=new Ww(this.getResponseProperty("MasterPasswordPolicy")),this.ssoEmail2faSessionToken=this.getResponseProperty("SsoEmail2faSessionToken"),this.email=this.getResponseProperty("Email")}}class oS{constructor(e,t){this.publicKey=e,this.encryptedPrivateKey=t}}var aS=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 lS{constructor(e,t,i,n,r,s,o,a,l,c,u,d,h,p,f,v,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=f,this.KdfConfigService=v,this.environmentService=m,this.configService=g,this.accountCryptographicStateService=y,this.sessionTimeoutSubject=new fd.t(!1),this.sessionTimeout$=this.sessionTimeoutSubject.asObservable()}logInTwoFactor(e){return aS(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 aS(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 sS)return[yield this.processTwoFactorResponse(t),t];if(t instanceof rS)return[yield this.processTokenResponse(t),t];if(t instanceof zw)return[yield this.processDeviceVerificationResponse(t),t];if(t instanceof _w)return[yield this.processSsoRequiredResponse(t),t];throw new Error("Invalid response object.")})}buildDeviceRequest(){return aS(this,void 0,void 0,function*(){const e=yield this.appIdService.getAppId();return new Nw(e,this.platformUtilsService)})}buildTwoFactor(e,t){return aS(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 ww(jw.Remember,e,!1)}return new ww})}saveAccountInformation(e){return aS(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,xw.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,ho._)(this.vaultTimeoutSettingsService.getVaultTimeoutActionByUserId$(o)),l=yield(0,ho._)(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 aS(this,void 0,void 0,function*(){var t;const i=new Lw;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.setPrivateKey(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 aS(this,void 0,void 0,function*(){return!!e&&(yield this.masterPasswordService.setForceSetPasswordReason(Gw.AdminForcePasswordReset,t),!0)})}createKeyPairForOldAccount(e){return aS(this,void 0,void 0,function*(){try{const t=yield(0,ho._)(this.keyService.userKey$(e));if(null===t)throw new Error("User key is null when creating key pair for old account");if(t.inner().type==Hh.CoseEncrypt0)throw new Error("Cannot create key pair for account on V2 encryption");const[i,n]=yield this.keyService.makeKeyPair(t);if(!n.encryptedString)throw new Error("Failed to create encrypted private key");return yield this.apiService.postAccountKeys(new oS(i,n.encryptedString)),n.encryptedString}catch(e){this.logService.error(e)}})}processTwoFactorResponse(e){return aS(this,void 0,void 0,function*(){var t;yield this.clearTwoFactorToken();const i=new Lw;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 aS(this,void 0,void 0,function*(){const e=this.cache.value.userEnteredEmail;e&&(yield this.tokenService.clearTwoFactorToken(e))})}verifyAccountAdded(e){return aS(this,void 0,void 0,function*(){yield(0,ho._)(this.accountService.activeAccount$.pipe((0,To.p)(t=>(null==t?void 0:t.id)===e),(0,po.w)({first:1e3,with:()=>{throw new Error("Expected user never made active user after initialization.")}})))})}processDeviceVerificationResponse(e){return aS(this,void 0,void 0,function*(){const e=new Lw;return e.requiresDeviceVerification=!0,e})}processSsoRequiredResponse(e){return aS(this,void 0,void 0,function*(){const t=new Lw;return t.ssoOrganizationIdentifier=e.ssoOrganizationIdentifier,t})}}var cS=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 uS{static fromJSON(e){return Object.assign(new uS,e,{tokenRequest:Bw.fromJSON(e.tokenRequest),authRequestCredentials:Tw.fromJSON(e.authRequestCredentials)})}}class dS extends lS{constructor(e,t,...i){super(...i),this.deviceTrustService=t,this.cache=new fd.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 cS(this,void 0,void 0,function*(){const t=new uS;t.tokenRequest=new Bw(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 cS(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 cS(this,void 0,void 0,function*(){const e=this.cache.value.authRequestCredentials;e.decryptedMasterKey&&e.decryptedMasterKeyHash&&(yield this.masterPasswordService.setMasterKey(e.decryptedMasterKey,t),yield this.masterPasswordService.setMasterKeyHash(e.decryptedMasterKeyHash,t))})}setUserKey(e,t){return cS(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 cS(this,void 0,void 0,function*(){const t=yield(0,ho._)(this.masterPasswordService.masterKey$(e));if(t){const i=yield this.masterPasswordService.decryptUserKeyWithMasterKey(t,e);yield this.keyService.setUserKey(i,e)}})}setPrivateKey(e,t){return cS(this,void 0,void 0,function*(){var i;yield this.keyService.setPrivateKey(null!==(i=e.privateKey)&&void 0!==i?i:yield this.createKeyPairForOldAccount(t),t),e.accountKeysResponseModel&&(yield this.accountCryptographicStateService.setAccountCryptographicState(e.accountKeysResponseModel.toWrappedAccountCryptographicState(),t))})}exportCache(){return{authRequest:this.cache.value}}}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())})};class pS{constructor(){this.forcePasswordResetReason=Gw.None}static fromJSON(e){return Object.assign(new pS,e,{tokenRequest:Bw.fromJSON(e.tokenRequest),masterKey:gf.fromJSON(e.masterKey)})}}class fS extends lS{constructor(e,t,i,n,...r){super(...r),this.passwordStrengthService=t,this.policyService=i,this.loginStrategyService=n,this.cache=new fd.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 hS(this,void 0,void 0,function*(){const{email:t,masterPassword:i,twoFactor:n}=e,r=new pS;r.masterKey=yield this.loginStrategyService.makePasswordPreLoginMasterKey(i,t),r.masterPassword=i,r.userEnteredEmail=t,r.localMasterKeyHash=yield this.keyService.hashMasterKey(i,r.masterKey,ep.LocalAuthorization);const s=yield this.keyService.hashMasterKey(i,r.masterKey);r.tokenRequest=new Bw(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 hS(this,void 0,void 0,function*(){return yield t.logInTwoFactor.call(this,e)})}setMasterKey(e,t){return hS(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 hS(this,void 0,void 0,function*(){if(this.encryptionKeyMigrationRequired(e))return;e.key&&(yield this.masterPasswordService.setMasterKeyEncryptedUserKey(e.key,t));const i=yield(0,ho._)(this.masterPasswordService.masterKey$(t));if(i){const e=yield this.masterPasswordService.decryptUserKeyWithMasterKey(i,t);yield this.keyService.setUserKey(e,t)}})}setPrivateKey(e,t){return hS(this,void 0,void 0,function*(){var i;yield this.keyService.setPrivateKey(null!==(i=e.privateKey)&&void 0!==i?i:yield this.createKeyPairForOldAccount(t),t),e.accountKeysResponseModel&&(yield this.accountCryptographicStateService.setAccountCryptographicState(e.accountKeysResponseModel.toWrappedAccountCryptographicState(),t))})}encryptionKeyMigrationRequired(e){return!e.key}evaluateMasterPasswordIfRequired(e,t,i){return hS(this,void 0,void 0,function*(){if(e instanceof zw||e instanceof _w)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 sS?this.cache.next(Object.assign(Object.assign({},this.cache.value),{forcePasswordResetReason:Gw.WeakMasterPassword})):yield this.masterPasswordService.setForceSetPasswordReason(Gw.WeakMasterPassword,i.userId))})}getMasterPasswordPolicyOptionsFromResponse(e){return null==e?null:Kp.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 hS(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 hS(this,void 0,void 0,function*(){if(yield i.processForceSetPasswordReason.call(this,e,t))return!1;const n=this.cache.value.forcePasswordResetReason;return n!==Gw.None&&(yield this.masterPasswordService.setForceSetPasswordReason(n,t),!0)})}}class vS extends Vw{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(vS.prototype),e,{device:e.device?Nw.fromJSON(e.device):void 0,twoFactor:e.twoFactor?Object.assign(new ww,e.twoFactor):void 0})}}var mS=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 gS{static fromJSON(e){return Object.assign(new gS,e,{tokenRequest:vS.fromJSON(e.tokenRequest)})}}class yS extends lS{constructor(e,t,i,n,r,...s){super(...s),this.keyConnectorService=t,this.deviceTrustService=i,this.authRequestService=n,this.i18nService=r,this.cache=new fd.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 mS(this,void 0,void 0,function*(){const t=new gS;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 vS(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 mS(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 mS(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 mS(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 Mw&&t.statusCode===xa.NotFound&&(yield this.authRequestService.clearAdminAuthRequest(e)))}(null==i?void 0:i.requestApproved)&&(i.masterPasswordHash?yield this.authRequestService.setKeysAfterDecryptingSharedMasterKeyAndHash(i,t.privateKey,e):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 mS(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 mS(this,void 0,void 0,function*(){const t=yield(0,ho._)(this.masterPasswordService.masterKey$(e));if(!t)return;const i=yield this.masterPasswordService.decryptUserKeyWithMasterKey(t,e);yield this.keyService.setUserKey(i,e)})}setPrivateKey(e,t){return mS(this,void 0,void 0,function*(){var i;e.accountKeysResponseModel&&(yield this.accountCryptographicStateService.setAccountCryptographicState(e.accountKeysResponseModel.toWrappedAccountCryptographicState(),t)),e.hasMasterKeyEncryptedUserKey()?yield this.keyService.setPrivateKey(null!==(i=e.privateKey)&&void 0!==i?i:yield this.createKeyPairForOldAccount(t),t):e.privateKey&&(yield this.keyService.setPrivateKey(e.privateKey,t))})}exportCache(){return{sso:this.cache.value}}processForceSetPasswordReason(e,t){const i=Object.create(null,{processForceSetPasswordReason:{get:()=>super.processForceSetPasswordReason}});return mS(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,ho._)(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(Gw.TdeOffboarding,t),!0;const l=yield(0,ho._)(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(Gw.TdeUserWithoutPasswordHasPasswordResetPermission,t),!0):!(a.hasMasterPassword||(null===(o=a.keyConnectorOption)||void 0===o?void 0:o.keyConnectorUrl)||a.trustedDeviceOption)&&(yield this.masterPasswordService.setForceSetPasswordReason(Gw.SsoNewJitProvisionedUser,t),!0):(yield this.masterPasswordService.setForceSetPasswordReason(Gw.TdeOffboardingUntrustedDevice,t),!0)})}}class bS extends Vw{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(bS.prototype),e,{device:e.device?Nw.fromJSON(e.device):void 0,twoFactor:e.twoFactor?Object.assign(new ww,e.twoFactor):void 0})}}var wS=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 SS{static fromJSON(e){return Object.assign(new SS,e,{tokenRequest:bS.fromJSON(e.tokenRequest)})}}class kS extends lS{constructor(e,t,...i){super(...i),this.keyConnectorService=t,this.cache=new fd.t(e)}logIn(e){return wS(this,void 0,void 0,function*(){const t=new SS;t.tokenRequest=new bS(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 wS(this,void 0,void 0,function*(){if(e.apiUseKeyConnector){const e=(yield(0,ho._)(this.environmentService.environment$)).getKeyConnectorUrl();yield this.keyConnectorService.setMasterKeyFromUrl(e,t)}})}setUserKey(e,t){return wS(this,void 0,void 0,function*(){if(e.key&&(yield this.masterPasswordService.setMasterKeyEncryptedUserKey(e.key,t)),e.apiUseKeyConnector){const e=yield(0,ho._)(this.masterPasswordService.masterKey$(t));if(e){const i=yield this.masterPasswordService.decryptUserKeyWithMasterKey(e,t);yield this.keyService.setUserKey(i,t)}}})}setPrivateKey(e,t){return wS(this,void 0,void 0,function*(){var i;yield this.keyService.setPrivateKey(null!==(i=e.privateKey)&&void 0!==i?i:yield this.createKeyPairForOldAccount(t),t),e.accountKeysResponseModel&&(yield this.accountCryptographicStateService.setAccountCryptographicState(e.accountKeysResponseModel.toWrappedAccountCryptographicState(),t))})}saveAccountInformation(e){const t=Object.create(null,{saveAccountInformation:{get:()=>super.saveAccountInformation}});return wS(this,void 0,void 0,function*(){const i=yield t.saveAccountInformation.call(this,e),n=yield(0,ho._)(this.vaultTimeoutSettingsService.getVaultTimeoutActionByUserId$(i)),r=yield(0,ho._)(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 IS extends Vw{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(IS.prototype),e,{deviceResponse:kw.fromJSON(e.deviceResponse),device:e.device?Nw.fromJSON(e.device):void 0,twoFactor:e.twoFactor?Object.assign(new ww,e.twoFactor):void 0})}}var CS=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 TS{static fromJSON(e){return Object.assign(new TS,e,{tokenRequest:IS.fromJSON(e.tokenRequest),credentials:Pw.fromJSON(e.credentials)})}}class PS extends lS{constructor(e,...t){super(...t),this.cache=new fd.t(e)}logIn(e){return CS(this,void 0,void 0,function*(){const t=new TS;t.credentials=e,t.tokenRequest=new IS(e.token,e.deviceResponse,yield this.buildDeviceRequest()),this.cache.next(t);const[i]=yield this.startLogIn();return i})}logInTwoFactor(){return CS(this,void 0,void 0,function*(){throw new Error("2FA not supported yet for WebAuthn Login.")})}setMasterKey(e,t){return CS(this,void 0,void 0,function*(){})}setUserKey(e,t){return CS(this,void 0,void 0,function*(){var i;const n=e.key;n&&(yield this.masterPasswordService.setMasterKeyEncryptedUserKey(n,t));const r=null==e?void 0:e.userDecryptionOptions;if(null==r?void 0:r.webAuthnPrfOption){const n=null===(i=e.userDecryptionOptions)||void 0===i?void 0:i.webAuthnPrfOption,r=this.cache.value.credentials;if(!r.prfKey)return;const s=yield this.encryptService.unwrapDecapsulationKey(n.encryptedPrivateKey,r.prfKey),o=yield this.encryptService.decapsulateKeyUnsigned(new up(n.encryptedUserKey.encryptedString),s);o&&(yield this.keyService.setUserKey(o,t))}})}setPrivateKey(e,t){return CS(this,void 0,void 0,function*(){var i;yield this.keyService.setPrivateKey(null!==(i=e.privateKey)&&void 0!==i?i:yield this.createKeyPairForOldAccount(t),t),e.accountKeysResponseModel&&(yield this.accountCryptographicStateService.setAccountCryptographicState(e.accountKeysResponseModel.toWrappedAccountCryptographicState(),t))})}exportCache(){return{webAuthn:this.cache.value}}}const FS=new m(N,"currentLoginStrategy",{deserializer:e=>e}),RS=new m(N,"loginStrategyCacheExpiration",{deserializer:e=>e?null:new Date(e)}),xS=new m(N,"authRequestPushNotification",{deserializer:e=>e}),AS=new m(N,"loginStrategyCache",{deserializer:e=>null==e?null:{password:e.password?pS.fromJSON(e.password):void 0,sso:e.sso?gS.fromJSON(e.sso):void 0,userApiKey:e.userApiKey?SS.fromJSON(e.userApiKey):void 0,authRequest:e.authRequest?uS.fromJSON(e.authRequest):void 0,webAuthn:e.webAuthn?TS.fromJSON(e.webAuthn):void 0}});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=3e5;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())})};const OS=new k(Y,"decryptionOptions",{deserializer:e=>xw.fromJSON(e),clearOn:["logout"]});class US{constructor(e){e&&Object.assign(this,e)}toJSON(){return{id:this.id,privateKey:kd.fromBufferToByteString(this.privateKey)}}static fromJSON(e){if(null==e)return null;let t=null;return e.privateKey&&(t=kd.fromByteStringToArray(e.privateKey)),new US({id:e.id,privateKey:t})}}class MS{constructor(e,t,i,n){this.key=e,this.masterPasswordHash=t,this.deviceIdentifier=i,this.requestApproved=n}}class NS extends Uw{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.masterPasswordHash=this.getResponseProperty("MasterPasswordHash"),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 VS=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 BS=new k(E,"adminAuthRequest",{deserializer:e=>e,clearOn:[]});class jS extends Uw{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 GS=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 LS(e,t,i){if(null==e)throw new Error(`${t} is null or undefined.${i?` ${i}`:""}`)}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{}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())})};class XS{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 qS,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())})};class WS{constructor(e){this.messagingService=e}logout(e,t){return YS(this,void 0,void 0,function*(){this.messagingService.send("logout",{userId:e,logoutReason:t})})}}function HS(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=kd.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"}(qS||(qS={}));class JS{}class ZS{constructor(e){this.messageStream=e,this.allMessages$=this.messageStream}messages$(e){return this.allMessages$.pipe((0,To.p)(t=>(null==t?void 0:t.command)===e.command))}}ZS.EMPTY=new ZS($p.w);class QS{constructor(e){this.innerMessageSenders=e}send(e,t={}){for(const i of this.innerMessageSenders)i.send(e,t)}}class ek{static combine(...e){return new QS(e)}}ek.EMPTY=new QS([]);class tk{constructor(e){this.command=e}}const ik=Symbol("externalSource"),nk=e=>"string"==typeof e?e:e.command;class rk{constructor(e){this.messagesSubject=e}send(e,t={}){const i=nk(e);this.messagesSubject.next(Object.assign(null!=t?t:{},{command:i}))}}class sk{}class ok{}class ak{}class lk{}class ck{}class uk{}class dk{}class hk{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()||kd.isMobileBrowser)return;null!=this.getElement()&&(this.ngZone.isStable?this.focus():this.ngZone.onStable.pipe((0,No.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}}hk.ɵfac=function(e){return new(e||hk)(yl.rXU(yl.aKT),yl.rXU(yl.SKi),yl.rXU(Cl,8))},hk.ɵdir=yl.FsC({type:hk,selectors:[["","appAutofocus",""],["","bitAutofocus",""]],inputs:{appAutofocus:[1,"appAutofocus"]}});var 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())})};const fk=["masterPasswordInputRef"],vk=e=>({"tw-hidden":e});function mk(e,t){if(1&e){const e=yl.RV6();yl.qex(0),yl.j41(1,"button",16),yl.nI1(2,"i18n"),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.handleLoginWithPasskeyClick())}),yl.nrm(3,"i",17),yl.EFF(4),yl.nI1(5,"i18n"),yl.k0s(),yl.bVm()}if(2&e){const e=yl.XpG();yl.R7$(),yl.Y8G("bitTooltip",e.ssoRequired?yl.bMT(2,4,"yourOrganizationRequiresSingleSignOn"):"")("addTooltipToDescribedby",e.ssoRequired)("disabled",e.ssoRequired),yl.R7$(3),yl.SpI(" ",yl.bMT(5,6,"logInWithPasskey")," ")}}function gk(e,t){if(1&e){const e=yl.RV6();yl.qex(0),yl.j41(1,"div",7),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.j41(4,"button",18),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.startAuthRequestLogin())}),yl.nrm(5,"i",19),yl.EFF(6),yl.nI1(7,"i18n"),yl.k0s(),yl.bVm()}2&e&&(yl.R7$(2),yl.JRh(yl.bMT(3,2,"or")),yl.R7$(4),yl.SpI(" ",yl.bMT(7,4,"loginWithDevice")," "))}function yk(e,t){if(1&e){const e=yl.RV6();yl.qex(0),yl.j41(1,"button",18),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.backButtonClicked())}),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.bVm()}2&e&&(yl.R7$(2),yl.SpI(" ",yl.bMT(3,1,"back")," "))}const bk="LoginComponent";var wk;!function(e){e.EMAIL_ENTRY="EmailEntry",e.MASTER_PASSWORD_ENTRY="MasterPasswordEntry"}(wk||(wk={}));class Sk{get emailFormControl(){return this.formGroup.controls.email}constructor(e,t,i,n,r,s,o,a,l,c,u,d,h,p,f,v,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=f,this.policyService=v,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 go.B,this.Icons={WaveIcon:cw,VaultIcon:uw},this.ClientType=Ca,this.orgPoliciesFromInvite=null,this.LoginUiState=wk,this.isKnownDevice=!1,this.loginUiState=wk.EMAIL_ENTRY,this.ssoRequired=!1,this.formGroup=this.formBuilder.group({email:["",[fl.k0.required,fl.k0.email]],masterPassword:["",[fl.k0.required,fl.k0.minLength(kd.originalMinimumPasswordLength)]],rememberEmail:[!1]},{updateOn:"submit"}),this.deferFocus=null,this.submit=()=>pk(this,void 0,void 0,function*(){var e;if(this.clientType===Ca.Desktop&&this.loginUiState!==wk.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 Iw(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=>pk(this,void 0,void 0,function*(){this.loginUiState===wk.MASTER_PASSWORD_ENTRY?(e.preventDefault(),this.toggleLoginUiState(wk.EMAIL_ENTRY)):this.loginUiState===wk.EMAIL_ENTRY&&(e.preventDefault(),yield this.continue())}),this.clientType=this.platformUtilsService.getClientType()}ngOnInit(){return pk(this,void 0,void 0,function*(){window.addEventListener("popstate",this.handlePopState),yield this.defaultOnInit(),this.clientType===Ca.Desktop&&(yield this.desktopOnInit())})}ngOnDestroy(){window.removeEventListener("popstate",this.handlePopState),this.clientType===Ca.Desktop&&this.broadcasterService.unsubscribe(bk),this.destroy$.next(),this.destroy$.complete()}defaultOnInit(){return pk(this,void 0,void 0,function*(){let e=!1;const t=yield(0,ho._)(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 pk(this,void 0,void 0,function*(){this.broadcasterService.subscribe(bk,e=>pk(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 pk(this,void 0,void 0,function*(){const e=yield(0,ho._)(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,wl.pQ)(this.destroyRef)).subscribe(()=>{this.emailFormControl.value&&e.has(this.emailFormControl.value.toLowerCase())?this.ssoRequired=!0:this.ssoRequired=!1})}handleSubmitError(e){return pk(this,void 0,void 0,function*(){var t;if(e instanceof Mw)if(e.statusCode===xa.BadRequest)if(null===(t=e.message)||void 0===t?void 0:t.toLowerCase().includes("username or password is incorrect")){const e=yield(0,ho._)(this.environmentService.environment$),t=kd.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 pk(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===Ca.Browser?yield this.router.navigate(["/tabs/vault"]):yield this.router.navigate(["vault"])}})}isPasswordChangeRequiredByOrgPolicy(e){return pk(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 pk(this,void 0,void 0,function*(){const i={};t.map(e=>i[e.id]=Xp.fromPolicy(e)),yield this.policyService.replace(i,e)})}startAuthRequestLogin(){return pk(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 pk(this,void 0,void 0,function*(){var t,i;if(this.loginUiState=e,this.loginUiState===wk.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===wk.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,No.s)(1),(0,Jv.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 pk(this,void 0,void 0,function*(){yield this.router.navigateByUrl("/hint")})}continuePressed(){return pk(this,void 0,void 0,function*(){history.pushState({},"",window.location.href),yield this.continue()})}continue(){return pk(this,void 0,void 0,function*(){this.validateEmail()&&(yield this.makePasswordPreloginCall(),yield this.toggleLoginUiState(wk.MASTER_PASSWORD_ENTRY))})}handleLoginWithPasskeyClick(){return pk(this,void 0,void 0,function*(){yield this.router.navigate(["/login-with-passkey"])})}handleSsoClick(){return pk(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 pk(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 pk(this,void 0,void 0,function*(){const e=yield(0,ho._)(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===wk.MASTER_PASSWORD_ENTRY&&this.clientType!==Ca.Browser}backButtonClicked(){return pk(this,void 0,void 0,function*(){history.back()})}makePasswordPreloginCall(){return pk(this,void 0,void 0,function*(){try{if(yield this.configService.getFeatureFlag(Nf.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 pk(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 pk(this,void 0,void 0,function*(){const t=e.target;this.formGroup.controls.email.setValue(t.value),yield this.persistEmailIfValid()})}onRememberEmailInput(e){return pk(this,void 0,void 0,function*(){const t=e.target;this.formGroup.controls.rememberEmail.setValue(t.checked),yield this.persistEmailIfValid()})}}Sk.ɵfac=function(e){return new(e||Sk)(yl.rXU(ud.nX),yl.rXU(sk),yl.rXU(ok),yl.rXU(ak),yl.rXU(a.abz),yl.rXU(lk),yl.rXU(fl.ok),yl.rXU(Pl),yl.rXU(hw),yl.rXU(ck),yl.rXU(pw),yl.rXU(ek),yl.rXU(yl.SKi),yl.rXU(Wf),yl.rXU(Eb),yl.rXU(Ob),yl.rXU(ud.Ix),yl.rXU(xb),yl.rXU(za),yl.rXU(Cd),yl.rXU(gw),yl.rXU(uk),yl.rXU(dk),yl.rXU(JS))},Sk.ɵcmp=yl.VBU({type:Sk,selectors:[["ng-component"]],viewQuery:function(e,t){if(1&e&&yl.GBs(fk,5),2&e){let e;yl.mGM(e=yl.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=yl.RV6();yl.j41(0,"form",1)(1,"div",2)(2,"bit-form-field")(3,"bit-label"),yl.EFF(4),yl.nI1(5,"i18n"),yl.k0s(),yl.j41(6,"input",3),yl.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())}),yl.k0s()(),yl.j41(7,"bit-form-control")(8,"input",4),yl.bIt("input",function(i){return a.eBV(e),a.Njj(t.onRememberEmailInput(i))}),yl.k0s(),yl.j41(9,"bit-label"),yl.EFF(10),yl.nI1(11,"i18n"),yl.k0s()(),yl.j41(12,"div",5)(13,"button",6),yl.nI1(14,"i18n"),yl.bIt("click",function(){return a.eBV(e),a.Njj(t.continuePressed())}),yl.EFF(15),yl.nI1(16,"i18n"),yl.k0s(),yl.j41(17,"div",7),yl.EFF(18),yl.nI1(19,"i18n"),yl.k0s(),yl.DNE(20,mk,6,8,"ng-container",8),yl.j41(21,"button",9),yl.bIt("click",function(){return a.eBV(e),a.Njj(t.handleSsoClick())}),yl.nrm(22,"i",10),yl.EFF(23),yl.nI1(24,"i18n"),yl.k0s()()(),yl.j41(25,"div",2)(26,"bit-form-field",11)(27,"bit-label"),yl.EFF(28),yl.nI1(29,"i18n"),yl.k0s(),yl.nrm(30,"input",12,0)(32,"button",13),yl.k0s(),yl.j41(33,"a",14),yl.bIt("click",function(){return a.eBV(e),a.Njj(t.goToHint())}),yl.EFF(34),yl.nI1(35,"i18n"),yl.k0s(),yl.j41(36,"div",5)(37,"button",15),yl.EFF(38),yl.nI1(39,"i18n"),yl.k0s(),yl.DNE(40,gk,8,6,"ng-container",8)(41,yk,4,3,"ng-container",8),yl.k0s()()()}2&e&&(yl.Y8G("bitSubmit",t.submit)("formGroup",t.formGroup),yl.R7$(),yl.Y8G("ngClass",yl.eq3(37,vk,t.loginUiState!==t.LoginUiState.EMAIL_ENTRY)),yl.R7$(3),yl.JRh(yl.bMT(5,19,"emailAddress")),yl.R7$(6),yl.JRh(yl.bMT(11,21,"rememberEmail")),yl.R7$(3),yl.Y8G("bitTooltip",t.ssoRequired?yl.bMT(14,23,"yourOrganizationRequiresSingleSignOn"):"")("addTooltipToDescribedby",t.ssoRequired)("disabled",t.ssoRequired),yl.R7$(2),yl.SpI(" ",yl.bMT(16,25,"continue")," "),yl.R7$(3),yl.JRh(yl.bMT(19,27,"or")),yl.R7$(2),yl.Y8G("ngIf",t.isLoginWithPasskeySupported()),yl.R7$(),yl.Y8G("buttonType",t.ssoRequired?"primary":"secondary"),yl.R7$(2),yl.SpI(" ",yl.bMT(24,29,"useSingleSignOn")," "),yl.R7$(2),yl.Y8G("ngClass",yl.eq3(39,vk,t.loginUiState!==t.LoginUiState.MASTER_PASSWORD_ENTRY)),yl.R7$(3),yl.JRh(yl.bMT(29,31,"masterPass")),yl.R7$(6),yl.SpI(" ",yl.bMT(35,33,"getMasterPasswordHint")," "),yl.R7$(4),yl.SpI(" ",yl.bMT(39,35,"loginWithMasterPassword")," "),yl.R7$(2),yl.Y8G("ngIf",t.isKnownDevice),yl.R7$(),yl.Y8G("ngIf",t.shouldShowBackButton()))},dependencies:[rc,xd,Td,Xu,Ku,id,Ub,pl.MD,pl.YU,pl.bT,Eu,hc,Sc,ou,Du,Vb,Bb,_l,zl,Oh,_b,qf,hk,fl.X1,fl.qT,fl.me,fl.Zm,fl.BC,fl.cb,fl.j4,fl.JD,sw.iI,sw.Wk,Ul,Xf],encapsulation:2});class kk{constructor(e){this.configService=e}getSettings$(){return this.configService.serverSettings$}get isUserRegistrationDisabled$(){return this.getSettings$().pipe((0,l.T)(e=>e.disableUserRegistration))}}function Ik(e,t){1&e&&(yl.j41(0,"div",1),yl.EFF(1),yl.nI1(2,"i18n"),yl.j41(3,"a",2),yl.EFF(4),yl.nI1(5,"i18n"),yl.k0s()()),2&e&&(yl.R7$(),yl.SpI(" ",yl.bMT(2,2,"newToBitwarden")," "),yl.R7$(3),yl.JRh(yl.bMT(5,4,"createAccount")))}class Ck{constructor(){this.serverSettingsService=(0,a.WQX)(kk),this.isUserRegistrationDisabled$=this.serverSettingsService.isUserRegistrationDisabled$}}Ck.ɵfac=function(e){return new(e||Ck)},Ck.ɵcmp=yl.VBU({type:Ck,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&&(yl.DNE(0,Ik,6,6,"div",0),yl.nI1(1,"async")),2&e&&yl.Y8G("ngIf",!yl.bMT(1,1,t.isUserRegistrationDisabled$))},dependencies:[pl.MD,pl.bT,qf,Oh,_b,sw.iI,sw.Wk,pl.Jj,Xf],encapsulation:2});var Tk=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 Pk{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===Ca.Web}redirectToSsoLogin(e){return Tk(this,void 0,void 0,function*(){const[t,i]=yield this.setSsoPreLoginState(e);yield this.redirectToSso(e,t,i)})}redirectToSsoLoginWithOrganizationSsoIdentifier(e,t){return Tk(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 Tk(this,void 0,void 0,function*(){})}showBackButton(e){}setSsoPreLoginState(e){return Tk(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===Ca.Browser&&(i+=":clientId=browser");const n=yield this.passwordGenerationService.generatePassword(t),r=yield this.cryptoFunctionService.hash(n,"sha256"),s=kd.fromBufferToUrlB64(r);return yield this.ssoLoginService.setSsoState(i),yield this.ssoLoginService.setCodeVerifier(n),yield this.ssoLoginService.setSsoEmail(e),[i,s]})}}Error;Error;class Fk{}class Rk extends Error{constructor(e){super(`User (${e}) is not logged in`)}}class xk extends Error{constructor(e){super(`Invalid UUID: ${e}`)}}function Ak(e){switch(e){case Ta.Android:return"Android";case Ta.iOS:return"iOS";case Ta.ChromeExtension:return"ChromeExtension";case Ta.FirefoxExtension:return"FirefoxExtension";case Ta.OperaExtension:return"OperaExtension";case Ta.EdgeExtension:return"EdgeExtension";case Ta.WindowsDesktop:return"WindowsDesktop";case Ta.MacOsDesktop:return"MacOsDesktop";case Ta.LinuxDesktop:return"LinuxDesktop";case Ta.ChromeBrowser:return"ChromeBrowser";case Ta.FirefoxBrowser:return"FirefoxBrowser";case Ta.OperaBrowser:return"OperaBrowser";case Ta.EdgeBrowser:return"EdgeBrowser";case Ta.IEBrowser:return"IEBrowser";case Ta.UnknownBrowser:return"UnknownBrowser";case Ta.AndroidAmazon:return"AndroidAmazon";case Ta.UWP:return"UWP";case Ta.SafariBrowser:return"SafariBrowser";case Ta.VivaldiBrowser:return"VivaldiBrowser";case Ta.VivaldiExtension:return"VivaldiExtension";case Ta.SafariExtension:return"SafariExtension";case Ta.Server:return"Server";case Ta.WindowsCLI:return"WindowsCLI";case Ta.MacOsCLI:return"MacOsCLI";case Ta.LinuxCLI:return"LinuxCLI";default:return"SDK"}}function Dk(e){if(kd.isGuid(e))return e;throw new xk(e)}function Ek(e){return e}class $k{}class Ok{}class Uk extends Ok{}class Mk{}class Nk{}class Vk{}class Bk{}class jk{}class Gk{}class Lk{}var zk,_k=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})},Kk=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},Xk=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 qk(e,t){1&e&&(yl.qex(0),yl.j41(1,"div",2),yl.nrm(2,"i",3),yl.nI1(3,"i18n"),yl.j41(4,"span",4),yl.EFF(5),yl.nI1(6,"i18n"),yl.k0s()(),yl.bVm()),2&e&&(yl.R7$(2),yl.Y8G("title",yl.mNQ(yl.bMT(3,3,"loading"))),yl.R7$(3),yl.JRh(yl.bMT(6,5,"loading")))}function Yk(e,t){if(1&e&&(yl.j41(0,"form",5)(1,"bit-form-control"),yl.nrm(2,"input",6),yl.j41(3,"bit-label"),yl.EFF(4),yl.nI1(5,"i18n"),yl.k0s(),yl.j41(6,"bit-hint",7),yl.EFF(7),yl.nI1(8,"i18n"),yl.k0s()()()),2&e){const e=yl.XpG();yl.Y8G("formGroup",e.formGroup),yl.R7$(4),yl.JRh(yl.bMT(5,3,"rememberThisDevice")),yl.R7$(3),yl.JRh(yl.bMT(8,5,"uncheckIfPublicDevice"))}}function Wk(e,t){if(1&e&&(yl.qex(0),yl.j41(1,"button",8),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.bVm()),2&e){const e=yl.XpG();yl.R7$(),yl.Y8G("bitAction",e.createUser),yl.R7$(),yl.SpI(" ",yl.bMT(3,2,"continue")," ")}}function Hk(e,t){1&e&&(yl.j41(0,"div",2),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()),2&e&&(yl.R7$(),yl.SpI(" ",yl.bMT(2,1,"or")," "))}function Jk(e,t){if(1&e){const e=yl.RV6();yl.qex(0),yl.j41(1,"button",12),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG(2);return a.Njj(t.approveFromOtherDevice())}),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.DNE(4,Hk,3,3,"div",13),yl.bVm()}if(2&e){const e=yl.XpG(2);yl.R7$(2),yl.SpI(" ",yl.bMT(3,2,"approveFromYourOtherDevice")," "),yl.R7$(2),yl.Y8G("ngIf",e.canApproveWithMasterPassword||e.canRequestAdminApproval)}}function Zk(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",14),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG(2);return a.Njj(t.approveWithMasterPassword())}),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()}2&e&&(yl.R7$(),yl.SpI(" ",yl.bMT(2,1,"useMasterPassword")," "))}function Qk(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",14),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG(2);return a.Njj(t.requestAdminApproval())}),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()}2&e&&(yl.R7$(),yl.SpI(" ",yl.bMT(2,1,"requestAdminApproval")," "))}function eI(e,t){if(1&e){const e=yl.RV6();yl.qex(0),yl.j41(1,"div",9),yl.DNE(2,Jk,5,4,"ng-container",0)(3,Zk,3,3,"button",10)(4,Qk,3,3,"button",10),yl.j41(5,"button",11),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.logOut())}),yl.EFF(6),yl.nI1(7,"i18n"),yl.k0s()(),yl.bVm()}if(2&e){const e=yl.XpG();yl.R7$(2),yl.Y8G("ngIf",e.canApproveFromOtherDevice),yl.R7$(),yl.Y8G("ngIf",e.canApproveWithMasterPassword),yl.R7$(),yl.Y8G("ngIf",e.canRequestAdminApproval),yl.R7$(2),yl.SpI(" ",yl.bMT(7,4,"logOut")," ")}}!function(e){e[e.NewUser=0]="NewUser",e[e.ExistingUserUntrustedDevice=1]="ExistingUserUntrustedDevice"}(zk||(zk={}));class tI{get rememberDeviceControl(){return this.formGroup.controls.rememberDevice}constructor(e,t,i,n,r,s,o,a,l,c,u,d,h,p,f,v,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=f,this.router=v,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=zk,this.formGroup=this.formBuilder.group({rememberDevice:[!0]}),this.canApproveFromOtherDevice=!1,this.canRequestAdminApproval=!1,this.canApproveWithMasterPassword=!1,this.createUser=()=>_k(this,void 0,void 0,function*(){if(this.state===zk.NewUser)try{if(yield this.configService.getFeatureFlag(Nf.PM27279_V2RegistrationTdeJit)){const e=yield this.appIdService.getAppId(),t=this.activeAccountId,i=this.newUserOrgId,n=yield this.organizationApiService.getKeys(i),r=yield(0,ho._)(this.registerSdkService.registerClient$(t).pipe((0,yo.H)(r=>_k(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=Kk(s,r.take(),!1);return yield o.value.auth().registration().post_keys_for_tde_registration({org_id:Dk(i),org_public_key:n.publicKey,user_id:Dk(t),device_identifier:e,trust_device:this.formGroup.value.rememberDevice})}catch(e){s.error=e,s.hasError=!0}finally{Xk(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.keyService.setPrivateKey(r.account_cryptographic_state.V2.private_key,t),yield this.keyService.setSignedPublicKey(r.account_cryptographic_state.V2.signed_public_key,t),yield this.keyService.setUserSigningKey(r.account_cryptographic_state.V2.signing_key,t),yield this.securityStateService.setAccountSecurityState(r.account_cryptographic_state.V2.security_state,t),yield this.deviceTrustService.setDeviceKey(t,gf.fromString(r.device_key)),yield this.keyService.setUserKey(gf.fromString(r.user_key),t)}else{const{publicKey:e,privateKey:t}=yield this.keyService.initAccount(this.activeAccountId),i=new oS(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===Ca.Desktop&&this.messagingService.send("redrawMenu"),yield this.handleCreateUserSuccessNavigation()}catch(e){this.validationService.showError(e)}}),this.clientType=this.platformUtilsService.getClientType()}ngOnInit(){return _k(this,void 0,void 0,function*(){var e,t;if(this.loading=!0,this.activeAccountId=null===(e=yield(0,ho._)(this.accountService.activeAccount$))||void 0===e?void 0:e.id,this.email=yield(0,ho._)(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,ho._)(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 _k(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,wl.pQ)(this.destroyRef),(0,co.n)(e=>(0,Po.v)(()=>this.deviceTrustService.setShouldTrustDevice(this.activeAccountId,e)))).subscribe()}setRememberDeviceDefaultValueFromState(){return _k(this,void 0,void 0,function*(){const e=yield this.deviceTrustService.getShouldTrustDevice(this.activeAccountId),t=null==e||e;this.rememberDeviceControl.setValue(t)})}loadNewUserData(){return _k(this,void 0,void 0,function*(){this.state=zk.NewUser,this.anonLayoutWrapperDataService.setAnonLayoutWrapperData({pageTitle:{key:"loggedInExclamation"},pageSubtitle:{key:"rememberThisDeviceToMakeFutureLoginsSeamless"}});const e=(0,Po.v)(()=>this.ssoLoginService.getActiveUserOrganizationSsoIdentifier(this.activeAccountId)).pipe((0,co.n)(e=>null==e?(0,fo.$)(()=>new Error(this.i18nService.t("ssoIdentifierRequired"))):(0,md.H)(this.organizationApiService.getAutoEnrollStatus(e))),(0,vd.W)(e=>(this.validationService.showError(e),(0,Oo.of)(void 0)))),t=yield(0,ho._)(e);this.newUserOrgId=t.id})}loadExistingUserUntrustedDeviceData(e){var t,i;this.state=zk.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 _k(this,void 0,void 0,function*(){this.clientType===Ca.Browser?yield this.router.navigate(["/tabs/vault"]):yield this.router.navigate(["/vault"])})}approveFromOtherDevice(){return _k(this,void 0,void 0,function*(){yield this.router.navigate(["/login-with-device"])})}approveWithMasterPassword(){return _k(this,void 0,void 0,function*(){yield this.router.navigate(["/lock"],{queryParams:{from:"login-initiated"}})})}requestAdminApproval(){return _k(this,void 0,void 0,function*(){yield this.router.navigate(["/admin-approval-requested"])})}logOut(){return _k(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,ho._)(this.accountService.activeAccount$))||void 0===e?void 0:e.id;t&&(yield this.logoutService.logout(i),yield this.router.navigate(["/"]))})}}tI.ɵfac=function(e){return new(e||tI)(yl.rXU(Ok),yl.rXU(sk),yl.rXU(Mk),yl.rXU(a.abz),yl.rXU(Nk),yl.rXU(Jd),yl.rXU(fl.ok),yl.rXU(Pl),yl.rXU(Cp),yl.rXU(Vk),yl.rXU(hw),yl.rXU(ek),yl.rXU(Bk),yl.rXU(jk),yl.rXU(Eb),yl.rXU(ud.Ix),yl.rXU(dk),yl.rXU(xb),yl.rXU(fw),yl.rXU(Cd),yl.rXU(yw),yl.rXU(Fk),yl.rXU(Gk),yl.rXU(ok),yl.rXU(uk),yl.rXU(Lk))},tI.ɵcmp=yl.VBU({type:tI,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&&yl.DNE(0,qk,7,7,"ng-container",0)(1,Yk,9,7,"form",1)(2,Wk,4,4,"ng-container",0)(3,eI,8,6,"ng-container",0),2&e&&(yl.Y8G("ngIf",t.loading),yl.R7$(),yl.Y8G("ngIf",!t.loading),yl.R7$(),yl.Y8G("ngIf",t.state===t.State.NewUser),yl.R7$(),yl.Y8G("ngIf",t.state===t.State.ExistingUserUntrustedDevice))},dependencies:[rc,Rd,xd,Xu,Ku,id,Ub,pl.MD,pl.bT,Eu,hc,Sc,nu,qf,fl.X1,fl.qT,fl.Zm,fl.BC,fl.cb,fl.j4,fl.JD,Xl,Wl,Xf],encapsulation:2});var iI,nI=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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"}(iI||(iI={}));class rI{constructor(e,t,i,n,r){this.email=e,this.deviceIdentifier=t,this.publicKey=i,this.type=n,this.accessCode=r}}class sI{}class oI{constructor(){this.id=void 0,this.accessCode=void 0,this.privateKey=void 0}static fromJSON(e){return null==e?null:Object.assign(new oI,e)}}class aI{constructor(){this.viewCacheService=(0,a.WQX)(sI),this.defaultLoginViaAuthRequestCache=this.viewCacheService.signal({key:"login-via-auth-request-form-cache",initialValue:null,deserializer:oI.fromJSON})}cacheLoginView(e,t,i){this.defaultLoginViaAuthRequestCache.set({id:e,privateKey:kd.fromBufferToB64(t.buffer),accessCode:i})}clearCacheLoginView(){this.defaultLoginViaAuthRequestCache.set(null)}getCachedLoginViaAuthRequestView(){return this.defaultLoginViaAuthRequestCache()}}aI.ɵfac=function(e){return new(e||aI)},aI.ɵprov=a.jDH({token:aI,factory:aI.ɵfac});class lI{}class cI{}var uI,dI=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 hI(e,t){1&e&&(yl.qex(0),yl.j41(1,"div",1),yl.nrm(2,"i",2),yl.k0s(),yl.bVm())}function pI(e,t){if(1&e&&(yl.j41(0,"p"),yl.EFF(1),yl.nI1(2,"i18n"),yl.j41(3,"a",8),yl.EFF(4),yl.nI1(5,"i18n"),yl.k0s(),yl.EFF(6),yl.nI1(7,"i18n"),yl.k0s()),2&e){const e=yl.XpG(3);yl.R7$(),yl.SpI(" ",yl.bMT(2,4,"notificationSentDevicePart1")," "),yl.R7$(2),yl.Y8G("href",e.deviceManagementUrl,yl.B4B),yl.R7$(),yl.JRh(yl.bMT(5,6,"notificationSentDeviceAnchor")),yl.R7$(2),yl.SpI(". ",yl.bMT(7,8,"notificationSentDevicePart2")," ")}}function fI(e,t){1&e&&(yl.j41(0,"p"),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()),2&e&&(yl.R7$(),yl.SpI(" ",yl.bMT(2,1,"notificationSentDeviceComplete")," "))}function vI(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",9),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG(3);return a.Njj(t.handleNewStandardAuthRequestLogin())}),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()}2&e&&(yl.R7$(),yl.SpI(" ",yl.bMT(2,1,"resendNotification")," "))}function mI(e,t){if(1&e&&(yl.j41(0,"div",10)(1,"span"),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.EFF(4,"  "),yl.j41(5,"a",11),yl.EFF(6),yl.nI1(7,"i18n"),yl.k0s()()),2&e){const e=yl.XpG(3);yl.R7$(2),yl.JRh(yl.bMT(3,3,"needAnotherOptionV1")),yl.R7$(3),yl.Y8G("routerLink",e.backToRoute),yl.R7$(),yl.JRh(yl.bMT(7,5,"viewAllLogInOptions"))}}function gI(e,t){if(1&e&&(yl.qex(0),yl.DNE(1,pI,8,10,"p",0)(2,fI,3,3,"p",0),yl.j41(3,"div",4),yl.EFF(4),yl.nI1(5,"i18n"),yl.k0s(),yl.j41(6,"code",5),yl.EFF(7),yl.k0s(),yl.DNE(8,vI,3,3,"button",6)(9,mI,8,7,"div",7),yl.bVm()),2&e){const e=yl.XpG(2);yl.R7$(),yl.Y8G("ngIf",e.clientType!==e.ClientType.Web),yl.R7$(),yl.Y8G("ngIf",e.clientType===e.ClientType.Web),yl.R7$(2),yl.JRh(yl.bMT(5,6,"fingerprintPhraseHeader")),yl.R7$(3),yl.JRh(e.fingerprintPhrase),yl.R7$(),yl.Y8G("ngIf",e.showResendNotification),yl.R7$(),yl.Y8G("ngIf",e.clientType!==e.ClientType.Browser)}}function yI(e,t){if(1&e&&(yl.qex(0),yl.j41(1,"p"),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.j41(4,"div",4),yl.EFF(5),yl.nI1(6,"i18n"),yl.k0s(),yl.j41(7,"code",5),yl.EFF(8),yl.k0s(),yl.j41(9,"div",10)(10,"span"),yl.EFF(11),yl.nI1(12,"i18n"),yl.k0s(),yl.EFF(13,"  "),yl.j41(14,"a",11),yl.EFF(15),yl.nI1(16,"i18n"),yl.k0s()(),yl.bVm()),2&e){const e=yl.XpG(2);yl.R7$(2),yl.JRh(yl.bMT(3,6,"youWillBeNotifiedOnceTheRequestIsApproved")),yl.R7$(3),yl.JRh(yl.bMT(6,8,"fingerprintPhraseHeader")),yl.R7$(3),yl.JRh(e.fingerprintPhrase),yl.R7$(3),yl.JRh(yl.bMT(12,10,"troubleLoggingIn")),yl.R7$(3),yl.Y8G("routerLink",e.backToRoute),yl.R7$(),yl.JRh(yl.bMT(16,12,"viewAllLogInOptions"))}}function bI(e,t){if(1&e&&(yl.qex(0),yl.j41(1,"div",3),yl.DNE(2,gI,10,8,"ng-container",0)(3,yI,17,14,"ng-container",0),yl.k0s(),yl.bVm()),2&e){const e=yl.XpG();yl.R7$(2),yl.Y8G("ngIf",e.flow===e.Flow.StandardAuthRequest),yl.R7$(),yl.Y8G("ngIf",e.flow===e.Flow.AdminAuthRequest)}}!function(e){e[e.StandardAuthRequest=0]="StandardAuthRequest",e[e.AdminAuthRequest=1]="AdminAuthRequest"}(uI||(uI={}));const wI={paths:"exact",queryParams:"ignored",fragment:"ignored",matrixParams:"ignored"};class SI{constructor(e,t,i,n,r,s,o,a,l,c,u,d,h,p,f,v,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=f,this.router=v,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=Ca,this.email=void 0,this.fingerprintPhrase=void 0,this.showResendNotification=!1,this.Flow=uI,this.flow=uI.StandardAuthRequest,this.webVaultUrl=void 0,this.clientType=this.platformUtilsService.getClientType(),this.authRequestService.authRequestPushNotification$.pipe((0,wl.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,wl.pQ)()).subscribe(e=>{this.webVaultUrl=e.getWebVaultUrl(),this.deviceManagementUrl=`${this.webVaultUrl}/#/settings/security/device-management`})}ngOnInit(){return dI(this,void 0,void 0,function*(){this.authStatus=yield(0,ho._)(this.authService.activeAccountStatus$);this.authStatus===cd.Locked&&(this.backToRoute="/login-initiated"),this.router.isActive("admin-approval-requested",wI)?yield this.initAdminAuthRequestFlow():yield this.initStandardAuthRequestFlow(),this.loading=!1})}initAdminAuthRequestFlow(){return dI(this,void 0,void 0,function*(){var e;this.flow=uI.AdminAuthRequest;const t=null===(e=yield(0,ho._)(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 dI(this,void 0,void 0,function*(){var e,t;this.flow=uI.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,ho._)(n))&&void 0!==e?e:void 0;if(r||(r=null!==(t=yield(0,ho._)(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 dI(this,void 0,void 0,function*(){this.toastService.showToast({variant:"error",message:this.i18nService.t("userEmailMissing")}),yield this.router.navigate([this.backToRoute])})}ngOnDestroy(){return dI(this,void 0,void 0,function*(){yield this.anonymousHubService.stopHubConnection(),this.loginViaAuthRequestCacheService.clearCacheLoginView()})}handleNewAdminAuthRequestLogin(){return dI(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,iI.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 US({id:i.id,privateKey:this.authRequestKeyPair.privateKey}),r=null===(e=yield(0,ho._)(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 dI(this,void 0,void 0,function*(){return this.email=yield(0,ho._)(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 dI(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=kd.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 dI(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,iI.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 dI(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=kd.fromBufferToB64(this.authRequestKeyPair.publicKey);return new rI(e,n,r,t,this.accessCode)})}handleExistingAdminAuthRequestLogin(e,t){return dI(this,void 0,void 0,function*(){let i;try{i=yield this.authRequestApiService.getAuthRequest(e.id)}catch(e){return e instanceof Mw&&e.statusCode===xa.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 dI(this,void 0,void 0,function*(){let t;try{if(this.authStatus===cd.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 Mw&&e.statusCode===xa.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 dI(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===cd.Locked?yield this.handleAuthenticatedFlows(t):yield this.handleUnauthenticatedFlows(t,e)}yield this.anonymousHubService.createHubConnection(e)}catch(e){e instanceof Mw&&(yield this.router.navigate([this.backToRoute]),this.validationService.showError(e)),this.logService.error(e)}setTimeout(()=>{this.showResendNotification=!0},1e3*this.showResendNotificationTimeoutSeconds)})}handleAuthenticatedFlows(e){return dI(this,void 0,void 0,function*(){var t;const i=null===(t=yield(0,ho._)(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 dI(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 dI(this,void 0,void 0,function*(){e.masterPasswordHash?yield this.authRequestService.setKeysAfterDecryptingSharedMasterKeyAndHash(e,t,i):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,ho._)(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 dI(this,void 0,void 0,function*(){if(this.authRequestKeyPair&&this.authRequestKeyPair.privateKey)if(this.email){if(this.accessCode){if(t.masterPasswordHash){const{masterKey:i,masterKeyHash:n}=yield this.authRequestService.decryptPubKeyEncryptedMasterKeyAndHash(t.key,t.masterPasswordHash,this.authRequestKeyPair.privateKey);return new Tw(this.email,this.accessCode,e,null,i,n)}{const i=yield this.authRequestService.decryptPubKeyEncryptedUserKey(t.key,this.authRequestKeyPair.privateKey);return new Tw(this.email,this.accessCode,e,i,null,null)}}this.logService.error("Access code not defined when building auth request login credentials.")}else this.logService.error("Email not defined.");else this.logService.error("No private key set when building auth request login credentials.")})}clearExistingAdminAuthRequestAndStartNewRequest(e){return dI(this,void 0,void 0,function*(){yield this.authRequestService.clearAdminAuthRequest(e),yield this.handleNewAdminAuthRequestLogin()})}clearExistingStandardAuthRequestAndStartNewRequest(){return dI(this,void 0,void 0,function*(){this.loginViaAuthRequestCacheService.clearCacheLoginView(),yield this.handleNewStandardAuthRequestLogin()})}handlePostLoginNavigation(e){return dI(this,void 0,void 0,function*(){e.requiresTwoFactor?yield this.router.navigate(["2fa"]):yield this.handleSuccessfulLoginNavigation(e.userId)})}handleSuccessfulLoginNavigation(e){return dI(this,void 0,void 0,function*(){yield this.loginSuccessHandlerService.run(e,null),yield this.router.navigate(["vault"])})}}SI.ɵfac=function(e){return new(e||SI)(yl.rXU(Ok),yl.rXU(lI),yl.rXU(ok),yl.rXU(dw),yl.rXU(mw),yl.rXU(dd),yl.rXU(cI),yl.rXU(Nk),yl.rXU(JS),yl.rXU(Pl),yl.rXU(za),yl.rXU(hw),yl.rXU(pw),yl.rXU(rv),yl.rXU(Eb),yl.rXU(ud.Ix),yl.rXU(xb),yl.rXU(Cd),yl.rXU(gw),yl.rXU(aI))},SI.ɵcmp=yl.VBU({type:SI,selectors:[["ng-component"]],features:[yl.Jv_([{provide:aI}])],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&&yl.DNE(0,hI,3,0,"ng-container",0)(1,bI,4,2,"ng-container",0),2&e&&(yl.Y8G("ngIf",t.loading),yl.R7$(),yl.Y8G("ngIf",!t.loading))},dependencies:[Xu,Ku,pl.MD,pl.bT,qf,Oh,_b,sw.iI,sw.Wk,Xf],encapsulation:2});class kI{constructor(e){this.email=e}}class II{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")}}II.ɵfac=function(e){return new(e||II)(yl.rXU(yl.aKT),yl.rXU(yl.sFG))},II.ɵdir=yl.FsC({type:II,selectors:[["","appInputVerbatim",""]],inputs:{appInputVerbatim:"appInputVerbatim"},standalone:!1});var CI=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 TI(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"bit-form-field")(1,"bit-label"),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.nrm(4,"input",4),yl.k0s(),yl.j41(5,"button",5),yl.EFF(6),yl.nI1(7,"i18n"),yl.k0s(),yl.j41(8,"button",6),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.cancel())}),yl.EFF(9),yl.nI1(10,"i18n"),yl.k0s()}2&e&&(yl.R7$(2),yl.JRh(yl.bMT(3,5,"accountEmail")),yl.R7$(3),yl.Y8G("block",!0),yl.R7$(),yl.SpI(" ",yl.bMT(7,7,"requestHint")," "),yl.R7$(2),yl.Y8G("block",!0),yl.R7$(),yl.SpI(" ",yl.bMT(10,9,"cancel")," "))}function PI(e,t){1&e&&yl.eu8(0)}function FI(e,t){if(1&e&&(yl.j41(0,"main",7),yl.DNE(1,PI,1,0,"ng-container",8),yl.k0s()),2&e){yl.XpG();const e=yl.sdS(2);yl.R7$(),yl.Y8G("ngTemplateOutlet",e)}}function RI(e,t){1&e&&yl.eu8(0)}function xI(e,t){if(1&e&&(yl.qex(0),yl.DNE(1,RI,1,0,"ng-container",8),yl.bVm()),2&e){yl.XpG();const e=yl.sdS(2);yl.R7$(),yl.Y8G("ngTemplateOutlet",e)}}class AI{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:["",[fl.k0.required,fl.k0.email]]}),this.submit=()=>CI(this,void 0,void 0,function*(){this.validateEmailOrShowToast(this.email)&&(yield this.apiService.postPasswordHint(new kI(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 CI(this,void 0,void 0,function*(){var e;const t=null!==(e=yield(0,ho._)(this.loginEmailService.loginEmail$))&&void 0!==e?e:"";this.formGroup.controls.email.setValue(t)})}cancel(){return CI(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)}}AI.ɵfac=function(e){return new(e||AI)(yl.rXU(Mk),yl.rXU(fl.ok),yl.rXU(Pl),yl.rXU(hw),yl.rXU(Eb),yl.rXU(xb),yl.rXU(ud.Ix))},AI.ɵcmp=yl.VBU({type:AI,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&&(yl.j41(0,"form",1),yl.DNE(1,TI,11,11,"ng-template",null,0,yl.C5r)(3,FI,2,1,"main",2)(4,xI,2,1,"ng-container",3),yl.k0s()),2&e&&(yl.Y8G("bitSubmit",t.submit)("formGroup",t.formGroup),yl.R7$(3),yl.Y8G("ngIf","browser"===t.clientType),yl.R7$(),yl.Y8G("ngIf","browser"!==t.clientType))},dependencies:[rc,xd,Td,Xu,Ku,pl.MD,pl.bT,pl.T3,Eu,Sc,ou,Du,qf,hk,II,fl.X1,fl.qT,fl.me,fl.BC,fl.cb,fl.j4,fl.JD,sw.iI,Xf],encapsulation:2});const DI=lw` `,EI=lw` `;class $I{constructor(e,t,i){this.email=e,this.name=t,this.receiveMarketingEmails=i}}var OI=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 UI=(e,t)=>({"bwi-angle-right":e,"bwi-angle-down":t});function MI(e,t){1&e&&(yl.qex(0),yl.j41(1,"p",11),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.j41(4,"bit-form-field")(5,"bit-label"),yl.EFF(6),yl.nI1(7,"i18n"),yl.k0s(),yl.nrm(8,"input",12),yl.k0s(),yl.j41(9,"bit-form-field")(10,"bit-label"),yl.EFF(11),yl.nI1(12,"i18n"),yl.k0s(),yl.nrm(13,"input",13),yl.k0s(),yl.j41(14,"bit-form-field")(15,"bit-label"),yl.EFF(16),yl.nI1(17,"i18n"),yl.k0s(),yl.nrm(18,"input",14),yl.k0s(),yl.j41(19,"bit-form-field")(20,"bit-label"),yl.EFF(21),yl.nI1(22,"i18n"),yl.k0s(),yl.nrm(23,"input",15),yl.k0s(),yl.j41(24,"bit-form-field")(25,"bit-label"),yl.EFF(26),yl.nI1(27,"i18n"),yl.k0s(),yl.nrm(28,"input",16),yl.k0s(),yl.bVm()),2&e&&(yl.R7$(2),yl.SpI(" ",yl.bMT(3,6,"selfHostedCustomEnvHeader")," "),yl.R7$(4),yl.JRh(yl.bMT(7,8,"webVaultUrl")),yl.R7$(5),yl.JRh(yl.bMT(12,10,"apiUrl")),yl.R7$(5),yl.JRh(yl.bMT(17,12,"identityUrl")),yl.R7$(5),yl.JRh(yl.bMT(22,14,"notificationsUrl")),yl.R7$(5),yl.JRh(yl.bMT(27,16,"iconsUrl")))}function NI(e,t){1&e&&(yl.j41(0,"span",17),yl.nrm(1,"i",18),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s()),2&e&&(yl.R7$(2),yl.SpI(" ",yl.bMT(3,1,"selfHostedEnvFormInvalid")," "))}function VI(){const e=(0,a.WQX)(Pl),t=(0,a.WQX)(Eb);return i=>{const n=i.value;return!n||n.startsWith("https://")||t.isDev()?null:{onlyHttpsAllowed:{message:e.t("selfHostedEnvMustUseHttps")}}}}class BI{static open(e){return OI(this,void 0,void 0,function*(){const t=e.open(BI,{disableClose:!1}),i=yield(0,ho._)(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:["",[VI()]],webVaultUrl:["",[VI()]],apiUrl:["",[VI()]],identityUrl:["",[VI()]],iconsUrl:["",[VI()]],notificationsUrl:["",[VI()]]},{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 go.B,this.submit=()=>OI(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(qS.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,No.s)(1),(0,To.p)(e=>e.getRegion()===qS.SelfHosted),(0,Jv.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 OI(this,void 0,void 0,function*(){this.dialogRef.close(!1)})}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}}BI.ɵfac=function(e){return new(e||BI)(yl.rXU(Xd),yl.rXU(fl.ok),yl.rXU(JS))},BI.ɵcmp=yl.VBU({type:BI,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&&(yl.j41(0,"form",0)(1,"bit-dialog")(2,"span",1),yl.EFF(3," Self-hosted environment"),yl.k0s(),yl.qex(4,2),yl.j41(5,"bit-form-field")(6,"bit-label"),yl.EFF(7),yl.nI1(8,"i18n"),yl.k0s(),yl.nrm(9,"input",3),yl.j41(10,"bit-hint"),yl.EFF(11),yl.nI1(12,"i18n"),yl.k0s()(),yl.j41(13,"button",4),yl.bIt("click",function(){return t.showCustomEnv=!t.showCustomEnv}),yl.nrm(14,"i",5),yl.EFF(15),yl.nI1(16,"i18n"),yl.k0s(),yl.DNE(17,MI,29,18,"ng-container",6)(18,NI,4,3,"span",7),yl.bVm(),yl.qex(19,8),yl.j41(20,"button",9),yl.EFF(21),yl.nI1(22,"i18n"),yl.k0s(),yl.j41(23,"button",10),yl.bIt("click",function(){return t.cancel()}),yl.EFF(24),yl.nI1(25,"i18n"),yl.k0s(),yl.bVm(),yl.k0s()()),2&e&&(yl.Y8G("formGroup",t.formGroup)("bitSubmit",t.submit),yl.R7$(7),yl.JRh(yl.bMT(8,10,"baseUrl")),yl.R7$(4),yl.JRh(yl.bMT(12,12,"selfHostedBaseUrlHint")),yl.R7$(3),yl.Y8G("ngClass",yl.l_i(20,UI,!t.showCustomEnv,t.showCustomEnv)),yl.R7$(),yl.SpI(" ",yl.bMT(16,14,"customEnvironment")," "),yl.R7$(2),yl.Y8G("ngIf",t.showCustomEnv),yl.R7$(),yl.Y8G("ngIf",t.showErrorSummary),yl.R7$(3),yl.SpI(" ",yl.bMT(22,16,"save")," "),yl.R7$(3),yl.SpI(" ",yl.bMT(25,18,"cancel")," "))},dependencies:[pl.MD,pl.YU,pl.bT,qf,hk,II,dh,uh,Xu,Ku,Oh,Kb,Xl,Wl,fl.X1,fl.qT,fl.me,fl.BC,fl.cb,fl.j4,fl.JD,Eu,Sc,nu,ou,Du,rc,xd,Td,Xf],encapsulation:2});var jI=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 GI(e,t){if(1&e&&yl.nrm(0,"bit-option",5),2&e){const e=t.$implicit;yl.Y8G("value",e)("label",e.domain)}}function LI(e,t){if(1&e&&(yl.nrm(0,"bit-option",5),yl.nI1(1,"i18n")),2&e){const e=yl.XpG(2);yl.Y8G("value",e.ServerEnvironmentType.SelfHosted)("label",yl.bMT(1,2,"selfHostedServer"))}}function zI(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"form",1)(1,"bit-form-field")(2,"bit-label"),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s(),yl.j41(5,"bit-select",2),yl.bIt("closed",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.onSelectClosed())}),yl.DNE(6,GI,1,2,"bit-option",3)(7,LI,2,4,"bit-option",4),yl.k0s()()()}if(2&e){const e=yl.XpG();yl.Y8G("formGroup",e.formGroup),yl.R7$(3),yl.JRh(yl.bMT(4,4,"creatingAccountOn")),yl.R7$(3),yl.Y8G("ngForOf",e.availableRegionConfigs),yl.R7$(),yl.Y8G("ngIf",e.isDesktopOrBrowserExtension)}}class _I{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 yl.bkB,this.ServerEnvironmentType=qS,this.formGroup=this.formBuilder.group({selectedRegion:[null,fl.k0.required]}),this.availableRegionConfigs=this.environmentService.availableRegions(),this.hideEnvSelector=!1,this.isDesktopOrBrowserExtension=!1,this.destroy$=new go.B;const o=s.getClientType();this.isDesktopOrBrowserExtension=o===Ca.Desktop||o===Ca.Browser,this.hideEnvSelector=o===Ca.Web&&this.platformUtilsService.isSelfHost()}ngOnInit(){return jI(this,void 0,void 0,function*(){this.hideEnvSelector||(yield this.initSelectedRegionAndListenForEnvChanges(),this.listenForSelectedRegionChanges())})}initSelectedRegionAndListenForEnvChanges(){return jI(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?qS.SelfHosted:i}),(0,Fo.M)(e=>{e!==this.selectedRegion.value&&this.selectedRegion.setValue(e,{emitEvent:!1}),this.selectedRegionFromEnv=e,this.selectedRegionChange.emit(e)}),(0,Jv.Q)(this.destroy$)).subscribe()})}listenForSelectedRegionChanges(){this.selectedRegion.valueChanges.pipe((0,sd.Z)(null),(0,Qv.J)(),(0,co.n)(([e,t])=>null===t?(this.selectedRegionChange.emit(t),(0,Oo.of)(null)):t!==qS.SelfHosted?(this.selectedRegionChange.emit(t),(0,md.H)(this.environmentService.setEnvironment(t.key))):(0,Oo.of)(null)),(0,Jv.Q)(this.destroy$)).subscribe()}handleSelfHostedEnvConfigDialogResult(e,t){if(!0===e)return this.selectedRegionChange.emit(qS.SelfHosted),void this.toastService.showToast({variant:"success",title:null,message:this.i18nService.t("environmentSaved")});!1!==e&&void 0!==e||null===t||t===qS.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 jI(this,void 0,void 0,function*(){if(this.selectedRegion.value===qS.SelfHosted){const e=yield BI.open(this.dialogService);return this.handleSelfHostedEnvConfigDialogResult(e,this.selectedRegion.value)}})}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}}_I.ɵfac=function(e){return new(e||_I)(yl.rXU(fl.ok),yl.rXU(JS),yl.rXU(Jd),yl.rXU(Pl),yl.rXU(xb),yl.rXU(Eb))},_I.ɵcmp=yl.VBU({type:_I,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&&yl.DNE(0,zI,8,6,"form",0),2&e&&yl.Y8G("ngIf",!t.hideEnvSelector)},dependencies:[pl.MD,pl.Sq,pl.bT,qf,fl.X1,fl.qT,fl.BC,fl.cb,fl.j4,fl.JD,Eu,Sc,Du,Bu,Vu,Ou,Xf],encapsulation:2});class KI{}var XI,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 YI(e,t){1&e&&(yl.j41(0,"bit-form-control"),yl.nrm(1,"input",10),yl.j41(2,"bit-label",11),yl.EFF(3),yl.nI1(4,"i18n"),yl.j41(5,"a",12),yl.EFF(6),yl.nI1(7,"i18n"),yl.k0s(),yl.EFF(8),yl.nI1(9,"i18n"),yl.k0s()()),2&e&&(yl.R7$(3),yl.SpI(" ",yl.bMT(4,3,"receiveMarketingEmailsV2")," "),yl.R7$(3),yl.SpI(" ",yl.bMT(7,5,"unsubscribe")," "),yl.R7$(2),yl.SpI(" ",yl.bMT(9,7,"atAnyTime")," "))}function WI(e,t){if(1&e&&yl.nrm(0,"bit-error-summary",13),2&e){const e=yl.XpG(2);yl.Y8G("formGroup",e.formGroup)}}function HI(e,t){if(1&e){const e=yl.RV6();yl.qex(0),yl.j41(1,"form",1)(2,"auth-registration-env-selector",2),yl.bIt("selectedRegionChange",function(t){a.eBV(e);const i=yl.XpG();return a.Njj(i.handleSelectedRegionChange(t))}),yl.k0s(),yl.j41(3,"bit-form-field")(4,"bit-label"),yl.EFF(5),yl.nI1(6,"i18n"),yl.k0s(),yl.nrm(7,"input",3),yl.k0s(),yl.j41(8,"bit-form-field")(9,"bit-label"),yl.EFF(10),yl.nI1(11,"i18n"),yl.k0s(),yl.nrm(12,"input",4),yl.k0s(),yl.DNE(13,YI,10,9,"bit-form-control",0),yl.j41(14,"button",5),yl.EFF(15),yl.nI1(16,"i18n"),yl.k0s(),yl.j41(17,"p",6),yl.EFF(18),yl.nI1(19,"i18n"),yl.j41(20,"a",7),yl.EFF(21),yl.nI1(22,"i18n"),yl.k0s(),yl.EFF(23),yl.nI1(24,"i18n"),yl.j41(25,"a",8),yl.EFF(26),yl.nI1(27,"i18n"),yl.k0s()(),yl.DNE(28,WI,1,1,"bit-error-summary",9),yl.k0s(),yl.bVm()}if(2&e){const e=yl.XpG();yl.R7$(),yl.Y8G("formGroup",e.formGroup)("bitSubmit",e.submit),yl.R7$(4),yl.JRh(yl.bMT(6,13,"emailAddress")),yl.R7$(2),yl.BMQ("readonly",!!e.emailReadonly||null),yl.R7$(3),yl.JRh(yl.bMT(11,15,"name")),yl.R7$(3),yl.Y8G("ngIf",!e.isSelfHost),yl.R7$(),yl.Y8G("block",!0),yl.R7$(),yl.SpI(" ",yl.bMT(16,17,"continue")," "),yl.R7$(3),yl.SpI(" ",yl.bMT(19,19,"byContinuingYouAgreeToThe")," "),yl.R7$(3),yl.JRh(yl.bMT(22,21,"termsOfService")),yl.R7$(2),yl.SpI(" ",yl.bMT(24,23,"and")," "),yl.R7$(3),yl.JRh(yl.bMT(27,25,"privacyPolicy")),yl.R7$(2),yl.Y8G("ngIf",e.showErrorSummary)}}function JI(e,t){if(1&e){const e=yl.RV6();yl.qex(0),yl.j41(1,"div",14)(2,"p",15),yl.EFF(3),yl.nI1(4,"i18n"),yl.j41(5,"span",16),yl.EFF(6),yl.k0s(),yl.EFF(7),yl.nI1(8,"i18n"),yl.k0s(),yl.j41(9,"p",17),yl.EFF(10),yl.nI1(11,"i18n"),yl.j41(12,"a",18),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.goBack())}),yl.EFF(13),yl.nI1(14,"i18n"),yl.k0s(),yl.EFF(15),yl.nI1(16,"i18n"),yl.k0s()(),yl.bVm()}if(2&e){const e=yl.XpG();yl.R7$(3),yl.SpI(" ",yl.bMT(4,6,"followTheLinkInTheEmailSentTo")," "),yl.R7$(3),yl.JRh(e.email.value),yl.R7$(),yl.SpI(" ",yl.bMT(8,8,"andContinueCreatingYourAccount")," "),yl.R7$(3),yl.SpI(" ",yl.bMT(11,10,"noEmail")," "),yl.R7$(3),yl.SpI(" ",yl.bMT(14,12,"goBack")," "),yl.R7$(2),yl.SpI(" ",yl.bMT(16,14,"toEditYourEmailAddress")," ")}}!function(e){e.USER_DATA_ENTRY="UserDataEntry",e.CHECK_EMAIL="CheckEmail"}(XI||(XI={}));const ZI={[qS.US]:!0,[qS.EU]:!1,[qS.SelfHosted]:!1};class QI{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 yl.bkB,this.state=XI.USER_DATA_ENTRY,this.RegistrationStartState=XI,this.isSelfHost=!1,this.formGroup=this.formBuilder.group({email:["",[fl.k0.required,fl.k0.email]],name:[""],receiveMarketingEmails:[!1]}),this.emailReadonly=!1,this.showErrorSummary=!1,this.destroy$=new go.B,this.submit=()=>qI(this,void 0,void 0,function*(){if(!this.validateForm())return;const e=""===this.name.value?null:this.name.value,t=new $I(this.email.value,e,this.receiveMarketingEmails.value),i=yield this.accountApiService.registerSendVerificationEmail(t);"string"!=typeof i?(this.state=XI.CHECK_EMAIL,this.anonLayoutWrapperDataService.setAnonLayoutWrapperData({pageTitle:{key:"checkYourEmail"},pageIcon:DI}),this.registrationStartStateChange.emit(this.state)):yield this.router.navigate(["/finish-signup"],{queryParams:{token:i,email:this.email.value}})}),this.isSelfHost=i.isSelfHost()}ngOnInit(){return qI(this,void 0,void 0,function*(){this.registrationStartStateChange.emit(this.state),this.listenForQueryParamChanges(),this.loginEmailService.loginEmail$.pipe((0,Jv.Q)(this.destroy$)).subscribe(e=>{e&&this.formGroup.patchValue({email:e})})})}listenForQueryParamChanges(){this.route.queryParams.pipe((0,Jv.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===qS.SelfHosted)t=ZI[e];else{const i=e.key;t=ZI[i]}this.receiveMarketingEmails.setValue(t)}handleSelectedRegionChange(e){this.isSelfHost=e===qS.SelfHosted,null!==e&&this.setReceiveMarketingEmailsByRegion(e)}validateForm(){return this.formGroup.markAllAsTouched(),this.formGroup.invalid&&(this.showErrorSummary=!0),this.formGroup.valid}goBack(){this.state=XI.USER_DATA_ENTRY,this.anonLayoutWrapperDataService.setAnonLayoutWrapperData({pageIcon:EI,pageTitle:{key:"createAccount"}}),this.registrationStartStateChange.emit(this.state)}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}}QI.ɵfac=function(e){return new(e||QI)(yl.rXU(fl.ok),yl.rXU(ud.nX),yl.rXU(Eb),yl.rXU(KI),yl.rXU(ud.Ix),yl.rXU($w),yl.rXU(sk))},QI.ɵcmp=yl.VBU({type:QI,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&&yl.DNE(0,HI,29,27,"ng-container",0)(1,JI,17,16,"ng-container",0),2&e&&(yl.Y8G("ngIf",t.state===t.RegistrationStartState.USER_DATA_ENTRY),yl.R7$(),yl.Y8G("ngIf",t.state===t.RegistrationStartState.CHECK_EMAIL))},dependencies:[pl.MD,pl.bT,fl.X1,fl.qT,fl.me,fl.Zm,fl.BC,fl.cb,fl.j4,fl.JD,qf,Eu,hc,Sc,ou,Nb,Du,rc,xd,Td,id,Ub,Xu,Ku,Oh,_b,$h,_I,Xf],encapsulation:2});class eC{constructor(e,t){this.email=e,this.emailVerificationToken=t}}class tC{}class iC{}var nC=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 rC=()=>({key:"createAccount"});function sC(e,t){1&e&&(yl.j41(0,"div",2),yl.nrm(1,"i",3),yl.k0s())}function oC(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"auth-input-password",4),yl.bIt("onPasswordFormSubmit",function(t){a.eBV(e);const i=yl.XpG();return a.Njj(i.handlePasswordFormSubmit(t))}),yl.k0s()}if(2&e){const e=yl.XpG();yl.Y8G("email",e.email)("flow",e.inputPasswordFlow)("masterPasswordPolicyOptions",e.masterPasswordPolicyOptions)("loading",e.submitting)("primaryButtonText",yl.lJ4(5,rC))}}const aC=Object.freeze({Premium:"premium"});class lC{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 go.B,this.inputPasswordFlow=Xb.SetInitialPasswordAccountRegistration,this.loading=!0,this.submitting=!1,this.premiumInterest=!1,this.masterPasswordPolicyOptions=null}ngOnInit(){return nC(this,void 0,void 0,function*(){const e=yield(0,ho._)(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===aC.Premium&&(this.premiumInterest=!0)}initOrgInviteFlowIfPresent(){return nC(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 nC(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 Iw(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 nC(this,void 0,void 0,function*(){this.setDefaultPageTitleAndSubtitle(),yield this.registerVerificationEmailClicked(this.email,this.emailVerificationToken)})}registerVerificationEmailClicked(e,t){return nC(this,void 0,void 0,function*(){const i=new eC(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 nC(this,void 0,void 0,function*(){if(e instanceof Mw){const t=e;if(t.statusCode===xa.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()}}lC.ɵfac=function(e){return new(e||lC)(yl.rXU(ud.nX),yl.rXU(ud.Ix),yl.rXU(xb),yl.rXU(Pl),yl.rXU(tC),yl.rXU(Cd),yl.rXU(KI),yl.rXU(pw),yl.rXU(za),yl.rXU(sk),yl.rXU(gw),yl.rXU(iC))},lC.ɵcmp=yl.VBU({type:lC,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&&yl.DNE(0,sC,2,0,"div",0)(1,oC,1,6,"auth-input-password",1),2&e&&(yl.Y8G("ngIf",t.loading),yl.R7$(),yl.Y8G("ngIf",!t.loading))},dependencies:[pl.MD,pl.bT,qf,sw.iI,rw],encapsulation:2});const cC=lw` `;var uC=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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,this.destroy$=new go.B,this.Icons={TwoFactorTimeoutIcon:cC}}ngOnInit(){return uC(this,void 0,void 0,function*(){const e=yield(0,ho._)(this.activatedRoute.data);this.loginRoute=e.loginRoute})}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}}dC.ɵfac=function(e){return new(e||dC)(yl.rXU(ud.nX))},dC.ɵcmp=yl.VBU({type:dC,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&&(yl.j41(0,"div",0)(1,"p",1),yl.EFF(2),yl.nI1(3,"i18n"),yl.nrm(4,"br"),yl.EFF(5),yl.nI1(6,"i18n"),yl.k0s(),yl.j41(7,"a",2),yl.EFF(8),yl.nI1(9,"i18n"),yl.k0s(),yl.j41(10,"a",3),yl.EFF(11),yl.nI1(12,"i18n"),yl.k0s()()),2&e&&(yl.R7$(2),yl.SpI(" ",yl.bMT(3,7,"pleaseRestartRegistrationOrTryLoggingIn")),yl.R7$(3),yl.SpI(" ",yl.bMT(6,9,"youMayAlreadyHaveAnAccount")," "),yl.R7$(2),yl.Y8G("block",!0),yl.R7$(),yl.SpI(" ",yl.bMT(9,11,"restartRegistration")," "),yl.R7$(2),yl.Y8G("block",!0)("routerLink",t.loginRoute),yl.R7$(),yl.SpI(" ",yl.bMT(12,13,"logIn")," "))},dependencies:[pl.MD,qf,sw.iI,sw.Wk,$h,Xu,Ku,Xf],encapsulation:2});var hC=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 pC{constructor(e){this.activatedRoute=e}ngOnInit(){return hC(this,void 0,void 0,function*(){const e=yield(0,ho._)(this.activatedRoute.data);this.loginRoute=e.loginRoute})}}pC.ɵfac=function(e){return new(e||pC)(yl.rXU(ud.nX))},pC.ɵcmp=yl.VBU({type:pC,selectors:[["auth-registration-start-secondary"]],decls:6,vars:7,consts:[["bitLink","",3,"routerLink"]],template:function(e,t){1&e&&(yl.j41(0,"span"),yl.EFF(1),yl.nI1(2,"i18n"),yl.j41(3,"a",0),yl.EFF(4),yl.nI1(5,"i18n"),yl.k0s()()),2&e&&(yl.R7$(),yl.SpI("",yl.bMT(2,3,"alreadyHaveAccount")," "),yl.R7$(2),yl.Y8G("routerLink",t.loginRoute),yl.R7$(),yl.JRh(yl.bMT(5,5,"logIn")))},dependencies:[pl.MD,qf,sw.iI,sw.Wk,Oh,_b,Xf],encapsulation:2});class fC{constructor(e,t,i,n,r,s,o,a,l,c,u,d,h,p,f,v,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=f,this.organizationUserId=v,this.orgInviteToken=m}}var vC,mC=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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"}(vC||(vC={}));const gC=lw` `;var yC;!function(e){e[e.MasterPassword=0]="MasterPassword",e[e.OTP=1]="OTP",e[e.PIN=2]="PIN",e[e.Biometrics=3]="Biometrics"}(yC||(yC={}));class bC{}var wC=i(23197);class SC{constructor(e){this.domSanitizer=e,this.innerHtml=null,this.icon=(0,o.hFB)(),this.ariaLabel=(0,o.hFB)(),(0,bl.QZ)(()=>{const e=this.icon();if(!function(e){return e instanceof ow}(e))return;const t=e.svg;this.innerHtml=this.domSanitizer.bypassSecurityTrustHtml(t)})}}SC.ɵfac=function(e){return new(e||SC)(yl.rXU(wC.up))},SC.ɵcmp=yl.VBU({type:SC,selectors:[["bit-icon"]],hostAttrs:[1,"tw-max-h-full","tw-flex","tw-justify-center"],hostVars:3,hostBindings:function(e,t){2&e&&(yl.Avn("innerHTML",t.innerHtml,yl.npT),yl.BMQ("aria-hidden",!t.ariaLabel())("aria-label",t.ariaLabel()))},inputs:{icon:[1,"icon"],ariaLabel:[1,"ariaLabel"]},decls:0,vars:0,template:function(e,t){},encapsulation:2});var kC=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 IC(e,t){1&e&&yl.eu8(0)}function CC(e,t){if(1&e&&(yl.qex(0),yl.DNE(1,IC,1,0,"ng-container",4),yl.bVm()),2&e){yl.XpG(2);const e=yl.sdS(3);yl.R7$(),yl.Y8G("ngTemplateOutlet",e)}}function TC(e,t){if(1&e&&(yl.qex(0),yl.j41(1,"bit-form-field",5)(2,"bit-label"),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s(),yl.nrm(5,"input",6)(6,"button",7),yl.j41(7,"bit-hint"),yl.EFF(8),yl.nI1(9,"i18n"),yl.k0s()(),yl.bVm()),2&e){const e=yl.XpG(2);yl.R7$(3),yl.JRh(yl.bMT(4,3,"pin")),yl.R7$(2),yl.Y8G("formControl",e.secret),yl.R7$(3),yl.JRh(yl.bMT(9,5,"confirmIdentity"))}}function PC(e,t){1&e&&(yl.j41(0,"div"),yl.nrm(1,"i",13),yl.nI1(2,"i18n"),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s()),2&e&&(yl.R7$(),yl.Y8G("title",yl.mNQ(yl.bMT(2,3,"loading"))),yl.R7$(2),yl.SpI(" ",yl.bMT(4,5,"awaitingConfirmation")," "))}function FC(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"bit-callout",14),yl.EFF(1),yl.nI1(2,"i18n"),yl.j41(3,"button",15),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG(3);return a.Njj(t.verifyUserViaBiometrics())}),yl.EFF(4),yl.nI1(5,"i18n"),yl.k0s()()}2&e&&(yl.R7$(),yl.SpI(" ",yl.bMT(2,2,"couldNotCompleteBiometrics")," "),yl.R7$(3),yl.SpI(" ",yl.bMT(5,4,"tryAgain")," "))}function RC(e,t){if(1&e&&(yl.qex(0),yl.j41(1,"div",8)(2,"div",9),yl.nrm(3,"bit-icon",10),yl.k0s(),yl.j41(4,"p",11),yl.EFF(5),yl.nI1(6,"i18n"),yl.k0s(),yl.DNE(7,PC,5,7,"div",1),yl.k0s(),yl.DNE(8,FC,6,6,"bit-callout",12),yl.bVm()),2&e){const e=yl.XpG(2);yl.R7$(3),yl.Y8G("icon",e.Icons.UserVerificationBiometricsIcon),yl.R7$(2),yl.JRh(yl.bMT(6,4,"verifyWithBiometrics")),yl.R7$(2),yl.Y8G("ngIf",!e.biometricsVerificationFailed),yl.R7$(),yl.Y8G("ngIf",e.biometricsVerificationFailed)}}function xC(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",20),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG(3);return a.Njj(t.activeClientVerificationOption=t.ActiveClientVerificationOption.Biometrics)}),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()}2&e&&(yl.R7$(),yl.SpI(" ",yl.bMT(2,1,"useBiometrics")," "))}function AC(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",20),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG(3);return a.Njj(t.activeClientVerificationOption=t.ActiveClientVerificationOption.Pin)}),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()}2&e&&(yl.R7$(),yl.SpI(" ",yl.bMT(2,1,"usePin")," "))}function DC(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",21),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG(3);return a.Njj(t.activeClientVerificationOption=t.ActiveClientVerificationOption.MasterPassword)}),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()}2&e&&(yl.R7$(),yl.SpI(" ",yl.bMT(2,1,"useMasterPassword")," "))}function EC(e,t){if(1&e&&(yl.j41(0,"div",16)(1,"p",17),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.DNE(4,xC,3,3,"button",18)(5,AC,3,3,"button",18)(6,DC,3,3,"button",19),yl.k0s()),2&e){const e=yl.XpG(2);yl.R7$(2),yl.JRh(yl.bMT(3,4,"needADifferentMethod")),yl.R7$(2),yl.Y8G("ngIf",e.userVerificationOptions.client.biometrics&&e.activeClientVerificationOption!==e.ActiveClientVerificationOption.Biometrics),yl.R7$(),yl.Y8G("ngIf",e.userVerificationOptions.client.pin&&e.activeClientVerificationOption!==e.ActiveClientVerificationOption.Pin),yl.R7$(),yl.Y8G("ngIf",e.userVerificationOptions.client.masterPassword&&e.activeClientVerificationOption!==e.ActiveClientVerificationOption.MasterPassword)}}function $C(e,t){if(1&e&&(yl.qex(0),yl.j41(1,"div",2),yl.DNE(2,CC,2,1,"ng-container",1)(3,TC,10,7,"ng-container",1)(4,RC,9,6,"ng-container",1)(5,EC,7,6,"div",3),yl.k0s(),yl.bVm()),2&e){const e=yl.XpG();yl.R7$(2),yl.Y8G("ngIf",e.userVerificationOptions.client.masterPassword&&e.activeClientVerificationOption==e.ActiveClientVerificationOption.MasterPassword),yl.R7$(),yl.Y8G("ngIf",e.userVerificationOptions.client.pin&&e.activeClientVerificationOption==e.ActiveClientVerificationOption.Pin),yl.R7$(),yl.Y8G("ngIf",e.userVerificationOptions.client.biometrics&&e.activeClientVerificationOption==e.ActiveClientVerificationOption.Biometrics),yl.R7$(),yl.Y8G("ngIf",e.hasMultipleClientVerificationOptions)}}function OC(e,t){1&e&&yl.eu8(0)}function UC(e,t){if(1&e&&(yl.qex(0),yl.DNE(1,OC,1,0,"ng-container",4),yl.bVm()),2&e){yl.XpG(2);const e=yl.sdS(3);yl.R7$(),yl.Y8G("ngTemplateOutlet",e)}}function MC(e,t){1&e&&(yl.j41(0,"div",24),yl.nrm(1,"i",13),yl.nI1(2,"i18n"),yl.k0s()),2&e&&(yl.R7$(),yl.Y8G("title",yl.mNQ(yl.bMT(2,2,"loading"))))}function NC(e,t){1&e&&(yl.j41(0,"span",27),yl.nrm(1,"i",28),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s()),2&e&&(yl.Y8G("@sent",void 0),yl.R7$(2),yl.SpI(" ",yl.bMT(3,2,"codeSent")," "))}function VC(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"div",24),yl.EFF(1),yl.nI1(2,"i18n"),yl.j41(3,"p",25)(4,"button",15),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG(3);return a.Njj(t.requestOTP())}),yl.EFF(5),yl.nI1(6,"i18n"),yl.k0s(),yl.DNE(7,NC,4,4,"span",26),yl.k0s()()}if(2&e){const e=yl.XpG(3);yl.R7$(),yl.SpI(" ",yl.bMT(2,3,"enterVerificationCodeSentToEmail")," "),yl.R7$(4),yl.SpI(" ",yl.bMT(6,5,"resendCode")," "),yl.R7$(2),yl.Y8G("ngIf",e.sentCode)}}function BC(e,t){if(1&e&&(yl.qex(0),yl.DNE(1,MC,3,4,"div",22)(2,VC,8,7,"div",22),yl.j41(3,"bit-form-field",5)(4,"bit-label"),yl.EFF(5),yl.nI1(6,"i18n"),yl.k0s(),yl.nrm(7,"input",23),yl.j41(8,"bit-hint"),yl.EFF(9),yl.nI1(10,"i18n"),yl.k0s()(),yl.bVm()),2&e){const e=yl.XpG(2);yl.R7$(),yl.Y8G("ngIf",!e.sentInitialCode),yl.R7$(),yl.Y8G("ngIf",e.sentInitialCode),yl.R7$(3),yl.JRh(yl.bMT(6,5,"verificationCode")),yl.R7$(2),yl.Y8G("formControl",e.secret),yl.R7$(2),yl.JRh(yl.bMT(10,7,"confirmIdentity"))}}function jC(e,t){if(1&e&&(yl.qex(0),yl.DNE(1,UC,2,1,"ng-container",1)(2,BC,11,9,"ng-container",1),yl.bVm()),2&e){const e=yl.XpG();yl.R7$(),yl.Y8G("ngIf",e.userVerificationOptions.server.masterPassword),yl.R7$(),yl.Y8G("ngIf",e.userVerificationOptions.server.otp)}}function GC(e,t){if(1&e&&(yl.j41(0,"bit-form-field",5)(1,"bit-label"),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.nrm(4,"input",29)(5,"button",7),yl.j41(6,"bit-hint"),yl.EFF(7),yl.nI1(8,"i18n"),yl.k0s()()),2&e){const e=yl.XpG();yl.R7$(2),yl.JRh(yl.bMT(3,3,"masterPass")),yl.R7$(2),yl.Y8G("formControl",e.secret),yl.R7$(3),yl.JRh(yl.bMT(8,5,"confirmIdentity"))}}class LC{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===vC.MasterPassword?this.i18nService.t("incorrectPassword"):this.activeClientVerificationOption===vC.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 yl.bkB,this.activeClientVerificationOptionChange=new yl.bkB,this.biometricsVerificationResultChange=new yl.bkB,this.Icons={UserVerificationBiometricsIcon:gC},this.userVerificationOptions={client:{masterPassword:!1,pin:!1,biometrics:!1},server:{masterPassword:!1,otp:!1}},this.ActiveClientVerificationOption=vC,this._activeClientVerificationOptionSubject=new fd.t(null),this.activeClientVerificationOption$=this._activeClientVerificationOptionSubject.asObservable(),this.biometricsVerificationFailed=!1,this.disableRequestOTP=!1,this.sentInitialCode=!1,this.sentCode=!1,this.secret=new fl.MJ("",[fl.k0.required,()=>{if(this.invalidSecret)return{invalidSecret:{message:this.getInvalidSecretErrorMessage()}}}]),this.destroy$=new go.B,this.requestOTP=()=>kC(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 kC(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!==vC.Biometrics&&this.processSecretChanges(this.secret.value),this.secret.valueChanges.pipe((0,Jv.Q)(this.destroy$)).subscribe(e=>this.processSecretChanges(e))})}setDefaultActiveClientVerificationOption(){this.userVerificationOptions.client.biometrics?this.activeClientVerificationOption=vC.Biometrics:this.userVerificationOptions.client.pin?this.activeClientVerificationOption=vC.Pin:this.userVerificationOptions.client.masterPassword?this.activeClientVerificationOption=vC.MasterPassword:this.activeClientVerificationOption=vC.None}setupClientVerificationOptionChangeHandler(){this.activeClientVerificationOption$.pipe((0,Jv.Q)(this.destroy$)).subscribe(e=>{this.handleActiveClientVerificationOptionChange(e)})}handleActiveClientVerificationOptionChange(e){return kC(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 kC(this,void 0,void 0,function*(){this.biometricsVerificationFailed=!1;const e=yield this.userVerificationService.verifyUser({type:yC.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!==vC.Biometrics&&null!=this.onChange&&this.onChange({type:this.determineVerificationWithSecretType(),secret:kd.isNullOrWhitespace(e)?null:e})}determineVerificationWithSecretType(){return"server"===this.verificationType?this.userVerificationOptions.server.masterPassword?yC.MasterPassword:yC.OTP:this.userVerificationOptions.client.masterPassword&&this.activeClientVerificationOption===vC.MasterPassword?yC.MasterPassword:yC.PIN}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}}LC.ɵfac=function(e){return new(e||LC)(yl.rXU(bC),yl.rXU(Pl))},LC.ɵcmp=yl.VBU({type:LC,selectors:[["app-user-verification-form-input"]],inputs:{verificationType:"verificationType",invalidSecret:"invalidSecret"},outputs:{invalidSecretChange:"invalidSecretChange",activeClientVerificationOptionChange:"activeClientVerificationOptionChange",biometricsVerificationResultChange:"biometricsVerificationResultChange"},features:[yl.Jv_([{provide:fl.kq,multi:!0,useExisting:LC}])],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,"icon"],[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&&yl.DNE(0,$C,6,4,"ng-container",1)(1,jC,3,2,"ng-container",1)(2,GC,9,7,"ng-template",null,0,yl.C5r),2&e&&(yl.Y8G("ngIf","client"===t.verificationType),yl.R7$(),yl.Y8G("ngIf","server"===t.verificationType))},dependencies:[pl.MD,pl.bT,pl.T3,fl.X1,fl.me,fl.BC,fl.l_,qf,hk,II,Eu,Sc,nu,ou,Du,Vb,Bb,rc,_l,zl,$h,SC,Oh,Kb,Xu,td,ed,Xf],encapsulation:2,data:{animation:[(0,gl.hZ)("sent",[(0,gl.kY)(":enter",[(0,gl.iF)({opacity:0}),(0,gl.i0)("100ms",(0,gl.iF)({opacity:1}))])])]}});var zC=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 _C(e,t){if(1&e&&(yl.j41(0,"p",9),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()),2&e){const e=yl.XpG(2);yl.R7$(),yl.SpI(" ",yl.bMT(2,1,e.dialogOptions.bodyText)," ")}}function KC(e,t){if(1&e&&(yl.j41(0,"bit-callout",10),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()),2&e){const e=yl.XpG(2);yl.Y8G("type",e.dialogOptions.calloutOptions.type),yl.R7$(),yl.SpI(" ",yl.bMT(2,2,e.dialogOptions.calloutOptions.text)," ")}}function XC(e,t){if(1&e&&(yl.qex(0),yl.DNE(1,_C,3,3,"p",7)(2,KC,3,4,"bit-callout",8),yl.bVm()),2&e){const e=yl.XpG();yl.R7$(),yl.Y8G("ngIf",e.dialogOptions.bodyText),yl.R7$(),yl.Y8G("ngIf",e.dialogOptions.calloutOptions)}}function qC(e,t){1&e&&(yl.qex(0),yl.j41(1,"p",9),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.bVm()),2&e&&(yl.R7$(2),yl.SpI(" ",yl.bMT(3,1,"verificationRequiredForActionSetPinToContinue")," "))}function YC(e,t){1&e&&(yl.j41(0,"button",13),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()),2&e&&(yl.R7$(),yl.SpI(" ",yl.bMT(2,1,"submit")," "))}function WC(e,t){if(1&e&&(yl.j41(0,"button",14),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()),2&e){const e=yl.XpG(3);yl.Y8G("buttonType",e.dialogOptions.confirmButtonOptions.type),yl.R7$(),yl.SpI(" ",yl.bMT(2,2,e.dialogOptions.confirmButtonOptions.text)," ")}}function HC(e,t){if(1&e&&(yl.qex(0),yl.DNE(1,YC,3,3,"button",11)(2,WC,3,4,"button",12),yl.bVm()),2&e){const e=yl.XpG(2);yl.R7$(),yl.Y8G("ngIf",!e.dialogOptions.confirmButtonOptions),yl.R7$(),yl.Y8G("ngIf",e.dialogOptions.confirmButtonOptions)}}function JC(e,t){1&e&&(yl.qex(0),yl.j41(1,"button",13),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.bVm()),2&e&&(yl.R7$(2),yl.SpI(" ",yl.bMT(3,1,"setPin")," "))}function ZC(e,t){if(1&e&&(yl.qex(0),yl.DNE(1,HC,3,2,"ng-container",3)(2,JC,4,3,"ng-container",3),yl.bVm()),2&e){const e=yl.XpG();yl.R7$(),yl.Y8G("ngIf",e.activeClientVerificationOption!==e.ActiveClientVerificationOption.None),yl.R7$(),yl.Y8G("ngIf",e.activeClientVerificationOption===e.ActiveClientVerificationOption.None)}}class QC{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=vC,this.submit=()=>zC(this,void 0,void 0,function*(){if(this.activeClientVerificationOption!==vC.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===vC.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 zC(this,void 0,void 0,function*(){const i=e.open(QC,{data:t}),n=yield(0,ho._)(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)}}QC.ɵfac=function(e){return new(e||QC)(yl.rXU(nd.Qs),yl.rXU(Xd),yl.rXU(fl.ok),yl.rXU(bC),yl.rXU(Eb),yl.rXU(Pl),yl.rXU(xb))},QC.ɵcmp=yl.VBU({type:QC,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&&(yl.j41(0,"form",0)(1,"bit-dialog")(2,"span",1),yl.EFF(3),yl.nI1(4,"i18n"),yl.nI1(5,"i18n"),yl.k0s(),yl.qex(6,2),yl.DNE(7,XC,3,2,"ng-container",3)(8,qC,4,3,"ng-container",3),yl.j41(9,"app-user-verification-form-input",4),yl.mxI("invalidSecretChange",function(e){return yl.DH7(t.invalidSecret,e)||(t.invalidSecret=e),e}),yl.bIt("activeClientVerificationOptionChange",function(e){return t.handleActiveClientVerificationOptionChange(e)})("biometricsVerificationResultChange",function(e){return t.handleBiometricsVerificationResultChange(e)}),yl.k0s(),yl.bVm(),yl.qex(10,5),yl.DNE(11,ZC,3,2,"ng-container",3),yl.j41(12,"button",6),yl.bIt("click",function(){return t.cancel()}),yl.EFF(13),yl.nI1(14,"i18n"),yl.k0s(),yl.bVm(),yl.k0s()()),2&e&&(yl.Y8G("formGroup",t.verificationForm)("bitSubmit",t.submit),yl.R7$(3),yl.SpI(" ",t.dialogOptions.title?yl.bMT(4,9,t.dialogOptions.title):yl.bMT(5,11,"verificationRequired")),yl.R7$(4),yl.Y8G("ngIf","client"!==t.dialogOptions.verificationType||"client"===t.dialogOptions.verificationType&&t.activeClientVerificationOption!==t.ActiveClientVerificationOption.None),yl.R7$(),yl.Y8G("ngIf","client"===t.dialogOptions.verificationType&&t.activeClientVerificationOption===t.ActiveClientVerificationOption.None),yl.R7$(),yl.R50("invalidSecret",t.invalidSecret),yl.Y8G("verificationType","client"===t.dialogOptions.verificationType?"client":"server"),yl.R7$(2),yl.Y8G("ngIf","client"!==t.dialogOptions.verificationType||"client"===t.dialogOptions.verificationType&&t.activeClientVerificationOption!==t.ActiveClientVerificationOption.Biometrics),yl.R7$(2),yl.SpI(" ",yl.bMT(14,13,"cancel")," "))},dependencies:[pl.MD,pl.bT,fl.X1,fl.qT,fl.BC,fl.cb,fl.j4,fl.JD,qf,Xu,Ku,dh,uh,rc,xd,Td,LC,td,ed,Xf],encapsulation:2});class eT{}class tT{}class iT{}var nT,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())})};function sT(e,t){1&e&&(yl.j41(0,"div"),yl.nrm(1,"i",2),yl.nI1(2,"i18n"),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s()),2&e&&(yl.R7$(),yl.Y8G("title",yl.mNQ(yl.bMT(2,3,"loading"))),yl.R7$(2),yl.SpI(" ",yl.bMT(4,5,"loading")," "))}function oT(e,t){1&e&&(yl.j41(0,"div")(1,"bit-form-field")(2,"bit-label"),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s(),yl.nrm(5,"input",3),yl.k0s(),yl.j41(6,"div",4)(7,"button",5),yl.EFF(8),yl.nI1(9,"i18n"),yl.k0s()()()),2&e&&(yl.R7$(3),yl.JRh(yl.bMT(4,3,"ssoIdentifier")),yl.R7$(4),yl.Y8G("block",!0),yl.R7$(),yl.SpI(" ",yl.bMT(9,5,"continue")," "))}class aT{get identifierFormControl(){return this.formGroup.controls.identifier}constructor(e,t,i,n,r,s,o,a,l,c,u,d,h,p,f,v,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=f,this.accountService=v,this.toastService=m,this.ssoComponentService=g,this.loginSuccessHandlerService=y,this.keyConnectorService=b,this.formGroup=new fl.gE({identifier:new fl.MJ(null,[fl.k0.required])}),this.loggingIn=!1,this.submit=()=>rT(this,void 0,void 0,function*(){var e,t,i;if(this.formGroup.invalid)return;const n=null!=(yield(0,ho._)(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,wl.pQ)()).subscribe(e=>{this.redirectUri=e.getWebVaultUrl()+"/sso-connector.html"});const w=this.platformUtilsService.getClientType();this.isValidSsoClientType(w)&&(this.clientId=w)}ngOnInit(){return rT(this,void 0,void 0,function*(){var e;const t=yield(0,ho._)(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[Ca.Web,Ca.Browser,Ca.Desktop,Ca.Cli].includes(e)}hasParametersFromOtherClientRedirect(e){return null!=e.clientId&&null!=e.redirectUri&&null!=e.state&&null!=e.codeChallenge}handleTokenRequestForAuthenticatedUser(e){return rT(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 Mw){const t=e;if(t.statusCode===xa.NotFound)return;this.validationService.showError(t)}}submitSso(e,t){return rT(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 rT(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=kd.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,ho._)(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 rT(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 Cw(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,ho._)(this.keyConnectorService.requiresDomainConfirmation$(a.userId))))return void(yield this.router.navigate(["confirm-key-connector-domain"]));const l=yield(0,ho._)(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 rT(this,void 0,void 0,function*(){return void 0!==e})}handleTwoFactorRequired(e){return rT(this,void 0,void 0,function*(){yield this.router.navigate(["2fa"],{queryParams:{identifier:e,sso:"true"}})})}handleTrustedDeviceEncryptionEnabled(e){return rT(this,void 0,void 0,function*(){var t,i,n,r;const s=null===(t=yield(0,ho._)(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(Gw.TdeOffboarding,s):!e.hasMasterPassword&&(null===(n=e.trustedDeviceOption)||void 0===n?void 0:n.hasManageResetPasswordPermission)&&(yield this.masterPasswordService.setForceSetPasswordReason(Gw.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 rT(this,void 0,void 0,function*(){yield this.router.navigate(["set-initial-password"],{queryParams:{identifier:e}})})}handleSuccessfulLogin(){return rT(this,void 0,void 0,function*(){yield this.router.navigate(["lock"])})}handleLoginError(e){return rT(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 rT(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)})}}aT.ɵfac=function(e){return new(e||aT)(yl.rXU(dk),yl.rXU(pw),yl.rXU(ud.Ix),yl.rXU(Pl),yl.rXU(ud.nX),yl.rXU(eT),yl.rXU(Cd),yl.rXU(Eb),yl.rXU(Mk),yl.rXU(cI),yl.rXU(JS),yl.rXU(rv),yl.rXU(za),yl.rXU(fw),yl.rXU(Db),yl.rXU(Ok),yl.rXU(xb),yl.rXU(tT),yl.rXU(gw),yl.rXU(iT))},aT.ɵcmp=yl.VBU({type:aT,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&&(yl.j41(0,"form",0),yl.DNE(1,sT,5,7,"div",1)(2,oT,10,7,"div",1),yl.k0s()),2&e&&(yl.Y8G("formGroup",t.formGroup)("bitSubmit",t.submit),yl.R7$(),yl.Y8G("ngIf",t.loggingIn),yl.R7$(),yl.Y8G("ngIf",!t.loggingIn))},dependencies:[rc,xd,Td,Xu,Ku,id,pl.MD,pl.bT,Eu,Sc,ou,Du,_l,Oh,qf,hk,fl.X1,fl.qT,fl.me,fl.BC,fl.cb,fl.j4,fl.JD,sw.iI,Xf],encapsulation:2});class lT{}!function(e){e[e.DIRECT_LAUNCH=0]="DIRECT_LAUNCH",e[e.SINGLE_ACTION_POPOUT=1]="SINGLE_ACTION_POPOUT"}(nT||(nT={}));class cT{}class uT{shouldCheckForWebAuthnQueryParamResponse(){return!1}determineDuoLaunchAction(){return nT.DIRECT_LAUNCH}}var dT=i(88565);const hT=new sc("WINDOW"),pT=new sc("DOCUMENT"),fT=new sc("OBSERVABLE_MEMORY_STORAGE"),vT=new sc("OBSERVABLE_DISK_STORAGE"),mT=(new sc("OBSERVABLE_DISK_LOCAL_STORAGE"),new sc("MEMORY_STORAGE")),gT=new sc("SECURE_STORAGE"),yT=new sc("LOGOUT_CALLBACK"),bT=new sc("SUPPORTS_SECURE_STORAGE"),wT=new sc("LOCALES_DIRECTORY"),ST=new sc("SYSTEM_LANGUAGE"),kT=new sc("LOG_MAC_FAILURES"),IT=new sc("SYSTEM_THEME_OBSERVABLE"),CT=new sc("DEFAULT_VAULT_TIMEOUT"),TT=new sc("INTRAPROCESS_MESSAGING_SUBJECT"),PT=new sc("CLIENT_TYPE"),FT=new sc("REFRESH_ACCESS_TOKEN_ERROR_CALLBACK"),RT=new sc("ENV_ADDITIONAL_REGIONS"),xT=new sc("HTTP_OPERATIONS"),AT=lw` `,DT=lw` `,ET=lw` `,$T=lw` `,OT=lw` `;class UT{}const MT={[jw.Authenticator]:{type:jw.Authenticator,name:null,description:null,priority:1,sort:2,premium:!1},[jw.Yubikey]:{type:jw.Yubikey,name:null,description:null,priority:3,sort:4,premium:!0},[jw.Duo]:{type:jw.Duo,name:"Duo",description:null,priority:2,sort:5,premium:!0},[jw.OrganizationDuo]:{type:jw.OrganizationDuo,name:"Duo (Organization)",description:null,priority:10,sort:6,premium:!1},[jw.Email]:{type:jw.Email,name:null,description:null,priority:0,sort:1,premium:!1},[jw.WebAuthn]:{type:jw.WebAuthn,name:null,description:null,priority:4,sort:3,premium:!1}},NT=m.record(q,"providers",{deserializer:e=>e}),VT=new m(q,"selected",{deserializer:e=>e});class BT{}class jT extends Uw{constructor(e){super(e),this.enabled=this.getResponseProperty("Enabled"),this.key=this.getResponseProperty("Key"),this.userVerificationToken=this.getResponseProperty("UserVerificationToken")}}class GT extends Uw{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 LT extends Uw{constructor(e){super(e),this.enabled=this.getResponseProperty("Enabled"),this.email=this.getResponseProperty("Email")}}class zT extends Uw{constructor(e){super(e),this.enabled=this.getResponseProperty("Enabled"),this.type=this.getResponseProperty("Type")}}class _T extends Uw{constructor(e){super(e),this.code=this.getResponseProperty("Code")}}class KT extends Uw{constructor(e){super(e),this.enabled=this.getResponseProperty("Enabled");const t=this.getResponseProperty("Keys");this.keys=null==t?null:t.map(e=>new XT(e))}}class XT extends Uw{constructor(e){super(e),this.name=this.getResponseProperty("Name"),this.id=this.getResponseProperty("Id"),this.migrated=this.getResponseProperty("Migrated")}}class qT extends Uw{constructor(e){super(e),this.attestation=this.getResponseProperty("attestation"),this.authenticatorSelection=this.getResponseProperty("authenticatorSelection"),this.challenge=kd.fromUrlB64ToArray(this.getResponseProperty("challenge")),this.excludeCredentials=this.getResponseProperty("excludeCredentials").map(e=>(e.id=kd.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=kd.fromUrlB64ToArray(t.id),this.user=t}}class YT extends Uw{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 WT=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 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())})};class JT{constructor(){this.tokenFormControl=void 0,this.tokenChange=new yl.bkB}onTokenChange(e){const t=e.target.value||"";this.tokenChange.emit({token:t})}}JT.ɵfac=function(e){return new(e||JT)},JT.ɵcmp=yl.VBU({type:JT,selectors:[["app-two-factor-auth-authenticator"]],inputs:{tokenFormControl:"tokenFormControl"},outputs:{tokenChange:"tokenChange"},features:[yl.Jv_([])],decls:6,vars:4,consts:[["bitInput","","type","text","appAutofocus","","appInputVerbatim","",3,"keyup","formControl"]],template:function(e,t){1&e&&(yl.qex(0),yl.j41(1,"bit-form-field")(2,"bit-label"),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s(),yl.j41(5,"input",0),yl.bIt("keyup",function(e){return t.onTokenChange(e)}),yl.k0s()(),yl.bVm()),2&e&&(yl.R7$(3),yl.JRh(yl.bMT(4,2,"verificationCode")),yl.R7$(2),yl.Y8G("formControl",t.tokenFormControl))},dependencies:[pl.MD,qf,hk,II,dh,Xu,Oh,Xl,fl.X1,fl.me,fl.BC,fl.l_,Eu,Sc,ou,Du,rc,fl.YN,Xf],encapsulation:2});class ZT{}var QT=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 eP{constructor(e,t,i,n,r){this.i18nService=e,this.platformUtilsService=t,this.toastService=i,this.twoFactorAuthDuoComponentService=n,this.destroyRef=r,this.tokenEmitter=new yl.bkB,this.duoFramelessUrl=void 0}ngOnInit(){return QT(this,void 0,void 0,function*(){this.twoFactorAuthDuoComponentService.listenForDuo2faResult$().pipe((0,wl.pQ)(this.destroyRef)).subscribe(e=>{this.tokenEmitter.emit(e.token)}),this.duoFramelessUrl=this.providerData.AuthUrl})}launchDuoFrameless(e){return QT(this,void 0,void 0,function*(){var t,i;switch(e){case nT.DIRECT_LAUNCH:yield this.launchDuoFramelessDirectly();break;case nT.SINGLE_ACTION_POPOUT:yield null===(i=(t=this.twoFactorAuthDuoComponentService).openTwoFactorAuthDuoPopout)||void 0===i?void 0:i.call(t)}})}launchDuoFramelessDirectly(){return QT(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")})})}}eP.ɵfac=function(e){return new(e||eP)(yl.rXU(Pl),yl.rXU(Eb),yl.rXU(xb),yl.rXU(ZT),yl.rXU(a.abz))},eP.ɵcmp=yl.VBU({type:eP,selectors:[["app-two-factor-auth-duo"]],inputs:{providerData:"providerData"},outputs:{tokenEmitter:"tokenEmitter"},features:[yl.Jv_([])],decls:0,vars:0,template:function(e,t){},dependencies:[pl.MD,qf,dh,Xu,Oh,Xl,fl.X1,Eu,rc,fl.YN],encapsulation:2});class tP{authenticateWith(e){return this.masterPasswordHash=e.masterPasswordAuthenticationHash,this}}class iP extends tP{}class nP{constructor(){this.emailSent=!1}static fromJSON(e){return null==e?null:Object.assign(new nP,e)}}class rP{constructor(){this.viewCacheService=(0,a.WQX)(sI),this.emailCache=this.viewCacheService.signal({key:"two-factor-auth-email-component-cache",initialValue:null,deserializer:nP.fromJSON})}cacheData(e){this.emailCache.set({emailSent:e.emailSent})}clearCachedData(){this.emailCache.set(null)}getCachedData(){return this.emailCache()}}rP.ɵfac=function(e){return new(e||rP)},rP.ɵprov=a.jDH({token:rP,factory:rP.ɵfac});class sP{onClick(e){e.preventDefault()}}sP.ɵfac=function(e){return new(e||sP)},sP.ɵdir=yl.FsC({type:sP,selectors:[["","appStopClick",""]],hostBindings:function(e,t){1&e&&yl.bIt("click",function(e){return t.onClick(e)})},standalone:!1});var oP=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 aP{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 yl.bkB,this.twoFactorEmail=void 0,this.emailSent=!1}ngOnInit(){return oP(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(jw.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 oP(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 iP;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")})})}}aP.ɵfac=function(e){return new(e||aP)(yl.rXU(Pl),yl.rXU(BT),yl.rXU(pw),yl.rXU(Eb),yl.rXU(za),yl.rXU(ok),yl.rXU(xb),yl.rXU(rP))},aP.ɵcmp=yl.VBU({type:aP,selectors:[["app-two-factor-auth-email"]],inputs:{tokenFormControl:"tokenFormControl"},outputs:{tokenChange:"tokenChange"},features:[yl.Jv_([{provide:rP,useClass:rP}])],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&&(yl.j41(0,"bit-form-field",0)(1,"bit-label"),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.j41(4,"input",1),yl.bIt("keyup",function(e){return t.onTokenChange(e)}),yl.k0s()(),yl.j41(5,"div",2)(6,"a",3),yl.bIt("click",function(){return t.sendEmail(!0)}),yl.EFF(7),yl.nI1(8,"i18n"),yl.k0s()()),2&e&&(yl.R7$(2),yl.JRh(yl.bMT(3,3,"verificationCode")),yl.R7$(2),yl.Y8G("formControl",t.tokenFormControl),yl.R7$(3),yl.SpI(" ",yl.bMT(8,5,"resendCode")," "))},dependencies:[pl.MD,qf,hk,II,sP,dh,Xu,Oh,_b,Xl,Wl,fl.X1,fl.me,fl.BC,fl.l_,Eu,Sc,ou,Du,rc,fl.YN,Xf],encapsulation:2});class lP{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 cP{}var 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())})};const dP=e=>({"tw-hidden":e});function hP(e,t){1&e&&(yl.j41(0,"div",5),yl.nrm(1,"i",6),yl.k0s())}function pP(e,t){if(1&e&&(yl.j41(0,"div",2),yl.DNE(1,hP,2,0,"div",3),yl.nrm(2,"iframe",4),yl.k0s()),2&e){const e=yl.XpG();yl.R7$(),yl.Y8G("ngIf",!e.webAuthnReady),yl.R7$(),yl.Y8G("ngClass",yl.eq3(2,dP,!e.webAuthnReady))}}function fP(e,t){if(1&e){const e=yl.RV6();yl.qex(0),yl.j41(1,"button",7),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.authWebAuthn())}),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.bVm()}2&e&&(yl.R7$(),yl.Y8G("block",!0),yl.R7$(),yl.SpI(" ",yl.bMT(3,2,"openInNewTab")," "))}class vP{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 yl.bkB,this.webAuthnInNewTabEmitter=new yl.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 uP(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 uP(this,void 0,void 0,function*(){if(null!=this.win&&this.webAuthnSupported){const e=(yield(0,ho._)(this.environmentService.environment$)).getWebVaultUrl();this.webAuthnIframe=new lP(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(()=>uP(this,void 0,void 0,function*(){yield this.authWebAuthn()}),500)}})}ngOnDestroy(){this.cleanupWebAuthnIframe()}authWebAuthn(){return uP(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(jw.WebAuthn);this.webAuthnSupported&&null!=this.webAuthnIframe&&this.webAuthnIframe.init(t)})}cleanupWebAuthnIframe(){null!=this.webAuthnIframe&&(this.webAuthnIframe.stop(),this.webAuthnIframe.cleanup())}}vP.ɵfac=function(e){return new(e||vP)(yl.rXU(Pl),yl.rXU(Eb),yl.rXU(hT),yl.rXU(JS),yl.rXU(BT),yl.rXU(ud.nX),yl.rXU(xb),yl.rXU(cP),yl.rXU(za))},vP.ɵcmp=yl.VBU({type:vP,selectors:[["app-two-factor-auth-webauthn"]],outputs:{webAuthnResultEmitter:"webAuthnResultEmitter",webAuthnInNewTabEmitter:"webAuthnInNewTabEmitter"},features:[yl.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&&yl.DNE(0,pP,3,4,"div",0)(1,fP,4,4,"ng-container",1),2&e&&(yl.Y8G("ngIf",!t.webAuthnNewTab),yl.R7$(),yl.Y8G("ngIf",t.webAuthnNewTab))},dependencies:[pl.MD,pl.YU,pl.bT,qf,sP,dh,Xu,Ku,Oh,Xl,fl.X1,Eu,rc,fl.YN,Xf],encapsulation:2});class mP{constructor(){this.tokenFormControl=void 0}}mP.ɵfac=function(e){return new(e||mP)},mP.ɵcmp=yl.VBU({type:mP,selectors:[["app-two-factor-auth-yubikey"]],inputs:{tokenFormControl:"tokenFormControl"},features:[yl.Jv_([])],decls:5,vars:4,consts:[[1,""],["type","password","bitInput","","appAutofocus","","appInputVerbatim","",3,"formControl"]],template:function(e,t){1&e&&(yl.j41(0,"bit-form-field")(1,"bit-label",0),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.nrm(4,"input",1),yl.k0s()),2&e&&(yl.R7$(2),yl.JRh(yl.bMT(3,2,"verificationCode")),yl.R7$(2),yl.Y8G("formControl",t.tokenFormControl))},dependencies:[pl.MD,qf,hk,II,dh,Xu,Oh,Xl,fl.X1,fl.me,fl.BC,fl.l_,Eu,Sc,ou,Du,rc,fl.YN,Xf],encapsulation:2});class gP{constructor(){this.token=void 0,this.remember=void 0,this.selectedProviderType=void 0}static fromJSON(e){return null==e?null:Object.assign(new gP,e)}}class yP{constructor(){this.viewCacheService=(0,a.WQX)(sI),this.twoFactorAuthComponentCache=this.viewCacheService.signal({key:"two-factor-auth-component-cache",initialValue:null,deserializer:gP.fromJSON})}cacheData(e){this.twoFactorAuthComponentCache.set({token:e.token,remember:e.remember,selectedProviderType:e.selectedProviderType})}clearCachedData(){this.twoFactorAuthComponentCache.set(null)}getCachedData(){return this.twoFactorAuthComponentCache()}}yP.ɵfac=function(e){return new(e||yP)},yP.ɵprov=a.jDH({token:yP,factory:yP.ɵfac});const bP=lw` `;class wP{}wP.ɵfac=function(e){return new(e||wP)},wP.ɵmod=yl.$C({type:wP}),wP.ɵinj=a.G2t({});class SP{}SP.ɵfac=function(e){return new(e||SP)},SP.ɵcmp=yl.VBU({type:SP,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&&(yl.NAR(),yl.SdG(0))},encapsulation:2});const kP=["*",[["","slot","end"]]];class IP{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()}}IP.ɵfac=function(e){return new(e||IP)},IP.ɵcmp=yl.VBU({type:IP,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&&yl.bIt("focusin",function(e){return t.onFocusIn(e.target)})("focusout",function(){return t.onFocusOut()}),2&e&&yl.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&&(yl.NAR(kP),yl.j41(0,"bit-item-action",1),yl.SdG(1),yl.k0s(),yl.j41(2,"div",2,0),yl.SdG(4,1),yl.k0s()),2&e){const e=yl.sdS(3);yl.R7$(2),yl.Y8G("hidden",0===e.childElementCount)}},dependencies:[SP],encapsulation:2,changeDetection:0});const CP=["endSlot"],TP=[[["","slot","start"]],"*",[["","slot","default-trailing"]],[["","slot","secondary"]],[["","slot","end"]]],PP=(e,t)=>({"tw-truncate":e,"tw-text-wrap tw-overflow-auto tw-break-words":t});class FP{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)}}FP.ɵfac=function(e){return new(e||FP)},FP.ɵcmp=yl.VBU({type:FP,selectors:[["bit-item-content"],["","bit-item-content",""]],viewQuery:function(e,t){1&e&&yl.wEZ(t.endSlot,CP,5),2&e&&yl.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&&(yl.NAR(TP),yl.j41(0,"div",1),yl.SdG(1),yl.j41(2,"div",2)(3,"div",3)(4,"div",4),yl.SdG(5,1),yl.k0s(),yl.j41(6,"div",5),yl.SdG(7,2),yl.k0s()(),yl.j41(8,"div",6),yl.SdG(9,3),yl.k0s()()(),yl.j41(10,"div",7,0),yl.SdG(12,4),yl.k0s()),2&e&&(yl.R7$(4),yl.Y8G("ngClass",yl.l_i(3,PP,t.truncate(),!t.truncate())),yl.R7$(4),yl.Y8G("ngClass",yl.l_i(6,PP,t.truncate(),!t.truncate())),yl.R7$(2),yl.Y8G("hidden",!t.endSlotHasChildren()))},dependencies:[Xl,Wl,pl.YU],encapsulation:2,changeDetection:0});class RP{}RP.ɵfac=function(e){return new(e||RP)},RP.ɵcmp=yl.VBU({type:RP,selectors:[["bit-item-group"]],hostAttrs:[1,"tw-block"],ngContentSelectors:["*"],decls:1,vars:0,template:function(e,t){1&e&&(yl.NAR(),yl.SdG(0))},encapsulation:2,changeDetection:0});var xP=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 AP(e,t){if(1&e&&yl.nrm(0,"bit-icon",11),2&e){const e=yl.XpG(2);yl.Y8G("icon",e.Icons.TwoFactorAuthAuthenticatorIcon)}}function DP(e,t){if(1&e&&yl.nrm(0,"bit-icon",11),2&e){const e=yl.XpG(2);yl.Y8G("icon",e.Icons.TwoFactorAuthEmailIcon)}}function EP(e,t){if(1&e&&yl.nrm(0,"bit-icon",11),2&e){const e=yl.XpG(2);yl.Y8G("icon",e.Icons.TwoFactorAuthDuoIcon)}}function $P(e,t){if(1&e&&yl.nrm(0,"bit-icon",11),2&e){const e=yl.XpG(2);yl.Y8G("icon",e.Icons.TwoFactorAuthYubicoIcon)}}function OP(e,t){if(1&e&&yl.nrm(0,"bit-icon",11),2&e){const e=yl.XpG(2);yl.Y8G("icon",e.Icons.TwoFactorAuthDuoIcon)}}function UP(e,t){if(1&e&&yl.nrm(0,"bit-icon",11),2&e){const e=yl.XpG(2);yl.Y8G("icon",e.Icons.TwoFactorAuthWebAuthnIcon)}}function MP(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"bit-item",6),yl.bIt("click",function(){const t=a.eBV(e).$implicit,i=yl.XpG();return a.Njj(i.choose(t))}),yl.j41(1,"button",7)(2,"div",8),yl.DNE(3,AP,1,1,"bit-icon",9)(4,DP,1,1,"bit-icon",9)(5,EP,1,1,"bit-icon",9)(6,$P,1,1,"bit-icon",9)(7,OP,1,1,"bit-icon",9)(8,UP,1,1,"bit-icon",9),yl.k0s(),yl.EFF(9),yl.qex(10,10),yl.EFF(11),yl.bVm(),yl.k0s()()}if(2&e){const e=t.$implicit,i=yl.XpG();yl.R7$(),yl.Y8G("truncate",!1),yl.R7$(),yl.Y8G("ngSwitch",e.type),yl.R7$(),yl.Y8G("ngSwitchCase",i.TwoFactorProviderType.Authenticator),yl.R7$(),yl.Y8G("ngSwitchCase",i.TwoFactorProviderType.Email),yl.R7$(),yl.Y8G("ngSwitchCase",i.TwoFactorProviderType.Duo),yl.R7$(),yl.Y8G("ngSwitchCase",i.TwoFactorProviderType.Yubikey),yl.R7$(),yl.Y8G("ngSwitchCase",i.TwoFactorProviderType.OrganizationDuo),yl.R7$(),yl.Y8G("ngSwitchCase",i.TwoFactorProviderType.WebAuthn),yl.R7$(),yl.SpI(" ",e.name," "),yl.R7$(2),yl.SpI(" ",e.description," ")}}class NP{constructor(e,t){this.twoFactorService=e,this.dialogRef=t,this.providers=[],this.TwoFactorProviderType=jw,this.Icons={TwoFactorAuthAuthenticatorIcon:AT,TwoFactorAuthEmailIcon:DT,TwoFactorAuthDuoIcon:ET,TwoFactorAuthYubicoIcon:bP,TwoFactorAuthWebAuthnIcon:OT}}ngOnInit(){return xP(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 xP(this,void 0,void 0,function*(){this.dialogRef.close({type:e.type})})}static open(e){return e.open(NP)}cancel(){this.dialogRef.close()}}NP.ɵfac=function(e){return new(e||NP)(yl.rXU(BT),yl.rXU(Xd))},NP.ɵcmp=yl.VBU({type:NP,selectors:[["app-two-factor-options"]],features:[yl.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,"icon",4,"ngSwitchCase"],["slot","secondary"],[3,"icon"]],template:function(e,t){1&e&&(yl.j41(0,"bit-dialog",0)(1,"span",1),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.qex(4,2),yl.j41(5,"bit-item-group"),yl.DNE(6,MP,12,10,"bit-item",3),yl.k0s(),yl.bVm(),yl.qex(7,4),yl.j41(8,"button",5),yl.bIt("click",function(){return t.cancel()}),yl.EFF(9),yl.nI1(10,"i18n"),yl.k0s(),yl.bVm(),yl.k0s()),2&e&&(yl.Y8G("background","alt"),yl.R7$(2),yl.SpI(" ",yl.bMT(3,4,"selectTwoStepLoginMethod")," "),yl.R7$(4),yl.Y8G("ngForOf",t.providers),yl.R7$(3),yl.SpI(" ",yl.bMT(10,6,"cancel")," "))},dependencies:[pl.MD,pl.Sq,pl.ux,pl.e1,qf,dh,uh,Xu,Ku,Xl,wP,IP,FP,RP,$h,SC,Xf],encapsulation:2});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())})};const BP=["continueButton"],jP=["duoComponent"];function GP(e,t){1&e&&(yl.qex(0),yl.j41(1,"div",3),yl.nrm(2,"i",4),yl.k0s(),yl.bVm())}function LP(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"app-two-factor-auth-email",16),yl.bIt("tokenChange",function(t){a.eBV(e);const i=yl.XpG(2);return a.Njj(i.saveFormDataWithPartialData(t))}),yl.k0s()}if(2&e){const e=yl.XpG(2);yl.Y8G("tokenFormControl",e.tokenFormControl)}}function zP(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"app-two-factor-auth-authenticator",16),yl.bIt("tokenChange",function(t){a.eBV(e);const i=yl.XpG(2);return a.Njj(i.saveFormDataWithPartialData(t))}),yl.k0s()}if(2&e){const e=yl.XpG(2);yl.Y8G("tokenFormControl",e.tokenFormControl)}}function _P(e,t){if(1&e&&yl.nrm(0,"app-two-factor-auth-yubikey",17),2&e){const e=yl.XpG(2);yl.Y8G("tokenFormControl",e.tokenFormControl)}}function KP(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"app-two-factor-auth-duo",18,0),yl.bIt("tokenEmitter",function(t){a.eBV(e);const i=yl.XpG(2);return a.Njj(i.submit(t))}),yl.k0s()}if(2&e){const e=yl.XpG(2);yl.Y8G("providerData",e.selectedProviderData)}}function XP(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"bit-form-control")(1,"bit-label"),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.j41(4,"input",19),yl.bIt("change",function(){a.eBV(e);const t=yl.XpG(2);return a.Njj(t.onRememberChange())}),yl.k0s()()}2&e&&(yl.R7$(2),yl.JRh(yl.bMT(3,1,"dontAskAgainOnThisDeviceFor30Days")))}function qP(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"app-two-factor-auth-webauthn",20),yl.bIt("webAuthnResultEmitter",function(t){a.eBV(e);const i=yl.XpG(2);return a.Njj(i.submit(t.token,t.remember))})("webAuthnInNewTabEmitter",function(t){a.eBV(e);const i=yl.XpG(2);return a.Njj(i.webAuthInNewTab=t)}),yl.k0s()}}function YP(e,t){1&e&&(yl.qex(0),yl.j41(1,"p",21),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.j41(4,"p",21),yl.EFF(5),yl.nI1(6,"i18n"),yl.k0s(),yl.bVm()),2&e&&(yl.R7$(2),yl.JRh(yl.bMT(3,2,"noTwoStepProviders")),yl.R7$(3),yl.JRh(yl.bMT(6,4,"noTwoStepProviders2")))}function WP(e,t){1&e&&(yl.j41(0,"button",22,1)(2,"span"),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s()()),2&e&&(yl.R7$(3),yl.SpI(" ",yl.bMT(4,1,"continueLoggingIn")," "))}function HP(e,t){1&e&&(yl.j41(0,"span"),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()),2&e&&(yl.R7$(),yl.SpI(" ",yl.bMT(2,1,"launchDuo")))}function JP(e,t){1&e&&(yl.j41(0,"span"),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()),2&e&&(yl.R7$(),yl.SpI(" ",yl.bMT(2,1,"popoutExtension")))}function ZP(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",23),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG(2);return a.Njj(t.launchDuo())}),yl.DNE(1,HP,3,3,"span",2)(2,JP,3,3,"span",2),yl.k0s()}if(2&e){const e=yl.XpG(2);yl.R7$(),yl.Y8G("ngIf",e.duoLaunchAction===e.DuoLaunchAction.DIRECT_LAUNCH),yl.R7$(),yl.Y8G("ngIf",e.duoLaunchAction===e.DuoLaunchAction.SINGLE_ACTION_POPOUT)}}function QP(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",15),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG(2);return a.Njj(t.selectOtherTwoFactorMethod())}),yl.j41(1,"span"),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s()()}2&e&&(yl.R7$(2),yl.SpI(" ",yl.bMT(3,1,"selectAnotherMethod")," "))}function eF(e,t){if(1&e){const e=yl.RV6();yl.qex(0),yl.j41(1,"form",5),yl.bIt("keydown.enter",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.handleEnterKeyPress())}),yl.DNE(2,LP,1,1,"app-two-factor-auth-email",6)(3,zP,1,1,"app-two-factor-auth-authenticator",6)(4,_P,1,1,"app-two-factor-auth-yubikey",7)(5,KP,2,1,"app-two-factor-auth-duo",8)(6,XP,5,3,"bit-form-control",2)(7,qP,1,0,"app-two-factor-auth-webauthn",9)(8,YP,7,6,"ng-container",2),yl.j41(9,"div",10),yl.DNE(10,WP,5,3,"button",11)(11,ZP,3,2,"button",12),yl.j41(12,"p",13),yl.EFF(13),yl.nI1(14,"i18n"),yl.k0s(),yl.DNE(15,QP,4,3,"button",14),yl.j41(16,"button",15),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.use2faRecoveryCode())}),yl.j41(17,"span"),yl.EFF(18),yl.nI1(19,"i18n"),yl.k0s()()()(),yl.bVm()}if(2&e){const e=yl.XpG();yl.R7$(),yl.Y8G("bitSubmit",e.submit)("formGroup",e.form),yl.R7$(),yl.Y8G("ngIf",e.selectedProviderType===e.providerType.Email),yl.R7$(),yl.Y8G("ngIf",e.selectedProviderType===e.providerType.Authenticator),yl.R7$(),yl.Y8G("ngIf",e.selectedProviderType===e.providerType.Yubikey),yl.R7$(),yl.Y8G("ngIf",e.selectedProviderType===e.providerType.OrganizationDuo||e.selectedProviderType===e.providerType.Duo),yl.R7$(),yl.Y8G("ngIf",!e.hideRememberMe()),yl.R7$(),yl.Y8G("ngIf",e.selectedProviderType===e.providerType.WebAuthn),yl.R7$(),yl.Y8G("ngIf",null==e.selectedProviderType),yl.R7$(2),yl.Y8G("ngIf",e.showContinueButton()),yl.R7$(),yl.Y8G("ngIf",e.selectedProviderType===e.providerType.Duo||e.selectedProviderType===e.providerType.OrganizationDuo),yl.R7$(2),yl.JRh(yl.bMT(14,14,"or")),yl.R7$(2),yl.Y8G("ngIf",(null==e.twoFactorProviders?null:e.twoFactorProviders.size)>1),yl.R7$(3),yl.SpI(" ",yl.bMT(19,16,"useYourRecoveryCode")," ")}}class tF{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,f,v,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=f,this.twoFactorAuthComponentService=v,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=jw,this.selectedProviderType=jw.Authenticator,this.twoFactorProviders=null,this.form=this.formBuilder.group({token:["",{validators:[fl.k0.required],updateOn:"submit"}],remember:[!1]}),this.duoLaunchAction=void 0,this.DuoLaunchAction=nT,this.webAuthInNewTab=!1,this.authenticationSessionTimeoutRoute="authentication-timeout",this.submit=(e,t)=>VP(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 ww(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 VP(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 VP(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 VP(this,void 0,void 0,function*(){const e=!!this.rememberFormControl.value;yield this.saveFormDataWithPartialData({remember:e})})}initializeSelected2faProviderType(){return VP(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 jw.WebAuthn}return yield this.twoFactorService.getDefaultProvider(e)})}set2faProvidersAndData(){return VP(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,wl.pQ)(this.destroyRef)).subscribe(e=>VP(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 VP(this,void 0,void 0,function*(){const e=NP.open(this.dialogService),t=yield(0,dT.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 VP(this,void 0,void 0,function*(){null!=this.duoComponent&&void 0!==this.duoLaunchAction&&(yield this.duoComponent.launchDuoFrameless(this.duoLaunchAction))})}handleMigrateEncryptionKey(e){return VP(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 VP(this,void 0,void 0,function*(){switch(this.selectedProviderType){case jw.Authenticator:this.anonLayoutWrapperDataService.setAnonLayoutWrapperData({pageSubtitle:this.i18nService.t("enterTheCodeFromYourAuthenticatorApp"),pageIcon:AT});break;case jw.Email:this.anonLayoutWrapperDataService.setAnonLayoutWrapperData({pageSubtitle:this.i18nService.t("enterTheCodeSentToYourEmail"),pageIcon:DT});break;case jw.Duo:case jw.OrganizationDuo:this.anonLayoutWrapperDataService.setAnonLayoutWrapperData({pageSubtitle:this.i18nService.t("duoTwoFactorRequiredPageSubtitle"),pageIcon:ET});break;case jw.Yubikey:this.anonLayoutWrapperDataService.setAnonLayoutWrapperData({pageSubtitle:this.i18nService.t("pressYourYubiKeyToAuthenticate"),pageIcon:$T});break;case jw.WebAuthn:this.anonLayoutWrapperDataService.setAnonLayoutWrapperData({pageSubtitle:this.i18nService.t("followTheStepsBelowToFinishLoggingInWithSecurityKey"),pageIcon:OT});break;default:this.logService.error("setAnonLayoutDataByTwoFactorProviderType: Unhandled 2FA provider type",this.selectedProviderType)}})}handleAuthResult(e){return VP(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,ho._)(this.accountService.activeAccount$))||void 0===t?void 0:t.id;yield this.ssoLoginService.setActiveUserOrganizationSsoIdentifier(this.orgSsoIdentifier,e)}if(null!=(yield(0,ho._)(this.keyConnectorService.requiresDomainConfirmation$(e.userId))))return void(yield this.router.navigate(["confirm-key-connector-domain"]));const o=yield(0,ho._)(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 VP(this,void 0,void 0,function*(){if((yield(0,ho._)(this.authService.activeAccountStatus$))===cd.Locked)return"lock";const t=yield(0,ho._)(this.masterPasswordService.forceSetPasswordReason$(e));return t===Gw.WeakMasterPassword||t===Gw.AdminForcePasswordReset?"change-password":"vault"})}isTrustedDeviceEncEnabled(e){return VP(this,void 0,void 0,function*(){return"true"===this.activatedRoute.snapshot.queryParamMap.get("sso")&&void 0!==e})}handleTrustedDeviceEncryptionEnabled(e,t){return VP(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(Gw.TdeOffboarding,e):!t.hasMasterPassword&&(null===(n=t.trustedDeviceOption)||void 0===n?void 0:n.hasManageResetPasswordPermission)&&(yield this.masterPasswordService.setForceSetPasswordReason(Gw.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 VP(this,void 0,void 0,function*(){yield this.router.navigate(["set-initial-password"],{queryParams:{identifier:e}})})}showContinueButton(){return null!=this.selectedProviderType&&this.selectedProviderType!==jw.WebAuthn&&this.selectedProviderType!==jw.Duo&&this.selectedProviderType!==jw.OrganizationDuo}hideRememberMe(){return(this.selectedProviderType===jw.Duo||this.selectedProviderType===jw.OrganizationDuo)&&this.duoLaunchAction===nT.SINGLE_ACTION_POPOUT||this.selectedProviderType===jw.WebAuthn&&this.webAuthInNewTab}use2faRecoveryCode(){return VP(this,void 0,void 0,function*(){const e=(yield(0,ho._)(this.environmentService.environment$)).getWebVaultUrl();this.platformUtilsService.launchUri(e+"/#/recover-2fa")})}handleEnterKeyPress(){return VP(this,void 0,void 0,function*(){var e,t;switch(this.selectedProviderType){case jw.Authenticator:case jw.Email:null===(t=null===(e=this.continueButton)||void 0===e?void 0:e.nativeElement)||void 0===t||t.click();break;case jw.Duo:case jw.OrganizationDuo:case jw.WebAuthn:case jw.Yubikey:break;default:this.logService.error("handleEnterKeyPress: Unhandled 2FA provider type",this.selectedProviderType)}})}ngOnDestroy(){return VP(this,void 0,void 0,function*(){var e,t;null===(t=(e=this.twoFactorAuthComponentService).removePopupWidthExtension)||void 0===t||t.call(e)})}}tF.ɵfac=function(e){return new(e||tF)(yl.rXU(pw),yl.rXU(ud.Ix),yl.rXU(Pl),yl.rXU(Eb),yl.rXU(Jd),yl.rXU(ud.nX),yl.rXU(za),yl.rXU(BT),yl.rXU(fw),yl.rXU(dk),yl.rXU(Db),yl.rXU(Ok),yl.rXU(fl.ok),yl.rXU(hT),yl.rXU(xb),yl.rXU(cT),yl.rXU(a.abz),yl.rXU(sk),yl.rXU(JS),yl.rXU(gw),yl.rXU(yP),yl.rXU(dd),yl.rXU(iT))},tF.ɵcmp=yl.VBU({type:tF,selectors:[["app-two-factor-auth"]],viewQuery:function(e,t){if(1&e&&(yl.GBs(BP,5,yl.aKT),yl.GBs(jP,5)),2&e){let e;yl.mGM(e=yl.lsd())&&(t.continueButton=e.first),yl.mGM(e=yl.lsd())&&(t.duoComponent=e.first)}},features:[yl.Jv_([{provide:yP}])],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&&yl.DNE(0,GP,3,0,"ng-container",2)(1,eF,20,18,"ng-container",2),2&e&&(yl.Y8G("ngIf",t.loading),yl.R7$(),yl.Y8G("ngIf",!t.loading))},dependencies:[pl.MD,pl.bT,qf,fl.X1,fl.qT,fl.Zm,fl.BC,fl.cb,fl.j4,fl.JD,Eu,hc,Sc,rc,xd,Td,id,Ub,Xu,Ku,JT,aP,eP,mP,vP,Xf],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())})};class nF{shouldOpenWebAuthnInNewTab(){return!1}}class rF{}var sF=i(96331),oF=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 aF(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"div",6),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s(),yl.j41(3,"button",7),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.goBack())}),yl.EFF(4),yl.nI1(5,"i18n"),yl.k0s()}2&e&&(yl.R7$(),yl.JRh(yl.bMT(2,2,"or")),yl.R7$(3),yl.SpI(" ",yl.bMT(5,4,"back")," "))}class lF{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:[fl.k0.required],updateOn:"change"}]}),this.disableRequestOTP=!1,this.destroy$=new go.B,this.authenticationSessionTimeoutRoute="/authentication-timeout",this.showBackButton=!0,this.submit=()=>oF(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,ho._)(this.accountService.activeAccount$.pipe(Gp)),n=yield(0,ho._)(this.masterPasswordService.forceSetPasswordReason$(t));n===Gw.WeakMasterPassword||n===Gw.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 oF(this,void 0,void 0,function*(){this.showBackButton=this.newDeviceVerificationComponentService.showBackButton(),this.loginStrategyService.authenticationSessionTimeout$.pipe((0,Jv.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 oF(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()}}lF.ɵfac=function(e){return new(e||lF)(yl.rXU(ud.Ix),yl.rXU(fl.ok),yl.rXU(Mk),yl.rXU(pw),yl.rXU(za),yl.rXU(Pl),yl.rXU(gw),yl.rXU(Ok),yl.rXU(Ab),yl.rXU(rF),yl.rXU(sF.aZ))},lF.ɵcmp=yl.VBU({type:lF,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&&(yl.j41(0,"form",0)(1,"bit-form-field",1)(2,"bit-label"),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s(),yl.nrm(5,"input",2),yl.k0s(),yl.j41(6,"button",3),yl.bIt("click",function(){return t.resendOTP()}),yl.EFF(7),yl.nI1(8,"i18n"),yl.k0s(),yl.j41(9,"div",4)(10,"button",5),yl.EFF(11),yl.nI1(12,"i18n"),yl.k0s(),yl.nVh(13,aF,6,6),yl.k0s()()),2&e&&(yl.Y8G("formGroup",t.formGroup)("bitSubmit",t.submit),yl.R7$(3),yl.JRh(yl.bMT(4,9,"verificationCode")),yl.R7$(3),yl.Y8G("disabled",t.disableRequestOTP),yl.R7$(),yl.SpI(" ",yl.bMT(8,11,"resendCode")," "),yl.R7$(3),yl.Y8G("block",!0)("disabled",t.formGroup.invalid),yl.R7$(),yl.SpI(" ",yl.bMT(12,13,"continueLoggingIn")," "),yl.R7$(2),yl.vxM(t.showBackButton?13:-1))},dependencies:[pl.MD,fl.X1,fl.qT,fl.me,fl.BC,fl.cb,fl.j4,fl.JD,rc,xd,Td,qf,II,Xu,Ku,Eu,Sc,ou,Du,_l,Oh,Kb,Xf],encapsulation:2});class cF{showBackButton(){return!0}}class uF{}function dF(e){return new ea.c(t=>{const i=(...e)=>{chrome.runtime.lastError?t.error(chrome.runtime.lastError):t.next(e)};return tl.addListener(e,i),()=>tl.removeListener(e,i)})}uF.ɵfac=function(e){return new(e||uF)},uF.ɵmod=yl.$C({type:uF}),uF.ɵinj=a.G2t({});class hF{}var pF=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 fF{constructor(e,t,i,n,r,s){this.accountService=e,this.avatarService=t,this.messagingService=i,this.environmentService=n,this.logService=r,this.ACCOUNT_LIMIT=5,this.SPECIAL_ADD_ACCOUNT_ID="addAccount",this.availableAccounts$=(0,$o.z)([e.accounts$,s.authStatuses$,this.accountService.activeAccount$]).pipe((0,co.n)(e=>pF(this,[e],void 0,function*([e,t,i]){const n=Object.keys(e).filter(e=>t[e]!==cd.LoggedOut),r=n.length>=this.ACCOUNT_LIMIT,s=yield Promise.all(n.map(n=>pF(this,void 0,void 0,function*(){var r;const s=yield(0,ho._)(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,ho._)(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$=dF(chrome.runtime.onMessage).pipe((0,To.p)(([e])=>"switchAccountFinish"===e.command),(0,l.T)(([e])=>({userId:e.userId,authenticationStatus:e.status})))}get specialAccountAddId(){return this.SPECIAL_ADD_ACCOUNT_ID}selectAccount(e){return pF(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,ho._)(this.switchAccountFinished$.pipe((0,To.p)(({userId:t})=>!e||t===e),(0,po.w)({first:6e4,with:()=>(0,fo.$)(()=>new Error(fF.incompleteAccountSwitchError))}))).catch(e=>{if(e instanceof Error&&e.message===fF.incompleteAccountSwitchError)return this.logService.warning("message 'switchAccount' never responded."),null;throw e})}}fF.incompleteAccountSwitchError="Account switch did not complete.",fF.ɵfac=function(e){return new(e||fF)(a.KVO(Ok),a.KVO(hF),a.KVO(ek),a.KVO(JS),a.KVO(za),a.KVO(dd))},fF.ɵprov=a.jDH({token:fF,factory:fF.ɵfac,providedIn:"root"});const vF={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 mF{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,bl.EW)(()=>{var e;return["tw-rounded-full"].concat(null!==(e=vF[this.size()])&&void 0!==e?e:[]).concat(this.border()?["tw-border","tw-border-solid","tw-border-secondary-600"]:[])}),this.backgroundColor=(0,bl.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 kd.isNullOrWhitespace(this.color())?kd.isNullOrWhitespace(i)?kd.stringToColor(n):kd.stringToColor(i.toString()):this.color()}),this.textColor=(0,bl.EW)(()=>kd.pickTextColorBasedOnBgColor(this.backgroundColor(),135,!0)),this.displayChars=(0,bl.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(kd.regexpEmojiPresentation);return r&&(n=r[0]),n})}getFirstLetters(e,t){const i=e.split(" ");if(i.length>1){let e="";for(let n=0;nIF(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 IF(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"])})}}PF.ɵfac=function(e){return new(e||PF)(yl.rXU(Ok),yl.rXU(hF),yl.rXU(ud.Ix),yl.rXU(sF.aZ),yl.rXU(ud.nX),yl.rXU(dd))},PF.ɵcmp=yl.VBU({type:PF,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&&(yl.j41(0,"div",1),yl.DNE(1,CF,5,7,"button",2),yl.nI1(2,"async"),yl.DNE(3,TF,5,5,"ng-template",null,0,yl.C5r),yl.k0s()),2&e){const e=yl.sdS(4);yl.R7$(),yl.Y8G("ngIf",yl.bMT(2,2,t.currentAccount$))("ngIfElse",e)}},dependencies:[pl.MD,pl.bT,qf,uF,mF,sw.iI,sw.Wk,pl.Jj,Xf],encapsulation:2});var FF=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 RF{constructor(){this.apiService=(0,a.WQX)(Mk),this.userId=null,this.profileCreatedDate=null}getProfileCreationDate(e){return FF(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 FF(this,void 0,void 0,function*(){const e=yield this.apiService.getProfile();return this.userId=e.id,this.profileCreatedDate=e.creationDate,e})}}function xF(e){return(0,l.T)(t=>t.find(t=>t.id===e))}RF.ɵfac=function(e){return new(e||RF)},RF.ɵprov=a.jDH({token:RF,factory:RF.ɵfac,providedIn:"root"});class AF{}class DF extends AF{}class EF{}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())})};class OF{constructor(){this.stateProvider=(0,a.WQX)(u)}getNudgeStatus$(e,t){return this.stateProvider.getUser(t,BR).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 $F(this,void 0,void 0,function*(){yield this.stateProvider.getUser(i,BR).update(i=>(null!=i||(i={}),i[e]=t,i))})}}OF.ɵfac=function(e){return new(e||OF)},OF.ɵprov=a.jDH({token:OF,factory:OF.ɵfac,providedIn:"root"});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())})};class MF extends OF{constructor(){super(...arguments),this.vaultProfileService=(0,a.WQX)(RF),this.logService=(0,a.WQX)(za),this.pinService=(0,a.WQX)(EF),this.biometricStateService=(0,a.WQX)(wp),this.policyService=(0,a.WQX)($b),this.organizationService=(0,a.WQX)(AF)}nudgeStatus$(e,t){const i=(0,md.H)(this.vaultProfileService.getProfileCreationDate(t)).pipe((0,vd.W)(()=>(this.logService.error("Failed to load profile date:"),(0,Oo.of)(new Date))));return(0,$o.z)([i,this.getNudgeStatus$(e,t),(0,Oo.of)(Date.now()-2592e6),(0,md.H)(this.pinService.isPinSet(t)),this.biometricStateService.biometricUnlockEnabled$,this.organizationService.organizations$(t),this.policyService.policiesByType$(_h.RemoveUnlockWithPin,t)]).pipe((0,co.n)(i=>UF(this,[i],void 0,function*([i,n,r,s,o,a,l]){const c=i.getTime()l.some(t=>t.type===_h.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})))}}MF.ɵfac=(()=>{let e;return function(t){return(e||(e=yl.xGo(MF)))(t||MF)}})(),MF.ɵprov=a.jDH({token:MF,factory:MF.ɵfac,providedIn:"root"});var NF=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 VF extends OF{constructor(){super(...arguments),this.cipherService=(0,a.WQX)(Fb),this.vaultProfileService=(0,a.WQX)(RF),this.logService=(0,a.WQX)(za)}nudgeStatus$(e,t){const i=(0,md.H)(this.vaultProfileService.getProfileCreationDate(t)).pipe((0,vd.W)(()=>(this.logService.error("Error getting profile creation date"),(0,Oo.of)(new Date))));return(0,$o.z)([this.cipherService.cipherViews$(t),this.getNudgeStatus$(e,t),i,(0,Oo.of)(Date.now()-2592e6)]).pipe((0,co.n)(i=>NF(this,[i],void 0,function*([i,n,r,s]){const o=r.getTime()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(VR.EmptyVaultNudge,i,t),i}return n.hasSpotlightDismissed?n:{hasBadgeDismissed:null==a||0===a.length,hasSpotlightDismissed:null==a||0===a.length}})))}}VF.ɵfac=(()=>{let e;return function(t){return(e||(e=yl.xGo(VF)))(t||VF)}})(),VF.ɵprov=a.jDH({token:VF,factory:VF.ɵfac,providedIn:"root"});k.record(x,"autoConfirm",{deserializer:e=>e,clearOn:[]});class BF{}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())})};const GF=0,LF=1;class zF extends _p{constructor(e){super(),this.readOnly=!1,this.hidePasswords=!1,this.manage=!1,this.type=GF,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 zF(Object.assign(Object.assign({},e),{name:new up(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 jF(this,void 0,void 0,function*(){const n=new zF({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 KF.fromCollection(this,t,e)}static isCollectionId(e){return"string"==typeof e&&null!=e}}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())})};class KF{constructor(e){this.readOnly=!1,this.hidePasswords=!1,this.manage=!1,this.assigned=!1,this.type=GF,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==LF}static vaultFilterHead(){return new KF({id:"",organizationId:"",name:""})}static fromCollection(e,t,i){return _F(this,void 0,void 0,function*(){const n=new KF(Object.assign(Object.assign({},e),{name:""}));return n.name=yield t.decryptString(e.name,i),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 _F(this,void 0,void 0,function*(){const n=new KF(Object.assign({},e));try{n.name=yield t.decryptString(new up(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 KF(Object.assign({},e)),e)}encrypt(e,t){return zF.fromCollectionView(this,t,e)}}class XF extends Uw{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 qF extends Uw{constructor(e){var t;super(e),this.type=GF,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:GF}}class YF extends qF{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 WF extends YF{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 XF(e)));const i=this.getResponseProperty("Users");null!=i&&(this.users=i.map(e=>new XF(e)))}}class HF{constructor(e){this.readOnly=!1,this.manage=!1,this.hidePasswords=!1,this.type=GF,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 HF(new YF({})),e)}}class JF{constructor(e){this.groups=[],this.users=[],this.externalId=e.externalId,e.groups&&(this.groups=e.groups),e.users&&(this.users=e.users)}}JF.isUpdate=e=>e instanceof ZF;class ZF extends JF{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 QF extends JF{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}}var eR=i(84679);class tR{constructor(e,t,i,n){this.children=[],this.parent=t,this.node=e,i&&(this.node.name=i),n&&(this.node.id=n)}}class iR{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 tR(n,r,a));const l=e.filter(e=>e.node.name===a);if(0===l.length){const o=a+s+i[t+1];iR.nestedTraverse(e,0,[o,...i.slice(t+2)],n,r,s)}else iR.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;iHF.fromJSON(e),clearOn:["logout"]}),rR=new k(ke,"decryptedCollections",{deserializer:e=>{var t;return null!==(t=null==e?void 0:e.map(e=>KF.fromJSON(e)))&&void 0!==t?t:null},clearOn:["logout","lock"]});var sR=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 oR{}class aR{constructor(e){this.ids=null==e?[]:e}}class lR extends Uw{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 cR extends Uw{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 lR(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 XF(e)));const i=this.getResponseProperty("Groups");null!=i&&(this.groups=i)}}class uR extends cR{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 dR extends cR{constructor(e){var t;super(e),this.managedByOrganization=null!==(t=this.getResponseProperty("ManagedByOrganization"))&&void 0!==t&&t,this.ssoExternalId=this.getResponseProperty("SsoExternalId")}}class hR extends Uw{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 pR extends Uw{constructor(e){super(e),this.id=this.getResponseProperty("Id"),this.error=this.getResponseProperty("Error")}}class fR extends Uw{constructor(e){super(e),this.id=this.getResponseProperty("Id"),this.userId=this.getResponseProperty("UserId"),this.key=this.getResponseProperty("Key")}}class vR extends Uw{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 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())})};class gR{constructor(e,t){this.keys=e,this.defaultUserCollectionName=t}}class yR{static newConstructor(e,t){const i=new yR;return i.newMasterPasswordHash=e.masterPasswordAuthenticationHash,i.key=t.masterKeyWrappedUserKey,i}}class bR extends tP{}class wR extends OF{constructor(){super(...arguments),this.cipherService=(0,a.WQX)(Fb),this.organizationService=(0,a.WQX)(AF),this.collectionService=(0,a.WQX)(BF)}nudgeStatus$(e,t){return(0,$o.z)([this.getNudgeStatus$(e,t),this.cipherService.cipherListViews$(t),this.organizationService.organizations$(t),this.collectionService.decryptedCollections$(t)]).pipe((0,co.n)(([e,t,i,n])=>{const r=!(null==t||0===t.length);if(null==i||0===i.length)return e.hasBadgeDismissed||e.hasSpotlightDismissed?(0,Oo.of)(e):(0,Oo.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,Oo.of)(e):a||o?(0,Oo.of)({hasSpotlightDismissed:r,hasBadgeDismissed:r}):(0,Oo.of)({hasSpotlightDismissed:!0,hasBadgeDismissed:!0})}))}}wR.ɵfac=(()=>{let e;return function(t){return(e||(e=yl.xGo(wR)))(t||wR)}})(),wR.ɵprov=a.jDH({token:wR,factory:wR.ɵfac,providedIn:"root"});class SR extends OF{constructor(){super(...arguments),this.cipherService=(0,a.WQX)(Fb),this.organizationService=(0,a.WQX)(AF),this.collectionService=(0,a.WQX)(BF)}nudgeStatus$(e,t){return(0,$o.z)([this.getNudgeStatus$(e,t),this.cipherService.cipherViews$(t),this.organizationService.organizations$(t),this.collectionService.decryptedCollections$(t)]).pipe((0,co.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,Oo.of)(e):(0,Oo.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,Oo.of)(e):d||u?(0,Oo.of)({hasSpotlightDismissed:o,hasBadgeDismissed:o}):(0,Oo.of)({hasSpotlightDismissed:!0,hasBadgeDismissed:!0})}))}}SR.ɵfac=(()=>{let e;return function(t){return(e||(e=yl.xGo(SR)))(t||SR)}})(),SR.ɵprov=a.jDH({token:SR,factory:SR.ɵfac,providedIn:"root"});const kR={None:0,Password:1};function IR(e){switch(e){case kR.None:case kR.Password:return e;default:return kR.None}}const CR=Object.freeze({Login:1,SecureNote:2,Card:3,Identity:4,SshKey:5}),TR=Object.freeze(Object.fromEntries(Object.entries(CR).map(([e,t])=>[t,e])));const PR=e=>Object.values(CR).includes(e),FR=Object.freeze({Text:0,Hidden:1,Boolean:2,Linked:3});function RR(e){switch(e){case FR.Text:case FR.Hidden:case FR.Boolean:case FR.Linked:return e;default:return FR.Text}}const xR={Username:100,Password:101},AR={CardholderName:300,ExpMonth:301,ExpYear:302,Code:303,Brand:304,Number:305},DR={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 ER(e){if(null==e)return;return[...Object.values(xR),...Object.values(AR),...Object.values(DR)].includes(e)?e:void 0}const $R=0;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 UR extends OF{constructor(){super(...arguments),this.cipherService=(0,a.WQX)(Fb)}nudgeStatus$(e,t){return(0,$o.z)([this.getNudgeStatus$(e,t),this.cipherService.cipherViews$(t).pipe((0,To.p)(e=>null!=e))]).pipe((0,co.n)(i=>OR(this,[i],void 0,function*([i,n]){if(i.hasSpotlightDismissed)return i;let r;switch(e){case VR.NewLoginItemStatus:r=CR.Login;break;case VR.NewCardItemStatus:r=CR.Card;break;case VR.NewIdentityItemStatus:r=CR.Identity;break;case VR.NewNoteItemStatus:r=CR.SecureNote;break;case VR.NewSshItemStatus:r=CR.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})))}}UR.ɵfac=(()=>{let e;return function(t){return(e||(e=yl.xGo(UR)))(t||UR)}})(),UR.ɵprov=a.jDH({token:UR,factory:UR.ɵfac,providedIn:"root"});class MR extends OF{constructor(){super(...arguments),this.vaultProfileService=(0,a.WQX)(RF),this.logService=(0,a.WQX)(za)}nudgeStatus$(e,t){const i=(0,md.H)(this.vaultProfileService.getProfileCreationDate(t)).pipe((0,vd.W)(()=>(this.logService.error("Error getting profile creation date"),(0,Oo.of)(new Date))));return(0,$o.z)([i,this.getNudgeStatus$(e,t),(0,Oo.of)(Date.now()-2592e6)]).pipe((0,l.T)(([e,t,i])=>{const n=e.getTime(){let e;return function(t){return(e||(e=yl.xGo(MR)))(t||MR)}})(),MR.ɵprov=a.jDH({token:MR,factory:MR.ɵfac,providedIn:"root"});var 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())})};const VR={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",PremiumUpgrade:"premium-upgrade"},BR=new k(Ue,"vaultNudgeDismissed",{deserializer:e=>e,clearOn:[]});class jR{constructor(){this.newItemNudgeService=(0,a.WQX)(UR),this.newAcctNudgeService=(0,a.WQX)(MR),this.customNudgeServices={[VR.HasVaultItems]:(0,a.WQX)(VF),[VR.EmptyVaultNudge]:(0,a.WQX)(wR),[VR.VaultSettingsImportNudge]:(0,a.WQX)(SR),[VR.AccountSecurity]:(0,a.WQX)(MF),[VR.AutofillNudge]:this.newAcctNudgeService,[VR.DownloadBitwarden]:this.newAcctNudgeService,[VR.GeneratorNudgeStatus]:this.newAcctNudgeService,[VR.NewLoginItemStatus]:this.newItemNudgeService,[VR.NewCardItemStatus]:this.newItemNudgeService,[VR.NewIdentityItemStatus]:this.newItemNudgeService,[VR.NewNoteItemStatus]:this.newItemNudgeService,[VR.NewSshItemStatus]:this.newItemNudgeService},this.defaultNudgeService=(0,a.WQX)(OF)}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 NR(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=[VR.EmptyVaultNudge,VR.DownloadBitwarden,VR.AutofillNudge].map(t=>this.getNudgeService(t).nudgeStatus$(t,e).pipe((0,l.T)(e=>!(null==e?void 0:e.hasBadgeDismissed)),(0,Pp.t)({refCount:!1,bufferSize:1})));return(0,$o.z)(t).pipe((0,l.T)(e=>e.some(e=>!0===e)))}}jR.ɵfac=function(e){return new(e||jR)},jR.ɵprov=a.jDH({token:jR,factory:jR.ɵfac,providedIn:"root"});function GR(e,t){if(1&e&&(yl.j41(0,"h2",7),yl.EFF(1),yl.k0s()),2&e){const e=yl.XpG();yl.R7$(),yl.JRh(e.title())}}function LR(e,t){if(1&e&&yl.nrm(0,"p",8),2&e){const e=yl.XpG();yl.Y8G("innerHTML",e.subtitle(),yl.npT)}}function zR(e,t){1&e&&yl.SdG(0,0,["*ngIf","!subtitle()"])}function _R(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",9),yl.nI1(1,"i18n"),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.handleDismiss())}),yl.k0s()}2&e&&yl.Y8G("label",yl.bMT(1,1,"close"))}function KR(e,t){if(1&e&&yl.nrm(0,"i",12),2&e){const e=yl.XpG(2);yl.Y8G("ngClass",e.buttonIcon())}}function XR(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",10),yl.bIt("click",function(t){a.eBV(e);const i=yl.XpG();return a.Njj(i.handleButtonClick(t))}),yl.EFF(1),yl.DNE(2,KR,1,1,"i",11),yl.k0s()}if(2&e){const e=yl.XpG();yl.R7$(),yl.SpI(" ",e.buttonText()," "),yl.R7$(),yl.Y8G("ngIf",e.buttonIcon())}}class qR{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()}}qR.ɵfac=function(e){return new(e||qR)},qR.ɵcmp=yl.VBU({type:qR,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&&(yl.NAR(),yl.j41(0,"div",0)(1,"div",1)(2,"div"),yl.DNE(3,GR,2,1,"h2",2)(4,LR,1,1,"p",3)(5,zR,1,0,"ng-content",4),yl.k0s(),yl.DNE(6,_R,2,3,"button",5),yl.k0s(),yl.DNE(7,XR,3,2,"button",6),yl.k0s()),2&e&&(yl.R7$(3),yl.Y8G("ngIf",t.title()),yl.R7$(),yl.Y8G("ngIf",t.subtitle()),yl.R7$(),yl.Y8G("ngIf",!t.subtitle()),yl.R7$(),yl.Y8G("ngIf",!t.persistent()),yl.R7$(),yl.Y8G("ngIf",t.buttonText()))},dependencies:[Xu,Ku,pl.MD,pl.YU,pl.bT,_l,zl,Xl,Wl,Hl],encapsulation:2,changeDetection:0});class YR{}YR.ɵfac=function(e){return new(e||YR)},YR.ɵdir=yl.FsC({type:YR,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 WR{}WR.ɵfac=function(e){return new(e||WR)},WR.ɵcmp=yl.VBU({type:WR,selectors:[["bit-card"]],hostAttrs:[1,"tw-p-4","[@media(min-width:650px)]:tw-p-6"],features:[yl.nM4([YR])],ngContentSelectors:["*"],decls:1,vars:0,template:function(e,t){1&e&&(yl.NAR(),yl.SdG(0))},encapsulation:2,changeDetection:0});var HR=i(93161);const JR=e=>({"tw-mb-5 bit-compact:tw-mb-4 [&:not(bit-dialog_*):not(popup-page_*)]:md:tw-mb-12":e});class ZR{constructor(){this.disableMargin=(0,o.hFB)(!1,{transform:HR.he})}}ZR.ɵfac=function(e){return new(e||ZR)},ZR.ɵcmp=yl.VBU({type:ZR,selectors:[["bit-section"]],inputs:{disableMargin:[1,"disableMargin"]},ngContentSelectors:["*"],decls:2,vars:3,consts:[[3,"ngClass"]],template:function(e,t){1&e&&(yl.NAR(),yl.j41(0,"section",0),yl.SdG(1),yl.k0s()),2&e&&yl.Y8G("ngClass",yl.eq3(1,JR,!t.disableMargin()))},dependencies:[pl.MD,pl.YU],encapsulation:2});const QR=["*",[["","slot","end"]]];class ex{}ex.ɵfac=function(e){return new(e||ex)},ex.ɵcmp=yl.VBU({type:ex,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&&(yl.NAR(QR),yl.rj2(0,"div",0)(1,"div",1),yl.SdG(2),yl.eux(),yl.rj2(3,"div",2),yl.SdG(4,1),yl.eux()())},dependencies:[Xl],encapsulation:2});const tx=[[["bit-label"]],[["bit-hint"]]],ix=(e,t)=>({"tw-cursor-default":e,"tw-cursor-pointer":t}),nx=e=>({"tw-text-muted tw-pointer-events-none":e}),rx=(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}),sx=e=>({"tw-translate-x-[calc(theme(spacing.9)_-_(1.125rem_+_4px))] rtl:-tw-translate-x-[calc(theme(spacing.9)_-_(1.125rem_+_4px))]":e});function ox(e,t){if(1&e&&(yl.j41(0,"div",7),yl.EFF(1),yl.k0s()),2&e){const e=yl.XpG(),t=yl.r8f(0);yl.BMQ("id",e.disabledReasonTextId),yl.R7$(),yl.SpI(" ",t," ")}}let ax=0;class lx{constructor(){this.el=(0,a.WQX)(yl.aKT),this.label=o.sbv.required(Sc),this.selected=(0,o.geq)(!1),this.disabled=(0,o.geq)(!1),this.disabledReasonText=(0,o.hFB)(null),this.hintComponent=(0,o.sbv)(nu),this.disabledReasonTextId="bit-switch-disabled-text-"+ax++,this.describedByIds=(0,bl.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-"+ax++)}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. must be used with a .")}}lx.ɵfac=function(e){return new(e||lx)},lx.ɵcmp=yl.VBU({type:lx,selectors:[["bit-switch"]],contentQueries:function(e,t,i){1&e&&(yl.C6U(i,t.label,Sc,5),yl.C6U(i,t.hintComponent,nu,5)),2&e&&yl.NyB(2)},hostVars:3,hostBindings:function(e,t){2&e&&(yl.Avn("id",t.id()),yl.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:[yl.Jv_([{provide:fl.kq,useExisting:lx,multi:!0}]),yl.nM4([Vl])],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=yl.RV6();yl.NAR(tx),yl.SS7(0),yl.j41(1,"div",0)(2,"label",1)(3,"div")(4,"span",2),yl.SdG(5),yl.k0s()(),yl.j41(6,"span",3)(7,"input",4),yl.bIt("change",function(i){return a.eBV(e),a.Njj(t.onInputChange(i))}),yl.k0s(),yl.nrm(8,"span",5),yl.k0s()(),yl.j41(9,"div",6),yl.SdG(10,1,["ngProjectAs","bit-hint",5,["bit-hint"]]),yl.k0s(),yl.nVh(11,ox,2,2,"div",7),yl.k0s()}if(2&e){const e=yl.bH3(t.disabledReasonText());yl.R7$(2),yl.Y8G("ngClass",yl.l_i(11,ix,t.disabled(),!t.disabled())),yl.BMQ("for",t.inputId),yl.R7$(2),yl.Y8G("ngClass",yl.eq3(14,nx,t.disabled())),yl.R7$(2),yl.Y8G("ngClass",yl.sMw(16,rx,t.disabled(),t.selected()&&!t.disabled(),!t.selected()&&!t.disabled())),yl.R7$(),yl.Y8G("id",t.inputId)("checked",t.selected()),yl.BMQ("aria-disabled",t.disabled())("aria-describedby",t.describedByIds()),yl.R7$(),yl.Y8G("ngClass",yl.eq3(20,sx,t.selected())),yl.R7$(3),yl.vxM(e&&t.disabled()?11:-1)}},dependencies:[kc,pl.YU],encapsulation:2});var cx=i(21898);class ux{}class dx extends Uw{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 hx extends Uw{constructor(e){super(e);const t=this.getResponseProperty("MasterPasswordUnlock");null!=t&&"object"==typeof t&&(this.masterPasswordUnlock=new Qw(t))}}class px extends Uw{constructor(e){super(e),this.type=this.getResponseProperty("Type"),this.domains=this.getResponseProperty("Domains"),this.excluded=this.getResponseProperty("Excluded")}}class fx extends Uw{constructor(e){super(e),this.globalEquivalentDomains=[],this.equivalentDomains=this.getResponseProperty("EquivalentDomains");const t=this.getResponseProperty("GlobalEquivalentDomains");this.globalEquivalentDomains=null!=t?t.map(e=>new px(e)):[]}}class vx extends Uw{constructor(e){var t,i,n,r,s,o;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 lR(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 a=this.getResponseProperty("FamilySponsorshipLastSyncDate");a&&(this.familySponsorshipLastSyncDate=new Date(a));const l=this.getResponseProperty("FamilySponsorshipValidUntil");l&&(this.familySponsorshipValidUntil=new Date(l)),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.isAdminInitiated=this.getResponseProperty("IsAdminInitiated"),this.ssoEnabled=null!==(s=this.getResponseProperty("SsoEnabled"))&&void 0!==s&&s,this.ssoMemberDecryptionType=this.getResponseProperty("SsoMemberDecryptionType"),this.usePhishingBlocker=null!==(o=this.getResponseProperty("UsePhishingBlocker"))&&void 0!==o&&o}}class mx extends vx{constructor(e){super(e),this.keyConnectorEnabled=!1}}class gx extends Uw{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 lR(this.getResponseProperty("permissions")),this.userId=this.getResponseProperty("UserId"),this.useEvents=this.getResponseProperty("UseEvents"),this.providerStatus=this.getResponseProperty("ProviderStatus"),this.providerType=this.getResponseProperty("ProviderType")}}class yx extends Uw{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 up(r)),null!=this.getResponseProperty("AccountKeys")&&(this.accountKeys=new Yw(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 vx(e)));const o=this.getResponseProperty("Providers");null!=o&&(this.providers=o.map(e=>new gx(e)));const a=this.getResponseProperty("ProviderOrganizations");null!=a&&(this.providerOrganizations=a.map(e=>new mx(e)))}}class bx extends Uw{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 wx extends Uw{constructor(e=null){super(e),null!=e&&(this.text=this.getResponseProperty("Text"),this.hidden=this.getResponseProperty("Hidden")||!1)}}class Sx extends Uw{constructor(e){super(e),this.id=this.getResponseProperty("Id"),this.accessId=this.getResponseProperty("AccessId"),this.type=this.getResponseProperty("Type"),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;const t=this.getResponseProperty("Text");null!=t&&(this.text=new wx(t));const i=this.getResponseProperty("File");null!=i&&(this.file=new bx(i))}}class kx extends Uw{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 Ix extends Uw{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 Ix,e)}static fromSdkCipherPermissions(e){if(!e)return;const t=new Ix;return t.delete=e.delete,t.restore=e.restore,t}toSdkCipherPermissions(){return this}}class Cx extends Uw{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 Tx extends Uw{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 Px extends Uw{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 Fx extends Uw{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 Rx extends Uw{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 Fx(e)));const i=this.getResponseProperty("Fido2Credentials");null!=i&&(this.fido2Credentials=i.map(e=>new Px(e)))}}class xx extends Uw{constructor(e=null){super(e),null!=e&&(this.type=this.getResponseProperty("Type"))}}class Ax extends Uw{constructor(e=null){super(e),null!=e&&(this.privateKey=this.getResponseProperty("PrivateKey"),this.publicKey=this.getResponseProperty("PublicKey"),this.keyFingerprint=this.getResponseProperty("KeyFingerprint"))}}class Dx extends Uw{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 Ex extends Uw{constructor(e){super(e),this.password=this.getResponseProperty("Password"),this.lastUsedDate=this.getResponseProperty("LastUsedDate")}}class $x extends Uw{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 Ix(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 Rx(t));const i=this.getResponseProperty("Card");null!=i&&(this.card=new kx(i));const n=this.getResponseProperty("Identity");null!=n&&(this.identity=new Tx(n));const r=this.getResponseProperty("SecureNote");null!=r&&(this.secureNote=new xx(r));const s=this.getResponseProperty("sshKey");null!=s&&(this.sshKey=new Ax(s));const o=this.getResponseProperty("Fields");null!=o&&(this.fields=o.map(e=>new Cx(e)));const a=this.getResponseProperty("Attachments");null!=a&&(this.attachments=a.map(e=>new Dx(e)));const l=this.getResponseProperty("PasswordHistory");null!=l&&(this.passwordHistory=l.map(e=>new Ex(e))),this.reprompt=this.getResponseProperty("Reprompt")||kR.None,this.key=this.getResponseProperty("Key")||null}}class Ox extends Uw{constructor(e){super(e),this.id=this.getResponseProperty("Id"),this.name=this.getResponseProperty("Name"),this.revisionDate=this.getResponseProperty("RevisionDate")}}class Ux extends Uw{constructor(e){super(e),this.folders=[],this.collections=[],this.ciphers=[],this.policies=[],this.sends=[];const t=this.getResponseProperty("Profile");null!=t&&(this.profile=new yx(t));const i=this.getResponseProperty("Folders");null!=i&&(this.folders=i.map(e=>new Ox(e)));const n=this.getResponseProperty("Collections");null!=n&&(this.collections=n.map(e=>new YF(e)));const r=this.getResponseProperty("Ciphers");null!=r&&(this.ciphers=r.map(e=>new $x(e)));const s=this.getResponseProperty("Domains");null!=s&&(this.domains=new fx(s));const o=this.getResponseProperty("Policies");null!=o&&(this.policies=o.map(e=>new dx(e)));const a=this.getResponseProperty("Sends");null!=a&&(this.sends=a.map(e=>new Sx(e)));const l=this.getResponseProperty("UserDecryption");null!=l&&"object"==typeof l&&(this.userDecryption=new hx(l))}}const Mx=Object.freeze({MasterPassword:"masterPassword",Pin:"pin",Biometrics:"biometrics"});class Nx{}class Vx{}var Bx=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 jx(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",9),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.activeUnlockOption.set(t.UnlockOption.Biometrics))}),yl.j41(1,"span"),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s()()}if(2&e){const e=yl.XpG();yl.Y8G("disabled",!e.biometricsAvailable()),yl.R7$(2),yl.SpI(" ",yl.bMT(3,2,e.biometricUnlockBtnText()))}}function Gx(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",10),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.activeUnlockOption.set(t.UnlockOption.Pin))}),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()}2&e&&(yl.R7$(),yl.SpI(" ",yl.bMT(2,1,"unlockWithPin")," "))}class Lx{constructor(){this.accountService=(0,a.WQX)(Ok),this.masterPasswordUnlockService=(0,a.WQX)(Vx),this.i18nService=(0,a.WQX)(Pl),this.toastService=(0,a.WQX)(xb),this.logService=(0,a.WQX)(za),this.UnlockOption=Mx,this.activeUnlockOption=o.geq.required(),this.unlockOptions=o.hFB.required(),this.biometricUnlockBtnText=o.hFB.required(),this.showPinSwap=(0,bl.EW)(()=>{var e;return null!==(e=this.unlockOptions().pin.enabled)&&void 0!==e&&e}),this.biometricsAvailable=(0,bl.EW)(()=>{var e;return null!==(e=this.unlockOptions().biometrics.enabled)&&void 0!==e&&e}),this.showBiometricsSwap=(0,bl.EW)(()=>{const e=this.unlockOptions().biometrics.biometricsStatus;return e!==gp.PlatformUnsupported&&e!==gp.NotEnabledLocally}),this.successfulUnlock=(0,o.CGW)(),this.logOut=(0,o.CGW)(),this.formGroup=new fl.gE({masterPassword:new fl.MJ("",{validators:[fl.k0.required],updateOn:"submit"})}),this.submit=()=>Bx(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,ho._)(Gp(this.accountService.activeAccount$));yield this.unlockViaMasterPassword(e,t)})}unlockViaMasterPassword(e,t){return Bx(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")})}})}}Lx.ɵfac=function(e){return new(e||Lx)},Lx.ɵcmp=yl.VBU({type:Lx,selectors:[["bit-master-password-lock"]],inputs:{activeUnlockOption:[1,"activeUnlockOption"],unlockOptions:[1,"unlockOptions"],biometricUnlockBtnText:[1,"biometricUnlockBtnText"]},outputs:{activeUnlockOption:"activeUnlockOptionChange",successfulUnlock:"successfulUnlock",logOut:"logOut"},decls:19,vars:16,consts:[[3,"formGroup","bitSubmit"],["type","password","formControlName","masterPassword","bitInput","","appAutofocus","","name","masterPassword","required","","appInputVerbatim","",1,"tw-font-mono"],["type","button","bitIconButton","","bitSuffix","","bitPasswordInputToggle",""],[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",""],["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&&(yl.j41(0,"form",0)(1,"bit-form-field")(2,"bit-label"),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s(),yl.nrm(5,"input",1)(6,"button",2),yl.k0s(),yl.j41(7,"div",3)(8,"button",4),yl.EFF(9),yl.nI1(10,"i18n"),yl.k0s(),yl.j41(11,"p",5),yl.EFF(12),yl.nI1(13,"i18n"),yl.k0s(),yl.nVh(14,jx,4,4,"button",6),yl.nVh(15,Gx,3,3,"button",7),yl.j41(16,"button",8),yl.bIt("click",function(){return t.logOut.emit()}),yl.EFF(17),yl.nI1(18,"i18n"),yl.k0s()()()),2&e&&(yl.Y8G("formGroup",t.formGroup)("bitSubmit",t.submit),yl.R7$(3),yl.JRh(yl.bMT(4,8,"masterPass")),yl.R7$(6),yl.SpI(" ",yl.bMT(10,10,"unlock")," "),yl.R7$(3),yl.JRh(yl.bMT(13,12,"or")),yl.R7$(2),yl.vxM(t.showBiometricsSwap()?14:-1),yl.R7$(),yl.vxM(t.showPinSwap()?15:-1),yl.R7$(2),yl.SpI(" ",yl.bMT(18,14,"logOut")," "))},dependencies:[qf,hk,II,fl.X1,fl.qT,fl.me,fl.BC,fl.cb,fl.YS,fl.j4,fl.JD,Xu,Ku,Eu,Sc,ou,Du,Vb,Bb,rc,xd,Td,_l,zl,Xf],encapsulation:2});class zx{}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())})};function Kx(e,t){1&e&&(yl.j41(0,"div",2),yl.nrm(1,"i",3),yl.k0s())}function Xx(e,t){if(1&e){const e=yl.RV6();yl.qex(0),yl.j41(1,"button",10),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG(3);return a.Njj(t.activeUnlockOption=t.UnlockOption.Pin)}),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.bVm()}2&e&&(yl.R7$(2),yl.SpI(" ",yl.bMT(3,1,"unlockWithPin")," "))}function qx(e,t){if(1&e){const e=yl.RV6();yl.qex(0),yl.j41(1,"button",10),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG(3);return a.Njj(t.activeUnlockOption=t.UnlockOption.MasterPassword)}),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.bVm()}2&e&&(yl.R7$(2),yl.SpI(" ",yl.bMT(3,1,"unlockWithMasterPassword")," "))}function Yx(e,t){if(1&e){const e=yl.RV6();yl.qex(0),yl.j41(1,"button",6),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG(2);return a.Njj(t.unlockViaBiometrics())}),yl.j41(2,"span"),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s()(),yl.j41(5,"div",7)(6,"p",8),yl.EFF(7),yl.nI1(8,"i18n"),yl.k0s(),yl.DNE(9,Xx,4,3,"ng-container",4)(10,qx,4,3,"ng-container",4),yl.j41(11,"button",9),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG(2);return a.Njj(t.logOut())}),yl.EFF(12),yl.nI1(13,"i18n"),yl.k0s()(),yl.bVm()}if(2&e){const e=yl.XpG(2);yl.R7$(),yl.Y8G("disabled",e.unlockingViaBiometrics||!e.biometricsAvailable)("loading",e.unlockingViaBiometrics)("bitTooltip",e.biometricUnavailabilityReason),yl.R7$(2),yl.SpI(" ",yl.bMT(4,8,e.biometricUnlockBtnText)),yl.R7$(4),yl.JRh(yl.bMT(8,10,"or")),yl.R7$(2),yl.Y8G("ngIf",e.unlockOptions.pin.enabled),yl.R7$(),yl.Y8G("ngIf",e.unlockOptions.masterPassword.enabled),yl.R7$(2),yl.SpI(" ",yl.bMT(13,12,"logOut")," ")}}function Wx(e,t){if(1&e){const e=yl.RV6();yl.qex(0),yl.j41(1,"button",17),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG(3);return a.Njj(t.activeUnlockOption=t.UnlockOption.Biometrics)}),yl.j41(2,"span"),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s()(),yl.bVm()}if(2&e){const e=yl.XpG(3);yl.R7$(),yl.Y8G("disabled",!e.biometricsAvailable),yl.R7$(2),yl.SpI(" ",yl.bMT(4,2,e.biometricUnlockBtnText))}}function Hx(e,t){if(1&e){const e=yl.RV6();yl.qex(0),yl.j41(1,"button",18),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG(3);return a.Njj(t.activeUnlockOption=t.UnlockOption.MasterPassword)}),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.bVm()}2&e&&(yl.R7$(2),yl.SpI(" ",yl.bMT(3,1,"unlockWithMasterPassword")," "))}function Jx(e,t){if(1&e){const e=yl.RV6();yl.qex(0),yl.j41(1,"form",11)(2,"bit-form-field")(3,"bit-label"),yl.EFF(4),yl.nI1(5,"i18n"),yl.k0s(),yl.nrm(6,"input",12),yl.j41(7,"button",13),yl.mxI("toggledChange",function(t){a.eBV(e);const i=yl.XpG(2);return yl.DH7(i.showPassword,t)||(i.showPassword=t),a.Njj(t)}),yl.k0s()(),yl.j41(8,"div",7)(9,"button",14),yl.EFF(10),yl.nI1(11,"i18n"),yl.k0s(),yl.j41(12,"p",15),yl.EFF(13),yl.nI1(14,"i18n"),yl.k0s(),yl.DNE(15,Wx,5,4,"ng-container",4)(16,Hx,4,3,"ng-container",4),yl.j41(17,"button",16),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG(2);return a.Njj(t.logOut())}),yl.EFF(18),yl.nI1(19,"i18n"),yl.k0s()()(),yl.bVm()}if(2&e){const e=yl.XpG(2);yl.R7$(),yl.Y8G("bitSubmit",e.submit)("formGroup",e.formGroup),yl.R7$(3),yl.JRh(yl.bMT(5,9,"pin")),yl.R7$(3),yl.R50("toggled",e.showPassword),yl.R7$(3),yl.SpI(" ",yl.bMT(11,11,"unlock")," "),yl.R7$(3),yl.JRh(yl.bMT(14,13,"or")),yl.R7$(2),yl.Y8G("ngIf",e.showBiometrics),yl.R7$(),yl.Y8G("ngIf",e.unlockOptions.masterPassword.enabled),yl.R7$(2),yl.SpI(" ",yl.bMT(19,15,"logOut")," ")}}function Zx(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"bit-master-password-lock",19),yl.mxI("activeUnlockOptionChange",function(t){a.eBV(e);const i=yl.XpG(2);return yl.DH7(i.activeUnlockOption,t)||(i.activeUnlockOption=t),a.Njj(t)}),yl.bIt("successfulUnlock",function(t){a.eBV(e);const i=yl.XpG(2);return a.Njj(i.successfulMasterPasswordUnlock(t))})("logOut",function(){a.eBV(e);const t=yl.XpG(2);return a.Njj(t.logOut())}),yl.k0s()}if(2&e){const e=yl.XpG(2);yl.R50("activeUnlockOption",e.activeUnlockOption),yl.Y8G("unlockOptions",e.unlockOptions)("biometricUnlockBtnText",e.biometricUnlockBtnText)}}function Qx(e,t){if(1&e){const e=yl.RV6();yl.qex(0),yl.j41(1,"button",17),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG(4);return a.Njj(t.activeUnlockOption=t.UnlockOption.Biometrics)}),yl.j41(2,"span"),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s()(),yl.bVm()}if(2&e){const e=yl.XpG(4);yl.R7$(),yl.Y8G("disabled",!e.biometricsAvailable),yl.R7$(2),yl.SpI(" ",yl.bMT(4,2,e.biometricUnlockBtnText))}}function eA(e,t){if(1&e){const e=yl.RV6();yl.qex(0),yl.j41(1,"button",18),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG(4);return a.Njj(t.activeUnlockOption=t.UnlockOption.Pin)}),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.bVm()}2&e&&(yl.R7$(2),yl.SpI(" ",yl.bMT(3,1,"unlockWithPin")," "))}function tA(e,t){if(1&e){const e=yl.RV6();yl.qex(0),yl.j41(1,"form",11)(2,"bit-form-field")(3,"bit-label"),yl.EFF(4),yl.nI1(5,"i18n"),yl.k0s(),yl.nrm(6,"input",20),yl.j41(7,"button",13),yl.mxI("toggledChange",function(t){a.eBV(e);const i=yl.XpG(3);return yl.DH7(i.showPassword,t)||(i.showPassword=t),a.Njj(t)}),yl.k0s()(),yl.j41(8,"div",7)(9,"button",14),yl.EFF(10),yl.nI1(11,"i18n"),yl.k0s(),yl.j41(12,"p",15),yl.EFF(13),yl.nI1(14,"i18n"),yl.k0s(),yl.DNE(15,Qx,5,4,"ng-container",4)(16,eA,4,3,"ng-container",4),yl.j41(17,"button",16),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG(3);return a.Njj(t.logOut())}),yl.EFF(18),yl.nI1(19,"i18n"),yl.k0s()()(),yl.bVm()}if(2&e){const e=yl.XpG(3);yl.R7$(),yl.Y8G("bitSubmit",e.submit)("formGroup",e.formGroup),yl.R7$(3),yl.JRh(yl.bMT(5,9,"masterPass")),yl.R7$(3),yl.R50("toggled",e.showPassword),yl.R7$(3),yl.SpI(" ",yl.bMT(11,11,"unlock")," "),yl.R7$(3),yl.JRh(yl.bMT(14,13,"or")),yl.R7$(2),yl.Y8G("ngIf",e.showBiometrics),yl.R7$(),yl.Y8G("ngIf",e.unlockOptions.pin.enabled),yl.R7$(2),yl.SpI(" ",yl.bMT(19,15,"logOut")," ")}}function iA(e,t){if(1&e&&yl.DNE(0,tA,20,17,"ng-container",4),2&e){const e=yl.XpG(2);yl.Y8G("ngIf",e.unlockOptions.masterPassword.enabled&&e.activeUnlockOption===e.UnlockOption.MasterPassword)}}function nA(e,t){if(1&e&&(yl.qex(0),yl.DNE(1,Yx,14,14,"ng-container",4)(2,Jx,20,17,"ng-container",4),yl.nVh(3,Zx,1,3,"bit-master-password-lock",5),yl.nI1(4,"async"),yl.vZN(5,iA,1,1,"ng-container"),yl.bVm()),2&e){const e=yl.XpG();yl.R7$(),yl.Y8G("ngIf",e.activeUnlockOption===e.UnlockOption.Biometrics),yl.R7$(),yl.Y8G("ngIf",e.unlockOptions.pin.enabled&&e.activeUnlockOption===e.UnlockOption.Pin),yl.R7$(),yl.vxM(yl.bMT(4,3,e.unlockWithMasterPasswordUnlockDataFlag$)&&e.unlockOptions.masterPassword.enabled&&e.activeUnlockOption===e.UnlockOption.MasterPassword?3:5)}}const rA="LockComponent",sA={[Ca.Web]:"vault",[Ca.Desktop]:"vault",[Ca.Browser]:"/tabs/current"},oA=[gp.HardwareUnavailable,gp.DesktopDisconnected,gp.NotEnabledInConnectedDesktopApp];class aA{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,f,v,m,g,y,b,w,S,k,I,C,T,P,F){this.accountService=e,this.pinService=t,this.userVerificationService=i,this.keyService=n,this.platformUtilsService=r,this.router=s,this.activatedRoute=o,this.dialogService=a,this.messagingService=l,this.biometricStateService=c,this.ngZone=u,this.i18nService=d,this.masterPasswordService=h,this.logService=p,this.deviceTrustService=f,this.syncService=v,this.policyService=m,this.passwordStrengthService=g,this.formBuilder=y,this.toastService=b,this.userAsymmetricKeysRegenerationService=w,this.biometricService=S,this.logoutService=k,this.lockComponentService=I,this.anonLayoutWrapperDataService=C,this.encryptedMigrator=T,this.configService=P,this.broadcasterService=F,this.destroy$=new go.B,this.loading=!0,this.unlockWithMasterPasswordUnlockDataFlag$=this.configService.getFeatureFlag$(Nf.UnlockWithMasterPasswordUnlockData),this.activeAccount=null,this.unlockOptions=null,this.UnlockOption=Mx,this._activeUnlockOptionBSubject=new fd.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=()=>_x(this,void 0,void 0,function*(){if(this.activeUnlockOption===Mx.Pin)return yield this.unlockViaPin();yield this.unlockViaMasterPassword()})}ngOnInit(){return _x(this,void 0,void 0,function*(){this.listenForActiveUnlockOptionChanges(),this.listenForActiveAccountChanges(),this.listenForUnlockOptionsChanges(),this.clientType=this.platformUtilsService.getClientType(),this.clientType===Ca.Desktop?yield this.desktopOnInit():this.clientType===Ca.Browser&&(this.biometricUnlockBtnText=this.lockComponentService.getBiometricsUnlockBtnText())})}listenForUnlockOptionsChanges(){(0,Zo.Y)(1e3).pipe((0,cx.Z)(()=>_x(this,void 0,void 0,function*(){var e;null!=(null===(e=this.activeAccount)||void 0===e?void 0:e.id)&&(this.unlockOptions=yield(0,ho._)(this.lockComponentService.getAvailableUnlockOptions$(this.activeAccount.id)),null==this.activeUnlockOption&&(this.loading=!1,yield this.setDefaultActiveUnlockOption(this.unlockOptions)))})),(0,Jv.Q)(this.destroy$)).subscribe()}listenForActiveUnlockOptionChanges(){this.activeUnlockOption$.pipe((0,Jv.Q)(this.destroy$)).subscribe(e=>{e===Mx.Pin?this.buildPinForm():e===Mx.MasterPassword&&this.buildMasterPasswordForm()})}buildMasterPasswordForm(){this.formGroup=this.formBuilder.group({masterPassword:["",[fl.k0.required]]},{updateOn:"submit"})}buildPinForm(){this.formGroup=this.formBuilder.group({pin:["",[fl.k0.required]]},{updateOn:"submit"})}listenForActiveAccountChanges(){this.accountService.activeAccount$.pipe((0,Fo.M)(e=>{this.loading=!0,this.activeAccount=e,this.resetDataOnActiveAccountChange()}),(0,To.p)(e=>null!=e),(0,co.n)(e=>_x(this,void 0,void 0,function*(){yield this.handleActiveAccountChange(e),this.loading=!1})),(0,Jv.Q)(this.destroy$)).subscribe()}handleActiveAccountChange(e){return _x(this,void 0,void 0,function*(){var t,i,n;if(yield this.keyService.hasUserKey(e.id))return;this.setEmailAsPageSubtitle(e.email),this.unlockOptions=yield(0,ho._)(this.lockComponentService.getAvailableUnlockOptions$(e.id));const r=[gp.Available,...oA].includes(yield this.biometricService.getBiometricsStatusForUser(e.id));if(!(null===(t=this.unlockOptions)||void 0===t?void 0:t.masterPassword.enabled)&&!(null===(i=this.unlockOptions)||void 0===i?void 0:i.pin.enabled)&&!r)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 _x(this,void 0,void 0,function*(){(null==e?void 0:e.biometrics.enabled)?this.activeUnlockOption=Mx.Biometrics:(null==e?void 0:e.pin.enabled)?this.activeUnlockOption=Mx.Pin:(null==e?void 0:e.masterPassword.enabled)?this.activeUnlockOption=Mx.MasterPassword:null!=e&&oA.includes(e.biometrics.biometricsStatus)&&(this.activeUnlockOption=Mx.Biometrics)})}handleBiometricsUnlockEnabled(){return _x(this,void 0,void 0,function*(){var e;this.biometricUnlockBtnText=this.lockComponentService.getBiometricsUnlockBtnText();const t=yield(0,ho._)(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()===Ta.FirefoxExtension&&(yield this.lockComponentService.popOutBrowserExtension(),this.shouldClosePopout=!0),this.loading=!1,yield this.unlockViaBiometrics())}})}logOut(){return _x(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 _x(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})}togglePassword(){var e;this.showPassword=!this.showPassword;const t=document.getElementById((null===(e=this.unlockOptions)||void 0===e?void 0:e.pin.enabled)?"pin":"masterPassword");null!=t&&(this.ngZone.isStable?t.focus():this.ngZone.onStable.pipe((0,No.s)(1)).subscribe(()=>t.focus()))}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 _x(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")})}})}validateMasterPassword(){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("masterPasswordRequired")}),!1)}unlockViaMasterPassword(){return _x(this,void 0,void 0,function*(){if(!this.validateMasterPassword()||null==this.formGroup||null==this.activeAccount)return;const e=this.formGroup.controls.masterPassword.value,t={type:yC.MasterPassword,secret:e};let i=!1,n=null;try{n=yield this.userVerificationService.verifyUserByMasterPassword(t,this.activeAccount.id,this.activeAccount.email),null!=(null==n?void 0:n.policyOptions)?this.enforcedMasterPasswordOptions=Kp.fromResponse(n.policyOptions):this.enforcedMasterPasswordOptions=void 0,i=!0}catch(e){this.logService.error(e)}if(!i)return void this.toastService.showToast({variant:"error",title:this.i18nService.t("errorOccurred"),message:this.i18nService.t("invalidMasterPassword")});const r=yield this.masterPasswordService.decryptUserKeyWithMasterKey(n.masterKey,this.activeAccount.id);null!=r?yield this.setUserKeyAndContinue(r,{passwordEvaluation:{masterPassword:e}}):this.toastService.showToast({variant:"error",title:this.i18nService.t("errorOccurred"),message:this.i18nService.t("invalidMasterPassword")})})}successfulMasterPasswordUnlock(e){return _x(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 _x(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 _x(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,ho._)(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,ho._)(this.accountService.activeAccount$.pipe(Gp,(0,co.n)(e=>this.policyService.masterPasswordPolicyOptions$(e))))),this.requirePasswordChange(e.passwordEvaluation.masterPassword)&&(yield this.masterPasswordService.setForceSetPasswordReason(Gw.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=sA[this.clientType];yield this.router.navigate([e])}this.shouldClosePopout&&this.platformUtilsService.getDevice()===Ta.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 _x(this,void 0,void 0,function*(){this.biometricUnlockBtnText=this.lockComponentService.getBiometricsUnlockBtnText(),this.broadcasterService.subscribe(rA,e=>_x(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 _x(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,ho._)(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(rA)}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!==gp.PlatformUnsupported&&this.unlockOptions.biometrics.biometricsStatus!==gp.NotEnabledLocally)}get biometricUnavailabilityReason(){var e,t,i,n;switch(null===(e=this.unlockOptions)||void 0===e?void 0:e.biometrics.biometricsStatus){case gp.Available:return"";case gp.UnlockNeeded:return this.i18nService.t("biometricsStatusHelptextUnlockNeeded");case gp.HardwareUnavailable:return this.i18nService.t("biometricsStatusHelptextHardwareUnavailable");case gp.AutoSetupNeeded:return this.i18nService.t("biometricsStatusHelptextAutoSetupNeeded");case gp.ManualSetupNeeded:return this.i18nService.t("biometricsStatusHelptextManualSetupNeeded");case gp.NotEnabledInConnectedDesktopApp:return this.i18nService.t("biometricsStatusHelptextNotEnabledInDesktop",null===(t=this.activeAccount)||void 0===t?void 0:t.email);case gp.NotEnabledLocally:return this.i18nService.t("biometricsStatusHelptextNotEnabledInDesktop",null===(i=this.activeAccount)||void 0===i?void 0:i.email);case gp.DesktopDisconnected:return this.i18nService.t("biometricsStatusHelptextDesktopDisconnected");default:return this.i18nService.t("biometricsStatusHelptextUnavailableReasonUnknown")+(null===(n=this.unlockOptions)||void 0===n?void 0:n.biometrics.biometricsStatus)}}}aA.ɵfac=function(e){return new(e||aA)(yl.rXU(Ok),yl.rXU(EF),yl.rXU(bC),yl.rXU(Cp),yl.rXU(Eb),yl.rXU(ud.Ix),yl.rXU(ud.nX),yl.rXU(Jd),yl.rXU(ek),yl.rXU(wp),yl.rXU(yl.SKi),yl.rXU(Pl),yl.rXU(Db),yl.rXU(za),yl.rXU(Nk),yl.rXU(ux),yl.rXU(Ob),yl.rXU(Wf),yl.rXU(fl.ok),yl.rXU(xb),yl.rXU(Mf),yl.rXU(kp),yl.rXU(yw),yl.rXU(Nx),yl.rXU(sk),yl.rXU(zx),yl.rXU(uk),yl.rXU(ak))},aA.ɵcmp=yl.VBU({type:aA,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"],["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"],["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","logOut","activeUnlockOption","unlockOptions","biometricUnlockBtnText"],["type","password","formControlName","masterPassword","bitInput","","appAutofocus","","name","masterPassword","required","","appInputVerbatim","",1,"tw-font-mono"]],template:function(e,t){if(1&e&&yl.DNE(0,Kx,2,0,"ng-template",null,0,yl.C5r)(2,nA,6,5,"ng-container",1),2&e){const e=yl.sdS(1);yl.R7$(2),yl.Y8G("ngIf",t.unlockOptions&&!t.loading)("ngIfElse",e)}},dependencies:[pl.MD,pl.bT,qf,hk,II,fl.X1,fl.qT,fl.me,fl.BC,fl.cb,fl.YS,fl.j4,fl.JD,Xu,Ku,Eu,Sc,ou,Du,Vb,Bb,rc,xd,Td,_l,zl,Lx,Ul,pl.Jj,Xf],encapsulation:2});var lA=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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&&(yl.j41(0,"li"),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()),2&e){const e=yl.XpG();yl.R7$(),yl.SpI(" ",yl.i5U(2,1,"userkeyRotationDisclaimerAccountRecoveryOrgsText",e.params.orgName)," ")}}function uA(e,t){if(1&e&&(yl.j41(0,"li"),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()),2&e){const e=yl.XpG();yl.R7$(),yl.SpI(" ",yl.i5U(2,1,"userkeyRotationDisclaimerEmergencyAccessText",e.params.numberOfEmergencyAccessUsers)," ")}}class dA{constructor(e,t,i){this.params=e,this.logService=t,this.dialogRef=i}submit(){return lA(this,void 0,void 0,function*(){try{this.dialogRef.close(!0)}catch(e){this.logService.error(e)}})}static open(e,t){return e.open(dA,{data:t})}}dA.ɵfac=function(e){return new(e||dA)(yl.rXU(nd.Qs),yl.rXU(za),yl.rXU(nd.ce))},dA.ɵcmp=yl.VBU({type:dA,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&&(yl.j41(0,"bit-dialog",0)(1,"span",1)(2,"strong"),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s()(),yl.j41(5,"span",2),yl.EFF(6),yl.nI1(7,"i18n"),yl.j41(8,"ul",3),yl.DNE(9,cA,3,4,"li",4)(10,uA,3,4,"li",4),yl.k0s()(),yl.qex(11,5),yl.j41(12,"a",6),yl.bIt("click",function(){return t.submit()}),yl.EFF(13),yl.nI1(14,"i18n"),yl.k0s(),yl.j41(15,"button",7),yl.EFF(16),yl.nI1(17,"i18n"),yl.k0s(),yl.bVm(),yl.k0s()),2&e&&(yl.R7$(3),yl.SpI(" ",yl.bMT(4,6,"userkeyRotationDisclaimerTitle")," "),yl.R7$(3),yl.SpI(" ",yl.bMT(7,8,"userkeyRotationDisclaimerDescription")," "),yl.R7$(3),yl.Y8G("ngIf",null!=t.params.orgName),yl.R7$(),yl.Y8G("ngIf",t.params.numberOfEmergencyAccessUsers>0),yl.R7$(3),yl.SpI(" ",yl.bMT(14,10,"continue")," "),yl.R7$(3),yl.SpI(" ",yl.bMT(17,12,"close")," "))},dependencies:[pl.MD,pl.bT,qf,dh,Zd,uh,Xu,Ku,fl.X1,rc,fl.YN,Xf],encapsulation:2});var hA=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 pA{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 hA(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 hA(this,void 0,void 0,function*(){this.loading||this.dialogRef.close(!0)})}static open(e,t){return e.open(pA,{data:t})}}pA.ɵfac=function(e){return new(e||pA)(yl.rXU(nd.Qs),yl.rXU(fl.ok),yl.rXU(Cp),yl.rXU(za),yl.rXU(nd.ce))},pA.ɵcmp=yl.VBU({type:pA,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&&(yl.j41(0,"bit-dialog",0),yl.nI1(1,"i18n"),yl.qex(2,1),yl.j41(3,"p",2),yl.EFF(4),yl.nI1(5,"i18n"),yl.nrm(6,"br")(7,"br"),yl.EFF(8),yl.nI1(9,"i18n"),yl.j41(10,"code"),yl.EFF(11),yl.k0s()(),yl.bVm(),yl.qex(12,3),yl.j41(13,"button",4),yl.bIt("click",function(){return t.submit()}),yl.j41(14,"span"),yl.EFF(15),yl.nI1(16,"i18n"),yl.k0s()(),yl.j41(17,"button",5),yl.EFF(18),yl.nI1(19,"i18n"),yl.k0s(),yl.bVm(),yl.k0s()),2&e&&(yl.Y8G("loading",t.loading)("title",yl.bMT(1,8,"trustOrganization"))("subtitle",t.params.name),yl.R7$(4),yl.SpI(" ",yl.bMT(5,10,"orgTrustWarning1")," "),yl.R7$(4),yl.SpI(" ",yl.bMT(9,12,"fingerprintPhrase")," "),yl.R7$(3),yl.JRh(t.fingerprint),yl.R7$(4),yl.JRh(yl.bMT(16,14,"trust")),yl.R7$(3),yl.SpI(" ",yl.bMT(19,16,"doNotTrust")," "))},dependencies:[pl.MD,qf,dh,Zd,uh,Xu,Ku,Oh,Xl,Wl,fl.X1,Eu,rc,xd,fl.YN,td,Xf],encapsulation:2});var fA=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 vA{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 fA(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 fA(this,void 0,void 0,function*(){this.loading||this.dialogRef.close(!0)})}static open(e,t){return e.open(vA,{data:t})}}vA.ɵfac=function(e){return new(e||vA)(yl.rXU(nd.Qs),yl.rXU(fl.ok),yl.rXU(Cp),yl.rXU(za),yl.rXU(nd.ce))},vA.ɵcmp=yl.VBU({type:vA,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&&(yl.j41(0,"bit-dialog",0),yl.nI1(1,"i18n"),yl.qex(2,1),yl.j41(3,"bit-callout",2),yl.EFF(4),yl.nI1(5,"i18n"),yl.k0s(),yl.j41(6,"p",3),yl.EFF(7),yl.nI1(8,"i18n"),yl.j41(9,"a",4),yl.EFF(10),yl.nI1(11,"i18n"),yl.k0s()(),yl.j41(12,"p",3)(13,"code"),yl.EFF(14),yl.k0s()(),yl.bVm(),yl.qex(15,5),yl.j41(16,"button",6),yl.bIt("click",function(){return t.submit()}),yl.j41(17,"span"),yl.EFF(18),yl.nI1(19,"i18n"),yl.k0s()(),yl.j41(20,"button",7),yl.EFF(21),yl.nI1(22,"i18n"),yl.k0s(),yl.bVm(),yl.k0s()),2&e&&(yl.Y8G("loading",t.loading)("title",yl.bMT(1,9,"trustUser"))("subtitle",t.params.name),yl.R7$(4),yl.JRh(yl.bMT(5,11,"emergencyAccessTrustWarning")),yl.R7$(3),yl.SpI(" ",yl.bMT(8,13,"fingerprintEnsureIntegrityVerify")," "),yl.R7$(3),yl.SpI(" ",yl.bMT(11,15,"learnMore")),yl.R7$(4),yl.JRh(t.fingerprint),yl.R7$(4),yl.JRh(yl.bMT(19,17,"trust")),yl.R7$(3),yl.SpI(" ",yl.bMT(22,19,"doNotTrust")," "))},dependencies:[pl.MD,qf,dh,Zd,uh,Xu,Ku,Oh,_b,Xl,Wl,fl.X1,Eu,rc,xd,fl.YN,td,ed,Xf],encapsulation:2});var mA=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 gA(e,t){1&e&&(yl.j41(0,"div",0),yl.nrm(1,"i",1),yl.nI1(2,"i18n"),yl.j41(3,"span",2),yl.EFF(4),yl.nI1(5,"i18n"),yl.k0s()()),2&e&&(yl.R7$(),yl.Y8G("title",yl.mNQ(yl.bMT(2,3,"loading"))),yl.R7$(3),yl.JRh(yl.bMT(5,5,"loading")))}function yA(e,t){if(1&e&&(yl.j41(0,"p"),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s(),yl.j41(3,"p",3),yl.EFF(4),yl.nI1(5,"i18n"),yl.k0s(),yl.j41(6,"p",4),yl.EFF(7),yl.k0s(),yl.j41(8,"p",5),yl.EFF(9),yl.nI1(10,"i18n"),yl.nrm(11,"button",6),yl.nI1(12,"i18n"),yl.k0s(),yl.j41(13,"p",7),yl.EFF(14),yl.k0s(),yl.j41(15,"div",8)(16,"button",9),yl.EFF(17),yl.nI1(18,"i18n"),yl.k0s(),yl.j41(19,"button",10),yl.EFF(20),yl.nI1(21,"i18n"),yl.k0s()()),2&e){const e=yl.XpG();yl.R7$(),yl.JRh(yl.bMT(2,12,"removeMasterPasswordForOrgUserKeyConnector")),yl.R7$(3),yl.JRh(yl.bMT(5,14,"organization")),yl.R7$(3),yl.JRh(e.organization.name),yl.R7$(2),yl.SpI(" ",yl.bMT(10,16,"domain")," "),yl.R7$(2),yl.Y8G("label",yl.bMT(12,18,"keyConnectorDomainTooltip")),yl.R7$(3),yl.JRh(e.keyConnectorHostName),yl.R7$(2),yl.Y8G("block",!0)("bitAction",e.convert),yl.R7$(),yl.SpI(" ",yl.bMT(18,20,"continueWithLogIn")," "),yl.R7$(2),yl.Y8G("block",!0)("bitAction",e.leave),yl.R7$(),yl.SpI(" ",yl.bMT(21,22,"doNotContinue")," ")}}class bA{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=()=>mA(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=()=>mA(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 mA(this,void 0,void 0,function*(){const e=yield(0,ho._)(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=kd.getHostname(this.organization.keyConnectorUrl),void(this.loading=!1)))})}get action(){return this.continuing||this.leaving}handleActionError(e){let t="";(e instanceof Mw||e instanceof Error)&&(t=e.message),this.toastService.showToast({variant:"error",title:this.i18nService.t("errorOccurred"),message:t})}}bA.ɵfac=function(e){return new(e||bA)(yl.rXU(za),yl.rXU(ud.Ix),yl.rXU(Ok),yl.rXU(ux),yl.rXU(Pl),yl.rXU(iT),yl.rXU(Bk),yl.rXU(Jd),yl.rXU(xb))},bA.ɵcmp=yl.VBU({type:bA,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&&yl.nVh(0,gA,6,7,"div",0)(1,yA,22,24),2&e&&yl.vxM(t.loading?0:1)},dependencies:[pl.MD,Xu,Ku,Rd,_l,zl,Hl],encapsulation:2});class wA{}var SA=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 kA(e,t){1&e&&(yl.j41(0,"div",0),yl.nrm(1,"i",1),yl.nI1(2,"i18n"),yl.j41(3,"span",2),yl.EFF(4),yl.nI1(5,"i18n"),yl.k0s()()),2&e&&(yl.R7$(),yl.Y8G("title",yl.mNQ(yl.bMT(2,3,"loading"))),yl.R7$(3),yl.JRh(yl.bMT(5,5,"loading")))}function IA(e,t){if(1&e&&(yl.j41(0,"p"),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s(),yl.j41(3,"p",9),yl.EFF(4),yl.nI1(5,"i18n"),yl.k0s(),yl.j41(6,"p",10),yl.EFF(7),yl.k0s()),2&e){const e=yl.XpG(2);yl.R7$(),yl.JRh(yl.bMT(2,3,"confirmKeyConnectorOrganizationUserDescription")),yl.R7$(3),yl.JRh(yl.bMT(5,5,"organization")),yl.R7$(3),yl.JRh(e.organizationName)}}function CA(e,t){1&e&&(yl.j41(0,"p"),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()),2&e&&(yl.R7$(),yl.JRh(yl.bMT(2,1,"verifyYourDomainDescription")))}function TA(e,t){if(1&e&&(yl.nVh(0,IA,8,7)(1,CA,3,3,"p"),yl.j41(2,"p",3),yl.EFF(3),yl.nI1(4,"i18n"),yl.nrm(5,"button",4),yl.nI1(6,"i18n"),yl.k0s(),yl.j41(7,"p",5),yl.EFF(8),yl.k0s(),yl.j41(9,"div",6)(10,"button",7),yl.EFF(11),yl.nI1(12,"i18n"),yl.k0s(),yl.j41(13,"button",8),yl.EFF(14),yl.nI1(15,"i18n"),yl.k0s()()),2&e){const e=yl.XpG();yl.vxM(e.organizationName?0:1),yl.R7$(3),yl.SpI(" ",yl.bMT(4,10,"domain")," "),yl.R7$(2),yl.Y8G("label",yl.bMT(6,12,"keyConnectorDomainTooltip")),yl.R7$(3),yl.JRh(e.keyConnectorHostName),yl.R7$(2),yl.Y8G("bitAction",e.confirm)("block",!0),yl.R7$(),yl.SpI(" ",yl.bMT(12,14,"continueWithLogIn")," "),yl.R7$(2),yl.Y8G("bitAction",e.cancel)("block",!0),yl.R7$(),yl.SpI(" ",yl.bMT(15,16,"doNotContinue")," ")}}class PA{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=()=>SA(this,void 0,void 0,function*(){}),this.confirm=()=>SA(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=()=>SA(this,void 0,void 0,function*(){this.messagingService.send("logout")})}ngOnInit(){return SA(this,void 0,void 0,function*(){try{this.userId=yield(0,ho._)(Gp(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,ho._)(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=kd.getHostname(e.keyConnectorUrl),this.loading=!1})}getOrganizationName(e){return SA(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)}})}}PA.ɵfac=function(e){return new(e||PA)(yl.rXU(ud.Ix),yl.rXU(za),yl.rXU(iT),yl.rXU(ek),yl.rXU(ux),yl.rXU(Ok),yl.rXU(wA),yl.rXU(xb),yl.rXU(Pl),yl.rXU(sk))},PA.ɵcmp=yl.VBU({type:PA,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&&yl.nVh(0,kA,6,7,"div",0)(1,TA,16,18),2&e&&yl.vxM(t.loading?0:1)},dependencies:[pl.MD,Xu,Ku,Rd,_l,zl,Hl],encapsulation:2});var FA=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 RA{constructor(e,t,i){this.i18nService=e,this.sessionTimeoutTypeService=t,this.policyService=i,this.availableTimeoutOptions$=(0,Po.v)(()=>FA(this,void 0,void 0,function*(){const e=this.getAllTimeoutOptions();return(yield Promise.all(e.map(e=>FA(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$(_h.MaximumVaultTimeout,e).pipe(Jp,(0,l.T)(e=>{var t;return null!==(t=null==e?void 0:e.data)&&void 0!==t?t:null}));return(0,$o.z)([this.availableTimeoutOptions$,t,t.pipe((0,yo.H)(e=>FA(this,void 0,void 0,function*(){if(null==e)return null;switch(e.type){case"immediately":return yield this.sessionTimeoutTypeService.getOrPromoteToAvailable(of);case"onSystemLock":return yield this.sessionTimeoutTypeService.getOrPromoteToAvailable(tf)}return null})))]).pipe((0,yo.H)(e=>FA(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!==of&&!cf(e.value)&&e.value!==sf&&e.value!==tf&&e.value!==rf&&e.value!==nf)||e.value===i;case"onAppRestart":return e.value===of||cf(e.value)||e.value===sf||e.value===ef;case"custom":case null:case void 0:return e.value===of||e.value===sf||cf(e.value)&&e.value<=t.minutes;case"never":return!0;default:throw Error(`Unsupported policy type: ${t.type}`)}})})))}getAllTimeoutOptions(){return[{name:"immediately",value:of},{name:"oneMinute",value:af},{name:"fiveMinutes",value:5},{name:"fifteenMinutes",value:15},{name:"thirtyMinutes",value:30},{name:"oneHour",value:60},{name:"fourHours",value:240},{name:"onIdle",value:rf},{name:"onSleep",value:nf},{name:"onLocked",value:tf},{name:"sessionTimeoutOnRestart",value:ef},{name:"never",value:Qp},{name:"custom",value:sf}]}}class xA{}var AA=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 DA=(e,t)=>t.value;function EA(e,t){if(1&e&&(yl.nrm(0,"bit-option",3),yl.nI1(1,"i18n")),2&e){const e=t.$implicit;yl.Y8G("value",e.value)("label",yl.bMT(1,2,e.name))}}function $A(e,t){if(1&e&&(yl.j41(0,"div",4)(1,"bit-form-field",6),yl.nrm(2,"input",7),yl.j41(3,"bit-label"),yl.EFF(4),yl.nI1(5,"i18n"),yl.k0s()(),yl.j41(6,"bit-form-field",8),yl.nrm(7,"input",9),yl.j41(8,"bit-label"),yl.EFF(9),yl.nI1(10,"i18n"),yl.k0s()()()),2&e){const e=yl.XpG();yl.R7$(4),yl.JRh(yl.bMT(5,3,"hours")),yl.R7$(3),yl.Y8G("min",e.customMinutesMin),yl.R7$(2),yl.JRh(yl.bMT(10,5,"minutes"))}}function OA(e,t){if(1&e&&(yl.j41(0,"div",5),yl.nrm(1,"i",10),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s()),2&e){const e=yl.XpG();yl.R7$(2),yl.SpI(" ",yl.brH(3,1,"sessionTimeoutSettingsPolicyMaximumError",e.maxSessionTimeoutPolicyHours,e.maxSessionTimeoutPolicyMinutes)," ")}}function UA(e,t){if(1&e&&(yl.j41(0,"bit-hint",11),yl.EFF(1),yl.k0s()),2&e){yl.XpG();const e=yl.r8f(0);yl.R7$(),yl.SpI(" ",e," ")}}function MA(e,t){if(1&e&&(yl.SS7(0),yl.nI1(1,"async"),yl.nVh(2,UA,2,1,"bit-hint",11)),2&e){const e=yl.bH3(yl.bMT(1,1,yl.XpG().policyTimeoutMessage$));yl.R7$(2),yl.vxM(null!=e?2:-1)}}class NA{constructor(){this.formBuilder=(0,a.WQX)(fl.ok),this.policyService=(0,a.WQX)($b),this.i18nService=(0,a.WQX)(Pl),this.accountService=(0,a.WQX)(Ok),this.destroyRef=(0,a.WQX)(a.abz),this.sessionTimeoutTypeService=(0,a.WQX)(xA),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,[fl.k0.required,fl.k0.min(0)]],minutes:[0,[fl.k0.required,fl.k0.min(0),fl.k0.max(59)]]})},{validators:[this.formValidator.bind(this)]}),this.onChange=null,this.validatorChange=null}get isCustomTimeoutType(){return this.form.controls.vaultTimeout.value===sf}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)===sf&&this.isCustomTimeoutType&&this.getTotalMinutesFromCustomValue(this.form.value.custom)>this.maxSessionTimeoutPolicyMinutes+60*this.maxSessionTimeoutPolicyHours}ngOnInit(){const e=this.accountService.activeAccount$.pipe(Gp,(0,co.n)(e=>this.policyService.policiesByType$(_h.MaximumVaultTimeout,e)),Jp,(0,To.p)(e=>null!=e),(0,l.T)(e=>e.data));this.policyTimeoutMessage$=e.pipe((0,co.n)(e=>this.getPolicyTimeoutMessage(e))),e.pipe((0,wl.pQ)(this.destroyRef)).subscribe(e=>{this.maxSessionTimeoutPolicyData=e,this.form.controls.custom.updateValueAndValidity(),this.validatorChange&&this.validatorChange()}),this.form.valueChanges.pipe((0,wl.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,To.p)(e=>null!=e&&e!==sf),(0,wl.pQ)(this.destroyRef)).subscribe(e=>{const t=cf(e)?e:lf;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:sf,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===sf))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!==sf?null!==(t=e.vaultTimeout)&&void 0!==t?t:null:this.getTotalMinutesFromCustomValue(e.custom)}getPolicyTimeoutMessage(e){return AA(this,void 0,void 0,function*(){const t=yield this.getPolicyAppliedTimeout(e);switch(t){case null:return null;case of:return this.i18nService.t("sessionTimeoutSettingsPolicySetDefaultTimeoutToImmediately");case tf:return this.i18nService.t("sessionTimeoutSettingsPolicySetDefaultTimeoutToOnLocked");case ef:return this.i18nService.t("sessionTimeoutSettingsPolicySetDefaultTimeoutToOnRestart");default:if(cf(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 AA(this,void 0,void 0,function*(){switch(e.type){case"immediately":return yield this.sessionTimeoutTypeService.getOrPromoteToAvailable(of);case"onSystemLock":return yield this.sessionTimeoutTypeService.getOrPromoteToAvailable(tf);case"onAppRestart":return ef;case"never":{const e=yield this.sessionTimeoutTypeService.getOrPromoteToAvailable(Qp);return e==Qp?null:e}default:return e.minutes}})}}NA.MIN_CUSTOM_MINUTES=0,NA.ɵfac=function(e){return new(e||NA)},NA.ɵcmp=yl.VBU({type:NA,selectors:[["bit-session-timeout-input"]],inputs:{availableTimeoutOptions:[1,"availableTimeoutOptions"]},features:[yl.Jv_([{provide:fl.kq,multi:!0,useExisting:NA},{provide:fl.cz,multi:!0,useExisting:NA}])],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&&(yl.j41(0,"div",0)(1,"bit-form-field",1)(2,"bit-label"),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s(),yl.j41(5,"bit-select",2),yl.Z7z(6,EA,2,4,"bit-option",3,DA),yl.k0s()(),yl.nVh(8,$A,11,7,"div",4),yl.nVh(9,OA,4,5,"div",5)(10,MA,3,4),yl.k0s()),2&e&&(yl.Y8G("formGroup",t.form),yl.R7$(),yl.Y8G("disableMargin",!t.isCustomTimeoutType),yl.R7$(2),yl.JRh(yl.bMT(4,5,"vaultTimeout1")),yl.R7$(3),yl.Dyx(t.availableTimeoutOptions()),yl.R7$(2),yl.vxM(t.isCustomTimeoutType?8:-1),yl.R7$(),yl.vxM(t.form.hasError("maxTimeoutError")?9:null!=t.maxSessionTimeoutPolicyData?10:-1))},dependencies:[pl.MD,qf,fl.X1,fl.me,fl.Q0,fl.BC,fl.cb,fl.VZ,fl.zX,fl.j4,fl.JD,fl.$R,Eu,Sc,nu,ou,Du,Bu,Vu,Ou,pl.Jj,Xf],encapsulation:2,changeDetection:0});var VA=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 BA(e,t){if(1&e&&yl.nrm(0,"bit-session-timeout-input",1),2&e){const e=yl.XpG();yl.Y8G("availableTimeoutOptions",t)("formControl",e.formGroup.controls.timeout)}}function jA(e,t){if(1&e&&(yl.nrm(0,"bit-option",4),yl.nI1(1,"i18n")),2&e){const e=t.$implicit;yl.Y8G("value",e)("label",yl.bMT(1,2,e))}}function GA(e,t){1&e&&(yl.j41(0,"bit-hint"),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()),2&e&&(yl.R7$(),yl.JRh(yl.bMT(2,1,"sessionTimeoutSettingsSetUnlockMethodToChangeTimeoutAction")))}function LA(e,t){1&e&&(yl.j41(0,"bit-hint"),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()),2&e&&(yl.R7$(),yl.JRh(yl.bMT(2,1,"sessionTimeoutSettingsManagedByOrganization")))}class zA{constructor(){this.refreshTimeoutActionSettings=(0,o.hFB)(new fd.t(void 0)),this.vaultTimeoutSettingsService=(0,a.WQX)(Ep),this.sessionTimeoutSettingsComponentService=(0,a.WQX)(RA),this.i18nService=(0,a.WQX)(Pl),this.toastService=(0,a.WQX)(xb),this.policyService=(0,a.WQX)($b),this.accountService=(0,a.WQX)(Ok),this.dialogService=(0,a.WQX)(Jd),this.logService=(0,a.WQX)(za),this.destroyRef=(0,a.WQX)(a.abz),this.platformUtilsService=(0,a.WQX)(Eb),this.formGroup=new fl.gE({timeout:new fl.MJ(null,[fl.k0.required]),timeoutAction:new fl.MJ(Zp.Lock,[fl.k0.required])}),this.availableTimeoutActions=(0,a.vPA)([]),this.availableTimeoutOptions$=this.accountService.activeAccount$.pipe(Gp,(0,co.n)(e=>this.sessionTimeoutSettingsComponentService.policyFilteredTimeoutOptions$(e)),(0,Fo.M)(e=>{this.logService.debug("[SessionTimeoutSettings] Available timeout options",e)})),this.sessionTimeoutActionFromPolicy$=this.accountService.activeAccount$.pipe(Gp,(0,co.n)(e=>this.policyService.policiesByType$(_h.MaximumVaultTimeout,e)),Jp,(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,wl.ot)(this.sessionTimeoutActionFromPolicy$)}get canLock(){return this.availableTimeoutActions().includes(Zp.Lock)}get supportsLock(){return this.platformUtilsService.getClientType()!==Ca.Web&&"logOut"!==this.sessionTimeoutActionFromPolicy()}ngOnInit(){return VA(this,void 0,void 0,function*(){this.userId=yield(0,ho._)(Gp(this.accountService.activeAccount$));const e=yield(0,ho._)(this.vaultTimeoutSettingsService.getVaultTimeoutByUserId$(this.userId));this.formGroup.patchValue({timeout:e,timeoutAction:yield(0,ho._)(this.vaultTimeoutSettingsService.getVaultTimeoutActionByUserId$(this.userId))},{emitEvent:!1}),this.vaultTimeoutSettingsService.getVaultTimeoutByUserId$(this.userId).pipe((0,To.p)(e=>this.formGroup.controls.timeout.value!==e),(0,Fo.M)(e=>this.logService.debug(`[SessionTimeoutSettings] Updating initial form timeout from ${this.formGroup.controls.timeout.value} to ${e}`)),(0,wl.pQ)(this.destroyRef)).subscribe(e=>{this.formGroup.controls.timeout.setValue(e,{emitEvent:!1})}),this.refreshTimeoutActionSettings().pipe((0,sd.Z)(void 0),(0,co.n)(()=>(0,$o.z)([this.vaultTimeoutSettingsService.availableVaultTimeoutActions$(this.userId),this.vaultTimeoutSettingsService.getVaultTimeoutActionByUserId$(this.userId),this.sessionTimeoutActionFromPolicy$])),(0,wl.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,sd.Z)(e),(0,To.p)(e=>null!=e),(0,lo.F)(),(0,Qv.J)(),(0,yo.H)(e=>VA(this,[e],void 0,function*([e,t]){yield this.saveTimeout(e,t)})),(0,wl.pQ)(this.destroyRef)).subscribe(),this.formGroup.controls.timeoutAction.valueChanges.pipe((0,To.p)(e=>null!=e),(0,l.T)(e=>VA(this,void 0,void 0,function*(){yield this.saveTimeoutAction(e)})),(0,wl.pQ)(this.destroyRef)).subscribe()})}saveTimeout(e,t){return VA(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===Qp){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,ho._)(this.vaultTimeoutSettingsService.getVaultTimeoutActionByUserId$(this.userId));yield this.vaultTimeoutSettingsService.setVaultTimeoutOptions(this.userId,t,i),this.sessionTimeoutSettingsComponentService.onTimeoutSave(t)})}saveTimeoutAction(e){return VA(this,void 0,void 0,function*(){if(this.logService.debug("[SessionTimeoutSettings] Saving timeout action",e),e===Zp.LogOut){if(!(yield this.dialogService.openSimpleDialog({title:{key:"vaultTimeoutLogOutConfirmationTitle"},content:{key:"vaultTimeoutLogOutConfirmation"},type:"warning"})))return void this.formGroup.controls.timeoutAction.setValue(Zp.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)})}}zA.ɵfac=function(e){return new(e||zA)},zA.ɵcmp=yl.VBU({type:zA,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&&(yl.j41(0,"div",0),yl.nVh(1,BA,1,2,"bit-session-timeout-input",1),yl.nI1(2,"async"),yl.j41(3,"bit-form-field",2)(4,"bit-label"),yl.EFF(5),yl.nI1(6,"i18n"),yl.k0s(),yl.j41(7,"bit-select",3),yl.Z7z(8,jA,2,4,"bit-option",4,yl.fX1),yl.k0s(),yl.nVh(10,GA,3,3,"bit-hint"),yl.nI1(11,"async"),yl.vZN(12,LA,3,3,"bit-hint"),yl.k0s()()),2&e){let e;yl.Y8G("formGroup",t.formGroup),yl.R7$(),yl.vxM((e=yl.bMT(2,7,t.availableTimeoutOptions$))?1:-1,e),yl.R7$(2),yl.Y8G("disableMargin",!0),yl.R7$(2),yl.JRh(yl.bMT(6,9,"sessionTimeoutSettingsAction")),yl.R7$(2),yl.Y8G("formControl",t.formGroup.controls.timeoutAction)("required",!1),yl.R7$(),yl.Dyx(t.availableTimeoutActions()),yl.R7$(2),yl.vxM(!t.canLock&&t.supportsLock?10:null!=yl.bMT(11,11,t.sessionTimeoutActionFromPolicy$)?12:-1)}},dependencies:[id,pl.MD,Eu,Sc,nu,Du,fl.YN,fl.BC,fl.cb,fl.YS,fl.X1,fl.l_,fl.j4,_l,wP,qf,Oh,sw.iI,Bu,Vu,Ou,Xl,NA,pl.Jj,Xf],encapsulation:2});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 KA(e,t){if(1&e&&yl.nrm(0,"bit-option",8),2&e){const e=t.$implicit;yl.Y8G("value",e.value)("label",e.name)}}function XA(e,t){1&e&&(yl.j41(0,"div",9)(1,"bit-form-field",10),yl.nrm(2,"input",11),yl.j41(3,"bit-label"),yl.EFF(4),yl.nI1(5,"i18n"),yl.k0s()(),yl.j41(6,"bit-form-field",12),yl.nrm(7,"input",13),yl.j41(8,"bit-label"),yl.EFF(9),yl.nI1(10,"i18n"),yl.k0s()()()),2&e&&(yl.R7$(4),yl.JRh(yl.bMT(5,2,"hours")),yl.R7$(5),yl.JRh(yl.bMT(10,4,"minutes")))}function qA(e,t){if(1&e&&(yl.j41(0,"bit-hint"),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()),2&e){const e=yl.XpG();yl.R7$(),yl.SpI(" ",yl.brH(2,1,"vaultTimeoutPolicyInEffect1",e.vaultTimeoutPolicyHours,e.vaultTimeoutPolicyMinutes)," ")}}function YA(e,t){1&e&&(yl.j41(0,"small",14),yl.nrm(1,"i",15),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s()),2&e&&(yl.R7$(2),yl.SpI(" ",yl.bMT(3,1,"vaultCustomTimeoutMinimum")," "))}function WA(e,t){if(1&e&&(yl.j41(0,"small",16),yl.nrm(1,"i",15),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s()),2&e){const e=yl.XpG();yl.R7$(2),yl.SpI(" ",yl.brH(3,1,"vaultTimeoutPolicyMaximumError",e.vaultTimeoutPolicyHours,e.vaultTimeoutPolicyMinutes)," ")}}class HA{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=Zp,this.destroy$=new go.B}get showCustom(){return this.form.get("vaultTimeout").value===HA.CUSTOM_VALUE}get exceedsMinimumTimeout(){return!this.showCustom||this.customTimeInMinutes()>HA.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 _A(this,void 0,void 0,function*(){this.accountService.activeAccount$.pipe(Gp,(0,co.n)(e=>this.policyService.policiesByType$(_h.MaximumVaultTimeout,e)),Jp,(0,To.p)(e=>null!=e),(0,Jv.Q)(this.destroy$)).subscribe(e=>{this.vaultTimeoutPolicy=e,this.applyVaultTimeoutPolicy()}),this.form.valueChanges.pipe((0,Jv.Q)(this.destroy$)).subscribe(e=>{this.onChange&&this.onChange(this.getVaultTimeout(e))}),this.form.controls.vaultTimeout.valueChanges.pipe((0,To.p)(e=>e!==HA.CUSTOM_VALUE),(0,Jv.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(Zp.Lock)))})}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}ngOnChanges(){this.vaultTimeoutOptions.find(e=>e.value===HA.CUSTOM_VALUE)||this.vaultTimeoutOptions.push({name:this.i18nService.t("custom"),value:HA.CUSTOM_VALUE})}getVaultTimeout(e){return e.vaultTimeout!==HA.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:HA.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===HA.CUSTOM_VALUE||"number"==typeof e.value&&e.value<=this.vaultTimeoutPolicy.data.minutes),this.validatorChange&&this.validatorChange()}}HA.CUSTOM_VALUE=-100,HA.MIN_CUSTOM_MINUTES=0,HA.ɵfac=function(e){return new(e||HA)(yl.rXU(fl.ok),yl.rXU($b),yl.rXU(Ep),yl.rXU(Pl),yl.rXU(Ok))},HA.ɵcmp=yl.VBU({type:HA,selectors:[["bit-session-timeout-input-legacy"]],inputs:{vaultTimeoutOptions:"vaultTimeoutOptions"},features:[yl.Jv_([{provide:fl.kq,multi:!0,useExisting:HA},{provide:fl.cz,multi:!0,useExisting:HA}]),yl.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&&(yl.j41(0,"div",0)(1,"bit-form-field",1)(2,"bit-label"),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s(),yl.j41(5,"bit-select",2),yl.DNE(6,KA,1,2,"bit-option",3),yl.k0s()(),yl.DNE(7,XA,11,6,"div",4)(8,qA,3,5,"bit-hint",5)(9,YA,4,3,"small",6)(10,WA,4,5,"small",7),yl.k0s()),2&e&&(yl.Y8G("formGroup",t.form),yl.R7$(),yl.Y8G("disableMargin",!t.showCustom),yl.R7$(2),yl.JRh(yl.bMT(4,8,"vaultTimeout1")),yl.R7$(3),yl.Y8G("ngForOf",t.filteredVaultTimeoutOptions),yl.R7$(),yl.Y8G("ngIf",t.showCustom),yl.R7$(),yl.Y8G("ngIf",null!=t.vaultTimeoutPolicy&&!t.exceedsMaximumTimeout),yl.R7$(),yl.Y8G("ngIf",!t.exceedsMinimumTimeout),yl.R7$(),yl.Y8G("ngIf",t.exceedsMaximumTimeout))},dependencies:[pl.MD,pl.Sq,pl.bT,qf,fl.X1,fl.me,fl.Q0,fl.BC,fl.cb,fl.VZ,fl.j4,fl.JD,fl.$R,Eu,Sc,nu,ou,Du,Bu,Vu,Ou,Xf],encapsulation:2});const JA={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 ZA=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 QA(e,t){if(1&e){const e=yl.RV6();yl.qex(0),yl.j41(1,"button",1),yl.nI1(2,"i18n"),yl.nI1(3,"i18n"),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.expand())}),yl.k0s(),yl.bVm()}2&e&&(yl.R7$(),yl.Y8G("label",yl.mNQ(yl.bMT(2,3,"popOutNewWindow")))("title",yl.bMT(3,5,"popOutNewWindow")))}class eD{constructor(e){this.platformUtilsService=e,this.show=!0}ngOnInit(){return ZA(this,void 0,void 0,function*(){this.show&&(rl.inSidebar(window)&&this.platformUtilsService.isFirefox()||rl.inPopout(window))&&(this.show=!1)})}expand(){return ZA(this,void 0,void 0,function*(){yield rl.openCurrentPagePopout(window)})}}eD.ɵfac=function(e){return new(e||eD)(yl.rXU(Eb))},eD.ɵcmp=yl.VBU({type:eD,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&&yl.DNE(0,QA,4,7,"ng-container",0),2&e&&yl.Y8G("ngIf",t.show)},dependencies:[pl.MD,pl.bT,qf,_l,zl,Xf],encapsulation:2});const tD="new_popup",iD=m.record(ae,"popup-view-cache",{deserializer:e=>e}),nD=new m(ae,"popup-route-history-details",{deserializer:e=>e}),rD=new tk("save-view-cache"),sD=new tk("clear-view-cache");var oD=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 aD{get hasRestoredCache(){return this._hasRestoredCache}constructor(){this.router=(0,a.WQX)(ud.Ix),this.state=(0,a.WQX)(d).get(nD),this.location=(0,a.WQX)(sF.aZ),this.hasNavigated=!1,this._hasRestoredCache=!1,this.history$().pipe((0,Yv.$)()).subscribe(e=>Array.isArray(e)&&e.forEach(({url:e})=>this.location.go(e))),this.router.events.pipe((0,To.p)(e=>e instanceof ud.wF),(0,Fo.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,To.p)(({data:e})=>!(null==e?void 0:e.doNotSaveUrl)),(0,co.n)(({event:e,data:t})=>this.push(e.url,t))).subscribe()}history$(){return this.state.state$}setHistory(e){return oD(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 oD(this,void 0,void 0,function*(){var i;if(!rl.inPopup(window)||e===(yield(0,ho._)(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 oD(this,arguments,void 0,function*(e=!1){if(!e&&!rl.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}}aD.ɵfac=function(e){return new(e||aD)},aD.ɵprov=a.jDH({token:aD,factory:aD.ɵfac,providedIn:"root"});const lD=[[["","slot","header"]],[["","slot","full-width-notice"]],[["","slot","above-scroll-area"]],"*",[["","slot","footer"]]],cD=(e,t,i)=>({"tw-invisible !tw-p-0 !tw-border-none":e,"tw-border-secondary-300":t,"tw-border-transparent":i}),uD=(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}),dD=e=>({"tw-invisible":e});class hD{constructor(){this.i18nService=(0,a.WQX)(Pl),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"))}handleScroll(e){this.scrolled.set(0!==e.currentTarget.scrollTop)}}hD.ɵfac=function(e){return new(e||hD)},hD.ɵcmp=yl.VBU({type:hD,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,"scroll","ngClass"],[1,"tw-absolute","tw-inset-0","tw-flex","tw-items-center","tw-justify-center","tw-text-main",3,"ngClass"],[1,"bwi","bwi-spinner","bwi-lg","bwi-spin"]],template:function(e,t){if(1&e){const e=yl.RV6();yl.NAR(lD),yl.SdG(0),yl.j41(1,"main",1),yl.SdG(2,1),yl.j41(3,"div",2,0),yl.SdG(5,2),yl.k0s(),yl.j41(6,"div",3),yl.bIt("scroll",function(i){return a.eBV(e),a.Njj(t.handleScroll(i))}),yl.SdG(7,3),yl.k0s(),yl.j41(8,"span",4),yl.nrm(9,"i",5),yl.k0s()(),yl.SdG(10,4)}if(2&e){const e=yl.sdS(4);yl.R7$(3),yl.Y8G("ngClass",yl.sMw(4,cD,t.loading()||0===e.childElementCount,t.scrolled(),!t.scrolled())),yl.R7$(3),yl.Y8G("ngClass",yl.ziG(8,uD,t.hideOverflow(),!t.hideOverflow(),t.loading(),!t.disablePadding())),yl.R7$(2),yl.Y8G("ngClass",yl.eq3(13,dD,!t.loading())),yl.R7$(),yl.BMQ("aria-label",t.loadingText())}},dependencies:[pl.MD,pl.YU,fh],encapsulation:2,changeDetection:0});var pD=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 fD=["*",[["","slot","end"]]],vD=(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 mD(e,t){if(1&e&&(yl.nrm(0,"button",5),yl.nI1(1,"i18n")),2&e){const e=yl.XpG();yl.Y8G("label",yl.bMT(1,2,"back"))("bitAction",e.backAction)}}function gD(e,t){if(1&e&&(yl.j41(0,"h1",6),yl.EFF(1),yl.k0s()),2&e){const e=yl.XpG();yl.R7$(),yl.SpI(" ",e.pageTitle," ")}}class yD{constructor(){this.popupRouterCacheService=(0,a.WQX)(aD),this.pageContentScrolled=(0,a.WQX)(hD).isScrolled,this.background="default",this._showBackButton=!1,this.backAction=()=>pD(this,void 0,void 0,function*(){return this.popupRouterCacheService.back()})}get showBackButton(){return this._showBackButton}set showBackButton(e){this._showBackButton=(0,HR.he)(e)}}yD.ɵfac=function(e){return new(e||yD)},yD.ɵcmp=yl.VBU({type:yD,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&&(yl.NAR(fD),yl.j41(0,"header",0)(1,"div",1)(2,"div",2),yl.DNE(3,mD,2,4,"button",3)(4,gD,2,1,"h1",4),yl.SdG(5),yl.k0s(),yl.j41(6,"div",2),yl.SdG(7,1),yl.k0s()()()),2&e&&(yl.Y8G("ngClass",yl.ziG(3,vD,"alt"===t.background&&!t.pageContentScrolled(),"alt"===t.background&&t.pageContentScrolled()||"default"===t.background,!t.showBackButton,t.showBackButton)),yl.R7$(3),yl.Y8G("ngIf",t.showBackButton),yl.R7$(),yl.Y8G("ngIf",t.pageTitle))},dependencies:[Xl,Wl,pl.MD,pl.YU,pl.bT,_l,zl,qf,rc,Rd,Xf],encapsulation:2});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())})};class wD{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:["",[fl.k0.required,fl.k0.minLength(4)]],requireMasterPasswordOnClientRestart:!0}),this.submit=()=>bD(this,void 0,void 0,function*(){var e;const t=this.setPinForm.controls.pin,i=this.setPinForm.get("requireMasterPasswordOnClientRestart").value;if(kd.isNullOrWhitespace(t.value)||t.invalid)return;const n=null===(e=yield(0,ho._)(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 bD(this,void 0,void 0,function*(){const e=yield this.userVerificationService.hasMasterPassword();this.setPinForm.controls.requireMasterPasswordOnClientRestart.setValue(e),this.showMasterPasswordOnClientRestartOption=e})}}function SD(e,t){1&e&&(yl.j41(0,"label",9),yl.nrm(1,"input",10),yl.j41(2,"span"),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s()()),2&e&&(yl.R7$(3),yl.JRh(yl.bMT(4,1,"lockWithMasterPassOnRestart1")))}wD.ɵfac=function(e){return new(e||wD)(yl.rXU(Ok),yl.rXU(Xd),yl.rXU(fl.ok),yl.rXU(EF),yl.rXU(bC))},wD.ɵdir=yl.FsC({type:wD});class kD extends wD{static open(e){return e.open(kD)}}kD.ɵfac=(()=>{let e;return function(t){return(e||(e=yl.xGo(kD)))(t||kD)}})(),kD.ɵcmp=yl.VBU({type:kD,selectors:[["ng-component"]],features:[yl.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&&(yl.j41(0,"form",0)(1,"bit-dialog")(2,"div",1),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s(),yl.j41(5,"div",2)(6,"p"),yl.EFF(7),yl.nI1(8,"i18n"),yl.k0s(),yl.j41(9,"bit-form-field")(10,"bit-label"),yl.EFF(11),yl.nI1(12,"i18n"),yl.k0s(),yl.nrm(13,"input",3)(14,"button",4),yl.k0s(),yl.DNE(15,SD,5,3,"label",5),yl.k0s(),yl.qex(16,6),yl.j41(17,"button",7)(18,"span"),yl.EFF(19),yl.nI1(20,"i18n"),yl.k0s()(),yl.j41(21,"button",8),yl.EFF(22),yl.nI1(23,"i18n"),yl.k0s(),yl.bVm(),yl.k0s()()),2&e&&(yl.Y8G("bitSubmit",t.submit)("formGroup",t.setPinForm),yl.R7$(3),yl.SpI(" ",yl.bMT(4,8,"setYourPinTitle")," "),yl.R7$(4),yl.SpI(" ",yl.bMT(8,10,"setPinCode")," "),yl.R7$(4),yl.JRh(yl.bMT(12,12,"pin")),yl.R7$(4),yl.Y8G("ngIf",t.showMasterPasswordOnClientRestartOption),yl.R7$(4),yl.JRh(yl.bMT(20,14,"setYourPinButton")),yl.R7$(3),yl.SpI(" ",yl.bMT(23,16,"cancel")," "))},dependencies:[dh,Zd,uh,pl.MD,pl.bT,qf,Xu,Ku,_l,zl,fl.X1,fl.qT,fl.me,fl.Zm,fl.BC,fl.cb,fl.j4,fl.JD,rc,xd,Td,Eu,Sc,ou,Du,Vb,Bb,Xf],encapsulation:2});class ID{static open(e){return e.open(ID,{positionStrategy:new Yd})}}ID.ɵfac=function(e){return new(e||ID)},ID.ɵcmp=yl.VBU({type:ID,selectors:[["ng-component"]],decls:11,vars:10,consts:[["bitDialogTitle",""],["bitDialogContent",""],["bitDialogFooter",""],["bitButton","","type","button","buttonType","secondary",3,"bitDialogClose"]],template:function(e,t){1&e&&(yl.j41(0,"bit-simple-dialog")(1,"span",0),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.j41(4,"span",1),yl.EFF(5),yl.nI1(6,"i18n"),yl.k0s(),yl.qex(7,2),yl.j41(8,"button",3),yl.EFF(9),yl.nI1(10,"i18n"),yl.k0s(),yl.bVm(),yl.k0s()),2&e&&(yl.R7$(2),yl.JRh(yl.bMT(3,4,"awaitDesktop")),yl.R7$(3),yl.SpI(" ",yl.bMT(6,6,"awaitDesktopDesc")," "),yl.R7$(3),yl.Y8G("bitDialogClose",!1),yl.R7$(),yl.SpI(" ",yl.bMT(10,8,"close")," "))},dependencies:[qf,Xu,Ku,dh,Zd,Vd,Xf],encapsulation:2});class CD{}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){const e=yl.RV6();yl.j41(0,"bit-spotlight",17),yl.nI1(1,"i18n"),yl.nI1(2,"i18n"),yl.bIt("onDismiss",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.dismissAccountSecurityNudge())}),yl.k0s()}2&e&&yl.Y8G("title",yl.bMT(1,2,"unlockVault"))("subtitle",yl.bMT(2,4,"unlockVaultDesc"))}function FD(e,t){if(1&e&&(yl.j41(0,"bit-hint"),yl.EFF(1),yl.k0s()),2&e){const e=yl.XpG();yl.R7$(),yl.SpI(" ",e.biometricUnavailabilityReason," ")}}function RD(e,t){if(1&e&&(yl.j41(0,"bit-form-control",18),yl.nI1(1,"async"),yl.nrm(2,"input",19),yl.j41(3,"bit-label",20),yl.EFF(4),yl.nI1(5,"i18n"),yl.k0s()()),2&e){const e=yl.XpG();yl.Y8G("disableMargin",!(yl.bMT(1,2,e.pinEnabled$)||e.form.value.pin)),yl.R7$(4),yl.SpI(" ",yl.bMT(5,4,"enableAutoBiometricsPrompt")," ")}}function xD(e,t){if(1&e&&(yl.j41(0,"bit-form-control",5),yl.nrm(1,"input",21),yl.j41(2,"bit-label",22),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s()()),2&e){const e=yl.XpG();yl.Y8G("disableMargin",!(e.form.value.pin&&e.showMasterPasswordOnClientRestartOption)),yl.R7$(3),yl.JRh(yl.bMT(4,2,"unlockWithPin"))}}function AD(e,t){1&e&&(yl.j41(0,"bit-form-control",23),yl.nrm(1,"input",24),yl.j41(2,"bit-label",25),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s()()),2&e&&(yl.R7$(3),yl.SpI(" ",yl.bMT(4,1,"lockWithMasterPassOnRestart1")," "))}function DD(e,t){if(1&e&&(yl.j41(0,"bit-section-header")(1,"h2",4),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s()(),yl.j41(4,"bit-card"),yl.nrm(5,"bit-session-timeout-settings",26),yl.k0s()),2&e){const e=yl.XpG();yl.R7$(2),yl.SpI(" ",yl.bMT(3,2,"sessionTimeoutHeader")," "),yl.R7$(3),yl.Y8G("refreshTimeoutActionSettings",e.refreshTimeoutSettings$)}}function ED(e,t){if(1&e&&(yl.nrm(0,"bit-option",32),yl.nI1(1,"i18n")),2&e){const e=t.$implicit;yl.Y8G("value",e)("label",yl.bMT(1,2,e))}}function $D(e,t){1&e&&(yl.j41(0,"bit-hint"),yl.EFF(1),yl.nI1(2,"i18n"),yl.nrm(3,"br"),yl.k0s()),2&e&&(yl.R7$(),yl.SpI(" ",yl.bMT(2,1,"unlockMethodNeededToChangeTimeoutActionDesc")))}function OD(e,t){1&e&&(yl.j41(0,"bit-hint",33),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()),2&e&&(yl.R7$(),yl.SpI(" ",yl.bMT(2,1,"vaultTimeoutPolicyAffectingOptions")," "))}function UD(e,t){if(1&e&&(yl.j41(0,"bit-section-header")(1,"h2",4),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s()(),yl.j41(4,"bit-card"),yl.nrm(5,"bit-session-timeout-input-legacy",27),yl.j41(6,"bit-form-field",14)(7,"bit-label",28),yl.EFF(8),yl.nI1(9,"i18n"),yl.k0s(),yl.j41(10,"bit-select",29),yl.DNE(11,ED,2,4,"bit-option",30),yl.k0s(),yl.DNE(12,$D,4,3,"bit-hint",8),yl.k0s(),yl.DNE(13,OD,3,3,"bit-hint",31),yl.k0s()),2&e){const e=yl.XpG();yl.R7$(2),yl.SpI(" ",yl.bMT(3,7,"vaultTimeoutHeader")," "),yl.R7$(3),yl.Y8G("vaultTimeoutOptions",e.vaultTimeoutOptions)("formControl",e.form.controls.vaultTimeout),yl.R7$(3),yl.JRh(yl.bMT(9,9,"vaultTimeoutAction1")),yl.R7$(3),yl.Y8G("ngForOf",e.availableVaultTimeoutActions),yl.R7$(),yl.Y8G("ngIf",!e.availableVaultTimeoutActions.includes(e.VaultTimeoutAction.Lock)),yl.R7$(),yl.Y8G("ngIf",e.hasVaultTimeoutPolicy)}}function MD(e,t){1&e&&(yl.j41(0,"bit-section")(1,"bit-section-header")(2,"h2",4),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s()(),yl.j41(5,"bit-card")(6,"bit-switch",34)(7,"bit-label",35),yl.EFF(8),yl.nI1(9,"i18n"),yl.k0s(),yl.j41(10,"bit-hint"),yl.EFF(11),yl.nI1(12,"i18n"),yl.k0s()()()()),2&e&&(yl.R7$(3),yl.JRh(yl.bMT(4,3,"phishingBlocker")),yl.R7$(5),yl.JRh(yl.bMT(9,5,"enablePhishingDetection")),yl.R7$(3),yl.JRh(yl.bMT(12,7,"enablePhishingDetectionDesc")))}function ND(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"bit-item")(1,"button",15),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.changePassword())}),yl.EFF(2),yl.nI1(3,"i18n"),yl.nrm(4,"i",16),yl.k0s()()}2&e&&(yl.R7$(2),yl.SpI(" ",yl.bMT(3,1,"changeMasterPassword")," "))}class VD{constructor(e,t,i,n,r,s,o,a,l,c,u,d,h,p,f,v,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=f,this.biometricStateService=v,this.toastService=m,this.biometricsService=g,this.vaultNudgesService=y,this.validationService=b,this.logService=w,this.phishingDetectionSettingsService=S,this.VaultTimeoutAction=Zp,this.showMasterPasswordOnClientRestartOption=!0,this.availableVaultTimeoutActions=[],this.vaultTimeoutOptions=[],this.hasVaultTimeoutPolicy=!1,this.showChangeMasterPass=!0,this.pinEnabled$=(0,Oo.of)(!0),this.form=this.formBuilder.group({vaultTimeout:[null],vaultTimeoutAction:[Zp.Lock],pin:[null],pinLockWithMasterPassword:!1,biometric:!1,enableAutoBiometricsPrompt:!0,enablePhishingDetection:!0}),this.showAccountSecurityNudge$=this.accountService.activeAccount$.pipe(Gp,(0,co.n)(e=>this.vaultNudgesService.showNudgeSpotlight$(VR.AccountSecurity,e))),this.refreshTimeoutSettings$=new fd.t(void 0),this.destroy$=new go.B,this.BIOMETRICS_POLLING_INTERVAL=2e3,this.consolidatedSessionTimeoutComponent$=this.configService.getFeatureFlag$(Nf.ConsolidatedSessionTimeoutComponent),this.phishingDetectionAvailable$=this.phishingDetectionSettingsService.available$}ngOnInit(){return TD(this,void 0,void 0,function*(){const e=yield this.userVerificationService.hasMasterPassword();this.showMasterPasswordOnClientRestartOption=e;const t=this.accountService.activeAccount$.pipe(Gp,(0,co.n)(e=>this.policyService.policiesByType$(_h.MaximumVaultTimeout,e)),Jp);null!=(yield(0,ho._)(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:tf}),this.vaultTimeoutOptions.push({name:this.i18nService.t("onRestart"),value:ef}),this.vaultTimeoutOptions.push({name:this.i18nService.t("never"),value:Qp});const n=yield(0,ho._)(this.accountService.activeAccount$);let r=yield(0,ho._)(this.vaultTimeoutSettingsService.getVaultTimeoutByUserId$(n.id));r!==tf||i||(r=ef),this.pinEnabled$=this.accountService.activeAccount$.pipe(Gp,(0,co.n)(e=>this.policyService.policiesByType$(_h.RemoveUnlockWithPin,e)),Jp,(0,l.T)(e=>null==e||!e.enabled));const s={vaultTimeout:r,vaultTimeoutAction:yield(0,ho._)(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(),enableAutoBiometricsPrompt:yield(0,ho._)(this.biometricStateService.promptAutomatically$),enablePhishingDetection:yield(0,ho._)(this.phishingDetectionSettingsService.enabled$)};this.form.patchValue(s,{emitEvent:!1}),(0,ko.O)(0,this.BIOMETRICS_POLLING_INTERVAL).pipe((0,co.n)(()=>TD(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 tl.permissionsGranted(["nativeMessaging"]))&&!this.platformUtilsService.isSafari())return;const t=yield this.biometricsService.getBiometricsStatusForUser(n.id);t!==gp.DesktopDisconnected||e?t!==gp.NotEnabledInConnectedDesktopApp||e?t!==gp.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,Jv.Q)(this.destroy$)).subscribe(),this.showChangeMasterPass=yield this.userVerificationService.hasMasterPassword(),this.form.controls.vaultTimeout.valueChanges.pipe((0,sd.Z)(s.vaultTimeout),(0,Qv.J)(),(0,yo.H)(e=>TD(this,[e],void 0,function*([e,t]){yield this.saveVaultTimeout(e,t)})),(0,Jv.Q)(this.destroy$)).subscribe(),this.form.controls.vaultTimeoutAction.valueChanges.pipe((0,l.T)(e=>TD(this,void 0,void 0,function*(){yield this.saveVaultTimeoutAction(e)})),(0,Jv.Q)(this.destroy$)).subscribe(),this.form.controls.pin.valueChanges.pipe((0,yo.H)(e=>TD(this,void 0,void 0,function*(){yield this.updatePin(e),this.refreshTimeoutSettings$.next()})),(0,Jv.Q)(this.destroy$)).subscribe(),this.form.controls.pinLockWithMasterPassword.valueChanges.pipe((0,yo.H)(e=>TD(this,void 0,void 0,function*(){const t=(yield(0,ho._)(this.accountService.activeAccount$)).id,i=yield this.pinService.getPin(t);yield this.pinService.setPin(i,e?"EPHEMERAL":"PERSISTENT",t),this.refreshTimeoutSettings$.next()})),(0,Jv.Q)(this.destroy$)).subscribe(),this.form.controls.biometric.valueChanges.pipe((0,lo.F)(),(0,yo.H)(e=>TD(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,Jv.Q)(this.destroy$)).subscribe(),this.form.controls.enableAutoBiometricsPrompt.valueChanges.pipe((0,yo.H)(e=>TD(this,void 0,void 0,function*(){yield this.biometricStateService.setPromptAutomatically(e)})),(0,Jv.Q)(this.destroy$)).subscribe(),this.form.controls.enablePhishingDetection.valueChanges.pipe((0,yo.H)(e=>TD(this,void 0,void 0,function*(){const t=yield(0,ho._)(this.accountService.activeAccount$.pipe(Gp));yield this.phishingDetectionSettingsService.setEnabled(t,e)})),(0,Jv.Q)(this.destroy$)).subscribe(),this.refreshTimeoutSettings$.pipe((0,co.n)(()=>(0,$o.z)([this.vaultTimeoutSettingsService.availableVaultTimeoutActions$(),this.vaultTimeoutSettingsService.getVaultTimeoutActionByUserId$(n.id)])),(0,Jv.Q)(this.destroy$)).subscribe(([e,t])=>{this.availableVaultTimeoutActions=e,this.form.controls.vaultTimeoutAction.setValue(t,{emitEvent:!1}),this.changeDetectorRef.detectChanges()}),this.refreshTimeoutSettings$.pipe((0,co.n)(()=>(0,$o.z)([this.vaultTimeoutSettingsService.availableVaultTimeoutActions$(),t])),(0,Jv.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 TD(this,void 0,void 0,function*(){if(t===Qp){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,ho._)(this.accountService.activeAccount$),n=yield(0,ho._)(this.vaultTimeoutSettingsService.getVaultTimeoutActionByUserId$(i.id));yield this.vaultTimeoutSettingsService.setVaultTimeoutOptions(i.id,t,n),t===Qp&&this.messagingService.send("bgReseedStorage")})}dismissAccountSecurityNudge(){return TD(this,void 0,void 0,function*(){const e=yield(0,ho._)(this.accountService.activeAccount$);e&&(yield this.vaultNudgesService.dismissNudge(VR.AccountSecurity,e.id))})}saveVaultTimeoutAction(e){return TD(this,void 0,void 0,function*(){if(e===Zp.LogOut){if(!(yield this.dialogService.openSimpleDialog({title:{key:"vaultTimeoutLogOutConfirmationTitle"},content:{key:"vaultTimeoutLogOutConfirmation"},type:"warning"})))return void this.form.controls.vaultTimeoutAction.setValue(Zp.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,ho._)(this.accountService.activeAccount$);yield this.vaultTimeoutSettingsService.setVaultTimeoutOptions(t.id,this.form.value.vaultTimeout,e),this.refreshTimeoutSettings$.next()})}updatePin(e){return TD(this,void 0,void 0,function*(){if(e){const e=kD.open(this.dialogService);if(null==e)return void this.form.controls.pin.setValue(!1,{emitEvent:!1});const t=yield(0,ho._)(this.accountService.activeAccount$.pipe((0,l.T)(e=>e.id))),i=yield(0,ho._)(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(VR.AccountSecurity,t))}else{const e=yield(0,ho._)(this.accountService.activeAccount$.pipe(Gp));yield this.pinService.unsetPin(e)}})}updateBiometric(e){return TD(this,void 0,void 0,function*(){if(e){let e;try{e=yield tl.requestPermission({permissions:["nativeMessaging"]})}catch(e){if(console.error(e),this.platformUtilsService.isFirefox()&&rl.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,ho._)(this.accountService.activeAccount$.pipe(Gp));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 TD(this,void 0,void 0,function*(){let e,t=!1,i=!1;return yield Promise.all([(()=>TD(this,void 0,void 0,function*(){yield new Promise(e=>setTimeout(e,500)),t||(e=ID.open(this.dialogService),yield(0,ho._)(e.closed),t||(i=!1))}))(),(()=>TD(this,void 0,void 0,function*(){try{const n=yield(0,ho._)(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=JA[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 TD(this,void 0,void 0,function*(){yield this.biometricStateService.setPromptAutomatically(this.form.value.enableAutoBiometricsPrompt)})}changePassword(){return TD(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,ho._)(this.environmentService.environment$);yield tl.createNewTab(e.getWebVaultUrl())}})}twoStep(){return TD(this,void 0,void 0,function*(){(yield this.dialogService.openSimpleDialog({title:{key:"twoStepLoginConfirmationTitle"},content:{key:"twoStepLoginConfirmationContent"},type:"info",acceptButtonText:{key:"continue"},cancelButtonText:{key:"cancel"}}))&&tl.createNewTab("https://bitwarden.com/help/setup-two-step-login/")})}openAcctFingerprintDialog(){return TD(this,void 0,void 0,function*(){const e=yield(0,ho._)(Gp(this.accountService.activeAccount$)),t=yield(0,ho._)(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=Yf.open(this.dialogService,{fingerprint:i});return(0,ho._)(n.closed)})}lock(){return TD(this,void 0,void 0,function*(){const e=yield(0,ho._)(Gp(this.accountService.activeAccount$));yield this.lockService.lock(e)})}logOut(){return TD(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,ho._)(this.accountService.activeAccount$))||void 0===e?void 0:e.id;t&&this.messagingService.send("logout",{userId:i})})}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}}VD.ɵfac=function(e){return new(e||VD)(yl.rXU(Ok),yl.rXU(uk),yl.rXU(EF),yl.rXU($b),yl.rXU(fl.ok),yl.rXU(Eb),yl.rXU(Pl),yl.rXU(_S),yl.rXU(Ep),yl.rXU(ek),yl.rXU(JS),yl.rXU(Cp),yl.rXU(bC),yl.rXU(Jd),yl.rXU(o.gRc),yl.rXU(wp),yl.rXU(xb),yl.rXU(kp),yl.rXU(jR),yl.rXU(Cd),yl.rXU(za),yl.rXU(CD))},VD.ɵcmp=yl.VBU({type:VD,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&&(yl.j41(0,"popup-page")(1,"popup-header",0),yl.nI1(2,"i18n"),yl.qex(3,1),yl.nrm(4,"app-pop-out"),yl.bVm(),yl.k0s(),yl.DNE(5,PD,3,6,"bit-spotlight",2),yl.nI1(6,"async"),yl.j41(7,"div",3)(8,"bit-section")(9,"bit-section-header")(10,"h2",4),yl.EFF(11),yl.nI1(12,"i18n"),yl.k0s()(),yl.j41(13,"bit-card")(14,"bit-form-control",5),yl.nI1(15,"async"),yl.nrm(16,"input",6),yl.j41(17,"bit-label",7),yl.EFF(18),yl.nI1(19,"i18n"),yl.k0s(),yl.DNE(20,FD,2,1,"bit-hint",8),yl.k0s(),yl.DNE(21,RD,6,6,"bit-form-control",9)(22,xD,5,4,"bit-form-control",10),yl.nI1(23,"async"),yl.DNE(24,AD,5,3,"bit-form-control",11),yl.k0s()(),yl.j41(25,"bit-section"),yl.nVh(26,DD,6,4),yl.nI1(27,"async"),yl.vZN(28,UD,14,11),yl.k0s(),yl.j41(29,"bit-section")(30,"bit-section-header")(31,"h2",4),yl.EFF(32),yl.nI1(33,"i18n"),yl.k0s()(),yl.j41(34,"bit-item")(35,"button",12),yl.EFF(36),yl.nI1(37,"i18n"),yl.nrm(38,"i",13),yl.k0s()()(),yl.DNE(39,MD,13,9,"bit-section",8),yl.nI1(40,"async"),yl.j41(41,"bit-section",14)(42,"bit-section-header")(43,"h2",4),yl.EFF(44),yl.nI1(45,"i18n"),yl.k0s()(),yl.j41(46,"bit-item")(47,"button",15),yl.bIt("click",function(){return t.openAcctFingerprintDialog()}),yl.EFF(48),yl.nI1(49,"i18n"),yl.k0s()(),yl.j41(50,"bit-item")(51,"button",15),yl.bIt("click",function(){return t.twoStep()}),yl.EFF(52),yl.nI1(53,"i18n"),yl.nrm(54,"i",16),yl.k0s()(),yl.DNE(55,ND,5,3,"bit-item",8),yl.k0s()()()),2&e&&(yl.R7$(),yl.Y8G("pageTitle",yl.mNQ(yl.bMT(2,19,"accountSecurity"))),yl.R7$(4),yl.Y8G("ngIf",yl.bMT(6,21,t.showAccountSecurityNudge$)),yl.R7$(2),yl.Y8G("formGroup",t.form),yl.R7$(4),yl.JRh(yl.bMT(12,23,"unlockMethods")),yl.R7$(3),yl.Y8G("disableMargin",!(yl.bMT(15,25,t.pinEnabled$)||t.form.value.pin)),yl.R7$(4),yl.SpI(" ",yl.bMT(19,27,"unlockWithBiometrics")," "),yl.R7$(2),yl.Y8G("ngIf",t.biometricUnavailabilityReason),yl.R7$(),yl.Y8G("ngIf",t.form.value.biometric),yl.R7$(),yl.Y8G("ngIf",yl.bMT(23,29,t.pinEnabled$)||t.form.value.pin),yl.R7$(2),yl.Y8G("ngIf",t.form.value.pin&&t.showMasterPasswordOnClientRestartOption),yl.R7$(2),yl.vxM(yl.bMT(27,31,t.consolidatedSessionTimeoutComponent$)?26:28),yl.R7$(6),yl.JRh(yl.bMT(33,33,"manageDevices")),yl.R7$(4),yl.SpI(" ",yl.bMT(37,35,"devices")," "),yl.R7$(3),yl.Y8G("ngIf",yl.bMT(40,37,t.phishingDetectionAvailable$)),yl.R7$(5),yl.JRh(yl.bMT(45,39,"otherOptions")),yl.R7$(4),yl.SpI(" ",yl.bMT(49,41,"fingerprintPhrase")," "),yl.R7$(4),yl.SpI(" ",yl.bMT(53,43,"twoStepLogin")," "),yl.R7$(3),yl.Y8G("ngIf",t.showChangeMasterPass))},dependencies:[WR,id,Ub,pl.MD,pl.Sq,pl.bT,Eu,hc,Sc,nu,Du,fl.YN,fl.me,fl.Zm,fl.BC,fl.cb,fl.X1,fl.l_,fl.j4,fl.JD,_l,wP,IP,FP,qf,sP,Oh,eD,yD,hD,sw.iI,sw.Wk,ZR,ex,Bu,Vu,Ou,zA,qR,Xl,Wl,HA,lx,pl.Jj,Xf],encapsulation:2});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())})};const jD=new k(Q,"autofillOnPageLoad",{deserializer:e=>null!=e&&e,clearOn:[]}),GD=new k(Q,"autofillOnPageLoadDefault",{deserializer:e=>null!=e&&e,clearOn:[]}),LD=new k(Q,"autofillOnPageLoadCalloutIsDismissed",{deserializer:e=>null!=e&&e,clearOn:[]}),zD=new k(Q,"autofillOnPageLoadPolicyToastHasDisplayed",{deserializer:e=>null!=e&&e,clearOn:[]}),_D=new k(Q,"autoCopyTotp",{deserializer:e=>null==e||e,clearOn:[]}),KD=new m(ee,"inlineMenuVisibility",{deserializer:e=>null!=e?e:pa}),XD=new k(Q,"showInlineMenuIdentities",{deserializer:e=>null==e||e,clearOn:[]}),qD=new k(Q,"showInlineMenuCards",{deserializer:e=>null==e||e,clearOn:[]}),YD=new m(Q,"enableContextMenu",{deserializer:e=>null==e||e}),WD=new k(ee,"clearClipboardDelay",{deserializer:e=>null!=e?e:na,clearOn:[]});class HD{}class JD{constructor(e,t,i,n){this.stateProvider=e,this.policyService=t,this.accountService=i,this.restrictedItemTypesService=n,this.autofillOnPageLoadState=this.stateProvider.getActive(jD),this.autofillOnPageLoad$=this.autofillOnPageLoadState.state$.pipe((0,l.T)(e=>null!=e&&e)),this.autofillOnPageLoadDefaultState=this.stateProvider.getActive(GD),this.autofillOnPageLoadDefault$=this.autofillOnPageLoadDefaultState.state$.pipe((0,l.T)(e=>null==e||e)),this.autofillOnPageLoadCalloutIsDismissedState=this.stateProvider.getActive(LD),this.autofillOnPageLoadCalloutIsDismissed$=this.autofillOnPageLoadCalloutIsDismissedState.state$.pipe((0,l.T)(e=>null!=e&&e)),this.activateAutofillOnPageLoadFromPolicy$=this.accountService.activeAccount$.pipe(Gp,(0,co.n)(e=>this.policyService.policyAppliesToUser$(_h.ActivateAutofill,e))),this.autofillOnPageLoadPolicyToastHasDisplayedState=this.stateProvider.getActive(zD),this.autofillOnPageLoadPolicyToastHasDisplayed$=this.autofillOnPageLoadPolicyToastHasDisplayedState.state$.pipe((0,l.T)(e=>null!=e&&e)),this.autoCopyTotpState=this.stateProvider.getActive(_D),this.autoCopyTotp$=this.autoCopyTotpState.state$.pipe((0,l.T)(e=>null==e||e)),this.inlineMenuVisibilityState=this.stateProvider.getGlobal(KD),this.inlineMenuVisibility$=this.inlineMenuVisibilityState.state$.pipe((0,l.T)(e=>null!=e?e:pa)),this.showInlineMenuIdentitiesState=this.stateProvider.getActive(XD),this.showInlineMenuIdentities$=this.showInlineMenuIdentitiesState.state$.pipe((0,l.T)(e=>null==e||e)),this.showInlineMenuCardsState=this.stateProvider.getActive(qD),this.showInlineMenuCards$=(0,$o.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===CR.Card))),this.enableContextMenuState=this.stateProvider.getGlobal(YD),this.enableContextMenu$=this.enableContextMenuState.state$.pipe((0,l.T)(e=>null==e||e)),this.clearClipboardDelayState=this.stateProvider.getActive(WD),this.clearClipboardDelay$=this.clearClipboardDelayState.state$.pipe((0,l.T)(e=>null!=e?e:na))}setAutofillOnPageLoad(e){return BD(this,void 0,void 0,function*(){yield this.autofillOnPageLoadState.update(()=>e)})}setAutofillOnPageLoadDefault(e){return BD(this,void 0,void 0,function*(){yield this.autofillOnPageLoadDefaultState.update(()=>e)})}setAutofillOnPageLoadCalloutIsDismissed(e){return BD(this,void 0,void 0,function*(){yield this.autofillOnPageLoadCalloutIsDismissedState.update(()=>e)})}setAutofillOnPageLoadPolicyToastHasDisplayed(e){return BD(this,void 0,void 0,function*(){yield this.autofillOnPageLoadPolicyToastHasDisplayedState.update(()=>e)})}setAutoCopyTotp(e){return BD(this,void 0,void 0,function*(){yield this.autoCopyTotpState.update(()=>e)})}setInlineMenuVisibility(e){return BD(this,void 0,void 0,function*(){yield this.inlineMenuVisibilityState.update(()=>e)})}setShowInlineMenuIdentities(e){return BD(this,void 0,void 0,function*(){yield this.showInlineMenuIdentitiesState.update(()=>e)})}setShowInlineMenuCards(e){return BD(this,void 0,void 0,function*(){yield this.showInlineMenuCardsState.update(()=>e)})}setEnableContextMenu(e){return BD(this,void 0,void 0,function*(){yield this.enableContextMenuState.update(()=>e)})}setClearClipboardDelay(e){return BD(this,void 0,void 0,function*(){yield this.clearClipboardDelayState.update(()=>e)})}}const ZD={Domain:0,Host:1,StartsWith:2,Exact:3,RegularExpression:4,Never:5};function QD(e){if(null!=e)switch(e){case 0:case 1:case 2:case 3:case 4:case 5:return e;default:return}}var eE=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 tE=new m(Z,"showFavicons",{deserializer:e=>null==e||e}),iE=new m(Z,"neverDomains",{deserializer:e=>null!=e?e:null}),nE=new m(Z,"blockedInteractionsUris",{deserializer:e=>null!=e?e:{}}),rE=new k(Z,"equivalentDomains",{deserializer:e=>null!=e?e:null,clearOn:["logout"]}),sE=new k(Z,"defaultUriMatchStrategy",{deserializer:e=>null!=e?e:ZD.Domain,clearOn:[]});class oE{}class aE{constructor(e,t,i){this.stateProvider=e,this.policyService=t,this.accountService=i,this.showFaviconsState=this.stateProvider.getGlobal(tE),this.showFavicons$=this.showFaviconsState.state$.pipe((0,l.T)(e=>null==e||e)),this.neverDomainsState=this.stateProvider.getGlobal(iE),this.neverDomains$=this.neverDomainsState.state$.pipe((0,l.T)(e=>null!=e?e:null)),this.blockedInteractionsUrisState=this.stateProvider.getGlobal(nE),this.blockedInteractionsUris$=this.blockedInteractionsUrisState.state$.pipe((0,l.T)(e=>null!=e?e:{})),this.equivalentDomainsState=this.stateProvider.getActive(rE),this.equivalentDomains$=this.equivalentDomainsState.state$.pipe((0,l.T)(e=>null!=e?e:null)),this.defaultUriMatchStrategyState=this.stateProvider.getActive(sE),this.defaultUriMatchStrategy$=this.defaultUriMatchStrategyState.state$.pipe((0,l.T)(e=>null!=e?e:ZD.Domain)),this.defaultUriMatchStrategyPolicy$=this.accountService.activeAccount$.pipe(Gp,(0,co.n)(e=>this.policyService.policiesByType$(_h.UriMatchDefaults,e)),Jp,(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(ZD).includes(i)?i:null}),(0,Pp.t)({bufferSize:1,refCount:!0})),this.resolvedDefaultUriMatchStrategy$=(0,$o.z)([this.defaultUriMatchStrategy$,this.defaultUriMatchStrategyPolicy$]).pipe((0,l.T)(([e,t])=>t||e),(0,Pp.t)({bufferSize:1,refCount:!0}))}setShowFavicons(e){return eE(this,void 0,void 0,function*(){yield this.showFaviconsState.update(()=>e)})}setNeverDomains(e){return eE(this,void 0,void 0,function*(){yield this.neverDomainsState.update(()=>e)})}setBlockedInteractionsUris(e){return eE(this,void 0,void 0,function*(){yield this.blockedInteractionsUrisState.update(()=>e)})}setEquivalentDomains(e,t){return eE(this,void 0,void 0,function*(){yield this.stateProvider.getUser(t,rE).update(()=>e)})}setDefaultUriMatchStrategy(e){return eE(this,void 0,void 0,function*(){yield this.defaultUriMatchStrategyState.update(()=>e)})}getUrlEquivalentDomains(e){return this.equivalentDomains$.pipe((0,l.T)(t=>{const i=kd.getDomain(e);if(null==i||null==t)return new Set;const n=t.filter(e=>e.includes(i)).flat();return new Set(n)}))}}const lE=["https://","http://","ssh://","ftp://","sftp://","irc://","vnc://","rdp://","ms-rd:","chrome://","iosapp://","androidapp://"];class cE{static canLaunch(e){if(kd.isNullOrWhitespace(e))return!1;for(let t=0;t"object"==typeof e.type||"string"==typeof e.type,hE.getLogin=e=>dE.isCipherListView(e)?"object"!=typeof e.type?null:"login"in e.type?e.type.login:null:e.type===CR.Login?e.login:null,hE.uri=e=>{var t;const i=dE.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},hE.getCard=e=>dE.isCipherListView(e)?"object"!=typeof e.type?null:"card"in e.type?e.type.card:null:e.type===CR.Card?e.card:null,hE.isArchived=e=>dE.isCipherListView(e)?!!e.archivedDate:e.isArchived,hE.isDeleted=e=>dE.isCipherListView(e)?!!e.deletedDate:e.isDeleted,hE.isUnassigned=e=>dE.isCipherListView(e)?null!=e.organizationId&&(null==e.collectionIds||0===e.collectionIds.length):e.isUnassigned,hE.canAssignToCollections=e=>dE.isCipherListView(e)?!e.organizationId||e.edit&&e.viewPassword:e.canAssignToCollections,hE.getType=e=>{if(!dE.isCipherListView(e))return e.type;switch(!0){case"secureNote"===e.type:return CR.SecureNote;case"sshKey"===e.type:return CR.SshKey;case"identity"===e.type:return CR.Identity;case"object"==typeof e.type&&"card"in e.type:return CR.Card;case"object"==typeof e.type&&"login"in e.type:return CR.Login;default:throw new Error(`Unknown cipher type: ${e.type}`)}},hE.subtitle=e=>dE.isCipherListView(e)?e.subtitle:e.subTitle,hE.hasAttachments=e=>dE.isCipherListView(e)?"number"==typeof e.attachments&&e.attachments>0:e.hasAttachments,hE.canLaunch=e=>{var t;const i=dE.getLogin(e);return!!i&&!!(null===(t=i.uris)||void 0===t?void 0:t.map(e=>fE(e)).some(e=>e.canLaunch))},hE.getLaunchUri=e=>{var t,i;const n=dE.getLogin(e);if(n)return null===(i=null===(t=n.uris)||void 0===t?void 0:t.map(e=>fE(e)).find(e=>e.canLaunch))||void 0===i?void 0:i.launchUri},hE.matchesUri=(e,t,i,n=ZD.Domain,r)=>{var s;if(dE.getType(e)!==CR.Login)return!1;if(!dE.isCipherListView(e))return e.login.matchesUri(t,i,n,r);const o=dE.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 uE;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))},hE.hasCopyableValue=(e,t)=>{var i,n,r,s,o,a,l,c,u,d,h,p;if(dE.isCipherListView(e)){let i=t;return"username"===i&&dE.getType(e)===CR.Login?i="usernameLogin":"username"===i&&dE.getType(e)===CR.Identity&&(i="usernameIdentity"),e.copyableFields.includes(pE[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}},hE.hasFido2Credentials=e=>{var t;const i=dE.getLogin(e);return!!(null===(t=null==i?void 0:i.fido2Credentials)||void 0===t?void 0:t.length)},hE.decryptionFailure=e=>"decryptionFailure"in e&&e.decryptionFailure;const pE={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"},fE=e=>{if(e instanceof uE)return e;const t=new uE;return e.match&&(t.match=e.match),e.uri&&(t.uri=e.uri),t};class vE{constructor(e,t,i){this.accountService=e,this.organizationService=t,this.policyService=i,this.restricted$=this.accountService.activeAccount$.pipe(Lp,(0,co.n)(e=>null==e?(0,Oo.of)([]):(0,$o.z)([this.organizationService.organizations$(e),this.policyService.policiesByType$(_h.RestrictedItemTypes,e)]).pipe((0,l.T)(([e,t])=>{const i=e=>{var t;return null!==(t=e.data)&&void 0!==t?t:[CR.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,lo.F)(),(0,Pp.t)({bufferSize:1,refCount:!0}))}isCipherRestricted(e,t){const i=t.find(t=>t.cipherType===hE.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 mE=0,gE=1,yE=0;class bE{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 wE{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 wE({}),e,{creationDate:new Date(e.creationDate),revisionDate:new Date(e.revisionDate)})}}class SE extends Uw{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 kE{}function IE(e,t=void 0){const i=new Map;return n=>{let r=i.get(n);return r||(null!=t||(t=$p.w),r=(0,bo.h)(e(n),t.pipe((0,To.p)(e=>e===n||null===e),(0,l.T)(()=>null))).pipe((0,Pp.t)({bufferSize:1,refCount:!1})),i.set(n,r)),r}}function CE(){return(0,To.p)(e=>null!=e)}const TE=k.array(Ee,"securityTasks",{deserializer:e=>wE.fromJSON(e),clearOn:["logout","lock"]});var PE=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 FE=(0,l.T)(e=>Object.entries(null!=e?e:{}).filter(([,e])=>e>=cd.Unlocked).map(([e])=>e));const RE=new k(Ne,"atRiskPasswords",{deserializer:e=>e,clearOn:["lock","logout"]});class xE{constructor(e,t,i){this.taskService=e,this.cipherService=t,this.stateProvider=i}pendingTasks$(e){return(0,$o.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===yE&&i&&i.edit&&i.viewPassword&&!i.isDeleted})))}completedTasks$(e){return this.taskService.completedTasks$(e).pipe((0,l.T)(e=>e.find(e=>e.type===yE)))}showCompletedTasksBanner$(e){return(0,$o.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,RE)}updateAtRiskPasswordState(e,t){this.atRiskPasswordState(e).update(()=>t)}}xE.ɵfac=function(e){return new(e||xE)(a.KVO(kE),a.KVO(Fb),a.KVO(u))},xE.ɵprov=a.jDH({token:xE,factory:xE.ɵfac});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())})};class DE{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:[fl.k0.required],updateOn:"submit"}]}),this.submit=()=>AE(this,void 0,void 0,function*(){if(!this.formGroup.value.masterPassword)return;const e=yield(0,ho._)(Gp(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")})})}}DE.ɵfac=function(e){return new(e||DE)(yl.rXU(Cp),yl.rXU(Eb),yl.rXU(Pl),yl.rXU(fl.ok),yl.rXU(Xd),yl.rXU(xb),yl.rXU(Ok))},DE.ɵcmp=yl.VBU({type:DE,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&&(yl.j41(0,"form",0)(1,"bit-dialog")(2,"span",1),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s(),yl.qex(5,2),yl.EFF(6),yl.nI1(7,"i18n"),yl.j41(8,"bit-form-field",3)(9,"bit-label"),yl.EFF(10),yl.nI1(11,"i18n"),yl.k0s(),yl.nrm(12,"input",4)(13,"button",5),yl.k0s(),yl.bVm(),yl.qex(14,6),yl.j41(15,"button",7)(16,"span"),yl.EFF(17),yl.nI1(18,"i18n"),yl.k0s()(),yl.j41(19,"button",8),yl.EFF(20),yl.nI1(21,"i18n"),yl.k0s(),yl.bVm(),yl.k0s()()),2&e&&(yl.Y8G("formGroup",t.formGroup)("bitSubmit",t.submit),yl.R7$(3),yl.SpI(" ",yl.bMT(4,7,"passwordConfirmation")," "),yl.R7$(3),yl.SpI(" ",yl.bMT(7,9,"passwordConfirmationDesc")," "),yl.R7$(4),yl.JRh(yl.bMT(11,11,"masterPass")),yl.R7$(7),yl.JRh(yl.bMT(18,13,"ok")),yl.R7$(3),yl.SpI(" ",yl.bMT(21,15,"cancel")," "))},dependencies:[qf,hk,rc,xd,Td,Xu,Ku,dh,Zd,uh,Eu,Sc,ou,Du,Vb,Bb,_l,zl,fl.X1,fl.qT,fl.me,fl.BC,fl.cb,fl.j4,fl.JD,Xf],encapsulation:2});var EE=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 $E{constructor(e,t){this.dialogService=e,this.userVerificationService=t,this.enabled$=kd.asyncToObservable(()=>this.userVerificationService.hasMasterPasswordAndMasterKeyHash())}protectedFields(){return["TOTP","Password","H_Field","Card Number","Security Code"]}passwordRepromptCheck(e){return EE(this,void 0,void 0,function*(){return e.reprompt===kR.None||(yield this.showPasswordPrompt())})}showPasswordPrompt(){return EE(this,void 0,void 0,function*(){if(!(yield this.enabled()))return!0;const e=this.dialogService.open(DE,{ariaModal:!0});return!0===(yield(0,dT.s)(e.closed))})}enabled(){return(0,ho._)(this.enabled$)}}$E.ɵfac=function(e){return new(e||$E)(a.KVO(Jd),a.KVO(bC))},$E.ɵprov=a.jDH({token:$E,factory:$E.ɵfac});class OE{}class UE{}class ME{}var NE=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 VE={username:{typeI18nKey:"username",protected:!1},password:{typeI18nKey:"password",protected:!0,event:Ra.Cipher_ClientCopiedPassword},totp:{typeI18nKey:"verificationCodeTotp",protected:!0},cardNumber:{typeI18nKey:"number",protected:!0},securityCode:{typeI18nKey:"securityCode",protected:!0,event:Ra.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:Ra.Cipher_ClientCopiedHiddenField}};class BE{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 NE(this,arguments,void 0,function*(e,t,i,n=!1){const r=VE[t];if(!n&&i.reprompt!==kR.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,ho._)(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 NE(this,void 0,void 0,function*(){const t=yield(0,ho._)(this.accountService.activeAccount$);if(!(null==t?void 0:t.id))return!1;const i=hE.getLogin(e);return!!(null==i?void 0:i.totp)&&(e.organizationUseTotp||(yield(0,ho._)(this.billingAccountProfileStateService.hasPremiumFromAnySource$(t.id))))})}}BE.ɵfac=function(e){return new(e||BE)(a.KVO(Eb),a.KVO(xb),a.KVO(OE),a.KVO($E),a.KVO(UE),a.KVO(Pl),a.KVO(ME),a.KVO(Ok))},BE.ɵprov=a.jDH({token:BE,factory:BE.ɵfac,providedIn:"root"});const jE=[[["","slot","start"]],"*",[["","slot","end"]]],GE=e=>({"tw-hidden":e});class LE{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()}}LE.ɵfac=function(e){return new(e||LE)(yl.rXU(yl.aKT))},LE.ɵcmp=yl.VBU({type:LE,selectors:[["","bitMenuItem",""]],hostVars:5,hostBindings:function(e,t){2&e&&(yl.Avn("tabIndex",t.tabIndex),yl.BMQ("role",t.role)("disabled",t.disabledAttr),yl.HbH(t.classList))},inputs:{disabled:[2,"disabled","disabled",HR.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&&(yl.NAR(jE),yl.j41(0,"div",2)(1,"span",3)(2,"span",4,0),yl.SdG(4),yl.k0s(),yl.j41(5,"span",5),yl.SdG(6,1),yl.k0s()(),yl.j41(7,"span",4,1),yl.SdG(9,2),yl.k0s()()),2&e){const e=yl.sdS(3),t=yl.sdS(8);yl.R7$(2),yl.Y8G("ngClass",yl.eq3(2,GE,0===e.childElementCount)),yl.R7$(5),yl.Y8G("ngClass",yl.eq3(4,GE,0===t.childElementCount))}},dependencies:[pl.YU],encapsulation:2});var zE,_E,KE,XE,qE,YE,WE,HE=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 JE{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 HE(this,void 0,void 0,function*(){const e=yield this.getValueToCopy();yield this.copyCipherFieldService.copy(null!=e?e:"",this.action,this.cipher)})}ngOnChanges(){return HE(this,void 0,void 0,function*(){yield this.updateDisabledState()})}updateDisabledState(){return HE(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 hE.hasCopyableValue(this.cipher,this.action)}getValueToCopy(){return HE(this,void 0,void 0,function*(){var e,t,i,n,r,s,o,a,l,c,u,d;let h;if(hE.isCipherListView(this.cipher)){const e=yield(0,ho._)(this.accountService.activeAccount$.pipe(Gp)),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}})}}JE.ɵfac=function(e){return new(e||JE)(yl.rXU(BE),yl.rXU(Ok),yl.rXU(Fb),yl.rXU(LE,8),yl.rXU(zl,8))},JE.ɵdir=yl.FsC({type:JE,selectors:[["","appCopyField",""]],hostVars:3,hostBindings:function(e,t){1&e&&yl.bIt("click",function(){return t.copy()}),2&e&&(yl.BMQ("disabled",t.disabled),yl.AVh("tw-hidden",t.hidden))},inputs:{action:[0,"appCopyField","action"],cipher:"cipher"},features:[yl.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"}(zE||(zE={})),function(e){e[e.FamiliesForEnterprise=0]="FamiliesForEnterprise"}(_E||(_E={})),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"}(KE||(KE={})),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"}(XE||(XE={})),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"}(qE||(qE={})),function(e){e[e.PasswordManager=0]="PasswordManager",e[e.SecretsManager=1]="SecretsManager"}(YE||(YE={})),function(e){e[e.Monthly=0]="Monthly",e[e.Annually=1]="Annually"}(WE||(WE={}));class ZE{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 qE.Free:case qE.Families:return"bwi-family";case qE.Teams:case qE.Enterprise:case qE.TeamsStarter:return"bwi-business";default:return""}}get classList(){return["bwi",this.iconSize,this.orgIcon]}}ZE.ɵfac=function(e){return new(e||ZE)(yl.rXU(yl.aKT),yl.rXU(yl.sFG))},ZE.ɵdir=yl.FsC({type:ZE,selectors:[["","appOrgIcon",""]],hostVars:2,hostBindings:function(e,t){2&e&&yl.HbH(t.classList)},inputs:{tierType:"tierType",size:"size"}});const QE=e=>(0,l.T)(t=>t.find(t=>t.id===e)),e$=e=>{const t=new Set(e);return(0,l.T)(e=>e.filter(e=>e.id&&t.has(e.id)))};class t${}class i${set cipher(e){this.viewContainer.clear(),this.cipherAuthorizationService.canDeleteCipher$(e).pipe((0,Jv.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 go.B}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}}i$.ɵfac=function(e){return new(e||i$)(yl.rXU(yl.C4Q),yl.rXU(yl.c1b),yl.rXU(t$))},i$.ɵdir=yl.FsC({type:i$,selectors:[["","appCanDeleteCipher",""]],inputs:{cipher:[0,"appCanDeleteCipher","cipher"]}});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 r${}const s$=new m(ce,"selection",{deserializer:e=>e});class o${constructor(){this.themeService=(0,a.WQX)(r$),this.systemTheme$=(0,a.WQX)(IT),this.el=(0,a.WQX)(yl.aKT),this.destroyRef=(0,a.WQX)(a.abz),this.darkImgSrc=o.hFB.required({alias:"appDarkImgSrc"})}ngOnInit(){this.lightImgSrc=this.el.nativeElement.getAttribute("src"),(0,$o.z)([this.themeService.selectedTheme$,this.systemTheme$]).pipe((0,wl.pQ)(this.destroyRef)).subscribe(([e,t])=>{const i="dark"===("system"===e?t:e);this.src=i?this.darkImgSrc():this.lightImgSrc})}}function a$(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 l$(e="",t={}){const i=t&&Object.keys(t);if(i.length&&(null==e?void 0:e.length)){let t;try{t=kd.getHostname(e)}catch(e){return!1}if(t)return i.some(e=>t.endsWith(e))}return!1}o$.ɵfac=function(e){return new(e||o$)},o$.ɵdir=yl.FsC({type:o$,selectors:[["","appDarkImgSrc",""]],hostVars:1,hostBindings:function(e,t){2&e&&yl.BMQ("src",t.src,yl.n$t)},inputs:{darkImgSrc:[1,"appDarkImgSrc","darkImgSrc"]}});class c${}const u$=["input"],d$=(e,t)=>({"tw-opacity-0":e,"tw-bg-text-muted":t});function h$(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",7),yl.nI1(1,"i18n"),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.clearSearch())}),yl.k0s()}if(2&e){const e=yl.XpG();yl.Y8G("ngClass",yl.l_i(4,d$,!e.showResetButton(),e.showResetButton())),yl.BMQ("aria-label",yl.bMT(1,2,"resetSearch"))}}let p$=0;class f${constructor(){this.input=(0,o.ebz)("input"),this.id="search-id-"+p$++,this.inputType=Oa()?"text":"search",this.isInputFocused=(0,a.vPA)(!1),this.isFormHovered=(0,a.vPA)(!1),this.showResetButton=(0,bl.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)}}f$.ɵfac=function(e){return new(e||f$)},f$.ɵcmp=yl.VBU({type:f$,selectors:[["bit-search"]],viewQuery:function(e,t){1&e&&yl.wEZ(t.input,u$,5),2&e&&yl.NyB()},inputs:{disabled:[1,"disabled"],placeholder:[1,"placeholder"],autocomplete:[1,"autocomplete"]},outputs:{disabled:"disabledChange"},features:[yl.Jv_([{provide:fl.kq,multi:!0,useExisting:f$},{provide:Cl,useExisting:f$}])],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=yl.RV6();yl.j41(0,"form",1),yl.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))}),yl.j41(1,"label",2),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.j41(4,"label",3),yl.nrm(5,"i",4),yl.k0s(),yl.j41(6,"input",5,0),yl.nI1(8,"i18n"),yl.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())}),yl.k0s(),yl.DNE(9,h$,2,7,"button",6),yl.k0s()}2&e&&(yl.R7$(),yl.Y8G("for",t.id),yl.R7$(),yl.JRh(yl.bMT(3,10,"search")),yl.R7$(2),yl.Y8G("for",t.id),yl.R7$(2),yl.Y8G("type",t.inputType)("id",t.id)("placeholder",null!==(i=t.placeholder())&&void 0!==i?i:yl.bMT(8,12,"search"))("ngModel",t.searchText)("disabled",t.disabled()),yl.BMQ("autocomplete",t.autocomplete()),yl.R7$(3),yl.Y8G("ngIf",t.searchText&&t.showResetButton()))},dependencies:[Vc,ou,fl.X1,fl.qT,fl.me,fl.BC,fl.cb,fl.YN,fl.vS,fl.cV,pl.bT,pl.YU,Hl],encapsulation:2});class v${}v$.ɵfac=function(e){return new(e||v$)},v$.ɵmod=yl.$C({type:v$}),v$.ɵinj=a.G2t({imports:[f$]});const m$=new a.nKC("CopyClickListener");class g${constructor(e,t,i,n){this.platformUtilsService=e,this.toastService=t,this.i18nService=i,this.copyListener=n,this._showToast=(0,bl.EW)(()=>void 0!==this.showToast()),this.toastVariant=(0,bl.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})}}}g$.ɵfac=function(e){return new(e||g$)(yl.rXU(Eb),yl.rXU(xb),yl.rXU(Pl),yl.rXU(m$,8))},g$.ɵdir=yl.FsC({type:g$,selectors:[["","appCopyClick",""]],hostBindings:function(e,t){1&e&&yl.bIt("click",function(){return t.onClick()})},inputs:{valueToCopy:[1,"appCopyClick","valueToCopy"],valueLabel:[1,"valueLabel"],showToast:[1,"showToast"]}});class y${constructor(){this.data=""}onDragStart(e){var t;null===(t=e.dataTransfer)||void 0===t||t.setData("text",this.data)}}y$.ɵfac=function(e){return new(e||y$)},y$.ɵdir=yl.FsC({type:y$,selectors:[["","appTextDrag",""]],hostAttrs:["draggable","true",1,"tw-cursor-move"],hostBindings:function(e,t){1&e&&yl.bIt("dragstart",function(e){return t.onDragStart(e)})},inputs:{data:[0,"appTextDrag","data"]}});class b${constructor(){this.notes=""}}var w$;function S$(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 k$(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}}b$.ɵfac=function(e){return new(e||b$)},b$.ɵcmp=yl.VBU({type:b$,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&&(yl.j41(0,"section",0)(1,"bit-section-header")(2,"h2",1),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s()(),yl.j41(5,"bit-card",2)(6,"bit-form-field",3)(7,"bit-label",4),yl.EFF(8),yl.nI1(9,"i18n"),yl.k0s(),yl.j41(10,"textarea",5),yl.EFF(11),yl.k0s(),yl.nrm(12,"button",6),yl.nI1(13,"i18n"),yl.nI1(14,"i18n"),yl.k0s()()()),2&e&&(yl.R7$(3),yl.JRh(yl.bMT(4,7,"additionalOptions")),yl.R7$(4),yl.Y8G("appTextDrag",t.notes),yl.R7$(),yl.JRh(yl.bMT(9,9,"note")),yl.R7$(3),yl.JRh(t.notes),yl.R7$(),yl.Y8G("appCopyClick",t.notes)("valueLabel",yl.bMT(13,11,"note"))("label",yl.bMT(14,13,"copyNotes")))},dependencies:[pl.MD,qf,g$,y$,WR,_l,zl,Vc,ou,ex,Xl,Wl,Eu,Sc,Du,Bb,Xf],encapsulation:2}),function(e){e[e.Cipher=0]="Cipher",e[e.CipherView=1]="CipherView"}(w$||(w$={}));class I${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}static fromJSON(e){const t=null==e.key?null:gf.fromJSON(e.key);let i;return null!=e.encryptedKey&&("string"==typeof e.encryptedKey?i=up.fromJSON(e.encryptedKey):e.encryptedKey instanceof up&&(i=e.encryptedKey)),Object.assign(new I$,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){if(!e)return;const t=new I$;return t.id=e.id,t.url=e.url,t.size=e.size,t.sizeName=e.sizeName,t.fileName=e.fileName,t.key=e.decryptedKey?gf.fromString(e.decryptedKey):void 0,t.encryptedKey=e.key?new up(e.key):void 0,t}}class C${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 T$(e,t){return(i,n)=>{null==i.linkedFieldOptions&&(i.linkedFieldOptions=new Map),i.linkedFieldOptions.set(e,new C$(n,t))}}class P${}var F$=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},R$=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};class x$ extends P${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?a$(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 x$,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 x$;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}}F$([T$(AR.CardholderName,{sortPosition:0}),R$("design:type",String)],x$.prototype,"cardholderName",void 0),F$([T$(AR.ExpMonth,{sortPosition:3,i18nKey:"expirationMonth"}),R$("design:type",String)],x$.prototype,"expMonth",void 0),F$([T$(AR.ExpYear,{sortPosition:4,i18nKey:"expirationYear"}),R$("design:type",String)],x$.prototype,"expYear",void 0),F$([T$(AR.Code,{sortPosition:5,i18nKey:"securityCode"}),R$("design:type",String)],x$.prototype,"code",void 0),F$([T$(AR.Brand,{sortPosition:2}),R$("design:type",String),R$("design:paramtypes",[String])],x$.prototype,"brand",null),F$([T$(AR.Number,{sortPosition:1}),R$("design:type",String),R$("design:paramtypes",[String])],x$.prototype,"number",null);var A$=i(82781);class D${constructor(e){this.type=FR.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 D$,e)}static fromSdkFieldView(e){if(!e)return;const t=new D$;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:A$.PUO.Text,linkedId:null!==(n=this.linkedId)&&void 0!==n?n:void 0}}}var E$=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},$$=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};class O$ extends P${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 kd.isNullOrWhitespace(this.title)||(e+=this.title+" "),kd.isNullOrWhitespace(this.firstName)||(e+=this.firstName+" "),kd.isNullOrWhitespace(this.middleName)||(e+=this.middleName+" "),kd.isNullOrWhitespace(this.lastName)||(e+=this.lastName),e.trim()}}get fullAddress(){var e;let t=null!==(e=this.address1)&&void 0!==e?e:"";return kd.isNullOrWhitespace(this.address2)||(kd.isNullOrWhitespace(t)||(t+=", "),t+=this.address2),kd.isNullOrWhitespace(this.address3)||(kd.isNullOrWhitespace(t)||(t+=", "),t+=this.address3),t}get fullAddressPart2(){const e=!kd.isNullOrWhitespace(this.city),t=!kd.isNullOrWhitespace(this.state),i=!kd.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 O$,e)}static fromSdkIdentityView(e){const t=new O$;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}}E$([T$(DR.Title,{sortPosition:0}),$$("design:type",String)],O$.prototype,"title",void 0),E$([T$(DR.MiddleName,{sortPosition:2}),$$("design:type",String)],O$.prototype,"middleName",void 0),E$([T$(DR.Address1,{sortPosition:12}),$$("design:type",String)],O$.prototype,"address1",void 0),E$([T$(DR.Address2,{sortPosition:13}),$$("design:type",String)],O$.prototype,"address2",void 0),E$([T$(DR.Address3,{sortPosition:14}),$$("design:type",String)],O$.prototype,"address3",void 0),E$([T$(DR.City,{sortPosition:15,i18nKey:"cityTown"}),$$("design:type",String)],O$.prototype,"city",void 0),E$([T$(DR.State,{sortPosition:16,i18nKey:"stateProvince"}),$$("design:type",String)],O$.prototype,"state",void 0),E$([T$(DR.PostalCode,{sortPosition:17,i18nKey:"zipPostalCodeLabel"}),$$("design:type",String)],O$.prototype,"postalCode",void 0),E$([T$(DR.Country,{sortPosition:18}),$$("design:type",String)],O$.prototype,"country",void 0),E$([T$(DR.Company,{sortPosition:6}),$$("design:type",String)],O$.prototype,"company",void 0),E$([T$(DR.Email,{sortPosition:10}),$$("design:type",String)],O$.prototype,"email",void 0),E$([T$(DR.Phone,{sortPosition:11}),$$("design:type",String)],O$.prototype,"phone",void 0),E$([T$(DR.Ssn,{sortPosition:7}),$$("design:type",String)],O$.prototype,"ssn",void 0),E$([T$(DR.Username,{sortPosition:5}),$$("design:type",String)],O$.prototype,"username",void 0),E$([T$(DR.PassportNumber,{sortPosition:8}),$$("design:type",String)],O$.prototype,"passportNumber",void 0),E$([T$(DR.LicenseNumber,{sortPosition:9}),$$("design:type",String)],O$.prototype,"licenseNumber",void 0),E$([T$(DR.FirstName,{sortPosition:1}),$$("design:type",String),$$("design:paramtypes",[String])],O$.prototype,"firstName",null),E$([T$(DR.LastName,{sortPosition:4}),$$("design:type",String),$$("design:paramtypes",[String])],O$.prototype,"lastName",null),E$([T$(DR.FullName,{sortPosition:3}),$$("design:type",String),$$("design:paramtypes",[])],O$.prototype,"fullName",null);class U$ extends P${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 U$,e,{creationDate:t})}static fromSdkFido2CredentialView(e){var t;if(e)return new U$({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 M$=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},N$=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};class V$ extends P${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 kd.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!kd.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 V$;const s=Object.assign(new V$,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=>uE.fromJSON(e)))&&void 0!==i?i:[],s.fido2Credentials=null!==(r=null===(n=e.fido2Credentials)||void 0===n?void 0:n.map(e=>U$.fromJSON(e)))&&void 0!==r?r:[],s}static fromSdkLoginView(e){var t;const i=new V$;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=>uE.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}}}M$([T$(xR.Username,{sortPosition:0}),N$("design:type",String)],V$.prototype,"username",void 0),M$([T$(xR.Password,{sortPosition:1}),N$("design:type",String)],V$.prototype,"password",void 0);class B${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 B$,e,{lastUsedDate:t})}static fromSdkPasswordHistoryView(e){if(!e)return;const t=new B$;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 j$ extends P${constructor(e){super(),this.type=$R,e&&(this.type=e.type)}get subTitle(){}static fromJSON(e){return Object.assign(new j$,e)}static fromSdkSecureNoteView(e){const t=new j$;return t.type=e.type,t}toSdkSecureNoteView(){return this}}class G$ extends P${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 G$,e)}static fromSdkSshKeyView(e){const t=new G$;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 L${constructor(e){var t;this.initializerKey=w$.CipherView,this.id="",this.name="",this.type=CR.Login,this.favorite=!1,this.organizationUseTotp=!1,this.permissions=new Ix,this.edit=!1,this.viewPassword=!0,this.login=new V$,this.identity=new O$,this.card=new x$,this.secureNote=new j$,this.sshKey=new G$,this.attachments=[],this.fields=[],this.passwordHistory=[],this.collectionIds=[],this.reprompt=kR.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:kR.None,this.key=e.key):this.creationDate=this.revisionDate=new Date}get item(){switch(this.type){case CR.Login:return this.login;case CR.SecureNote:return this.secureNote;case CR.Card:return this.card;case CR.Identity:return this.identity;case CR.SshKey:return this.sshKey}}get subTitle(){var e;return null===(e=this.item)||void 0===e?void 0:e.subTitle}get hasPasswordHistory(){return this.passwordHistory&&this.passwordHistory.length>0}get hasLoginPassword(){var e;return this.type===CR.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;e0}get passwordRevisionDisplayDate(){if(this.type===CR.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===CR.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,f,v,m,g,y;if(null==e)return null;const b=new L$;if(b.type=null!==(t=e.type)&&void 0!==t?t:CR.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?Ix.fromJSON(e.permissions):void 0,b.reprompt=null!==(d=e.reprompt)&&void 0!==d?d:kR.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!==(f=null===(p=e.attachments)||void 0===p?void 0:p.map(e=>I$.fromJSON(e)))&&void 0!==f?f:[],b.fields=null!==(m=null===(v=e.fields)||void 0===v?void 0:v.map(e=>D$.fromJSON(e)))&&void 0!==m?m:[],b.passwordHistory=null!==(y=null===(g=e.passwordHistory)||void 0===g?void 0:g.map(e=>B$.fromJSON(e)))&&void 0!==y?y:[],null!=e.key){let t;"string"==typeof e.key?t=up.fromJSON(e.key):e.key instanceof up&&(t=e.key),b.key=t}switch(e.type){case CR.Card:b.card=x$.fromJSON(e.card);break;case CR.Identity:b.identity=O$.fromJSON(e.identity);break;case CR.Login:b.login=V$.fromJSON(e.login);break;case CR.SecureNote:b.secureNote=j$.fromJSON(e.secureNote);break;case CR.SshKey:b.sshKey=G$.fromJSON(e.sshKey)}return b}static fromSdkCipherView(e){var t,i,n,r,s,o,a,l,c;if(null==e)return;const u=new L$;switch(u.id=e.id,u.organizationId=e.organizationId,u.folderId=e.folderId,u.name=e.name,u.notes=e.notes,u.type=e.type,u.favorite=e.favorite,u.organizationUseTotp=e.organizationUseTotp,u.permissions=e.permissions?Ix.fromSdkCipherPermissions(e.permissions):void 0,u.edit=e.edit,u.viewPassword=e.viewPassword,u.localData=S$(e.localData),u.attachments=null!==(i=null===(t=e.attachments)||void 0===t?void 0:t.map(e=>I$.fromSdkAttachmentView(e)))&&void 0!==i?i:[],u.fields=null!==(r=null===(n=e.fields)||void 0===n?void 0:n.map(e=>D$.fromSdkFieldView(e)))&&void 0!==r?r:[],u.passwordHistory=null!==(o=null===(s=e.passwordHistory)||void 0===s?void 0:s.map(e=>B$.fromSdkPasswordHistoryView(e)))&&void 0!==o?o:[],u.collectionIds=null!==(l=null===(a=e.collectionIds)||void 0===a?void 0:a.map(e=>e))&&void 0!==l?l:[],u.revisionDate=new Date(e.revisionDate),u.creationDate=new Date(e.creationDate),u.deletedDate=null==e.deletedDate?void 0:new Date(e.deletedDate),u.archivedDate=null==e.archivedDate?void 0:new Date(e.archivedDate),u.reprompt=null!==(c=e.reprompt)&&void 0!==c?c:kR.None,u.key=e.key?up.fromJSON(e.key):void 0,e.type){case CR.Card:u.card=e.card?x$.fromSdkCardView(e.card):new x$;break;case CR.Identity:u.identity=e.identity?O$.fromSdkIdentityView(e.identity):new O$;break;case CR.Login:u.login=e.login?V$.fromSdkLoginView(e.login):new V$;break;case CR.SecureNote:u.secureNote=e.secureNote?j$.fromSdkSecureNoteView(e.secureNote):new j$;break;case CR.SshKey:u.sshKey=e.sshKey?G$.fromSdkSshKeyView(e.sshKey):new G$}return u}toSdkCipherView(){var e,t,i,n,r,s,o,a,l,c,u,d,h,p,f,v,m,g,y,b,w,S,k;const I={id:this.id?Dk(this.id):void 0,organizationId:this.organizationId?Dk(this.organizationId):void 0,folderId:this.folderId?Dk(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:CR.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:k$(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=>Dk(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===(f=this.deletedDate)||void 0===f?void 0:f.toISOString(),archivedDate:null===(v=this.archivedDate)||void 0===v?void 0:v.toISOString(),reprompt:null!==(m=this.reprompt)&&void 0!==m?m:kR.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 CR.Card:I.card=null===(y=this.card)||void 0===y?void 0:y.toSdkCardView();break;case CR.Identity:I.identity=null===(b=this.identity)||void 0===b?void 0:b.toSdkIdentityView();break;case CR.Login:I.login=null===(w=this.login)||void 0===w?void 0:w.toSdkLoginView();break;case CR.SecureNote:I.secureNote=null===(S=this.secureNote)||void 0===S?void 0:S.toSdkSecureNoteView();break;case CR.SshKey:I.sshKey=null===(k=this.sshKey)||void 0===k?void 0:k.toSdkSshKeyView()}return I}}class z${}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())})};function K$(e,t){if(1&e&&(yl.nrm(0,"button",0),yl.nI1(1,"i18n")),2&e){const e=yl.XpG();yl.Y8G("bitAction",e.download)("label",yl.i5U(1,2,"downloadAttachmentName",e.attachment().fileName))}}class X${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,bl.EW)(()=>this.attachment().fileName===cp),this.download=()=>_$(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 Mw&&404===t.statusCode))throw t instanceof Mw?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,ho._)(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 q$(e,t){if(1&e&&(yl.j41(0,"bit-item")(1,"bit-item-content")(2,"span",3),yl.EFF(3),yl.k0s(),yl.j41(4,"span",4),yl.EFF(5),yl.k0s()(),yl.qex(6,5),yl.j41(7,"bit-item-action"),yl.nrm(8,"app-download-attachment",6),yl.k0s(),yl.bVm(),yl.k0s()),2&e){const e=t.$implicit,i=yl.XpG();yl.R7$(2),yl.Y8G("title",e.fileName),yl.R7$(),yl.JRh(e.fileName),yl.R7$(2),yl.JRh(e.sizeName),yl.R7$(3),yl.Y8G("admin",i.admin)("cipher",i.cipher)("attachment",e)("checkPwReprompt",!0)("emergencyAccessId",i.emergencyAccessId)}}X$.ɵfac=function(e){return new(e||X$)(yl.rXU(Pl),yl.rXU(Mk),yl.rXU(z$),yl.rXU(xb),yl.rXU(u),yl.rXU(Fb))},X$.ɵcmp=yl.VBU({type:X$,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&&yl.nVh(0,K$,2,5,"button",0),2&e&&yl.vxM(t.isDecryptionFailure()?-1:0)},dependencies:[rc,Rd,pl.MD,qf,_l,zl,Xf],encapsulation:2,changeDetection:0});class Y${constructor(e,t,i,n){this.keyService=e,this.billingAccountProfileStateService=t,this.stateProvider=i,this.accountService=n,this.admin=!1,this.subscribeToHasPremiumCheck(),this.subscribeToOrgKey()}subscribeToHasPremiumCheck(){this.accountService.activeAccount$.pipe((0,co.n)(e=>this.billingAccountProfileStateService.hasPremiumFromAnySource$(e.id)),(0,wl.pQ)()).subscribe(e=>{this.canAccessPremium=e})}subscribeToOrgKey(){this.stateProvider.activeUserId$.pipe((0,co.n)(e=>null!=e?this.keyService.orgKeys$(e):uo.t),(0,wl.pQ)()).subscribe(e=>{e&&(this.orgKey=e[this.cipher.organizationId])})}}Y$.ɵfac=function(e){return new(e||Y$)(yl.rXU(Cp),yl.rXU(ME),yl.rXU(u),yl.rXU(Ok))},Y$.ɵcmp=yl.VBU({type:Y$,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"],[3,"admin","cipher","attachment","checkPwReprompt","emergencyAccessId"]],template:function(e,t){1&e&&(yl.j41(0,"section",0)(1,"bit-section-header")(2,"h2",1),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s()(),yl.j41(5,"bit-item-group"),yl.DNE(6,q$,9,8,"bit-item",2),yl.k0s()()),2&e&&(yl.R7$(3),yl.JRh(yl.bMT(4,2,"attachments")),yl.R7$(3),yl.Y8G("ngForOf",t.cipher.attachments))},dependencies:[pl.MD,pl.Sq,qf,wP,IP,FP,SP,RP,_l,ex,Xl,Wl,X$,Xf],encapsulation:2});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())})};function H$(e,t){if(1&e){const e=yl.RV6();yl.qex(0),yl.j41(1,"bit-form-field",3)(2,"bit-label"),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s(),yl.nrm(5,"input",4),yl.j41(6,"button",5),yl.nI1(7,"i18n"),yl.bIt("click",function(){const t=a.eBV(e).$implicit,i=yl.XpG();return a.Njj(i.openWebsite(t.launchUri))}),yl.k0s(),yl.nrm(8,"button",6),yl.nI1(9,"i18n"),yl.nI1(10,"i18n"),yl.k0s(),yl.bVm()}if(2&e){const e=t.$implicit,i=t.last;yl.R7$(),yl.Y8G("disableMargin",i)("disableReadOnlyBorder",i),yl.R7$(2),yl.SpI(" ",yl.bMT(4,8,"website")," "),yl.R7$(2),yl.Y8G("value",e.hostOrUri),yl.R7$(),yl.Y8G("label",yl.bMT(7,10,"launch")+" "+e.hostOrUri),yl.R7$(2),yl.Y8G("appCopyClick",e.uri)("valueLabel",yl.bMT(9,12,"website"))("label",yl.bMT(10,14,"copyWebsite"))}}class J${constructor(e,t,i){this.platformUtilsService=e,this.cipherService=t,this.accountService=i}openWebsite(e){return W$(this,void 0,void 0,function*(){const t=yield(0,ho._)(this.accountService.activeAccount$.pipe(Gp));yield this.cipherService.updateLastLaunchedDate(this.cipherId,t),this.platformUtilsService.launchUri(e)})}}J$.ɵfac=function(e){return new(e||J$)(yl.rXU(Eb),yl.rXU(Fb),yl.rXU(Ok))},J$.ɵcmp=yl.VBU({type:J$,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&&(yl.j41(0,"section",0)(1,"bit-section-header")(2,"h2",1),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s()(),yl.j41(5,"bit-card"),yl.DNE(6,H$,11,16,"ng-container",2),yl.k0s()()),2&e&&(yl.R7$(3),yl.JRh(yl.bMT(4,2,"autofillOptions")),yl.R7$(3),yl.Y8G("ngForOf",t.loginUris))},dependencies:[pl.MD,pl.Sq,qf,g$,WR,ex,Xl,Wl,Eu,Sc,ou,Du,Bb,_l,zl,Xf],encapsulation:2});class Z${ngAfterViewInit(){var e;(null===(e=this.formFields)||void 0===e?void 0:e.last)&&setTimeout(()=>{this.formFields&&(this.formFields.last.disableReadOnlyBorder=!0)})}}Z$.ɵfac=function(e){return new(e||Z$)},Z$.ɵcmp=yl.VBU({type:Z$,selectors:[["read-only-cipher-card"]],contentQueries:function(e,t,i){if(1&e&&yl.wni(i,Du,4),2&e){let e;yl.mGM(e=yl.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&&(yl.NAR(),yl.j41(0,"bit-card",0),yl.SdG(1),yl.k0s())},dependencies:[WR],encapsulation:2});var Q$=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 eO(e,t){if(1&e&&(yl.j41(0,"bit-form-field")(1,"bit-label",3),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.nrm(4,"input",4),yl.k0s()),2&e){const e=yl.XpG();yl.R7$(),yl.Y8G("appTextDrag",e.card.cardholderName),yl.R7$(),yl.JRh(yl.bMT(3,3,"cardholderName")),yl.R7$(2),yl.Y8G("value",e.card.cardholderName)}}function tO(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"bit-form-field")(1,"bit-label",3),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.nrm(4,"input",5),yl.nI1(5,"creditCardNumber"),yl.j41(6,"button",6),yl.bIt("toggledChange",function(t){a.eBV(e);const i=yl.XpG();return a.Njj(i.logCardEvent(t,i.EventType.Cipher_ClientToggledCardNumberVisible))}),yl.k0s(),yl.nrm(7,"button",7),yl.nI1(8,"i18n"),yl.nI1(9,"i18n"),yl.k0s()}if(2&e){const e=yl.XpG();yl.R7$(),yl.Y8G("appTextDrag",e.card.number),yl.R7$(),yl.JRh(yl.bMT(3,7,"number")),yl.R7$(2),yl.Y8G("value",yl.i5U(5,9,e.card.number,e.cipher.card.brand)),yl.R7$(2),yl.Y8G("toggled",e.revealCardNumber),yl.R7$(),yl.Y8G("appCopyClick",e.card.number)("valueLabel",yl.bMT(8,12,"number"))("label",yl.bMT(9,14,"copyNumber"))}}function iO(e,t){if(1&e&&(yl.j41(0,"bit-form-field")(1,"bit-label",3),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.nrm(4,"input",8),yl.k0s()),2&e){const e=yl.XpG();yl.R7$(),yl.Y8G("appTextDrag",e.card.expiration),yl.R7$(),yl.JRh(yl.bMT(3,3,"expiration")),yl.R7$(2),yl.Y8G("value",e.card.expiration)}}function nO(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"bit-form-field")(1,"bit-label",3),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.nrm(4,"input",9),yl.j41(5,"button",10),yl.bIt("toggledChange",function(t){a.eBV(e);const i=yl.XpG();return a.Njj(i.logCardEvent(t,i.EventType.Cipher_ClientToggledCardCodeVisible))}),yl.k0s(),yl.j41(6,"button",11),yl.nI1(7,"i18n"),yl.nI1(8,"i18n"),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.logCardEvent(!0,t.EventType.Cipher_ClientCopiedCardCode))}),yl.k0s()()}if(2&e){const e=yl.XpG();yl.R7$(),yl.Y8G("appTextDrag",e.card.code),yl.R7$(),yl.JRh(yl.bMT(3,7,"securityCode")),yl.R7$(2),yl.Y8G("value",e.card.code),yl.R7$(),yl.Y8G("toggled",e.revealCardCode),yl.R7$(),yl.Y8G("appCopyClick",e.card.code)("valueLabel",yl.bMT(7,9,"securityCode"))("label",yl.bMT(8,11,"copySecurityCode"))}}class rO{constructor(e,t){this.i18nService=e,this.eventCollectionService=t,this.EventType=Ra,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 Q$(this,void 0,void 0,function*(){t===Ra.Cipher_ClientToggledCardNumberVisible?this.revealCardNumber=e:t===Ra.Cipher_ClientToggledCardCodeVisible&&(this.revealCardCode=e),e&&(yield this.eventCollectionService.collect(t,this.cipher.id,!1,this.cipher.organizationId))})}}rO.ɵfac=function(e){return new(e||rO)(yl.rXU(Pl),yl.rXU(OE))},rO.ɵcmp=yl.VBU({type:rO,selectors:[["app-card-details-view"]],inputs:{cipher:"cipher"},features:[yl.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&&(yl.j41(0,"section",0)(1,"bit-section-header")(2,"h2",1),yl.EFF(3),yl.k0s()(),yl.j41(4,"read-only-cipher-card"),yl.DNE(5,eO,5,5,"bit-form-field",2)(6,tO,10,16,"bit-form-field",2)(7,iO,5,5,"bit-form-field",2)(8,nO,9,13,"bit-form-field",2),yl.k0s()()),2&e&&(yl.R7$(3),yl.JRh(t.setSectionTitle),yl.R7$(2),yl.Y8G("ngIf",t.card.cardholderName),yl.R7$(),yl.Y8G("ngIf",t.card.number),yl.R7$(),yl.Y8G("ngIf",t.card.expiration),yl.R7$(),yl.Y8G("ngIf",t.card.code))},dependencies:[pl.MD,pl.bT,qf,g$,y$,ex,Xl,Wl,Eu,Sc,ou,Du,Vb,Bb,_l,zl,Z$,Mh,Xf],encapsulation:2});class sO{}sO.ɵfac=function(e){return new(e||sO)},sO.ɵmod=yl.$C({type:sO}),sO.ɵinj=a.G2t({});var oO=i(40287),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 lO{constructor(e,t){this.autosize=e,this.ngZone=t,this.autosize.enabled=!1}ngAfterViewInit(){return aO(this,void 0,void 0,function*(){yield(0,ho._)(this.ngZone.onStable),this.autosize.enabled=!0})}}function cO(e,t){if(1&e&&(yl.rj2(0,"span",2),yl.EFF(1),yl.eux()),2&e){const e=yl.XpG().$index;yl.R7$(),yl.JRh(e+1)}}function uO(e,t){if(1&e&&(yl.rj2(0,"span",1)(1,"span"),yl.EFF(2),yl.eux(),yl.nVh(3,cO,2,1,"span",2),yl.eux()),2&e){const e=t.$implicit,i=yl.XpG();yl.HbH(i.getCharacterClass(e)),yl.R7$(2),yl.JRh(e),yl.R7$(),yl.vxM(i.showCount()?3:-1)}}lO.ɵfac=function(e){return new(e||lO)(yl.rXU(oO.xb,1),yl.rXU(yl.SKi))},lO.ɵdir=yl.FsC({type:lO,selectors:[["textarea","vaultAutosizeReadOnlyTextArea",""]],features:[yl.Jv_([oO.EE]),yl.nM4([oO.xb])]});class dO{constructor(){this.password=(0,o.hFB)(""),this.showCount=(0,o.hFB)(!1),this.passwordCharArray=(0,bl.EW)(()=>{var e;return Array.from(null!==(e=this.password())&&void 0!==e?e:"")}),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(kd.regexpEmojiPresentation))return"emoji";if(e.match(/\d/))return"number";return["&","<",">"," "].includes(e)||e.match(/[^\w ]/)?"special":"letter"}}dO.ɵfac=function(e){return new(e||dO)},dO.ɵcmp=yl.VBU({type:dO,selectors:[["bit-color-password"]],hostVars:2,hostBindings:function(e,t){2&e&&yl.HbH(t.classList)},inputs:{password:[1,"password"],showCount:[1,"showCount"]},decls:2,vars:0,consts:[[1,"tw-font-mono",3,"class"],[1,"tw-font-mono"],[1,"tw-whitespace-nowrap","tw-text-xs","tw-leading-5","tw-text-main"]],template:function(e,t){1&e&&yl.Z7z(0,uO,4,4,"span",0,yl.Vm6),2&e&&yl.Dyx(t.passwordCharArray())},encapsulation:2});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 pO=e=>({"tw-mb-4":e}),fO=()=>({"tw-mt-3":!0,"tw-mb-2":!0});function vO(e,t){if(1&e&&(yl.j41(0,"bit-form-field",7)(1,"bit-label",8),yl.EFF(2),yl.k0s(),yl.nrm(3,"textarea",9)(4,"button",10),yl.nI1(5,"i18n"),yl.k0s()),2&e){const e=yl.XpG(),t=e.$implicit,i=e.last;yl.Y8G("disableReadOnlyBorder",i),yl.R7$(),yl.Y8G("appTextDrag",t.value),yl.R7$(),yl.JRh(t.name),yl.R7$(),yl.Y8G("value",t.value),yl.R7$(),yl.Y8G("appCopyClick",t.value)("valueLabel",t.name)("label",yl.i5U(5,7,"copyCustomField",t.name))}}function mO(e,t){if(1&e&&yl.nrm(0,"input",16),2&e){const e=yl.XpG(2).$implicit;yl.Y8G("value",e.value)}}function gO(e,t){if(1&e&&yl.nrm(0,"textarea",17),2&e){const e=yl.XpG(2).$implicit;yl.Y8G("value",e.value)}}function yO(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",18),yl.nI1(1,"i18n"),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG(2).index,i=yl.XpG();return a.Njj(i.toggleCharacterCount(t))}),yl.k0s()}if(2&e){const e=yl.XpG(2).index,t=yl.XpG();yl.Y8G("label",yl.bMT(1,2,t.showHiddenValueCountFields.includes(e)?"hideCharacterCount":"showCharacterCount")),yl.BMQ("aria-expanded",t.showHiddenValueCountFields.includes(e))}}function bO(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",19),yl.bIt("toggledChange",function(t){a.eBV(e);const i=yl.XpG(2).index,n=yl.XpG();return a.Njj(n.toggleHiddenField(t,i))}),yl.k0s()}}function wO(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",20),yl.nI1(1,"i18n"),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG(3);return a.Njj(t.logCopyEvent())}),yl.k0s()}if(2&e){const e=yl.XpG(2).$implicit;yl.Y8G("appCopyClick",e.value)("valueLabel",e.name)("label",yl.i5U(1,3,"copyCustomField",e.name))}}function SO(e,t){if(1&e&&(yl.j41(0,"bit-form-field",7)(1,"bit-label",8),yl.EFF(2),yl.k0s(),yl.DNE(3,mO,1,1,"input",11)(4,gO,1,1,"textarea",12)(5,yO,2,4,"button",13)(6,bO,1,0,"button",14)(7,wO,2,6,"button",15),yl.k0s()),2&e){const e=yl.XpG(),t=e.$implicit,i=e.last,n=e.index,r=yl.XpG();yl.Y8G("disableReadOnlyBorder",i),yl.R7$(),yl.Y8G("appTextDrag",t.value),yl.R7$(),yl.JRh(t.name),yl.R7$(),yl.Y8G("ngIf",!r.revealedHiddenFields.includes(n)),yl.R7$(),yl.Y8G("ngIf",r.revealedHiddenFields.includes(n)),yl.R7$(),yl.Y8G("ngIf",r.canViewPassword&&r.revealedHiddenFields.includes(n)),yl.R7$(),yl.Y8G("ngIf",r.canViewPassword),yl.R7$(),yl.Y8G("ngIf",r.canViewPassword)}}function kO(e,t){if(1&e&&(yl.j41(0,"div",21),yl.nrm(1,"bit-color-password",22),yl.k0s()),2&e){const e=yl.XpG().$implicit;yl.Y8G("ngClass",yl.lJ4(3,fO)),yl.R7$(),yl.Y8G("password",e.value)("showCount",!0)}}function IO(e,t){if(1&e&&(yl.j41(0,"bit-form-control"),yl.nrm(1,"input",23),yl.j41(2,"bit-label",8),yl.EFF(3),yl.k0s()()),2&e){const e=yl.XpG().$implicit;yl.R7$(),yl.Y8G("checked","true"===e.value),yl.R7$(),yl.Y8G("appTextDrag",e.value),yl.R7$(),yl.SpI(" ",e.name," ")}}function CO(e,t){if(1&e&&(yl.j41(0,"bit-form-field",7)(1,"bit-label"),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.nrm(4,"input",24),yl.k0s()),2&e){const e=yl.XpG(),t=e.$implicit,i=e.last,n=yl.XpG();yl.Y8G("disableReadOnlyBorder",i),yl.R7$(2),yl.Lme(" ",yl.bMT(3,4,"cfTypeLinked"),": ",t.name," "),yl.R7$(2),yl.Y8G("value",n.getLinkedType(t.linkedId))}}function TO(e,t){if(1&e&&(yl.j41(0,"div",3),yl.DNE(1,vO,6,10,"bit-form-field",4)(2,SO,8,8,"bit-form-field",4)(3,kO,2,4,"div",5)(4,IO,4,3,"bit-form-control",6)(5,CO,5,6,"bit-form-field",4),yl.k0s()),2&e){const e=t.$implicit,i=t.last,n=t.index,r=yl.XpG();yl.Y8G("ngClass",yl.eq3(6,pO,!i)),yl.R7$(),yl.Y8G("ngIf",e.type===r.fieldType.Text),yl.R7$(),yl.Y8G("ngIf",e.type===r.fieldType.Hidden),yl.R7$(),yl.Y8G("ngIf",r.showHiddenValueCountFields.includes(n)&&r.revealedHiddenFields.includes(n)),yl.R7$(),yl.Y8G("ngIf",e.type===r.fieldType.Boolean),yl.R7$(),yl.Y8G("ngIf",e.type===r.fieldType.Linked)}}class PO{constructor(e,t){this.i18nService=e,this.eventCollectionService=t,this.fieldType=FR,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 hO(this,void 0,void 0,function*(){e?this.revealedHiddenFields.push(t):this.revealedHiddenFields=this.revealedHiddenFields.filter(e=>e!==t),e&&(yield this.eventCollectionService.collect(Ra.Cipher_ClientToggledHiddenFieldVisible,this.cipher.id,!1,this.cipher.organizationId))})}logCopyEvent(){return hO(this,void 0,void 0,function*(){yield this.eventCollectionService.collect(Ra.Cipher_ClientCopiedHiddenField,this.cipher.id,!1,this.cipher.organizationId)})}getLinkedFieldsOptionsForCipher(){switch(this.cipher.type){case CR.Login:return V$.prototype.linkedFieldOptions;case CR.Card:return x$.prototype.linkedFieldOptions;case CR.Identity:return O$.prototype.linkedFieldOptions;default:return}}}var FO,RO,xO,AO,DO,EO;PO.ɵfac=function(e){return new(e||PO)(yl.rXU(Pl),yl.rXU(OE))},PO.ɵcmp=yl.VBU({type:PO,selectors:[["app-custom-fields-v2"]],inputs:{cipher:"cipher"},features:[yl.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&&(yl.j41(0,"section",0)(1,"bit-section-header")(2,"h2",1),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s()(),yl.j41(5,"bit-card"),yl.DNE(6,TO,6,8,"div",2),yl.k0s()()),2&e&&(yl.R7$(3),yl.JRh(yl.bMT(4,2,"customFields")),yl.R7$(3),yl.Y8G("ngForOf",t.cipher.fields))},dependencies:[pl.MD,pl.YU,pl.Sq,pl.bT,qf,sP,g$,y$,WR,_l,zl,Eu,hc,Sc,ou,Du,Vb,Bb,Vc,ex,Xl,Wl,id,Ub,sO,dO,lO,Xf],encapsulation:2}),function(e){e[e.None=0]="None",e[e.OpenIdConnect=1]="OpenIdConnect",e[e.Saml2=2]="Saml2"}(FO||(FO={})),function(e){e[e.MasterPassword=0]="MasterPassword",e[e.KeyConnector=1]="KeyConnector",e[e.TrustedDeviceEncryption=2]="TrustedDeviceEncryption"}(RO||(RO={})),function(e){e[e.RedirectGet=0]="RedirectGet",e[e.FormPost=1]="FormPost"}(xO||(xO={})),function(e){e[e.HttpRedirect=1]="HttpRedirect",e[e.HttpPost=2]="HttpPost"}(AO||(AO={})),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"}(DO||(DO={})),function(e){e[e.IfIdpWantAuthnRequestsSigned=0]="IfIdpWantAuthnRequestsSigned",e[e.Always=1]="Always",e[e.Never=3]="Never"}(EO||(EO={}));class $O{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.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.isAdminInitiated=e.isAdminInitiated,this.ssoEnabled=e.ssoEnabled,this.ssoMemberDecryptionType=e.ssoMemberDecryptionType,this.usePhishingBlocker=e.usePhishingBlocker)}get canAccess(){return!!this.isOwner||this.enabled&&this.status===Lh.Confirmed}get isAdmin(){return this.type===zh.Admin||this.isOwner}get isOwner(){return this.type===zh.Owner||this.isProviderUser}get canAccessEventLogs(){return(this.isAdmin||this.permissions.accessEventLogs)&&this.useEvents}get canAccessImport(){return this.isProviderUser||this.type===zh.Owner||this.type===zh.Admin||this.permissions.accessImportExport}get canAccessExport(){return this.isMember&&(this.type===zh.Owner||this.type===zh.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===zh.Custom&&this.permissions.editAnyCollection||this.allowAdminAccessToAllCollectionItems&&this.isAdmin}get canEditUnmanagedCollections(){return this.isAdmin||this.permissions.editAnyCollection}get canEditUnassignedCiphers(){return this.type===zh.Admin||this.type===zh.Owner||this.permissions.editAnyCollection}get canEditAllCiphers(){return this.type===zh.Custom&&this.permissions.editAnyCollection||this.allowAdminAccessToAllCollectionItems&&(this.type===zh.Admin||this.type===zh.Owner)}get canDeleteAnyCollection(){return!(!this.isProviderUser&&!this.permissions.deleteAnyCollection)||!!this.allowAdminAccessToAllCollectionItems&&(this.type==zh.Owner||this.type==zh.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===RO.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===Kh.Msp||this.providerType===Kh.BusinessUnit)}get hasReseller(){return this.hasProvider&&this.providerType===Kh.Reseller}get canAccessSecretsManager(){return this.useSecretsManager&&this.accessSecretsManager}get isFreeOrg(){return!this.useTotp}get canManageSponsorships(){return this.familySponsorshipAvailable||null!==this.familySponsorshipFriendlyName}static fromJSON(e){return null==e?null:Object.assign(new $O,e,{familySponsorshipLastSyncDate:new Date(e.familySponsorshipLastSyncDate),familySponsorshipValidUntil:new Date(e.familySponsorshipValidUntil)})}get canAccessIntegrations(){return(this.productTierType===qE.Teams||this.productTierType===qE.Enterprise)&&(this.isAdmin||this.permissions.manageUsers||this.permissions.manageGroups||this.permissions.accessEventLogs)}get canUseAccessIntelligence(){return this.productTierType===qE.Enterprise}}class OO{constructor(e){this.id=null,this.name=null,this.revisionDate=null,e&&(this.id=e.id,this.revisionDate=e.revisionDate)}static fromJSON(e){const t=null==e.revisionDate?null:new Date(e.revisionDate);return Object.assign(new OO,e,{revisionDate:t})}}const UO=(e,t)=>({"tw-invisible tw-absolute":e,"tw-size-6":t}),MO=(e,t)=>({"tw-flex tw-items-center tw-justify-center":e,"tw-bg-illustration-bg-primary tw-rounded-full":t}),NO=(e,t,i,n)=>({color:e,width:t,height:i,fontSize:n});function VO(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"img",4),yl.bIt("load",function(){a.eBV(e);const t=yl.XpG(2);return a.Njj(t.imageLoaded.set(!0))})("error",function(){a.eBV(e);const t=yl.XpG(2);return a.Njj(t.imageLoaded.set(!1))}),yl.k0s()}if(2&e){const e=yl.XpG().ngIf,t=yl.XpG();yl.Y8G("src",e.image,yl.B4B)("ngClass",yl.l_i(3,UO,!t.imageLoaded(),!t.coloredIcon()))("ngStyle",t.iconStyle())}}function BO(e,t){if(1&e&&(yl.j41(0,"div",3),yl.nrm(1,"i",5),yl.k0s()),2&e){const e=yl.XpG().ngIf,t=yl.XpG();yl.Y8G("ngClass",yl.l_i(6,MO,t.coloredIcon(),(null==e.icon?null:e.icon.startsWith("bwi-"))&&t.coloredIcon()))("ngStyle",t.iconStyle()),yl.R7$(),yl.HbH(yl.VkB("tw-text-muted bwi bwi-lg ",e.icon)),yl.Y8G("ngStyle",yl.ziG(9,NO,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 jO(e,t){if(1&e&&(yl.qex(0),yl.nVh(1,VO,1,6,"img",2),yl.nVh(2,BO,2,14,"div",3),yl.bVm()),2&e){const e=t.ngIf,i=yl.XpG();yl.R7$(),yl.vxM(e.imageEnabled&&e.image?1:-1),yl.R7$(),yl.vxM(e.imageEnabled&&e.image&&i.imageLoaded()?-1:2)}}class GO{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,bl.EW)(()=>{if(this.coloredIcon())return{width:"36px",height:"36px"};const e=this.size();return e?{width:e+"px",height:e+"px"}:{}});const i=(0,$o.z)([this.environmentService.environment$.pipe((0,l.T)(e=>e.getIconsUrl())),this.domainSettingsService.showFavicons$.pipe((0,lo.F)())]).pipe((0,l.T)(([e,t])=>({iconsUrl:e,showFavicon:t})),(0,sd.Z)({iconsUrl:null,showFavicon:!1}),(0,lo.F)());this.data$=(0,$o.z)([i,(0,wl.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=hE.getType(t),l=hE.uri(t),c=hE.getCard(t);switch(a){case CR.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}/${kd.getHostname(t)}/icon.png`,s="images/bwi-globe.png"}catch(e){}}else r=null;break;case CR.SecureNote:n="bwi-sticky-note";break;case CR.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 CR.Identity:n="bwi-id-card";break;case CR.SshKey:n="bwi-key"}return{imageEnabled:i,image:r,fallbackImage:s,icon:n}}(e,i,t)),(0,sd.Z)(null),(0,Qv.J)(),(0,Fo.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))}}GO.ɵfac=function(e){return new(e||GO)(yl.rXU(JS),yl.rXU(oE))},GO.ɵcmp=yl.VBU({type:GO,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&&(yl.j41(0,"div",0),yl.DNE(1,jO,3,2,"ng-container",1),yl.nI1(2,"async"),yl.k0s()),2&e&&(yl.Y8G("ngStyle",t.iconStyle()),yl.R7$(),yl.Y8G("ngIf",yl.bMT(2,2,t.data$)))},dependencies:[pl.YU,pl.bT,pl.B3,pl.Jj],encapsulation:2,changeDetection:0});const LO=e=>({"tw-mb-2":e}),zO=(e,t)=>t.id;function _O(e,t){if(1&e&&(yl.nrm(0,"i",8),yl.nI1(1,"i18n")),2&e){const e=yl.XpG(2);yl.Y8G("tierType",e.organization().productTierType)("size","large")("title",yl.bMT(1,3,"owner"))}}function KO(e,t){if(1&e&&yl.nrm(0,"i",9),2&e){const e=yl.XpG().$implicit,t=yl.XpG();yl.Y8G("ngClass",t.getIconClass(e))("title",t.getItemTitle(e))}}function XO(e,t){if(1&e&&(yl.j41(0,"span",6),yl.nVh(1,_O,2,5,"i",8)(2,KO,1,2,"i",9),yl.j41(3,"span",10),yl.EFF(4),yl.k0s()()),2&e){const e=t.$implicit,i=t.$index,n=t.$count,r=yl.XpG();yl.Y8G("ngClass",yl.eq3(4,LO,i===n-1&&r.hasSmallScreen())),yl.BMQ("aria-label",r.getAriaLabel(e)),yl.R7$(),yl.vxM(r.isOrgIcon(e)?1:2),yl.R7$(3),yl.SpI(" ",e.name," ")}}function qO(e,t){1&e&&(yl.j41(0,"span",7),yl.nI1(1,"i18n"),yl.nrm(2,"i",11),yl.nI1(3,"i18n"),yl.j41(4,"span",10),yl.EFF(5),yl.nI1(6,"i18n"),yl.k0s()()),2&e&&(yl.BMQ("aria-label",yl.bMT(1,3,"noneFolder")),yl.R7$(2),yl.Y8G("title",yl.bMT(3,5,"folder")),yl.R7$(3),yl.SpI(" ",yl.bMT(6,7,"noneFolder")," "))}function YO(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",13),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG(2);return a.Njj(t.toggleShowMore())}),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()}2&e&&(yl.R7$(),yl.SpI(" ",yl.bMT(2,1,"showMore")," "))}function WO(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",13),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG(2);return a.Njj(t.toggleShowMore())}),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()}2&e&&(yl.R7$(),yl.SpI(" ",yl.bMT(2,1,"showLess")," "))}function HO(e,t){if(1&e&&yl.DNE(0,YO,3,3,"button",12)(1,WO,3,3,"button",12),2&e){const e=yl.XpG();yl.Y8G("ngIf",!e.showAllDetails()),yl.R7$(),yl.Y8G("ngIf",e.showAllDetails())}}class JO{constructor(e){this.i18nService=e,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,bl.EW)(()=>this.cipher().organizationId&&this.organization()&&!this.hideOwner()),this.hasSmallScreen=(0,wl.ot)((0,hh.R)(window,"resize").pipe((0,l.T)(()=>window.innerWidth),(0,sd.Z)(window.innerWidth),(0,l.T)(e=>e<681))),this.allItems=(0,bl.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,bl.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()})}toggleShowMore(){this.showAllDetails.update(e=>!e)}getAriaLabel(e){return e instanceof $O?this.i18nService.t("owner")+e.name:e instanceof KF?this.i18nService.t("collection")+e.name:e instanceof OO?this.i18nService.t("folder")+e.name:""}getIconClass(e){return e instanceof KF?e.type===LF?"bwi-user":"bwi-collection-shared":e instanceof OO?"bwi-folder":""}getItemTitle(e){return e instanceof KF?this.i18nService.t("collection"):e instanceof OO?this.i18nService.t("folder"):""}isOrgIcon(e){return e instanceof $O}}JO.ɵfac=function(e){return new(e||JO)(yl.rXU(Pl))},JO.ɵcmp=yl.VBU({type:JO,selectors:[["app-item-details-v2"]],inputs:{hideOwner:[1,"hideOwner"],cipher:[1,"cipher"],organization:[1,"organization"],folder:[1,"folder"],collections:[1,"collections"]},decls:13,vars:8,consts:[[1,"tw-mb-5","bit-compact:tw-mb-4"],[1,"tw-flex","tw-place-items-center",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"],[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&&(yl.j41(0,"section",0)(1,"bit-card")(2,"div",1)(3,"div",2),yl.nrm(4,"app-vault-icon",3),yl.k0s(),yl.j41(5,"h2",4),yl.EFF(6),yl.k0s()(),yl.qex(7),yl.j41(8,"div",5),yl.Z7z(9,XO,5,6,"span",6,zO),yl.nVh(11,qO,7,9,"span",7),yl.nVh(12,HO,2,2),yl.k0s(),yl.bVm(),yl.k0s()()),2&e&&(yl.R7$(2),yl.Y8G("ngClass",yl.eq3(6,LO,t.allItems.length>0)),yl.R7$(2),yl.Y8G("cipher",t.cipher())("coloredIcon",!0),yl.R7$(2),yl.SpI(" ",t.cipher().name," "),yl.R7$(3),yl.Dyx(t.showItems()),yl.R7$(2),yl.vxM(0===t.allItems().length?11:-1),yl.R7$(),yl.vxM(t.hasSmallScreen()&&t.allItems().length>2&&t.cipher().collectionIds.length>1?12:-1))},dependencies:[pl.MD,pl.YU,pl.bT,qf,GO,WR,Xl,Wl,ZE,Eu,Kb,Xf],encapsulation:2});class ZO{}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,t)=>({"tw-mb-1 ":e,"tw-mb-0":t}),tU=e=>({"tw-mb-3":e});function iU(e,t){if(1&e&&(yl.j41(0,"p",4)(1,"span",3),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.EFF(4),yl.nI1(5,"date"),yl.k0s()),2&e){const e=yl.XpG();yl.Y8G("ngClass",yl.eq3(8,tU,e.cipher.hasPasswordHistory)),yl.R7$(2),yl.SpI("",yl.bMT(3,3,"datePasswordUpdated"),":"),yl.R7$(2),yl.SpI(" ",yl.i5U(5,5,e.cipher.passwordRevisionDisplayDate,"medium")," ")}}function nU(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",7),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.viewPasswordHistory())}),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()}2&e&&(yl.R7$(),yl.SpI(" ",yl.bMT(2,1,"passwordHistory")," "))}class rU{constructor(e){this.viewPasswordHistoryService=e}get isLogin(){return this.cipher.type===CR.Login}viewPasswordHistory(){return QO(this,void 0,void 0,function*(){yield this.viewPasswordHistoryService.viewPasswordHistory(this.cipher)})}}rU.ɵfac=function(e){return new(e||rU)(yl.rXU(ZO))},rU.ɵcmp=yl.VBU({type:rU,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&&(yl.j41(0,"bit-section",0)(1,"bit-section-header")(2,"h2",1),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s()(),yl.j41(5,"bit-card")(6,"p",2)(7,"span",3),yl.EFF(8),yl.nI1(9,"i18n"),yl.k0s(),yl.EFF(10),yl.nI1(11,"date"),yl.k0s(),yl.j41(12,"p",4)(13,"span",3),yl.EFF(14),yl.nI1(15,"i18n"),yl.k0s(),yl.EFF(16),yl.nI1(17,"date"),yl.k0s(),yl.DNE(18,iU,6,10,"p",5)(19,nU,3,3,"button",6),yl.k0s()()),2&e&&(yl.R7$(3),yl.JRh(yl.bMT(4,8,"itemHistory")),yl.R7$(5),yl.SpI("",yl.bMT(9,10,"lastEdited"),":"),yl.R7$(2),yl.SpI(" ",yl.i5U(11,12,t.cipher.revisionDate,"medium")," "),yl.R7$(2),yl.Y8G("ngClass",yl.l_i(20,eU,t.cipher.hasPasswordHistory,!t.cipher.hasPasswordHistory)),yl.R7$(2),yl.SpI("",yl.bMT(15,15,"dateCreated"),":"),yl.R7$(2),yl.SpI(" ",yl.i5U(17,17,t.cipher.creationDate,"medium")," "),yl.R7$(2),yl.Y8G("ngIf",t.cipher.passwordRevisionDisplayDate),yl.R7$(),yl.Y8G("ngIf",t.cipher.hasPasswordHistory))},dependencies:[pl.MD,pl.YU,pl.bT,qf,sw.iI,WR,ZR,ex,Xl,Wl,Oh,Kb,pl.vh,Xf],encapsulation:2});class sU{}var oU=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 aU{constructor(e,t,i,n,r){this.templateRef=e,this.viewContainer=t,this.billingAccountProfileStateService=i,this.destroyRef=n,this.accountService=r}ngOnInit(){return oU(this,void 0,void 0,function*(){const e=yield(0,ho._)(this.accountService.activeAccount$);e?this.billingAccountProfileStateService.hasPremiumFromAnySource$(e.id).pipe((0,wl.pQ)(this.destroyRef)).subscribe(e=>{e?this.viewContainer.clear():this.viewContainer.createEmbeddedView(this.templateRef)}):this.viewContainer.createEmbeddedView(this.templateRef)})}}aU.ɵfac=function(e){return new(e||aU)(yl.rXU(yl.C4Q),yl.rXU(yl.c1b),yl.rXU(ME),yl.rXU(a.abz),yl.rXU(Ok))},aU.ɵdir=yl.FsC({type:aU,selectors:[["","appNotPremium",""]],standalone:!1});var lU=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 cU(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",1),yl.bIt("click",function(t){a.eBV(e);const i=yl.XpG();return a.Njj(i.promptForPremium(t))}),yl.nrm(1,"i",2),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s()}2&e&&(yl.Y8G("variant","primary"),yl.R7$(2),yl.SpI("",yl.bMT(3,2,"upgrade")," "))}class uU{constructor(e){this.premiumUpgradePromptService=e,this.organizationId=(0,o.hFB)()}promptForPremium(e){return lU(this,void 0,void 0,function*(){e.stopPropagation(),e.preventDefault(),yield this.premiumUpgradePromptService.promptForPremium(this.organizationId())})}}uU.ɵfac=function(e){return new(e||uU)(yl.rXU(sU))},uU.ɵcmp=yl.VBU({type:uU,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&&yl.DNE(0,cU,4,4,"button",0)},dependencies:[Kc,_c,qf,aU,Xf],encapsulation:2});var dU=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 hU=(e,t)=>({"tw-text-main":e,"tw-text-danger":t}),pU=(e,t)=>({"tw-stroke-text-main":e,"tw-stroke-danger-600":t}),fU=e=>({"stroke-dashoffset.px":e});function vU(e,t){if(1&e&&(yl.qex(0),yl.j41(1,"div",1)(2,"span",2)(3,"span",3),yl.EFF(4),yl.k0s(),a.qSk(),yl.j41(5,"svg",4)(6,"g"),yl.nrm(7,"circle",5)(8,"circle",6),yl.k0s()()()(),yl.bVm()),2&e){const e=t.ngIf;yl.R7$(3),yl.Y8G("ngClass",yl.l_i(5,hU,!e.totpLow,e.totpLow)),yl.R7$(),yl.JRh(e.totpSec),yl.R7$(3),yl.Y8G("ngClass",yl.l_i(8,pU,!e.totpLow,e.totpLow))("ngStyle",yl.eq3(11,fU,e.totpDash)),yl.R7$(),yl.Y8G("ngClass",yl.l_i(13,pU,!e.totpLow,e.totpLow))}}class mU{constructor(e){this.totpService=e,this.sendCopyCode=new yl.bkB}ngOnInit(){return dU(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,Fo.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}}mU.ɵfac=function(e){return new(e||mU)(yl.rXU(UE))},mU.ɵcmp=yl.VBU({type:mU,selectors:[["","bitTotpCountdown",""]],inputs:{cipher:"cipher"},outputs:{sendCopyCode:"sendCopyCode"},features:[yl.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&&(yl.DNE(0,vU,9,16,"ng-container",0),yl.nI1(1,"async")),2&e&&yl.Y8G("ngIf",yl.bMT(1,1,t.totpInfo$))},dependencies:[pl.MD,pl.YU,pl.bT,pl.B3,Xl,Wl,pl.Jj],encapsulation:2});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 yU=["passwordInput"],bU=e=>({"tw-hidden":e}),wU=e=>({"tw-mt-3":e,"tw-mb-2":!0});function SU(e,t){if(1&e&&(yl.j41(0,"bit-form-field")(1,"bit-label",5),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.nrm(4,"input",6)(5,"button",7),yl.nI1(6,"i18n"),yl.nI1(7,"i18n"),yl.k0s()),2&e){const e=yl.XpG();yl.R7$(),yl.Y8G("appTextDrag",e.cipher.login.username),yl.R7$(),yl.SpI(" ",yl.bMT(3,6,"username")," "),yl.R7$(2),yl.Y8G("value",e.cipher.login.username),yl.R7$(),yl.Y8G("appCopyClick",e.cipher.login.username)("valueLabel",yl.bMT(6,8,"username"))("label",yl.bMT(7,10,"copyUsername"))}}function kU(e,t){if(1&e&&(yl.j41(0,"span",14),yl.nrm(1,"bit-color-password",15),yl.k0s()),2&e){const e=yl.XpG(2);yl.BMQ("aria-label",e.cipher.login.password),yl.R7$(),yl.Y8G("password",e.cipher.login.password)}}function IU(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",16),yl.nI1(1,"i18n"),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG(2);return a.Njj(t.togglePasswordCount())}),yl.k0s()}if(2&e){const e=yl.XpG(2);yl.Y8G("label",yl.bMT(1,2,e.showPasswordCount?"hideCharacterCount":"showCharacterCount")),yl.BMQ("aria-expanded",e.showPasswordCount)}}function CU(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",17),yl.bIt("toggledChange",function(t){a.eBV(e);const i=yl.XpG(2);return a.Njj(i.pwToggleValue(t))}),yl.k0s()}if(2&e){const e=yl.XpG(2);yl.Y8G("toggled",e.passwordRevealed)}}function TU(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",18),yl.nI1(1,"i18n"),yl.nI1(2,"i18n"),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG(2);return a.Njj(t.logCopyEvent())}),yl.k0s()}if(2&e){const e=yl.XpG(2);yl.Y8G("appCopyClick",e.cipher.login.password)("valueLabel",yl.bMT(1,3,"password"))("label",yl.bMT(2,5,"copyPassword"))}}function PU(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"bit-hint")(1,"a",19),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG(2);return a.Njj(t.launchChangePasswordEvent())}),yl.EFF(2),yl.nI1(3,"i18n"),yl.nrm(4,"i",20),yl.k0s()()}2&e&&(yl.R7$(2),yl.SpI(" ",yl.bMT(3,1,"changeAtRiskPassword")," "))}function FU(e,t){if(1&e&&(yl.j41(0,"bit-form-field")(1,"bit-label",8),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.nrm(4,"input",9,0),yl.DNE(6,kU,2,2,"span",10)(7,IU,2,4,"button",11)(8,CU,1,1,"button",12)(9,TU,3,7,"button",13)(10,PU,5,3,"bit-hint",3),yl.k0s()),2&e){const e=yl.XpG();yl.R7$(),yl.Y8G("appTextDrag",e.cipher.login.password),yl.R7$(),yl.SpI(" ",yl.bMT(3,9,"password")," "),yl.R7$(2),yl.Y8G("ngClass",yl.eq3(11,bU,e.passwordRevealed))("value",e.cipher.login.password),yl.R7$(2),yl.Y8G("ngIf",e.passwordRevealed),yl.R7$(),yl.Y8G("ngIf",e.cipher.viewPassword&&e.passwordRevealed),yl.R7$(),yl.Y8G("ngIf",e.cipher.viewPassword),yl.R7$(),yl.Y8G("ngIf",e.cipher.viewPassword),yl.R7$(),yl.Y8G("ngIf",e.showChangePasswordLink)}}function RU(e,t){if(1&e&&(yl.j41(0,"div",21),yl.nrm(1,"bit-color-password",22),yl.k0s()),2&e){const e=yl.XpG();yl.Y8G("ngClass",yl.eq3(3,wU,!e.cipher.login.totp)),yl.R7$(),yl.Y8G("password",e.cipher.login.password)("showCount",!0)}}function xU(e,t){if(1&e&&(yl.j41(0,"bit-form-field")(1,"bit-label",5),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.nrm(4,"input",23),yl.k0s()),2&e){const e=yl.XpG();yl.R7$(),yl.Y8G("appTextDrag",e.fido2CredentialCreationDateValue),yl.R7$(),yl.SpI("",yl.bMT(3,3,"typePasskey")," "),yl.R7$(2),yl.Y8G("value",e.fido2CredentialCreationDateValue)}}function AU(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"div",29),yl.bIt("sendCopyCode",function(t){a.eBV(e);const i=yl.XpG(2);return a.Njj(i.setTotpCopyCode(t))}),yl.k0s()}if(2&e){const e=yl.XpG(2);yl.Y8G("cipher",e.cipher)}}function DU(e,t){if(1&e&&(yl.j41(0,"bit-form-field")(1,"bit-label",5)(2,"div",24),yl.EFF(3),yl.nI1(4,"i18n"),yl.nrm(5,"app-premium-badge",25),yl.k0s()(),yl.nrm(6,"input",26),yl.nI1(7,"async"),yl.DNE(8,AU,1,1,"div",27),yl.nI1(9,"async"),yl.nrm(10,"button",28),yl.nI1(11,"i18n"),yl.nI1(12,"i18n"),yl.nI1(13,"async"),yl.k0s()),2&e){const e=yl.XpG();yl.R7$(),yl.Y8G("appTextDrag",null==e.totpCodeCopyObj?null:e.totpCodeCopyObj.totpCode),yl.R7$(2),yl.SpI(" ",yl.bMT(4,10,"verificationCodeTotp")," "),yl.R7$(2),yl.Y8G("organizationId",e.cipher.organizationId),yl.R7$(),yl.Y8G("type",yl.bMT(7,12,e.isPremium$)?"text":"password")("value",(null==e.totpCodeCopyObj?null:e.totpCodeCopyObj.totpCodeFormatted)||"*** ***"),yl.R7$(2),yl.Y8G("ngIf",yl.bMT(9,14,e.isPremium$)),yl.R7$(2),yl.Y8G("appCopyClick",null==e.totpCodeCopyObj?null:e.totpCodeCopyObj.totpCode)("valueLabel",yl.bMT(11,16,"verificationCodeTotp"))("label",yl.bMT(12,18,"copyVerificationCode"))("disabled",!yl.bMT(13,20,e.isPremium$))}}class EU{constructor(e,t,i,n,r){this.billingAccountProfileStateService=e,this.i18nService=t,this.premiumUpgradeService=i,this.eventCollectionService=n,this.accountService=r,this.handleChangePassword=new yl.bkB,this.isPremium$=this.accountService.activeAccount$.pipe((0,co.n)(e=>this.billingAccountProfileStateService.hasPremiumFromAnySource$(e.id))),this.showPasswordCount=!1,this.passwordRevealed=!1,this.datePipe=(0,a.WQX)(pl.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 gU(this,void 0,void 0,function*(){this.passwordRevealed=e,e&&(yield this.eventCollectionService.collect(Ra.Cipher_ClientToggledPasswordVisible,this.cipher.id,!1,this.cipher.organizationId))})}togglePasswordCount(){this.showPasswordCount=!this.showPasswordCount}setTotpCopyCode(e){this.totpCodeCopyObj=e}logCopyEvent(){return gU(this,void 0,void 0,function*(){yield this.eventCollectionService.collect(Ra.Cipher_ClientCopiedPassword,this.cipher.id,!1,this.cipher.organizationId)})}launchChangePasswordEvent(){this.handleChangePassword.emit()}}EU.ɵfac=function(e){return new(e||EU)(yl.rXU(ME),yl.rXU(Pl),yl.rXU(sU),yl.rXU(OE),yl.rXU(Ok))},EU.ɵcmp=yl.VBU({type:EU,selectors:[["app-login-credentials-view"]],viewQuery:function(e,t){if(1&e&&yl.GBs(yU,5),2&e){let e;yl.mGM(e=yl.lsd())&&(t.passwordInput=e.first)}},inputs:{cipher:"cipher",activeUserId:"activeUserId",showChangePasswordLink:"showChangePasswordLink"},outputs:{handleChangePassword:"handleChangePassword"},features:[yl.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"],["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"],["bitLink","","href","#","appStopClick","",3,"click"],["aria-hidden","true",1,"bwi","bwi-external-link","tw-ml-1"],[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&&(yl.j41(0,"section",1)(1,"bit-section-header")(2,"h2",2),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s()(),yl.j41(5,"read-only-cipher-card"),yl.DNE(6,SU,8,12,"bit-form-field",3)(7,FU,11,13,"bit-form-field",3)(8,RU,2,5,"div",4)(9,xU,5,5,"bit-form-field",3)(10,DU,14,22,"bit-form-field",3),yl.k0s()()),2&e&&(yl.R7$(3),yl.JRh(yl.bMT(4,6,"loginCredentials")),yl.R7$(3),yl.Y8G("ngIf",t.cipher.login.username),yl.R7$(),yl.Y8G("ngIf",t.cipher.login.password),yl.R7$(),yl.Y8G("ngIf",t.showPasswordCount&&t.passwordRevealed),yl.R7$(),yl.Y8G("ngIf",(null==t.cipher.login||null==t.cipher.login.fido2Credentials?null:t.cipher.login.fido2Credentials.length)>0),yl.R7$(),yl.Y8G("ngIf",t.cipher.login.totp))},dependencies:[pl.MD,pl.YU,pl.bT,qf,sP,g$,y$,ex,Xl,Wl,Eu,Sc,nu,ou,Du,Vb,Bb,_l,zl,Kc,sO,dO,mU,Z$,Oh,_b,uU,pl.Jj,Xf],encapsulation:2});class $U{constructor(){this.revealSshKey=!1}ngOnChanges(e){e.sshKey&&(this.revealSshKey=!1)}}function OU(e,t){if(1&e&&(yl.j41(0,"bit-form-field")(1,"bit-label",4),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.nrm(4,"input",5)(5,"button",6),yl.nI1(6,"i18n"),yl.nI1(7,"i18n"),yl.k0s()),2&e){const e=yl.XpG(2);yl.R7$(),yl.Y8G("appTextDrag",e.cipher.identity.fullName),yl.R7$(),yl.JRh(yl.bMT(3,6,"name")),yl.R7$(2),yl.Y8G("value",e.cipher.identity.fullName),yl.R7$(),yl.Y8G("label",yl.bMT(6,8,"copyName"))("appCopyClick",e.cipher.identity.fullName)("valueLabel",yl.bMT(7,10,"name"))}}function UU(e,t){if(1&e&&(yl.j41(0,"bit-form-field")(1,"bit-label",4),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.nrm(4,"input",7)(5,"button",8),yl.nI1(6,"i18n"),yl.nI1(7,"i18n"),yl.k0s()),2&e){const e=yl.XpG(2);yl.R7$(),yl.Y8G("appTextDrag",e.cipher.identity.username),yl.R7$(),yl.JRh(yl.bMT(3,6,"username")),yl.R7$(2),yl.Y8G("value",e.cipher.identity.username),yl.R7$(),yl.Y8G("label",yl.bMT(6,8,"copyUsername"))("appCopyClick",e.cipher.identity.username)("valueLabel",yl.bMT(7,10,"username"))}}function MU(e,t){if(1&e&&(yl.j41(0,"bit-form-field")(1,"bit-label",4),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.nrm(4,"input",9)(5,"button",10),yl.nI1(6,"i18n"),yl.nI1(7,"i18n"),yl.k0s()),2&e){const e=yl.XpG(2);yl.R7$(),yl.Y8G("appTextDrag",e.cipher.identity.company),yl.R7$(),yl.JRh(yl.bMT(3,6,"company")),yl.R7$(2),yl.Y8G("value",e.cipher.identity.company),yl.R7$(),yl.Y8G("label",yl.bMT(6,8,"copyCompany"))("appCopyClick",e.cipher.identity.company)("valueLabel",yl.bMT(7,10,"company"))}}function NU(e,t){if(1&e&&(yl.j41(0,"section",1)(1,"bit-section-header")(2,"h2",2),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s()(),yl.j41(5,"read-only-cipher-card"),yl.DNE(6,OU,8,12,"bit-form-field",3)(7,UU,8,12,"bit-form-field",3)(8,MU,8,12,"bit-form-field",3),yl.k0s()()),2&e){const e=yl.XpG();yl.R7$(3),yl.JRh(yl.bMT(4,4,"personalDetails")),yl.R7$(3),yl.Y8G("ngIf",e.cipher.identity.fullName),yl.R7$(),yl.Y8G("ngIf",e.cipher.identity.username),yl.R7$(),yl.Y8G("ngIf",e.cipher.identity.company)}}function VU(e,t){if(1&e&&(yl.j41(0,"bit-form-field")(1,"bit-label",4),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.nrm(4,"input",11)(5,"button",12)(6,"button",13),yl.nI1(7,"i18n"),yl.nI1(8,"i18n"),yl.k0s()),2&e){const e=yl.XpG(2);yl.R7$(),yl.Y8G("appTextDrag",e.cipher.identity.ssn),yl.R7$(),yl.JRh(yl.bMT(3,6,"ssn")),yl.R7$(2),yl.Y8G("value",e.cipher.identity.ssn),yl.R7$(2),yl.Y8G("label",yl.bMT(7,8,"copySSN"))("appCopyClick",e.cipher.identity.ssn)("valueLabel",yl.bMT(8,10,"ssn"))}}function BU(e,t){if(1&e&&(yl.j41(0,"bit-form-field")(1,"bit-label",4),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.nrm(4,"input",14)(5,"button",15)(6,"button",16),yl.nI1(7,"i18n"),yl.nI1(8,"i18n"),yl.k0s()),2&e){const e=yl.XpG(2);yl.R7$(),yl.Y8G("appTextDrag",e.cipher.identity.passportNumber),yl.R7$(),yl.JRh(yl.bMT(3,6,"passportNumber")),yl.R7$(2),yl.Y8G("value",e.cipher.identity.passportNumber),yl.R7$(2),yl.Y8G("label",yl.bMT(7,8,"copyPassportNumber"))("appCopyClick",e.cipher.identity.passportNumber)("valueLabel",yl.bMT(8,10,"passportNumber"))}}function jU(e,t){if(1&e&&(yl.j41(0,"bit-form-field")(1,"bit-label",4),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.nrm(4,"input",17)(5,"button",18),yl.nI1(6,"i18n"),yl.nI1(7,"i18n"),yl.k0s()),2&e){const e=yl.XpG(2);yl.R7$(),yl.Y8G("appTextDrag",e.cipher.identity.licenseNumber),yl.R7$(),yl.JRh(yl.bMT(3,6,"licenseNumber")),yl.R7$(2),yl.Y8G("value",e.cipher.identity.licenseNumber),yl.R7$(),yl.Y8G("label",yl.bMT(6,8,"copyLicenseNumber"))("appCopyClick",e.cipher.identity.licenseNumber)("valueLabel",yl.bMT(7,10,"licenseNumber"))}}function GU(e,t){if(1&e&&(yl.j41(0,"section",1)(1,"bit-section-header")(2,"h2",2),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s()(),yl.j41(5,"read-only-cipher-card"),yl.DNE(6,VU,9,12,"bit-form-field",3)(7,BU,9,12,"bit-form-field",3)(8,jU,8,12,"bit-form-field",3),yl.k0s()()),2&e){const e=yl.XpG();yl.R7$(3),yl.JRh(yl.bMT(4,4,"identification")),yl.R7$(3),yl.Y8G("ngIf",e.cipher.identity.ssn),yl.R7$(),yl.Y8G("ngIf",e.cipher.identity.passportNumber),yl.R7$(),yl.Y8G("ngIf",e.cipher.identity.licenseNumber)}}function LU(e,t){if(1&e&&(yl.j41(0,"bit-form-field")(1,"bit-label",4),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.nrm(4,"input",19)(5,"button",20),yl.nI1(6,"i18n"),yl.nI1(7,"i18n"),yl.k0s()),2&e){const e=yl.XpG(2);yl.R7$(),yl.Y8G("appTextDrag",e.cipher.identity.email),yl.R7$(),yl.JRh(yl.bMT(3,6,"email")),yl.R7$(2),yl.Y8G("value",e.cipher.identity.email),yl.R7$(),yl.Y8G("label",yl.bMT(6,8,"copyEmail"))("appCopyClick",e.cipher.identity.email)("valueLabel",yl.bMT(7,10,"email"))}}function zU(e,t){if(1&e&&(yl.j41(0,"bit-form-field")(1,"bit-label",4),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.nrm(4,"input",21)(5,"button",22),yl.nI1(6,"i18n"),yl.nI1(7,"i18n"),yl.k0s()),2&e){const e=yl.XpG(2);yl.R7$(),yl.Y8G("appTextDrag",e.cipher.identity.phone),yl.R7$(),yl.JRh(yl.bMT(3,6,"phone")),yl.R7$(2),yl.Y8G("value",e.cipher.identity.phone),yl.R7$(),yl.Y8G("label",yl.bMT(6,8,"copyPhone"))("appCopyClick",e.cipher.identity.phone)("valueLabel",yl.bMT(7,10,"phone"))}}function _U(e,t){if(1&e&&(yl.j41(0,"bit-form-field")(1,"bit-label",4),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.nrm(4,"textarea",23)(5,"button",24),yl.nI1(6,"i18n"),yl.nI1(7,"i18n"),yl.k0s()),2&e){const e=yl.XpG(2);yl.R7$(),yl.Y8G("appTextDrag",e.addressFields),yl.R7$(),yl.JRh(yl.bMT(3,7,"address")),yl.R7$(2),yl.Y8G("value",e.addressFields)("rows",e.addressRows),yl.R7$(),yl.Y8G("label",yl.bMT(6,9,"copyAddress"))("appCopyClick",e.addressFields)("valueLabel",yl.bMT(7,11,"address"))}}function KU(e,t){if(1&e&&(yl.j41(0,"section",1)(1,"bit-section-header")(2,"h2",2),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s()(),yl.j41(5,"read-only-cipher-card"),yl.DNE(6,LU,8,12,"bit-form-field",3)(7,zU,8,12,"bit-form-field",3)(8,_U,8,13,"bit-form-field",3),yl.k0s()()),2&e){const e=yl.XpG();yl.R7$(3),yl.JRh(yl.bMT(4,4,"contactInfo")),yl.R7$(3),yl.Y8G("ngIf",e.cipher.identity.email),yl.R7$(),yl.Y8G("ngIf",e.cipher.identity.phone),yl.R7$(),yl.Y8G("ngIf",e.addressFields)}}$U.ɵfac=function(e){return new(e||$U)},$U.ɵcmp=yl.VBU({type:$U,selectors:[["app-sshkey-view"]],inputs:{sshKey:"sshKey"},features:[yl.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&&(yl.j41(0,"section",0)(1,"bit-section-header")(2,"h2",1),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s()(),yl.j41(5,"read-only-cipher-card")(6,"bit-form-field")(7,"bit-label"),yl.EFF(8),yl.nI1(9,"i18n"),yl.k0s(),yl.nrm(10,"input",2),yl.j41(11,"button",3),yl.mxI("toggledChange",function(e){return yl.DH7(t.revealSshKey,e)||(t.revealSshKey=e),e}),yl.k0s(),yl.nrm(12,"button",4),yl.nI1(13,"i18n"),yl.nI1(14,"i18n"),yl.k0s(),yl.j41(15,"bit-form-field")(16,"bit-label"),yl.EFF(17),yl.nI1(18,"i18n"),yl.k0s(),yl.nrm(19,"input",5)(20,"button",4),yl.nI1(21,"i18n"),yl.nI1(22,"i18n"),yl.k0s(),yl.j41(23,"bit-form-field")(24,"bit-label"),yl.EFF(25),yl.nI1(26,"i18n"),yl.k0s(),yl.nrm(27,"input",6)(28,"button",4),yl.nI1(29,"i18n"),yl.nI1(30,"i18n"),yl.k0s()()()),2&e&&(yl.R7$(3),yl.JRh(yl.bMT(4,17,"typeSshKey")),yl.R7$(5),yl.JRh(yl.bMT(9,19,"sshPrivateKey")),yl.R7$(2),yl.Y8G("value",t.sshKey.privateKey),yl.R7$(),yl.R50("toggled",t.revealSshKey),yl.R7$(),yl.Y8G("label",yl.bMT(13,21,"copyPrivateKey"))("appCopyClick",t.sshKey.privateKey)("valueLabel",yl.bMT(14,23,"sshPrivateKey")),yl.R7$(5),yl.JRh(yl.bMT(18,25,"sshPublicKey")),yl.R7$(2),yl.Y8G("value",t.sshKey.publicKey),yl.R7$(),yl.Y8G("label",yl.bMT(21,27,"copyPublicKey"))("appCopyClick",t.sshKey.publicKey)("valueLabel",yl.bMT(22,29,"sshPublicKey")),yl.R7$(5),yl.JRh(yl.bMT(26,31,"sshFingerprint")),yl.R7$(2),yl.Y8G("value",t.sshKey.keyFingerprint),yl.R7$(),yl.Y8G("label",yl.bMT(29,33,"copyFingerprint"))("appCopyClick",t.sshKey.keyFingerprint)("valueLabel",yl.bMT(30,35,"sshFingerprint")))},dependencies:[pl.MD,qf,g$,ex,Z$,Xl,Wl,Eu,Sc,ou,Du,Vb,Bb,_l,zl,Xf],encapsulation:2});class XU{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)}}XU.ɵfac=function(e){return new(e||XU)},XU.ɵcmp=yl.VBU({type:XU,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&&yl.DNE(0,NU,9,6,"section",0)(1,GU,9,6,"section",0)(2,KU,9,6,"section",0),2&e&&(yl.Y8G("ngIf",t.hasPersonalDetails),yl.R7$(),yl.Y8G("ngIf",t.hasIdentificationDetails),yl.R7$(),yl.Y8G("ngIf",t.hasContactDetails))},dependencies:[pl.bT,qf,g$,y$,ex,Xl,Wl,Eu,Sc,ou,Du,Vb,Bb,_l,zl,Z$,Xf],encapsulation:2});class qU{}class YU extends qU{}class WU{}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){1&e&&(yl.j41(0,"bit-callout",10),yl.nI1(1,"i18n"),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s()),2&e&&(yl.Y8G("title",yl.bMT(1,2,"cardExpiredTitle")),yl.R7$(2),yl.SpI(" ",yl.bMT(3,4,"cardExpiredMessage")," "))}function ZU(e,t){1&e&&(yl.j41(0,"bit-callout",11),yl.nI1(1,"i18n"),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s()),2&e&&(yl.Y8G("title",yl.bMT(1,2,"missingWebsite")),yl.R7$(2),yl.SpI(" ",yl.bMT(3,4,"changeAtRiskPasswordAndAddWebsite")," "))}function QU(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"bit-callout",11)(1,"a",12),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG(2);return a.Njj(t.launchChangePassword())}),yl.EFF(2),yl.nI1(3,"i18n"),yl.nrm(4,"i",13),yl.k0s()()}2&e&&(yl.Y8G("title",""),yl.R7$(2),yl.SpI(" ",yl.bMT(3,2,"changeAtRiskPassword")," "))}function eM(e,t){1&e&&(yl.j41(0,"p",14),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()),2&e&&(yl.R7$(),yl.SpI(" ",yl.bMT(2,1,"noEditPermissions")," "))}function tM(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"app-login-credentials-view",15),yl.nI1(1,"async"),yl.bIt("handleChangePassword",function(){a.eBV(e);const t=yl.XpG(2);return a.Njj(t.launchChangePassword())}),yl.k0s()}if(2&e){const e=yl.XpG(2);yl.Y8G("cipher",e.cipher())("activeUserId",yl.bMT(1,3,e.activeUserId$))("showChangePasswordLink",e.showChangePasswordLink())}}function iM(e,t){if(1&e&&yl.nrm(0,"app-autofill-options-view",16),2&e){const e=yl.XpG(2);yl.Y8G("loginUris",e.cipher().login.uris)("cipherId",e.cipher().id)}}function nM(e,t){if(1&e&&yl.nrm(0,"app-card-details-view",9),2&e){const e=yl.XpG(2);yl.Y8G("cipher",e.cipher())}}function rM(e,t){if(1&e&&yl.nrm(0,"app-view-identity-sections",9),2&e){const e=yl.XpG(2);yl.Y8G("cipher",e.cipher())}}function sM(e,t){if(1&e&&yl.nrm(0,"app-sshkey-view",17),2&e){const e=yl.XpG(2);yl.Y8G("sshKey",e.cipher().sshKey)}}function oM(e,t){if(1&e&&(yl.qex(0),yl.nrm(1,"app-additional-options",18),yl.bVm()),2&e){const e=yl.XpG(2);yl.R7$(),yl.Y8G("notes",e.cipher().notes)}}function aM(e,t){if(1&e&&(yl.qex(0),yl.nrm(1,"app-custom-fields-v2",9),yl.bVm()),2&e){const e=yl.XpG(2);yl.R7$(),yl.Y8G("cipher",e.cipher())}}function lM(e,t){if(1&e&&(yl.qex(0),yl.nrm(1,"app-attachments-v2-view",19),yl.bVm()),2&e){const e=yl.XpG(2);yl.R7$(),yl.Y8G("emergencyAccessId",e.emergencyAccessId())("cipher",e.cipher())("admin",e.isAdminConsole())}}function cM(e,t){if(1&e&&(yl.qex(0),yl.DNE(1,JU,4,6,"bit-callout",1)(2,ZU,4,6,"bit-callout",2)(3,QU,5,4,"bit-callout",2)(4,eM,3,3,"p",3),yl.nrm(5,"app-item-details-v2",4),yl.DNE(6,tM,2,5,"app-login-credentials-view",5)(7,iM,1,2,"app-autofill-options-view",6)(8,nM,1,1,"app-card-details-view",7)(9,rM,1,1,"app-view-identity-sections",7)(10,sM,1,1,"app-sshkey-view",8)(11,oM,2,1,"ng-container",0)(12,aM,2,1,"ng-container",0)(13,lM,2,3,"ng-container",0),yl.nrm(14,"app-item-history-v2",9),yl.bVm()),2&e){let e,t,i,n,r;const s=yl.XpG();yl.R7$(),yl.Y8G("ngIf",s.cardIsExpired()),yl.R7$(),yl.Y8G("ngIf",!s.hasLoginUri()&&s.hadPendingChangePasswordTask()),yl.R7$(),yl.Y8G("ngIf",s.showChangePasswordLink()),yl.R7$(),yl.Y8G("ngIf",(null==(e=s.cipher())?null:e.isDeleted)&&!(null!=(e=s.cipher())&&e.edit)),yl.R7$(),yl.Y8G("cipher",s.cipher())("organization",s.organization())("collections",s.resolvedCollections())("folder",s.folder())("hideOwner",s.isAdminConsole()),yl.R7$(),yl.Y8G("ngIf",s.hasLogin()),yl.R7$(),yl.Y8G("ngIf",s.hasAutofill()),yl.R7$(),yl.Y8G("ngIf",s.hasCard()),yl.R7$(),yl.Y8G("ngIf",null==(t=s.cipher())?null:t.identity),yl.R7$(),yl.Y8G("ngIf",s.hasSshKey()),yl.R7$(),yl.Y8G("ngIf",null==(i=s.cipher())?null:i.notes),yl.R7$(),yl.Y8G("ngIf",null==(n=s.cipher())?null:n.hasFields),yl.R7$(),yl.Y8G("ngIf",null==(r=s.cipher())?null:r.hasAttachments),yl.R7$(),yl.Y8G("cipher",s.cipher())}}class uM{constructor(e,t,i,n,r,s,a,c,u,d,h,p){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.configService=p,this.cipher=o.hFB.required(),this.cipher$=(0,wl.br)(this.cipher),this.emergencyAccessId=(0,o.hFB)(),this.collections=(0,o.hFB)(void 0),this.isAdminConsole=(0,o.hFB)(!1),this.activeUserId$=Gp(this.accountService.activeAccount$),this.resolvedCollections=(0,wl.ot)((0,$o.z)([this.activeUserId$,this.cipher$,(0,wl.br)(this.collections)]).pipe((0,co.n)(([e,t,i])=>i&&i.length>0?(0,Oo.of)(i):t.collectionIds&&t.collectionIds.length>0?this.collectionService.decryptedCollections$(e).pipe(e$(t.collectionIds)):(0,Oo.of)(void 0)))),this.organization=(0,wl.ot)((0,$o.z)([this.activeUserId$,this.cipher$]).pipe((0,co.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,Oo.of)(void 0)))),this.folder=(0,wl.ot)((0,$o.z)([this.activeUserId$,this.cipher$]).pipe((0,co.n)(([e,t])=>e&&(null==t?void 0:t.folderId)?this.folderService.getDecrypted$(t.folderId,e):(0,Oo.of)(void 0)))),this.hadPendingChangePasswordTask=(0,wl.ot)((0,$o.z)([this.activeUserId$,this.cipher$]).pipe((0,co.n)(([e,t])=>(null==t?void 0:t.type)===CR.Login&&(null==t?void 0:t.organizationId)?(0,$o.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===yE))&&void 0!==n&&n)}),(0,vd.W)(e=>(this.logService.error("Failed to retrieve change password tasks for cipher",e),(0,Oo.of)(!1)))):(0,Oo.of)(!1))),{initialValue:!1}),this.hasCard=(0,bl.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,bl.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=a$(i),s=r?parseInt(r,10):NaN,o=sn.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,bl.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,bl.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,bl.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,bl.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,wl.ot)((0,$o.z)([this.activeUserId$,this.cipher$,this.configService.getFeatureFlag$(Nf.RiskInsightsForPremium)]).pipe((0,co.n)(([e,t,i])=>i&&t.hasLoginPassword&&t.edit&&!t.organizationId&&!t.isDeleted?this.switchPremium$(e,()=>(0,md.H)(this.checkIfPasswordIsAtRisk(t.id,e)).pipe((0,sd.Z)(!1)),()=>(0,Oo.of)(!1)):(0,Oo.of)(!1))),{initialValue:!1}),this.showChangePasswordLink=(0,bl.EW)(()=>this.hasLoginUri()&&(this.hadPendingChangePasswordTask()||this.passwordIsAtRisk())),this.launchChangePassword=()=>HU(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,co.n)(e=>e?t():i()))}checkIfPasswordIsAtRisk(e,t){return HU(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}})}}uM.ɵfac=function(e){return new(e||uM)(yl.rXU(AF),yl.rXU(BF),yl.rXU(qU),yl.rXU(Ok),yl.rXU(kE),yl.rXU(Eb),yl.rXU(WU),yl.rXU(Fb),yl.rXU(za),yl.rXU(c$),yl.rXU(ME),yl.rXU(uk))},uM.ɵcmp=yl.VBU({type:uM,selectors:[["app-cipher-view"]],inputs:{cipher:[1,"cipher"],emergencyAccessId:[1,"emergencyAccessId"],collections:[1,"collections"],isAdminConsole:[1,"isAdminConsole"]},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",3,"click"],["aria-hidden","true",1,"bwi","bwi-external-link","tw-ml-1"],["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&&yl.DNE(0,cM,15,18,"ng-container",0),2&e&&yl.Y8G("ngIf",!!t.cipher())},dependencies:[td,ed,pl.MD,pl.bT,v$,qf,sP,JO,b$,Y$,rU,PO,rO,$U,XU,EU,J$,_b,Xl,Wl,pl.Jj,Xf],encapsulation:2});class dM{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 hM{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 pM{constructor(e){this.type=FR.Text,null!=e&&(this.type=e.type,this.name=e.name,this.value=e.value,this.linkedId=e.linkedId)}}class fM{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 vM{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 mM{constructor(e){null!=e&&(this.uri=e.uri,this.uriChecksum=e.uriChecksum,this.match=e.match)}}class gM{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 mM(e))),e.fido2Credentials&&(this.fido2Credentials=null===(t=e.fido2Credentials)||void 0===t?void 0:t.map(e=>new vM(e))))}}class yM{constructor(e){null!=e&&(this.password=e.password,this.lastUsedDate=e.lastUsedDate)}}class bM{constructor(e){this.type=$R,null!=e&&(this.type=e.type)}}class wM{constructor(e){null!=e&&(this.privateKey=e.privateKey,this.publicKey=e.publicKey,this.keyFingerprint=e.keyFingerprint)}}class SM{constructor(e,t){if(this.id="",this.edit=!1,this.viewPassword=!0,this.organizationUseTotp=!1,this.favorite=!1,this.type=CR.Login,this.name="",this.reprompt=kR.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 CR.Login:this.login=new gM(e.login);break;case CR.SecureNote:this.secureNote=new bM(e.secureNote);break;case CR.Card:this.card=new hM(e.card);break;case CR.Identity:this.identity=new fM(e.identity);break;case CR.SshKey:this.sshKey=new wM(e.sshKey)}null!=e.fields&&(this.fields=e.fields.map(e=>new pM(e))),null!=e.attachments&&(this.attachments=e.attachments.map(e=>new dM(e))),null!=e.passwordHistory&&(this.passwordHistory=e.passwordHistory.map(e=>new yM(e)))}else this.creationDate=this.revisionDate=(new Date).toISOString()}static fromJSON(e){const t=Object.assign(new SM,e);return null!=e.permissions&&(t.permissions=Ix.fromJSON(e.permissions)),t}}const kM=e=>null!=e?new up(e):void 0,IM=e=>null!=e?up.fromJSON(e):void 0;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 TM extends _p{constructor(e){super(),null!=e&&(this.id=e.id,this.url=e.url,this.size=e.size,this.sizeName=e.sizeName,this.fileName=kM(e.fileName),this.key=kM(e.key))}decrypt(e){return CM(this,arguments,void 0,function*(e,t="No Cipher Context"){const i=yield this.decryptObj(this,new I$(this),["fileName"],e,"DomainType: Attachment; "+t);return null!=this.key&&(i.key=yield this.decryptAttachmentKey(e),i.encryptedKey=this.key),i})}decryptAttachmentKey(e){return CM(this,void 0,void 0,function*(){try{if(null==this.key)return;const t=kd.getContainerService().getEncryptService();return yield t.unwrapSymmetricKey(this.key,e)}catch(e){return void console.error("[Attachment] Error decrypting attachment",e)}})}toAttachmentData(){const e=new dM;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 TM;return t.id=e.id,t.url=e.url,t.size=e.size,t.sizeName=e.sizeName,t.key=IM(e.key),t.fileName=IM(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 TM;return t.id=e.id,t.url=e.url,t.size=e.size,t.sizeName=e.sizeName,t.fileName=IM(e.fileName),t.key=IM(e.key),t}}var PM=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 FM extends _p{constructor(e){super(),null!=e&&(this.cardholderName=kM(e.cardholderName),this.brand=kM(e.brand),this.number=kM(e.number),this.expMonth=kM(e.expMonth),this.expYear=kM(e.expYear),this.code=kM(e.code))}decrypt(e){return PM(this,arguments,void 0,function*(e,t="No Cipher Context"){return this.decryptObj(this,new x$,["cardholderName","brand","number","expMonth","expYear","code"],e,"DomainType: Card; "+t)})}toCardData(){const e=new hM;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 FM;return t.cardholderName=IM(e.cardholderName),t.brand=IM(e.brand),t.number=IM(e.number),t.expMonth=IM(e.expMonth),t.expYear=IM(e.expYear),t.code=IM(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 FM;return t.cardholderName=IM(e.cardholderName),t.brand=IM(e.brand),t.number=IM(e.number),t.expMonth=IM(e.expMonth),t.expYear=IM(e.expYear),t.code=IM(e.code),t}}class RM extends _p{constructor(e){var t;super(),this.type=FR.Text,null!=e&&(this.type=e.type,this.linkedId=null!==(t=e.linkedId)&&void 0!==t?t:void 0,this.name=kM(e.name),this.value=kM(e.value))}decrypt(e){return this.decryptObj(this,new D$(this),["name","value"],e)}toFieldData(){const e=new pM;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 RM;return n.type=null!==(t=e.type)&&void 0!==t?t:FR.Text,n.linkedId=null!==(i=e.linkedId)&&void 0!==i?i:void 0,n.name=IM(e.name),n.value=IM(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:RR(this.type),linkedId:ER(this.linkedId)}}static fromSdkField(e){if(null==e)return;const t=new RM;return t.name=IM(e.name),t.value=IM(e.value),t.type=e.type,t.linkedId=e.linkedId,t}}class xM extends _p{constructor(e){super(),null!=e&&(this.title=kM(e.title),this.firstName=kM(e.firstName),this.middleName=kM(e.middleName),this.lastName=kM(e.lastName),this.address1=kM(e.address1),this.address2=kM(e.address2),this.address3=kM(e.address3),this.city=kM(e.city),this.state=kM(e.state),this.postalCode=kM(e.postalCode),this.country=kM(e.country),this.company=kM(e.company),this.email=kM(e.email),this.phone=kM(e.phone),this.ssn=kM(e.ssn),this.username=kM(e.username),this.passportNumber=kM(e.passportNumber),this.licenseNumber=kM(e.licenseNumber))}decrypt(e,t="No Cipher Context"){return this.decryptObj(this,new O$,["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 fM;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 xM;return t.title=IM(e.title),t.firstName=IM(e.firstName),t.middleName=IM(e.middleName),t.lastName=IM(e.lastName),t.address1=IM(e.address1),t.address2=IM(e.address2),t.address3=IM(e.address3),t.city=IM(e.city),t.state=IM(e.state),t.postalCode=IM(e.postalCode),t.country=IM(e.country),t.company=IM(e.company),t.email=IM(e.email),t.phone=IM(e.phone),t.ssn=IM(e.ssn),t.username=IM(e.username),t.passportNumber=IM(e.passportNumber),t.licenseNumber=IM(e.licenseNumber),t}toSdkIdentity(){var e,t,i,n,r,s,o,a,l,c,u,d,h,p,f,v,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===(f=this.ssn)||void 0===f?void 0:f.toSdk(),username:null===(v=this.username)||void 0===v?void 0:v.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 xM;return t.title=IM(e.title),t.firstName=IM(e.firstName),t.middleName=IM(e.middleName),t.lastName=IM(e.lastName),t.address1=IM(e.address1),t.address2=IM(e.address2),t.address3=IM(e.address3),t.city=IM(e.city),t.state=IM(e.state),t.postalCode=IM(e.postalCode),t.country=IM(e.country),t.company=IM(e.company),t.email=IM(e.email),t.phone=IM(e.phone),t.ssn=IM(e.ssn),t.username=IM(e.username),t.passportNumber=IM(e.passportNumber),t.licenseNumber=IM(e.licenseNumber),t}}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 DM extends _p{constructor(e){super(),null!=e?(this.credentialId=new up(e.credentialId),this.keyType=new up(e.keyType),this.keyAlgorithm=new up(e.keyAlgorithm),this.keyCurve=new up(e.keyCurve),this.keyValue=new up(e.keyValue),this.rpId=new up(e.rpId),this.counter=new up(e.counter),this.discoverable=new up(e.discoverable),this.userHandle=kM(e.userHandle),this.userName=kM(e.userName),this.rpName=kM(e.rpName),this.userDisplayName=kM(e.userDisplayName),this.creationDate=new Date(e.creationDate)):this.creationDate=new Date}decrypt(e){return AM(this,void 0,void 0,function*(){const t=yield this.decryptObj(this,new U$,["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 vM;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 DM;return t.credentialId=up.fromJSON(e.credentialId),t.keyType=up.fromJSON(e.keyType),t.keyAlgorithm=up.fromJSON(e.keyAlgorithm),t.keyCurve=up.fromJSON(e.keyCurve),t.keyValue=up.fromJSON(e.keyValue),t.rpId=up.fromJSON(e.rpId),t.userHandle=IM(e.userHandle),t.userName=IM(e.userName),t.counter=up.fromJSON(e.counter),t.rpName=IM(e.rpName),t.userDisplayName=IM(e.userDisplayName),t.discoverable=up.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 DM;return t.credentialId=up.fromJSON(e.credentialId),t.keyType=up.fromJSON(e.keyType),t.keyAlgorithm=up.fromJSON(e.keyAlgorithm),t.keyCurve=up.fromJSON(e.keyCurve),t.keyValue=up.fromJSON(e.keyValue),t.rpId=up.fromJSON(e.rpId),t.counter=up.fromJSON(e.counter),t.userHandle=IM(e.userHandle),t.userName=IM(e.userName),t.rpName=IM(e.rpName),t.userDisplayName=IM(e.userDisplayName),t.discoverable=up.fromJSON(e.discoverable),t.creationDate=new Date(e.creationDate),t}}var EM=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 $M extends _p{constructor(e){var t;super(),null!=e&&(this.uri=kM(e.uri),this.uriChecksum=kM(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 uE(this),["uri"],e,t)}validateChecksum(e,t){return EM(this,void 0,void 0,function*(){if(null==this.uriChecksum)return!1;const i=kd.getContainerService().getEncryptService(),n=yield i.hash(e,"sha256");return(yield i.decryptString(this.uriChecksum,t))===n})}toLoginUriData(){const e=new mM;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 $M;return i.uri=IM(e.uri),i.match=null!==(t=e.match)&&void 0!==t?t:void 0,i.uriChecksum=IM(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:QD(this.match)}}static fromSdkLoginUri(e){if(null==e)return;const t=new $M;return t.uri=IM(e.uri),t.uriChecksum=IM(e.uriChecksum),t.match=e.match,t}}var OM=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 extends _p{constructor(e){super(),null!=e&&(this.passwordRevisionDate=null!=e.passwordRevisionDate?new Date(e.passwordRevisionDate):void 0,this.autofillOnPageLoad=e.autofillOnPageLoad,this.username=kM(e.username),this.password=kM(e.password),this.totp=kM(e.totp),e.uris&&(this.uris=e.uris.map(e=>new $M(e))),e.fido2Credentials&&(this.fido2Credentials=e.fido2Credentials.map(e=>new DM(e))))}decrypt(e,t){return OM(this,arguments,void 0,function*(e,t,i="No Cipher Context"){const n=yield this.decryptObj(this,new V$(this),["username","password","totp"],t,`DomainType: Login; ${i}`);if(null!=this.uris){n.uris=[];for(let r=0;re.decrypt(t)))),n})}toLoginData(){const e=new gM;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 UM;return r.passwordRevisionDate=null!=e.passwordRevisionDate?new Date(e.passwordRevisionDate):void 0,r.autofillOnPageLoad=e.autofillOnPageLoad,r.username=IM(e.username),r.password=IM(e.password),r.totp=IM(e.totp),r.uris=null===(t=e.uris)||void 0===t?void 0:t.map(e=>$M.fromJSON(e)).filter(e=>null!=e),r.fido2Credentials=null!==(n=null===(i=e.fido2Credentials)||void 0===i?void 0:i.map(e=>DM.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 UM;return s.passwordRevisionDate=null!=e.passwordRevisionDate?new Date(e.passwordRevisionDate):void 0,s.autofillOnPageLoad=e.autofillOnPageLoad,s.username=IM(e.username),s.password=IM(e.password),s.totp=IM(e.totp),s.uris=null!==(i=null===(t=e.uris)||void 0===t?void 0:t.filter(e=>null!=e.uri).map(e=>$M.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=>DM.fromSdkFido2Credential(e)).filter(e=>null!=e))&&void 0!==r?r:void 0,s}}class MM extends _p{constructor(e){super(),null!=e&&(this.password=new up(e.password),this.lastUsedDate=new Date(e.lastUsedDate))}decrypt(e){return this.decryptObj(this,new B$(this),["password"],e,"DomainType: PasswordHistory")}toPasswordHistoryData(){const e=new yM;return e.lastUsedDate=this.lastUsedDate.toISOString(),this.buildDataModel(this,e,{password:null}),e}static fromJSON(e){if(null==e)return;const t=new MM;return t.password=up.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 MM;return t.password=up.fromJSON(e.password),t.lastUsedDate=new Date(e.lastUsedDate),t}}var NM=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 VM extends _p{constructor(e){super(),this.type=$R,null!=e&&(this.type=e.type)}decrypt(){return NM(this,void 0,void 0,function*(){return new j$(this)})}toSecureNoteData(){const e=new bM;return e.type=this.type,e}static fromJSON(e){if(null==e)return;const t=new VM;return t.type=e.type,t}toSdkSecureNote(){return{type:(this.type,$R)}}static fromSdkSecureNote(e){if(null==e)return;const t=new VM;return t.type=e.type,t}}class BM extends _p{constructor(e){super(),null!=e&&(this.privateKey=new up(e.privateKey),this.publicKey=new up(e.publicKey),this.keyFingerprint=new up(e.keyFingerprint))}decrypt(e,t="No Cipher Context"){return this.decryptObj(this,new G$,["privateKey","publicKey","keyFingerprint"],e,"DomainType: SshKey; "+t)}toSshKeyData(){const e=new wM;return this.buildDataModel(this,e,{privateKey:null,publicKey:null,keyFingerprint:null}),e}static fromJSON(e){if(null==e)return;const t=new BM;return t.privateKey=up.fromJSON(e.privateKey),t.publicKey=up.fromJSON(e.publicKey),t.keyFingerprint=up.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 BM;return t.privateKey=up.fromJSON(e.privateKey),t.publicKey=up.fromJSON(e.publicKey),t.keyFingerprint=up.fromJSON(e.fingerprint),t}}var jM=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 GM extends _p{constructor(e,t){var i;if(super(),this.initializerKey=w$.Cipher,this.id="",this.name=new up(""),this.type=CR.Login,this.favorite=!1,this.organizationUseTotp=!1,this.edit=!1,this.viewPassword=!0,this.collectionIds=[],this.reprompt=kR.None,null!=e){switch(this.id=e.id,this.organizationId=e.organizationId,this.folderId=e.folderId,this.name=new up(e.name),this.notes=kM(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=kM(e.key),this.type){case CR.Login:this.login=new UM(e.login);break;case CR.SecureNote:this.secureNote=new VM(e.secureNote);break;case CR.Card:this.card=new FM(e.card);break;case CR.Identity:this.identity=new xM(e.identity);break;case CR.SshKey:this.sshKey=new BM(e.sshKey)}null!=e.attachments&&(this.attachments=e.attachments.map(e=>new TM(e))),null!=e.fields&&(this.fields=e.fields.map(e=>new RM(e))),null!=e.passwordHistory&&(this.passwordHistory=e.passwordHistory.map(e=>new MM(e)))}else this.creationDate=this.revisionDate=new Date}decrypt(e){return jM(this,void 0,void 0,function*(){LS(e,"userKeyOrOrgKey","Cipher decryption");const t=new L$(this);let i=!0,n=e;if(null!=this.key){const r=kd.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 CR.Login:null!=this.login&&(t.login=yield this.login.decrypt(i,n,`Cipher Id: ${this.id}`));break;case CR.SecureNote:null!=this.secureNote&&(t.secureNote=yield this.secureNote.decrypt());break;case CR.Card:null!=this.card&&(t.card=yield this.card.decrypt(n,`Cipher Id: ${this.id}`));break;case CR.Identity:null!=this.identity&&(t.identity=yield this.identity.decrypt(n,`Cipher Id: ${this.id}`));break;case CR.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 SM;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 CR.Login:null!=this.login&&(e.login=this.login.toLoginData());break;case CR.SecureNote:null!=this.secureNote&&(e.secureNote=this.secureNote.toSecureNoteData());break;case CR.Card:null!=this.card&&(e.card=this.card.toCardData());break;case CR.Identity:null!=this.identity&&(e.identity=this.identity.toIdentityData());break;case CR.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 GM;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 Ix(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=up.fromJSON(e.name),r.notes=IM(e.notes),r.key=IM(e.key),r.attachments=null===(t=e.attachments)||void 0===t?void 0:t.map(e=>TM.fromJSON(e)).filter(e=>null!=e),r.fields=null===(i=e.fields)||void 0===i?void 0:i.map(e=>RM.fromJSON(e)).filter(e=>null!=e),r.passwordHistory=null===(n=e.passwordHistory)||void 0===n?void 0:n.map(e=>MM.fromJSON(e)).filter(e=>null!=e),e.type){case CR.Card:null!=e.card&&(r.card=FM.fromJSON(e.card));break;case CR.Identity:null!=e.identity&&(r.identity=xM.fromJSON(e.identity));break;case CR.Login:null!=e.login&&(r.login=UM.fromJSON(e.login));break;case CR.SecureNote:null!=e.secureNote&&(r.secureNote=VM.fromJSON(e.secureNote));break;case CR.SshKey:null!=e.sshKey&&(r.sshKey=BM.fromJSON(e.sshKey))}return r}toSdkCipher(){var e,t,i,n,r,s,o;const a={id:this.id?Dk(this.id):void 0,organizationId:this.organizationId?Dk(this.organizationId):void 0,folderId:this.folderId?Dk(this.folderId):void 0,collectionIds:this.collectionIds?this.collectionIds.map(Dk):[],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:k$(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:IR(this.reprompt),login:void 0,identity:void 0,card:void 0,secureNote:void 0,sshKey:void 0,data:void 0};switch(this.type){case CR.Login:null!=this.login&&(a.login=this.login.toSdkLogin());break;case CR.SecureNote:null!=this.secureNote&&(a.secureNote=this.secureNote.toSdkSecureNote());break;case CR.Card:null!=this.card&&(a.card=this.card.toSdkCard());break;case CR.Identity:null!=this.identity&&(a.identity=this.identity.toSdkIdentity());break;case CR.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 GM;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(Ek):[],r.key=IM(e.key),r.name=up.fromJSON(e.name),r.notes=IM(e.notes),r.type=e.type,r.favorite=e.favorite,r.organizationUseTotp=e.organizationUseTotp,r.edit=e.edit,r.permissions=Ix.fromSdkCipherPermissions(e.permissions),r.viewPassword=e.viewPassword,r.localData=S$(e.localData),r.attachments=null===(t=e.attachments)||void 0===t?void 0:t.map(e=>TM.fromSdkAttachment(e)).filter(e=>null!=e),r.fields=null===(i=e.fields)||void 0===i?void 0:i.map(e=>RM.fromSdkField(e)).filter(e=>null!=e),r.passwordHistory=null===(n=e.passwordHistory)||void 0===n?void 0:n.map(e=>MM.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=UM.fromSdkLogin(e.login),r.secureNote=VM.fromSdkSecureNote(e.secureNote),r.card=FM.fromSdkCard(e.card),r.identity=xM.fromSdkIdentity(e.identity),r.sshKey=BM.fromSdkSshKey(e.sshKey),r}}var LM=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 zM{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 yl.bkB,this.delete=()=>LM(this,void 0,void 0,function*(){if(yield this.dialogService.openSimpleDialog({title:{key:"deleteAttachment"},content:{key:"permanentlyDeleteAttachmentConfirmation"},type:"warning"}))try{const e=yield(0,ho._)(this.accountService.activeAccount$.pipe(Lp));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)}})}}zM.ɵfac=function(e){return new(e||zM)(yl.rXU(xb),yl.rXU(Pl),yl.rXU(Fb),yl.rXU(za),yl.rXU(Jd),yl.rXU(Ok))},zM.ɵcmp=yl.VBU({type:zM,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&&(yl.nrm(0,"button",0),yl.nI1(1,"i18n")),2&e&&yl.Y8G("label",yl.i5U(1,2,"deleteAttachmentName",t.attachment.fileName))("bitAction",t.delete)},dependencies:[rc,Rd,pl.MD,qf,Xu,_l,zl,Xf],encapsulation:2});var _M=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 KM=["fileInput"],XM=(e,t)=>t.id;function qM(e,t){1&e&&(yl.nrm(0,"i",18),yl.nI1(1,"i18n")),2&e&&yl.Y8G("appA11yTitle",yl.bMT(1,1,"fixEncryptionTooltip"))}function YM(e,t){if(1&e&&yl.nrm(0,"app-download-attachment",15),2&e){let e;const t=yl.XpG().$implicit,i=yl.XpG(2);yl.Y8G("admin",i.admin()&&(null==(e=i.organization())?null:e.canEditAllCiphers))("cipher",i.cipher())("attachment",t)}}function WM(e,t){if(1&e&&(yl.j41(0,"button",16),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()),2&e){const e=yl.XpG().$implicit,t=yl.XpG(2);yl.Y8G("bitAction",t.fixOldAttachment(e)),yl.R7$(),yl.SpI(" ",yl.bMT(2,2,"fixEncryption")," ")}}function HM(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"li")(1,"bit-item")(2,"bit-item-content")(3,"span",11),yl.EFF(4),yl.k0s(),yl.j41(5,"span",12),yl.EFF(6),yl.k0s(),yl.DNE(7,qM,2,3,"i",13),yl.k0s(),yl.qex(8,14),yl.j41(9,"bit-item-action"),yl.nVh(10,YM,1,3,"app-download-attachment",15)(11,WM,3,4,"button",16),yl.k0s(),yl.j41(12,"bit-item-action")(13,"app-delete-attachment",17),yl.bIt("onDeletionSuccess",function(){const t=a.eBV(e).$implicit,i=yl.XpG(2);return a.Njj(i.removeAttachment(t))}),yl.k0s()(),yl.bVm(),yl.k0s()()}if(2&e){let e;const i=t.$implicit,n=yl.XpG(2);yl.R7$(3),yl.Y8G("title",i.fileName),yl.R7$(),yl.JRh(i.fileName),yl.R7$(2),yl.JRh(i.sizeName),yl.R7$(),yl.Y8G("ngIf",null==i.key),yl.R7$(3),yl.vxM(null!=i.key?10:11),yl.R7$(3),yl.Y8G("admin",n.admin()&&(null==(e=n.organization())?null:e.canEditAllCiphers))("cipherId",n.cipher().id)("attachment",i)}}function JM(e,t){1&e&&(yl.j41(0,"ul",2),yl.Z7z(1,HM,14,8,"li",null,XM),yl.k0s()),2&e&&(yl.R7$(),yl.Dyx(t))}class ZM{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:yl.aKT}),this.bitSubmit=(0,o.ebz)(Td),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.organization=(0,a.vPA)(null),this.cipher=(0,a.vPA)(null),this.attachmentForm=this.formBuilder.group({file:new fl.MJ(null,[fl.k0.required])}),this.cipherDomain=null,this.activeUserId=null,this.destroyRef=(0,a.WQX)(a.abz),this.submit=()=>_M(this,void 0,void 0,function*(){var e;this.onUploadStarted.emit();const t=this.attachmentForm.value.file;if(null!=t){if(t.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,t,this.activeUserId,null===(e=this.organization())||void 0===e?void 0:e.canEditAllCiphers),this.cipher.set(yield this.cipherService.decrypt(this.cipherDomain,this.activeUserId));const i=this.fileInput();i&&(i.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=>()=>_M(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,wl.pQ)()).subscribe(e=>{const t=this.submitBtn();t&&t.disabled.set("VALID"!==e)}),(0,bl.QZ)(()=>_M(this,void 0,void 0,function*(){const e=this.cipherId();if(!e)return;this.activeUserId=yield(0,ho._)(this.accountService.activeAccount$.pipe(Gp)),this.organization.set(yield this.getOrganization()),this.cipherDomain=yield this.getCipher(e),this.cipherDomain&&this.activeUserId&&this.cipher.set(yield this.cipherService.decrypt(this.cipherDomain,this.activeUserId));const t=this.submitBtn();t&&t.disabled.set(!this.attachmentForm.valid)})),(0,bl.QZ)(()=>{const e=this.bitSubmit(),t=this.submitBtn();e&&t&&(e.loading$.pipe((0,wl.pQ)(this.destroyRef)).subscribe(e=>{t.loading.set(e)}),e.disabled$.pipe((0,wl.pQ)(this.destroyRef)).subscribe(e=>{t.disabled.set(e)}))})}get attachmentFormId(){return ZM.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 _M(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 SM(t);return new GM(i)}return null})}getOrganization(){return _M(this,void 0,void 0,function*(){const e=this.organizationId();if(!e||!this.activeUserId)return null;return(yield(0,ho._)(this.organizationService.organizations$(this.activeUserId))).find(t=>t.id===e)||null})}}function QM(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"app-cipher-attachments",7),yl.bIt("onUploadStarted",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.uploadStarted())})("onUploadSuccess",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.uploadSuccessful())})("onUploadFailed",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.uploadFailed())})("onRemoveSuccess",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.removalSuccessful())}),yl.k0s()}if(2&e){const e=yl.XpG(),t=yl.sdS(8);yl.Y8G("cipherId",e.cipherId)("organizationId",e.organizationId)("admin",e.admin)("submitBtn",t)}}ZM.attachmentFormID="attachmentForm",ZM.ɵfac=function(e){return new(e||ZM)(yl.rXU(Fb),yl.rXU(Pl),yl.rXU(fl.ok),yl.rXU(za),yl.rXU(xb),yl.rXU(Ok),yl.rXU(Mk),yl.rXU(AF))},ZM.ɵcmp=yl.VBU({type:ZM,selectors:[["app-cipher-attachments"]],viewQuery:function(e,t){1&e&&(yl.wEZ(t.fileInput,KM,5,yl.aKT),yl.wEZ(t.bitSubmit,Td,5)),2&e&&yl.NyB(2)},inputs:{cipherId:[1,"cipherId"],organizationId:[1,"organizationId"],admin:[1,"admin"],submitBtn:[1,"submitBtn"]},outputs:{onUploadStarted:"onUploadStarted",onUploadSuccess:"onUploadSuccess",onUploadFailed:"onUploadFailed",onRemoveSuccess:"onRemoveSuccess"},decls:22,vars:19,consts:[["fileInput",""],["id","attachments",1,"tw-sr-only"],["aria-labelledby","attachments",1,"tw-list-none","tw-pl-0"],[3,"id","formGroup","bitSubmit"],["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"],["data-testid","file-name",3,"title"],["slot","secondary","data-testid","file-size"],["slot","default-trailing","class","bwi bwi-exclamation-triangle bwi-sm tw-text-muted",3,"appA11yTitle",4,"ngIf"],["slot","end"],[3,"admin","cipher","attachment"],["bitButton","","buttonType","primary","size","small","type","button",3,"bitAction"],[3,"onDeletionSuccess","admin","cipherId","attachment"],["slot","default-trailing",1,"bwi","bwi-exclamation-triangle","bwi-sm","tw-text-muted",3,"appA11yTitle"]],template:function(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"h2",1),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s(),yl.nVh(3,JM,3,0,"ul",2),yl.j41(4,"form",3)(5,"bit-card")(6,"label",4),yl.EFF(7),yl.nI1(8,"i18n"),yl.k0s(),yl.j41(9,"div",5)(10,"input",6,0),yl.bIt("change",function(i){return a.eBV(e),a.Njj(t.onFileChange(i))}),yl.k0s(),yl.j41(12,"div",7)(13,"button",8),yl.bIt("click",function(){a.eBV(e);const t=yl.sdS(11);return a.Njj(t.click())}),yl.EFF(14),yl.nI1(15,"i18n"),yl.k0s(),yl.j41(16,"p",9),yl.EFF(17),yl.nI1(18,"i18n"),yl.k0s()()(),yl.j41(19,"p",10),yl.EFF(20),yl.nI1(21,"i18n"),yl.k0s()()()}if(2&e){let e;yl.R7$(),yl.JRh(yl.bMT(2,9,"attachments")),yl.R7$(2),yl.vxM((e=null==(e=t.cipher())?null:e.attachments)?3:-1,e),yl.R7$(),yl.Y8G("id",t.attachmentFormId)("formGroup",t.attachmentForm)("bitSubmit",t.submit),yl.R7$(3),yl.SpI(" ",yl.bMT(8,11,"addAttachment")," "),yl.R7$(7),yl.SpI(" ",yl.bMT(15,13,"chooseFile")," "),yl.R7$(3),yl.SpI(" ",null!=t.attachmentForm.controls.file&&t.attachmentForm.controls.file.value?t.attachmentForm.controls.file.value.name:yl.bMT(18,15,"noFileChosen")," "),yl.R7$(3),yl.SpI(" ",yl.bMT(21,17,"maxFileSizeSansPunctuation")," ")}},dependencies:[rc,Rd,Td,Xu,Ku,pl.MD,pl.bT,wP,IP,FP,SP,qf,jb,fl.X1,fl.qT,fl.cb,fl.j4,Xl,Wl,WR,zM,X$,Xf],encapsulation:2,changeDetection:0});const eN="uploaded",tN="removed";class iN{constructor(e,t){var i;this.dialogRef=e,this.params=t,this.admin=!1,this.attachmentFormId=ZM.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!==(i=t.admin)&&void 0!==i&&i}static open(e,t){return e.open(iN,{data:t})}uploadStarted(){this.isUploading=!0,this.dialogRef.disableClose=!0}uploadSuccessful(){this.isUploading=!1,this.dialogRef.disableClose=!1,this.dialogRef.close({action:eN})}uploadFailed(){this.isUploading=!1,this.dialogRef.disableClose=!1}removalSuccessful(){this.dialogRef.close({action:tN})}}iN.ɵfac=function(e){return new(e||iN)(yl.rXU(Xd),yl.rXU(nd.Qs))},iN.ɵcmp=yl.VBU({type:iN,selectors:[["app-vault-attachments-v2"]],hostBindings:function(e,t){1&e&&yl.bIt("beforeunload",function(e){return t.handleBeforeUnloadEvent(e)},yl.tSv)},decls:11,vars:8,consts:[["submitBtn",""],["dialogSize","default","background","alt"],["bitDialogTitle",""],["bitDialogContent",""],[3,"cipherId","organizationId","admin","submitBtn","onUploadStarted","onUploadSuccess","onUploadFailed","onRemoveSuccess",4,"ngIf"],["bitDialogFooter",""],["bitButton","","type","submit","buttonType","primary"],[3,"onUploadStarted","onUploadSuccess","onUploadFailed","onRemoveSuccess","cipherId","organizationId","admin","submitBtn"]],template:function(e,t){1&e&&(yl.j41(0,"bit-dialog",1)(1,"span",2),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.qex(4,3),yl.DNE(5,QM,1,4,"app-cipher-attachments",4),yl.bVm(),yl.qex(6,5),yl.j41(7,"button",6,0),yl.EFF(9),yl.nI1(10,"i18n"),yl.k0s(),yl.bVm(),yl.k0s()),2&e&&(yl.R7$(2),yl.SpI(" ",yl.bMT(3,4,"attachments")," "),yl.R7$(3),yl.Y8G("ngIf",t.cipherId),yl.R7$(2),yl.BMQ("form",t.attachmentFormId),yl.R7$(2),yl.SpI(" ",yl.bMT(10,6,"upload")," "))},dependencies:[Xu,Ku,pl.MD,pl.bT,dh,uh,ZM,Hl],encapsulation:2});class nN{}class rN{}class sN{}class oN{constructor(){this.viewCacheService=(0,a.WQX)(sI),this.cipherCache=this.viewCacheService.signal({key:"cipher-form-cache",initialValue:null,deserializer:L$.fromJSON}),this.initializedWithValue=!!this.cipherCache()}cacheCipherView(e){this.cipherCache.set(L$.fromJSON(e))}getCachedCipherView(){return this.cipherCache()}clearCache(){this.cipherCache.set(null)}}function aN(e,t){if(1&e&&yl.nrm(0,"bit-option",12),2&e){const e=t.$implicit;yl.Y8G("value",e.value)("label",e.name)}}function lN(e,t){if(1&e&&(yl.j41(0,"bit-form-field")(1,"bit-label"),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.j41(4,"bit-select",10),yl.DNE(5,aN,1,2,"bit-option",11),yl.k0s(),yl.j41(6,"bit-hint"),yl.EFF(7),yl.k0s()()),2&e){const e=yl.XpG();yl.R7$(2),yl.JRh(yl.bMT(3,3,"fieldType")),yl.R7$(3),yl.Y8G("ngForOf",e.fieldTypeOptions),yl.R7$(2),yl.SpI(" ",e.getTypeHint()," ")}}function cN(e,t){1&e&&(yl.j41(0,"bit-hint"),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()),2&e&&(yl.R7$(),yl.SpI(" ",yl.bMT(2,1,"linkedLabelHelpText")," "))}function uN(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",13),yl.nI1(1,"i18n"),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.removeField())}),yl.k0s()}if(2&e){const e=yl.XpG();yl.Y8G("label",yl.i5U(1,1,"deleteCustomField",e.customFieldForm.value.label))}}oN.ɵfac=function(e){return new(e||oN)},oN.ɵprov=a.jDH({token:oN,factory:oN.ɵfac});class dN{constructor(e,t,i){this.data=e,this.formBuilder=t,this.i18nService=i,this.customFieldForm=this.formBuilder.group({type:FR.Text,label:["",fl.k0.required]}),this.fieldTypeOptions=[{name:this.i18nService.t("cfTypeText"),value:FR.Text},{name:this.i18nService.t("cfTypeHidden"),value:FR.Hidden},{name:this.i18nService.t("cfTypeCheckbox"),value:FR.Boolean},{name:this.i18nService.t("cfTypeLinked"),value:FR.Linked}],this.FieldType=FR,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!==FR.Hidden)&&(this.data.cipherType!==CR.SecureNote&&this.data.cipherType!==CR.SshKey||e.value!==FR.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 FR.Text:return this.i18nService.t("textHelpText");case FR.Hidden:return this.i18nService.t("hiddenHelpText");case FR.Boolean:return this.i18nService.t("checkBoxHelpText");case FR.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)}}dN.ɵfac=function(e){return new(e||dN)(yl.rXU(nd.Qs),yl.rXU(fl.ok),yl.rXU(Pl))},dN.ɵcmp=yl.VBU({type:dN,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&&(yl.j41(0,"form",0)(1,"bit-dialog")(2,"span",1),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s(),yl.j41(5,"div",2),yl.DNE(6,lN,8,5,"bit-form-field",3),yl.j41(7,"bit-form-field",4)(8,"bit-label"),yl.EFF(9),yl.nI1(10,"i18n"),yl.k0s(),yl.nrm(11,"input",5),yl.DNE(12,cN,3,3,"bit-hint",3),yl.k0s()(),yl.qex(13,6),yl.j41(14,"button",7),yl.EFF(15),yl.nI1(16,"i18n"),yl.k0s(),yl.j41(17,"button",8),yl.EFF(18),yl.nI1(19,"i18n"),yl.k0s(),yl.DNE(20,uN,2,4,"button",9),yl.bVm(),yl.k0s()()),2&e&&(yl.Y8G("formGroup",t.customFieldForm)("bitSubmit",t.submit),yl.R7$(3),yl.SpI(" ",yl.bMT(4,10,"add"===t.variant?"addField":"editField")," "),yl.R7$(3),yl.Y8G("ngIf","add"===t.variant),yl.R7$(3),yl.JRh(yl.bMT(10,12,"fieldLabel")),yl.R7$(3),yl.Y8G("ngIf",t.customFieldForm.value.type===t.FieldType.Linked),yl.R7$(2),yl.Y8G("disabled",t.customFieldForm.invalid),yl.R7$(),yl.SpI(" ",yl.bMT(16,14,"add"===t.variant?"add":"save")," "),yl.R7$(3),yl.SpI(" ",yl.bMT(19,16,"cancel")," "),yl.R7$(2),yl.Y8G("ngIf","edit"===t.variant))},dependencies:[pl.MD,pl.Sq,pl.bT,qf,dh,Zd,uh,Xu,Ku,Eu,Sc,nu,ou,Du,Bu,Vu,Ou,fl.X1,fl.qT,fl.me,fl.BC,fl.cb,fl.j4,fl.JD,_l,zl,rc,Td,Xf],encapsulation:2});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=["customFieldRow"],fN=e=>({"tw-mb-0":e}),vN=e=>({"tw-items-center":e});function mN(e,t){if(1&e&&(yl.j41(0,"bit-form-field",12)(1,"bit-label"),yl.EFF(2),yl.k0s(),yl.nrm(3,"input",13),yl.k0s()),2&e){const e=yl.XpG().$implicit;yl.R7$(2),yl.JRh(e.value.name)}}function gN(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",16),yl.bIt("toggledChange",function(t){a.eBV(e);const i=yl.XpG(4);return a.Njj(i.logHiddenEvent(t))}),yl.k0s()}}function yN(e,t){if(1&e&&(yl.j41(0,"bit-form-field",12)(1,"bit-label"),yl.EFF(2),yl.k0s(),yl.nrm(3,"input",14),yl.DNE(4,gN,1,0,"button",15),yl.k0s()),2&e){const e=yl.XpG(),t=e.$implicit,i=e.index,n=yl.XpG(2);yl.R7$(2),yl.JRh(t.value.name),yl.R7$(2),yl.Y8G("ngIf",n.canViewPasswords(i))}}function bN(e,t){if(1&e&&(yl.j41(0,"bit-form-control",12),yl.nrm(1,"input",17),yl.j41(2,"bit-label"),yl.EFF(3),yl.k0s()()),2&e){const e=yl.XpG().$implicit;yl.R7$(3),yl.JRh(e.value.name)}}function wN(e,t){if(1&e&&yl.nrm(0,"bit-option",20),2&e){const e=t.$implicit;yl.Y8G("value",e.value)("label",e.name)}}function SN(e,t){if(1&e&&(yl.j41(0,"bit-form-field",12)(1,"bit-label"),yl.EFF(2),yl.k0s(),yl.j41(3,"bit-select",18),yl.DNE(4,wN,1,2,"bit-option",19),yl.k0s()()),2&e){const e=yl.XpG().$implicit,t=yl.XpG(2);yl.R7$(2),yl.JRh(e.value.name),yl.R7$(2),yl.Y8G("ngForOf",t.linkedFieldOptions)}}function kN(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",21),yl.nI1(1,"i18n"),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG(),i=t.$implicit,n=t.index,r=yl.XpG(2);return a.Njj(r.openAddEditCustomFieldDialog({index:n,label:i.value.name}))}),yl.k0s()}if(2&e){const e=yl.XpG().$implicit,t=yl.XpG(2);yl.Y8G("label",yl.i5U(1,2,"editFieldLabel",e.value.name))("disabled",t.parentFormDisabled)}}function IN(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",22),yl.nI1(1,"i18n"),yl.bIt("keydown",function(t){a.eBV(e);const i=yl.XpG(),n=i.$implicit,r=i.index,s=yl.XpG(2);return a.Njj(s.handleKeyDown(t,n.value.name,r))}),yl.k0s()}if(2&e){const e=yl.XpG().$implicit,t=yl.XpG(2);yl.Y8G("label",yl.i5U(1,2,"reorderToggleButton",e.value.name))("disabled",t.parentFormDisabled)}}function CN(e,t){if(1&e&&(yl.j41(0,"div",8,0),yl.DNE(2,mN,4,1,"bit-form-field",9)(3,yN,5,2,"bit-form-field",9)(4,bN,4,1,"bit-form-control",9)(5,SN,5,2,"bit-form-field",9)(6,kN,2,5,"button",10)(7,IN,2,5,"button",11),yl.k0s()),2&e){const e=t.$implicit,i=t.index,n=yl.XpG(2);yl.Y8G("formGroupName",i)("ngClass",yl.eq3(10,vN,e.value.type===n.FieldType.Boolean))("cdkDragDisabled",!n.canEdit(e.value.type)),yl.BMQ("data-testid",e.value.name+"-entry"),yl.R7$(2),yl.Y8G("ngIf",e.value.type===n.FieldType.Text),yl.R7$(),yl.Y8G("ngIf",e.value.type===n.FieldType.Hidden),yl.R7$(),yl.Y8G("ngIf",e.value.type===n.FieldType.Boolean),yl.R7$(),yl.Y8G("ngIf",e.value.type===n.FieldType.Linked),yl.R7$(),yl.Y8G("ngIf",n.canEdit(e.value.type)),yl.R7$(),yl.Y8G("ngIf",n.canEdit(e.value.type)&&n.fields.controls.length>1)}}function TN(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",23),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG(2);return a.Njj(t.openAddEditCustomFieldDialog())}),yl.nrm(1,"i",24),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s()}2&e&&(yl.R7$(2),yl.SpI(" ",yl.bMT(3,1,"addField")," "))}function PN(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"section",2)(1,"bit-section-header")(2,"h2",3),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s()(),yl.j41(5,"form",4)(6,"bit-card",5),yl.bIt("cdkDropListDropped",function(t){a.eBV(e);const i=yl.XpG();return a.Njj(i.drop(t))}),yl.DNE(7,CN,8,12,"div",6)(8,TN,4,3,"button",7),yl.k0s()()()}if(2&e){const e=yl.XpG();yl.Y8G("ngClass",yl.eq3(7,fN,e.disableSectionMargin)),yl.R7$(3),yl.JRh(yl.bMT(4,5,"customFields")),yl.R7$(2),yl.Y8G("formGroup",e.customFieldsForm),yl.R7$(2),yl.Y8G("ngForOf",e.fields.controls),yl.R7$(),yl.Y8G("ngIf",!e.isPartialEdit&&!e.parentFormDisabled)}}class FN{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 yl.bkB,this.customFieldsForm=this.formBuilder.group({fields:new fl.Yp([])}),this.linkedFieldOptions=[],this.hasCustomFields=!1,this.focusOnNewInput$=new go.B,this.parentFormDisabled=!1,this.FieldType=FR,this.destroyed$=(0,a.WQX)(a.abz),this.cipherFormContainer.registerChildForm("customFields",this.customFieldsForm),this.customFieldsForm.valueChanges.pipe((0,wl.pQ)()).subscribe(()=>{this.updateCipher(this.fields.getRawValue())}),this.cipherFormContainer.formStatusChange$.pipe((0,wl.pQ)()).subscribe(e=>{this.parentFormDisabled="disabled"===e})}get fields(){return this.customFieldsForm.controls.fields}canEdit(e){return!this.isPartialEdit&&(e!==FR.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===FR.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!==FR.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,Wv.y)(this.focusOnNewInput$,this.customFieldRows.changes).pipe((0,wl.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(dN,{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===FR.Boolean&&(n=!1),e===FR.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,cl.HD)(this.fields.controls,e.previousIndex,e.currentIndex),this.updateCipher(this.fields.controls.map(e=>e.value))}handleKeyDown(e,t,i){return hN(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 hN(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(Ra.Cipher_ClientToggledHiddenFieldVisible,i.id,!1,i.organizationId))})}getLinkedFieldsOptionsForCipher(){switch(this.cipherFormContainer.config.cipherType){case CR.Login:return V$.prototype.linkedFieldOptions;case CR.Card:return x$.prototype.linkedFieldOptions;case CR.Identity:return O$.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 D$;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))}}FN.ɵfac=function(e){return new(e||FN)(yl.rXU(Jd),yl.rXU(sN),yl.rXU(fl.ok),yl.rXU(Pl),yl.rXU(ll.Ai),yl.rXU(OE))},FN.ɵcmp=yl.VBU({type:FN,selectors:[["vault-custom-fields"]],viewQuery:function(e,t){if(1&e&&yl.GBs(pN,5),2&e){let e;yl.mGM(e=yl.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&&yl.DNE(0,PN,9,9,"section",1),2&e&&yl.Y8G("ngIf",t.hasCustomFields)},dependencies:[qf,pl.MD,pl.YU,pl.Sq,pl.bT,fl.YN,fl.qT,fl.me,fl.Zm,fl.BC,fl.cb,Eu,hc,Sc,ou,Du,Vb,Bb,fl.X1,fl.j4,fl.JD,fl.$R,fl.v8,ex,Xl,Wl,WR,_l,zl,id,Ub,Bu,Vu,Ou,cl.ad,cl.O7,cl.T1,cl.Fb,Oh,Kb,Xf],encapsulation:2});const RN=e=>({"tw-mb-0":e});function xN(e,t){if(1&e&&(yl.j41(0,"bit-form-control",6),yl.nrm(1,"input",7),yl.j41(2,"bit-label"),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s()()),2&e){const e=yl.XpG();yl.Y8G("disableMargin",e.hasCustomFields||e.isPartialEdit),yl.R7$(3),yl.JRh(yl.bMT(4,2,"passwordPrompt"))}}function AN(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",8),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.addCustomField())}),yl.nrm(1,"i",9),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s()}2&e&&(yl.R7$(2),yl.SpI(" ",yl.bMT(3,1,"addField")," "))}class DN{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,Pp.t)({refCount:!1,bufferSize:1})),this.hasCustomFields=!1,this.isPartialEdit=!1,this.cipherFormContainer.registerChildForm("additionalOptions",this.additionalOptionsForm),this.additionalOptionsForm.valueChanges.pipe((0,wl.pQ)()).subscribe(e=>{this.cipherFormContainer.patchCipher(t=>(t.notes=e.notes,t.reprompt=e.reprompt?kR.Password:kR.None,t))})}ngOnInit(){const e=this.cipherFormContainer.getInitialCipherView();e&&this.additionalOptionsForm.patchValue({notes:e.notes,reprompt:e.reprompt===kR.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()}}DN.ɵfac=function(e){return new(e||DN)(yl.rXU(sN),yl.rXU(fl.ok),yl.rXU($E),yl.rXU(o.gRc))},DN.ɵcmp=yl.VBU({type:DN,selectors:[["vault-additional-options-section"]],viewQuery:function(e,t){if(1&e&&yl.GBs(FN,5),2&e){let e;yl.mGM(e=yl.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&&(yl.j41(0,"section",0)(1,"bit-section-header")(2,"h2",1),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s()(),yl.j41(5,"bit-card")(6,"bit-form-field")(7,"bit-label"),yl.EFF(8),yl.nI1(9,"i18n"),yl.k0s(),yl.nrm(10,"textarea",2),yl.k0s(),yl.DNE(11,xN,5,4,"bit-form-control",3),yl.nI1(12,"async"),yl.DNE(13,AN,4,3,"button",4),yl.k0s()(),yl.j41(14,"vault-custom-fields",5),yl.bIt("numberOfFieldsChange",function(e){return t.handleCustomFieldChange(e)}),yl.k0s()),2&e&&(yl.Y8G("ngClass",yl.eq3(13,RN,t.disableSectionMargin&&!t.hasCustomFields))("formGroup",t.additionalOptionsForm),yl.R7$(3),yl.JRh(yl.bMT(4,7,"additionalOptions")),yl.R7$(5),yl.JRh(yl.bMT(9,9,"notes")),yl.R7$(3),yl.Y8G("ngIf",yl.bMT(12,11,t.passwordRepromptEnabled$)),yl.R7$(2),yl.Y8G("ngIf",!t.hasCustomFields&&!t.isPartialEdit&&t.allowNewField),yl.R7$(),yl.Y8G("disableSectionMargin",t.disableSectionMargin))},dependencies:[pl.MD,pl.YU,pl.bT,ex,Xl,Wl,qf,WR,Eu,hc,Sc,ou,Du,fl.X1,fl.me,fl.Zm,fl.BC,fl.cb,fl.j4,fl.JD,id,Ub,FN,Oh,Kb,pl.Jj,Xf],encapsulation:2});var EN=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 $N(e,t){if(1&e&&yl.nrm(0,"bit-option",14),2&e){const e=t.$implicit;yl.Y8G("value",e.value)("label",e.name)}}function ON(e,t){if(1&e&&yl.nrm(0,"bit-option",14),2&e){const e=t.$implicit;yl.Y8G("value",e.value)("label",e.name)}}class UN{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=Ra,this.cipherFormContainer.registerChildForm("cardDetails",this.cardDetailsForm),this.cardDetailsForm.valueChanges.pipe((0,wl.pQ)()).subscribe(({cardholderName:e,number:t,brand:i,expMonth:n,expYear:r,code:s})=>{this.cipherFormContainer.patchCipher(o=>{var a;const l=null!==(a=a$(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,wl.pQ)()).subscribe(e=>{const t=x$.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;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,expMonth:null!==(o=null===(s=this.initialValues)||void 0===s?void 0:s.expMonth)&&void 0!==o?o:e.expMonth,expYear:null!==(l=null===(a=this.initialValues)||void 0===a?void 0:a.expYear)&&void 0!==l?l:e.expYear,code:null!==(u=null===(c=this.initialValues)||void 0===c?void 0:c.code)&&void 0!==u?u: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:x$.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 EN(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 MN(e,t){if(1&e&&yl.nrm(0,"bit-option",25),2&e){const e=t.$implicit;yl.Y8G("value",e.value)("label",e.name)}}UN.ɵfac=function(e){return new(e||UN)(yl.rXU(sN),yl.rXU(fl.ok),yl.rXU(Pl),yl.rXU(OE))},UN.ɵcmp=yl.VBU({type:UN,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&&(yl.j41(0,"section",0)(1,"bit-section-header")(2,"h2",1),yl.EFF(3),yl.k0s()(),yl.j41(4,"bit-card")(5,"bit-form-field")(6,"bit-label"),yl.EFF(7),yl.nI1(8,"i18n"),yl.k0s(),yl.nrm(9,"input",2),yl.k0s(),yl.j41(10,"bit-form-field")(11,"bit-label"),yl.EFF(12),yl.nI1(13,"i18n"),yl.k0s(),yl.nrm(14,"input",3),yl.j41(15,"button",4),yl.bIt("toggledChange",function(e){return t.logCardEvent(e,t.EventType.Cipher_ClientToggledCardNumberVisible)}),yl.k0s()(),yl.j41(16,"bit-form-field")(17,"bit-label"),yl.EFF(18),yl.nI1(19,"i18n"),yl.k0s(),yl.j41(20,"bit-select",5),yl.DNE(21,$N,1,2,"bit-option",6),yl.k0s()(),yl.j41(22,"div",7)(23,"bit-form-field",8)(24,"bit-label"),yl.EFF(25),yl.nI1(26,"i18n"),yl.k0s(),yl.j41(27,"bit-select",9),yl.DNE(28,ON,1,2,"bit-option",6),yl.k0s()(),yl.j41(29,"bit-form-field",8)(30,"bit-label"),yl.EFF(31),yl.nI1(32,"i18n"),yl.k0s(),yl.nrm(33,"input",10),yl.k0s()(),yl.j41(34,"bit-form-field",11)(35,"bit-label"),yl.EFF(36),yl.nI1(37,"i18n"),yl.k0s(),yl.nrm(38,"input",12),yl.j41(39,"button",13),yl.bIt("toggledChange",function(e){return t.logCardEvent(e,t.EventType.Cipher_ClientToggledCardCodeVisible)}),yl.k0s()()()()),2&e&&(yl.Y8G("formGroup",t.cardDetailsForm),yl.R7$(3),yl.SpI(" ",t.getSectionHeading()," "),yl.R7$(4),yl.JRh(yl.bMT(8,10,"cardholderName")),yl.R7$(5),yl.JRh(yl.bMT(13,12,"number")),yl.R7$(6),yl.JRh(yl.bMT(19,14,"brand")),yl.R7$(3),yl.Y8G("ngForOf",t.cardBrands),yl.R7$(4),yl.JRh(yl.bMT(26,16,"expirationMonth")),yl.R7$(3),yl.Y8G("ngForOf",t.expirationMonths),yl.R7$(3),yl.JRh(yl.bMT(32,18,"expirationYear")),yl.R7$(5),yl.JRh(yl.bMT(37,20,"securityCode")))},dependencies:[WR,Xl,Wl,Eu,Sc,ou,Du,Vb,Bb,fl.X1,fl.me,fl.Q0,fl.BC,fl.cb,fl.j4,fl.JD,Bu,Vu,Ou,ex,_l,zl,qf,pl.MD,pl.Sq,Xf],encapsulation:2});class NN{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,wl.pQ)()).subscribe(e=>{const t=new O$;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,f,v,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!==(f=null===(p=this.initialValues)||void 0===p?void 0:p.licenseNumber)&&void 0!==f?f:e.licenseNumber,email:null!==(m=null===(v=this.initialValues)||void 0===v?void 0:v.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,f,v;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===(f=this.initialValues)||void 0===f?void 0:f.postalCode)||"",country:(null===(v=this.initialValues)||void 0===v?void 0:v.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})}}NN.ɵfac=function(e){return new(e||NN)(yl.rXU(sN),yl.rXU(fl.ok),yl.rXU(Pl))},NN.ɵcmp=yl.VBU({type:NN,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&&(yl.j41(0,"form",0)(1,"section",1)(2,"bit-section-header")(3,"h2",2),yl.EFF(4),yl.nI1(5,"i18n"),yl.k0s()(),yl.j41(6,"bit-card")(7,"bit-form-field")(8,"bit-label"),yl.EFF(9),yl.nI1(10,"i18n"),yl.k0s(),yl.j41(11,"bit-select",3),yl.DNE(12,MN,1,2,"bit-option",4),yl.k0s()(),yl.j41(13,"bit-form-field")(14,"bit-label"),yl.EFF(15),yl.nI1(16,"i18n"),yl.k0s(),yl.nrm(17,"input",5),yl.k0s(),yl.j41(18,"bit-form-field")(19,"bit-label"),yl.EFF(20),yl.nI1(21,"i18n"),yl.k0s(),yl.nrm(22,"input",6),yl.k0s(),yl.j41(23,"bit-form-field")(24,"bit-label"),yl.EFF(25),yl.nI1(26,"i18n"),yl.k0s(),yl.nrm(27,"input",7),yl.k0s(),yl.j41(28,"bit-form-field")(29,"bit-label"),yl.EFF(30),yl.nI1(31,"i18n"),yl.k0s(),yl.nrm(32,"input",8),yl.k0s(),yl.j41(33,"bit-form-field",9)(34,"bit-label"),yl.EFF(35),yl.nI1(36,"i18n"),yl.k0s(),yl.nrm(37,"input",10),yl.k0s()()(),yl.j41(38,"section",1)(39,"bit-section-header")(40,"h2",2),yl.EFF(41),yl.nI1(42,"i18n"),yl.k0s()(),yl.j41(43,"bit-card")(44,"bit-form-field")(45,"bit-label"),yl.EFF(46),yl.nI1(47,"i18n"),yl.k0s(),yl.nrm(48,"input",11)(49,"button",12),yl.k0s(),yl.j41(50,"bit-form-field")(51,"bit-label"),yl.EFF(52),yl.nI1(53,"i18n"),yl.k0s(),yl.nrm(54,"input",13)(55,"button",14),yl.k0s(),yl.j41(56,"bit-form-field",9)(57,"bit-label"),yl.EFF(58),yl.nI1(59,"i18n"),yl.k0s(),yl.nrm(60,"input",15),yl.k0s()()(),yl.j41(61,"section",1)(62,"bit-section-header")(63,"h2",2),yl.EFF(64),yl.nI1(65,"i18n"),yl.k0s()(),yl.j41(66,"bit-card")(67,"bit-form-field")(68,"bit-label"),yl.EFF(69),yl.nI1(70,"i18n"),yl.k0s(),yl.nrm(71,"input",16),yl.k0s(),yl.j41(72,"bit-form-field",9)(73,"bit-label"),yl.EFF(74),yl.nI1(75,"i18n"),yl.k0s(),yl.nrm(76,"input",17),yl.k0s()()(),yl.j41(77,"section",1)(78,"bit-section-header")(79,"h2",2),yl.EFF(80),yl.nI1(81,"i18n"),yl.k0s()(),yl.j41(82,"bit-card")(83,"bit-form-field")(84,"bit-label"),yl.EFF(85),yl.nI1(86,"i18n"),yl.k0s(),yl.nrm(87,"input",18),yl.k0s(),yl.j41(88,"bit-form-field")(89,"bit-label"),yl.EFF(90),yl.nI1(91,"i18n"),yl.k0s(),yl.nrm(92,"input",19),yl.k0s(),yl.j41(93,"bit-form-field")(94,"bit-label"),yl.EFF(95),yl.nI1(96,"i18n"),yl.k0s(),yl.nrm(97,"input",20),yl.k0s(),yl.j41(98,"bit-form-field")(99,"bit-label"),yl.EFF(100),yl.nI1(101,"i18n"),yl.k0s(),yl.nrm(102,"input",21),yl.k0s(),yl.j41(103,"bit-form-field")(104,"bit-label"),yl.EFF(105),yl.nI1(106,"i18n"),yl.k0s(),yl.nrm(107,"input",22),yl.k0s(),yl.j41(108,"bit-form-field")(109,"bit-label"),yl.EFF(110),yl.nI1(111,"i18n"),yl.k0s(),yl.nrm(112,"input",23),yl.k0s(),yl.j41(113,"bit-form-field",9)(114,"bit-label"),yl.EFF(115),yl.nI1(116,"i18n"),yl.k0s(),yl.nrm(117,"input",24),yl.k0s()()()()),2&e&&(yl.Y8G("formGroup",t.identityForm),yl.R7$(4),yl.JRh(yl.bMT(5,24,"personalDetails")),yl.R7$(5),yl.SpI(" ",yl.bMT(10,26,"title")," "),yl.R7$(3),yl.Y8G("ngForOf",t.identityTitleOptions),yl.R7$(3),yl.SpI(" ",yl.bMT(16,28,"firstName")," "),yl.R7$(5),yl.SpI(" ",yl.bMT(21,30,"middleName")," "),yl.R7$(5),yl.SpI(" ",yl.bMT(26,32,"lastName")," "),yl.R7$(5),yl.SpI(" ",yl.bMT(31,34,"username")," "),yl.R7$(5),yl.SpI(" ",yl.bMT(36,36,"company")," "),yl.R7$(6),yl.JRh(yl.bMT(42,38,"identification")),yl.R7$(5),yl.SpI(" ",yl.bMT(47,40,"ssn")," "),yl.R7$(6),yl.SpI(" ",yl.bMT(53,42,"passportNumber")," "),yl.R7$(6),yl.SpI(" ",yl.bMT(59,44,"licenseNumber")," "),yl.R7$(6),yl.JRh(yl.bMT(65,46,"contactInfo")),yl.R7$(5),yl.SpI(" ",yl.bMT(70,48,"email")," "),yl.R7$(5),yl.SpI(" ",yl.bMT(75,50,"phone")," "),yl.R7$(6),yl.JRh(yl.bMT(81,52,"address")),yl.R7$(5),yl.SpI(" ",yl.bMT(86,54,"address1")," "),yl.R7$(5),yl.SpI(" ",yl.bMT(91,56,"address2")," "),yl.R7$(5),yl.SpI(" ",yl.bMT(96,58,"address3")," "),yl.R7$(5),yl.SpI(" ",yl.bMT(101,60,"cityTown")," "),yl.R7$(5),yl.SpI(" ",yl.bMT(106,62,"stateProvince")," "),yl.R7$(5),yl.SpI(" ",yl.bMT(111,64,"zipPostalCodeLabel")," "),yl.R7$(5),yl.SpI(" ",yl.bMT(116,66,"country")," "))},dependencies:[pl.MD,pl.Sq,Xu,qf,fl.X1,fl.qT,fl.me,fl.BC,fl.cb,fl.j4,fl.JD,ex,WR,Eu,Sc,ou,Du,Vb,Bb,_l,zl,Bu,Vu,Ou,Xl,Wl,Xf],encapsulation:2});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())})};function BN(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",6),yl.nI1(1,"i18n"),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.toggleFavorite())}),yl.k0s()}if(2&e){const e=yl.XpG();yl.Y8G("bitIconButton",e.favoriteIcon)("label",yl.bMT(1,4,"favorite"))("disabled",e.favoriteButtonDisabled),yl.BMQ("aria-checked",e.itemDetailsForm.value.favorite)}}function jN(e,t){if(1&e&&(yl.nrm(0,"bit-option",10),yl.nI1(1,"async")),2&e){const e=yl.XpG(2);yl.Y8G("value",null)("label",yl.bMT(1,2,e.userEmail$))}}function GN(e,t){if(1&e&&yl.nrm(0,"bit-option",10),2&e){const e=t.$implicit;yl.Y8G("value",e.id)("label",e.name)}}function LN(e,t){if(1&e&&(yl.j41(0,"bit-form-field")(1,"bit-label"),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.j41(4,"bit-select",7),yl.DNE(5,jN,2,4,"bit-option",8)(6,GN,1,2,"bit-option",9),yl.k0s()()),2&e){const e=yl.XpG();yl.R7$(2),yl.JRh(yl.bMT(3,3,"owner")),yl.R7$(3),yl.Y8G("ngIf",e.showPersonalOwnershipOption),yl.R7$(),yl.Y8G("ngForOf",e.organizations)}}function zN(e,t){if(1&e&&(yl.j41(0,"bit-hint",14),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()),2&e){const e=yl.XpG(2);yl.R7$(),yl.SpI(" ",yl.i5U(2,1,"cannotRemoveViewOnlyCollections",e.readOnlyCollectionsNames.join(", "))," ")}}function _N(e,t){if(1&e&&(yl.qex(0),yl.j41(1,"bit-form-field",11)(2,"bit-label"),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s(),yl.nrm(5,"bit-multi-select",12),yl.DNE(6,zN,3,4,"bit-hint",13),yl.k0s(),yl.bVm()),2&e){const e=yl.XpG();yl.R7$(),yl.Y8G("disableMargin",e.config.hideIndividualVaultFields),yl.R7$(2),yl.JRh(yl.bMT(4,4,"collections")),yl.R7$(2),yl.Y8G("baseItems",e.collectionOptions),yl.R7$(),yl.Y8G("ngIf",e.readOnlyCollectionsNames.length>0)}}function KN(e,t){if(1&e&&yl.nrm(0,"bit-option",10),2&e){const e=t.$implicit;yl.Y8G("value",e.id)("label",e.name)}}function XN(e,t){if(1&e&&(yl.j41(0,"bit-form-field",15)(1,"bit-label"),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.j41(4,"bit-select",16),yl.DNE(5,KN,1,2,"bit-option",9),yl.k0s()()),2&e){const e=yl.XpG();yl.R7$(2),yl.JRh(yl.bMT(3,2,"folder")),yl.R7$(3),yl.Y8G("ngForOf",e.config.folders)}}class qN{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,o){this.cipherFormContainer=e,this.formBuilder=t,this.i18nService=i,this.destroyRef=n,this.accountService=r,this.configService=s,this.policyService=o,this.itemDetailsForm=this.formBuilder.group({name:["",[fl.k0.required]],organizationId:[null],folderId:[null],collectionIds:new fl.MJ([],[fl.k0.required]),favorite:[!1]}),this.collectionOptions=[],this.readOnlyCollections=[],this.userEmail$=this.accountService.activeAccount$.pipe((0,l.T)(e=>e.email)),this.organizations=[],this.favoriteButtonDisabled=!1,this.cipherFormContainer.registerChildForm("itemDetails",this.itemDetailsForm),this.itemDetailsForm.valueChanges.pipe((0,wl.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 VN(this,void 0,void 0,function*(){var e,t,i,n;if(this.organizations=this.config.organizations.sort(kd.getSortFunction(this.i18nService,"name")),this.userId=yield(0,ho._)(this.accountService.activeAccount$.pipe(Gp)),!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,wl.pQ)(this.destroyRef),(0,lo.F)(),(0,yo.H)(()=>VN(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 VN(this,void 0,void 0,function*(){if(!e||this.allowPersonalOwnership)return;if(!(yield this.configService.getFeatureFlag(Nf.CreateDefaultLocation)))return;if(!(yield(0,ho._)(this.policyService.policiesByType$(_h.OrganizationDataOwnership,this.userId))).find(e=>e.organizationId))return;const t=this.collections.find(t=>t.organizationId===e&&t.type===LF);return null==t?void 0:t.id})}initFromExistingCipher(e){return VN(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!==zh.Custom||e.viewPassword)||this.itemDetailsForm.controls.collectionIds.disable())}updateCollectionOptions(){return VN(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)===GF});if(this.collectionOptions=this.collections.filter(e=>e.organizationId===n&&(!!this.partialEdit||(!!this.config.admin||(!s||e.type!==LF)&&(e.assigned&&!e.readOnly)))).sort((e,t)=>(e.type===LF?-1:0)-(t.type===LF?-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)})}}qN.ɵfac=function(e){return new(e||qN)(yl.rXU(sN),yl.rXU(fl.ok),yl.rXU(Pl),yl.rXU(a.abz),yl.rXU(Ok),yl.rXU(uk),yl.rXU($b))},qN.ɵcmp=yl.VBU({type:qN,selectors:[["vault-item-details-section"]],inputs:{config:"config",originalCipherView:"originalCipherView"},decls:15,vars:11,consts:[[1,"tw-mb-5","bit-compact:tw-mb-4",3,"formGroup"],["bitTypography","h6"],["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&&(yl.j41(0,"section",0)(1,"bit-section-header")(2,"h2",1),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s(),yl.DNE(5,BN,2,6,"button",2),yl.k0s(),yl.j41(6,"bit-card")(7,"bit-form-field")(8,"bit-label"),yl.EFF(9),yl.nI1(10,"i18n"),yl.k0s(),yl.nrm(11,"input",3),yl.k0s(),yl.DNE(12,LN,7,5,"bit-form-field",4)(13,_N,7,6,"ng-container",4)(14,XN,6,4,"bit-form-field",5),yl.k0s()()),2&e&&(yl.Y8G("formGroup",t.itemDetailsForm),yl.R7$(3),yl.JRh(yl.bMT(4,7,"itemDetails")),yl.R7$(2),yl.Y8G("ngIf",!t.config.hideIndividualVaultFields),yl.R7$(4),yl.JRh(yl.bMT(10,9,"itemName")),yl.R7$(3),yl.Y8G("ngIf",t.showOwnership),yl.R7$(),yl.Y8G("ngIf",t.showCollectionsControl),yl.R7$(),yl.Y8G("ngIf",!t.config.hideIndividualVaultFields))},dependencies:[WR,Xl,Wl,Eu,Sc,nu,ou,eu,Du,fl.X1,fl.me,fl.BC,fl.cb,fl.j4,fl.JD,Bu,Vu,Ou,ex,_l,zl,qf,pl.MD,pl.Sq,pl.bT,Xf,pl.Jj],encapsulation:2});function YN(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"section",0)(1,"div",1)(2,"div",2)(3,"div",3)(4,"h2",4),yl.EFF(5),yl.k0s(),yl.j41(6,"button",5),yl.nI1(7,"i18n"),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.closed.emit())}),yl.k0s()(),yl.j41(8,"div",6),yl.SdG(9),yl.k0s()()(),yl.nrm(10,"div",7),yl.k0s()}if(2&e){const e=yl.XpG();yl.BMQ("aria-label",e.title()),yl.R7$(5),yl.SpI(" ",e.title()," "),yl.R7$(),yl.Y8G("label",yl.bMT(7,3,"close"))}}class WN{constructor(){this.templateRef=o.ebz.required(yl.C4Q),this.title=(0,o.hFB)(""),this.closed=new yl.bkB}}WN.ɵfac=function(e){return new(e||WN)},WN.ɵcmp=yl.VBU({type:WN,selectors:[["bit-popover"]],viewQuery:function(e,t){1&e&&yl.wEZ(t.templateRef,yl.C4Q,5),2&e&&yl.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&&(yl.NAR(),yl.DNE(0,YN,11,5,"ng-template"))},dependencies:[ll.Pd,ll.kB,_l,zl,Kl,Xl,Wl,Hl],encapsulation:2});class HN{}HN.ɵfac=function(e){return new(e||HN)},HN.ɵmod=yl.$C({type:HN}),HN.ɵinj=a.G2t({imports:[WN]});class JN{constructor(e){this.dialogRef=e,this.platformUtilsService=(0,a.WQX)(Eb),this.params=(0,a.WQX)(nd.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(JN,{data:t,disableClose:!0,positionStrategy:new Yd})}}JN.ɵfac=function(e){return new(e||JN)(yl.rXU(Xd))},JN.ɵcmp=yl.VBU({type:JN,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&&(yl.j41(0,"bit-simple-dialog"),yl.nrm(1,"i",0),yl.j41(2,"span",1),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s(),yl.j41(5,"div",2)(6,"p",3),yl.EFF(7),yl.nI1(8,"i18n"),yl.nrm(9,"br"),yl.j41(10,"button",4),yl.bIt("click",function(e){return t.openLink(e)}),yl.EFF(11),yl.nI1(12,"i18n"),yl.k0s()()(),yl.qex(13,5),yl.j41(14,"button",6),yl.bIt("click",function(){return t.onContinue()}),yl.EFF(15),yl.nI1(16,"i18n"),yl.k0s(),yl.j41(17,"button",7),yl.bIt("click",function(){return t.onCancel()}),yl.EFF(18),yl.nI1(19,"i18n"),yl.k0s(),yl.bVm(),yl.k0s()),2&e&&(yl.R7$(3),yl.SpI(" ",yl.bMT(4,5,"warningCapitalized")," "),yl.R7$(4),yl.SpI(" ",yl.bMT(8,7,t.contentKey)," "),yl.R7$(4),yl.SpI(" ",yl.bMT(12,9,"uriMatchWarningDialogLink")," "),yl.R7$(4),yl.SpI(" ",yl.bMT(16,11,"continue")," "),yl.R7$(3),yl.SpI(" ",yl.bMT(19,13,"cancel")," "))},dependencies:[Kb,Xu,Ku,dh,Nd,Vd,qf,Xf],encapsulation:2});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=["uriInput"],eV=["matchDetectionSelect"];function tV(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",11),yl.nI1(1,"i18n"),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.removeUri())}),yl.k0s()}2&e&&yl.Y8G("label",yl.bMT(1,1,"deleteWebsite"))}function iV(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"div",12)(1,"button",13),yl.nI1(2,"i18n"),yl.bIt("keydown",function(t){a.eBV(e);const i=yl.XpG();return a.Njj(i.handleKeydown(t))}),yl.k0s()()}if(2&e){const e=yl.XpG();yl.R7$(),yl.Y8G("label",yl.i5U(2,1,"reorderToggleButton",e.uriLabel))}}function nV(e,t){if(1&e&&yl.nrm(0,"bit-option",18),2&e){const e=t.$implicit;yl.Y8G("label",e.label)("value",e.value)("disabled",e.disabled)}}function rV(e,t){if(1&e&&(yl.qex(0),yl.j41(1,"b"),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.EFF(4),yl.nI1(5,"i18n"),yl.bVm()),2&e){const e=yl.XpG().ngIf;yl.R7$(2),yl.SpI("",yl.bMT(3,2,"warningCapitalized"),":"),yl.R7$(2),yl.SpI(" ",yl.bMT(5,4,e[1])," ")}}function sV(e,t){if(1&e&&(yl.j41(0,"bit-hint"),yl.EFF(1),yl.nI1(2,"i18n"),yl.DNE(3,rV,6,6,"ng-container",17),yl.k0s()),2&e){const e=t.ngIf;yl.R7$(),yl.SpI(" ",yl.bMT(2,2,e[0])," "),yl.R7$(2),yl.Y8G("ngIf",e.length>1)}}function oV(e,t){if(1&e&&(yl.j41(0,"bit-form-field",14)(1,"bit-label"),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.j41(4,"bit-select",15,1),yl.DNE(6,nV,1,3,"bit-option",16),yl.k0s(),yl.DNE(7,sV,4,4,"bit-hint",17),yl.k0s()),2&e){const e=yl.XpG();yl.R7$(2),yl.JRh(yl.bMT(3,3,"matchDetection")),yl.R7$(4),yl.Y8G("ngForOf",e.uriMatchOptions),yl.R7$(),yl.Y8G("ngIf",e.getMatchHints())}}class aV{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.showMatchDetection?this.i18nService.t("hideMatchDetection",this.uriForm.value.uri):this.i18nService.t("showMatchDetection",this.uriForm.value.uri)}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:ZD.Domain},{label:this.i18nService.t("host"),value:ZD.Host},{label:this.i18nService.t("exact"),value:ZD.Exact},{label:this.i18nService.t("never"),value:ZD.Never},{label:this.i18nService.t("uriAdvancedOption"),value:null,disabled:!0},{label:this.i18nService.t("startsWith"),value:ZD.StartsWith},{label:this.i18nService.t("regEx"),value:ZD.RegularExpression}],this.advancedOptionWarningMap={[ZD.StartsWith]:"startsWithAdvancedOptionWarning",[ZD.RegularExpression]:"regExAdvancedOptionWarning"},this.onKeydown=new yl.bkB,this.remove=new yl.bkB,this.showMatchDetection=!1,this.onChange=()=>{},this.onTouched=()=>{},this.uriForm.valueChanges.pipe((0,wl.pQ)()).subscribe(e=>{this.onChange(e)}),this.uriForm.statusChanges.pipe((0,wl.pQ)()).subscribe(()=>{this.onTouched()}),this.uriForm.controls.matchDetection.valueChanges.pipe((0,Qv.J)(),(0,yo.H)(([e,t])=>this.handleAdvancedMatch(e,t)),(0,wl.pQ)()).subscribe()}handleAdvancedMatch(e,t){return ZN(this,void 0,void 0,function*(){e!==t&&(t===ZD.StartsWith||t===ZD.RegularExpression)&&JN.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!==ZD.StartsWith&&i!==ZD.RegularExpression||t.push(this.advancedOptionWarningMap[i]),t}}aV.ɵfac=function(e){return new(e||aV)(yl.rXU(Jd),yl.rXU(fl.ok),yl.rXU(Pl))},aV.ɵcmp=yl.VBU({type:aV,selectors:[["vault-autofill-uri-option"]],viewQuery:function(e,t){if(1&e&&(yl.GBs(QN,5),yl.GBs(eV,5)),2&e){let e;yl.mGM(e=yl.lsd())&&(t.inputElement=e.first),yl.mGM(e=yl.lsd())&&(t.matchDetectionSelect=e.first)}},inputs:{canReorder:"canReorder",canRemove:"canRemove",defaultMatchDetection:"defaultMatchDetection",index:"index"},outputs:{onKeydown:"onKeydown",remove:"remove"},features:[yl.Jv_([{provide:fl.kq,useExisting:(0,a.Rfq)(()=>aV),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=yl.RV6();yl.qex(0,2),yl.j41(1,"div",3)(2,"div",4)(3,"bit-form-field",5)(4,"bit-label"),yl.EFF(5),yl.k0s(),yl.nrm(6,"input",6,0),yl.j41(8,"button",7),yl.bIt("click",function(){return a.eBV(e),a.Njj(t.toggleMatchDetection())}),yl.k0s(),yl.DNE(9,tV,2,3,"button",8),yl.k0s(),yl.DNE(10,iV,3,4,"div",9),yl.k0s(),yl.DNE(11,oV,8,5,"bit-form-field",10),yl.k0s(),yl.bVm()}2&e&&(yl.Y8G("formGroup",t.uriForm),yl.R7$(2),yl.AVh("!tw-mb-1",t.showMatchDetection),yl.R7$(3),yl.JRh(t.uriLabel),yl.R7$(3),yl.Y8G("bitIconButton",t.showMatchDetection?"bwi-cog-f":"bwi-cog")("label",t.toggleTitle),yl.R7$(),yl.Y8G("ngIf",t.canRemove),yl.R7$(),yl.Y8G("ngIf",t.canReorder),yl.R7$(),yl.Y8G("ngIf",t.showMatchDetection))},dependencies:[cl.ad,cl.Fb,Eu,Sc,nu,ou,Du,Bb,fl.X1,fl.me,fl.BC,fl.cb,fl.j4,fl.JD,_l,zl,qf,Bu,Vu,Ou,pl.Sq,pl.bT,Xf],encapsulation:2});var lV=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 cV(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"vault-autofill-uri-option",7),yl.nI1(1,"async"),yl.bIt("remove",function(){const t=a.eBV(e).index,i=yl.XpG();return a.Njj(i.removeUri(t))})("onKeydown",function(t){const i=a.eBV(e).index,n=yl.XpG();return a.Njj(n.onUriItemKeydown(t,i))}),yl.k0s()}if(2&e){const e=t.index,i=yl.XpG();yl.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",yl.bMT(1,6,i.defaultMatchDetection$))("index",e)}}function uV(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",8),yl.nI1(1,"async"),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.addUri({uri:null,matchDetection:null},!0))}),yl.nrm(2,"i",9),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s()}if(2&e){const e=yl.XpG();yl.AVh("tw-mb-6",yl.bMT(1,3,e.autofillOnPageLoadEnabled$)),yl.R7$(3),yl.SpI(" ",yl.bMT(4,5,"addWebsite")," ")}}function dV(e,t){if(1&e&&(yl.j41(0,"bit-form-field",10)(1,"bit-label"),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.nrm(4,"bit-select",11),yl.k0s()),2&e){const e=yl.XpG();yl.R7$(2),yl.JRh(yl.bMT(3,2,"autoFillOnPageLoad")),yl.R7$(2),yl.Y8G("items",e.autofillOptions)}}class hV{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,To.p)(()=>this.platformUtilsService.getClientType()==Ca.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 go.B,this.cipherFormContainer.registerChildForm("autoFillOptions",this.autofillOptionsForm),this.autofillOptionsForm.valueChanges.pipe((0,wl.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 uE,{uri:e.uri,match:e.matchDetection})),t.login.autofillOnPageLoad=e.autofillOnPageLoad,t})}),this.updateDefaultAutofillLabel(),this.focusOnNewInput$.pipe((0,wl.pQ)(),(0,co.n)(()=>this.uriOptions.changes.pipe((0,No.s)(1))),(0,co.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,wl.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,wl.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 uE,{uri:e.value.uri,match:null!==(t=e.value.matchDetection)&&void 0!==t?t:null})}),e))}onUriItemDrop(e){(0,cl.HD)(this.uriControls,e.previousIndex,e.currentIndex),this.updateUriFields()}onUriItemKeydown(e,t){return lV(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 lV(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,cl.HD)(this.uriControls,t,n),this.updateUriFields(),requestAnimationFrame(()=>{e.target.focus()})})}}hV.ɵfac=function(e){return new(e||hV)(yl.rXU(sN),yl.rXU(fl.ok),yl.rXU(Pl),yl.rXU(ll.Ai),yl.rXU(oE),yl.rXU(HD),yl.rXU(Eb))},hV.ɵcmp=yl.VBU({type:hV,selectors:[["vault-autofill-options"]],viewQuery:function(e,t){if(1&e&&yl.GBs(aV,5),2&e){let e;yl.mGM(e=yl.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&&(yl.j41(0,"section",0)(1,"bit-section-header")(2,"h2",1),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s()(),yl.j41(5,"bit-card",2),yl.bIt("cdkDropListDropped",function(e){return t.onUriItemDrop(e)}),yl.qex(6,3),yl.DNE(7,cV,2,8,"vault-autofill-uri-option",4),yl.bVm(),yl.DNE(8,uV,5,7,"button",5)(9,dV,5,4,"bit-form-field",6),yl.nI1(10,"async"),yl.k0s()()),2&e&&(yl.Y8G("formGroup",t.autofillOptionsForm),yl.R7$(3),yl.SpI(" ",yl.bMT(4,5,"autofillOptions")," "),yl.R7$(4),yl.Y8G("ngForOf",t.uriControls),yl.R7$(),yl.Y8G("ngIf",t.autofillOptionsForm.enabled),yl.R7$(),yl.Y8G("ngIf",yl.bMT(10,7,t.autofillOnPageLoadEnabled$)))},dependencies:[cl.ad,cl.O7,cl.T1,ex,Xl,Wl,qf,WR,fl.X1,fl.BC,fl.cb,fl.j4,fl.JD,fl.v8,pl.Sq,Eu,Sc,Du,Bu,Vu,_l,aV,Oh,Kb,pl.bT,Xf,pl.Jj],encapsulation:2});class pV{}var fV=i(65023);const vV=14,mV=24,gV=[{id:"right-start",offsetX:vV,offsetY:-24,originX:"end",originY:"center",overlayX:"start",overlayY:"top",panelClass:["bit-popover-right","bit-popover-right-start"]},{id:"right-center",offsetX:vV,originX:"end",originY:"center",overlayX:"start",overlayY:"center",panelClass:["bit-popover-right","bit-popover-right-center"]},{id:"right-end",offsetX:vV,offsetY:mV,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:mV,originX:"start",originY:"center",overlayX:"end",overlayY:"bottom",panelClass:["bit-popover-left","bit-popover-left-end"]},{id:"below-center",offsetY:vV,originX:"center",originY:"bottom",overlayX:"center",overlayY:"top",panelClass:["bit-popover-below","bit-popover-below-center"]},{id:"below-start",offsetX:-24,offsetY:vV,originX:"center",originY:"bottom",overlayX:"start",overlayY:"top",panelClass:["bit-popover-below","bit-popover-below-start"]},{id:"below-end",offsetX:mV,offsetY:vV,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:mV,offsetY:-14,originX:"center",originY:"top",overlayX:"end",overlayY:"bottom",panelClass:["bit-popover-above","bit-popover-above-end"]}];class yV{get positions(){if(!this.position())return gV;const e=gV.find(e=>e.id===this.position());return e?[e,...gV]:gV}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}togglePopover(){this.popoverOpen()?this.closePopover():this.openPopover()}openPopover(){this.popoverOpen.set(!0),this.overlayRef=this.overlay.create(this.defaultPopoverConfig);const e=new xl.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,To.p)(e=>"Escape"===e.key)),i=this.overlayRef.backdropClick(),n=this.popover().closed;return e.pipe((0,fV.X)(t,i,n))}destroyPopover(){this.overlayRef&&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}ngAfterViewInit(){this.popoverOpen()&&this.openPopover()}ngOnDestroy(){this.disposeAll()}closePopover(){this.destroyPopover()}}yV.ɵfac=function(e){return new(e||yV)(yl.rXU(yl.aKT),yl.rXU(yl.c1b),yl.rXU(dl.hJ))},yV.ɵdir=yl.FsC({type:yV,selectors:[["","bitPopoverTriggerFor",""]],hostVars:1,hostBindings:function(e,t){1&e&&yl.bIt("click",function(){return t.togglePopover()}),2&e&&yl.BMQ("aria-expanded",t.popoverOpen())},inputs:{popoverOpen:[1,"popoverOpen"],popover:[1,"bitPopoverTriggerFor","popover"],position:[1,"position"]},outputs:{popoverOpen:"popoverOpenChange"},exportAs:["popoverTrigger"]});var bV=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 wV(e,t){if(1&e&&(yl.nrm(0,"button",18),yl.nI1(1,"i18n")),2&e){const e=yl.XpG();yl.Y8G("label",yl.bMT(1,2,"generateUsername"))("bitAction",e.generateUsername)}}function SV(e,t){1&e&&(yl.qex(0),yl.EFF(1),yl.nI1(2,"i18n"),yl.bVm()),2&e&&(yl.R7$(),yl.SpI(" ",yl.bMT(2,1,"securePasswordGenerated")," "))}function kV(e,t){1&e&&(yl.qex(0),yl.j41(1,"span",19),yl.EFF(2),yl.nI1(3,"i18n"),yl.nI1(4,"i18n"),yl.k0s(),yl.j41(5,"span",20),yl.EFF(6),yl.nI1(7,"i18n"),yl.nrm(8,"i",21),yl.EFF(9),yl.nI1(10,"i18n"),yl.k0s(),yl.bVm()),2&e&&(yl.R7$(2),yl.Lme(" ",yl.bMT(3,4,"useGeneratorHelpTextPartOne")," ",yl.bMT(4,6,"useGeneratorHelpTextPartTwo")," "),yl.R7$(4),yl.SpI(" ",yl.bMT(7,8,"useGeneratorHelpTextPartOne")," "),yl.R7$(3),yl.SpI(" ",yl.bMT(10,10,"useGeneratorHelpTextPartTwo")," "))}function IV(e,t){if(1&e&&(yl.j41(0,"bit-hint"),yl.DNE(1,SV,3,3,"ng-container",6)(2,kV,11,12,"ng-container",6),yl.k0s()),2&e){const e=yl.XpG();yl.R7$(),yl.Y8G("ngIf",e.newPasswordGenerated),yl.R7$(),yl.Y8G("ngIf",!e.newPasswordGenerated)}}function CV(e,t){if(1&e&&(yl.nrm(0,"button",22),yl.nI1(1,"i18n")),2&e){const e=yl.XpG();yl.Y8G("label",yl.bMT(1,2,"checkPassword"))("bitAction",e.checkPassword)}}function TV(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",23),yl.bIt("toggledChange",function(t){a.eBV(e);const i=yl.XpG();return a.Njj(i.logVisibleEvent(t,i.EventType.Cipher_ClientToggledPasswordVisible))}),yl.k0s()}}function PV(e,t){if(1&e&&(yl.nrm(0,"button",24),yl.nI1(1,"i18n")),2&e){const e=yl.XpG();yl.Y8G("label",yl.bMT(1,2,"generatePassword"))("bitAction",e.generatePassword)}}function FV(e,t){if(1&e&&(yl.nrm(0,"button",27),yl.nI1(1,"i18n")),2&e){const e=yl.XpG(2);yl.Y8G("bitAction",e.removePasskey)("label",yl.bMT(1,2,"removePasskey"))}}function RV(e,t){if(1&e&&(yl.j41(0,"bit-form-field")(1,"bit-label"),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.nrm(4,"input",25),yl.DNE(5,FV,2,4,"button",26),yl.k0s()),2&e){const e=yl.XpG();yl.R7$(2),yl.JRh(yl.bMT(3,3,"typePasskey")),yl.R7$(2),yl.Y8G("value",e.fido2CredentialCreationDateValue),yl.R7$(),yl.Y8G("ngIf",e.loginDetailsForm.enabled&&e.viewHiddenFields)}}function xV(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",28),yl.bIt("toggledChange",function(t){a.eBV(e);const i=yl.XpG();return a.Njj(i.logVisibleEvent(t,i.EventType.Cipher_ClientToggledTOTPSeedVisible))}),yl.k0s()}}function AV(e,t){if(1&e&&(yl.nrm(0,"button",29),yl.nI1(1,"i18n")),2&e){const e=yl.XpG();yl.Y8G("bitAction",e.captureTotp)("label",yl.bMT(1,2,"totpCapture"))}}class DV{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=Ra,this.loginDetailsForm=this.formBuilder.group({username:[""],password:[""],totp:[""]}),this.datePipe=(0,a.WQX)(pl.vh),this.destroyRef=(0,a.WQX)(a.abz),this.logVisibleEvent=(e,t)=>bV(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=()=>bV(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=()=>bV(this,void 0,void 0,function*(){this.existingFido2Credentials=null,this.cipherFormContainer.patchCipher(e=>(e.login.fido2Credentials=null,e))}),this.generatePassword=()=>bV(this,void 0,void 0,function*(){const e=yield this.generationService.generatePassword();e&&(this.loginDetailsForm.controls.password.patchValue(e),this.newPasswordGenerated=!0)}),this.generateUsername=()=>bV(this,void 0,void 0,function*(){const e=yield this.generationService.generateUsername(this.cipherFormContainer.website);e&&this.loginDetailsForm.controls.username.patchValue(e)}),this.checkPassword=()=>bV(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,wl.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,wl.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)||""})}}DV.ɵfac=function(e){return new(e||DV)(yl.rXU(sN),yl.rXU(fl.ok),yl.rXU(Pl),yl.rXU(nN),yl.rXU(Pb),yl.rXU(xb),yl.rXU(OE),yl.rXU(pV,8))},DV.ɵcmp=yl.VBU({type:DV,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&&(yl.j41(0,"section",1)(1,"bit-section-header")(2,"h2",2),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s()(),yl.j41(5,"bit-card")(6,"bit-form-field")(7,"bit-label"),yl.EFF(8),yl.nI1(9,"i18n"),yl.k0s(),yl.nrm(10,"input",3),yl.DNE(11,wV,2,4,"button",4),yl.k0s(),yl.j41(12,"bit-form-field")(13,"bit-label"),yl.EFF(14),yl.nI1(15,"i18n"),yl.k0s(),yl.nrm(16,"input",5),yl.DNE(17,IV,3,2,"bit-hint",6)(18,CV,2,4,"button",7)(19,TV,1,0,"button",8)(20,PV,2,4,"button",9),yl.k0s(),yl.DNE(21,RV,6,5,"bit-form-field",6),yl.j41(22,"bit-form-field",10)(23,"bit-label"),yl.EFF(24),yl.nI1(25,"i18n"),yl.j41(26,"button",11),yl.nI1(27,"i18n"),yl.nrm(28,"i",12),yl.k0s(),yl.j41(29,"bit-popover",13,0),yl.nI1(31,"i18n"),yl.j41(32,"p",14),yl.EFF(33),yl.nI1(34,"i18n"),yl.k0s()()(),yl.nrm(35,"input",15),yl.DNE(36,xV,1,0,"button",16)(37,AV,2,4,"button",17),yl.k0s()()(),yl.nrm(38,"vault-autofill-options")),2&e){const e=yl.sdS(30);yl.Y8G("formGroup",t.loginDetailsForm),yl.R7$(3),yl.SpI(" ",yl.bMT(4,17,"loginCredentials")," "),yl.R7$(5),yl.JRh(yl.bMT(9,19,"username")),yl.R7$(3),yl.Y8G("ngIf",t.loginDetailsForm.controls.username.enabled),yl.R7$(3),yl.JRh(yl.bMT(15,21,"password")),yl.R7$(3),yl.Y8G("ngIf",t.loginDetailsForm.controls.password.enabled),yl.R7$(),yl.Y8G("ngIf",t.loginDetailsForm.controls.password.enabled&&(null==t.loginDetailsForm.controls.password.value?null:t.loginDetailsForm.controls.password.value.length)>0),yl.R7$(),yl.Y8G("ngIf",t.viewHiddenFields),yl.R7$(),yl.Y8G("ngIf",t.loginDetailsForm.controls.password.enabled),yl.R7$(),yl.Y8G("ngIf",t.hasPasskey),yl.R7$(3),yl.SpI(" ",yl.bMT(25,23,"authenticatorKey")," "),yl.R7$(2),yl.Y8G("bitPopoverTriggerFor",e)("appA11yTitle",yl.bMT(27,25,"learnMoreAboutAuthenticators")),yl.R7$(3),yl.Y8G("title",yl.bMT(31,27,"totpHelperTitle")),yl.R7$(4),yl.SpI(" ",yl.bMT(34,29,t.canCaptureTotp?"totpHelperWithCapture":"totpHelper")," "),yl.R7$(3),yl.Y8G("ngIf",t.viewHiddenFields),yl.R7$(),yl.Y8G("ngIf",t.canCaptureTotp)}},dependencies:[fl.X1,fl.me,fl.BC,fl.cb,fl.j4,fl.JD,ex,Xl,Wl,qf,jb,WR,Eu,Sc,nu,ou,Du,Vb,Bb,_l,zl,rc,Rd,pl.bT,HN,WN,yV,hV,Oh,Kb,Xf],encapsulation:2});var EV=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 $V(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"bit-spotlight",1),yl.bIt("onDismiss",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.dismissNewItemSpotlight())}),yl.k0s()}if(2&e){const e=yl.XpG();yl.Y8G("title",e.nudgeTitle)("subtitle",e.nudgeBody)}}class OV{constructor(e,t,i){this.i18nService=e,this.accountService=t,this.nudgesService=i,this.configType=o.hFB.required(),this.activeUserId$=this.accountService.activeAccount$.pipe(Gp),this.showNewItemSpotlight$=(0,$o.z)([this.activeUserId$,(0,wl.br)(this.configType).pipe((0,l.T)(e=>this.mapToNudgeType(e)))]).pipe((0,co.n)(([e,t])=>this.nudgesService.showNudgeSpotlight$(t,e))),this.nudgeTitle="",this.nudgeBody="",this.dismissalNudgeType=null}mapToNudgeType(e){switch(e){case A$.gCH.Login:{const e=this.i18nService.t("newLoginNudgeBodyOne"),t=this.i18nService.t("newLoginNudgeBodyBold"),i=this.i18nService.t("newLoginNudgeBodyTwo");return this.dismissalNudgeType=VR.NewLoginItemStatus,this.nudgeTitle=this.i18nService.t("newLoginNudgeTitle"),this.nudgeBody=`${e} ${t} ${i}`,VR.NewLoginItemStatus}case A$.gCH.Card:return this.dismissalNudgeType=VR.NewCardItemStatus,this.nudgeTitle=this.i18nService.t("newCardNudgeTitle"),this.nudgeBody=this.i18nService.t("newCardNudgeBody"),VR.NewCardItemStatus;case A$.gCH.Identity:return this.dismissalNudgeType=VR.NewIdentityItemStatus,this.nudgeTitle=this.i18nService.t("newIdentityNudgeTitle"),this.nudgeBody=this.i18nService.t("newIdentityNudgeBody"),VR.NewIdentityItemStatus;case A$.gCH.SecureNote:return this.dismissalNudgeType=VR.NewNoteItemStatus,this.nudgeTitle=this.i18nService.t("newNoteNudgeTitle"),this.nudgeBody=this.i18nService.t("newNoteNudgeBody"),VR.NewNoteItemStatus;case A$.gCH.SshKey:{const e=this.i18nService.t("newSshNudgeBodyOne"),t=this.i18nService.t("newSshNudgeBodyTwo");return this.dismissalNudgeType=VR.NewSshItemStatus,this.nudgeTitle=this.i18nService.t("newSshNudgeTitle"),this.nudgeBody=`${e} ${t}`,VR.NewSshItemStatus}default:throw new Error("Unsupported cipher type")}}dismissNewItemSpotlight(){return EV(this,void 0,void 0,function*(){const e=yield(0,ho._)(this.activeUserId$);this.dismissalNudgeType&&e&&(yield this.nudgesService.dismissNudge(this.dismissalNudgeType,e),this.showNewItemSpotlight$=(0,Oo.of)(!1))})}}OV.ɵfac=function(e){return new(e||OV)(yl.rXU(Pl),yl.rXU(Ok),yl.rXU(jR))},OV.ɵcmp=yl.VBU({type:OV,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&&(yl.nVh(0,$V,1,2,"bit-spotlight",0),yl.nI1(1,"async")),2&e&&yl.vxM(yl.bMT(1,1,t.showNewItemSpotlight$)?0:-1)},dependencies:[qR,pl.Jj],encapsulation:2});class UV{}var MV=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 NV(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",7),yl.nI1(1,"i18n"),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.importSshKeyFromClipboard())}),yl.k0s()}2&e&&yl.Y8G("label",yl.mNQ(yl.bMT(1,2,"importSshKeyFromClipboard")))}class VV{constructor(e,t,i,n,r){this.cipherFormContainer=e,this.formBuilder=t,this.sdkService=i,this.sshImportPromptService=n,this.platformUtilsService=r,this.sshKeyForm=this.formBuilder.group({privateKey:[""],publicKey:[""],keyFingerprint:[""]}),this.showImport=!1,this.destroyRef=(0,a.WQX)(a.abz),this.cipherFormContainer.registerChildForm("sshKeyDetails",this.sshKeyForm),this.sshKeyForm.valueChanges.pipe((0,wl.pQ)()).subscribe(e=>{const t=new G$;t.privateKey=e.privateKey,t.publicKey=e.publicKey,t.keyFingerprint=e.keyFingerprint,this.cipherFormContainer.patchCipher(e=>(e.sshKey=t,e))})}ngOnInit(){return MV(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.platformUtilsService.getClientType()!==Ca.Web&&(this.showImport=!0),this.cipherFormContainer.formStatusChange$.pipe((0,wl.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 MV(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 MV(this,void 0,void 0,function*(){yield(0,ho._)(this.sdkService.client$);const e=(0,A$.v8c)("Ed25519");this.sshKeyForm.setValue({privateKey:e.privateKey,publicKey:e.publicKey,keyFingerprint:e.fingerprint})})}}VV.ɵfac=function(e){return new(e||VV)(yl.rXU(sN),yl.rXU(fl.ok),yl.rXU($k),yl.rXU(UV),yl.rXU(Eb))},VV.ɵcmp=yl.VBU({type:VV,selectors:[["vault-sshkey-section"]],inputs:{originalCipherView:"originalCipherView",disabled:"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","click",4,"ngIf"],["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&&(yl.j41(0,"section",0)(1,"bit-section-header")(2,"h2",1),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s()(),yl.j41(5,"bit-card")(6,"bit-form-field")(7,"bit-label"),yl.EFF(8),yl.nI1(9,"i18n"),yl.k0s(),yl.nrm(10,"input",2)(11,"button",3),yl.DNE(12,NV,2,4,"button",4),yl.k0s(),yl.j41(13,"bit-form-field")(14,"bit-label"),yl.EFF(15),yl.nI1(16,"i18n"),yl.k0s(),yl.nrm(17,"input",5),yl.k0s(),yl.j41(18,"bit-form-field")(19,"bit-label"),yl.EFF(20),yl.nI1(21,"i18n"),yl.k0s(),yl.nrm(22,"input",6),yl.k0s()()()),2&e&&(yl.Y8G("formGroup",t.sshKeyForm),yl.R7$(3),yl.SpI(" ",yl.bMT(4,6,"typeSshKey")," "),yl.R7$(5),yl.JRh(yl.bMT(9,8,"sshPrivateKey")),yl.R7$(4),yl.Y8G("ngIf",t.showImport),yl.R7$(3),yl.JRh(yl.bMT(16,10,"sshPublicKey")),yl.R7$(5),yl.JRh(yl.bMT(21,12,"sshFingerprint")))},dependencies:[WR,Xl,Wl,Eu,Sc,ou,Du,Vb,Bb,fl.X1,fl.me,fl.BC,fl.cb,fl.j4,fl.JD,Bu,ex,_l,zl,qf,pl.MD,pl.bT,Xf],encapsulation:2});class BV{}var jV=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 GV=[[["","slot","attachment-button"]]];function LV(e,t){if(1&e&&yl.nrm(0,"vault-new-item-nudge",3),2&e){const e=yl.XpG();yl.Y8G("configType",e.config.cipherType)}}function zV(e,t){1&e&&yl.nrm(0,"vault-login-details-section")}function _V(e,t){if(1&e&&yl.nrm(0,"vault-identity-section",8),2&e){const e=yl.XpG(2);yl.Y8G("disabled","partial-edit"===e.config.mode)("originalCipherView",e.originalCipherView)}}function KV(e,t){if(1&e&&yl.nrm(0,"vault-card-details-section",9),2&e){const e=yl.XpG(2);yl.Y8G("originalCipherView",e.originalCipherView)("disabled","partial-edit"===e.config.mode)}}function XV(e,t){if(1&e&&yl.nrm(0,"vault-sshkey-section",8),2&e){const e=yl.XpG(2);yl.Y8G("disabled","partial-edit"===e.config.mode)("originalCipherView",e.originalCipherView)}}function qV(e,t){1&e&&(yl.qex(0),yl.SdG(1),yl.bVm())}function YV(e,t){if(1&e&&(yl.qex(0),yl.nrm(1,"vault-item-details-section",4),yl.DNE(2,zV,1,0,"vault-login-details-section",2)(3,_V,1,2,"vault-identity-section",5)(4,KV,1,2,"vault-card-details-section",6)(5,XV,1,2,"vault-sshkey-section",5),yl.nrm(6,"vault-additional-options-section",7),yl.DNE(7,qV,2,0,"ng-container",2),yl.bVm()),2&e){const e=yl.XpG();yl.R7$(),yl.Y8G("config",e.config)("originalCipherView",e.originalCipherView),yl.R7$(),yl.Y8G("ngIf",e.config.cipherType===e.CipherType.Login),yl.R7$(),yl.Y8G("ngIf",e.config.cipherType===e.CipherType.Identity),yl.R7$(),yl.Y8G("ngIf",e.config.cipherType===e.CipherType.Card),yl.R7$(),yl.Y8G("ngIf",e.config.cipherType===e.CipherType.SshKey),yl.R7$(),yl.Y8G("disableSectionMargin","edit"!==e.config.mode),yl.R7$(),yl.Y8G("ngIf","edit"==e.config.mode)}}class WV{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,wl.pQ)(this.destroyRef)).subscribe(e=>{this.submitBtn.loading.set(e)}),this.bitSubmit.disabled$.pipe((0,wl.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 jV(this,void 0,void 0,function*(){this._firstInitialized&&(yield this.init())})}ngOnInit(){return jV(this,void 0,void 0,function*(){yield this.init(),this._firstInitialized=!0})}init(){return jV(this,void 0,void 0,function*(){if(this.loading=!0,this.changeDetectorRef.detectChanges(),this.updatedCipherView=new L$,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===CR.SecureNote&&(this.updatedCipherView.secureNote.type=$R);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 yl.bkB,this.formReadySubject=new go.B,this.formReady=this.formReadySubject.asObservable(),this.formStatusChangeSubject=new fd.t(null),this.formStatusChange$=this.formStatusChangeSubject.asObservable(),this.cipherForm=this.formBuilder.group({}),this.loading=!0,this.CipherType=CR,this.submit=()=>jV(this,void 0,void 0,function*(){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,ho._)(this.accountService.activeAccount$.pipe(Gp,(0,co.n)(e=>this.cipherArchiveService.userCanArchive$(e)))))&&this.updatedCipherView.archivedDate&&(this.updatedCipherView.archivedDate=null);const e=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?"editedItem":"addedItem")}),this.cipherSaved.emit(e)})}countInvalidFields(e){return Object.values(e.controls).reduce((e,t)=>t instanceof fl.gE?e+this.countInvalidFields(t):e+(t.invalid?1:0),0)}}WV.ɵfac=function(e){return new(e||WV)(yl.rXU(fl.ok),yl.rXU(rN),yl.rXU(xb),yl.rXU(Pl),yl.rXU(o.gRc),yl.rXU(oN),yl.rXU(BV),yl.rXU(Ok))},WV.ɵcmp=yl.VBU({type:WV,selectors:[["vault-cipher-form"]],viewQuery:function(e,t){if(1&e&&yl.GBs(Td,5),2&e){let e;yl.mGM(e=yl.lsd())&&(t.bitSubmit=e.first)}},inputs:{formId:"formId",config:"config",submitBtn:"submitBtn",beforeSubmit:"beforeSubmit"},outputs:{cipherSaved:"cipherSaved",formReady:"formReady",formStatusChange$:"formStatusChange$"},features:[yl.Jv_([{provide:sN,useExisting:(0,a.Rfq)(()=>WV)},{provide:oN}]),yl.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&&(yl.NAR(GV),yl.DNE(0,LV,1,1,"vault-new-item-nudge",0),yl.j41(1,"form",1),yl.DNE(2,YV,8,8,"ng-container",2),yl.k0s()),2&e&&(yl.Y8G("ngIf",!t.loading),yl.R7$(),yl.Y8G("id",t.formId)("formGroup",t.cipherForm)("bitSubmit",t.submit),yl.R7$(),yl.Y8G("ngIf",!t.loading))},dependencies:[rc,Td,Xl,wP,Eu,fl.X1,fl.qT,fl.cb,fl.j4,Bu,qN,UN,NN,VV,pl.bT,DN,DV,OV],encapsulation:2});var HV=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 JV{constructor(e,t){this.passwordGenerationService=e,this.usernameGenerationService=t}generatePassword(){return HV(this,void 0,void 0,function*(){const[e]=yield this.passwordGenerationService.getOptions();return yield this.passwordGenerationService.generatePassword(e)})}generateUsername(){return HV(this,void 0,void 0,function*(){const e=yield this.usernameGenerationService.getOptions();return yield this.usernameGenerationService.generateUsername(e)})}}JV.ɵfac=function(e){return new(e||JV)(a.KVO(rv),a.KVO(tb))},JV.ɵprov=a.jDH({token:JV,factory:JV.ɵfac});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{constructor(){this.cipherService=(0,a.WQX)(Fb),this.accountService=(0,a.WQX)(Ok),this.taskService=(0,a.WQX)(kE)}decryptCipher(e){return ZV(this,void 0,void 0,function*(){const t=yield(0,ho._)(this.accountService.activeAccount$.pipe(Gp));return yield this.cipherService.decrypt(e,t)})}saveCipher(e,t){return ZV(this,void 0,void 0,function*(){var i,n;const r=yield(0,ho._)(this.accountService.activeAccount$.pipe(Gp));let s;if(null==e.id||""===e.id){const i=yield this.cipherService.encrypt(e,r);return s=yield this.cipherService.createWithServer(i,t.admin),yield this.cipherService.decrypt(s,r)}if(null==t.originalCipher)throw new Error("Original cipher is required for updating an existing cipher");const o=new Set(null!==(i=t.originalCipher.collectionIds)&&void 0!==i?i:[]),a=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(c=a,(l=o).size===c.size&&[...l].every(e=>c.has(e))){const i=yield this.cipherService.encrypt(e,r,null,null,t.originalCipher);s=yield this.cipherService.updateWithServer(i,t.admin)}else{const i=yield this.cipherService.encrypt(e,r,null,null,t.originalCipher),n=i.cipher;n.collectionIds=t.originalCipher.collectionIds,yield this.cipherService.updateWithServer(i,t.admin||0===o.size),n.collectionIds=e.collectionIds,s=t.admin||0===o.size?yield this.cipherService.saveCollectionsWithServerAdmin(n):yield this.cipherService.saveCollectionsWithServer(n,r)}var l,c;return yield this.markAssociatedTaskAsComplete(r,e,t),null==s?null:yield this.cipherService.decrypt(s,r)})}markAssociatedTaskAsComplete(e,t,i){return ZV(this,void 0,void 0,function*(){var n;const r=yield this.cipherService.decrypt(i.originalCipher,e),s=yield(0,ho._)(this.taskService.pendingTasks$(e).pipe((0,l.T)(e=>e.find(e=>e.type===yE&&e.cipherId===t.id)))),o=t.type===CR.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))})}}QV.ɵfac=function(e){return new(e||QV)},QV.ɵprov=a.jDH({token:QV,factory:QV.ɵfac});class eB{}eB.ɵfac=function(e){return new(e||eB)},eB.ɵmod=yl.$C({type:eB}),eB.ɵinj=a.G2t({providers:[{provide:rN,useClass:QV},{provide:nN,useClass:JV}],imports:[WV]});class tB{}var iB=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 nB{constructor(){this.policyService=(0,a.WQX)($b),this.organizationService=(0,a.WQX)(AF),this.cipherService=(0,a.WQX)(Fb),this.folderService=(0,a.WQX)(qU),this.collectionService=(0,a.WQX)(BF),this.accountService=(0,a.WQX)(Ok),this.organizationDataOwnershipDisabled$=this.accountService.activeAccount$.pipe(Gp,(0,co.n)(e=>this.policyService.policyAppliesToUser$(_h.OrganizationDataOwnership,e)),(0,l.T)(e=>!e))}buildConfig(e,t,i){return iB(this,void 0,void 0,function*(){var n,r;const s=yield(0,ho._)(this.accountService.activeAccount$.pipe(Gp)),[o,a,c,u,d]=yield(0,ho._)((0,$o.z)([this.organizations$(s),this.collectionService.encryptedCollections$(s).pipe((0,l.T)(e=>null!=e?e:[]),(0,co.n)(e=>this.collectionService.decryptedCollections$(s).pipe((0,To.p)(t=>t.length===e.length)))),this.organizationDataOwnershipDisabled$,this.folderService.folders$(s).pipe((0,co.n)(e=>this.folderService.folderViews$(s).pipe((0,To.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:CR.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===Lh.Confirmed)))}getCipher(e,t){return null==t?Promise.resolve(null):this.cipherService.get(t,e)}}nB.ɵfac=function(e){return new(e||nB)},nB.ɵprov=a.jDH({token:nB,factory:nB.ɵfac});class rB{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,_a.Debug,t)}info(e,t){this.log(e,_a.Info,t)}warn(e,t){this.log(e,_a.Warning,t)}error(e,t){this.log(e,_a.Error,t)}panic(e,t){this.log(e,_a.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:sB(t),"@timestamp":this.now()});"string"!=typeof e||i||(n.message=e,delete n.content),this.logger.write(t,n)}}function sB(e){switch(e){case _a.Debug:return"debug";case _a.Info:return"information";case _a.Warning:return"warning";case _a.Error:return"error";default:return`${e}`}}const oB=gm({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 aB(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 lB(e){return oB}function cB(e,t){return t.length&&aB(e,"enableLogForTypes",{types:t}),function(i){const{type:n}=i;if("string"==typeof n&&t.includes(n)){const r=new rB(e,i);return aB(e,"enableLogForTypes",{targetType:n,available:t,loggerContext:i}),r}return oB}}function uB(e,t,i){if(e){const e=new rB(t,i);return aB(t,"ifEnabledSemanticLoggerProvider",i),e}return oB}class dB{}dB.ɵfac=function(e){return new(e||dB)},dB.ɵmod=yl.$C({type:dB}),dB.ɵinj=a.G2t({});var hB=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 pB{constructor(e,t){this.formBuilder=e,this.generatorService=t,this.account$=new So.m(1),this.onUpdated=new yl.bkB,this.settings=this.formBuilder.group({catchallDomain:[""]}),this.saveSettings=new go.B,this.destroyed$=new go.B}ngOnChanges(e){return hB(this,void 0,void 0,function*(){"account"in e&&e.account&&this.account$.next(this.account)})}ngOnInit(){return hB(this,void 0,void 0,function*(){const e=yield this.generatorService.settings(Eg.catchall,{account$:this.account$});e.pipe((0,Jv.Q)(this.destroyed$)).subscribe(e=>{this.settings.patchValue(e,{emitEvent:!1})}),e.pipe((0,jg.i)(1),(0,Jv.Q)(this.destroyed$)).subscribe(this.onUpdated),this.saveSettings.pipe((0,sm.E)(this.settings.valueChanges),(0,l.T)(([,e])=>e),(0,Jv.Q)(this.destroyed$)).subscribe(e)})}save(e="component api call"){this.saveSettings.next(e)}ngOnDestroy(){this.account$.complete(),this.destroyed$.next(),this.destroyed$.complete()}}pB.ɵfac=function(e){return new(e||pB)(yl.rXU(fl.ok),yl.rXU(sv))},pB.ɵcmp=yl.VBU({type:pB,selectors:[["tools-catchall-settings"]],inputs:{account:"account"},outputs:{onUpdated:"onUpdated"},features:[yl.OA$],decls:6,vars:4,consts:[[1,"tw-container",3,"formGroup"],["bitInput","","formControlName","catchallDomain","type","text",3,"change"]],template:function(e,t){1&e&&(yl.j41(0,"form",0)(1,"bit-form-field")(2,"bit-label"),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s(),yl.j41(5,"input",1),yl.bIt("change",function(){return t.save("catchallDomain")}),yl.k0s()()()),2&e&&(yl.Y8G("formGroup",t.settings),yl.R7$(3),yl.JRh(yl.bMT(4,2,"domainName")))},dependencies:[fl.X1,fl.qT,fl.me,fl.BC,fl.cb,fl.j4,fl.JD,Eu,Sc,ou,Du,qf,Hl],encapsulation:2});var fB=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 vB(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"bit-form-field")(1,"bit-label"),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.j41(4,"input",2),yl.bIt("change",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.save("domain"))}),yl.k0s(),yl.j41(5,"bit-hint"),yl.EFF(6),yl.nI1(7,"i18n"),yl.k0s()()}2&e&&(yl.R7$(2),yl.JRh(yl.bMT(3,2,"forwarderDomainName")),yl.R7$(4),yl.JRh(yl.bMT(7,4,"forwarderDomainNameHint")))}function mB(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"bit-form-field")(1,"bit-label"),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.j41(4,"input",3),yl.bIt("change",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.save("password"))}),yl.k0s(),yl.j41(5,"button",4),yl.bIt("change",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.save("token"))}),yl.k0s()()}2&e&&(yl.R7$(2),yl.JRh(yl.bMT(3,1,"apiKey")))}function gB(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"bit-form-field",1)(1,"bit-label"),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.j41(4,"input",5),yl.bIt("change",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.save("baseUrl"))}),yl.k0s()()}2&e&&(yl.R7$(2),yl.JRh(yl.bMT(3,1,"selfHostBaseUrl")))}const yB=Object.freeze({domain:"domain",token:"token",baseUrl:"baseUrl"});class bB{constructor(e,t){this.formBuilder=e,this.generatorService=t,this.account=null,this.account$=new So.m(1),this.forwarder=null,this.onUpdated=new yl.bkB,this.settings=this.formBuilder.group({[yB.domain]:[""],[yB.token]:[""],[yB.baseUrl]:[""]}),this.vendor=new So.m(1),this.saveSettings=new go.B,this.displayDomain=!1,this.displayToken=!1,this.displayBaseUrl=!1,this.refresh$=new go.B,this.destroyed$=new go.B}ngOnInit(){return fB(this,void 0,void 0,function*(){const e=new So.m(1);this.vendor.pipe((0,l.T)(e=>this.generatorService.forwarder(e)),(0,Jv.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,Hv.w)(),(0,Jv.Q)(this.destroyed$)).subscribe(e=>{this.settings.patchValue(e,{emitEvent:!1})}),e.pipe((0,Jv.Q)(this.destroyed$)).subscribe(e=>{for(const t in yB){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,jg.i)(1))),(0,Hv.w)(),(0,Jv.Q)(this.destroyed$)).subscribe(this.onUpdated),this.saveSettings.pipe((0,sm.E)(this.settings.valueChanges,t),(0,Jv.Q)(this.destroyed$)).subscribe(([,e,t])=>{t.next(e)})})}save(e="component api call"){this.saveSettings.next(e)}ngOnChanges(e){return fB(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()}}bB.ɵfac=function(e){return new(e||bB)(yl.rXU(fl.ok),yl.rXU(sv))},bB.ɵcmp=yl.VBU({type:bB,selectors:[["tools-forwarder-settings"]],inputs:{account:"account",forwarder:"forwarder"},outputs:{onUpdated:"onUpdated"},features:[yl.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&&(yl.j41(0,"form",0),yl.nVh(1,vB,8,6,"bit-form-field"),yl.nVh(2,mB,6,3,"bit-form-field"),yl.nVh(3,gB,5,3,"bit-form-field",1),yl.k0s()),2&e&&(yl.Y8G("formGroup",t.settings),yl.R7$(),yl.vxM(t.displayDomain?1:-1),yl.R7$(),yl.vxM(t.displayToken?2:-1),yl.R7$(),yl.vxM(t.displayBaseUrl?3:-1))},dependencies:[fl.X1,fl.qT,fl.me,fl.BC,fl.cb,fl.j4,fl.JD,Eu,Sc,nu,ou,Du,Vb,Bb,zl,qf,Hl],encapsulation:2});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())})};function SB(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"div",0)(1,"bit-spotlight",1),yl.nI1(2,"i18n"),yl.bIt("onDismiss",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.dismissGeneratorSpotlight(t.NudgeType.GeneratorNudgeStatus))}),yl.j41(3,"p",2)(4,"span",3),yl.EFF(5),yl.nI1(6,"i18n"),yl.k0s(),yl.j41(7,"span",4),yl.EFF(8),yl.nI1(9,"i18n"),yl.nrm(10,"i",5),yl.EFF(11),yl.nI1(12,"i18n"),yl.k0s()()()()}2&e&&(yl.R7$(),yl.Y8G("title",yl.bMT(2,4,"generatorNudgeTitle")),yl.R7$(4),yl.SpI(" ",yl.bMT(6,6,"generatorNudgeBodyAria")," "),yl.R7$(3),yl.SpI(" ",yl.bMT(9,8,"generatorNudgeBodyOne")," "),yl.R7$(3),yl.SpI(" ",yl.bMT(12,10,"generatorNudgeBodyTwo")," "))}class kB{constructor(e,t){this.nudgesService=e,this.accountService=t,this.NudgeType=VR,this.activeUserId$=this.accountService.activeAccount$.pipe(Gp),this.showGeneratorSpotlight$=this.activeUserId$.pipe((0,co.n)(e=>this.nudgesService.showNudgeSpotlight$(VR.GeneratorNudgeStatus,e)))}dismissGeneratorSpotlight(e){return wB(this,void 0,void 0,function*(){const t=yield(0,ho._)(this.activeUserId$);yield this.nudgesService.dismissNudge(e,t)})}}kB.ɵfac=function(e){return new(e||kB)(yl.rXU(jR),yl.rXU(Ok))},kB.ɵcmp=yl.VBU({type:kB,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&&(yl.nVh(0,SB,13,12,"div",0),yl.nI1(1,"async")),2&e&&yl.vxM(yl.bMT(1,1,t.showGeneratorSpotlight$)?0:-1)},dependencies:[qR,pl.MD,Xl,Wl,Hl,pl.Jj],encapsulation:2});var IB=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 CB(e,t){1&e&&(yl.j41(0,"bit-section-header")(1,"h6",9),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s()()),2&e&&(yl.R7$(2),yl.JRh(yl.bMT(3,1,"options")))}function TB(e,t){1&e&&(yl.j41(0,"p",8),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()),2&e&&(yl.R7$(),yl.JRh(yl.bMT(2,1,"generatorPolicyInEffect")))}const PB=Object.freeze({numWords:"numWords",includeNumber:"includeNumber",capitalize:"capitalize",wordSeparator:"wordSeparator"});class FB{constructor(e,t,i,n){this.formBuilder=e,this.generatorService=t,this.i18nService=i,this.logService=n,this.debug=!1,this.log=lB(),this.account=null,this.account$=new So.m(1),this.showHeader=!0,this.disableMargin=!1,this.onUpdated=new yl.bkB,this.settings=this.formBuilder.group({[PB.numWords]:[0],[PB.wordSeparator]:[""],[PB.capitalize]:[!1],[PB.includeNumber]:[!1]}),this.wordSeparatorMaxLength=0,this.saveSettings=new go.B,this.policyInEffect=!1,this.numWordsBoundariesHint=new So.m(1),this.numWordsBoundariesHint$=this.numWordsBoundariesHint.asObservable(),this.destroyed$=new go.B}ngOnChanges(e){return IB(this,void 0,void 0,function*(){"account"in e&&e.account&&this.account$.next(this.account)})}ngOnInit(){return IB(this,void 0,void 0,function*(){this.log=uB(this.debug,this.logService,{type:"PassphraseSettingsComponent"});const e=yield this.generatorService.settings(Eg.passphrase,{account$:this.account$});e.withConstraints$.pipe((0,Fo.M)(e=>this.log.debug(e,"passphrase settings loaded with constraints")),(0,Jv.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,jg.i)(1),(0,Fo.M)(e=>this.log.debug(e,"passphrase settings onUpdate event")),(0,Jv.Q)(this.destroyed$)).subscribe(this.onUpdated),this.generatorService.policy$(Eg.passphrase,{account$:this.account$}).pipe((0,Jv.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(PB.capitalize,!(null===(r=e.capitalize)||void 0===r?void 0:r.readonly)),this.toggleEnabled(PB.includeNumber,!(null===(s=e.includeNumber)||void 0===s?void 0:s.readonly))}),this.saveSettings.pipe((0,sm.E)(this.settings.valueChanges),(0,Fo.M)(([e,t])=>this.log.debug({source:e,form:t},"save passphrase settings request")),(0,l.T)(([,e])=>e),(0,Jv.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 RB(e,t){const i={id:e.id,type:e.type,name:xB(e.i18nKeys.name,t),generate:xB(e.i18nKeys.generateCredential,t),onGeneratedMessage:xB(e.i18nKeys.credentialGenerated,t),credentialType:xB(e.i18nKeys.credentialType,t),copy:xB(e.i18nKeys.copyCredential,t),useGeneratedValue:xB(e.i18nKeys.useCredential,t),onlyOnRequest:!e.capabilities.autogenerate,request:e.capabilities.fields};return e.i18nKeys.description&&(i.description=xB(e.i18nKeys.description,t)),i}function xB(e,t){return"string"==typeof e?t.t(e):e.literal}function AB(e,t){return(null!=e?e:0)<(null!=t?t:Number.POSITIVE_INFINITY)}FB.ɵfac=function(e){return new(e||FB)(yl.rXU(fl.ok),yl.rXU(sv),yl.rXU(Pl),yl.rXU(za))},FB.ɵcmp=yl.VBU({type:FB,selectors:[["tools-passphrase-settings"]],inputs:{debug:"debug",account:"account",showHeader:"showHeader",disableMargin:[2,"disableMargin","disableMargin",HR.he]},outputs:{onUpdated:"onUpdated"},features:[yl.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&&(yl.j41(0,"bit-section",0),yl.nVh(1,CB,4,3,"bit-section-header"),yl.j41(2,"form",1)(3,"div",2)(4,"bit-card")(5,"bit-form-field",3)(6,"bit-label"),yl.EFF(7),yl.nI1(8,"i18n"),yl.k0s(),yl.j41(9,"input",4),yl.bIt("change",function(){return t.save("numWords")}),yl.k0s(),yl.j41(10,"bit-hint"),yl.EFF(11),yl.nI1(12,"async"),yl.k0s()()()(),yl.j41(13,"div")(14,"bit-card")(15,"bit-form-field")(16,"bit-label"),yl.EFF(17),yl.nI1(18,"i18n"),yl.k0s(),yl.j41(19,"input",5),yl.bIt("change",function(){return t.save("wordSeparator")}),yl.k0s()(),yl.j41(20,"bit-form-control")(21,"input",6),yl.bIt("change",function(){return t.save("capitalize")}),yl.k0s(),yl.j41(22,"bit-label"),yl.EFF(23),yl.nI1(24,"i18n"),yl.k0s()(),yl.j41(25,"bit-form-control",0)(26,"input",7),yl.bIt("change",function(){return t.save("includeNumber")}),yl.k0s(),yl.j41(27,"bit-label"),yl.EFF(28),yl.nI1(29,"i18n"),yl.k0s()(),yl.nVh(30,TB,3,3,"p",8),yl.k0s()()()()),2&e&&(yl.Y8G("disableMargin",t.disableMargin),yl.R7$(),yl.vxM(t.showHeader?1:-1),yl.R7$(),yl.Y8G("formGroup",t.settings),yl.R7$(5),yl.JRh(yl.bMT(8,11,"numWords")),yl.R7$(4),yl.JRh(yl.bMT(12,13,t.numWordsBoundariesHint$)),yl.R7$(6),yl.JRh(yl.bMT(18,15,"wordSeparator")),yl.R7$(2),yl.Y8G("maxlength",t.wordSeparatorMaxLength),yl.R7$(4),yl.JRh(yl.bMT(24,17,"capitalize")),yl.R7$(2),yl.Y8G("disableMargin",!t.policyInEffect),yl.R7$(3),yl.JRh(yl.bMT(29,19,"includeNumber")),yl.R7$(2),yl.vxM(t.policyInEffect?30:-1))},dependencies:[ZR,ex,Xl,Wl,fl.X1,fl.qT,fl.me,fl.Q0,fl.Zm,fl.BC,fl.cb,fl.tU,fl.j4,fl.JD,WR,Eu,hc,Sc,nu,ou,Du,id,Ub,qf,pl.Jj,Hl],encapsulation:2});var DB=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 EB(e,t){1&e&&(yl.j41(0,"bit-section-header")(1,"h2",20),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s()()),2&e&&(yl.R7$(2),yl.JRh(yl.bMT(3,1,"options")))}function $B(e,t){1&e&&(yl.j41(0,"p",19),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()),2&e&&(yl.R7$(),yl.JRh(yl.bMT(2,1,"generatorPolicyInEffect")))}const OB=Object.freeze({length:"length",uppercase:"uppercase",lowercase:"lowercase",number:"number",special:"special",minNumber:"minNumber",minSpecial:"minSpecial",avoidAmbiguous:"avoidAmbiguous"});class UB{constructor(e,t,i){this.formBuilder=e,this.generatorService=t,this.i18nService=i,this.account=null,this.account$=new So.m(1),this.showHeader=!0,this.waitMs=100,this.disableMargin=!1,this.onUpdated=new yl.bkB,this.settings=this.formBuilder.group({[OB.length]:[0],[OB.uppercase]:[!1],[OB.lowercase]:[!1],[OB.number]:[!1],[OB.special]:[!1],[OB.minNumber]:[0],[OB.minSpecial]:[0],[OB.avoidAmbiguous]:[!1]}),this.saveSettings=new go.B,this.policyInEffect=!1,this.lengthBoundariesHint=new So.m(1),this.lengthBoundariesHint$=this.lengthBoundariesHint.asObservable(),this.destroyed$=new go.B}ngOnChanges(e){return DB(this,void 0,void 0,function*(){"account"in e&&e.account&&this.account$.next(this.account)})}get numbers(){return this.settings.get(OB.number)}get special(){return this.settings.get(OB.special)}get minNumber(){return this.settings.get(OB.minNumber)}get minSpecial(){return this.settings.get(OB.minSpecial)}ngOnInit(){return DB(this,void 0,void 0,function*(){const e=yield this.generatorService.settings(Eg.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,Jv.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$(Eg.password,{account$:this.account$}).pipe((0,Jv.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=[[OB.length,AB(null===(i=e.length)||void 0===i?void 0:i.min,null===(n=e.length)||void 0===n?void 0:n.max)],[OB.uppercase,!(null===(r=e.uppercase)||void 0===r?void 0:r.readonly)],[OB.lowercase,!(null===(s=e.lowercase)||void 0===s?void 0:s.readonly)],[OB.number,!(null===(o=e.number)||void 0===o?void 0:o.readonly)],[OB.special,!(null===(a=e.special)||void 0===a?void 0:a.readonly)],[OB.minNumber,AB(null===(l=e.minNumber)||void 0===l?void 0:l.min,null===(c=e.minNumber)||void 0===c?void 0:c.max)],[OB.minSpecial,AB(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,To.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,Jv.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,Fo.M)(([e,i])=>t=i&&e?e:t),(0,Jv.Q)(this.destroyed$)).subscribe(([,e])=>this.numbers.setValue(e,{emitEvent:!1}));let i=1;this.special.valueChanges.pipe((0,To.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,Jv.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,Fo.M)(([e,t])=>i=t&&e?e:i),(0,Jv.Q)(this.destroyed$)).subscribe(([,e])=>this.special.setValue(e,{emitEvent:!1})),e.pipe((0,jg.i)(1),(0,Jv.Q)(this.destroyed$)).subscribe(this.onUpdated),this.saveSettings.pipe((0,sm.E)(this.settings.valueChanges),(0,l.T)(([,e])=>{const t=Object.assign({},e);return t.ambiguous=!t.avoidAmbiguous,delete t.avoidAmbiguous,t}),(0,Jv.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()}}UB.ɵfac=function(e){return new(e||UB)(yl.rXU(fl.ok),yl.rXU(sv),yl.rXU(Pl))},UB.ɵcmp=yl.VBU({type:UB,selectors:[["tools-password-settings"]],inputs:{account:"account",showHeader:"showHeader",waitMs:"waitMs",disableMargin:[2,"disableMargin","disableMargin",HR.he]},outputs:{onUpdated:"onUpdated"},features:[yl.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&&(yl.j41(0,"bit-section",0),yl.nVh(1,EB,4,3,"bit-section-header"),yl.j41(2,"form",1)(3,"div",2)(4,"bit-card")(5,"bit-form-field",3)(6,"bit-label"),yl.EFF(7),yl.nI1(8,"i18n"),yl.k0s(),yl.j41(9,"input",4),yl.bIt("change",function(){return t.save("length")}),yl.k0s(),yl.j41(10,"bit-hint"),yl.EFF(11),yl.nI1(12,"async"),yl.k0s()()()(),yl.j41(13,"div")(14,"bit-card")(15,"div",2),yl.EFF(16),yl.nI1(17,"i18n"),yl.k0s(),yl.j41(18,"div",5)(19,"bit-form-control",6),yl.nI1(20,"i18n"),yl.nI1(21,"i18n"),yl.j41(22,"input",7),yl.bIt("change",function(){return t.save("uppercase")}),yl.k0s(),yl.j41(23,"bit-label"),yl.EFF(24),yl.nI1(25,"i18n"),yl.k0s()(),yl.j41(26,"bit-form-control",6),yl.nI1(27,"i18n"),yl.nI1(28,"i18n"),yl.j41(29,"input",8),yl.bIt("change",function(){return t.save("lowercase")}),yl.k0s(),yl.j41(30,"bit-label"),yl.EFF(31),yl.nI1(32,"i18n"),yl.k0s()(),yl.j41(33,"bit-form-control",6),yl.nI1(34,"i18n"),yl.nI1(35,"i18n"),yl.j41(36,"input",9),yl.bIt("change",function(){return t.save("number")}),yl.k0s(),yl.j41(37,"bit-label"),yl.EFF(38),yl.nI1(39,"i18n"),yl.k0s()(),yl.j41(40,"bit-form-control",6),yl.nI1(41,"i18n"),yl.j41(42,"input",10),yl.bIt("change",function(){return t.save("special")}),yl.k0s(),yl.j41(43,"bit-label")(44,"span",11),yl.EFF(45),yl.k0s(),yl.j41(46,"span",12),yl.EFF(47),yl.nI1(48,"i18n"),yl.k0s()()()(),yl.j41(49,"div",13)(50,"bit-form-field",14)(51,"bit-label"),yl.EFF(52),yl.nI1(53,"i18n"),yl.k0s(),yl.j41(54,"input",15),yl.bIt("change",function(){return t.save("minNumbers")}),yl.k0s()(),yl.j41(55,"bit-form-field",16)(56,"bit-label"),yl.EFF(57),yl.nI1(58,"i18n"),yl.k0s(),yl.j41(59,"input",17),yl.bIt("change",function(){return t.save("minSpecial")}),yl.k0s()()(),yl.j41(60,"bit-form-control",0)(61,"input",18),yl.bIt("change",function(){return t.save("avoidAmbiguous")}),yl.k0s(),yl.j41(62,"bit-label"),yl.EFF(63),yl.nI1(64,"i18n"),yl.k0s()(),yl.nVh(65,$B,3,3,"p",19),yl.k0s()()()()),2&e&&(yl.Y8G("disableMargin",t.disableMargin),yl.R7$(),yl.vxM(t.showHeader?1:-1),yl.R7$(),yl.Y8G("formGroup",t.settings),yl.R7$(5),yl.JRh(yl.bMT(8,27,"length")),yl.R7$(4),yl.JRh(yl.bMT(12,29,t.lengthBoundariesHint$)),yl.R7$(5),yl.JRh(yl.bMT(17,31,"include")),yl.R7$(3),yl.Y8G("title",yl.mNQ(yl.bMT(20,33,"uppercaseDescription"))),yl.BMQ("aria-description",yl.bMT(21,35,"uppercaseDescription")),yl.R7$(5),yl.JRh(yl.bMT(25,37,"uppercaseLabel")),yl.R7$(2),yl.Y8G("title",yl.mNQ(yl.bMT(27,39,"lowercaseDescription"))),yl.BMQ("aria-description",yl.bMT(28,41,"lowercaseDescription")),yl.R7$(5),yl.JRh(yl.bMT(32,43,"lowercaseLabel")),yl.R7$(2),yl.Y8G("title",yl.mNQ(yl.bMT(34,45,"numbersDescription"))),yl.BMQ("aria-description",yl.bMT(35,47,"numbersDescription")),yl.R7$(5),yl.JRh(yl.bMT(39,49,"numbersLabel")),yl.R7$(2),yl.Y8G("title",yl.mNQ(yl.bMT(41,51,"specialCharactersDescription"))),yl.R7$(5),yl.JRh("!@#$%^&*"),yl.R7$(2),yl.SpI(" ",yl.bMT(48,53,"specialCharactersDescription")," "),yl.R7$(5),yl.JRh(yl.bMT(53,55,"minNumbers")),yl.R7$(5),yl.JRh(yl.bMT(58,57,"minSpecial")),yl.R7$(3),yl.Y8G("disableMargin",!t.policyInEffect),yl.R7$(3),yl.JRh(yl.bMT(64,59,"avoidAmbiguous")),yl.R7$(2),yl.vxM(t.policyInEffect?65:-1))},dependencies:[ZR,ex,Xl,Wl,fl.X1,fl.qT,fl.me,fl.Q0,fl.Zm,fl.BC,fl.cb,fl.j4,fl.JD,WR,Eu,hc,Sc,nu,ou,Du,id,Ub,qf,pl.Jj,Hl],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())})};class NB{constructor(e,t){this.formBuilder=e,this.generatorService=t,this.account=null,this.account$=new So.m(1),this.onUpdated=new yl.bkB,this.settings=this.formBuilder.group({subaddressEmail:[""]}),this.saveSettings=new go.B,this.destroyed$=new go.B}ngOnChanges(e){return MB(this,void 0,void 0,function*(){"account"in e&&e.account&&this.account$.next(this.account)})}ngOnInit(){return MB(this,void 0,void 0,function*(){const e=yield this.generatorService.settings(Eg.plusAddress,{account$:this.account$});e.pipe((0,Jv.Q)(this.destroyed$)).subscribe(e=>{this.settings.patchValue(e,{emitEvent:!1})}),e.pipe((0,jg.i)(1),(0,Jv.Q)(this.destroyed$)).subscribe(this.onUpdated),this.saveSettings.pipe((0,sm.E)(this.settings.valueChanges),(0,l.T)(([,e])=>e),(0,Jv.Q)(this.destroyed$)).subscribe(e)})}save(e="component api call"){this.saveSettings.next(e)}ngOnDestroy(){this.destroyed$.next(),this.destroyed$.complete()}}NB.ɵfac=function(e){return new(e||NB)(yl.rXU(fl.ok),yl.rXU(sv))},NB.ɵcmp=yl.VBU({type:NB,selectors:[["tools-subaddress-settings"]],inputs:{account:"account"},outputs:{onUpdated:"onUpdated"},features:[yl.OA$],decls:6,vars:4,consts:[[1,"tw-container",3,"formGroup"],["bitInput","","formControlName","subaddressEmail","type","text",3,"change"]],template:function(e,t){1&e&&(yl.j41(0,"form",0)(1,"bit-form-field")(2,"bit-label"),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s(),yl.j41(5,"input",1),yl.bIt("change",function(){return t.save("subaddressEmail")}),yl.k0s()()()),2&e&&(yl.Y8G("formGroup",t.settings),yl.R7$(3),yl.JRh(yl.bMT(4,2,"email")))},dependencies:[fl.X1,fl.qT,fl.me,fl.BC,fl.cb,fl.j4,fl.JD,Eu,Sc,ou,Du,qf,Hl],encapsulation:2});var VB=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 BB{constructor(e,t){this.formBuilder=e,this.generatorService=t,this.account=null,this.account$=new So.m(1),this.onUpdated=new yl.bkB,this.settings=this.formBuilder.group({wordCapitalize:[!1],wordIncludeNumber:[!1]}),this.saveSettings=new go.B,this.destroyed$=new go.B}ngOnChanges(e){return VB(this,void 0,void 0,function*(){"account"in e&&this.account$.next(this.account)})}ngOnInit(){return VB(this,void 0,void 0,function*(){const e=yield this.generatorService.settings(Eg.effWordList,{account$:this.account$});e.pipe((0,Jv.Q)(this.destroyed$)).subscribe(e=>{this.settings.patchValue(e,{emitEvent:!1})}),e.pipe((0,jg.i)(1),(0,Jv.Q)(this.destroyed$)).subscribe(this.onUpdated),this.saveSettings.pipe((0,sm.E)(this.settings.valueChanges),(0,l.T)(([,e])=>e),(0,Jv.Q)(this.destroyed$)).subscribe(e)})}save(e="component api call"){this.saveSettings.next(e)}ngOnDestroy(){this.destroyed$.next(),this.destroyed$.complete()}}BB.ɵfac=function(e){return new(e||BB)(yl.rXU(fl.ok),yl.rXU(sv))},BB.ɵcmp=yl.VBU({type:BB,selectors:[["tools-username-settings"]],inputs:{account:"account"},outputs:{onUpdated:"onUpdated"},features:[yl.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&&(yl.j41(0,"form",0)(1,"bit-form-control")(2,"input",1),yl.bIt("change",function(){return t.save("wordCapitalize")}),yl.k0s(),yl.j41(3,"bit-label"),yl.EFF(4),yl.nI1(5,"i18n"),yl.k0s()(),yl.j41(6,"bit-form-control")(7,"input",2),yl.bIt("change",function(){return t.save("wordIncludeNumber")}),yl.k0s(),yl.j41(8,"bit-label"),yl.EFF(9),yl.nI1(10,"i18n"),yl.k0s()()()),2&e&&(yl.Y8G("formGroup",t.settings),yl.R7$(4),yl.JRh(yl.bMT(5,3,"capitalize")),yl.R7$(5),yl.JRh(yl.bMT(10,5,"includeNumber")))},dependencies:[fl.X1,fl.qT,fl.Zm,fl.BC,fl.cb,fl.j4,fl.JD,Eu,hc,Sc,id,Ub,qf,Hl],encapsulation:2});let jB=0;class GB{constructor(){this.id=jB++,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,bl.EW)(()=>["tw-flex"].concat(this.fullWidth()?["tw-w-full","[&>*]:tw-flex-1"]:[]))}onInputInteraction(e){this.selected.set(e)}}GB.ɵfac=function(e){return new(e||GB)},GB.ɵcmp=yl.VBU({type:GB,selectors:[["bit-toggle-group"]],hostAttrs:["role","radiogroup"],hostVars:2,hostBindings:function(e,t){2&e&&yl.HbH(t.classlist())},inputs:{fullWidth:[1,"fullWidth"],selected:[1,"selected"]},outputs:{selected:"selectedChange"},ngContentSelectors:["*"],decls:1,vars:0,template:function(e,t){1&e&&(yl.NAR(),yl.SdG(0))},encapsulation:2,changeDetection:0});const LB=["labelContent"],zB=["*",[["","bitBadge",""]]];let _B=0;class KB{constructor(){this.id="bit-toggle-"+_B++,this.groupComponent=(0,a.WQX)(GB),this.value=o.hFB.required(),this.labelContent=(0,o.ebz)("labelContent"),this.badgeElement=(0,o.sbv)(_c),this.hasBadge=(0,bl.EW)(()=>!!this.badgeElement()),this.labelTitle=(0,a.vPA)(null),this.name=this.groupComponent.name,this.selected=(0,bl.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,yl.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())}}KB.ɵfac=function(e){return new(e||KB)},KB.ɵcmp=yl.VBU({type:KB,selectors:[["bit-toggle"]],contentQueries:function(e,t,i){1&e&&yl.C6U(i,t.badgeElement,_c,5),2&e&&yl.NyB()},viewQuery:function(e,t){1&e&&yl.wEZ(t.labelContent,LB,5),2&e&&yl.NyB()},hostAttrs:["tabindex","-1"],hostVars:2,hostBindings:function(e,t){2&e&&yl.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=yl.RV6();yl.NAR(zB),yl.rj2(0,"input",1),yl.VwU("change",function(){return a.eBV(e),a.Njj(t.handleInputChange())}),yl.eux(),yl.rj2(1,"label",2)(2,"span",3,0),yl.SdG(4),yl.eux(),yl.rj2(5,"span",4),yl.SdG(6,1),yl.eux()()}2&e&&(yl.HbH(t.inputClasses),yl.Avn("id",t.id)("name",t.name)("checked",t.selected()),yl.R7$(),yl.HbH(t.labelClasses),yl.Avn("htmlFor",t.id)("title",t.labelTitle()),yl.R7$(4),yl.Avn("hidden",!t.hasBadge()))},encapsulation:2,changeDetection:0});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 qB(e,t){if(1&e&&(yl.j41(0,"bit-toggle",1),yl.EFF(1),yl.k0s()),2&e){const e=t.$implicit;yl.Y8G("value",e.value),yl.R7$(),yl.SpI(" ",e.label," ")}}function YB(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"tools-password-settings",9),yl.bIt("onUpdated",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.generate("password settings"))}),yl.k0s()}if(2&e){yl.XpG();const e=yl.r8f(24);yl.Y8G("account",e)}}function WB(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"tools-passphrase-settings",9),yl.bIt("onUpdated",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.generate("passphrase settings"))}),yl.k0s()}if(2&e){yl.XpG();const e=yl.r8f(24);yl.Y8G("account",e)}}function HB(e,t){if(1&e&&(yl.j41(0,"bit-hint"),yl.EFF(1),yl.nI1(2,"async"),yl.k0s()),2&e){const e=yl.XpG(2);yl.R7$(),yl.JRh(yl.bMT(2,1,e.credentialTypeHint$))}}function JB(e,t){if(1&e&&(yl.j41(0,"form",12)(1,"bit-form-field")(2,"bit-label"),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s(),yl.nrm(5,"bit-select",16),yl.nI1(6,"async"),yl.k0s()()),2&e){const e=yl.XpG(2);yl.Y8G("formGroup",e.forwarder),yl.R7$(3),yl.JRh(yl.bMT(4,3,"service")),yl.R7$(2),yl.Y8G("items",yl.bMT(6,5,e.forwarderOptions$))}}function ZB(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"tools-catchall-settings",17),yl.bIt("onUpdated",function(){a.eBV(e);const t=yl.XpG(2);return a.Njj(t.generate("catchall settings"))}),yl.k0s()}if(2&e){yl.XpG(2);const e=yl.r8f(24);yl.Y8G("account",e)}}function QB(e,t){if(1&e&&yl.nrm(0,"tools-forwarder-settings",15),2&e){yl.XpG(2);const e=yl.r8f(24);yl.Y8G("account",e)("forwarder",t)}}function ej(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"tools-subaddress-settings",17),yl.bIt("onUpdated",function(){a.eBV(e);const t=yl.XpG(2);return a.Njj(t.generate("subaddress settings"))}),yl.k0s()}if(2&e){yl.XpG(2);const e=yl.r8f(24);yl.Y8G("account",e)}}function tj(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"tools-username-settings",17),yl.bIt("onUpdated",function(){a.eBV(e);const t=yl.XpG(2);return a.Njj(t.generate("username settings"))}),yl.k0s()}if(2&e){yl.XpG(2);const e=yl.r8f(24);yl.Y8G("account",e)}}function ij(e,t){if(1&e&&(yl.j41(0,"bit-section")(1,"bit-section-header")(2,"h2",10),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s()(),yl.j41(5,"div",11)(6,"bit-card")(7,"form",12)(8,"bit-form-field")(9,"bit-label"),yl.EFF(10),yl.nI1(11,"i18n"),yl.k0s(),yl.nrm(12,"bit-select",13),yl.nI1(13,"async"),yl.nVh(14,HB,3,3,"bit-hint"),yl.nI1(15,"async"),yl.k0s()(),yl.nVh(16,JB,7,7,"form",12),yl.nI1(17,"async"),yl.nVh(18,ZB,1,1,"tools-catchall-settings",14),yl.nVh(19,QB,1,2,"tools-forwarder-settings",15),yl.nI1(20,"async"),yl.nVh(21,ej,1,1,"tools-subaddress-settings",14),yl.nVh(22,tj,1,1,"tools-username-settings",14),yl.k0s()()()),2&e){let e;const t=yl.XpG(),i=yl.r8f(22);yl.R7$(3),yl.JRh(yl.bMT(4,10,"options")),yl.R7$(4),yl.Y8G("formGroup",t.username),yl.R7$(3),yl.JRh(yl.bMT(11,12,"type")),yl.R7$(2),yl.Y8G("items",yl.bMT(13,14,t.usernameOptions$)),yl.R7$(2),yl.vxM(yl.bMT(15,16,t.credentialTypeHint$)?14:-1),yl.R7$(2),yl.vxM(yl.bMT(17,18,t.showForwarder$)?16:-1),yl.R7$(2),yl.vxM((null==i?null:i.id)===t.Algorithm.catchall?18:-1),yl.R7$(),yl.vxM((e=yl.bMT(20,20,t.forwarderId$))?19:-1,e),yl.R7$(2),yl.vxM((null==i?null:i.id)===t.Algorithm.plusAddress?21:-1),yl.R7$(),yl.vxM((null==i?null:i.id)===t.Algorithm.username?22:-1)}}const nj="identifier",rj="forwarder",sj="none";class oj{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 go.B,this.Algorithm=ym,this.account=null,this.debug=!1,this.log=lB(),this.account$=new So.m(1),this.website=null,this.onGenerated=new yl.bkB,this.root$=new fd.t({nav:null}),this.username=this.formBuilder.group({nav:[null]}),this.forwarder=this.formBuilder.group({nav:[null]}),this.rootOptions$=new fd.t([]),this.usernameOptions$=new fd.t([]),this.forwarderOptions$=new fd.t([]),this.forwarderId$=new fd.t(null),this.showForwarder$=new fd.t(!1),this.maybeAlgorithm$=new So.m(1),this.algorithm$=this.maybeAlgorithm$.pipe((0,To.p)(e=>!!e)),this.showAlgorithm$=this.maybeAlgorithm$.pipe((0,Op.v)(this.showForwarder$),(0,l.T)(([e,t])=>t?null:e)),this.credentialTypeCopyLabel$=this.algorithm$.pipe((0,l.T)(({i18nKeys:{copyCredential:e}})=>xB(e,this.i18nService))),this.credentialTypeGenerateLabel$=this.algorithm$.pipe((0,l.T)(({i18nKeys:{generateCredential:e}})=>xB(e,this.i18nService))),this.credentialTypeLabel$=this.algorithm$.pipe((0,l.T)(({i18nKeys:{credentialType:e}})=>xB(e,this.i18nService))),this.credentialTypeHint$=new So.m(1),this.category$=new So.m(1),this.generatedCredential$=new fd.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 go.B}ngOnChanges(e){return XB(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 XB(this,void 0,void 0,function*(){if(this.log=uB(this.debug,this.logService,{type:"CredentialGeneratorComponent"}),!this.account){const e=yield(0,ho._)(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,$o.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:rj,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:sj,label:this.i18nService.t("select")}),[i,r]}),(0,Fo.M)(e=>this.log.debug({algorithms:e},"algorithms loaded")),(0,Jv.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:nj,label:this.i18nService.t("username")}),t}),(0,Jv.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)?xB(e.i18nKeys.description,this.i18nService):""}),(0,Jv.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,lo.F)(),(0,Jv.Q)(this.destroyed)).subscribe(e=>{this.zone.run(()=>{this.category$.next(e)})}),this.generatorService.generate$({on$:this.generate$,account$:this.account$}).pipe((0,vd.W)((e,t)=>("string"==typeof e?this.toastService.showToast({message:e,variant:"error",title:""}):this.logService.error(e),t)),(0,sm.E)(this.account$,this.maybeAlgorithm$),(0,Jv.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(xB(i.i18nKeys.credentialGenerated,this.i18nService)),this.generatedCredential$.next(e),this.onGenerated.next(e)})});const e=new go.B,t=new go.B,i=new go.B;this.root$.pipe((0,l.T)(e=>e.nav===nj?{nav:e.nav}:e.nav?{nav:e.nav,algorithm:JSON.parse(e.nav)}:{nav:nj}),(0,Jv.Q)(this.destroyed)).subscribe(e),this.username.valueChanges.pipe((0,l.T)(e=>{if(e.nav===rj)return{nav:e.nav};if(e.nav)return{nav:e.nav,algorithm:JSON.parse(e.nav)};{const[e]=$g[bm.username];return{nav:JSON.stringify(e),algorithm:e}}}),(0,Jv.Q)(this.destroyed)).subscribe(t),this.forwarder.valueChanges.pipe((0,l.T)(e=>e.nav===sj?{nav:e.nav}:e.nav?{nav:e.nav,algorithm:JSON.parse(e.nav)}:{nav:sj}),(0,Jv.Q)(this.destroyed)).subscribe(i),(0,$o.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,lo.F)((e,t)=>e[0]===t[0]&&e[1]===t[1]),(0,Jv.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,$o.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,lo.F)((e,t)=>null!==e&&null!==t&&Dg(e.id,t.id)),(0,Jv.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,sm.E)(n),(0,Jv.Q)(this.destroyed)).subscribe(([e,t])=>{function i(i){const n=t[i];n.algorithm=e.id,n.updated=new Date}if(Ag(e.id))i("email");else if(Rg(e.id))i("username");else{if(!Fg(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):sj,o=r?rj:JSON.stringify(n.algorithm),a=n.updated>i.updated?nj:JSON.stringify(i.algorithm);return{root:{selection:{nav:a},active:{nav:a,algorithm:a===nj?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,Jv.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,Jv.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 XB(this,void 0,void 0,function*(){const t=yield(0,ho._)(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:xB(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")}}oj.ɵfac=function(e){return new(e||oj)(yl.rXU(sv),yl.rXU(xy),yl.rXU(xb),yl.rXU(za),yl.rXU(Pl),yl.rXU(Ok),yl.rXU(yl.SKi),yl.rXU(fl.ok),yl.rXU(ll.Ai))},oj.ɵcmp=yl.VBU({type:oj,selectors:[["tools-credential-generator"]],inputs:{account:"account",debug:"debug",website:"website"},outputs:{onGenerated:"onGenerated"},features:[yl.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=yl.RV6();yl.j41(0,"bit-toggle-group",0),yl.nI1(1,"async"),yl.nI1(2,"i18n"),yl.bIt("selectedChange",function(i){return a.eBV(e),a.Njj(t.onRootChanged({nav:i}))}),yl.Z7z(3,qB,2,2,"bit-toggle",1,yl.fX1),yl.nI1(5,"async"),yl.k0s(),yl.nrm(6,"nudge-generator-spotlight"),yl.j41(7,"bit-card",2)(8,"div",3),yl.nrm(9,"bit-color-password",4),yl.nI1(10,"async"),yl.k0s(),yl.j41(11,"div",5)(12,"button",6),yl.nI1(13,"async"),yl.nI1(14,"async"),yl.bIt("click",function(){return a.eBV(e),a.Njj(t.generate(t.USER_REQUEST))}),yl.EFF(15),yl.nI1(16,"async"),yl.k0s(),yl.nrm(17,"button",7),yl.nI1(18,"async"),yl.nI1(19,"async"),yl.nI1(20,"async"),yl.nI1(21,"async"),yl.k0s()(),yl.SS7(22),yl.nI1(23,"async"),yl.SS7(24),yl.nI1(25,"async"),yl.nVh(26,YB,1,1,"tools-password-settings",8)(27,WB,1,1,"tools-passphrase-settings",8),yl.nVh(28,ij,23,22,"bit-section"),yl.nI1(29,"async")}if(2&e){let e;yl.Y8G("selected",yl.bMT(1,12,t.root$).nav),yl.BMQ("aria-label",yl.bMT(2,14,"type")),yl.R7$(3),yl.Dyx(yl.bMT(5,16,t.rootOptions$)),yl.R7$(6),yl.Y8G("password",yl.bMT(10,18,t.value$)),yl.R7$(3),yl.Y8G("label",yl.bMT(13,20,t.credentialTypeGenerateLabel$))("disabled",!yl.bMT(14,22,t.algorithm$)),yl.R7$(3),yl.SpI(" ",yl.bMT(16,24,t.credentialTypeGenerateLabel$)," "),yl.R7$(2),yl.Y8G("label",yl.bMT(18,26,t.credentialTypeCopyLabel$))("appCopyClick",yl.bMT(19,28,t.value$))("valueLabel",yl.bMT(20,30,t.credentialTypeLabel$))("disabled",!yl.bMT(21,32,t.algorithm$)),yl.R7$(5);const i=yl.bH3(yl.bMT(23,34,t.showAlgorithm$));yl.R7$(2),yl.bH3(yl.bMT(25,37,t.account$)),yl.R7$(2),yl.vxM((e=null==i?null:i.id)===t.Algorithm.password?26:e===t.Algorithm.passphrase?27:-1),yl.R7$(2),yl.vxM("password"!==yl.bMT(29,40,t.category$)?28:-1)}},dependencies:[dB,GB,KB,kB,WR,dO,zl,g$,UB,FB,ZR,ex,Xl,Wl,fl.X1,fl.qT,fl.BC,fl.cb,fl.j4,fl.JD,Eu,Sc,nu,Du,Bu,Vu,pB,bB,NB,BB,qf,pl.Jj,Hl],encapsulation:2});var aj=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 lj(e,t){if(1&e&&(yl.j41(0,"bit-item")(1,"bit-item-content"),yl.nrm(2,"bit-color-password",0),yl.j41(3,"div",1),yl.EFF(4),yl.nI1(5,"date"),yl.k0s()(),yl.qex(6,2),yl.j41(7,"bit-item-action")(8,"button",3),yl.EFF(9),yl.k0s()(),yl.bVm(),yl.k0s()),2&e){const e=t.$implicit,i=yl.XpG();yl.R7$(2),yl.Y8G("password",e.credential),yl.R7$(2),yl.SpI(" ",yl.i5U(5,6,e.generationDate,"medium")," "),yl.R7$(4),yl.Y8G("appCopyClick",e.credential)("valueLabel",i.getGeneratedValueText(e))("label",i.getCopyText(e)),yl.R7$(),yl.SpI(" ",i.getCopyText(e)," ")}}class cj{constructor(e,t,i,n){this.generatorService=e,this.history=t,this.i18nService=i,this.logService=n,this.destroyed=new go.B,this.credentials$=new fd.t([]),this.account$=new So.m(1),this.debug=!1,this.log=lB()}ngOnChanges(e){return aj(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=uB(this.debug,this.logService,{type:"CredentialGeneratorComponent"}),this.account$.pipe((0,Fo.M)(e=>this.log.info({accountId:e.id},"loading credential history")),(0,co.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,Jv.Q)(this.destroyed)).subscribe(this.credentials$)}getCopyText(e){const[t]=$g[e.category];return xB(this.generatorService.algorithm(t).i18nKeys.copyCredential,this.i18nService)}getGeneratedValueText(e){const[t]=$g[e.category];return xB(this.generatorService.algorithm(t).i18nKeys.credentialType,this.i18nService)}ngOnDestroy(){this.destroyed.next(),this.destroyed.complete(),this.log.debug("component destroyed")}}cj.ɵfac=function(e){return new(e||cj)(yl.rXU(sv),yl.rXU(xy),yl.rXU(Pl),yl.rXU(za))},cj.ɵcmp=yl.VBU({type:cj,selectors:[["bit-credential-generator-history"]],inputs:{account:"account",debug:"debug"},features:[yl.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&&(yl.Z7z(0,lj,10,9,"bit-item",null,yl.fX1),yl.nI1(2,"async")),2&e&&yl.Dyx(yl.bMT(2,0,t.credentials$))},dependencies:[pl.MD,sO,dO,_l,zl,Eh,qf,g$,wP,IP,FP,SP,pl.Jj,pl.vh],encapsulation:2});const uj=lw` `,dj=lw` `,hj=[[["","slot","title"]],[["","slot","description"]],[["","slot","button"]]];class pj{constructor(){this.icon=(0,o.hFB)(dj)}}pj.ɵfac=function(e){return new(e||pj)},pj.ɵcmp=yl.VBU({type:pj,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,"icon"],[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&&(yl.NAR(hj),yl.j41(0,"div",0)(1,"div",1)(2,"div",2),yl.nrm(3,"bit-icon",3),yl.k0s(),yl.j41(4,"h3",4),yl.SdG(5),yl.k0s(),yl.j41(6,"p",5),yl.SdG(7,1),yl.k0s()(),yl.j41(8,"div",6),yl.SdG(9,2),yl.k0s()()),2&e&&(yl.R7$(3),yl.Y8G("icon",t.icon()))},dependencies:[SC],encapsulation:2});class fj{constructor(){this.noCredentialsIcon=uj}}fj.ɵfac=function(e){return new(e||fj)},fj.ɵcmp=yl.VBU({type:fj,selectors:[["bit-empty-credential-history"]],decls:7,vars:7,consts:[[3,"icon"],["slot","title"],["slot","description"]],template:function(e,t){1&e&&(yl.j41(0,"bit-no-items",0),yl.qex(1,1),yl.EFF(2),yl.nI1(3,"i18n"),yl.bVm(),yl.qex(4,2),yl.EFF(5),yl.nI1(6,"i18n"),yl.bVm(),yl.k0s()),2&e&&(yl.Y8G("icon",t.noCredentialsIcon),yl.R7$(2),yl.JRh(yl.bMT(3,3,"nothingToShow")),yl.R7$(3),yl.JRh(yl.bMT(6,5,"nothingGeneratedRecently")))},dependencies:[qf,Eh,pj,Xf],encapsulation:2});var vj=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 mj(e,t){if(1&e&&(yl.nrm(0,"bit-credential-generator-history",4),yl.nI1(1,"async")),2&e){const e=yl.XpG();yl.Y8G("account",yl.bMT(1,1,e.account$))}}function gj(e,t){1&e&&yl.nrm(0,"bit-empty-credential-history",5)}class yj{constructor(e,t,i,n){this.accountService=e,this.history=t,this.dialogService=i,this.logService=n,this.destroyed=new go.B,this.hasHistory$=new fd.t(!1),this.account$=new So.m(1),this.debug=!1,this.log=lB()}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 vj(this,void 0,void 0,function*(){this.log=uB(this.debug,this.logService,{type:"CredentialGeneratorComponent"}),this.account||(this.account=yield(0,ho._)(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,co.n)(e=>e.id&&this.history.credentials$(e.id)),(0,l.T)(e=>e.length>0),(0,Jv.Q)(this.destroyed)).subscribe(this.hasHistory$)})}clear(){return vj(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,ho._)(this.account$)).id))})}ngOnDestroy(){this.destroyed.next(),this.destroyed.complete(),this.log.debug("component destroyed")}}yj.ɵfac=function(e){return new(e||yj)(yl.rXU(Ok),yl.rXU(xy),yl.rXU(Jd),yl.rXU(za))},yj.ɵcmp=yl.VBU({type:yj,selectors:[["ng-component"]],inputs:{account:"account",debug:"debug"},features:[yl.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=yl.RV6();yl.j41(0,"bit-dialog",1,0)(2,"span",2),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s(),yl.qex(5,3),yl.nVh(6,mj,2,3,"bit-credential-generator-history",4),yl.nI1(7,"async"),yl.vZN(8,gj,1,0,"bit-empty-credential-history",5),yl.bVm(),yl.qex(9,6),yl.j41(10,"button",7),yl.nI1(11,"async"),yl.bIt("click",function(){return a.eBV(e),a.Njj(t.clear())}),yl.EFF(12),yl.nI1(13,"i18n"),yl.k0s(),yl.bVm(),yl.k0s()}2&e&&(yl.R7$(3),yl.JRh(yl.bMT(4,4,"generatorHistory")),yl.R7$(3),yl.vxM(yl.bMT(7,6,t.hasHistory$)?6:8),yl.R7$(4),yl.Y8G("disabled",!yl.bMT(11,8,t.hasHistory$)),yl.R7$(2),yl.SpI(" ",yl.bMT(13,10,"clearHistory")," "))},dependencies:[Xu,Ku,pl.MD,qf,dh,uh,cj,fj,pl.Jj,Xf],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){if(1&e&&(yl.j41(0,"bit-toggle",9),yl.EFF(1),yl.k0s()),2&e){const e=t.$implicit;yl.Y8G("value",e.value),yl.R7$(),yl.SpI(" ",e.label," ")}}function Sj(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"bit-toggle-group",8),yl.nI1(1,"async"),yl.nI1(2,"i18n"),yl.bIt("selectedChange",function(t){a.eBV(e);const i=yl.XpG();return a.Njj(i.onCredentialTypeChanged(t))}),yl.Z7z(3,wj,2,2,"bit-toggle",9,yl.fX1),yl.nI1(5,"async"),yl.k0s()}if(2&e){const e=yl.XpG();yl.Y8G("selected",yl.bMT(1,2,e.credentialType$)),yl.BMQ("aria-label",yl.bMT(2,4,"type")),yl.R7$(3),yl.Dyx(yl.bMT(5,6,e.passwordOptions$))}}function kj(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"tools-password-settings",10),yl.nI1(1,"async"),yl.bIt("onUpdated",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.generate("password settings"))}),yl.k0s()}if(2&e){const e=yl.XpG();yl.Y8G("account",yl.bMT(1,2,e.account$))("disableMargin",e.disableMargin)}}function Ij(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"tools-passphrase-settings",10),yl.nI1(1,"async"),yl.bIt("onUpdated",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.generate("passphrase settings"))}),yl.k0s()}if(2&e){const e=yl.XpG();yl.Y8G("account",yl.bMT(1,2,e.account$))("disableMargin",e.disableMargin)}}class Cj{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=ym,this.account=null,this.account$=new So.m(1),this.debug=!1,this.log=lB(),this.profile=wm.account,this.disableMargin=!1,this.credentialType$=new fd.t(null),this.value$=new fd.t(""),this.generate$=new go.B,this.USER_REQUEST="user request",this.onGenerated=new yl.bkB,this.onAlgorithm=new yl.bkB,this.passwordOptions$=new fd.t([]),this.showCredentialTypes$=this.passwordOptions$.pipe((0,l.T)(e=>e.length>1)),this.maybeAlgorithm$=new So.m(1),this.algorithm$=this.maybeAlgorithm$.pipe((0,To.p)(e=>!!e)),this.credentialTypeCopyLabel$=this.algorithm$.pipe((0,l.T)(({i18nKeys:{copyCredential:e}})=>xB(e,this.i18nService))),this.credentialTypeGenerateLabel$=this.algorithm$.pipe((0,l.T)(({i18nKeys:{generateCredential:e}})=>xB(e,this.i18nService))),this.credentialTypeLabel$=this.algorithm$.pipe((0,l.T)(({i18nKeys:{credentialType:e}})=>xB(e,this.i18nService))),this.destroyed=new go.B}ngOnChanges(e){return bj(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 bj(this,void 0,void 0,function*(){const t=yield(0,ho._)(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 bj(this,void 0,void 0,function*(){if(this.log=uB(this.debug,this.logService,{type:"PasswordGeneratorComponent"}),!this.account){const e=yield(0,ho._)(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,Jv.Q)(this.destroyed)).subscribe(this.passwordOptions$),this.generatorService.generate$({on$:this.generate$,account$:this.account$}).pipe((0,vd.W)((e,t)=>("string"==typeof e?this.toastService.showToast({message:e,variant:"error",title:""}):this.logService.error(e),t)),(0,sm.E)(this.account$,this.algorithm$),(0,Jv.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(xB(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,To.p)(e=>!!e),(0,sm.E)(e),(0,Jv.Q)(this.destroyed)).subscribe(([t,i])=>{Fg(t)&&(this.log.info({algorithm:t,type:bm.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,lo.F)((e,t)=>null!==e&&null!==t&&Dg(e.id,t.id)),(0,Jv.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(RB(e,this.i18nService))})}),this.maybeAlgorithm$.pipe((0,Jv.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:xB(e.i18nKeys.name,this.i18nService)}))}ngOnDestroy(){this.destroyed.complete(),this.generate$.complete(),this.value$.complete(),this.onGenerated.complete()}}Cj.ɵfac=function(e){return new(e||Cj)(yl.rXU(sv),yl.rXU(xy),yl.rXU(xb),yl.rXU(Pl),yl.rXU(za),yl.rXU(Ok),yl.rXU(yl.SKi),yl.rXU(ll.Ai))},Cj.ɵcmp=yl.VBU({type:Cj,selectors:[["tools-password-generator"]],inputs:{account:"account",debug:"debug",profile:"profile",disableMargin:[2,"disableMargin","disableMargin",HR.he]},outputs:{onGenerated:"onGenerated",onAlgorithm:"onAlgorithm"},features:[yl.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&&(yl.nVh(0,Sj,6,8,"bit-toggle-group",0),yl.nI1(1,"async"),yl.j41(2,"bit-card",1)(3,"div",2),yl.nrm(4,"bit-color-password",3),yl.nI1(5,"async"),yl.k0s(),yl.j41(6,"div",4)(7,"button",5),yl.nI1(8,"async"),yl.nI1(9,"async"),yl.bIt("click",function(){return t.generate(t.USER_REQUEST)}),yl.EFF(10),yl.nI1(11,"async"),yl.k0s(),yl.nrm(12,"button",6),yl.nI1(13,"async"),yl.nI1(14,"async"),yl.nI1(15,"async"),yl.nI1(16,"async"),yl.k0s()(),yl.nVh(17,kj,2,4,"tools-password-settings",7),yl.nI1(18,"async"),yl.nVh(19,Ij,2,4,"tools-passphrase-settings",7),yl.nI1(20,"async")),2&e){let e,i;yl.vxM(yl.bMT(1,11,t.showCredentialTypes$)?0:-1),yl.R7$(4),yl.Y8G("password",yl.bMT(5,13,t.value$)),yl.R7$(3),yl.Y8G("label",yl.bMT(8,15,t.credentialTypeGenerateLabel$))("disabled",!yl.bMT(9,17,t.algorithm$)),yl.R7$(3),yl.SpI(" ",yl.bMT(11,19,t.credentialTypeGenerateLabel$)," "),yl.R7$(2),yl.Y8G("label",yl.bMT(13,21,t.credentialTypeCopyLabel$))("appCopyClick",yl.bMT(14,23,t.value$))("valueLabel",yl.bMT(15,25,t.credentialTypeLabel$))("disabled",!yl.bMT(16,27,t.algorithm$)),yl.R7$(5),yl.vxM((null==(e=yl.bMT(18,29,t.algorithm$))?null:e.id)===t.Algorithm.password?17:-1),yl.R7$(2),yl.vxM((null==(i=yl.bMT(20,31,t.algorithm$))?null:i.id)===t.Algorithm.passphrase?19:-1)}},dependencies:[dB,GB,KB,WR,dO,zl,g$,UB,FB,qf,pl.Jj,Hl],encapsulation:2});var Tj=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 Pj=e=>({"tw-mb-4":e});function Fj(e,t){if(1&e&&(yl.j41(0,"bit-hint"),yl.EFF(1),yl.nI1(2,"async"),yl.k0s()),2&e){const e=yl.XpG();yl.R7$(),yl.JRh(yl.bMT(2,1,e.credentialTypeHint$))}}function Rj(e,t){if(1&e&&(yl.j41(0,"form",9)(1,"bit-form-field")(2,"bit-label"),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s(),yl.nrm(5,"bit-select",13),yl.nI1(6,"async"),yl.k0s()()),2&e){const e=yl.XpG();yl.Y8G("formGroup",e.forwarder),yl.R7$(3),yl.JRh(yl.bMT(4,3,"service")),yl.R7$(2),yl.Y8G("items",yl.bMT(6,5,e.forwarderOptions$))}}function xj(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"tools-catchall-settings",14),yl.bIt("onUpdated",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.generate("catchall settings"))}),yl.k0s()}if(2&e){yl.XpG();const e=yl.r8f(37);yl.Y8G("account",e)}}function Aj(e,t){if(1&e&&yl.nrm(0,"tools-forwarder-settings",12),2&e){yl.XpG();const e=yl.r8f(37);yl.Y8G("forwarder",t)("account",e)}}function Dj(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"tools-subaddress-settings",14),yl.bIt("onUpdated",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.generate("subaddress settings"))}),yl.k0s()}if(2&e){yl.XpG();const e=yl.r8f(37);yl.Y8G("account",e)}}function Ej(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"tools-username-settings",14),yl.bIt("onUpdated",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.generate("username settings"))}),yl.k0s()}if(2&e){yl.XpG();const e=yl.r8f(37);yl.Y8G("account",e)}}const $j="forwarder",Oj="none";class Uj{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=ym,this.account=null,this.account$=new So.m(1),this.debug=!1,this.log=lB(),this.website=null,this.onGenerated=new yl.bkB,this.onAlgorithm=new yl.bkB,this.disableMargin=!1,this.username=this.formBuilder.group({nav:[null]}),this.forwarder=this.formBuilder.group({nav:[null]}),this.typeOptions$=new fd.t([]),this.forwarderId$=new fd.t(null),this.forwarderOptions$=new fd.t([]),this.showForwarder$=new fd.t(!1),this.maybeAlgorithm$=new So.m(1),this.algorithm$=this.maybeAlgorithm$.pipe((0,To.p)(e=>!!e)),this.credentialTypeHint$=new So.m(1),this.generatedCredential$=new fd.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 go.B,this.showAlgorithm$=this.maybeAlgorithm$.pipe((0,Op.v)(this.showForwarder$),(0,l.T)(([e,t])=>t?null:e)),this.credentialTypeCopyLabel$=this.algorithm$.pipe((0,l.T)(({i18nKeys:{copyCredential:e}})=>xB(e,this.i18nService))),this.credentialTypeGenerateLabel$=this.algorithm$.pipe((0,l.T)(({i18nKeys:{generateCredential:e}})=>xB(e,this.i18nService))),this.credentialTypeLabel$=this.algorithm$.pipe((0,l.T)(({i18nKeys:{credentialType:e}})=>xB(e,this.i18nService))),this.USER_REQUEST="user request",this.destroyed=new go.B}ngOnChanges(e){return Tj(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 Tj(this,void 0,void 0,function*(){if(this.log=uB(this.debug,this.logService,{type:"UsernameGeneratorComponent"}),!this.account){const e=yield(0,ho._)(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,$o.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:$j,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:Oj,label:this.i18nService.t("select")}),[i,r]}),(0,Fo.M)(e=>this.log.debug({algorithms:e},"algorithms loaded")),(0,Jv.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)?xB(e.i18nKeys.description,this.i18nService):""}),(0,Jv.Q)(this.destroyed)).subscribe(e=>{this.zone.run(()=>{this.credentialTypeHint$.next(e)})}),this.generatorService.generate$({on$:this.generate$,account$:this.account$}).pipe((0,vd.W)((e,t)=>("string"==typeof e?this.toastService.showToast({message:e,variant:"error",title:""}):this.logService.error(e),t)),(0,sm.E)(this.account$,this.maybeAlgorithm$),(0,Jv.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(xB(i.i18nKeys.credentialGenerated,this.i18nService)),this.generatedCredential$.next(e),this.onGenerated.next(e)})});const e=new go.B,t=new go.B;this.username.valueChanges.pipe((0,l.T)(e=>{if(e.nav===$j)return{nav:e.nav};if(e.nav)return{nav:e.nav,algorithm:JSON.parse(e.nav)};{const[e]=$g[bm.username];return{nav:JSON.stringify(e),algorithm:e}}}),(0,Jv.Q)(this.destroyed)).subscribe(e),this.forwarder.valueChanges.pipe((0,l.T)(e=>e.nav===Oj?{nav:e.nav}:e.nav?{nav:e.nav,algorithm:JSON.parse(e.nav)}:{nav:Oj}),(0,Jv.Q)(this.destroyed)).subscribe(t),(0,$o.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,lo.F)((e,t)=>e[0]===t[0]&&e[1]===t[1]),(0,Jv.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,$o.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,lo.F)((e,t)=>null!==e&&null!==t&&Dg(e.id,t.id)),(0,Jv.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(RB(e,this.i18nService)):this.onAlgorithm.next(null)})});const i=yield this.generatorService.preferences({account$:this.account$});this.algorithm$.pipe((0,sm.E)(i),(0,Jv.Q)(this.destroyed)).subscribe(([e,t])=>{if(Ag(e.id))t.email.algorithm=e.id,t.email.updated=new Date;else{if(!Rg(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):Oj,s=n?$j: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,Jv.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,Jv.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 Tj(this,void 0,void 0,function*(){const t=yield(0,ho._)(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:xB(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")}}Uj.ɵfac=function(e){return new(e||Uj)(yl.rXU(sv),yl.rXU(xy),yl.rXU(xb),yl.rXU(za),yl.rXU(Pl),yl.rXU(Ok),yl.rXU(yl.SKi),yl.rXU(fl.ok),yl.rXU(ll.Ai))},Uj.ɵcmp=yl.VBU({type:Uj,selectors:[["tools-username-generator"]],inputs:{account:"account",debug:"debug",website:"website",disableMargin:[2,"disableMargin","disableMargin",HR.he]},outputs:{onGenerated:"onGenerated",onAlgorithm:"onAlgorithm"},features:[yl.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=yl.RV6();yl.j41(0,"bit-card",0)(1,"div",1),yl.nrm(2,"bit-color-password",2),yl.nI1(3,"async"),yl.k0s(),yl.j41(4,"div",3)(5,"button",4),yl.nI1(6,"async"),yl.nI1(7,"async"),yl.bIt("click",function(){return a.eBV(e),a.Njj(t.generate(t.USER_REQUEST))}),yl.EFF(8),yl.nI1(9,"async"),yl.k0s(),yl.j41(10,"button",5),yl.nI1(11,"async"),yl.nI1(12,"async"),yl.nI1(13,"async"),yl.nI1(14,"async"),yl.EFF(15),yl.nI1(16,"async"),yl.k0s()()(),yl.j41(17,"bit-section",6)(18,"bit-section-header")(19,"h2",7),yl.EFF(20),yl.nI1(21,"i18n"),yl.k0s()(),yl.j41(22,"div",8)(23,"bit-card")(24,"form",9)(25,"bit-form-field")(26,"bit-label"),yl.EFF(27),yl.nI1(28,"i18n"),yl.k0s(),yl.nrm(29,"bit-select",10),yl.nI1(30,"async"),yl.nVh(31,Fj,3,3,"bit-hint"),yl.nI1(32,"async"),yl.k0s()(),yl.nVh(33,Rj,7,7,"form",9),yl.nI1(34,"async"),yl.SS7(35),yl.nI1(36,"async"),yl.SS7(37),yl.nI1(38,"async"),yl.nVh(39,xj,1,1,"tools-catchall-settings",11),yl.nVh(40,Aj,1,2,"tools-forwarder-settings",12),yl.nI1(41,"async"),yl.nVh(42,Dj,1,1,"tools-subaddress-settings",11),yl.nVh(43,Ej,1,1,"tools-username-settings",11),yl.k0s()()()}if(2&e){let e;yl.R7$(2),yl.Y8G("password",yl.bMT(3,21,t.value$)),yl.R7$(3),yl.Y8G("label",yl.bMT(6,23,t.credentialTypeGenerateLabel$))("disabled",!yl.bMT(7,25,t.algorithm$)),yl.R7$(3),yl.SpI(" ",yl.bMT(9,27,t.credentialTypeGenerateLabel$)," "),yl.R7$(2),yl.Y8G("label",yl.bMT(11,29,t.credentialTypeCopyLabel$))("appCopyClick",yl.bMT(12,31,t.value$))("valueLabel",yl.bMT(13,33,t.credentialTypeLabel$))("disabled",!yl.bMT(14,35,t.algorithm$)),yl.R7$(5),yl.SpI(" ",yl.bMT(16,37,t.credentialTypeCopyLabel$)," "),yl.R7$(2),yl.Y8G("disableMargin",t.disableMargin),yl.R7$(3),yl.JRh(yl.bMT(21,39,"options")),yl.R7$(2),yl.Y8G("ngClass",yl.eq3(56,Pj,!t.disableMargin)),yl.R7$(2),yl.Y8G("formGroup",t.username),yl.R7$(3),yl.JRh(yl.bMT(28,41,"type")),yl.R7$(2),yl.Y8G("items",yl.bMT(30,43,t.typeOptions$)),yl.R7$(2),yl.vxM(yl.bMT(32,45,t.credentialTypeHint$)?31:-1),yl.R7$(2),yl.vxM(yl.bMT(34,47,t.showForwarder$)?33:-1);const i=yl.bMT(36,49,t.showAlgorithm$);yl.R7$(4),yl.bH3(yl.bMT(38,51,t.account$)),yl.R7$(2),yl.vxM((null==i?null:i.id)===t.Algorithm.catchall?39:-1),yl.R7$(),yl.vxM((e=yl.bMT(41,54,t.forwarderId$))?40:-1,e),yl.R7$(2),yl.vxM((null==i?null:i.id)===t.Algorithm.plusAddress?42:-1),yl.R7$(),yl.vxM((null==i?null:i.id)===t.Algorithm.username?43:-1)}},dependencies:[WR,dO,zl,g$,ZR,ex,Xl,Wl,pl.YU,fl.X1,fl.qT,fl.BC,fl.cb,fl.j4,fl.JD,Vu,Eu,Sc,nu,Du,pB,bB,NB,BB,qf,pl.Jj,Hl],encapsulation:2});class Mj{constructor(){}}Mj.ɵfac=function(e){return new(e||Mj)},Mj.ɵmod=yl.$C({type:Mj}),Mj.ɵinj=a.G2t({imports:[oj,Cj,Uj]});class Nj{}var Vj=i(69514),Bj=i(24999),jj=i(7222);class Gj{}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 zj extends Gj{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 Lj(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 Lj(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 _j{constructor(e,t){this.encryptService=e,this.keyService=t}userEncryptor$(e,t){const i=new ry(e);return t.singleUserId$.pipe(cm(e=>e,(e,t)=>({expectedUserId:e,actualUserId:t})),(0,nm.N)(e=>{const t=new So.m(1);return e.subscribe(t),t.pipe((0,co.n)(e=>this.keyService.userKey$(e).pipe((0,Vj.j)(e=>!e),(0,Qo.v)(e=>!!e),(0,l.T)(t=>{const n=new Qg(e,this.encryptService,t,i);return{userId:e,encryptor:n}}),(0,Bj.O)())),(0,jj.Z)(),(0,Jv.Q)(hm(t)))}))}organizationEncryptor$(e,t){const i=new ry(e),n=t.singleOrganizationId$.pipe(cm(e=>e.userId,(e,t)=>({expectedUserId:e,actualUserId:t})),cm(e=>e.organizationId,(e,t)=>({expectedOrganizationId:e,actualOrganizationId:t})),(0,nm.N)(e=>{const t=new So.m(1);return e.subscribe(t),t.pipe((0,co.n)(e=>this.keyService.orgKeys$(e.userId).pipe((0,Vj.j)(e=>!e),(0,Qo.v)(e=>!!e),(0,l.T)(t=>{const n=e.organizationId,r=t[n];return{organizationId:n,encryptor:new zj(n,this.encryptService,r,i)}}),(0,Bj.O)())),(0,jj.Z)(),(0,Jv.Q)(hm(t)))}));return n}}class Kj{}const Xj=Object.freeze({forwarder:"forwarder"}),qj=Object.freeze({token:"token",baseUrl:"baseUrl",domain:"domain",prefix:"prefix"}),Yj=Object.freeze({default:"default",none:"none",allow:"allow",deny:"deny"});class Wj{}class Hj{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 fv;return Object.assign(Object.assign({},e.storage),{target:"object",key:`${t.site.id}.${t.product.vendor.id}.${e.storage.key}`,state:ve,classifier:i,format:"classified"})}(e,n),s=i.account$.pipe((0,Pp.t)({bufferSize:1,refCount:!0}));return new Kg(r,this.providers,{account$:s})}site(e){return this.registry.build(e)}}const Jj=Object.freeze(Object.keys(Xj)),Zj=Object.freeze(Object.keys(qj)),Qj={[Xj.forwarder]:{id:Xj.forwarder,availableFields:[qj.baseUrl,qj.domain,qj.prefix,qj.token]}},eG=Object.freeze(Object.values(Yj));class tG{constructor(e,t){this.site=e,this.extensions=t,gm(this)}}class iG{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=gm({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=gm(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(!eG.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 tG(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=nG(this.getPermissions(e,t),this.extensionRegistrations[i]);n&&r.set(t,n)}return new tG(n,r)}}function nG(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 rG={id:pv.addyio,name:"Addy.io"},sG=[{site:Qj.forwarder,product:{vendor:rG},host:{authorization:"bearer",selfHost:"maybe",baseUrl:"https://app.addy.io"},requestedFields:[qj.token,qj.baseUrl,qj.domain]}],oG=Object.freeze({id:pv.bitwarden,name:"Bitwarden"}),aG={id:pv.duckduckgo,name:"DuckDuckGo"},lG=[{site:Qj.forwarder,product:{vendor:aG},host:{authorization:"bearer",selfHost:"never",baseUrl:"https://quack.duckduckgo.com/api"},requestedFields:[qj.token]}],cG={id:pv.fastmail,name:"Fastmail"},uG=[{site:Qj.forwarder,product:{vendor:cG},host:{authorization:"bearer",selfHost:"maybe",baseUrl:"https://api.fastmail.com"},requestedFields:[qj.token]}],dG={id:pv.forwardemail,name:"Forward Email"},hG=[{site:Qj.forwarder,product:{vendor:dG},host:{authorization:"basic-username",selfHost:"never",baseUrl:"https://api.forwardemail.net"},requestedFields:[qj.domain,qj.token]}],pG={id:pv.mozilla,name:"Mozilla"},fG=[{site:Qj.forwarder,product:{vendor:pG,name:"Firefox Relay"},host:{authorization:"token",selfHost:"never",baseUrl:"https://relay.firefox.com/api"},requestedFields:[qj.token]}],vG={id:pv.simplelogin,name:"SimpleLogin"},mG=[{site:Qj.forwarder,product:{vendor:vG},host:{authentication:!0,selfHost:"maybe",baseUrl:"https://app.simplelogin.io"},requestedFields:[qj.baseUrl,qj.token,qj.domain]}],gG=gm([rG,oG,aG,cG,dG,pG,vG]),yG=gm([sG,lG,uG,hG,fG,mG].flat());const bG=new sc("Randomizer"),wG=new sc("CredentialGeneratorProviders"),SG=new sc("SystemServices");class kG{constructor(){}}function IG(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"tools-password-generator",2),yl.bIt("onGenerated",function(t){a.eBV(e);const i=yl.XpG();return a.Njj(i.onCredentialGenerated(t))})("onAlgorithm",function(t){a.eBV(e);const i=yl.XpG();return a.Njj(i.onAlgorithmSelected(t))}),yl.k0s()}if(2&e){const e=yl.XpG();yl.Y8G("disableMargin",e.disableMargin)}}function CG(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"tools-username-generator",3),yl.bIt("onGenerated",function(t){a.eBV(e);const i=yl.XpG();return a.Njj(i.onCredentialGenerated(t))})("onAlgorithm",function(t){a.eBV(e);const i=yl.XpG();return a.Njj(i.onAlgorithmSelected(t))}),yl.k0s()}if(2&e){const e=yl.XpG();yl.Y8G("website",e.uri)("disableMargin",e.disableMargin)}}kG.ɵfac=function(e){return new(e||kG)},kG.ɵmod=yl.$C({type:kG}),kG.ɵinj=a.G2t({providers:[{provide:bG,useFactory:function(e){return new Kv(e)},deps:[Cp]},{provide:Kj,useClass:_j,deps:[Nj,Cp]},{provide:Wj,useFactory:()=>{const e=new iG(Jj,Zj);e.registerSite(Qj[Xj.forwarder]);for(const t of gG)e.registerVendor(t);for(const t of yG)e.registerExtension(t);return e.setPermission({all:!0},"default"),e},deps:[]},{provide:SG,useFactory:(e,t,i,n,r,s,o)=>{let a;a=s.isDev()?cB(r,[]):lB;return{policy:i,extension:new Hj(n,{encryptor:e,state:t,log:a,now:Date.now}),log:a,configService:o}},deps:[Kj,u,$b,Wj,za,Eb,uk]},{provide:wG,useFactory:(e,t,i,n,r,s)=>{const o={encryptor:i,state:n,log:e.log,now:Date.now},a=(0,md.H)(e.configService.getFeatureFlag(Nf.UseSdkPasswordGenerators));let l=!1;a.pipe((0,No.s)(1)).subscribe(e=>l=e);const c=new qg(o,e,Object.values(Eg)),u=l?e.sdk:void 0,d=new Yg(o,e.policy),h={randomizer:t,client:new nb(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:[SG,bG,Kj,u,Pl,Mk]},{provide:class{},useFactory:(e,t)=>Object.freeze({encryptor:e,state:t,log:lB,now:Date.now}),deps:[Kj,u]},{provide:sv,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,Pp.t)({refCount:!0,bufferSize:1})),i=e.account$.pipe((0,Pp.t)({refCount:!0,bufferSize:1})),n=t.pipe((0,co.n)(e=>Mg(e)?(0,Oo.of)(e.algorithm):Ng(e)?this.provide.metadata.preference$(e.type,{account$:i}).pipe((0,Yv.$)()):void this.log.panic(e,"algorithm or category required")),(0,To.p)(e=>!!e),mm(e=>this.provide.metadata.metadata(e),{size:10}),(0,Pp.t)({refCount:!0,bufferSize:1})),r=(0,Wv.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:wm.account}),t]}),mm(([e,t])=>{const[n,r]=[e.profile,t.id],s=this.settings(t,{account$:i},n).pipe((0,Fo.M)(()=>this.log.debug({algorithm:r,profile:n},"settings update received")),(0,wo.u)({connector:()=>new So.m(1,Vg),resetOnRefCountZero:()=>(0,ko.O)(Vg)}),(0,Fo.M)({subscribe:()=>this.log.debug({algorithm:r,profile:n},"settings hot"),complete:()=>this.log.debug({algorithm:r,profile:n},"settings cold")}),(0,Yv.$)());return this.log.debug({algorithm:r,profile:n},"settings cached"),s},{key:([e,t])=>`${t.id}:${e.profile}`}),(0,Hv.w)()),s=n.pipe(mm(e=>{const t=e.engine.create(this.provide.generator);return this.log.debug({algorithm:e.id},"engine cached"),t},{size:10}));return(0,Wv.y)([t,r,s]).pipe((0,Fo.M)(([e])=>this.log.debug(e,"generating credential")),(0,yo.H)(([e,t,i])=>i.generate(e,t)),(0,Jv.Q)(hm([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=wm.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=wm.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:[wG,SG]}],imports:[qf]});class TG{constructor(){this.uri="",this.type="password",this.disableMargin=!1,this.algorithmSelected=new yl.bkB,this.valueGenerated=new yl.bkB,this.onAlgorithmSelected=e=>{this.algorithmSelected.emit(e)},this.onCredentialGenerated=e=>{this.valueGenerated.emit(e.credential)}}}TG.ɵfac=function(e){return new(e||TG)},TG.ɵcmp=yl.VBU({type:TG,selectors:[["vault-cipher-form-generator"]],inputs:{uri:"uri",type:"type",disableMargin:[2,"disableMargin","disableMargin",HR.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&&yl.DNE(0,IG,1,1,"tools-password-generator",0)(1,CG,1,2,"tools-username-generator",1),2&e&&(yl.Y8G("ngIf","password"===t.type),yl.R7$(),yl.Y8G("ngIf","username"===t.type))},dependencies:[pl.MD,pl.bT,Mj,Cj,Uj],encapsulation:2});var PG=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 FG(e,t){if(1&e&&(yl.j41(0,"li")(1,"p"),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s()()),2&e){const e=yl.XpG();yl.R7$(2),yl.SpI(" ",yl.brH(3,1,"bulkCollectionAssignmentWarning",e.totalItemCount,e.readonlyItemCount)," ")}}function RG(e,t){if(1&e&&(yl.j41(0,"li")(1,"p"),yl.EFF(2),yl.k0s()()),2&e){const e=yl.XpG();yl.R7$(2),yl.SpI(" ",e.transferWarningText(e.orgName,e.personalItemsCount)," ")}}function xG(e,t){if(1&e&&yl.nrm(0,"bit-option",11),2&e){const e=t.$implicit;yl.Y8G("value",e.id)("label",e.name)}}function AG(e,t){if(1&e&&(yl.j41(0,"div",4)(1,"bit-form-field",8)(2,"bit-label"),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s(),yl.j41(5,"bit-select",9),yl.DNE(6,xG,1,2,"bit-option",10),yl.nI1(7,"async"),yl.k0s()()()),2&e){const e=yl.XpG();yl.R7$(3),yl.JRh(yl.bMT(4,2,"moveToOrganization")),yl.R7$(3),yl.Y8G("ngForOf",yl.bMT(7,4,e.organizations$))}}function DG(e,t){if(1&e&&(yl.j41(0,"bit-hint",12),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()),2&e){const e=yl.XpG();yl.R7$(),yl.SpI(" ",yl.i5U(2,1,"cannotRemoveViewOnlyCollections",e.readOnlyCollectionNames.join(", "))," ")}}const EG="saved",$G="canceled",OG="MyVault";class UG{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 yl.bkB,this.onCollectionAssign=new yl.bkB,this.formGroup=this.formBuilder.group({selectedOrg:[null],collections:[[],[fl.k0.required]]}),this.readOnlyCollectionNames=[],this.availableCollections=[],this.showOrgSelector=!1,this.organizations$=this.accountService.activeAccount$.pipe((0,co.n)(e=>this.organizationService.organizations$(null==e?void 0:e.id).pipe((0,l.T)(e=>e.filter(e=>e.enabled&&e.status===Lh.Confirmed).sort((e,t)=>e.name.localeCompare(t.name))),(0,Fo.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 go.B,this.submit=()=>PG(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,ho._)(this.accountService.activeAccount$.pipe(Gp));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(EG)}),this.sortItems=(e,t)=>this.i18nService.collator.compare(e.labelName,t.labelName)}ngOnInit(){return PG(this,void 0,void 0,function*(){const e=this.params.ciphers.every(e=>null==e.organizationId);(this.selectedOrgId===OG||e)&&(this.showOrgSelector=!0),yield this.initializeItems(this.selectedOrgId),this.selectedOrgId&&this.selectedOrgId!==OG&&(yield this.handleOrganizationCiphers(this.selectedOrgId)),this.setupFormSubscriptions()})}ngAfterViewInit(){this.bitSubmit.loading$.pipe((0,Jv.Q)(this.destroy$)).subscribe(e=>{this.submitBtn&&this.submitBtn.loading.set(e)}),this.bitSubmit.disabled$.pipe((0,Jv.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 PG(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($G);const t=yield(0,ho._)(Gp(this.accountService.activeAccount$)),i=yield(0,ho._)(this.organizationService.organizations$(t).pipe(xF(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!==LF).map(e=>({icon:e.type===LF?"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 PG(this,void 0,void 0,function*(){if(this.totalItemCount=this.params.ciphers.length,!e||e===OG)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,ho._)(Gp(this.accountService.activeAccount$)),i=yield(0,ho._)(this.organizationService.organizations$(t).pipe(xF(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([fl.k0.required]),null==e||e.updateValueAndValidity()}setupFormSubscriptions(){this.formGroup.controls.selectedOrg.valueChanges.pipe((0,Fo.M)(()=>{this.formGroup.controls.collections.setValue([],{emitEvent:!1})}),(0,co.n)(e=>this.getCollectionsForOrganization(e)),(0,Jv.Q)(this.destroy$)).subscribe(e=>{this.availableCollections=e.map(e=>({icon:e.type===LF?"bwi-user":"bwi-collection-shared",id:e.id,labelName:e.name,listName:e.name}))})}getCollectionsForOrganization(e){return this.accountService.activeAccount$.pipe(Gp,(0,co.n)(e=>(0,$o.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!==LF)}),(0,Pp.t)({refCount:!0,bufferSize:1}))}moveToOrganization(e,t,i,n){return PG(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 PG(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 PG(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 PG(this,void 0,void 0,function*(){const{availableCollections:e,ciphers:t}=this.params,i=yield(0,ho._)(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)===LF}));return i}}function MG(e,t){if(1&e&&(yl.j41(0,"bit-item")(1,"div",3),yl.nrm(2,"bit-color-password",4),yl.j41(3,"div",5),yl.EFF(4),yl.nI1(5,"date"),yl.k0s()(),yl.qex(6,6),yl.j41(7,"bit-item-action"),yl.nrm(8,"button",7),yl.nI1(9,"i18n"),yl.nI1(10,"i18n"),yl.k0s(),yl.bVm(),yl.k0s()),2&e){const e=t.$implicit;yl.R7$(2),yl.Y8G("password",e.password)("showCount",!1),yl.R7$(2),yl.JRh(yl.i5U(5,6,e.lastUsedDate,"medium")),yl.R7$(4),yl.Y8G("label",yl.bMT(9,9,"copyPassword"))("appCopyClick",e.password)("valueLabel",yl.bMT(10,11,"password"))}}function NG(e,t){if(1&e&&(yl.j41(0,"div"),yl.DNE(1,MG,11,13,"bit-item",2),yl.k0s()),2&e){const e=yl.XpG();yl.R7$(),yl.Y8G("ngForOf",e.history)}}function VG(e,t){1&e&&(yl.j41(0,"div",8)(1,"p"),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s()()),2&e&&(yl.R7$(2),yl.JRh(yl.bMT(3,1,"noPasswordsInList")))}UG.ɵfac=function(e){return new(e||UG)(yl.rXU(Fb),yl.rXU(Pl),yl.rXU(AF),yl.rXU(BF),yl.rXU(fl.ok),yl.rXU(xb),yl.rXU(Ok))},UG.ɵcmp=yl.VBU({type:UG,selectors:[["assign-collections"]],viewQuery:function(e,t){if(1&e&&yl.GBs(Td,5),2&e){let e;yl.mGM(e=yl.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&&(yl.j41(0,"form",0)(1,"p"),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.j41(4,"ul",1),yl.DNE(5,FG,4,5,"li",2)(6,RG,3,1,"li",2),yl.k0s(),yl.DNE(7,AG,8,6,"div",3),yl.j41(8,"div",4)(9,"bit-form-field",5)(10,"bit-label"),yl.EFF(11),yl.nI1(12,"i18n"),yl.k0s(),yl.nrm(13,"bit-multi-select",6),yl.DNE(14,DG,3,4,"bit-hint",7),yl.k0s()()()),2&e&&(yl.Y8G("formGroup",t.formGroup)("bitSubmit",t.submit),yl.R7$(2),yl.SpI(" ",yl.bMT(3,9,1===t.personalItemsCount?"bulkCollectionAssignmentDialogDescriptionSingular":"bulkCollectionAssignmentDialogDescriptionPlural")," "),yl.R7$(3),yl.Y8G("ngIf",t.readonlyItemCount>0),yl.R7$(),yl.Y8G("ngIf",t.personalItemsCount>0),yl.R7$(),yl.Y8G("ngIf",t.showOrgSelector),yl.R7$(4),yl.JRh(yl.bMT(12,11,"selectCollectionsToAssign")),yl.R7$(2),yl.Y8G("baseItems",t.availableCollections),yl.R7$(),yl.Y8G("ngIf",t.readOnlyCollectionNames.length>0))},dependencies:[pl.MD,pl.Sq,pl.bT,qf,Eu,Sc,nu,eu,Du,rc,Td,tu,Bu,Vu,Ou,fl.X1,fl.qT,fl.BC,fl.cb,fl.j4,fl.JD,Xu,dh,pl.Jj,Xf],encapsulation:2});class BG{constructor(){this.history=[]}ngOnInit(){this.history=null==this.cipher.passwordHistory?[]:this.cipher.passwordHistory}}function jG(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"li",9,0),yl.bIt("click",function(){a.eBV(e);const t=yl.sdS(1),i=yl.XpG();return a.Njj(i.selectText(t))}),yl.EFF(2),yl.k0s()}if(2&e){const e=t.$implicit;yl.R7$(2),yl.SpI(" ",e," ")}}BG.ɵfac=function(e){return new(e||BG)},BG.ɵcmp=yl.VBU({type:BG,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&&yl.DNE(0,NG,2,1,"div",0)(1,VG,4,3,"div",1),2&e&&(yl.Y8G("ngIf",t.history&&t.history.length),yl.R7$(),yl.Y8G("ngIf",!(null!=t.history&&t.history.length)))},dependencies:[pl.MD,pl.Sq,pl.bT,wP,IP,SP,sO,dO,_l,zl,qf,sP,g$,pl.vh,Xf],encapsulation:2});class GG{constructor(){this.dialogRef=(0,a.WQX)(Xd),this.params=(0,a.WQX)(nd.Qs),this.platformUtilsService=(0,a.WQX)(Eb)}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(GG,{data:t,positionStrategy:new Yd})}}GG.ɵfac=function(e){return new(e||GG)},GG.ɵcmp=yl.VBU({type:GG,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&&(yl.j41(0,"bit-simple-dialog"),yl.nrm(1,"i",1),yl.j41(2,"span",2),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s(),yl.j41(5,"div",3)(6,"p"),yl.EFF(7),yl.nI1(8,"i18n"),yl.j41(9,"a",4),yl.bIt("click",function(e){return t.openContactSupport(e)}),yl.EFF(10),yl.nI1(11,"i18n"),yl.k0s(),yl.EFF(12),yl.nI1(13,"i18n"),yl.k0s(),yl.j41(14,"ul",5),yl.DNE(15,jG,3,1,"li",6),yl.k0s()(),yl.qex(16,7),yl.j41(17,"button",8),yl.bIt("click",function(){return t.dialogRef.close(!1)}),yl.EFF(18),yl.nI1(19,"i18n"),yl.k0s(),yl.bVm(),yl.k0s()),2&e&&(yl.R7$(3),yl.JRh(yl.bMT(4,6,"decryptionError")),yl.R7$(4),yl.SpI(" ",yl.bMT(8,8,"couldNotDecryptVaultItemsBelow")," "),yl.R7$(3),yl.JRh(yl.bMT(11,10,"contactCSToAvoidDataLossPart1")),yl.R7$(2),yl.SpI(" ",yl.bMT(13,12,"contactCSToAvoidDataLossPart2")," "),yl.R7$(3),yl.Y8G("ngForOf",t.params.cipherIds),yl.R7$(3),yl.SpI(" ",yl.bMT(19,14,"close")," "))},dependencies:[dh,Nd,Vd,pl.MD,pl.Sq,Xl,qf,rc,Xu,Ku,_b,Xf],encapsulation:2});class LG{constructor(e,t){this.params=e,this.dialogRef=t,this.cipher=e.cipher}close(){this.dialogRef.close()}}LG.ɵfac=function(e){return new(e||LG)(yl.rXU(nd.Qs),yl.rXU(Xd))},LG.ɵcmp=yl.VBU({type:LG,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&&(yl.j41(0,"bit-dialog",0)(1,"span",1),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.qex(4,2),yl.nrm(5,"vault-password-history-view",3),yl.bVm(),yl.qex(6,4),yl.j41(7,"button",5),yl.bIt("click",function(){return t.close()}),yl.EFF(8),yl.nI1(9,"i18n"),yl.k0s(),yl.bVm(),yl.k0s()),2&e&&(yl.R7$(2),yl.SpI(" ",yl.bMT(3,3,"passwordHistory")," "),yl.R7$(3),yl.Y8G("cipher",t.cipher),yl.R7$(3),yl.SpI(" ",yl.bMT(9,5,"close")," "))},dependencies:[Xu,Ku,pl.MD,rc,dh,uh,BG,Hl],encapsulation:2});class zG{}var _G=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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=["submitBtn"];function XG(e,t){if(1&e&&(yl.nrm(0,"button",10),yl.nI1(1,"i18n")),2&e){const e=yl.XpG();yl.Y8G("label",yl.bMT(1,2,"deleteFolder"))("bitAction",e.deleteFolder)}}const qG="created",YG="deleted";class WG{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 OO,this.variant="add",this.folderForm=this.formBuilder.group({name:["",fl.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=()=>_G(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,ho._)(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(qG)}catch(e){this.logService.error(e)}}}),this.deleteFolder=()=>_G(this,void 0,void 0,function*(){if(yield this.dialogService.openSimpleDialog({title:{key:"deleteFolder"},content:{key:"deleteFolderPermanently"},type:"warning"})){try{const e=yield(0,ho._)(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(YG)}})}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 OO}ngAfterViewInit(){var e;null===(e=this.bitSubmit)||void 0===e||e.loading$.pipe((0,wl.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(WG,{data:t})}}WG.ɵfac=function(e){return new(e||WG)(yl.rXU(fl.ok),yl.rXU(qU),yl.rXU(zG),yl.rXU(Ok),yl.rXU(Cp),yl.rXU(xb),yl.rXU(Pl),yl.rXU(za),yl.rXU(Jd),yl.rXU(Xd),yl.rXU(nd.Qs))},WG.ɵcmp=yl.VBU({type:WG,selectors:[["vault-add-edit-folder-dialog"]],viewQuery:function(e,t){if(1&e&&(yl.GBs(Td,5),yl.GBs(KG,5)),2&e){let e;yl.mGM(e=yl.lsd())&&(t.bitSubmit=e.first),yl.mGM(e=yl.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&&(yl.j41(0,"form",1)(1,"bit-dialog")(2,"span",2),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s(),yl.j41(5,"div",3)(6,"bit-form-field",4)(7,"bit-label"),yl.EFF(8),yl.nI1(9,"i18n"),yl.k0s(),yl.nrm(10,"input",5),yl.j41(11,"bit-hint"),yl.EFF(12),yl.nI1(13,"i18n"),yl.k0s()()(),yl.qex(14,6),yl.j41(15,"button",7,0),yl.EFF(17),yl.nI1(18,"i18n"),yl.k0s(),yl.j41(19,"button",8),yl.EFF(20),yl.nI1(21,"i18n"),yl.k0s(),yl.DNE(22,XG,2,4,"button",9),yl.bVm(),yl.k0s()()),2&e&&(yl.Y8G("formGroup",t.folderForm)("bitSubmit",t.submit),yl.R7$(3),yl.SpI(" ",yl.bMT(4,9,"add"===t.variant?"newFolder":"editFolder")," "),yl.R7$(5),yl.JRh(yl.bMT(9,11,"folderName")),yl.R7$(4),yl.SpI(" ",yl.bMT(13,13,"folderHintText")," "),yl.R7$(3),yl.Y8G("disabled",t.folderForm.invalid),yl.R7$(2),yl.SpI(" ",yl.bMT(18,15,"save")," "),yl.R7$(3),yl.SpI(" ",yl.bMT(21,17,"cancel")," "),yl.R7$(2),yl.Y8G("ngIf","edit"===t.variant))},dependencies:[pl.MD,pl.bT,qf,dh,Zd,uh,Xu,Ku,Eu,Sc,nu,ou,Du,fl.X1,fl.qT,fl.me,fl.BC,fl.cb,fl.j4,fl.JD,_l,zl,rc,Rd,Td,Xf],encapsulation:2});const HG=e=>({"tw-px-4 tw-py-5":e});function JG(e,t){if(1&e&&(yl.j41(0,"div",0),yl.SdG(1),yl.k0s()),2&e){const e=yl.XpG();yl.Y8G("ngClass",yl.eq3(2,HG,!e.disablePadding)),yl.BMQ("tabIndex",e.noFocusableChildren?0:void 0)}}class ZG{get content(){return this._contentPortal}constructor(e){this.viewContainerRef=e,this.disablePadding=!1,this._contentPortal=null}ngOnInit(){this._contentPortal=new xl.VA(this.implicitContent,this.viewContainerRef)}}ZG.ɵfac=function(e){return new(e||ZG)(yl.rXU(yl.c1b))},ZG.ɵcmp=yl.VBU({type:ZG,selectors:[["vault-carousel-slide"]],viewQuery:function(e,t){if(1&e&&yl.GBs(yl.C4Q,7),2&e){let e;yl.mGM(e=yl.lsd())&&(t.implicitContent=e.first)}},inputs:{label:"label",disablePadding:[2,"disablePadding","disablePadding",o.L39],noFocusableChildren:[2,"noFocusableChildren","noFocusableChildren",HR.he]},ngContentSelectors:["*"],decls:1,vars:0,consts:[["role","tabpanel",3,"ngClass"]],template:function(e,t){1&e&&(yl.NAR(),yl.DNE(0,JG,2,4,"ng-template"))},dependencies:[pl.MD,pl.YU],encapsulation:2});var QG=i(58716);const eL=lw` `,tL=["btn"];class iL{constructor(){this.CarouselIcon=eL,this.onClick=new yl.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 nL(e,t){}iL.ɵfac=function(e){return new(e||iL)},iL.ɵcmp=yl.VBU({type:iL,selectors:[["vault-carousel-button"]],viewQuery:function(e,t){if(1&e&&yl.GBs(tL,7),2&e){let e;yl.mGM(e=yl.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,"icon"]],template:function(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",1,0),yl.bIt("click",function(){return a.eBV(e),a.Njj(t.onClick.emit())}),yl.nrm(2,"bit-icon",2),yl.k0s()}2&e&&(yl.Y8G("ngClass",t.dynamicClasses),yl.BMQ("aria-selected",t.isActive)("tabindex",t.isActive?0:-1)("aria-label",t.slide.label),yl.R7$(2),yl.Y8G("icon",t.CarouselIcon))},dependencies:[pl.MD,pl.YU,$h,SC],encapsulation:2});class rL{}rL.ɵfac=function(e){return new(e||rL)},rL.ɵcmp=yl.VBU({type:rL,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&&(yl.j41(0,"div",0),yl.DNE(1,nL,0,0,"ng-template",1),yl.k0s()),2&e&&(yl.R7$(),yl.Y8G("cdkPortalOutlet",t.content))},dependencies:[xl.I3],encapsulation:2});var sL=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 oL=["container"],aL=["carouselButtonWrapper"],lL=["tempSlideContainer"],cL=e=>({minHeight:e});function uL(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"vault-carousel-button",11),yl.bIt("onClick",function(){const t=a.eBV(e).index,i=yl.XpG();return a.Njj(i.selectSlide(t))}),yl.k0s()}if(2&e){const e=t.$implicit,i=t.index,n=yl.XpG();yl.Y8G("slide",e)("isActive",i===n.selectedIndex)}}function dL(e,t){}function hL(e,t){1&e&&(yl.j41(0,"div",12,2),yl.DNE(2,dL,0,0,"ng-template",13),yl.k0s())}class pL{constructor(e,t){this.ngZone=e,this.destroyRef=t,this.changeDetectorRef=(0,a.WQX)(o.gRc),this.label="",this.slideChange=new yl.bkB,this.selectedIndex=0,this.minHeight=null,this.keyManager=null}selectSlide(e){this.selectedIndex=e,this.slideChange.emit(e)}nextSlide(){this.selectedIndex0&&this.selectSlide(this.selectedIndex-1)}ngAfterViewInit(){return sL(this,void 0,void 0,function*(){this.keyManager=new QG.B(this.carouselButtons).withHorizontalOrientation("ltr").withWrap().withHomeAndEnd(),this.keyManager.setFirstItemActive(),this.ngZone.onStable.pipe((0,No.s)(1),(0,wl.pQ)(this.destroyRef)).subscribe(()=>{this.setMinHeightOfCarousel()})})}setMinHeightOfCarousel(){return sL(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;en&&(n=this.tempSlideContainer.nativeElement.offsetHeight),this.tempSlideOutlet.detach());this.minHeight=`${n+e}px`,this.changeDetectorRef.detectChanges()})}}pL.ɵfac=function(e){return new(e||pL)(yl.rXU(yl.SKi),yl.rXU(a.abz))},pL.ɵcmp=yl.VBU({type:pL,selectors:[["vault-carousel"]],contentQueries:function(e,t,i){if(1&e&&yl.wni(i,ZG,4),2&e){let e;yl.mGM(e=yl.lsd())&&(t.slides=e)}},viewQuery:function(e,t){if(1&e&&(yl.GBs(oL,5),yl.GBs(aL,5),yl.GBs(lL,5),yl.GBs(xl.I3,5),yl.GBs(iL,5)),2&e){let e;yl.mGM(e=yl.lsd())&&(t.carouselContainer=e.first),yl.mGM(e=yl.lsd())&&(t.carouselButtonWrapper=e.first),yl.mGM(e=yl.lsd())&&(t.tempSlideContainer=e.first),yl.mGM(e=yl.lsd())&&(t.tempSlideOutlet=e.first),yl.mGM(e=yl.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=yl.RV6();yl.j41(0,"section",3,0),yl.nrm(2,"vault-carousel-content",4),yl.j41(3,"div",5)(4,"button",6),yl.nI1(5,"i18n"),yl.bIt("click",function(){return a.eBV(e),a.Njj(t.prevSlide())}),yl.k0s(),yl.j41(6,"div",7,1),yl.bIt("keydown",function(i){return a.eBV(e),a.Njj(t.keyManager.onKeydown(i))}),yl.DNE(8,uL,1,2,"vault-carousel-button",8),yl.k0s(),yl.j41(9,"button",9),yl.nI1(10,"i18n"),yl.bIt("click",function(){return a.eBV(e),a.Njj(t.nextSlide())}),yl.k0s()(),yl.DNE(11,hL,3,0,"div",10),yl.k0s()}if(2&e){let e;yl.Y8G("ngStyle",yl.eq3(15,cL,null!==(i=t.minHeight)&&void 0!==i?i:void 0)),yl.BMQ("aria-label",t.label),yl.R7$(2),yl.Y8G("content",null==(e=t.slides.get(t.selectedIndex))?null:e.content),yl.R7$(2),yl.Y8G("label",yl.mNQ(yl.bMT(5,11,"back")))("disabled",t.selectedIndex<=0),yl.R7$(4),yl.Y8G("ngForOf",t.slides),yl.R7$(),yl.Y8G("label",yl.mNQ(yl.bMT(10,13,"next")))("disabled",t.selectedIndex>=t.slides.length-1),yl.R7$(2),yl.Y8G("ngIf",null===t.minHeight)}},dependencies:[xl.I3,pl.MD,pl.Sq,pl.bT,pl.B3,qf,_l,zl,Xu,rL,iL,Hl],encapsulation:2});class fL{}fL.ɵfac=function(e){return new(e||fL)},fL.ɵmod=yl.$C({type:fL}),fL.ɵinj=a.G2t({imports:[pL,ZG]});const vL=Object.freeze([{type:CR.Login,icon:"bwi-globe",labelKey:"typeLogin"},{type:CR.Card,icon:"bwi-credit-card",labelKey:"typeCard"},{type:CR.Identity,icon:"bwi-id-card",labelKey:"typeIdentity"},{type:CR.SecureNote,icon:"bwi-sticky-note",labelKey:"typeNote"},{type:CR.SshKey,icon:"bwi-key",labelKey:"typeSshKey"}]);function mL(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"div",0),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.closed.emit())}),yl.SdG(1),yl.k0s()}if(2&e){const e=yl.XpG();yl.Y8G("cdkTrapFocusAutoCapture","dialog"===e.ariaRole()),yl.BMQ("role",e.ariaRole())("aria-label",e.ariaLabel())}}class gL{constructor(){this.templateRef=o.ebz.required(yl.C4Q),this.closed=new yl.bkB,this.menuItems=(0,o.tEk)(LE,{descendants:!0}),this.ariaRole=(0,o.hFB)("menu"),this.ariaLabel=(0,o.hFB)()}ngAfterContentInit(){"menu"===this.ariaRole()&&(this.keyManager=new QG.B(this.menuItems()).withWrap().skipPredicate(e=>!!e.disabled))}}gL.ɵfac=function(e){return new(e||gL)},gL.ɵcmp=yl.VBU({type:gL,selectors:[["bit-menu"]],contentQueries:function(e,t,i){1&e&&yl.C6U(i,t.menuItems,LE,5),2&e&&yl.NyB()},viewQuery:function(e,t){1&e&&yl.wEZ(t.templateRef,yl.C4Q,5),2&e&&yl.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&&(yl.NAR(),yl.DNE(0,mL,2,3,"ng-template"))},dependencies:[ll.kB],encapsulation:2});const yL=[{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 bL{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(yL).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 xl.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,To.p)(e=>("menu"===this.menu().ariaRole()?["Escape","Tab"]:["Escape"]).includes(e.key))),i=this.menu().closed,n=this.overlayRef.detachments(),r=e?(0,bo.h)(n,t,i):(0,bo.h)(n,t,this.overlayRef.backdropClick(),i);this.closedEventsSub=r.pipe((0,Jv.Q)(this.overlayRef.detachments())).subscribe(e=>{e instanceof KeyboardEvent&&"Escape"===e.key&&!(0,Bc.rp)(e)&&e.preventDefault(),e instanceof KeyboardEvent&&("Tab"===e.key||"Escape"===e.key)&&this.elementRef.nativeElement.focus(),this.destroyMenu()})}setupMenuCloseListener(){this.overlayRef&&(this.menuCloseListenerSub=this.overlayRef.outsidePointerEvents().pipe((0,jg.i)(1),(0,Jv.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()}}bL.ɵfac=function(e){return new(e||bL)(yl.rXU(yl.aKT),yl.rXU(yl.c1b),yl.rXU(dl.hJ))},bL.ɵdir=yl.FsC({type:bL,selectors:[["","bitMenuTriggerFor",""]],hostVars:3,hostBindings:function(e,t){1&e&&yl.bIt("click",function(){return t.toggleMenu()}),2&e&&yl.BMQ("role",t.role())("aria-expanded",t.isOpen)("aria-haspopup",t.hasPopup)},inputs:{role:[1,"role"],menu:[1,"bitMenuTriggerFor","menu"]},exportAs:["menuTrigger"]});class wL{}wL.ɵfac=function(e){return new(e||wL)},wL.ɵcmp=yl.VBU({type:wL,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&&yl.Hgh(0,"div",0)},encapsulation:2});const SL=(e,t)=>t.type;function kL(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",7),yl.bIt("click",function(){const t=a.eBV(e).$implicit,i=yl.XpG(2);return a.Njj(i.cipherAdded.emit(t.type))}),yl.nrm(1,"i",8),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s()}if(2&e){const e=t.$implicit;yl.R7$(),yl.HbH(yl.VkB("bwi ",e.icon)),yl.R7$(),yl.SpI(" ",yl.bMT(3,4,e.labelKey)," ")}}function IL(e,t){1&e&&yl.nrm(0,"bit-menu-divider")}function CL(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",7),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG(2);return a.Njj(t.folderAdded.emit())}),yl.nrm(1,"i",9),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s()}2&e&&(yl.R7$(2),yl.SpI(" ",yl.bMT(3,1,"folder")," "))}function TL(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",7),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG(2);return a.Njj(t.collectionAdded.emit())}),yl.nrm(1,"i",10),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s()}2&e&&(yl.R7$(2),yl.SpI(" ",yl.bMT(3,1,"collection")," "))}function PL(e,t){if(1&e&&(yl.qex(0),yl.j41(1,"div")(2,"button",2),yl.nI1(3,"i18n"),yl.nrm(4,"i",3),yl.EFF(5),yl.nI1(6,"i18n"),yl.k0s(),yl.j41(7,"bit-menu",4,0),yl.Z7z(9,kL,4,6,"button",5,SL),yl.nI1(11,"async"),yl.DNE(12,IL,1,0,"bit-menu-divider",1)(13,CL,4,3,"button",6)(14,TL,4,3,"button",6),yl.k0s()(),yl.bVm()),2&e){const e=yl.sdS(8),t=yl.XpG();yl.R7$(2),yl.Y8G("bitMenuTriggerFor",e)("appA11yTitle",yl.bMT(3,6,"new")),yl.R7$(3),yl.SpI(" ",yl.bMT(6,8,"new")," "),yl.R7$(4),yl.Dyx(yl.bMT(11,10,t.cipherMenuItems$)),yl.R7$(3),yl.Y8G("ngIf",t.canCreateCipher()),yl.R7$(),yl.Y8G("ngIf",t.canCreateFolder()),yl.R7$(),yl.Y8G("ngIf",t.canCreateCollection())}}class FL{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$=this.restrictedItemTypesService.restricted$.pipe((0,l.T)(e=>vL.filter(t=>!(!this.canCreateSshKey()&&t.type===CR.SshKey)&&!e.some(e=>e.cipherType===t.type))),(0,Pp.t)({bufferSize:1,refCount:!0}))}}FL.ɵfac=function(e){return new(e||FL)(yl.rXU(vE))},FL.ɵcmp=yl.VBU({type:FL,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,"bitMenuTriggerFor","appA11yTitle"],["aria-hidden","true",1,"bwi","bwi-plus"],["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&&yl.DNE(0,PL,15,12,"ng-container",1),2&e&&yl.Y8G("ngIf",t.canCreateCipher()||t.canCreateCollection()||t.canCreateFolder())},dependencies:[Xu,Ku,pl.MD,pl.bT,Dh,gL,bL,LE,wL,qf,jb,pl.Jj,Xf],encapsulation:2});class RL{constructor(){this.platformUtilService=(0,a.WQX)(Eb)}openLearnMore(e){e.preventDefault(),this.platformUtilService.launchUri("https://bitwarden.com/help/website-icons/")}}RL.ɵfac=function(e){return new(e||RL)},RL.ɵcmp=yl.VBU({type:RL,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=yl.RV6();yl.j41(0,"button",1),yl.nI1(1,"i18n"),yl.nrm(2,"i",2),yl.k0s(),yl.j41(3,"bit-popover",3,0),yl.nI1(5,"i18n"),yl.j41(6,"p"),yl.EFF(7),yl.nI1(8,"i18n"),yl.k0s(),yl.j41(9,"div",4)(10,"a",5),yl.bIt("click",function(i){return a.eBV(e),a.Njj(t.openLearnMore(i))}),yl.EFF(11),yl.nI1(12,"i18n"),yl.k0s(),yl.nrm(13,"i",6),yl.k0s()()}if(2&e){const e=yl.sdS(4);yl.Y8G("bitPopoverTriggerFor",e)("appA11yTitle",yl.bMT(1,5,"aboutThisSetting")),yl.R7$(3),yl.Y8G("title",yl.bMT(5,7,"aboutThisSetting")),yl.R7$(4),yl.SpI(" ",yl.bMT(8,9,"permitCipherDetailsDescription")," "),yl.R7$(4),yl.SpI(" ",yl.bMT(12,11,"learnMore")," ")}},dependencies:[HN,WN,yV,qf,jb,Oh,_b,Kb,Xf],encapsulation:2});const xL=Object.freeze({Accepted:"accepted",Declined:"declined"});class AL{constructor(){this.params=(0,a.WQX)(nd.Qs),this.dialogRef=(0,a.WQX)(Xd),this.platformUtilsService=(0,a.WQX)(Eb),this.organizationName=this.params.organizationName}acceptTransfer(){this.dialogRef.close(xL.Accepted)}decline(){this.dialogRef.close(xL.Declined)}openLearnMore(e){e.preventDefault(),this.platformUtilsService.launchUri("https://bitwarden.com/help/transfer-ownership/")}static open(e,t){return e.open(AL,Object.assign({positionStrategy:new Yd,disableClose:!0},t))}}AL.ɵfac=function(e){return new(e||AL)},AL.ɵcmp=yl.VBU({type:AL,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-w-full","tw-text-center","tw-text-sm",3,"click"],["aria-hidden","true",1,"bwi","bwi-external-link","tw-ml-1"]],template:function(e,t){1&e&&(yl.j41(0,"bit-simple-dialog",0)(1,"span",1),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.j41(4,"span",2),yl.EFF(5),yl.nI1(6,"i18n"),yl.k0s(),yl.qex(7,3),yl.j41(8,"button",4),yl.bIt("click",function(){return t.acceptTransfer()}),yl.EFF(9),yl.nI1(10,"i18n"),yl.k0s(),yl.j41(11,"button",5),yl.bIt("click",function(){return t.decline()}),yl.EFF(12),yl.nI1(13,"i18n"),yl.k0s(),yl.j41(14,"a",6),yl.bIt("click",function(e){return t.openLearnMore(e)}),yl.EFF(15),yl.nI1(16,"i18n"),yl.nrm(17,"i",7),yl.k0s(),yl.bVm(),yl.k0s()),2&e&&(yl.R7$(2),yl.JRh(yl.i5U(3,5,"transferItemsToOrganizationTitle",t.organizationName)),yl.R7$(3),yl.SpI(" ",yl.i5U(6,8,"transferItemsToOrganizationContent",t.organizationName)," "),yl.R7$(4),yl.SpI(" ",yl.bMT(10,11,"acceptTransfer")," "),yl.R7$(3),yl.SpI(" ",yl.bMT(13,13,"declineAndLeave")," "),yl.R7$(3),yl.SpI(" ",yl.bMT(16,15,"whyAmISeeingThis")," "))},dependencies:[Xu,Ku,dh,Vd,Oh,_b,Xl,qf,Xf],encapsulation:2,changeDetection:0});const DL=Object.freeze({Confirmed:"confirmed",Back:"back"});class EL{constructor(){this.params=(0,a.WQX)(nd.Qs),this.dialogRef=(0,a.WQX)(Xd),this.platformUtilsService=(0,a.WQX)(Eb),this.organizationName=this.params.organizationName}confirmLeave(){this.dialogRef.close(DL.Confirmed)}goBack(){this.dialogRef.close(DL.Back)}openLearnMore(e){e.preventDefault(),this.platformUtilsService.launchUri("https://bitwarden.com/help/transfer-ownership/")}static open(e,t){return e.open(EL,Object.assign({positionStrategy:new Yd,disableClose:!0},t))}}EL.ɵfac=function(e){return new(e||EL)},EL.ɵcmp=yl.VBU({type:EL,selectors:[["ng-component"]],decls:23,vars:19,consts:[["bitDialogIcon","","aria-hidden","true",1,"bwi","bwi-exclamation-triangle","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-w-full","tw-text-center","tw-text-sm",3,"click"],["aria-hidden","true",1,"bwi","bwi-external-link","tw-ml-1"]],template:function(e,t){1&e&&(yl.j41(0,"bit-simple-dialog"),yl.nrm(1,"i",0),yl.j41(2,"span",1),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s(),yl.qex(5,2),yl.j41(6,"p",3),yl.EFF(7),yl.nI1(8,"i18n"),yl.k0s(),yl.j41(9,"p",4),yl.EFF(10),yl.nI1(11,"i18n"),yl.k0s(),yl.bVm(),yl.qex(12,5),yl.j41(13,"button",6),yl.bIt("click",function(){return t.confirmLeave()}),yl.EFF(14),yl.nI1(15,"i18n"),yl.k0s(),yl.j41(16,"button",7),yl.bIt("click",function(){return t.goBack()}),yl.EFF(17),yl.nI1(18,"i18n"),yl.k0s(),yl.j41(19,"a",8),yl.bIt("click",function(e){return t.openLearnMore(e)}),yl.EFF(20),yl.nI1(21,"i18n"),yl.nrm(22,"i",9),yl.k0s(),yl.bVm(),yl.k0s()),2&e&&(yl.R7$(3),yl.JRh(yl.bMT(4,6,"leaveConfirmationDialogTitle")),yl.R7$(4),yl.SpI(" ",yl.bMT(8,8,"leaveConfirmationDialogContentOne")," "),yl.R7$(3),yl.SpI(" ",yl.bMT(11,10,"leaveConfirmationDialogContentTwo")," "),yl.R7$(4),yl.SpI(" ",yl.i5U(15,12,"leaveConfirmationDialogConfirmButton",t.organizationName)," "),yl.R7$(3),yl.SpI(" ",yl.bMT(18,15,"goBack")," "),yl.R7$(3),yl.SpI(" ",yl.bMT(21,17,"howToManageMyVault")," "))},dependencies:[Xu,Ku,dh,Nd,Vd,Oh,_b,Xl,Wl,qf,Xf],encapsulation:2,changeDetection:0});var $L=i(54539);class OL extends gh.q{constructor(){super(),this._filter=new fd.t(()=>!0),this._renderData=new fd.t([]),this._renderChangesSubscription=null,this._data=new fd.t([]),this._sort=new fd.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,$o.z)([this._data,this._filter]).pipe((0,l.T)(([e])=>this.filterData(e))),i=(0,$o.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?OL.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,$L.o1)(i)){const e=Number(i);return e{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:st=>{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 UL{get classList(){return["tw-p-3","has-[[biticonbutton]]:tw-py-1"]}}function ML(e,t){if(1&e&&(yl.j41(0,"tr",9)(1,"td",4),yl.EFF(2),yl.k0s(),yl.j41(3,"td",4),yl.EFF(4),yl.k0s()()),2&e){const e=t.$implicit;yl.R7$(2),yl.JRh(e.type),yl.R7$(2),yl.JRh(e.message)}}function NL(e,t){if(1&e&&(yl.DNE(0,ML,5,2,"tr",8),yl.nI1(1,"async")),2&e){const e=t.$implicit;yl.Y8G("ngForOf",yl.bMT(1,1,e))}}UL.ɵfac=function(e){return new(e||UL)},UL.ɵdir=yl.FsC({type:UL,selectors:[["th","bitCell",""],["td","bitCell",""]],hostVars:2,hostBindings:function(e,t){2&e&&yl.HbH(t.classList)}});class VL{constructor(e,t){this.dialogRef=e,this.data=t,this.dataSource=new OL}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 BL(e,t){if(1&e&&(yl.j41(0,"tr",9)(1,"td",4),yl.nrm(2,"i",10),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s(),yl.j41(5,"td",4),yl.EFF(6),yl.k0s()()),2&e){const e=t.$implicit;yl.R7$(2),yl.HbH(yl.VkB("bwi bwi-fw bwi-",e.icon)),yl.R7$(),yl.SpI(" ",yl.bMT(4,5,e.type)," "),yl.R7$(3),yl.JRh(e.count)}}function jL(e,t){if(1&e&&(yl.DNE(0,BL,7,7,"tr",8),yl.nI1(1,"async")),2&e){const e=t.$implicit;yl.Y8G("ngForOf",yl.bMT(1,1,e))}}VL.ɵfac=function(e){return new(e||VL)(yl.rXU(Xd),yl.rXU(nd.Qs))},VL.ɵcmp=yl.VBU({type:VL,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&&(yl.j41(0,"bit-dialog")(1,"span",0),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.j41(4,"span",1)(5,"div"),yl.EFF(6),yl.nI1(7,"i18n"),yl.k0s(),yl.j41(8,"bit-table",2),yl.qex(9,3),yl.j41(10,"tr")(11,"th",4),yl.EFF(12),yl.nI1(13,"i18n"),yl.k0s(),yl.j41(14,"th",4),yl.EFF(15),yl.nI1(16,"i18n"),yl.k0s()(),yl.bVm(),yl.DNE(17,NL,2,3,"ng-template",5),yl.k0s()(),yl.qex(18,6),yl.j41(19,"button",7),yl.EFF(20),yl.nI1(21,"i18n"),yl.k0s(),yl.bVm(),yl.k0s()),2&e&&(yl.R7$(2),yl.SpI(" ",yl.bMT(3,6,"importError")," "),yl.R7$(4),yl.JRh(yl.bMT(7,8,"resolveTheErrorsBelowAndTryAgain")),yl.R7$(2),yl.Y8G("dataSource",t.dataSource),yl.R7$(4),yl.JRh(yl.bMT(13,10,"name")),yl.R7$(3),yl.JRh(yl.bMT(16,12,"description")),yl.R7$(5),yl.SpI(" ",yl.bMT(21,14,"ok")," "))},dependencies:[pl.MD,pl.Sq,qf,dh,Zd,uh,Ah,UL,mh,Sh,kh,Xu,Ku,pl.Jj,Xf],encapsulation:2});class GL{constructor(e,t){this.dialogRef=e,this.data=t,this.dataSource=new OL}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 CR.Login:e++;break;case CR.Card:t++;break;case CR.SecureNote:n++;break;case CR.Identity:i++;break;case CR.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}}GL.ɵfac=function(e){return new(e||GL)(yl.rXU(Xd),yl.rXU(nd.Qs))},GL.ɵcmp=yl.VBU({type:GL,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&&(yl.j41(0,"bit-dialog")(1,"span",0),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.j41(4,"div",1)(5,"span"),yl.EFF(6),yl.nI1(7,"i18n"),yl.k0s(),yl.j41(8,"bit-table",2),yl.qex(9,3),yl.j41(10,"tr")(11,"th",4),yl.EFF(12),yl.nI1(13,"i18n"),yl.k0s(),yl.j41(14,"th",4),yl.EFF(15),yl.nI1(16,"i18n"),yl.k0s()(),yl.bVm(),yl.DNE(17,jL,2,3,"ng-template",5),yl.k0s()(),yl.qex(18,6),yl.j41(19,"button",7),yl.EFF(20),yl.nI1(21,"i18n"),yl.k0s(),yl.bVm(),yl.k0s()),2&e&&(yl.R7$(2),yl.SpI(" ",yl.bMT(3,6,"importSuccess")," "),yl.R7$(4),yl.JRh(yl.i5U(7,8,"importSuccessNumberOfItems",t.data.ciphers.length)),yl.R7$(2),yl.Y8G("dataSource",t.dataSource),yl.R7$(4),yl.JRh(yl.bMT(13,11,"type")),yl.R7$(3),yl.JRh(yl.bMT(16,13,"total")),yl.R7$(5),yl.SpI(" ",yl.bMT(21,15,"ok")," "))},dependencies:[pl.MD,pl.Sq,qf,dh,Zd,uh,Ah,UL,mh,Sh,kh,Xu,Ku,pl.Jj,Xf],encapsulation:2});class LL{constructor(e,t){this.dialogRef=e,this.formBuilder=t,this.formGroup=this.formBuilder.group({filePassword:["",fl.k0.required]}),this.submit=()=>{this.formGroup.markAsTouched(),this.formGroup.valid&&this.dialogRef.close(this.formGroup.value.filePassword)}}}LL.ɵfac=function(e){return new(e||LL)(yl.rXU(Xd),yl.rXU(fl.ok))},LL.ɵcmp=yl.VBU({type:LL,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&&(yl.j41(0,"form",0)(1,"bit-dialog")(2,"span",1),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s(),yl.j41(5,"div",2),yl.EFF(6),yl.nI1(7,"i18n"),yl.j41(8,"bit-form-field",3)(9,"bit-label"),yl.EFF(10),yl.nI1(11,"i18n"),yl.k0s(),yl.nrm(12,"input",4)(13,"button",5),yl.k0s()(),yl.qex(14,6),yl.j41(15,"button",7)(16,"span"),yl.EFF(17),yl.nI1(18,"i18n"),yl.k0s()(),yl.j41(19,"button",8)(20,"span"),yl.EFF(21),yl.nI1(22,"i18n"),yl.k0s()(),yl.bVm(),yl.k0s()()),2&e&&(yl.Y8G("formGroup",t.formGroup)("bitSubmit",t.submit),yl.R7$(3),yl.SpI(" ",yl.bMT(4,7,"confirmVaultImport")," "),yl.R7$(3),yl.SpI(" ",yl.bMT(7,9,"confirmVaultImportDesc")," "),yl.R7$(4),yl.JRh(yl.bMT(11,11,"confirmFilePassword")),yl.R7$(7),yl.JRh(yl.bMT(18,13,"importVerb")),yl.R7$(4),yl.JRh(yl.bMT(22,15,"cancel")))},dependencies:[pl.MD,qf,hk,II,dh,Zd,uh,Eu,Sc,ou,Du,Vb,Bb,rc,Td,Xu,Ku,_l,zl,fl.X1,fl.qT,fl.me,fl.BC,fl.cb,fl.j4,fl.JD,Xf],encapsulation:2});class zL{constructor(e,t){this.dialogRef=e,this.formBuilder=t,this.formGroup=this.formBuilder.group({sshKeyPassword:["",fl.k0.required]}),this.submit=()=>{this.formGroup.markAsTouched(),this.formGroup.valid&&this.dialogRef.close(this.formGroup.value.sshKeyPassword)}}}zL.ɵfac=function(e){return new(e||zL)(yl.rXU(Xd),yl.rXU(fl.ok))},zL.ɵcmp=yl.VBU({type:zL,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&&(yl.j41(0,"form",0)(1,"bit-dialog")(2,"span",1),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s(),yl.j41(5,"div",2),yl.EFF(6),yl.nI1(7,"i18n"),yl.j41(8,"bit-form-field",3)(9,"bit-label"),yl.EFF(10),yl.nI1(11,"i18n"),yl.k0s(),yl.nrm(12,"input",4)(13,"button",5),yl.k0s()(),yl.qex(14,6),yl.j41(15,"button",7)(16,"span"),yl.EFF(17),yl.nI1(18,"i18n"),yl.k0s()(),yl.j41(19,"button",8)(20,"span"),yl.EFF(21),yl.nI1(22,"i18n"),yl.k0s()(),yl.bVm(),yl.k0s()()),2&e&&(yl.Y8G("formGroup",t.formGroup)("bitSubmit",t.submit),yl.R7$(3),yl.SpI(" ",yl.bMT(4,7,"enterSshKeyPassword")," "),yl.R7$(3),yl.SpI(" ",yl.bMT(7,9,"enterSshKeyPasswordDesc")," "),yl.R7$(4),yl.JRh(yl.bMT(11,11,"confirmSshKeyPassword")),yl.R7$(7),yl.JRh(yl.bMT(18,13,"importSshKey")),yl.R7$(4),yl.JRh(yl.bMT(22,15,"cancel")))},dependencies:[pl.MD,qf,hk,II,dh,Zd,uh,Eu,Sc,ou,Du,Vb,Bb,rc,Td,Xu,Ku,_l,zl,fl.X1,fl.qT,fl.me,fl.BC,fl.cb,fl.j4,fl.JD,Xf],encapsulation:2});class _L{}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())})};class XL extends Error{constructor(e){super(`SDK loading failed: ${e}`)}}class qL{loadAndInit(){return KL(this,void 0,void 0,function*(){try{yield this.load(),(0,A$.Geh)(qL.logLevel),qL.markAsReady()}catch(e){qL.markAsFailed(e)}})}}qL.logLevel=A$.$bb.Info,qL.Ready=new Promise((e,t)=>{qL.markAsReady=e,qL.markAsFailed=e=>t(new XL(e))});var YL=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 WL{}var HL=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 JL{}class ZL{constructor(){this.ciphers=[],this.folders=[],this.folderRelationships=[]}}class QL{constructor(){this.ciphers=[],this.collections=[],this.collectionRelationships=[]}}class ez{constructor(e,t){this.key=e,this.value=t}}class tz{}class iz{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 CR.Login:this.login=new Rx,this.login.uris=null!==(r=null===(n=e.login.uris)||void 0===n?void 0:n.map(e=>{const t=new Fx;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 Px;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 CR.SecureNote:this.secureNote=new xx,this.secureNote.type=e.secureNote.type;break;case CR.SshKey:this.sshKey=new Ax,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 CR.Card:this.card=new kx,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 CR.Identity:this.identity=new Tx,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 Cx;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 tz;n.fileName=i,n.lastKnownRevisionDate=e.revisionDate,null!=t.key&&(n.key=t.key.encryptedString),this.attachments2[t.id]=n}))}}class nz{constructor(e){this.name=e.name?e.name.encryptedString:null}}class rz extends nz{constructor(e){super(e),this.id=e.id}}class sz{constructor(){this.success=!1,this.ciphers=[],this.folders=[],this.folderRelationships=[],this.collections=[],this.collectionRelationships=[]}}var oz=i(98869);class az{constructor(){this.organizationId=null,this.logService=new Ka(!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=oz.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 uE;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 uE;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=kd.getHostname(e);return this.isNullOrWhitespace(t)?null:t.startsWith("www.")?t.replace("www.",""):t}isNullOrWhitespace(e){return kd.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?(?[1-9]|1[0-2])/(?(?:[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=a$(r),!0}moveFoldersToCollections(e){e.folderRelationships.forEach(t=>e.collectionRelationships.push(t)),e.collections=e.folders.map(e=>new KF({name:e.name,organizationId:this.organizationId,id:zF.isCollectionId(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 L$;return e.favorite=!1,e.notes="",e.fields=[],e.login=new V$,e.type=CR.Login,e}cleanupCipher(e){null!=e&&(e.type!==CR.Login&&(e.login=null),this.isNullOrWhitespace(e.name)&&(e.name="--"),this.isNullOrWhitespace(e.notes)?e.notes=null:e.notes=e.notes.trim())}processKvp(e,t,i,n=FR.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 D$;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;i0;t--){const i=s.slice(0,t).join("/");if(null==e.folders.find(e=>e.name===i)){const t=new OO;t.name=i,e.folders.push(t)}}}convertToNoteIfNeeded(e){e.type===CR.Login&&this.isNullOrWhitespace(e.login.username)&&this.isNullOrWhitespace(e.login.password)&&(null==e.login.uris||0===e.login.uris.length)&&(e.type=CR.SecureNote,e.secureNote=new j$,e.secureNote.type=$R)}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("{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-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 cz extends az{parse(e){const t=new sz,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 uz extends az{parse(e){const t=new sz,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=CR.SecureNote,i.secureNote.type=$R,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=CR.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=x$.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 dz extends az{parse(e){const t=new sz,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 hz extends az{parse(e){const t=new sz,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 pz extends az{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 sz,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 fz extends az{parse(e){const t=new sz,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 L$;i.favorite=!this.organization&&"0"!==this.getValueOrDefault(e.favorite,"0"),i.type=CR.Login,i.notes=this.getValueOrDefault(e.notes),i.name=this.getValueOrDefault(e.name,"--");try{i.reprompt=parseInt(this.getValueOrDefault(e.reprompt,kR.None.toString()),10)}catch(e){console.error("Unable to parse reprompt value",e),i.reprompt=kR.None}if(!this.isNullOrWhitespace(e.fields)){const t=this.splitNewLine(e.fields);for(let e=0;en+2&&(r.value=t[e].substr(n+2)),i.fields.push(r)}}switch(null!=e.type?e.type.toLowerCase():null){case"note":i.type=CR.SecureNote,i.secureNote=new j$,i.secureNote.type=$R;break;default:{i.type=CR.Login,i.login=new V$,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 vz(e){return null==e?null:"string"==typeof e?e:null==e?void 0:e.encryptedString}class mz{static template(){const e=new mz;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 x$){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 FM){return t.cardholderName=null!=e.cardholderName?new up(e.cardholderName):null,t.brand=null!=e.brand?new up(e.brand):null,t.number=null!=e.number?new up(e.number):null,t.expMonth=null!=e.expMonth?new up(e.expMonth):null,t.expYear=null!=e.expYear?new up(e.expYear):null,t.code=null!=e.code?new up(e.code):null,t}constructor(e){null!=e&&(this.cardholderName=vz(e.cardholderName),this.brand=vz(e.brand),this.number=vz(e.number),this.expMonth=vz(e.expMonth),this.expYear=vz(e.expYear),this.code=vz(e.code))}}class gz{static template(){const e=new gz;return e.name="Field name",e.value="Some value",e.type=FR.Text,e}static toView(e,t=new D$){return t.type=e.type,t.value=e.value,t.name=e.name,t.linkedId=e.linkedId,t}static toDomain(e,t=new RM){return t.type=e.type,t.value=null!=e.value?new up(e.value):null,t.name=null!=e.name?new up(e.name):null,t.linkedId=e.linkedId,t}constructor(e){null!=e&&(this.name=vz(e.name),this.value=vz(e.value),this.type=e.type,this.linkedId=e.linkedId)}}class yz{static template(){const e=new yz;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 O$){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 xM){return t.title=null!=e.title?new up(e.title):null,t.firstName=null!=e.firstName?new up(e.firstName):null,t.middleName=null!=e.middleName?new up(e.middleName):null,t.lastName=null!=e.lastName?new up(e.lastName):null,t.address1=null!=e.address1?new up(e.address1):null,t.address2=null!=e.address2?new up(e.address2):null,t.address3=null!=e.address3?new up(e.address3):null,t.city=null!=e.city?new up(e.city):null,t.state=null!=e.state?new up(e.state):null,t.postalCode=null!=e.postalCode?new up(e.postalCode):null,t.country=null!=e.country?new up(e.country):null,t.company=null!=e.company?new up(e.company):null,t.email=null!=e.email?new up(e.email):null,t.phone=null!=e.phone?new up(e.phone):null,t.ssn=null!=e.ssn?new up(e.ssn):null,t.username=null!=e.username?new up(e.username):null,t.passportNumber=null!=e.passportNumber?new up(e.passportNumber):null,t.licenseNumber=null!=e.licenseNumber?new up(e.licenseNumber):null,t}constructor(e){null!=e&&(this.title=vz(e.title),this.firstName=vz(e.firstName),this.middleName=vz(e.middleName),this.lastName=vz(e.lastName),this.address1=vz(e.address1),this.address2=vz(e.address2),this.address3=vz(e.address3),this.city=vz(e.city),this.state=vz(e.state),this.postalCode=vz(e.postalCode),this.country=vz(e.country),this.company=vz(e.company),this.email=vz(e.email),this.phone=vz(e.phone),this.ssn=vz(e.ssn),this.username=vz(e.username),this.passportNumber=vz(e.passportNumber),this.licenseNumber=vz(e.licenseNumber))}}class bz{static template(){const e=new bz;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 U$){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 DM){return t.credentialId=null!=e.credentialId?new up(e.credentialId):null,t.keyType=null!=e.keyType?new up(e.keyType):null,t.keyAlgorithm=null!=e.keyAlgorithm?new up(e.keyAlgorithm):null,t.keyCurve=null!=e.keyCurve?new up(e.keyCurve):null,t.keyValue=null!=e.keyValue?new up(e.keyValue):null,t.rpId=null!=e.rpId?new up(e.rpId):null,t.userHandle=null!=e.userHandle?new up(e.userHandle):null,t.userName=null!=e.userName?new up(e.userName):null,t.counter=null!=e.counter?new up(e.counter):null,t.rpName=null!=e.rpName?new up(e.rpName):null,t.userDisplayName=null!=e.userDisplayName?new up(e.userDisplayName):null,t.discoverable=null!=e.discoverable?new up(e.discoverable):null,t.creationDate=e.creationDate,t}constructor(e){null!=e&&(this.credentialId=vz(e.credentialId),this.keyType=vz(e.keyType),this.keyAlgorithm=vz(e.keyAlgorithm),this.keyCurve=vz(e.keyCurve),this.keyValue=vz(e.keyValue),this.rpId=vz(e.rpId),this.userHandle=vz(e.userHandle),this.userName=vz(e.userName),this.counter=vz(String(e.counter)),this.rpName=vz(e.rpName),this.userDisplayName=vz(e.userDisplayName),this.discoverable=vz(String(e.discoverable)),this.creationDate=e.creationDate)}}class wz{static template(){const e=new wz;return e.uri="https://google.com",e.match=null,e}static toView(e,t=new uE){return t.uri=e.uri,t.match=e.match,t}static toDomain(e,t=new $M){return t.uri=null!=e.uri?new up(e.uri):null,t.uriChecksum=null!=e.uriChecksum?new up(e.uriChecksum):null,t.match=e.match,t}constructor(e){var t;this.match=null,null!=e&&(this.uri=vz(e.uri),"uriChecksum"in e&&(this.uriChecksum=null===(t=e.uriChecksum)||void 0===t?void 0:t.encryptedString),this.match=e.match)}}class Sz{static template(){const e=new Sz;return e.uris=[],e.username="jdoe",e.password="myp@ssword123",e.totp="JBSWY3DPEHPK3PXP",e.fido2Credentials=[],e}static toView(e,t=new V$){return null!=e.uris&&(t.uris=e.uris.map(e=>wz.toView(e))),t.username=e.username,t.password=e.password,t.totp=e.totp,null!=e.fido2Credentials&&(t.fido2Credentials=e.fido2Credentials.map(e=>bz.toView(e))),t}static toDomain(e,t=new UM){return null!=e.uris&&(t.uris=e.uris.map(e=>wz.toDomain(e))),t.username=null!=e.username?new up(e.username):null,t.password=null!=e.password?new up(e.password):null,t.totp=null!=e.totp?new up(e.totp):null,t}constructor(e){null!=e&&(null!=e.uris&&(this.uris=e.uris.map(e=>new wz(e))),null!=e.fido2Credentials&&(this.fido2Credentials=e.fido2Credentials.map(e=>new bz(e))),this.username=vz(e.username),this.password=vz(e.password),this.totp=vz(e.totp))}}class kz{static template(){const e=new kz;return e.password=null,e.lastUsedDate=null,e}static toView(e,t=new B$){return t.password=e.password,t.lastUsedDate=e.lastUsedDate?new Date(e.lastUsedDate):null,t}static toDomain(e,t=new MM){return t.password=null!=e.password?new up(e.password):null,t.lastUsedDate=e.lastUsedDate?new Date(e.lastUsedDate):null,t}constructor(e){this.lastUsedDate=null,null!=e&&(this.password=vz(e.password),this.lastUsedDate=e.lastUsedDate)}}class Iz{static template(){const e=new Iz;return e.type=$R,e}static toView(e,t=new j$){return t.type=e.type,t}static toDomain(e,t=new VM){return t.type=e.type,t}constructor(e){null!=e&&(this.type=e.type)}}class Cz{static template(){const e=new Cz;return e.privateKey="",e.publicKey="",e.keyFingerprint="",e}static toView(e,t=new G$){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 BM){return t.privateKey=new up(e.privateKey),t.publicKey=new up(e.publicKey),t.keyFingerprint=new up(e.keyFingerprint),t}constructor(e){null!=e&&(this.privateKey=vz(e.privateKey),this.publicKey=vz(e.publicKey),this.keyFingerprint=vz(e.keyFingerprint))}}class Tz{constructor(){this.passwordHistory=null,this.revisionDate=null,this.creationDate=null,this.deletedDate=null,this.archivedDate=null}static template(){const e=new Tz;return e.organizationId=null,e.collectionIds=null,e.folderId=null,e.type=CR.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=kR.None,e.passwordHistory=[],e.creationDate=null,e.revisionDate=null,e.deletedDate=null,e.archivedDate=null,e}static toView(e,t=new L$){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:kR.None,t.key=null!=e.key?new up(e.key):null,null!=e.fields&&(t.fields=e.fields.map(e=>gz.toView(e))),e.type){case CR.Login:t.login=Sz.toView(e.login);break;case CR.SecureNote:t.secureNote=Iz.toView(e.secureNote);break;case CR.Card:t.card=mz.toView(e.card);break;case CR.Identity:t.identity=yz.toView(e.identity);break;case CR.SshKey:t.sshKey=Cz.toView(e.sshKey)}return null!=e.passwordHistory&&(t.passwordHistory=e.passwordHistory.map(e=>kz.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 GM){var i;switch(t.type=e.type,t.folderId=e.folderId,null==t.organizationId&&(t.organizationId=e.organizationId),t.name=null!=e.name?new up(e.name):null,t.notes=null!=e.notes?new up(e.notes):null,t.favorite=e.favorite,t.reprompt=null!==(i=e.reprompt)&&void 0!==i?i:kR.None,t.key=null!=e.key?new up(e.key):null,null!=e.fields&&(t.fields=e.fields.map(e=>gz.toDomain(e))),e.type){case CR.Login:t.login=Sz.toDomain(e.login);break;case CR.SecureNote:t.secureNote=Iz.toDomain(e.secureNote);break;case CR.Card:t.card=mz.toDomain(e.card);break;case CR.Identity:t.identity=yz.toDomain(e.identity);break;case CR.SshKey:t.sshKey=Cz.toDomain(e.sshKey)}return null!=e.passwordHistory&&(t.passwordHistory=e.passwordHistory.map(e=>kz.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=vz(e.name),this.notes=vz(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 gz(e))),e.type){case CR.Login:this.login=new Sz(e.login);break;case CR.SecureNote:this.secureNote=new Iz(e.secureNote);break;case CR.Card:this.card=new mz(e.card);break;case CR.Identity:this.identity=new yz(e.identity);break;case CR.SshKey:this.sshKey=new Cz(e.sshKey)}null!=e.passwordHistory&&(this.passwordHistory=e.passwordHistory.map(e=>new kz(e))),this.creationDate=e.creationDate,this.revisionDate=e.revisionDate,this.deletedDate=e.deletedDate,this.archivedDate=e.archivedDate}}class Pz extends Tz{build(e){this.id=e.id,super.build(e),this.collectionIds=e.collectionIds}}function Fz(e){return"string"==typeof e&&b(e)}class Rz{static template(){const e=new Rz;return e.organizationId="00000000-0000-0000-0000-000000000000",e.name="Collection name",e.externalId=null,e}static toView(e,t){const i=new KF({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 up(e.name):null,t.externalId=e.externalId,null==t.organizationId&&(t.organizationId=e.organizationId),t}build(e){this.organizationId=e.organizationId,this.name=vz(e.name),this.externalId=e.externalId}}class xz extends Rz{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 Az=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 Dz extends _p{constructor(e){super(),null!=e&&(this.buildDomainModel(this,e,{id:null,name:null},["id"]),this.revisionDate=null!=e.revisionDate?new Date(e.revisionDate):null)}decrypt(e){return this.decryptObj(this,new OO(this),["name"],e)}decryptWithKey(e,t){return Az(this,void 0,void 0,function*(){const i=new OO;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){const t=null==e.revisionDate?null:new Date(e.revisionDate);return Object.assign(new Dz,e,{name:up.fromJSON(e.name),revisionDate:t})}}class Ez{static template(){const e=new Ez;return e.name="Folder name",e}static toView(e,t=new OO){return t.name=e.name,t}static toDomain(e,t=new Dz){return t.name=null!=e.name?new up(e.name):null,t}build(e){this.name=vz(e.name)}}class $z extends Ez{static toView(e,t=new OO){return t.id=e.id,super.toView(e,t)}static toDomain(e,t=new Dz){return t.id=e.id,super.toDomain(e,t)}build(e){this.id=e.id,super.build(e)}}var Oz=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 Uz extends az{constructor(e,t,i,n,r){super(),this.keyService=e,this.encryptService=t,this.i18nService=i,this.cipherService=n,this.accountService=r}parse(e){return Oz(this,void 0,void 0,function*(){const t=yield(0,ho._)(this.accountService.activeAccount$);this.result=new sz;const i=JSON.parse(e);return null==i||null==i.items?(this.result.success=!1,this.result):(i.encrypted?yield this.parseEncrypted(i,t.id):yield this.parseDecrypted(i,t.id),this.result)})}parseEncrypted(e,t){return Oz(this,void 0,void 0,function*(){if(null!=e.encKeyValidation_DO_NOT_EDIT){const i=yield(0,ho._)(this.keyService.orgKeys$(t));let n=null==i?void 0:i[this.organizationId];null==n&&(n=yield(0,ho._)(this.keyService.userKey$(t)));const r=new up(e.encKeyValidation_DO_NOT_EDIT);try{yield this.encryptService.decryptString(r,n)}catch(e){return this.result.success=!1,void(this.result.errorMessage=this.i18nService.t("importEncKeyError"))}}const i=this.organization?yield this.parseCollections(e,t):yield this.parseFolders(e,t);for(const n of e.items){const e=Pz.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&&i.has(n.folderId)?this.result.folderRelationships.push([this.result.ciphers.length,i.get(n.folderId)]):this.organization&&null!=n.collectionIds&&n.collectionIds.forEach(e=>{i.has(e)&&this.result.collectionRelationships.push([this.result.ciphers.length,i.get(e)])});const r=yield this.cipherService.decrypt(e,t);this.cleanupCipher(r),this.result.ciphers.push(r)}this.result.success=!0})}parseDecrypted(e,t){return Oz(this,void 0,void 0,function*(){const i=this.organization?yield this.parseCollections(e,t):yield this.parseFolders(e,t);e.items.forEach(e=>{const t=Pz.toView(e);t.id=null,t.organizationId=null,t.collectionIds=null,null!=t.passwordHistory&&t.passwordHistory.length>5&&(t.passwordHistory=t.passwordHistory.slice(0,5)),!this.organization&&null!=e.folderId&&i.has(e.folderId)?this.result.folderRelationships.push([this.result.ciphers.length,i.get(e.folderId)]):this.organization&&null!=e.collectionIds&&e.collectionIds.forEach(e=>{i.has(e)&&this.result.collectionRelationships.push([this.result.ciphers.length,i.get(e)])}),this.cleanupCipher(t),this.result.ciphers.push(t)}),this.result.success=!0})}parseFolders(e,t){return Oz(this,void 0,void 0,function*(){if(null==e.folders)return null;const i=yield(0,ho._)(this.keyService.userKey$(t)),n=new Map;for(const t of e.folders){let r;if(e.encrypted){const e=$z.toDomain(t);null!=e&&(r=yield e.decrypt(i))}else r=$z.toView(t);null!=r&&(n.set(t.id,this.result.folders.length),this.result.folders.push(r))}return n})}parseCollections(e,t){return Oz(this,void 0,void 0,function*(){if(null==e.collections)return null;const i=yield(0,ho._)(this.keyService.orgKeys$(t).pipe((0,To.p)(e=>null!=e))),n=new Map;for(const t of e.collections){let r;if(e.encrypted){const e=xz.toDomain(t,new zF({id:t.id,name:new up(t.name),organizationId:this.organizationId})),n=i[t.organizationId];r=yield e.decrypt(n,this.encryptService)}else r=xz.toView(t),r.organizationId=null;null!=r&&(n.set(t.id,this.result.collections.length),this.result.collections.push(r))}return n})}}var Mz=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 Nz extends Uz{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 Mz(this,void 0,void 0,function*(){const i=new sz,n=JSON.parse(e);if(!n)return i.success=!1,i;if(!(null==n?void 0:n.encrypted))return yield t.parse.call(this,e);if(!(null==n?void 0:n.passwordProtected))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 up(n.data),o=yield this.encryptService.decryptString(s,this.key);return yield t.parse.call(this,o)})}checkPassword(e,t){return Mz(this,void 0,void 0,function*(){if(this.isNullOrWhitespace(t))return!1;const i=e.kdfType===Tf.PBKDF2_SHA256?new xf(e.kdfIterations):new Af(e.kdfIterations,e.kdfMemory,e.kdfParallelism);this.key=yield this.keyGenerationService.deriveVaultExportKey(t,e.salt,i);const n=new up(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!=Tf[e.kdfType]&&e.encKeyValidation_DO_NOT_EDIT&&e.data)}}class Vz extends az{parse(e){const t=new sz,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 Bz=["!group_id","!group_name","title","username","password","URL","id"];class jz extends az{parse(e){const t=new sz,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),i.login.uris=this.makeUriArray(e.URL);let n=!1;for(const t in e)e.hasOwnProperty(t)&&(n||-1!==Bz.indexOf(t)||(n=!0),n&&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 Gz extends az{parse(e){const t=new sz,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 Lz extends az{parse(e){const t=new sz,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 zz=new Set(["title","note","username","password","url","otpSecret","category"]),_z=new Set(["type","title","first_name","middle_name","last_name","login","email","phone_number","address","country","state","city","zip","item_name"]),Kz=new Set(["title","note"]);class Xz extends az{parse(e){const t=new sz,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=CR.Identity,e.identity=new O$,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=CR.Login,e.login=new V$,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,zz)}parsePaymentRecord(e,t){e.type=CR.Card,e.card=new x$,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=x$.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=CR.Identity,e.identity=new O$;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=CR.SecureNote,e.secureNote.type=$R,"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,_z)}parseSecureNoteRecords(e,t){e.type=CR.SecureNote,e.secureNote.type=$R,e.name=t.title,e.notes=t.note,this.importUnmappedFields(e,t,Kz)}importUnmappedFields(e,t,i){Object.keys(t).filter(e=>!i.has(e)).forEach(i=>{const n=t;this.processKvp(e,i,n[i])})}}const qz=new Set(["ADDRESS","AUTHENTIFIANT","BANKSTATEMENT","IDCARD","IDENTITY","PAYMENTMEANS_CREDITCARD","PAYMENTMEAN_PAYPAL","EMAIL"]);class Yz extends az{parse(e){this.result=new sz;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)&&!qz.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 L$;t.identity=new O$,t.type=CR.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 L$;t.identity=new O$,t.type=CR.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 L$;t.card=new x$,t.type=CR.Card,t.name=this.getValueOrDefault(e.bank),t.card.number=this.getValueOrDefault(e.cardNumber),t.card.brand=x$.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 L$;n.secureNote=new j$,n.type=CR.SecureNote,n.secureNote.type=$R,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 Wz extends az{parse(e){const t=new sz,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=CR.Card,i.card=new x$,i.card.cardholderName=this.getValueOrDefault(e["Name on card"]),i.card.number=this.getValueOrDefault(e["Card Number"]),i.card.brand=x$.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 Hz extends az{parse(e){const t=new sz,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=CR.SecureNote,i.secureNote=new j$,i.secureNote.type=$R),this.containsField(e,"cardholder")&&this.containsField(e,"number")&&this.containsField(e,"expiry date")&&(i.type=CR.Card,i.card=new x$),e.length>2&&e.length%2==0)for(let t=0;t!this.isNullOrWhitespace(e)&&e.toLowerCase()===t.toLowerCase()).length>0}}const Jz=new RegExp("androidapp://.*==@","g");class Zz extends az{parse(e){const t=new sz,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 OO;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)),i.notes+="\n"+this.getValueOrDefault(e.note,""),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(Jz,"androidapp://"),i.push(e)}else this.processKvp(e,t.label,t.value,1===t.sensitive?FR.Hidden:FR.Text);else e.login.username=t.value}),e.login.uris=this.makeUriArray(i)}processCard(e,t){e.card=new x$,e.type=CR.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=x$.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?FR.Hidden:FR.Text))})}processNote(e,t){t.forEach(t=>{this.isNullOrWhitespace(t.value)||"section"===t.type||this.processKvp(e,t.label,t.value,1===t.sensitive?FR.Hidden:FR.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 Qz extends az{parse(e){const t=new sz,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 e_=Object.freeze({Login:1,CreditCard:2});class t_ extends az{parse(e){const t=new sz,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 e_.Login:this.handleLoginEntry(e,t);break;case e_.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=CR.Card,t.card=new x$,t.card.cardholderName=this.getValueOrDefault(e.username),t.card.number=this.getValueOrDefault(e.creditNumber),t.card.brand=x$.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 i_ extends az{parse(e){const t=new sz,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 n_="Notes\n\n",r_="Applications\n\n",s_="Websites\n\n",o_="\n---\n";class a_ extends az{parse(e){const t=new sz;let i,n,r,s=this.splitNewLine(e).join("\n");if(-1!==s.indexOf(n_)){const e=s.split(n_);e.length>1&&(s=e[0],i=e[1])}if(-1!==s.indexOf(r_)){const e=s.split(r_);e.length>1&&(s=e[0],n=e[1])}if(0===s.indexOf(s_)){const e=s.split(s_);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(o_))return[];const t=[];return e.split(o_).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 l_ extends az{constructor(){super(...arguments),this.result=new sz}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 OO;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{let e=FR.Text;const n=t.attributes;n.length>0&&null!=n.ProtectInMemory&&"True"===n.ProtectInMemory.value&&(e=FR.Hidden),this.processKvp(r,s,i,e)}}),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 c_ extends az{parse(e){const t=new sz,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 u_ extends az{parse(e){const t=new sz,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}\n`),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{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-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 O$;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=CR.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=CR.Identity,t.identity=e}n=!0}}n||(t.secureNote=new j$,t.secureNote.type=$R,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 h_ extends az{parse(e){const t=new sz,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 p_ extends az{parse(e){const t=new sz,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 f_ extends az{parse(e){const t=new sz,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=CR.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=CR.SecureNote,n.secureNote=new j$,n.secureNote.type=$R;for(let t=3;t{const i=this.initLoginCipher();if(i.name=this.getValueOrDefault(e.nickname,"--"),i.notes=this.getValueOrDefault(e.additionalInfo),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,m_);else if(void 0!==e.authToken)i.login.totp=this.getValueOrDefault(e.authToken),this.importUnmappedFields(i,e,w_);else if(void 0!==e.cardNumber)i.card=new x$,i.type=CR.Card,i.card.cardholderName=this.getValueOrDefault(e.cardName),i.card.number=this.getValueOrDefault(e.cardNumber),i.card.brand=x$.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,g_);else if(void 0!==e.firstName)i.identity=new O$,i.type=CR.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,y_);else if(void 0!==e.idType){switch(i.identity=new O$,i.type=CR.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,b_)}else{if(void 0===e.content)return;i.secureNote=new j$,i.type=CR.SecureNote,i.secureNote.type=$R,i.notes=this.getValueOrDefault(e.content),this.importUnmappedFields(i,e,S_)}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 I_=new Set(["Organisationseinheit","Informationen","Beschreibung","Benutzername","Passwort","Internetseite","One-Time Passwort"]);class C_ extends az{parse(e){const t=new sz,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}\n`),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,I_),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 T_ extends az{parse(e){const t=new sz,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 L$;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=FR.Text;"hidden"==e.type&&(t=FR.Hidden),this.processKvp(n,e.label,e.value,t)})}switch(i){case CR.Login:if(n.type=CR.Login,n.login=new V$,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 CR.Card:n.type=CR.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=x$.getCardBrandByPatterns(n.card.number),this.setCardExpiration(n,e.expirydate);break;case CR.Identity:n.type=CR.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 CR.SecureNote:n.type=CR.SecureNote,n.secureNote.type=$R}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 CR.Login;case"credit_card":return CR.Card;case"note":return CR.SecureNote;case"identity":return CR.Identity}}}class P_ extends az{constructor(){super(...arguments),this.result=new sz}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=CR.Identity,t.identity=new O$):(t.type=CR.Card,t.card=new x$),t.type!==CR.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=CR.SecureNote,t.secureNote=new j$,t.secureNote.type=$R):"wallet.financial.CreditCard"===e.typeName?(t.type=CR.Card,t.card=new x$):"identities.Identity"===e.typeName?(t.type=CR.Identity,t.identity=new O$):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===CR.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 B$;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===CR.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===CR.Card){if(this.isNullOrWhitespace(t.card.number)&&"ccnum"===o)return t.card.number=s,void(t.card.brand=x$.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===CR.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?FR.Hidden:FR.Text;this.processKvp(t,a,s,l)})}}const F_=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"}),R_=Object.freeze({TextOrHtml:"T",EmailAddress:"E",URL:"U",Number:"N",Password:"P",TextArea:"A",PhoneNumber:"TEL",CheckBox:"C"});class x_ extends az{constructor(){super(...arguments),this.result=new sz}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 F_.Login:case F_.Database:case F_.Password:case F_.WirelessRouter:case F_.Server:case F_.API_Credential:t.type=CR.Login,t.login=new V$;break;case F_.CreditCard:case F_.BankAccount:t.type=CR.Card,t.card=new x$;break;case F_.SecureNote:case F_.SoftwareLicense:case F_.EmailAccount:case F_.MedicalRecord:t.type=CR.SecureNote,t.secureNote=new j$,t.secureNote.type=$R;break;case F_.Identity:case F_.DriversLicense:case F_.OutdoorLicense:case F_.Membership:case F_.Passport:case F_.RewardsProgram:case F_.SocialSecurityNumber:t.type=CR.Identity,t.identity=new O$}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")+"\n"),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=CR.Login,void(t.login.username=e.value);if("password"===e.designation&&""!==e.value)return t.type=CR.Login,void(t.login.password=e.value);let i=e.value,n=FR.Text;switch(e.fieldType){case R_.Password:n=FR.Hidden;break;case R_.CheckBox:i=""!==e.value?"true":"false",n=FR.Boolean}this.processKvp(t,e.name,i,n)})}processDetails(e,t,i){e===F_.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===CR.Login){if(this.fillLogin(t,a,i))return;switch(e){case F_.Login:case F_.Database:case F_.EmailAccount:case F_.WirelessRouter:break;case F_.Server:if(this.isNullOrWhitespace(i.login.uri)&&"url"===t.id)return void(i.login.uris=this.makeUriArray(a));break;case F_.API_Credential:if(this.fillApiCredentials(t,a,i))return}}else if(i.type===CR.Card){if(this.fillCreditCard(t,a,i))return;if(e===F_.BankAccount&&this.fillBankAccount(t,a,i))return}else if(i.type===CR.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 F_.Identity:break;case F_.DriversLicense:if(this.fillDriversLicense(t,a,i))return;break;case F_.OutdoorLicense:if(this.fillOutdoorLicense(t,a,i))return;break;case F_.Membership:if(this.fillMembership(t,a,i))return;break;case F_.Passport:if(this.fillPassport(t,a,i))return;break;case F_.RewardsProgram:if(this.fillRewardsProgram(t,a,i))return;break;case F_.SocialSecurityNumber:if(this.fillSSN(t,a,i))return}}if("email"===r){const{email_address:e,provider:n}=t.value.email;return this.processKvp(i,o,e,FR.Text),void this.processKvp(i,"provider",n,FR.Text)}if("password"===t.title&&null!=i.passwordHistory&&i.passwordHistory.some(e=>e.password===a))return;t.guarded&&i.reprompt===kR.None&&(i.reprompt=kR.Password);const l="concealed"===r?FR.Hidden:FR.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=x$.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,FR.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 B$;return t.password=e.value,t.lastUsedDate=new Date((""+e.time).length>=13?e.time:1e3*e.time),t})}}class A_{constructor(e,t,i){this.importRecord=e,this.property=t,this.cipher=i,this.lowerProperty=t.toLowerCase()}}const D_=["ainfo","autosubmit","notesplain","ps","scope","tags","title","uuid","notes"];class E_ extends az{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 sz,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 A_(e,t,i);i.type===CR.Login&&this.setKnownLoginValue(r)||(i.type===CR.Card&&this.setKnownCreditCardValue(r)||i.type===CR.Identity&&this.setKnownIdentityValue(r)||(n=this.setUnknownValue(r,n)))}i.type===CR.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===D_.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],FR.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=x$.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 $_ extends E_{setCipherType(e,t){switch(this.getValueOrDefault(this.getProp(e,"type"),"Login")){case"Credit Card":t.type=CR.Card,t.card=new x$,D_.push("type");break;case"Identity":t.type=CR.Identity,t.identity=new O$,D_.push("type");break;case"Login":case"Secure Note":D_.push("type")}}}class O_ extends E_{constructor(){super(),this.identityPropertyParsers.push(this.setIdentityAddress)}setCipherType(e,t){t.type=CR.Login,t.login=new V$,this.isNullOrWhitespace(this.getPropByRegexp(e,/\d+: number/i))||this.isNullOrWhitespace(this.getPropByRegexp(e,/\d+: expiry date/i))||(t.type=CR.Card,t.card=new x$),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=CR.Identity,t.identity=new O$)}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 U_ extends az{parse(e){const t=new sz,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;r0?i[0].trim():null;this.processFolder(t,n)}const i=this.initLoginCipher();i.name=this.getValueOrDefault(e[0],"--");for(let t=2;t-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 M_ extends az{parse(e){const t=new sz,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 N_ extends az{parse(e){const t=new sz,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 V_ extends az{parse(e){const t=new sz,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 B_ extends az{parse(e){const t=new sz,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;r0&&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 j_ extends az{parse(e){const t=new sz,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 G_ extends az{parse(e){const t=new sz,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 OO;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 x$,i.type=CR.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===CR.Card){if("cardNumber"===t){i.card.number=r,i.card.brand=x$.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 L_=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"}),z_=Object.freeze({Password:"1",Memo:"2",Date:"3",Number:"4",Boolean:"5",Decimal:"6",Email:"7",URL:"8"});class __ extends az{constructor(){super(...arguments),this.result=new sz,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 OO;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=L_.Password;const o=e.children;for(let e=0;e{this.parseBankingTANs(e,r)}):this.parseCustomFields(t,s,r));else switch(s=t.textContent,s){case L_.Password:case L_.RDP:case L_.Putty:case L_.TeamViewer:case L_.Banking:case L_.Certificate:case L_.EncryptedFile:r.type=CR.Login,r.login=new V$;break;case L_.CreditCard:r.type=CR.Card,r.card=new x$;break;case L_.SoftwareLicense:case L_.Information:case L_.Document:r.type=CR.SecureNote,r.secureNote=new j$,r.secureNote.type=$R;break;case L_.Identity:r.type=CR.Identity,r.identity=new O$}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 L_.CreditCard:if(this.parseCreditCardCustomFields(n,i))return;break;case L_.Identity:if(this.parseIdentityCustomFields(n,i))return;break;case L_.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=z_.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:z_.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:z_.Memo;const l=this.querySelectorDirectChild(e,"visible");n=null!=l?l.textContent:null}if(r===z_.Date&&!isNaN(i)){const e=parseInt(i);i=new Date((e-25569)*(1e3*86400)).toLocaleDateString()}return r===z_.Password?{name:t,value:i,type:FR.Hidden,linkedId:null}:r===z_.Boolean?{name:t,value:i,type:FR.Boolean,linkedId:null}:"0"==n?{name:t,value:i,type:FR.Hidden,linkedId:null}:{name:t,value:i,type:FR.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=x$.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;e0?i.split("\r\n").forEach(e=>{this._favouritesLookupTable.add(e)}):i.split("\n").forEach(e=>{this._favouritesLookupTable.add(e)})}}class K_ extends az{parse(e){const t=new sz,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 X_ extends az{parse(e){const t=new sz,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 q_ extends az{parse(e){const t=new sz,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 Y_={Titel:"Title",Gebruikersnaam:"Username",Wachtwoord:"Password",Gewijzigd:"Modified",Gemaakt:"Created","Verloopt op":"Expire on",Beschrijving:"Description","Gewijzigd door":"Modified by"},W_={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"},H_=new Set(["Title","Username","URL","Password","Description"]);function J_(e){return Object.assign(Object.assign({"User name":"Username"},W_),Y_)[e]||e}class Z_ extends az{parse(e){const t=new sz,i=this.parseCsv(e,!0,{skipEmptyLines:!0,transformHeader:J_});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));kd.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,H_),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 Q_(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 eK=Object.freeze({ACTIVE:1,TRASHED:2});class tK extends az{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?FR.Hidden:FR.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?FR.Hidden:FR.Text)})})}}else this.processKvp(e,i,t[i])})}parse(e){var t,i;const n=new sz,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==eK.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?FR.Text:FR.Hidden);break}case"note":s.type=CR.SecureNote,s.secureNote=new j$,s.secureNote.type=$R;break;case"creditCard":{const e=r.data.content;s.type=CR.Card,s.card=new x$,s.card.cardholderName=this.getValueOrDefault(e.cardholderName),s.card.number=this.getValueOrDefault(e.number),s.card.brand=x$.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,FR.Hidden);break}case"identity":{const e=r.data.content;s.type=CR.Identity,s.identity=new O$;const{mappedFirstName:n,mappedMiddleName:o,mappedLastName:a}=Q_(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?FR.Hidden:FR.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 iK extends az{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 sz,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)&&(kd.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(),FR.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=CR.SecureNote,t.secureNote=new j$,t.secureNote.type=$R,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=CR.SecureNote,t.secureNote=new j$,t.secureNote.type=$R,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=CR.SecureNote,t.secureNote=new j$,t.secureNote.type=$R,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,FR.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 nK extends az{parse(e){const t=new sz,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=CR.Card,i.card=new x$,i.card.cardholderName=this.getValueOrDefault(e.cardholder),i.card.number=this.getValueOrDefault(e.number),i.card.brand=x$.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 rK extends az{parse(e){const t=new sz,i=this.parseCsv(e,!0);if(null==i)return t.success=!1,Promise.resolve(t);let n=1;return i.forEach(e=>{const r=!this.isNullOrWhitespace(e.Folder)&&e.Folder.startsWith("/")?e.Folder.replace("/",""):e.Folder,s=this.isNullOrWhitespace(r)?null:r;this.processFolder(t,s);const o=this.initLoginCipher();o.notes=this.getValueOrDefault(e.Note),o.name=this.getValueOrDefault(e.Name,"--"),o.login.username=this.getValueOrDefault(e.Login),o.login.password=this.getValueOrDefault(e.Pwd),o.login.uris=this.makeUriArray(e.Url),this.isNullOrWhitespace(e.Rf_fields)?this.isNullOrWhitespace(e.RfFieldsV2)||this.parseRfFieldsV2(o,e):this.parseRfFields(o,e),this.convertToNoteIfNeeded(o),this.cleanupCipher(o),n===i.length&&"--"===o.name&&this.isNullOrWhitespace(o.login.password)||(t.ciphers.push(o),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]?FR.Hidden:FR.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 sK extends az{parse(e){const t=new sz,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 oK extends az{parse(e){const t=new sz,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 OO;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=CR.SecureNote,r.secureNote=new j$,r.secureNote.type=$R):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,FR.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===FR.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 aK extends az{parse(e){const t=new sz,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 lK extends az{parse(e){const t=new sz,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 cK extends az{parse(e){const t=new sz,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 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 dK=["kind","autologin","favorite","hexcolor","protectedwithpassword","subdomainonly","type","tk_export_version","note","title","document_content"];class hK extends az{parse(e){const t=new sz,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=CR.Card,i.card=new x$,i.card.cardholderName=this.getValueOrDefault(e.cardholder),i.card.number=this.getValueOrDefault(e.number),i.card.brand=x$.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=CR.SecureNote,i.secureNote=new j$,i.secureNote.type=$R,this.isNullOrWhitespace(i.notes)||(i.notes=this.getValueOrDefault(e.document_content,""));for(const t in e)e.hasOwnProperty(t)&&dK.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 pK extends az{parse(e){const t=new sz,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 fK extends az{parse(e){const t=new sz,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 vK extends az{parse(e){const t=new sz,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 mK=[{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)"}],gK=[{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:"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 yK=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 bK{}const wK=Object.freeze({file:"file",chromium:"chromium",ipc:"ipc",download:"download"}),SK=Object.freeze({unique:"unique",chromium:"chromium"}),kK=gm({[wK.chromium]:[Ca.Desktop],[wK.download]:[Ca.Browser],[wK.file]:[Ca.Browser,Ca.Desktop,Ca.Web,Ca.Cli],[wK.ipc]:[]}),IK=[{id:"bitwardenjson",loaders:[wK.file],instructions:SK.unique},{id:"chromecsv",loaders:[wK.file],instructions:SK.chromium},{id:"operacsv",loaders:[wK.file],instructions:SK.chromium},{id:"vivaldicsv",loaders:[wK.file],instructions:SK.chromium},{id:"bravecsv",loaders:[wK.file],instructions:SK.chromium},{id:"edgecsv",loaders:[wK.file],instructions:SK.chromium}],CK=gm(Object.fromEntries(IK.map(e=>[e.id,e])));var TK=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 PK{}const FK=new sc("SystemServices"),RK=[{provide:WL,useClass:class{constructor(e){this.apiService=e}postImportCiphers(e){return HL(this,void 0,void 0,function*(){return yield this.apiService.send("POST","/ciphers/import",e,!0,!1)})}postImportOrganizationCiphers(e,t){return HL(this,void 0,void 0,function*(){return yield this.apiService.send("POST","/ciphers/import-organization?organizationId="+e,t,!0,!1)})}},deps:[Mk]},{provide:Kj,useClass:_j,deps:[Nj,Cp]},{provide:Wj,useFactory:()=>function(){const e=new iG(Jj,Zj);for(const t of Reflect.ownKeys(Qj))e.registerSite(Qj[t]);for(const t of gG)e.registerVendor(t);for(const t of yG)e.registerExtension(t);return e}(),deps:[]},{provide:FK,useFactory:function(e,t,i,n,r,s,o){let a;return a=s.isDev()?cB(r,[]):lB,{policy:i,extension:new Hj(n,{encryptor:e,state:t,log:a,now:Date.now}),log:a,configService:o,environment:s}},deps:[Kj,u,$b,Wj,za,Eb,uk]},{provide:JL,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=mK,this.regularImportOptions=gK}getImportOptions(){return this.featuredImportOptions.concat(this.regularImportOptions)}import(e,t){return yK(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(!kd.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,ho._)(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.lengthi.folderRelationships.push(new ez(e[0],e[1]))),yield this.importApiService.postImportCiphers(i)})}handleOrganizationalImport(e,t,i){return yK(this,void 0,void 0,function*(){const n=new QL;for(let r=0;rn.collectionRelationships.push(new ez(e[0],e[1]))),yield this.importApiService.postImportOrganizationCiphers(t,n)})}badData(e){return(null==e.name||"--"===e.name)&&e.type===CR.Login&&null!=e.login&&kd.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=TR[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 yK(this,void 0,void 0,function*(){if(!i)return;if(t){if(!(i instanceof KF))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===LF){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 KF(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 OO))throw new Error(this.i18nService.t("errorAssigningTargetFolder"));const n=[];e.ciphers.forEach((e,t)=>{kd.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 OO;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:[Fb,qU,WL,Pl,BF,Cp,Nj,_L,Ok,vE]}];var xK=i(74794),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())})};function DK(e,t){if(1&e&&yl.nrm(0,"bit-option",3),2&e){const e=t.$implicit;yl.Y8G("value",e.id)("label",e.name)}}class EK{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:[fl.k0.required],asyncValidators:[this.validateAndEmitData()],updateOn:"submit"}]}),this.profileList=[],this.format=o.hFB.required(),this.csvDataLoaded=new yl.bkB,(0,bl.QZ)(()=>AK(this,void 0,void 0,function*(){this.profileList=yield this.onLoadProfilesFromBrowser(this.getBrowserName(this.format()))}))}ngOnInit(){return AK(this,void 0,void 0,function*(){this._parentFormGroup=this.controlContainer.control,this._parentFormGroup.addControl("chromeOptions",this.formGroup)})}ngOnDestroy(){this._parentFormGroup.removeControl("chromeOptions")}validateAndEmitData(){return()=>AK(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 $K(i.login));const i=oz.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":"Chrome"}}EK.ɵfac=function(e){return new(e||EK)(yl.rXU(fl.ok),yl.rXU(fl.ZU),yl.rXU(za),yl.rXU(Pl))},EK.ɵcmp=yl.VBU({type:EK,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&&(yl.j41(0,"div",0)(1,"bit-form-field")(2,"bit-label"),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s(),yl.j41(5,"bit-select",1),yl.DNE(6,DK,1,2,"bit-option",2),yl.k0s()()()),2&e&&(yl.Y8G("formGroup",t.formGroup),yl.R7$(3),yl.JRh(yl.bMT(4,3,"browserProfile")),yl.R7$(3),yl.Y8G("ngForOf",t.profileList))},dependencies:[pl.MD,pl.Sq,qf,td,Xl,Eu,Sc,Du,fl.X1,fl.BC,fl.cb,fl.j4,fl.JD,_l,id,Bu,Vu,Ou,Xf],encapsulation:2});class $K{constructor(e){const t=kd.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 OK=i(44280);class UK{}class MK{}const NK=Object.freeze({Azure:0,OktaAuthServer:1,OktaNoAuthServer:2,Google:3,PingOne:4,OneLogin:5}),VK=Object.freeze({MasterPassword:0,Federated:3}),BK=Object.freeze({GoogleAuth:0,MicrosoftAuth:1,Yubikey:2}),jK=Object.freeze({Desktop:0,Mobile:1});class GK{static createClientInfo(e){return{platform:jK.Desktop,id:e,description:"Importer"}}}class LK{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 zK{}class _K{constructor(e,t,i){this.waitForOutOfBand=e,this.passcode=t,this.rememberMe=i}waitForApproval(e){return new _K(!0,"",e)}continueWithPasscode(e,t){return new _K(!1,e,t)}}_K.cancel=new _K(!1,"cancel",!1);class KK{constructor(e,t){this.passcode=e,this.rememberMe=t}}KK.cancel=new KK("cancel",!1);class XK{constructor(){this.parseSecureNotesToAccount=!0}}XK.default=new XK;class qK{}class YK{}class WK{isFederated(){return this.type===VK.Federated&&this.hasValue(this.identityProviderURL)&&this.hasValue(this.openIDConnectAuthority)&&this.hasValue(this.openIDConnectClientId)}get oidcScope(){let e="openid profile email";return this.provider===NK.PingOne&&(e+=" lastpass"),e}get openIDConnectAuthorityBase(){return this.openIDConnectAuthority.replace("/.well-known/openid-configuration","")}hasValue(e){return null!=e&&""!==e.trim()}}class HK{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 JK=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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(){this.isBrowser=!0}get(e){return JK(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 JK(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 JK(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 JK(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 QK=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 eX=new Map([[jK.Desktop,"cli"],[jK.Mobile,"android"]]),tX=new Map([["googleauthrequired",BK.GoogleAuth],["microsoftauthrequired",BK.MicrosoftAuth],["otprequired",BK.Yubikey]]);class iX{constructor(e,t){this.parser=e,this.cryptoUtils=t}openVault(e,t,i,n,r,s){return QK(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 QK(this,void 0,void 0,function*(){const r=new HK(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 QK(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"===kd.fromBufferToUtf8(e[e.length-1].payload)}return!1}login(e,t,i,n,r){return QK(this,void 0,void 0,function*(){const s=new ZK;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=tX.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 QK(this,void 0,void 0,function*(){let l=null;switch(r){case BK.GoogleAuth:l=yield o.provideGoogleAuthPasscode();break;case BK.MicrosoftAuth:l=yield o.provideMicrosoftAuthPasscode();break;case BK.Yubikey:l=yield o.provideYubikeyPasscode();break;default:throw new Error("Invalid OTP method")}if(l==KK.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 QK(this,void 0,void 0,function*(){const l=r=>QK(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)})(),(()=>QK(this,void 0,void 0,function*(){const t=yield this.approveOob(e,r,o,a);if(t==_K.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 QK(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 QK(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 QK(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!=xa.Ok&&this.makeError(r)})}logout(e,t){return QK(this,void 0,void 0,function*(){const i=new Map([["method",eX.get(e.platform)],["noredirect",1]]),n=yield t.postForm("logout.php",i,null,this.getSessionCookies(e));n.status!=xa.Ok&&this.makeError(n)})}downloadVault(e,t){return QK(this,void 0,void 0,function*(){const i="getaccts.php?mobile=1&b64=1&hash=0.0&hasplugin=3.0.23&requestsrc="+eX.get(e.platform),n=yield t.get(i,null,this.getSessionCookies(e));if(n.status==xa.Ok){const e=yield n.text();return kd.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 qK;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 QK(this,void 0,void 0,function*(){const a=yield this.cryptoUtils.deriveKeyHash(e,t,n),l=new Map([["method",eX.get(s.platform)],["xml","2"],["username",e],["hash",kd.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==xa.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 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 rX{constructor(e){this.cryptoFunctionService=e}deriveKey(e,t,i){return nX(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 nX(this,void 0,void 0,function*(){const n=yield this.deriveKey(e,t,i);return 1==i?yield this.cryptoFunctionService.hash(kd.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;n32?this.decryptAes256CbcPlain(e,t):this.decryptAes256EcbPlain(e,t)})}decryptAes256Base64(e,t){return nX(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 nX(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 kd.fromBufferToUtf8(r)})}decryptAes256EcbPlain(e,t){return nX(this,void 0,void 0,function*(){return this.decryptAes256(e,t,"ecb")})}decryptAes256EcbBase64(e,t){return nX(this,void 0,void 0,function*(){const i=kd.fromB64ToArray(kd.fromBufferToUtf8(e));return this.decryptAes256(i,t,"ecb")})}decryptAes256CbcPlain(e,t){return nX(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 nX(this,void 0,void 0,function*(){const i=kd.fromB64ToArray(kd.fromBufferToUtf8(e.subarray(26))),n=kd.fromB64ToArray(kd.fromBufferToUtf8(e.subarray(1,25)));return this.decryptAes256(i,t,"cbc",n)})}}var sX=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 oX=new Set(["Server","Email Account","Database","Instant Messenger"]);class aX{constructor(e,t){this.cryptoFunctionService=e,this.cryptoUtils=t}parseAcct(e,t,i,n){return sX(this,void 0,void 0,function*(){let r,s=0;try{const o="decryption failed",a=new HK(e.payload);r=kd.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):kd.fromBufferToUtf8(this.decodeHexLoose(kd.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"===kd.fromBufferToUtf8(this.readItem(a));this.skipItem(a),s=7;let f=yield this.cryptoUtils.decryptAes256PlainWithDefault(this.readItem(a),t,o);s=8;let v=yield this.cryptoUtils.decryptAes256PlainWithDefault(this.readItem(a),t,o);this.skipItem(a),this.skipItem(a),s=11;const m="1"===kd.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":f=i[1];break;case"Password":v=i[1]}}if(!oX.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 UK;return b.id=r,b.name=l,b.username=f,b.password=v,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 sX(this,void 0,void 0,function*(){let t;try{const n=new HK(e.payload);t=kd.fromBufferToUtf8(this.readItem(n));const r=this.readItem(n),s=kd.fromHexToArray(kd.fromBufferToUtf8(r)),o=yield this.cryptoFunctionService.rsaDecrypt(s,i,"sha1"),a=kd.fromHexToArray(kd.fromBufferToUtf8(o)),l=this.readItem(n),c=yield this.cryptoUtils.decryptAes256Base64(l,a),u=new YK;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 sX(this,void 0,void 0,function*(){const i=yield this.cryptoUtils.decryptAes256(kd.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 kd.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 MK;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 kd.fromBufferToUtf8(e.readBytes(4))}readSize(e){return e.readUInt32BigEndian()}readPayload(e,t){return e.readBytes(t)}decodeHexLoose(e){return kd.fromHexToArray(e.length%2==0?e:"0"+e)}}var lX=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 cX{constructor(e){this.cryptoFunctionService=e,this.cryptoUtils=new rX(e);const t=new aX(e,this.cryptoUtils);this.client=new iX(t,this.cryptoUtils)}open(e,t,i,n){return lX(this,arguments,void 0,function*(e,t,i,n,r=XK.default){this.accounts=yield this.client.openVault(e,t,null,i,n,r)})}openFederated(e,t,i){return lX(this,arguments,void 0,function*(e,t,i,n=XK.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=kd.fromBufferToB64(a);this.accounts=yield this.client.openVault(e.username,l,o,t,i,n)})}setUserTypeContext(e){return lX(this,void 0,void 0,function*(){const t=e.toLowerCase(),i=new ZK;i.baseUrl="https://lastpass.com";const n="lmiapi/login/type?username="+encodeURIComponent(t),r=yield i.get(n);if(r.status===xa.Ok){const e=yield r.json();if(this.userType=new WK,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===NK.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 LK(e));if(0===t.length)throw new Error("No accounts to transform");return oz.unparse(t)}getK1(e){return lX(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 kd.fromByteStringToArray(e.idpUserInfo.LastPassK1);if(this.userType.provider===NK.Azure)i=yield this.getK1Azure(e);else if(this.userType.provider===NK.Google)i=yield this.getK1Google(e);else{const t=this.userType.provider===NK.PingOne;i=yield this.getK1FromAccessToken(e,t)}if(null!=i)return i;throw new Error("Cannot get k1.")})}getK1Azure(e){return lX(this,void 0,void 0,function*(){const t=new ZK;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===xa.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 kd.fromB64ToArray(t)}}return null})}getK1Google(e){return lX(this,void 0,void 0,function*(){const t=new Map([["Authorization","Bearer "+e.accessToken]]),i=new ZK;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===xa.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===xa.Ok){const t=yield e.text();return kd.fromB64ToArray(t)}}}return null})}getK1FromAccessToken(e,t){return lX(this,void 0,void 0,function*(){const i=HS(e.accessToken),n=null==i?void 0:i.LastPassK1;return null!=n?t?kd.fromB64ToArray(n):kd.fromByteStringToArray(n):null})}getK2FragmentId(e){return lX(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 ZK;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===xa.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[kd.fromB64ToArray(t),n]}throw new Error("Cannot get k2 and/or fragment ID.")})}}class uX{constructor(e){this.dialogRef=e,this.formGroup=new fl.gE({password:new fl.MJ("",{validators:fl.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(uX);return(0,ho._)(t.closed)}}uX.ɵfac=function(e){return new(e||uX)(yl.rXU(Xd))},uX.ɵcmp=yl.VBU({type:uX,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&&(yl.j41(0,"form",0)(1,"bit-dialog")(2,"span",1),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s(),yl.j41(5,"div",2)(6,"bit-form-field",3)(7,"bit-label"),yl.EFF(8),yl.nI1(9,"i18n"),yl.k0s(),yl.nrm(10,"input",4)(11,"button",5),yl.j41(12,"bit-hint"),yl.EFF(13),yl.nI1(14,"i18n"),yl.k0s()()(),yl.qex(15,6),yl.j41(16,"button",7)(17,"span"),yl.EFF(18),yl.nI1(19,"i18n"),yl.k0s()(),yl.j41(20,"button",8)(21,"span"),yl.EFF(22),yl.nI1(23,"i18n"),yl.k0s()(),yl.bVm(),yl.k0s()()),2&e&&(yl.Y8G("formGroup",t.formGroup)("bitSubmit",t.submit),yl.R7$(3),yl.SpI(" ",yl.bMT(4,7,"lastPassAuthRequired")," "),yl.R7$(5),yl.JRh(yl.bMT(9,9,"lastPassMasterPassword")),yl.R7$(5),yl.JRh(yl.bMT(14,11,"confirmIdentity")),yl.R7$(5),yl.JRh(yl.bMT(19,13,"submit")),yl.R7$(4),yl.JRh(yl.bMT(23,15,"cancel")))},dependencies:[pl.MD,qf,hk,II,fl.X1,fl.qT,fl.me,fl.BC,fl.cb,fl.j4,fl.JD,dh,Zd,uh,Eu,Sc,nu,ou,Du,Vb,Bb,rc,xd,Td,Xu,Ku,_l,zl,Xl,Xf],encapsulation:2});class dX{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 fl.gE({passcode:new fl.MJ("",{validators:fl.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(dX,{data:t})}}dX.ɵfac=function(e){return new(e||dX)(yl.rXU(Xd),yl.rXU(nd.Qs))},dX.ɵcmp=yl.VBU({type:dX,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&&(yl.j41(0,"form",0)(1,"bit-dialog")(2,"span",1),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s(),yl.j41(5,"div",2)(6,"p"),yl.EFF(7),yl.nI1(8,"i18n"),yl.k0s(),yl.j41(9,"bit-form-field",3)(10,"bit-label"),yl.EFF(11),yl.nI1(12,"i18n"),yl.k0s(),yl.nrm(13,"input",4),yl.j41(14,"bit-hint"),yl.EFF(15),yl.nI1(16,"i18n"),yl.k0s()()(),yl.qex(17,5),yl.j41(18,"button",6)(19,"span"),yl.EFF(20),yl.nI1(21,"i18n"),yl.k0s()(),yl.j41(22,"button",7)(23,"span"),yl.EFF(24),yl.nI1(25,"i18n"),yl.k0s()(),yl.bVm(),yl.k0s()()),2&e&&(yl.Y8G("formGroup",t.formGroup)("bitSubmit",t.submit),yl.R7$(3),yl.SpI(" ",yl.bMT(4,8,"lastPassMFARequired")," "),yl.R7$(4),yl.JRh(yl.bMT(8,10,t.descriptionI18nKey)),yl.R7$(4),yl.JRh(yl.bMT(12,12,"passcode")),yl.R7$(4),yl.JRh(yl.bMT(16,14,"confirmIdentity")),yl.R7$(5),yl.JRh(yl.bMT(21,16,"continue")),yl.R7$(4),yl.JRh(yl.bMT(25,18,"cancel")))},dependencies:[pl.MD,qf,hk,II,fl.X1,fl.qT,fl.me,fl.BC,fl.cb,fl.j4,fl.JD,dh,Zd,uh,Eu,Sc,nu,ou,Du,rc,xd,Td,Xu,Ku,_l,Xl,Xf],encapsulation:2});var hX=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 pX{constructor(e){this.dialogService=e}getOTPResult(e){return hX(this,void 0,void 0,function*(){const t=yield this.openMFADialog(e);return new KK(t,!1)})}getOOBResult(e){return hX(this,void 0,void 0,function*(){const t=yield this.openMFADialog(e);return new _K(!1,t,!1)})}openMFADialog(e){return this.mfaDialogRef=dX.open(this.dialogService,{variant:e}),(0,ho._)(this.mfaDialogRef.closed)}closeMFADialog(){var e;null===(e=this.mfaDialogRef)||void 0===e||e.close()}provideGoogleAuthPasscode(){return hX(this,void 0,void 0,function*(){return this.getOTPResult("otp")})}provideMicrosoftAuthPasscode(){return hX(this,void 0,void 0,function*(){return this.getOTPResult("otp")})}provideYubikeyPasscode(){return hX(this,void 0,void 0,function*(){return this.getOTPResult("yubikey")})}approveLastPassAuth(){return hX(this,void 0,void 0,function*(){return this.getOOBResult("oob")})}approveDuo(){return hX(this,void 0,void 0,function*(){return this.getOOBResult("oob")})}approveSalesforceAuth(){return hX(this,void 0,void 0,function*(){return this.getOOBResult("oob")})}}pX.ɵfac=function(e){return new(e||pX)(a.KVO(Jd))},pX.ɵprov=a.jDH({token:pX,factory:pX.ɵfac,providedIn:"root"});var fX=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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{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 go.B,this.ssoImportCallback$=this._ssoImportCallback$.asObservable(),this.vault=new cX(this.cryptoFunctionService),this.broadcasterService.subscribe("LastPassDirectImportService",e=>{this.ngZone.run(()=>fX(this,void 0,void 0,function*(){if("importCallbackLastPass"===e.command)this._ssoImportCallback$.next({oidcCode:e.code,oidcState:e.state})}))})}handleImport(e,t){return fX(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 uX.open(this.dialogService);return yield this.handleStandardImport(e,i,t)})}get isAccountFederated(){return this.vault.userType.isFederated()}verifyLastPassAccountExists(e){return fX(this,void 0,void 0,function*(){yield this.vault.setUserTypeContext(e)})}handleFederatedLogin(e){return fX(this,void 0,void 0,function*(){const t=(0,ho._)(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,ho._)(n.closed).then(e=>{throw Error("SSO auth cancelled")});return Promise.race([r,t]).finally(()=>{n.close()})})}createOidcSigninRequest(e){return fX(this,void 0,void 0,function*(){return this.oidcClient=new OK.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 fX(this,void 0,void 0,function*(){if(this.platformUtilsService.getClientType()===Ca.Desktop)return"bitwarden://import-callback-lp";return(yield(0,ho._)(this.environmentService.environment$)).getWebVaultUrl()+"/sso-connector.html?lp=1"})}handleStandardImport(e,t,i){return fX(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 fX(this,void 0,void 0,function*(){const n=yield this.oidcClient.processSigninResponse(this.getOidcRedirectUrlWithParams(e,t)),r=n.userState,s=new zK;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 fX(this,void 0,void 0,function*(){const t="lastpass"+(yield this.appIdService.getAppId())+e,i=yield this.cryptoFunctionService.hash(t,"sha256");return GK.createClientInfo(kd.fromBufferToHex(i))})}}vX.ɵfac=function(e){return new(e||vX)(a.KVO(cI),a.KVO(JS),a.KVO(ok),a.KVO(pX),a.KVO(Eb),a.KVO(rv),a.KVO(ak),a.KVO(yl.SKi),a.KVO(Jd),a.KVO(Pl))},vX.ɵprov=a.jDH({token:vX,factory:vX.ɵ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{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:[fl.k0.required,fl.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 yl.bkB}ngOnInit(){this._parentFormGroup=this.controlContainer.control,this._parentFormGroup.addControl("lastpassOptions",this.formGroup)}ngOnDestroy(){this._parentFormGroup.removeControl("lastpassOptions")}validateAndEmitData(){return()=>mX(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"}}}gX.ɵfac=function(e){return new(e||gX)(yl.rXU(fl.ok),yl.rXU(fl.ZU),yl.rXU(za),yl.rXU(vX),yl.rXU(Pl))},gX.ɵcmp=yl.VBU({type:gX,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&&(yl.j41(0,"div",0)(1,"bit-form-field")(2,"bit-label"),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s(),yl.nrm(5,"input",1),yl.j41(6,"bit-hint"),yl.EFF(7),yl.nI1(8,"async"),yl.k0s()(),yl.j41(9,"bit-form-control"),yl.nrm(10,"input",2),yl.j41(11,"bit-label"),yl.EFF(12),yl.nI1(13,"i18n"),yl.k0s()()()),2&e&&(yl.Y8G("formGroup",t.formGroup),yl.R7$(3),yl.JRh(yl.bMT(4,4,"lastPassEmail")),yl.R7$(4),yl.JRh(yl.bMT(8,6,t.emailHint$)),yl.R7$(5),yl.JRh(yl.bMT(13,8,"includeSharedFolders")))},dependencies:[pl.MD,qf,td,Xl,Eu,hc,Sc,nu,ou,Du,fl.X1,fl.me,fl.Zm,fl.BC,fl.cb,fl.j4,fl.JD,_l,id,Ub,pl.Jj,Xf],encapsulation:2});var yX=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 bX(e,t){1&e&&(yl.j41(0,"bit-callout",18),yl.nI1(1,"i18n"),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s()),2&e&&(yl.Y8G("title",yl.bMT(1,2,"restrictCardTypeImport")),yl.R7$(2),yl.SpI(" ",yl.bMT(3,4,"restrictCardTypeImportDesc"),"\n"))}function wX(e,t){1&e&&(yl.nrm(0,"bit-option",19),yl.nI1(1,"i18n")),2&e&&yl.Y8G("label",yl.bMT(1,1,"myVault"))}function SX(e,t){if(1&e&&yl.nrm(0,"bit-option",20),2&e){const e=t.$implicit;yl.Y8G("value",e.id)("label",e.name)}}function kX(e,t){if(1&e&&yl.nrm(0,"bit-option",23),2&e){const e=t.$implicit;yl.Y8G("value",e)("label",e.name)}}function IX(e,t){if(1&e&&(yl.qex(0),yl.nrm(1,"bit-option",21),yl.nI1(2,"i18n"),yl.DNE(3,kX,1,2,"bit-option",22),yl.nI1(4,"async"),yl.bVm()),2&e){const e=yl.XpG();yl.R7$(),yl.Y8G("label",yl.VkB("-- ",yl.bMT(2,4,"selectImportFolder")," --"))("value",null),yl.R7$(2),yl.Y8G("ngForOf",yl.bMT(4,6,e.folders$))}}function CX(e,t){if(1&e&&yl.nrm(0,"bit-option",25),2&e){const e=t.$implicit,i=yl.XpG(2);yl.Y8G("value",e)("label",e.name)("icon",e.type===i.DefaultCollectionType?"bwi-user":"bwi-collection-shared")}}function TX(e,t){if(1&e&&(yl.qex(0),yl.nrm(1,"bit-option",21),yl.nI1(2,"i18n"),yl.DNE(3,CX,1,3,"bit-option",24),yl.nI1(4,"async"),yl.bVm()),2&e){const e=yl.XpG();yl.R7$(),yl.Y8G("label",yl.VkB("-- ",yl.bMT(2,4,"selectImportCollection")," --"))("value",null),yl.R7$(2),yl.Y8G("ngForOf",yl.bMT(4,6,e.collections$))}}function PX(e,t){if(1&e&&yl.nrm(0,"bit-option",21),2&e){const e=t.$implicit;yl.Y8G("value",e.id)("label",e.name)}}function FX(e,t){if(1&e&&yl.nrm(0,"bit-option",21),2&e){const e=t.$implicit;yl.Y8G("value",e.id)("label",e.name)}}function RX(e,t){if(1&e&&(yl.qex(0),yl.nrm(1,"bit-option",26),yl.DNE(2,FX,1,2,"bit-option",15),yl.bVm()),2&e){const e=yl.XpG();yl.R7$(2),yl.Y8G("ngForOf",e.importOptions)}}function xX(e,t){1&e&&(yl.qex(0),yl.EFF(1," See detailed instructions on our help site at "),yl.j41(2,"a",27),yl.EFF(3," https://bitwarden.com/help/export-your-data/"),yl.k0s(),yl.bVm())}function AX(e,t){1&e&&(yl.j41(0,"bit-radio-group",31)(1,"bit-radio-button",32)(2,"bit-label"),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s()(),yl.j41(5,"bit-radio-button",33)(6,"bit-label"),yl.EFF(7),yl.nI1(8,"i18n"),yl.k0s()()()),2&e&&(yl.R7$(3),yl.JRh(yl.bMT(4,2,"importDirectlyFromLastPass")),yl.R7$(4),yl.JRh(yl.bMT(8,4,"importFromCSV")))}function DX(e,t){if(1&e&&(yl.qex(0),yl.j41(1,"p",28),yl.EFF(2),yl.nI1(3,"i18n"),yl.j41(4,"a",29),yl.EFF(5," https://bitwarden.com/help/import-from-lastpass/"),yl.k0s()(),yl.DNE(6,AX,9,6,"bit-radio-group",30),yl.bVm()),2&e){const e=yl.XpG(2);yl.R7$(2),yl.SpI(" ",yl.bMT(3,2,"seeDetailedInstructions")," "),yl.R7$(4),yl.Y8G("ngIf",e.showLastPassToggle)}}function EX(e,t){1&e&&(yl.qex(0),yl.EFF(1,' Using the KeePassX desktop application, navigate to "Database" → "Export to CSV file" and save the CSV file. '),yl.bVm())}function $X(e,t){1&e&&(yl.qex(0),yl.EFF(1,' In the Avira web vault, go to "Settings" → "My Data" → "Export data" and save the CSV file. '),yl.bVm())}function OX(e,t){1&e&&(yl.qex(0),yl.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". '),yl.bVm())}function UX(e,t){1&e&&(yl.qex(0),yl.EFF(1,' Using the SaveInCloud desktop application, navigate to "File" → "Export" → "As XML" and save the XML file. '),yl.bVm())}function MX(e,t){1&e&&(yl.qex(0),yl.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". '),yl.bVm())}function NX(e,t){1&e&&(yl.qex(0),yl.EFF(1,' Using the KeePass 2 desktop application, navigate to "File" → "Export" and select the "KeePass XML (2.x)" option. '),yl.bVm())}function VX(e,t){1&e&&(yl.qex(0),yl.EFF(1,' Using the Universal Password Manager desktop application, navigate to "Database" → "Export" and save the CSV file. '),yl.bVm())}function BX(e,t){1&e&&(yl.qex(0),yl.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. '),yl.bVm())}function jX(e,t){1&e&&(yl.qex(0),yl.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. '),yl.bVm())}function GX(e,t){1&e&&(yl.qex(0),yl.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. '),yl.bVm())}function LX(e,t){1&e&&(yl.j41(0,"span"),yl.EFF(1," The process is exactly the same as importing from Google Chrome. "),yl.k0s())}function zX(e,t){if(1&e&&(yl.qex(0),yl.DNE(1,LX,2,0,"span",10),yl.j41(2,"p"),yl.EFF(3," See detailed instructions on our help site at "),yl.j41(4,"a",34),yl.EFF(5," https://bitwarden.com/help/import-from-chrome/"),yl.k0s()(),yl.j41(6,"bit-radio-group",35),yl.nI1(7,"async"),yl.j41(8,"bit-radio-button",36)(9,"bit-label"),yl.EFF(10),yl.nI1(11,"i18n"),yl.k0s()(),yl.j41(12,"bit-radio-button",37)(13,"bit-label"),yl.EFF(14),yl.nI1(15,"i18n"),yl.k0s()()(),yl.bVm()),2&e){const e=yl.XpG(2);yl.R7$(),yl.Y8G("ngIf","chromecsv"!==e.format),yl.R7$(5),yl.Y8G("hidden",!yl.bMT(7,4,e.browserImporterAvailable$)),yl.R7$(4),yl.JRh(yl.bMT(11,6,"importDirectlyFromBrowser")),yl.R7$(4),yl.JRh(yl.bMT(15,8,"importFromCSV"))}}function _X(e,t){1&e&&(yl.qex(0),yl.EFF(1," See detailed instructions on our help site at "),yl.j41(2,"a",38),yl.EFF(3," https://bitwarden.com/help/import-from-firefox/"),yl.k0s(),yl.EFF(4,". "),yl.bVm())}function KX(e,t){1&e&&(yl.qex(0),yl.EFF(1," See detailed instructions on our help site at "),yl.j41(2,"a",39),yl.EFF(3," https://bitwarden.com/help/import-from-safari/"),yl.k0s(),yl.EFF(4,". "),yl.bVm())}function XX(e,t){1&e&&(yl.qex(0),yl.EFF(1," See detailed instructions on our help site at "),yl.j41(2,"a",40),yl.EFF(3," https://bitwarden.com/help/import-from-1password/"),yl.k0s(),yl.EFF(4,". "),yl.bVm())}function qX(e,t){1&e&&(yl.qex(0),yl.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. '),yl.bVm())}function YX(e,t){1&e&&(yl.qex(0),yl.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. '),yl.bVm())}function WX(e,t){1&e&&(yl.qex(0),yl.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. '),yl.bVm())}function HX(e,t){1&e&&(yl.qex(0),yl.EFF(1,' Using the Password Safe desktop application, navigate to "File" → "Export To" → "XML format..." and save the XML file. '),yl.bVm())}function JX(e,t){1&e&&(yl.qex(0),yl.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. '),yl.bVm())}function ZX(e,t){1&e&&(yl.qex(0),yl.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. "),yl.bVm())}function QX(e,t){1&e&&(yl.qex(0),yl.EFF(1,' Using the mSecure desktop application, navigate to "File" → "Export" → "CSV File..." and save the CSV file. '),yl.bVm())}function eq(e,t){1&e&&(yl.qex(0),yl.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. '),yl.bVm())}function tq(e,t){1&e&&(yl.qex(0),yl.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. '),yl.bVm())}function iq(e,t){1&e&&(yl.qex(0),yl.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. '),yl.bVm())}function nq(e,t){1&e&&(yl.qex(0),yl.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. '),yl.bVm())}function rq(e,t){1&e&&(yl.qex(0),yl.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. '),yl.bVm())}function sq(e,t){1&e&&(yl.qex(0),yl.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. '),yl.bVm())}function oq(e,t){1&e&&(yl.qex(0),yl.EFF(1,' Using the Password Boss desktop application, navigate to "File" → "Export data" → "Password Boss JSON - not encrypted" and save the JSON file. '),yl.bVm())}function aq(e,t){1&e&&(yl.qex(0),yl.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 '),yl.j41(2,"code"),yl.EFF(3,"zoho_export.csv"),yl.k0s(),yl.EFF(4,". "),yl.bVm())}function lq(e,t){1&e&&(yl.qex(0),yl.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. '),yl.bVm())}function cq(e,t){1&e&&(yl.qex(0),yl.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. '),yl.bVm())}function uq(e,t){1&e&&(yl.qex(0),yl.EFF(1," Make sure you have python-keyring and python-gnomekeyring installed. Save the "),yl.j41(2,"a",41),yl.EFF(3,"GNOME Keyring Import/Export"),yl.k0s(),yl.EFF(4," python script to your desktop as "),yl.j41(5,"code"),yl.EFF(6,"pw_helper.py"),yl.k0s(),yl.EFF(7,". Open terminal and run "),yl.j41(8,"code"),yl.EFF(9,"chmod +rx Desktop/pw_helper.py"),yl.k0s(),yl.EFF(10," and then "),yl.j41(11,"code"),yl.EFF(12,"python Desktop/pw_helper.py export Desktop/my_passwords.json"),yl.k0s(),yl.EFF(13,". Then upload the resulting "),yl.j41(14,"code"),yl.EFF(15,"my_passwords.json"),yl.k0s(),yl.EFF(16," file here to Bitwarden. "),yl.bVm())}function dq(e,t){1&e&&(yl.qex(0),yl.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. '),yl.bVm())}function hq(e,t){1&e&&(yl.qex(0),yl.EFF(1,' Log into the Passpack website vault and navigate to "Settings" → "Export", then click the "Download" button to save the CSV file. '),yl.bVm())}function pq(e,t){1&e&&(yl.qex(0),yl.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. '),yl.bVm())}function fq(e,t){1&e&&(yl.qex(0),yl.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. '),yl.bVm())}function vq(e,t){1&e&&(yl.qex(0),yl.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. '),yl.bVm())}function mq(e,t){1&e&&(yl.qex(0),yl.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. '),yl.bVm())}function gq(e,t){1&e&&(yl.qex(0),yl.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. '),yl.bVm())}function yq(e,t){1&e&&(yl.qex(0),yl.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. '),yl.bVm())}function bq(e,t){1&e&&(yl.qex(0),yl.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. '),yl.bVm())}function wq(e,t){1&e&&(yl.qex(0),yl.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. '),yl.bVm())}function Sq(e,t){1&e&&(yl.qex(0),yl.EFF(1," Export your SecureSafe password safe to a CSV file with a comma delimiter. "),yl.bVm())}function kq(e,t){1&e&&(yl.qex(0),yl.EFF(1,' Open the LogMeOnce browser extension, then navigate to "Open Menu" → "Export To" and select "CSV File" to save the CSV file. '),yl.bVm())}function Iq(e,t){1&e&&(yl.qex(0),yl.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. '),yl.bVm())}function Cq(e,t){1&e&&(yl.qex(0),yl.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. '),yl.bVm())}function Tq(e,t){1&e&&(yl.qex(0),yl.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. '),yl.bVm())}function Pq(e,t){1&e&&(yl.qex(0),yl.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. "),yl.bVm())}function Fq(e,t){1&e&&(yl.qex(0),yl.EFF(1,' From the Yoti browser extension, click on "Settings", then "Export Saved Logins" and save the CSV file. '),yl.bVm())}function Rq(e,t){1&e&&(yl.qex(0),yl.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. '),yl.bVm())}function xq(e,t){1&e&&(yl.qex(0),yl.EFF(1,' Log in to "https://vault.passky.org" → "Import & Export" → "Export" in the Passky section. ("Backup" is unsupported as it is encrypted). '),yl.bVm())}function Aq(e,t){1&e&&(yl.qex(0),yl.EFF(1," In the ProtonPass browser extension, go to Settings > Export. Export without PGP encryption and save the zip file. "),yl.bVm())}function Dq(e,t){1&e&&(yl.qex(0),yl.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. "),yl.bVm())}function Eq(e,t){1&e&&(yl.qex(0),yl.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. "),yl.bVm())}function $q(e,t){1&e&&(yl.qex(0),yl.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. "),yl.bVm())}function Oq(e,t){1&e&&(yl.qex(0),yl.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. "),yl.bVm())}function Uq(e,t){if(1&e&&(yl.j41(0,"bit-callout",18),yl.DNE(1,xX,4,0,"ng-container",10)(2,DX,7,4,"ng-container",10)(3,EX,2,0,"ng-container",10)(4,$X,2,0,"ng-container",10)(5,OX,2,0,"ng-container",10)(6,UX,2,0,"ng-container",10)(7,MX,2,0,"ng-container",10)(8,NX,2,0,"ng-container",10)(9,VX,2,0,"ng-container",10)(10,BX,2,0,"ng-container",10)(11,jX,2,0,"ng-container",10)(12,GX,2,0,"ng-container",10)(13,zX,16,10,"ng-container",10),yl.nI1(14,"async"),yl.DNE(15,_X,5,0,"ng-container",10)(16,KX,5,0,"ng-container",10)(17,XX,5,0,"ng-container",10)(18,qX,2,0,"ng-container",10)(19,YX,2,0,"ng-container",10)(20,WX,2,0,"ng-container",10)(21,HX,2,0,"ng-container",10)(22,JX,2,0,"ng-container",10)(23,ZX,2,0,"ng-container",10)(24,QX,2,0,"ng-container",10)(25,eq,2,0,"ng-container",10)(26,tq,2,0,"ng-container",10)(27,iq,2,0,"ng-container",10)(28,nq,2,0,"ng-container",10)(29,rq,2,0,"ng-container",10)(30,sq,2,0,"ng-container",10)(31,oq,2,0,"ng-container",10)(32,aq,5,0,"ng-container",10)(33,lq,2,0,"ng-container",10)(34,cq,2,0,"ng-container",10)(35,uq,17,0,"ng-container",10)(36,dq,2,0,"ng-container",10)(37,hq,2,0,"ng-container",10)(38,pq,2,0,"ng-container",10)(39,fq,2,0,"ng-container",10)(40,vq,2,0,"ng-container",10)(41,mq,2,0,"ng-container",10)(42,gq,2,0,"ng-container",10)(43,yq,2,0,"ng-container",10)(44,bq,2,0,"ng-container",10)(45,wq,2,0,"ng-container",10)(46,Sq,2,0,"ng-container",10)(47,kq,2,0,"ng-container",10)(48,Iq,2,0,"ng-container",10)(49,Cq,2,0,"ng-container",10)(50,Tq,2,0,"ng-container",10)(51,Pq,2,0,"ng-container",10)(52,Fq,2,0,"ng-container",10)(53,Rq,2,0,"ng-container",10)(54,xq,2,0,"ng-container",10)(55,Aq,2,0,"ng-container",10)(56,Dq,2,0,"ng-container",10)(57,Eq,2,0,"ng-container",10)(58,$q,2,0,"ng-container",10)(59,Oq,2,0,"ng-container",10),yl.k0s()),2&e){const e=yl.XpG();yl.Y8G("title",yl.mNQ(e.getFormatInstructionTitle())),yl.R7$(),yl.Y8G("ngIf","bitwardencsv"===e.format||"bitwardenjson"===e.format),yl.R7$(),yl.Y8G("ngIf","lastpasscsv"===e.format),yl.R7$(),yl.Y8G("ngIf","keepassxcsv"===e.format),yl.R7$(),yl.Y8G("ngIf","aviracsv"===e.format),yl.R7$(),yl.Y8G("ngIf","blurcsv"===e.format),yl.R7$(),yl.Y8G("ngIf","safeincloudxml"===e.format),yl.R7$(),yl.Y8G("ngIf","padlockcsv"===e.format),yl.R7$(),yl.Y8G("ngIf","keepass2xml"===e.format),yl.R7$(),yl.Y8G("ngIf","upmcsv"===e.format),yl.R7$(),yl.Y8G("ngIf","saferpasscsv"===e.format),yl.R7$(),yl.Y8G("ngIf","meldiumcsv"===e.format),yl.R7$(),yl.Y8G("ngIf","keepercsv"===e.format),yl.R7$(),yl.Y8G("ngIf",yl.bMT(14,60,e.showChromiumInstructions$)),yl.R7$(2),yl.Y8G("ngIf","firefoxcsv"===e.format),yl.R7$(),yl.Y8G("ngIf","safaricsv"===e.format),yl.R7$(),yl.Y8G("ngIf","1password1pux"===e.format||"1password1pif"===e.format||"1passwordwincsv"===e.format||"1passwordmaccsv"===e.format),yl.R7$(),yl.Y8G("ngIf","passworddragonxml"===e.format),yl.R7$(),yl.Y8G("ngIf","enpasscsv"===e.format),yl.R7$(),yl.Y8G("ngIf","enpassjson"===e.format),yl.R7$(),yl.Y8G("ngIf","pwsafexml"===e.format),yl.R7$(),yl.Y8G("ngIf","dashlanecsv"===e.format),yl.R7$(),yl.Y8G("ngIf","dashlanejson"===e.format),yl.R7$(),yl.Y8G("ngIf","msecurecsv"===e.format),yl.R7$(),yl.Y8G("ngIf","stickypasswordxml"===e.format),yl.R7$(),yl.Y8G("ngIf","truekeycsv"===e.format),yl.R7$(),yl.Y8G("ngIf","clipperzhtml"===e.format),yl.R7$(),yl.Y8G("ngIf","roboformcsv"===e.format),yl.R7$(),yl.Y8G("ngIf","passboltcsv"===e.format),yl.R7$(),yl.Y8G("ngIf","ascendocsv"===e.format),yl.R7$(),yl.Y8G("ngIf","passwordbossjson"===e.format),yl.R7$(),yl.Y8G("ngIf","zohovaultcsv"===e.format),yl.R7$(),yl.Y8G("ngIf","splashidcsv"===e.format),yl.R7$(),yl.Y8G("ngIf","passkeepcsv"===e.format),yl.R7$(),yl.Y8G("ngIf","gnomejson"===e.format),yl.R7$(),yl.Y8G("ngIf","passwordagentcsv"===e.format),yl.R7$(),yl.Y8G("ngIf","passpackcsv"===e.format),yl.R7$(),yl.Y8G("ngIf","passmanjson"===e.format),yl.R7$(),yl.Y8G("ngIf","avastcsv"===e.format),yl.R7$(),yl.Y8G("ngIf","avastjson"===e.format),yl.R7$(),yl.Y8G("ngIf","fsecurefsk"===e.format),yl.R7$(),yl.Y8G("ngIf","kasperskytxt"===e.format),yl.R7$(),yl.Y8G("ngIf","remembearcsv"===e.format),yl.R7$(),yl.Y8G("ngIf","passwordwallettxt"===e.format),yl.R7$(),yl.Y8G("ngIf","mykicsv"===e.format),yl.R7$(),yl.Y8G("ngIf","securesafecsv"===e.format),yl.R7$(),yl.Y8G("ngIf","logmeoncecsv"===e.format),yl.R7$(),yl.Y8G("ngIf","blackberrycsv"===e.format),yl.R7$(),yl.Y8G("ngIf","buttercupcsv"===e.format),yl.R7$(),yl.Y8G("ngIf","codebookcsv"===e.format),yl.R7$(),yl.Y8G("ngIf","encryptrcsv"===e.format),yl.R7$(),yl.Y8G("ngIf","yoticsv"===e.format),yl.R7$(),yl.Y8G("ngIf","psonojson"===e.format),yl.R7$(),yl.Y8G("ngIf","passkyjson"===e.format),yl.R7$(),yl.Y8G("ngIf","protonpass"===e.format),yl.R7$(),yl.Y8G("ngIf","passwordxpcsv"===e.format),yl.R7$(),yl.Y8G("ngIf","netwrixpasswordsecure"===e.format),yl.R7$(),yl.Y8G("ngIf","nordpasscsv"===e.format),yl.R7$(),yl.Y8G("ngIf","passworddepot17xml"===e.format)}}function Mq(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"import-lastpass",42),yl.bIt("csvDataLoaded",function(t){a.eBV(e);const i=yl.XpG();return a.Njj(i.formGroup.controls.fileContents.setValue(t))}),yl.k0s()}if(2&e){const e=yl.XpG();yl.Y8G("formGroup",e.formGroup)}}function Nq(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"import-chrome",43),yl.bIt("csvDataLoaded",function(t){a.eBV(e);const i=yl.XpG();return a.Njj(i.formGroup.controls.fileContents.setValue(t))}),yl.k0s()}if(2&e){const e=yl.XpG();yl.Y8G("formGroup",e.formGroup)("onImportFromBrowser",e.onImportFromBrowser)("onLoadProfilesFromBrowser",e.onLoadProfilesFromBrowser)("format",e.format)}}function Vq(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"bit-form-field")(1,"bit-label"),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.j41(4,"div",44)(5,"button",45),yl.bIt("click",function(){a.eBV(e);const t=yl.sdS(11);return a.Njj(t.click())}),yl.EFF(6),yl.nI1(7,"i18n"),yl.k0s(),yl.EFF(8),yl.nI1(9,"i18n"),yl.k0s(),yl.j41(10,"input",46,0),yl.bIt("change",function(t){a.eBV(e);const i=yl.XpG();return a.Njj(i.setSelectedFile(t))}),yl.k0s()(),yl.j41(12,"bit-form-field",8)(13,"bit-label"),yl.EFF(14),yl.nI1(15,"i18n"),yl.k0s(),yl.nrm(16,"textarea",47),yl.k0s()}if(2&e){const e=yl.XpG();yl.R7$(2),yl.JRh(yl.bMT(3,4,"selectImportFile")),yl.R7$(4),yl.SpI(" ",yl.bMT(7,6,"chooseFile")," "),yl.R7$(2),yl.SpI(" ",e.fileSelected?e.fileSelected.name:yl.bMT(9,8,"noFileChosen")," "),yl.R7$(6),yl.JRh(yl.bMT(15,10,"orCopyPasteFileContents"))}}class Bq{get organizationId(){return this._organizationId}set organizationId(e){return kd.isNullOrEmpty(e)?(this._organizationId=void 0,void(this.organization=void 0)):Fz(e)?(this._organizationId=e,void Gp(this.accountService.activeAccount$).pipe((0,co.n)(t=>this.organizationService.organizations$(t).pipe(QE(e)))).pipe((0,Jv.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,Jv.Q)(this.destroy$)).subscribe(e=>{this.formLoading.emit(e)}),this.bitSubmit.disabled$.pipe((0,Jv.Q)(this.destroy$)).subscribe(e=>{this.formDisabled.emit(e)})}constructor(e,t,i,n,r,s,o,a,c,u,d,h,p,f,v,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=f,this.restrictedItemTypesService=v,this.destroyRef=m,this.importMetadataService=g,this.DefaultCollectionType=LF,this.format=null,this.organization=void 0,this.destroy$=new go.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:[fl.k0.required]}],targetSelector:[null],format:[null,[fl.k0.required]],fileContents:[],file:[],lastPassType:["direct"],chromiumLoader:[wK.file]}),this.formLoading=new yl.bkB,this.formDisabled=new yl.bkB,this.onSuccessfulImport=new yl.bkB,this.importer$=new fd.t(void 0),this.showChromiumInstructions$=this.importer$.pipe((0,l.T)(e=>(null==e?void 0:e.instructions)===SK.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(wK.chromium)})),this.showChromiumOptions$=this.formGroup.controls.chromiumLoader.valueChanges.pipe((0,l.T)(e=>e===wK.chromium)),this.submit=()=>yX(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()===Ca.Desktop||this.platformUtilsService.getClientType()===Ca.Browser)}get showLastPassOptions(){return this.showLastPassToggle&&"direct"===this.formGroup.controls.lastPassType.value}ngOnInit(){return yX(this,void 0,void 0,function*(){yield this.importMetadataService.init(),this.setImportOptions(),this.importMetadataService.metadata$(this.formGroup.controls.format.valueChanges).pipe((0,wl.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(wK.chromium))?wK.chromium:null===(i=e.loaders)||void 0===i?void 0:i[0];this.formGroup.controls.chromiumLoader.setValue(null!=n?n:wK.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,Jv.Q)(this.destroy$)).subscribe(e=>{this.format=e}),yield this.handlePolicies()})}handleOrganizationImportInit(){return yX(this,void 0,void 0,function*(){const e=yield(0,ho._)(Gp(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$=kd.asyncToObservable(()=>this.importCollectionService.getAllAdminCollections(this.organizationId,e).then(e=>e.sort(kd.getSortFunction(this.i18nService,"name")))),this.isFromAC=!0})}handleImportInit(){return yX(this,void 0,void 0,function*(){this.folders$=this.activeUserId$.pipe((0,co.n)(e=>this.folderService.folderViews$(e)),(0,l.T)(e=>e.filter(e=>null!=e.id))),this.formGroup.controls.targetSelector.disable();const e=yield(0,ho._)(Gp(this.accountService.activeAccount$));this.organizations$=this.organizationService.memberOrganizations$(e).pipe((0,Op.v)(this.collectionService.decryptedCollections$(e)),(0,l.T)(([e,t])=>e.filter(e=>t.some(t=>t.organizationId===e.id&&t.manage)).sort(kd.getSortFunction(this.i18nService,"name")))),(0,$o.z)([this.formGroup.controls.vaultSelector.valueChanges,this.organizations$]).pipe((0,Jv.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(kd.getSortFunction(this.i18nService,"name")))))}),this.formGroup.controls.vaultSelector.setValue("myVault")})}handlePolicies(){return yX(this,void 0,void 0,function*(){(0,$o.z)([this.accountService.activeAccount$.pipe(Gp,(0,co.n)(e=>this.policyService.policyAppliesToUser$(_h.OrganizationDataOwnership,e))),this.organizations$]).pipe((0,Jv.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 yX(this,void 0,void 0,function*(){this.formGroup.pending&&(yield(0,ho._)(this.formGroup.statusChanges.pipe((0,To.p)(e=>"PENDING"!==e))))})}performImport(){return yX(this,void 0,void 0,function*(){var e;if(!(yield this.validateImport()))return;const t=this.importService.getImporter(this.format,()=>yX(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(GL,{data:n}),this.syncService.fullSync(!0),this.onSuccessfulImport.emit(this._organizationId)}catch(e){this.dialogService.open(VL,{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 xK).loadAsync(e).then(e=>e.file(t).async("string")).then(function(e){return e},function(e){return""})}getFilePassword(){return yX(this,void 0,void 0,function*(){const e=this.dialogService.open(LL,{ariaModal:!0});return yield(0,dT.s)(e.closed)})}validateImport(){return yX(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 yX(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()}}Bq.ɵfac=function(e){return new(e||Bq)(yl.rXU(Pl),yl.rXU(JL),yl.rXU(Eb),yl.rXU($b),yl.rXU(za),yl.rXU(ux),yl.rXU(Jd),yl.rXU(qU),yl.rXU(AF),yl.rXU(BF),yl.rXU(fl.ok),yl.rXU(PK,8),yl.rXU(xb),yl.rXU(Ok),yl.rXU(vE),yl.rXU(a.abz),yl.rXU(bK))},Bq.ɵcmp=yl.VBU({type:Bq,selectors:[["tools-import"]],viewQuery:function(e,t){if(1&e&&yl.GBs(Td,5),2&e){let e;yl.mGM(e=yl.lsd())&&(t.bitSubmit=e.first)}},inputs:{organizationId:"organizationId",onLoadProfilesFromBrowser:"onLoadProfilesFromBrowser",onImportFromBrowser:"onImportFromBrowser"},outputs:{formLoading:"formLoading",formDisabled:"formDisabled",onSuccessfulImport:"onSuccessfulImport"},features:[yl.Jv_(RK)],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&&(yl.DNE(0,bX,4,6,"bit-callout",1),yl.nI1(1,"async"),yl.j41(2,"form",2)(3,"bit-section")(4,"bit-section-header")(5,"h2",3),yl.EFF(6),yl.nI1(7,"i18n"),yl.k0s()(),yl.j41(8,"bit-card")(9,"bit-form-field",4)(10,"bit-label"),yl.EFF(11),yl.nI1(12,"i18n"),yl.k0s(),yl.j41(13,"bit-select",5),yl.DNE(14,wX,2,3,"bit-option",6)(15,SX,1,2,"bit-option",7),yl.nI1(16,"async"),yl.k0s()(),yl.j41(17,"bit-form-field",8)(18,"bit-label"),yl.EFF(19),yl.nI1(20,"i18n"),yl.nI1(21,"i18n"),yl.k0s(),yl.j41(22,"bit-select",9),yl.DNE(23,IX,5,8,"ng-container",10)(24,TX,5,8,"ng-container",10),yl.k0s(),yl.j41(25,"bit-hint"),yl.EFF(26),yl.nI1(27,"i18n"),yl.nI1(28,"i18n"),yl.k0s()()()(),yl.j41(29,"bit-section")(30,"bit-section-header")(31,"h2",3),yl.EFF(32),yl.nI1(33,"i18n"),yl.k0s()(),yl.j41(34,"bit-card")(35,"bit-form-field",11)(36,"bit-label"),yl.EFF(37),yl.nI1(38,"i18n"),yl.k0s(),yl.j41(39,"bit-select",12),yl.nrm(40,"bit-option",13),yl.nI1(41,"i18n"),yl.nrm(42,"bit-option",14),yl.nI1(43,"i18n"),yl.DNE(44,PX,1,2,"bit-option",15)(45,RX,3,1,"ng-container",10),yl.k0s()(),yl.DNE(46,Uq,60,62,"bit-callout",1),yl.nVh(47,Mq,1,1,"import-lastpass",16),yl.nI1(48,"async"),yl.vZN(49,Nq,1,4,"import-chrome",17)(50,Vq,17,12),yl.k0s()()()),2&e&&(yl.Y8G("ngIf",yl.bMT(1,22,t.isCardTypeRestricted$)),yl.R7$(2),yl.Y8G("formGroup",t.formGroup)("bitSubmit",t.submit),yl.R7$(4),yl.JRh(yl.bMT(7,24,"destination")),yl.R7$(3),yl.Y8G("hidden",t.isFromAC),yl.R7$(2),yl.JRh(yl.bMT(12,26,"vault")),yl.R7$(3),yl.Y8G("ngIf",!t.importBlockedByPolicy),yl.R7$(),yl.Y8G("ngForOf",yl.bMT(16,28,t.organizations$)),yl.R7$(4),yl.JRh(t.organizationId?yl.bMT(20,30,"collection"):yl.bMT(21,32,"folder")),yl.R7$(4),yl.Y8G("ngIf",!t.organizationId),yl.R7$(),yl.Y8G("ngIf",t.organizationId),yl.R7$(2),yl.JRh(t.organizationId?yl.bMT(27,34,"importTargetHintCollection"):yl.bMT(28,36,"importTargetHintFolder")),yl.R7$(6),yl.JRh(yl.bMT(33,38,"data")),yl.R7$(5),yl.JRh(yl.bMT(38,40,"fileFormat")),yl.R7$(3),yl.Y8G("label",yl.VkB("-- ",yl.bMT(41,42,"select")," --")),yl.R7$(2),yl.Y8G("label",yl.mNQ(yl.bMT(43,44,"commonImportFormats"))),yl.R7$(2),yl.Y8G("ngForOf",t.featuredImportOptions),yl.R7$(),yl.Y8G("ngIf",t.importOptions&&t.importOptions.length),yl.R7$(),yl.Y8G("ngIf",t.format),yl.R7$(),yl.vxM(t.showLastPassOptions?47:yl.bMT(48,46,t.showChromiumOptions$)?49:50))},dependencies:[pl.MD,pl.Sq,pl.bT,qf,Eu,Sc,nu,ou,Du,rc,Td,Xu,Ku,_l,Bu,Vu,Ou,td,ed,fl.X1,fl.qT,fl.me,fl.BC,fl.cb,fl.j4,fl.JD,EK,gX,Nc,Mc,$c,WR,ex,ZR,Oh,_b,pl.Jj,Xf],encapsulation:2});var jq=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 Gq{constructor(e,t,i,n){this.dialogService=e,this.toastService=t,this.platformUtilsService=i,this.i18nService=n}importSshKeyFromClipboard(){return jq(this,void 0,void 0,function*(){const e=yield this.platformUtilsService.readFromClipboard();let t=!1,i=null;try{i=(0,A$.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,A$.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 wM(new Ax({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 jq(this,void 0,void 0,function*(){const e=this.dialogService.open(zL,{ariaModal:!0});return yield(0,ho._)(e.closed)})}}Gq.ɵfac=function(e){return new(e||Gq)(a.KVO(Jd),a.KVO(xb),a.KVO(Eb),a.KVO(Pl))},Gq.ɵprov=a.jDH({token:Gq,factory:Gq.ɵfac});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.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._transferInProgressSubject=new fd.t(!1),this.transferInProgress$=this._transferInProgressSubject.asObservable()}enforcingOrganization$(e){return this.policyService.policiesByType$(_h.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,co.n)(t=>null==t?(0,Oo.of)(void 0):this.organizationService.organizations$(e).pipe(QE(t.organizationId))))}personalCiphers$(e){return this.cipherService.cipherViews$(e).pipe(CE(),(0,l.T)(e=>e.filter(e=>null==e.organizationId)))}userMigrationInfo$(e){return this.enforcingOrganization$(e).pipe((0,co.n)(t=>null==t?(0,Oo.of)({requiresMigration:!1}):(0,$o.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 zq(this,void 0,void 0,function*(){const t=AL.open(this.dialogService,{data:{organizationName:e}});if((yield(0,ho._)(t.closed))===xL.Accepted)return!0;const i=EL.open(this.dialogService,{data:{organizationName:e}});return(yield(0,ho._)(i.closed))===DL.Back&&this.promptUserForTransfer(e)})}enforceOrganizationDataOwnership(e){return zq(this,void 0,void 0,function*(){if(!(yield this.configService.getFeatureFlag(Nf.MigrateMyVaultToMyItems)))return;const t=yield(0,ho._)(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");if(yield this.promptUserForTransfer(t.enforcingOrganization.name))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(Ra.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")})}else yield this.eventCollectionService.collect(Ra.Organization_ItemOrganization_Declined,void 0,void 0,t.enforcingOrganization.id)})}transferPersonalItems(e,t,i){return zq(this,void 0,void 0,function*(){let n=yield(0,ho._)(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,ho._)(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 zq(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}`)})}}_q.ɵfac=function(e){return new(e||_q)(a.KVO(Fb),a.KVO($b),a.KVO(AF),a.KVO(BF),a.KVO(za),a.KVO(Pl),a.KVO(Jd),a.KVO(xb),a.KVO(OE),a.KVO(uk))},_q.ɵprov=a.jDH({token:_q,factory:_q.ɵfac});class Kq extends Uw{constructor(e){super(e),this.uri=this.getResponseProperty("uri")}}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{constructor(e,t,i){this.apiService=e,this.environmentService=t,this.domainSettingsService=i}getChangePasswordUrl(e){return Xq(this,void 0,void 0,function*(){if(e.type!==CR.Login||null==e.login||!e.login.hasUris)return null;const t=e.login.uris.map(e=>kd.getUrl(e.uri)).filter(e=>null!=e&&("http:"===e.protocol||"https:"===e.protocol));if(0===t.length)return null;if(!(yield(0,ho._)(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 Xq(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 Kq(n);return r})}buildChangePasswordUriRequest(e){return Xq(this,void 0,void 0,function*(){const t=new URLSearchParams;t.set("uri",e);const i=(yield(0,ho._)(this.environmentService.environment$)).getIconsUrl(),n=new URL(`${i}/change-password-uri?${t.toString()}`);return new Request(n,{method:"GET"})})}}qq.ɵfac=function(e){return new(e||qq)(a.KVO(Mk),a.KVO(JS),a.KVO(oE))},qq.ɵprov=a.jDH({token:qq,factory:qq.ɵfac});var Yq=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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,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 Yq(this,void 0,void 0,function*(){if(!(yield this.passwordRepromptService.passwordRepromptCheck(e)))return;if(!(yield this.dialogService.openSimpleDialog({title:{key:"archiveItem"},content:{key:"archiveItemConfirmDesc"},type:"info"})))return;const t=yield(0,ho._)(this.accountService.activeAccount$.pipe(Gp));yield this.cipherArchiveService.archiveWithServer(e.id,t).then(()=>{this.toastService.showToast({variant:"success",message:this.i18nService.t("itemWasSentToArchive")})}).catch(()=>{this.toastService.showToast({variant:"error",message:this.i18nService.t("errorOccurred")})})})}unarchiveCipher(e){return Yq(this,void 0,void 0,function*(){const t=yield(0,ho._)(this.accountService.activeAccount$.pipe(Gp));yield this.cipherArchiveService.unarchiveWithServer(e.id,t).then(()=>{this.toastService.showToast({variant:"success",message:this.i18nService.t("itemWasUnarchived")})}).catch(()=>{this.toastService.showToast({variant:"error",message:this.i18nService.t("errorOccurred")})})})}}Wq.ɵfac=function(e){return new(e||Wq)(a.KVO(BV),a.KVO(Jd),a.KVO($E),a.KVO(xb),a.KVO(Pl),a.KVO(Ok))},Wq.ɵprov=a.jDH({token:Wq,factory:Wq.ɵfac,providedIn:"root"});var Hq=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 Jq{constructor(){this._defaultBrowserAutofillDisabled$=new fd.t(!1),this.defaultBrowserAutofillDisabled$=this._defaultBrowserAutofillDisabled$.asObservable()}isBrowserAutofillSettingOverridden(e){return Hq(this,void 0,void 0,function*(){return e!==wa&&(yield tl.browserAutofillSettingsOverridden())})}setDefaultBrowserAutofillDisabled(e){this._defaultBrowserAutofillDisabled$.next(e)}}Jq.ɵfac=function(e){return new(e||Jq)},Jq.ɵprov=a.jDH({token:Jq,factory:Jq.ɵfac,providedIn:"root"});class Zq{}var Qq=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 eY(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"div",38)(1,"bit-spotlight",39),yl.nI1(2,"i18n"),yl.nI1(3,"i18n"),yl.bIt("onDismiss",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.dismissSpotlight())})("onButtonClick",function(t){a.eBV(e);const i=yl.XpG();return a.Njj(i.disableBrowserAutofillSettingsFromNudge(t))}),yl.k0s()()}if(2&e){const e=yl.XpG();yl.R7$(),yl.Y8G("title",yl.bMT(2,4,"autofillSpotlightTitle"))("subtitle",yl.bMT(3,6,"autofillSpotlightDesc"))("buttonText",e.spotlightButtonText)("buttonIcon",e.spotlightButtonIcon)}}function tY(e,t){1&e&&(yl.j41(0,"bit-hint",27),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()),2&e&&(yl.R7$(),yl.SpI(" ",yl.bMT(2,1,"showInlineMenuOnFormFieldsDescAlt")," "))}function iY(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"bit-hint"),yl.EFF(1),yl.nI1(2,"i18n"),yl.j41(3,"a",40),yl.bIt("click",function(t){a.eBV(e);const i=yl.XpG();return a.Njj(i.openURI(t,i.disablePasswordManagerURI))}),yl.EFF(4),yl.nI1(5,"i18n"),yl.k0s()()}if(2&e){const e=yl.XpG();yl.HbH(e.enableInlineMenu?"tw-text-sm":"tw-text-sm tw-mb-6"),yl.R7$(),yl.SpI(" ",yl.bMT(2,5,"turnOffBrowserBuiltInPasswordManagerSettings")," "),yl.R7$(2),yl.BMQ("href",e.disablePasswordManagerURI,yl.B4B),yl.R7$(),yl.SpI(" ",yl.bMT(5,7,"turnOffBrowserBuiltInPasswordManagerSettingsLink")," ")}}function nY(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"bit-form-control",41)(1,"input",42),yl.bIt("change",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.updateShowInlineMenuIdentities())}),yl.mxI("ngModelChange",function(t){a.eBV(e);const i=yl.XpG();return yl.DH7(i.showInlineMenuIdentities,t)||(i.showInlineMenuIdentities=t),a.Njj(t)}),yl.k0s(),yl.j41(2,"bit-label",43),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s()()}if(2&e){const e=yl.XpG();yl.R7$(),yl.R50("ngModel",e.showInlineMenuIdentities),yl.R7$(2),yl.SpI(" ",yl.bMT(4,2,"showInlineMenuIdentitiesLabel")," ")}}function rY(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"bit-form-control",41)(1,"input",44),yl.bIt("change",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.updateShowInlineMenuCards())}),yl.mxI("ngModelChange",function(t){a.eBV(e);const i=yl.XpG();return yl.DH7(i.showInlineMenuCards,t)||(i.showInlineMenuCards=t),a.Njj(t)}),yl.k0s(),yl.j41(2,"bit-label",45),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s()()}if(2&e){const e=yl.XpG();yl.R7$(),yl.R50("ngModel",e.showInlineMenuCards),yl.R7$(2),yl.SpI(" ",yl.bMT(4,2,"showInlineMenuCardsLabel")," ")}}function sY(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"bit-form-control",41)(1,"input",46),yl.bIt("change",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.updateInlineMenuVisibility())}),yl.mxI("ngModelChange",function(t){a.eBV(e);const i=yl.XpG();return yl.DH7(i.enableInlineMenuOnIconSelect,t)||(i.enableInlineMenuOnIconSelect=t),a.Njj(t)}),yl.k0s(),yl.j41(2,"bit-label",47),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s()()}if(2&e){const e=yl.XpG();yl.R7$(),yl.R50("ngModel",e.enableInlineMenuOnIconSelect),yl.R7$(2),yl.SpI(" ",yl.bMT(4,2,"showInlineMenuOnIconSelectionLabel")," ")}}function oY(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"bit-form-control")(1,"input",48),yl.bIt("change",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.updateDefaultBrowserAutofillDisabled())}),yl.mxI("ngModelChange",function(t){a.eBV(e);const i=yl.XpG();return yl.DH7(i.defaultBrowserAutofillDisabled,t)||(i.defaultBrowserAutofillDisabled=t),a.Njj(t)}),yl.k0s(),yl.j41(2,"bit-label",49),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s(),yl.j41(5,"bit-hint",27),yl.EFF(6),yl.nI1(7,"i18n"),yl.j41(8,"a",40),yl.bIt("click",function(t){a.eBV(e);const i=yl.XpG();return a.Njj(i.openURI(t,i.disablePasswordManagerURI))}),yl.EFF(9),yl.nI1(10,"i18n"),yl.k0s()()()}if(2&e){const e=yl.XpG();yl.R7$(),yl.R50("ngModel",e.defaultBrowserAutofillDisabled),yl.R7$(2),yl.JRh(yl.bMT(4,5,"overrideDefaultBrowserAutoFillSettings")),yl.R7$(3),yl.SpI(" ",yl.bMT(7,7,"turnOffBrowserBuiltInPasswordManagerSettings")," "),yl.R7$(2),yl.BMQ("href",e.disablePasswordManagerURI,yl.B4B),yl.R7$(),yl.SpI(" ",yl.bMT(10,9,"turnOffBrowserBuiltInPasswordManagerSettingsLink")," ")}}function aY(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"bit-form-control")(1,"input",50),yl.bIt("change",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.updateShowCardsCurrentTab())}),yl.mxI("ngModelChange",function(t){a.eBV(e);const i=yl.XpG();return yl.DH7(i.showCardsCurrentTab,t)||(i.showCardsCurrentTab=t),a.Njj(t)}),yl.k0s(),yl.j41(2,"bit-label",51),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s()()}if(2&e){const e=yl.XpG();yl.R7$(),yl.R50("ngModel",e.showCardsCurrentTab),yl.R7$(2),yl.JRh(yl.bMT(4,2,"showCardsInVaultViewV2"))}}function lY(e,t){1&e&&(yl.j41(0,"bit-hint",27),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()),2&e&&(yl.R7$(),yl.JRh(yl.bMT(2,1,"enterprisePolicyRequirementsApplied")))}function cY(e,t){if(1&e&&yl.nrm(0,"bit-option",52),2&e){const e=t.$implicit;yl.Y8G("label",e.name)("value",e.value)}}function uY(e,t){if(1&e&&yl.nrm(0,"bit-option",52),2&e){const e=t.$implicit;yl.Y8G("label",e.name)("value",e.value)}}function dY(e,t){if(1&e&&yl.nrm(0,"bit-option",56),2&e){const e=t.$implicit;yl.Y8G("label",e.name)("value",e.value)("disabled",e.disabled)}}function hY(e,t){if(1&e&&(yl.qex(0),yl.j41(1,"b"),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.EFF(4),yl.nI1(5,"i18n"),yl.bVm()),2&e){const e=yl.XpG().ngIf;yl.R7$(2),yl.SpI("",yl.bMT(3,2,"warningCapitalized"),":"),yl.R7$(2),yl.SpI(" ",yl.bMT(5,4,e[1])," ")}}function pY(e,t){if(1&e&&(yl.j41(0,"bit-hint"),yl.EFF(1),yl.nI1(2,"i18n"),yl.DNE(3,hY,6,6,"ng-container",11),yl.k0s()),2&e){const e=t.ngIf;yl.R7$(),yl.SpI(" ",yl.bMT(2,2,e[0])," "),yl.R7$(2),yl.Y8G("ngIf",e.length>1)}}function fY(e,t){if(1&e&&(yl.j41(0,"bit-form-field",12)(1,"bit-label",53),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.j41(4,"bit-select",54),yl.DNE(5,dY,1,3,"bit-option",55),yl.k0s(),yl.DNE(6,pY,4,4,"bit-hint",11),yl.k0s()),2&e){const e=yl.XpG();yl.R7$(2),yl.JRh(yl.bMT(3,3,"defaultUriMatchDetection")),yl.R7$(3),yl.Y8G("ngForOf",e.uriMatchOptions),yl.R7$(),yl.Y8G("ngIf",e.getMatchHints())}}class vY{constructor(e,t,i,n,r,s,o,a,c,u,d,h,p,f,v){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=f,this.policyService=v,this.canOverrideBrowserAutofillSetting=!1,this.defaultBrowserAutofillDisabled=!1,this.inlineMenuVisibility=va,this.browserClientVendor=wa,this.disablePasswordManagerURI=ka.Unknown,this.browserShortcutsURI=Sa.Unknown,this.autofillOnPageLoadFromPolicy$=this.autofillSettingsService.activateAutofillOnPageLoadFromPolicy$,this.showSpotlightNudge$=this.accountService.activeAccount$.pipe((0,To.p)(e=>null!==e),(0,co.n)(e=>this.nudgesService.showNudgeSpotlight$(VR.AutofillNudge,e.id))),this.restrictedCardType$=this.restrictedItemTypesService.restricted$.pipe((0,l.T)(e=>e.some(e=>e.cipherType===CR.Card)),(0,Pp.t)({bufferSize:1,refCount:!0})),this.autofillOnPageLoadForm=new fl.gE({autofillOnPageLoad:new fl.MJ,defaultAutofill:new fl.MJ}),this.additionalOptionsForm=new fl.gE({enableContextMenuItem:new fl.MJ,enableAutoTotpCopy:new fl.MJ,clearClipboard:new fl.MJ,defaultUriMatch:new fl.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=ZD.Domain,this.showCardsCurrentTab=!0,this.showIdentitiesCurrentTab=!0,this.accountSwitcherEnabled=!1,this.handleOverrideDialogAccept=()=>Qq(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:na},{name:e.t("tenSeconds"),value:ra},{name:e.t("twentySeconds"),value:sa},{name:e.t("thirtySeconds"),value:oa},{name:e.t("oneMinute"),value:aa},{name:e.t("twoMinutes"),value:la},{name:e.t("fiveMinutes"),value:ca}],this.uriMatchOptions=[{name:e.t("baseDomainOptionRecommended"),value:ZD.Domain},{name:e.t("host"),value:ZD.Host},{name:e.t("exact"),value:ZD.Exact},{name:e.t("never"),value:ZD.Never},{name:this.i18nService.t("uriAdvancedOption"),value:null,disabled:!0},{name:e.t("startsWith"),value:ZD.StartsWith},{name:e.t("regEx"),value:ZD.RegularExpression}],this.advancedOptionWarningMap={[ZD.StartsWith]:"startsWithAdvancedOptionWarning",[ZD.RegularExpression]:"regExAdvancedOptionWarning"},this.browserClientVendor=tl.getBrowserClientVendor(window),this.disablePasswordManagerURI=ka[this.browserClientVendor],this.browserShortcutsURI=Sa[this.browserClientVendor],this.browserClientIsUnknown=this.browserClientVendor===wa}ngOnInit(){return Qq(this,void 0,void 0,function*(){this.canOverrideBrowserAutofillSetting=!this.browserClientIsUnknown,this.defaultBrowserAutofillDisabled=yield this.autofillBrowserSettingsService.isBrowserAutofillSettingOverridden(this.browserClientVendor),this.inlineMenuVisibility=yield(0,ho._)(this.autofillSettingsService.inlineMenuVisibility$),this.showInlineMenuIdentities=yield(0,ho._)(this.autofillSettingsService.showInlineMenuIdentities$),this.showInlineMenuCards=yield(0,ho._)(this.autofillSettingsService.showInlineMenuCards$),this.enableInlineMenuOnIconSelect=this.inlineMenuVisibility===fa,this.enableInlineMenu=this.inlineMenuVisibility===va||this.enableInlineMenuOnIconSelect,this.autofillSettingsService.activateAutofillOnPageLoadFromPolicy$.pipe((0,wl.pQ)(this.destroyRef)).subscribe(e=>{e?this.autofillOnPageLoadForm.controls.autofillOnPageLoad.disable({emitEvent:!1}):this.autofillOnPageLoadForm.controls.autofillOnPageLoad.enable({emitEvent:!1})}),this.enableAutofillOnPageLoad=yield(0,ho._)(this.autofillSettingsService.autofillOnPageLoad$),this.autofillOnPageLoadForm.controls.autofillOnPageLoad.patchValue(this.enableAutofillOnPageLoad,{emitEvent:!1}),this.autofillOnPageLoadDefault=yield(0,ho._)(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,wl.pQ)(this.destroyRef)).subscribe(e=>{this.autofillSettingsService.setAutofillOnPageLoad(e),this.enableDefaultAutofillControl(e)}),this.autofillOnPageLoadForm.controls.defaultAutofill.valueChanges.pipe((0,wl.pQ)(this.destroyRef)).subscribe(e=>{this.autofillSettingsService.setAutofillOnPageLoadDefault(e)}),this.enableContextMenuItem=yield(0,ho._)(this.autofillSettingsService.enableContextMenu$),this.additionalOptionsForm.controls.enableContextMenuItem.patchValue(this.enableContextMenuItem,{emitEvent:!1}),this.enableAutoTotpCopy=yield(0,ho._)(this.autofillSettingsService.autoCopyTotp$),this.additionalOptionsForm.controls.enableAutoTotpCopy.patchValue(this.enableAutoTotpCopy,{emitEvent:!1}),this.clearClipboard=yield(0,ho._)(this.autofillSettingsService.clearClipboardDelay$),this.additionalOptionsForm.controls.clearClipboard.patchValue(this.clearClipboard,{emitEvent:!1});const e=yield(0,ho._)(this.domainSettingsService.resolvedDefaultUriMatchStrategy$);this.defaultUriMatch=null==e?ZD.Domain:e,this.additionalOptionsForm.controls.defaultUriMatch.patchValue(this.defaultUriMatch,{emitEvent:!1}),this.applyUriMatchPolicy(),this.additionalOptionsForm.controls.enableContextMenuItem.valueChanges.pipe((0,wl.pQ)(this.destroyRef)).subscribe(e=>{this.autofillSettingsService.setEnableContextMenu(e),this.messagingService.send("bgUpdateContextMenu")}),this.additionalOptionsForm.controls.enableAutoTotpCopy.valueChanges.pipe((0,wl.pQ)(this.destroyRef)).subscribe(e=>{this.autofillSettingsService.setAutoCopyTotp(e)}),this.additionalOptionsForm.controls.clearClipboard.valueChanges.pipe((0,wl.pQ)(this.destroyRef)).subscribe(e=>{this.autofillSettingsService.setClearClipboardDelay(e)}),this.additionalOptionsForm.controls.defaultUriMatch.valueChanges.pipe((0,sd.Z)(this.defaultUriMatch),(0,Qv.J)(),(0,yo.H)(([e,t])=>this.handleAdvancedMatch(e,t)),(0,wl.pQ)(this.destroyRef)).subscribe();const t=yield this.platformUtilsService.getAutofillKeyboardShortcut();yield this.setAutofillKeyboardHelperText(t),this.showCardsCurrentTab=yield(0,ho._)(this.vaultSettingsService.showCardsCurrentTab$),this.showIdentitiesCurrentTab=yield(0,ho._)(this.vaultSettingsService.showIdentitiesCurrentTab$)})}get spotlightButtonIcon(){return this.browserClientVendor===wa?"bwi-external-link":null}get browserClientVendorExtended(){return this.browserClientVendor!==wa?this.browserClientVendor:this.platformUtilsService.isFirefox()?"Firefox":this.platformUtilsService.isSafari()?"Safari":wa}get spotlightButtonText(){return this.browserClientVendorExtended===wa?this.i18nService.t("turnOffAutofill"):this.i18nService.t("turnOffBrowserAutofill",this.browserClientVendorExtended)}dismissSpotlight(){return Qq(this,void 0,void 0,function*(){yield this.nudgesService.dismissNudge(VR.AutofillNudge,yield(0,ho._)(this.accountService.activeAccount$.pipe(Gp)))})}updateInlineMenuVisibility(){return Qq(this,void 0,void 0,function*(){this.enableInlineMenu||(this.enableInlineMenuOnIconSelect=!1);const e=this.enableInlineMenuOnIconSelect?fa:this.enableInlineMenu?va:pa;yield this.autofillSettingsService.setInlineMenuVisibility(e),e!==pa&&(yield this.requestPrivacyPermission())})}getAutofillOnPageLoadFromPolicy(){return Qq(this,void 0,void 0,function*(){yield(0,ho._)(this.autofillOnPageLoadFromPolicy$)})}enableDefaultAutofillControl(e=!0){e?this.autofillOnPageLoadForm.controls.defaultAutofill.enable():this.autofillOnPageLoadForm.controls.defaultAutofill.disable()}setAutofillKeyboardHelperText(e){return Qq(this,void 0,void 0,function*(){this.autofillKeyboardHelperText=e?this.i18nService.t("autofillLoginShortcutText",e):this.i18nService.t("autofillLoginShortcutNotSet")})}openURI(e,t){return Qq(this,void 0,void 0,function*(){e.preventDefault(),t!==ka[this.browserClientVendor]?t!==Sa[this.browserClientVendor]?yield tl.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:()=>Qq(this,void 0,void 0,function*(){yield tl.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:()=>Qq(this,void 0,void 0,function*(){yield tl.createNewTab(t)}),cancelButtonText:{key:"cancel"},type:"info"}))})}requestPrivacyPermission(){return Qq(this,void 0,void 0,function*(){this.inlineMenuVisibility!==pa&&this.canOverrideBrowserAutofillSetting&&!this.defaultBrowserAutofillDisabled&&(yield this.dialogService.openSimpleDialog({title:{key:"overrideDefaultBrowserAutofillTitle"},content:{key:"overrideDefaultBrowserAutofillDescription"},acceptButtonText:{key:"continue"},acceptAction:()=>Qq(this,void 0,void 0,function*(){return yield this.handleOverrideDialogAccept()}),cancelButtonText:{key:"cancel"},type:"info"}))})}updateDefaultBrowserAutofillDisabled(){return Qq(this,void 0,void 0,function*(){const e=yield this.privacyPermissionGranted();if(this.defaultBrowserAutofillDisabled||e){if(!e&&!(yield tl.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 tl.updateDefaultBrowserAutofillSettings(!this.defaultBrowserAutofillDisabled),this.autofillBrowserSettingsService.setDefaultBrowserAutofillDisabled(this.defaultBrowserAutofillDisabled)}})}applyUriMatchPolicy(){this.domainSettingsService.defaultUriMatchStrategyPolicy$.pipe((0,wl.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 Qq(this,void 0,void 0,function*(){if(!(e!==t)||!(t===ZD.StartsWith||t===ZD.RegularExpression))return yield this.domainSettingsService.setDefaultUriMatchStrategy(t);JN.open(this.dialogService,{contentKey:this.advancedOptionWarningMap[t],onContinue:()=>Qq(this,void 0,void 0,function*(){this.additionalOptionsForm.controls.defaultUriMatch.setValue(t),yield this.domainSettingsService.setDefaultUriMatchStrategy(t)}),onCancel:()=>Qq(this,void 0,void 0,function*(){this.additionalOptionsForm.controls.defaultUriMatch.setValue(e),yield this.domainSettingsService.setDefaultUriMatchStrategy(e)})})})}privacyPermissionGranted(){return Qq(this,void 0,void 0,function*(){return yield tl.permissionsGranted(["privacy"])})}updateShowCardsCurrentTab(){return Qq(this,void 0,void 0,function*(){yield this.vaultSettingsService.setShowCardsCurrentTab(this.showCardsCurrentTab)})}updateShowIdentitiesCurrentTab(){return Qq(this,void 0,void 0,function*(){yield this.vaultSettingsService.setShowIdentitiesCurrentTab(this.showIdentitiesCurrentTab)})}updateShowInlineMenuCards(){return Qq(this,void 0,void 0,function*(){yield this.autofillSettingsService.setShowInlineMenuCards(this.showInlineMenuCards)})}updateShowInlineMenuIdentities(){return Qq(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!==ZD.StartsWith&&i!==ZD.RegularExpression||t.push(this.advancedOptionWarningMap[i]),t}disableBrowserAutofillSettingsFromNudge(e){return Qq(this,void 0,void 0,function*(){this.canOverrideBrowserAutofillSetting?(this.defaultBrowserAutofillDisabled=!0,yield this.updateDefaultBrowserAutofillDisabled()):yield this.openURI(e,this.disablePasswordManagerURI)})}}vY.ɵfac=function(e){return new(e||vY)(yl.rXU(Pl),yl.rXU(Eb),yl.rXU(oE),yl.rXU(Jd),yl.rXU(HD),yl.rXU(ek),yl.rXU(Zq),yl.rXU(uk),yl.rXU(fl.ok),yl.rXU(a.abz),yl.rXU(jR),yl.rXU(Ok),yl.rXU(Jq),yl.rXU(vE),yl.rXU($b))},vY.ɵcmp=yl.VBU({type:vY,selectors:[["ng-component"]],decls:116,vars:92,consts:[["slot","header","showBackButton","",3,"pageTitle"],["slot","end"],[1,"tw-bg-background-alt"],["class","tw-mb-6",4,"ngIf"],["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"],[1,"tw-mb-6"],[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&&(yl.j41(0,"popup-page")(1,"popup-header",0),yl.nI1(2,"i18n"),yl.qex(3,1),yl.nrm(4,"app-pop-out"),yl.bVm(),yl.k0s(),yl.j41(5,"div",2),yl.DNE(6,eY,4,8,"div",3),yl.nI1(7,"async"),yl.j41(8,"bit-section")(9,"bit-section-header")(10,"h2",4),yl.EFF(11),yl.nI1(12,"i18n"),yl.k0s()(),yl.j41(13,"bit-card")(14,"bit-form-control",5)(15,"input",6),yl.bIt("change",function(){return t.updateInlineMenuVisibility()}),yl.mxI("ngModelChange",function(e){return yl.DH7(t.enableInlineMenu,e)||(t.enableInlineMenu=e),e}),yl.k0s(),yl.j41(16,"bit-label",7),yl.EFF(17),yl.nI1(18,"i18n"),yl.k0s(),yl.DNE(19,tY,3,3,"bit-hint",8)(20,iY,6,9,"bit-hint",9),yl.k0s(),yl.DNE(21,nY,5,4,"bit-form-control",10)(22,rY,5,4,"bit-form-control",10),yl.nI1(23,"async"),yl.DNE(24,sY,5,4,"bit-form-control",10)(25,oY,11,11,"bit-form-control",11)(26,aY,5,4,"bit-form-control",11),yl.nI1(27,"async"),yl.j41(28,"bit-form-control",12)(29,"input",13),yl.bIt("change",function(){return t.updateShowIdentitiesCurrentTab()}),yl.mxI("ngModelChange",function(e){return yl.DH7(t.showIdentitiesCurrentTab,e)||(t.showIdentitiesCurrentTab=e),e}),yl.k0s(),yl.j41(30,"bit-label",14),yl.EFF(31),yl.nI1(32,"i18n"),yl.k0s()()()(),yl.j41(33,"bit-section")(34,"bit-section-header")(35,"h2",4),yl.EFF(36),yl.nI1(37,"i18n"),yl.k0s()(),yl.j41(38,"bit-item")(39,"button",15),yl.bIt("click",function(e){return t.openURI(e,t.browserShortcutsURI)}),yl.j41(40,"h3",16),yl.EFF(41),yl.nI1(42,"i18n"),yl.k0s(),yl.j41(43,"bit-hint",17),yl.EFF(44),yl.k0s(),yl.nrm(45,"i",18),yl.nI1(46,"i18n"),yl.k0s()()(),yl.j41(47,"bit-section")(48,"form",19)(49,"bit-section-header")(50,"legend")(51,"h2",4),yl.EFF(52),yl.nI1(53,"i18n"),yl.k0s()()(),yl.j41(54,"bit-card")(55,"bit-hint",20),yl.EFF(56),yl.nI1(57,"i18n"),yl.j41(58,"span")(59,"b"),yl.EFF(60),yl.nI1(61,"i18n"),yl.k0s(),yl.EFF(62),yl.nI1(63,"i18n"),yl.k0s(),yl.j41(64,"a",21),yl.EFF(65),yl.nI1(66,"i18n"),yl.k0s()(),yl.j41(67,"bit-form-control"),yl.nrm(68,"input",22),yl.j41(69,"bit-label",23),yl.EFF(70),yl.nI1(71,"i18n"),yl.k0s(),yl.DNE(72,lY,3,3,"bit-hint",8),yl.nI1(73,"async"),yl.k0s(),yl.j41(74,"bit-form-field",12)(75,"bit-label",24),yl.EFF(76),yl.nI1(77,"i18n"),yl.k0s(),yl.j41(78,"bit-select",25),yl.DNE(79,cY,1,2,"bit-option",26),yl.k0s(),yl.j41(80,"bit-hint",27),yl.EFF(81),yl.nI1(82,"i18n"),yl.k0s()()()()(),yl.j41(83,"bit-section")(84,"form",19)(85,"bit-section-header")(86,"h2",4),yl.EFF(87),yl.nI1(88,"i18n"),yl.k0s()(),yl.j41(89,"bit-card")(90,"bit-form-control"),yl.nrm(91,"input",28),yl.j41(92,"bit-label",29),yl.EFF(93),yl.nI1(94,"i18n"),yl.k0s()(),yl.j41(95,"bit-form-control"),yl.nrm(96,"input",30),yl.j41(97,"bit-label",31),yl.EFF(98),yl.nI1(99,"i18n"),yl.k0s()(),yl.j41(100,"bit-form-field",5)(101,"bit-label",32),yl.EFF(102),yl.nI1(103,"i18n"),yl.k0s(),yl.j41(104,"bit-select",33),yl.DNE(105,uY,1,2,"bit-option",26),yl.k0s(),yl.j41(106,"bit-hint",34),yl.EFF(107),yl.nI1(108,"i18n"),yl.k0s()(),yl.DNE(109,fY,7,5,"bit-form-field",35),yl.k0s()()(),yl.j41(110,"bit-section",12)(111,"bit-item")(112,"a",36),yl.EFF(113),yl.nI1(114,"i18n"),yl.k0s(),yl.nrm(115,"i",37),yl.k0s()()()()),2&e&&(yl.R7$(),yl.Y8G("pageTitle",yl.mNQ(yl.bMT(2,42,"autofill"))),yl.R7$(5),yl.Y8G("ngIf",!t.defaultBrowserAutofillDisabled&&yl.bMT(7,44,t.showSpotlightNudge$)),yl.R7$(5),yl.JRh(yl.bMT(12,46,"autofillSuggestionsSectionTitle")),yl.R7$(3),yl.Y8G("disableMargin",!t.enableInlineMenu&&!t.canOverrideBrowserAutofillSetting),yl.R7$(),yl.R50("ngModel",t.enableInlineMenu),yl.R7$(2),yl.JRh(yl.bMT(18,48,"showInlineMenuLabel")),yl.R7$(2),yl.Y8G("ngIf",t.accountSwitcherEnabled&&t.canOverrideBrowserAutofillSetting),yl.R7$(),yl.Y8G("ngIf",!t.canOverrideBrowserAutofillSetting),yl.R7$(),yl.Y8G("ngIf",t.enableInlineMenu),yl.R7$(),yl.Y8G("ngIf",t.enableInlineMenu&&!yl.bMT(23,50,t.restrictedCardType$)),yl.R7$(2),yl.Y8G("ngIf",t.enableInlineMenu),yl.R7$(),yl.Y8G("ngIf",t.canOverrideBrowserAutofillSetting),yl.R7$(),yl.Y8G("ngIf",!yl.bMT(27,52,t.restrictedCardType$)),yl.R7$(3),yl.R50("ngModel",t.showIdentitiesCurrentTab),yl.R7$(2),yl.SpI(" ",yl.bMT(32,54,"showIdentitiesInVaultViewV2")," "),yl.R7$(5),yl.JRh(yl.bMT(37,56,"autofillKeyboardShortcutSectionTitle")),yl.R7$(5),yl.JRh(yl.bMT(42,58,"autofillKeyboardManagerShortcutsLabel")),yl.R7$(3),yl.SpI(" ",t.autofillKeyboardHelperText," "),yl.R7$(),yl.Y8G("appA11yTitle",yl.mNQ(yl.bMT(46,60,"opensInANewWindow"))),yl.R7$(3),yl.Y8G("formGroup",t.autofillOnPageLoadForm),yl.R7$(4),yl.JRh(yl.bMT(53,62,"enableAutoFillOnPageLoadSectionTitle")),yl.R7$(4),yl.SpI(" ",yl.bMT(57,64,"enableAutoFillOnPageLoadDesc")," "),yl.R7$(4),yl.JRh(yl.bMT(61,66,"warningCapitalized")),yl.R7$(2),yl.SpI(": ",yl.bMT(63,68,"experimentalFeature")),yl.R7$(3),yl.SpI(" ",yl.bMT(66,70,"learnMoreAboutAutofillOnPageLoadLinkText")," "),yl.R7$(5),yl.JRh(yl.bMT(71,72,"enableAutoFillOnPageLoad")),yl.R7$(2),yl.Y8G("ngIf",yl.bMT(73,74,t.autofillOnPageLoadFromPolicy$)),yl.R7$(4),yl.JRh(yl.bMT(77,76,"defaultAutoFillOnPageLoad")),yl.R7$(3),yl.Y8G("ngForOf",t.autofillOnPageLoadOptions),yl.R7$(2),yl.SpI(" ",yl.bMT(82,78,"defaultAutoFillOnPageLoadDesc")," "),yl.R7$(3),yl.Y8G("formGroup",t.additionalOptionsForm),yl.R7$(3),yl.JRh(yl.bMT(88,80,"additionalOptions")),yl.R7$(6),yl.JRh(yl.bMT(94,82,"enableContextMenuItem")),yl.R7$(5),yl.JRh(yl.bMT(99,84,"enableAutoTotpCopy")),yl.R7$(2),yl.Y8G("disableMargin",t.isDefaultUriMatchDisabledByPolicy),yl.R7$(2),yl.JRh(yl.bMT(103,86,"clearClipboard")),yl.R7$(3),yl.Y8G("ngForOf",t.clearClipboardOptions),yl.R7$(2),yl.SpI(" ",yl.bMT(108,88,"clearClipboardDesc")," "),yl.R7$(2),yl.Y8G("ngIf",!t.isDefaultUriMatchDisabledByPolicy),yl.R7$(4),yl.JRh(yl.bMT(114,90,"blockedDomains")))},dependencies:[WR,id,Ub,pl.MD,pl.Sq,pl.bT,Eu,hc,Sc,nu,Du,fl.YN,fl.qT,fl.Zm,fl.BC,fl.cb,fl.vS,_l,wP,IP,FP,qf,jb,Oh,_b,eD,yD,hD,sw.iI,sw.Wk,ZR,ex,Bu,Vu,Ou,Xl,Wl,fl.X1,fl.j4,fl.JD,qR,pl.Jj,Xf],encapsulation:2});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())})};const gY=new m(J,"enableAddedLoginPrompt",{deserializer:e=>null==e||e}),yY=new m(J,"enableChangedPasswordPrompt",{deserializer:e=>null==e||e});class bY{}var wY=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 SY{constructor(e,t){this.userNotificationSettingsService=e,this.vaultSettingsService=t,this.enableAddLoginNotification=!1,this.enableChangedPasswordNotification=!1,this.enablePasskeys=!0}ngOnInit(){return wY(this,void 0,void 0,function*(){this.enableAddLoginNotification=yield(0,ho._)(this.userNotificationSettingsService.enableAddedLoginPrompt$),this.enableChangedPasswordNotification=yield(0,ho._)(this.userNotificationSettingsService.enableChangedPasswordPrompt$),this.enablePasskeys=yield(0,ho._)(this.vaultSettingsService.enablePasskeys$)})}updateAddLoginNotification(){return wY(this,void 0,void 0,function*(){yield this.userNotificationSettingsService.setEnableAddedLoginPrompt(this.enableAddLoginNotification)})}updateChangedPasswordNotification(){return wY(this,void 0,void 0,function*(){yield this.userNotificationSettingsService.setEnableChangedPasswordPrompt(this.enableChangedPasswordNotification)})}updateEnablePasskeys(){return wY(this,void 0,void 0,function*(){yield this.vaultSettingsService.setEnablePasskeys(this.enablePasskeys)})}}SY.ɵfac=function(e){return new(e||SY)(yl.rXU(bY),yl.rXU(Zq))},SY.ɵcmp=yl.VBU({type:SY,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&&(yl.j41(0,"popup-page")(1,"popup-header",0),yl.nI1(2,"i18n"),yl.qex(3,1),yl.nrm(4,"app-pop-out"),yl.bVm(),yl.k0s(),yl.j41(5,"div",2)(6,"bit-section")(7,"bit-section-header")(8,"h2",3),yl.EFF(9),yl.nI1(10,"i18n"),yl.k0s()(),yl.j41(11,"bit-card")(12,"bit-form-control")(13,"input",4),yl.bIt("change",function(){return t.updateEnablePasskeys()}),yl.mxI("ngModelChange",function(e){return yl.DH7(t.enablePasskeys,e)||(t.enablePasskeys=e),e}),yl.k0s(),yl.j41(14,"bit-label",5),yl.EFF(15),yl.nI1(16,"i18n"),yl.k0s()(),yl.j41(17,"bit-form-control")(18,"input",6),yl.bIt("change",function(){return t.updateAddLoginNotification()}),yl.mxI("ngModelChange",function(e){return yl.DH7(t.enableAddLoginNotification,e)||(t.enableAddLoginNotification=e),e}),yl.k0s(),yl.j41(19,"bit-label",7),yl.EFF(20),yl.nI1(21,"i18n"),yl.k0s()(),yl.j41(22,"bit-form-control",8)(23,"input",9),yl.bIt("change",function(){return t.updateChangedPasswordNotification()}),yl.mxI("ngModelChange",function(e){return yl.DH7(t.enableChangedPasswordNotification,e)||(t.enableChangedPasswordNotification=e),e}),yl.k0s(),yl.j41(24,"bit-label",10),yl.EFF(25),yl.nI1(26,"i18n"),yl.k0s()()()(),yl.j41(27,"bit-section",8)(28,"bit-item")(29,"a",11),yl.EFF(30),yl.nI1(31,"i18n"),yl.k0s(),yl.nrm(32,"i",12),yl.k0s()()()()),2&e&&(yl.R7$(),yl.Y8G("pageTitle",yl.mNQ(yl.bMT(2,10,"notifications"))),yl.R7$(8),yl.JRh(yl.bMT(10,12,"vaultSaveOptionsTitle")),yl.R7$(4),yl.R50("ngModel",t.enablePasskeys),yl.R7$(2),yl.JRh(yl.bMT(16,14,"enableUsePasskeys")),yl.R7$(3),yl.R50("ngModel",t.enableAddLoginNotification),yl.R7$(2),yl.JRh(yl.bMT(21,16,"enableAddLoginNotification")),yl.R7$(3),yl.R50("ngModel",t.enableChangedPasswordNotification),yl.R7$(2),yl.JRh(yl.bMT(26,18,"enableChangedPasswordNotification")),yl.R7$(5),yl.JRh(yl.bMT(31,20,"excludedDomains")))},dependencies:[pl.MD,qf,sw.iI,sw.Wk,hD,yD,eD,wP,IP,FP,WR,ZR,ex,id,Ub,Xl,Wl,Eu,hc,Sc,fl.YN,fl.Zm,fl.BC,fl.vS,Xf],encapsulation:2});function kY(e,t){1&e&&(yl.j41(0,"div",11),yl.nrm(1,"div",12),yl.k0s())}function IY(e,t){if(1&e&&(yl.j41(0,"li",6)(1,"button",7,0),yl.nI1(3,"i18n"),yl.nrm(4,"bit-icon",8),yl.j41(5,"span",9),yl.EFF(6),yl.nI1(7,"i18n"),yl.k0s()(),yl.DNE(8,kY,2,0,"div",10),yl.k0s()),2&e){const e=t.$implicit,i=yl.sdS(2),n=yl.XpG();yl.R7$(),yl.Y8G("title",yl.mNQ(yl.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)),yl.R7$(3),yl.Y8G("icon",i.isActive?e.iconActive:e.icon),yl.R7$(2),yl.SpI(" ",yl.bMT(7,10,e.label)," "),yl.R7$(2),yl.Y8G("ngIf",e.showBerry)}}class CY{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}}CY.ɵfac=function(e){return new(e||CY)(yl.rXU(Pl))},CY.ɵcmp=yl.VBU({type:CY,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,"icon"],[1,"tw-text-sm","tw-truncate","tw-max-w-full"],["class","tw-absolute tw-top-1.5 tw-left-[calc(50%+5px)]",4,"ngIf"],[1,"tw-absolute","tw-top-1.5","tw-left-[calc(50%+5px)]"],[1,"tw-bg-notification-600","tw-size-2.5","tw-rounded-full"]],template:function(e,t){1&e&&(yl.NAR(),yl.j41(0,"div",1),yl.SdG(1),yl.k0s(),yl.j41(2,"footer",2)(3,"div",3)(4,"nav")(5,"ul",4),yl.DNE(6,IY,9,12,"li",5),yl.k0s()()()()),2&e&&(yl.R7$(6),yl.Y8G("ngForOf",t.navButtons))},dependencies:[pl.MD,pl.YU,pl.Sq,pl.bT,Oh,sw.iI,sw.Wk,sw.wQ,qf,jb,$h,SC,Xf],encapsulation:2});class TY{constructor(e){this.platformUtilsService=e}showFilePopoutMessage(e){return this.showFirefoxFileWarning(e)||this.showSafariFileWarning(e)||this.showChromiumFileWarning(e)}showFirefoxFileWarning(e){return this.platformUtilsService.isFirefox()&&!(rl.inSidebar(e)||rl.inPopout(e))}showSafariFileWarning(e){return this.platformUtilsService.isSafari()&&!rl.inPopout(e)}showChromiumFileWarning(e){return(this.isLinux(e)||this.isUnsupportedMac(e))&&!this.platformUtilsService.isFirefox()&&!(rl.inSidebar(e)||rl.inPopout(e))}isLinux(e){var t;return-1!==(null===(t=null==e?void 0:e.navigator)||void 0===t?void 0:t.userAgent.indexOf("Linux"))}isUnsupportedMac(e){var t;return this.platformUtilsService.isChrome()&&(null===(t=null==e?void 0:e.navigator)||void 0===t?void 0:t.appVersion.includes("Mac OS X"))}}function PY(e,t){1&e&&(yl.j41(0,"div"),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()),2&e&&(yl.R7$(),yl.JRh(yl.bMT(2,1,"sendLinuxChromiumFileWarning")))}function FY(e,t){1&e&&(yl.j41(0,"div"),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()),2&e&&(yl.R7$(),yl.JRh(yl.bMT(2,1,"sendFirefoxFileWarning")))}function RY(e,t){1&e&&(yl.j41(0,"div"),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()),2&e&&(yl.R7$(),yl.JRh(yl.bMT(2,1,"sendSafariFileWarning")))}function xY(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"bit-callout",1),yl.nI1(1,"i18n"),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.popOutWindow())}),yl.DNE(2,PY,3,3,"div",2)(3,FY,3,3,"div",2)(4,RY,3,3,"div",2),yl.k0s()}if(2&e){const e=yl.XpG();yl.Y8G("title",yl.mNQ(yl.bMT(1,5,"sendFileCalloutHeader"))),yl.R7$(2),yl.Y8G("ngIf",e.showChromiumFileWarning),yl.R7$(),yl.Y8G("ngIf",e.showFirefoxFileWarning),yl.R7$(),yl.Y8G("ngIf",e.showSafariFileWarning)}}TY.ɵfac=function(e){return new(e||TY)(a.KVO(Eb))},TY.ɵprov=a.jDH({token:TY,factory:TY.ɵfac});class AY{constructor(e){this.filePopoutUtilsService=e,this.showFilePopoutMessage=!1,this.showFirefoxFileWarning=!1,this.showSafariFileWarning=!1,this.showChromiumFileWarning=!1}ngOnInit(){this.showFilePopoutMessage=this.filePopoutUtilsService.showFilePopoutMessage(window),this.showFirefoxFileWarning=this.filePopoutUtilsService.showFirefoxFileWarning(window),this.showSafariFileWarning=this.filePopoutUtilsService.showSafariFileWarning(window),this.showChromiumFileWarning=this.filePopoutUtilsService.showChromiumFileWarning(window)}popOutWindow(){rl.openCurrentPagePopout(window)}}AY.ɵfac=function(e){return new(e||AY)(yl.rXU(TY))},AY.ɵcmp=yl.VBU({type:AY,selectors:[["tools-file-popout-callout"]],decls:1,vars:1,consts:[["type","warning","icon","bwi-external-link bwi-rotate-270 bwi-fw",3,"title","click",4,"ngIf"],["type","warning","icon","bwi-external-link bwi-rotate-270 bwi-fw",3,"click","title"],[4,"ngIf"]],template:function(e,t){1&e&&yl.DNE(0,xY,5,7,"bit-callout",0),2&e&&yl.Y8G("ngIf",t.showFilePopoutMessage)},dependencies:[pl.MD,pl.bT,qf,td,ed,Xf],encapsulation:2});class DY{}DY.ɵfac=function(e){return new(e||DY)},DY.ɵcmp=yl.VBU({type:DY,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&&(yl.j41(0,"p",0),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s(),yl.j41(3,"a",1),yl.EFF(4),yl.nI1(5,"i18n"),yl.k0s()),2&e&&(yl.R7$(),yl.SpI(" ",yl.bMT(2,2,"authenticationSessionTimedOut")," "),yl.R7$(3),yl.SpI(" ",yl.bMT(5,4,"logIn")," "))},dependencies:[pl.MD,qf,Xu,Ku,sw.iI,sw.Wk,Xf],encapsulation:2});const EY=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 $Y=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 OY=e=>({selectedRegion:e});function UY(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",4),yl.bIt("click",function(){const t=a.eBV(e).$implicit,i=yl.XpG(2);return a.Njj(i.toggle(t.key))}),yl.nrm(1,"i",5),yl.j41(2,"span"),yl.EFF(3),yl.k0s()()}if(2&e){const e=t.$implicit,i=yl.XpG().ngIf;yl.BMQ("aria-pressed",i.selectedRegion===e?"true":"false"),yl.R7$(),yl.xc7("visibility",i.selectedRegion===e?"visible":"hidden"),yl.R7$(2),yl.JRh(e.domain)}}function MY(e,t){if(1&e){const e=yl.RV6();yl.qex(0),yl.j41(1,"div",2)(2,"bit-menu",null,0),yl.DNE(4,UY,4,4,"button",3),yl.j41(5,"button",4),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.toggle(t.ServerEnvironmentType.SelfHosted))}),yl.nrm(6,"i",5),yl.j41(7,"span"),yl.EFF(8),yl.nI1(9,"i18n"),yl.k0s()()(),yl.j41(10,"div",6),yl.EFF(11),yl.nI1(12,"i18n"),yl.j41(13,"button",7)(14,"b",8),yl.EFF(15),yl.nI1(16,"i18n"),yl.k0s(),yl.nrm(17,"i",9),yl.k0s()()(),yl.bVm()}if(2&e){const e=t.ngIf,i=yl.sdS(3),n=yl.XpG();yl.R7$(4),yl.Y8G("ngForOf",n.availableRegions),yl.R7$(),yl.BMQ("aria-pressed",e.selectedRegion?"false":"true"),yl.R7$(),yl.xc7("visibility",e.selectedRegion?"hidden":"visible"),yl.R7$(2),yl.JRh(yl.bMT(9,8,"selfHostedServer")),yl.R7$(3),yl.SpI(" ",yl.bMT(12,10,"accessing"),": "),yl.R7$(2),yl.Y8G("bitMenuTriggerFor",i),yl.R7$(2),yl.JRh((null==e.selectedRegion?null:e.selectedRegion.domain)||yl.bMT(16,12,"selfHostedServer"))}}class NY{constructor(e,t,i,n){this.environmentService=e,this.dialogService=t,this.toastService=i,this.i18nService=n,this.ServerEnvironmentType=qS,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 go.B}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}toggle(e){return $Y(this,void 0,void 0,function*(){if(null!==e){if(e===qS.SelfHosted){return void((yield BI.open(this.dialogService))&&this.toastService.showToast({variant:"success",title:"",message:this.i18nService.t("environmentSaved")}))}yield this.environmentService.setEnvironment(e)}})}}NY.ɵfac=function(e){return new(e||NY)(yl.rXU(JS),yl.rXU(Jd),yl.rXU(xb),yl.rXU(Pl))},NY.ɵcmp=yl.VBU({type:NY,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&&(yl.DNE(0,MY,18,14,"ng-container",1),yl.nI1(1,"async")),2&e&&yl.Y8G("ngIf",yl.eq3(3,OY,yl.bMT(1,1,t.selectedRegion$)))},dependencies:[pl.MD,pl.Sq,pl.bT,Dh,gL,bL,LE,Oh,Kb,Xl,Wl,pl.Jj,Hl],encapsulation:2});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())})};const BY=(e,t)=>VY(void 0,void 0,void 0,function*(){const e=(0,a.WQX)(dd),i=(0,a.WQX)(ud.Ix),n=(0,a.WQX)(ek),r=(0,a.WQX)(iT),s=(0,a.WQX)(Ok),o=(0,a.WQX)(Ab),l=yield e.getAuthStatus();if(l===cd.LoggedOut)return n.send("authBlocked",{url:t.url}),!1;const c=(yield(0,ho._)(s.activeAccount$)).id,u=yield(0,ho._)(o.forceSetPasswordReason$(c));if(l===cd.Locked&&u===Gw.SsoNewJitProvisionedUser&&!t.url.includes("set-initial-password"))return i.createUrlTree(["/set-initial-password"]);if(l===cd.Locked&&u===Gw.TdeOffboardingUntrustedDevice&&!t.url.includes("set-initial-password"))return i.createUrlTree(["/set-initial-password"]);if(l===cd.Locked&&u!==Gw.SsoNewJitProvisionedUser&&u!==Gw.TdeOffboardingUntrustedDevice)return null!=t&&n.send("lockedUrl",{url:t.url}),i.createUrlTree(["lock"],{queryParams:{promptBiometric:!0}});if((u===Gw.TdeUserWithoutPasswordHasPasswordResetPermission||u===Gw.TdeOffboarding)&&!t.url.includes("set-initial-password")){const e="/set-initial-password";return i.createUrlTree([e])}if((u===Gw.AdminForcePasswordReset||u===Gw.WeakMasterPassword)&&!t.url.includes("change-password")){const e="/change-password";return i.createUrlTree([e])}return!(u==Gw.None&&!t.url.includes("remove-password")&&(yield(0,ho._)(r.convertAccountRequired$)))||i.createUrlTree(["/remove-password"])});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())})};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())})};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={loggedIn:"/vault",loggedOut:"/login",locked:"/lock",notDecrypted:"/login-initiated"};var _Y=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 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={homepage:()=>"/vault",locked:"/lock"};function qY(e={}){return t=>KY(this,void 0,void 0,function*(){return function(e,t){return KY(this,void 0,void 0,function*(){const e=(0,a.WQX)(Ok),i=(0,a.WQX)(dd),n=(0,a.WQX)(ud.Ix),r=(0,a.WQX)(Cp),s=(0,a.WQX)(Nk),o=(0,a.WQX)(za),l=yield(0,ho._)(e.activeAccount$);if(!l)return!0;const c=yield(0,ho._)(i.authStatusFor$(l.id));if(null==c||c===cd.LoggedOut)return!0;if(c===cd.Unlocked)return n.createUrlTree([t.homepage()]);const u=yield(0,ho._)(s.supportsDeviceTrustByUserId$(l.id)),d=yield(0,ho._)(r.everHadUserKey$(l.id));return c===cd.Locked&&u&&!d?(o.info("Sending user to TDE decryption options. AuthStatus is %s. TDE support is %s. Ever had user key is %s.",cd[c],u,d),n.createUrlTree(["/login-initiated"])):n.createUrlTree([t.locked])})}(0,Object.assign(Object.assign({},XY),e))})}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())})};function WY(){return()=>YY(this,void 0,void 0,function*(){const e=(0,a.WQX)(Ok),t=(0,a.WQX)(dd),i=(0,a.WQX)(ud.Ix),n=yield(0,ho._)(e.activeAccount$);if(!n)return!0;return(yield(0,ho._)(t.authStatusFor$(n.id)))!==cd.Unlocked||i.createUrlTree(["/vault"])})}const HY=lw` `;class JY{}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())})};function QY(e,t){1&e&&(yl.qex(0),yl.j41(1,"p",4),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.j41(4,"button",5),yl.EFF(5),yl.nI1(6,"i18n"),yl.k0s(),yl.bVm()),2&e&&(yl.R7$(2),yl.JRh(yl.bMT(3,3,"readingPasskeyLoading")),yl.R7$(2),yl.Y8G("loading",!0),yl.R7$(),yl.SpI(" ",yl.bMT(6,5,"loading")," "))}function eW(e,t){if(1&e){const e=yl.RV6();yl.qex(0),yl.j41(1,"p",4),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.j41(4,"button",6),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.retry())}),yl.EFF(5),yl.nI1(6,"i18n"),yl.k0s(),yl.bVm()}2&e&&(yl.R7$(2),yl.JRh(yl.bMT(3,2,"passkeyAuthenticationFailed")),yl.R7$(3),yl.SpI(" ",yl.bMT(6,4,"tryAgain")," "))}class tW{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:$T,TwoFactorAuthSecurityKeyFailedIcon:HY},this.successRoutes={[Ca.Web]:"/vault",[Ca.Browser]:"/tabs/vault",[Ca.Desktop]:"/vault",[Ca.Cli]:"/vault"}}ngOnInit(){this.shouldAutoClosePopout="true"===this.route.snapshot.queryParamMap.get("autoClosePopout"),this.authenticate()}retry(){this.currentState="assert",this.setDefaultIcon(),this.authenticate()}authenticate(){return ZY(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,ho._)(this.keyService.userKey$(t.userId)))&&(yield this.loginSuccessHandlerService.run(t.userId,null)),this.shouldAutoClosePopout&&this.platformUtilsService.getClientType()===Ca.Browser)return this.messagingService.send("openPopup"),void window.close();yield this.router.navigate([this.successRoute])}catch(e){e instanceof Mw&&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})}}tW.ɵfac=function(e){return new(e||tW)(yl.rXU(JY),yl.rXU(ud.Ix),yl.rXU(ud.nX),yl.rXU(za),yl.rXU(Cd),yl.rXU(Pl),yl.rXU(gw),yl.rXU(Cp),yl.rXU(Eb),yl.rXU(sk),yl.rXU(ek))},tW.ɵcmp=yl.VBU({type:tW,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&&(yl.j41(0,"div",0),yl.DNE(1,QY,7,7,"ng-container",1)(2,eW,7,6,"ng-container",1),yl.j41(3,"p",2),yl.EFF(4),yl.nI1(5,"i18n"),yl.nrm(6,"br"),yl.j41(7,"a",3),yl.EFF(8),yl.nI1(9,"i18n"),yl.k0s()()()),2&e&&(yl.R7$(),yl.Y8G("ngIf","assert"===t.currentState),yl.R7$(),yl.Y8G("ngIf","assertFailed"===t.currentState),yl.R7$(2),yl.SpI(" ",yl.bMT(5,4,"troubleLoggingIn")),yl.R7$(4),yl.JRh(yl.bMT(9,6,"useADifferentLogInMethod")))},dependencies:[pl.MD,pl.bT,sw.iI,sw.Wk,qf,Xu,Ku,$h,Oh,_b,Xl,Wl,Xf],encapsulation:2});const iW=lw` `;class nW{}class rW{}var sW=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 oW=()=>({key:"changeMasterPassword"});function aW(e,t){1&e&&(yl.nrm(0,"i",0),yl.nI1(1,"i18n"),yl.j41(2,"span",1),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s()),2&e&&(yl.Y8G("title",yl.mNQ(yl.bMT(1,3,"loading"))),yl.R7$(3),yl.JRh(yl.bMT(4,5,"loading")))}function lW(e,t){1&e&&(yl.j41(0,"bit-callout",4),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()),2&e&&(yl.R7$(),yl.JRh(yl.bMT(2,1,"changePasswordWarning")))}function cW(e,t){if(1&e){const e=yl.RV6();yl.DNE(0,lW,3,3,"bit-callout",2),yl.j41(1,"auth-input-password",3),yl.bIt("onPasswordFormSubmit",function(t){a.eBV(e);const i=yl.XpG();return a.Njj(i.handlePasswordFormSubmit(t))})("onSecondaryButtonClick",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.logOut())}),yl.k0s()}if(2&e){const e=yl.XpG();yl.Y8G("ngIf",e.forceSetPasswordReason!==e.ForceSetPasswordReason.AdminForcePasswordReset),yl.R7$(),yl.Y8G("flow",e.inputPasswordFlow)("email",e.email)("userId",e.userId)("loading",e.submitting)("masterPasswordPolicyOptions",e.masterPasswordPolicyOptions)("inlineButtons",!0)("primaryButtonText",yl.lJ4(9,oW))("secondaryButtonText",e.secondaryButtonText())}}class uW{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=Xb.ChangePassword,this.activeAccount=null,this.initializing=!0,this.submitting=!1,this.forceSetPasswordReason=Gw.None,this.ForceSetPasswordReason=Gw}ngOnInit(){return sW(this,void 0,void 0,function*(){if(this.activeAccount=yield(0,ho._)(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,ho._)(this.policyService.masterPasswordPolicyOptions$(this.userId)),this.forceSetPasswordReason=yield(0,ho._)(this.masterPasswordService.forceSetPasswordReason$(this.userId)),this.forceSetPasswordReason===Gw.AdminForcePasswordReset?this.anonLayoutWrapperDataService.setAnonLayoutWrapperData({pageIcon:iW,pageTitle:{key:"updateMasterPassword"},pageSubtitle:{key:"accountRecoveryUpdateMasterPasswordSubtitle"}}):this.forceSetPasswordReason===Gw.WeakMasterPassword&&this.anonLayoutWrapperDataService.setAnonLayoutWrapperData({pageIcon:iW,pageTitle:{key:"updateMasterPassword"},pageSubtitle:{key:"updateMasterPasswordSubtitle"},maxWidth:"lg"}),this.initializing=!1})}logOut(){return sW(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 sW(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===Gw.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===Gw.AdminForcePasswordReset||this.forceSetPasswordReason===Gw.WeakMasterPassword?{key:"logOut"}:void 0}}uW.ɵfac=function(e){return new(e||uW)(yl.rXU(Ok),yl.rXU(nW),yl.rXU(Pl),yl.rXU(Db),yl.rXU(sk),yl.rXU(rW),yl.rXU(ek),yl.rXU($b),yl.rXU(xb),yl.rXU(ux),yl.rXU(Jd),yl.rXU(za))},uW.ɵcmp=yl.VBU({type:uW,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&&yl.nVh(0,aW,5,7)(1,cW,2,10),2&e&&yl.vxM(t.initializing?0:1)},dependencies:[rw,ed,pl.MD,pl.bT,Hl],encapsulation:2});class dW extends tP{static newConstructor(e,t){const i=new dW;return i.newMasterPasswordHash=e.masterPasswordAuthenticationHash,i.key=t.masterKeyWrappedUserKey,i.authenticationData=e,i.unlockData=t,i}}class hW extends yR{}var pW=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 fW{constructor(e,t,i){this.keyService=e,this.masterPasswordApiService=t,this.masterPasswordService=i}rotateUserKeyMasterPasswordAndEncryptedData(e,t,i,n){return pW(this,void 0,void 0,function*(){throw new Error("rotateUserKeyMasterPasswordAndEncryptedData() is only implemented in Web")})}preparePasswordChange(e,t,i){return pW(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 dW?(i.masterPasswordHash=e.currentServerMasterKeyHash,i.newMasterPasswordHash=e.newServerMasterKeyHash,i.masterPasswordHint=e.newPasswordHint):i instanceof hW&&(i.newMasterPasswordHash=e.newServerMasterKeyHash,i.masterPasswordHint=e.newPasswordHint),r})}changePassword(e,t){return pW(this,void 0,void 0,function*(){const i=new dW,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 pW(this,void 0,void 0,function*(){const i=new hW,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 vW=lw` `;function mW(e,t,i){if(!e||"number"==typeof e&&Number.isNaN(e))throw new Error(`${t} is falsy.${i?` ${i}`:""}`)}const gW=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 yW{}class bW{}var wW=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 SW=e=>({key:e}),kW=()=>({key:"logOut"});function IW(e,t){1&e&&(yl.j41(0,"div",0),yl.nrm(1,"i",1),yl.nI1(2,"i18n"),yl.k0s()),2&e&&(yl.R7$(),yl.Y8G("title",yl.mNQ(yl.bMT(2,2,"loading"))))}function CW(e,t){if(1&e){const e=yl.RV6();yl.nrm(0,"div",2),yl.j41(1,"bit-callout",3),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.j41(4,"button",4),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG(2);return a.Njj(t.logout())}),yl.EFF(5),yl.nI1(6,"i18n"),yl.k0s()}2&e&&(yl.R7$(2),yl.SpI(" ",yl.bMT(3,2,"loginOnTrustedDeviceOrAskAdminToAssignPassword")," "),yl.R7$(3),yl.SpI(" ",yl.bMT(6,4,"logOut")," "))}function TW(e,t){1&e&&(yl.j41(0,"bit-callout",7),yl.nI1(1,"i18n"),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s()),2&e&&(yl.Y8G("title",yl.mNQ(yl.bMT(1,3,"resetPasswordPolicyAutoEnroll"))),yl.R7$(2),yl.SpI(" ",yl.bMT(3,5,"resetPasswordAutoEnrollInviteWarning")," "))}function PW(e,t){if(1&e){const e=yl.RV6();yl.DNE(0,TW,4,7,"bit-callout",5),yl.j41(1,"auth-input-password",6),yl.bIt("onPasswordFormSubmit",function(t){a.eBV(e);const i=yl.XpG(2);return a.Njj(i.handlePasswordFormSubmit(t))})("onSecondaryButtonClick",function(){a.eBV(e);const t=yl.XpG(2);return a.Njj(t.logout())}),yl.k0s()}if(2&e){const e=yl.XpG(2);yl.Y8G("ngIf",e.resetPasswordAutoEnroll),yl.R7$(),yl.Y8G("flow",e.inputPasswordFlow)("email",e.email)("userId",e.userId)("loading",e.submitting)("masterPasswordPolicyOptions",e.masterPasswordPolicyOptions)("primaryButtonText",yl.eq3(8,SW,e.userType===e.SetInitialPasswordUserType.OFFBOARDED_TDE_ORG_USER?"setPassword":"createAccount"))("secondaryButtonText",yl.lJ4(10,kW))}}function FW(e,t){if(1&e&&yl.nVh(0,CW,7,6)(1,PW,2,11),2&e){const e=yl.XpG();yl.vxM(e.userType===e.SetInitialPasswordUserType.OFFBOARDED_TDE_ORG_USER_UNTRUSTED_DEVICE?0:1)}}class RW{constructor(e,t,i,n,r,s,o,a,l,c,u,d,h,p,f,v,m,g){this.accountService=e,this.activatedRoute=t,this.anonLayoutWrapperDataService=i,this.dialogService=n,this.i18nService=r,this.logoutService=s,this.logService=o,this.masterPasswordService=a,this.messagingService=l,this.organizationApiService=c,this.policyApiService=u,this.policyService=d,this.router=h,this.setInitialPasswordService=p,this.ssoLoginService=f,this.syncService=v,this.toastService=m,this.validationService=g,this.inputPasswordFlow=Xb.SetInitialPasswordAuthedUser,this.initializing=!0,this.masterPasswordPolicyOptions=null,this.submitting=!1,this.SetInitialPasswordUserType=gW}ngOnInit(){return wW(this,void 0,void 0,function*(){yield this.syncService.fullSync(!0);const e=yield(0,ho._)(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})}establishUserType(){return wW(this,void 0,void 0,function*(){if(!this.userId)throw new Error("userId not found. Could not determine user type.");this.forceSetPasswordReason=yield(0,ho._)(this.masterPasswordService.forceSetPasswordReason$(this.userId)),this.forceSetPasswordReason===Gw.TdeOffboardingUntrustedDevice&&(this.userType=gW.OFFBOARDED_TDE_ORG_USER_UNTRUSTED_DEVICE,this.anonLayoutWrapperDataService.setAnonLayoutWrapperData({pageTitle:{key:"unableToCompleteLogin"},pageIcon:vW})),this.forceSetPasswordReason===Gw.SsoNewJitProvisionedUser&&(this.userType=gW.JIT_PROVISIONED_MP_ORG_USER,this.anonLayoutWrapperDataService.setAnonLayoutWrapperData({pageTitle:{key:"joinOrganization"},pageSubtitle:{key:"finishJoiningThisOrganizationBySettingAMasterPassword"}})),this.forceSetPasswordReason===Gw.TdeUserWithoutPasswordHasPasswordResetPermission&&(this.userType=gW.TDE_ORG_USER_RESET_PASSWORD_PERMISSION_REQUIRES_MP,this.anonLayoutWrapperDataService.setAnonLayoutWrapperData({pageTitle:{key:"setMasterPassword"},pageSubtitle:{key:"orgPermissionsUpdatedMustSetPassword"}})),this.forceSetPasswordReason===Gw.TdeOffboarding&&(this.userType=gW.OFFBOARDED_TDE_ORG_USER,this.anonLayoutWrapperDataService.setAnonLayoutWrapperData({pageTitle:{key:"setMasterPassword"},pageSubtitle:{key:"tdeDisabledMasterPasswordRequired"}})),this.forceSetPasswordReason===Gw.None&&(yield this.router.navigate(["/"]))})}getOrgInfo(){return wW(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===gW.OFFBOARDED_TDE_ORG_USER)return void(this.masterPasswordPolicyOptions=null!==(e=yield(0,ho._)(this.policyService.masterPasswordPolicyOptions$(this.userId)))&&void 0!==e?e:null);const i=yield(0,ho._)(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")})}})}handlePasswordFormSubmit(e){return wW(this,void 0,void 0,function*(){switch(this.submitting=!0,this.userType){case gW.JIT_PROVISIONED_MP_ORG_USER:case gW.TDE_ORG_USER_RESET_PASSWORD_PERMISSION_REQUIRES_MP:yield this.setInitialPassword(e);break;case gW.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.")}})}setInitialPassword(e){return wW(this,void 0,void 0,function*(){const t="Could not set initial password.";mW(e.newMasterKey,"newMasterKey",t),mW(e.newServerMasterKeyHash,"newServerMasterKeyHash",t),mW(e.newLocalMasterKeyHash,"newLocalMasterKeyHash",t),mW(e.kdfConfig,"kdfConfig",t),mW(e.newPassword,"newPassword",t),mW(e.salt,"salt",t),mW(this.orgSsoIdentifier,"orgSsoIdentifier",t),mW(this.orgId,"orgId",t),mW(this.userType,"userType",t),mW(this.userId,"userId",t),LS(e.newPasswordHint,"newPasswordHint",t),LS(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}})}setInitialPasswordTdeOffboarding(e){return wW(this,void 0,void 0,function*(){const t="Could not set initial password.";mW(e.newMasterKey,"newMasterKey",t),mW(e.newServerMasterKeyHash,"newServerMasterKeyHash",t),mW(this.userId,"userId",t),LS(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===gW.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")})}logout(){return wW(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")})}}RW.ɵfac=function(e){return new(e||RW)(yl.rXU(Ok),yl.rXU(ud.nX),yl.rXU(sk),yl.rXU(Jd),yl.rXU(Pl),yl.rXU(yw),yl.rXU(za),yl.rXU(Db),yl.rXU(ek),yl.rXU(Bk),yl.rXU(bW),yl.rXU($b),yl.rXU(ud.Ix),yl.rXU(yW),yl.rXU(dk),yl.rXU(ux),yl.rXU(xb),yl.rXU(Cd))},RW.ɵcmp=yl.VBU({type:RW,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&&yl.nVh(0,IW,3,4,"div",0)(1,FW,2,1),2&e&&yl.vxM(t.initializing?0:1)},dependencies:[Xu,Ku,ed,pl.MD,pl.bT,rw,Hl],encapsulation:2});const xW=lw` `,AW=lw` `,DW=lw` `,EW=lw` `,$W=lw` `,OW=lw` Bitwarden `;class UW{}UW.ɵfac=function(e){return new(e||UW)},UW.ɵcmp=yl.VBU({type:UW,selectors:[["bit-base-card"]],features:[yl.nM4([YR])],ngContentSelectors:["*"],decls:1,vars:0,template:function(e,t){1&e&&(yl.NAR(),yl.SdG(0))},encapsulation:2});var MW=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 NW=[[["","slot","header-actions"]],[["","slot","secondary"]],[["","slot","environment-selector"]],"*"],VW=(e,t)=>({"tw-min-h-screen":e,"tw-min-h-full":t}),BW=()=>["/"];function jW(e,t){if(1&e&&(yl.j41(0,"a",2),yl.nrm(1,"bit-icon",11),yl.nI1(2,"i18n"),yl.k0s()),2&e){const e=yl.XpG();yl.Y8G("routerLink",yl.lJ4(5,BW)),yl.R7$(),yl.Y8G("icon",e.logo)("ariaLabel",yl.bMT(2,3,"appLogoLabel"))}}function GW(e,t){if(1&e&&(yl.j41(0,"div",12),yl.nrm(1,"bit-icon",13),yl.k0s()),2&e){yl.XpG();const e=yl.r8f(6);yl.R7$(),yl.Y8G("icon",e)}}function LW(e,t){if(1&e&&(yl.j41(0,"h1",14),yl.EFF(1),yl.k0s(),yl.j41(2,"h1",15),yl.EFF(3),yl.k0s()),2&e){const e=yl.XpG();yl.R7$(),yl.SpI(" ",e.title()," "),yl.R7$(2),yl.SpI(" ",e.title()," ")}}function zW(e,t){if(1&e&&(yl.j41(0,"div",6),yl.EFF(1),yl.k0s()),2&e){const e=yl.XpG();yl.R7$(),yl.JRh(e.subtitle())}}function _W(e,t){1&e&&yl.eu8(0)}function KW(e,t){if(1&e&&(yl.j41(0,"div",8),yl.DNE(1,_W,1,0,"ng-container",16),yl.k0s()),2&e){yl.XpG();const e=yl.sdS(17);yl.R7$(),yl.Y8G("ngTemplateOutlet",e)}}function XW(e,t){1&e&&yl.eu8(0)}function qW(e,t){if(1&e&&(yl.j41(0,"bit-base-card",9),yl.DNE(1,XW,1,0,"ng-container",16),yl.k0s()),2&e){yl.XpG();const e=yl.sdS(17);yl.R7$(),yl.Y8G("ngTemplateOutlet",e)}}function YW(e,t){if(1&e&&(yl.j41(0,"div",17),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()),2&e){const e=yl.XpG(2);yl.R7$(),yl.Lme("",yl.bMT(2,2,"accessing")," ",e.hostname)}}function WW(e,t){1&e&&yl.SdG(0,2)}function HW(e,t){if(1&e&&(yl.j41(0,"div",17),yl.EFF(1),yl.k0s(),yl.j41(2,"div",17),yl.EFF(3),yl.k0s()),2&e){const e=yl.XpG(2);yl.R7$(),yl.SpI("© ",e.year," Bitwarden Inc."),yl.R7$(2),yl.JRh(e.version)}}function JW(e,t){if(1&e&&(yl.j41(0,"footer",10),yl.nVh(1,YW,3,4,"div",17)(2,WW,1,0),yl.nVh(3,HW,4,2),yl.k0s()),2&e){const e=yl.XpG();yl.R7$(),yl.vxM(e.showReadonlyHostname()?1:2),yl.R7$(2),yl.vxM(e.hideYearAndVersion?-1:3)}}function ZW(e,t){if(1&e&&(yl.j41(0,"div",18),yl.nrm(1,"bit-icon",13),yl.k0s(),yl.j41(2,"div",19),yl.nrm(3,"bit-icon",13),yl.k0s()),2&e){const e=yl.XpG();yl.R7$(),yl.Y8G("icon",e.leftIllustration),yl.R7$(2),yl.Y8G("icon",e.rightIllustration)}}function QW(e,t){1&e&&yl.SdG(0,3)}class eH{get classList(){return["tw-h-full"]}get maxWidthClass(){switch(this.maxWidth()){case"md":return"tw-max-w-md";case"lg":return"tw-max-w-lg";case"xl":return"tw-max-w-xl";case"2xl":return"tw-max-w-2xl";case"3xl":return"tw-max-w-3xl";case"4xl":return"tw-max-w-4xl"}}constructor(e,t){this.environmentService=e,this.platformUtilsService=t,this.leftIllustration=EW,this.rightIllustration=$W,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=OW,this.hideYearAndVersion=!1,this.year=(new Date).getFullYear().toString(),this.clientType=this.platformUtilsService.getClientType(),this.hideYearAndVersion=this.clientType!==Ca.Web}ngOnInit(){return MW(this,void 0,void 0,function*(){var e;this.maxWidth.set(null!==(e=this.maxWidth())&&void 0!==e?e:"md"),this.hostname=(yield(0,ho._)(this.environmentService.environment$)).getHostname(),this.version=yield this.platformUtilsService.getApplicationVersion()})}ngOnChanges(e){return MW(this,void 0,void 0,function*(){var t;e.maxWidth&&this.maxWidth.set(null!==(t=e.maxWidth.currentValue)&&void 0!==t?t:"md")})}}eH.ɵfac=function(e){return new(e||eH)(yl.rXU(JS),yl.rXU(Eb))},eH.ɵcmp=yl.VBU({type:eH,selectors:[["auth-anon-layout"]],hostVars:2,hostBindings:function(e,t){2&e&&yl.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:[yl.OA$],ngContentSelectors:["[slot=header-actions]","[slot=secondary]","[slot=environment-selector]","*"],decls:18,vars:16,consts:[["defaultContent",""],[1,"tw-relative","tw-flex","tw-w-full","tw-mx-auto","tw-flex-col","tw-bg-background-alt","tw-p-5","tw-text-main",3,"ngClass"],[1,"tw-w-32","sm:tw-w-[200px]","tw-self-center","sm:tw-self-start","tw-block","[&>*]:tw-align-top",3,"routerLink"],[1,"tw-ms-auto"],[1,"tw-text-center","tw-mb-4","sm:tw-mb-6","tw-mx-auto",3,"ngClass"],["class","tw-size-20 sm:tw-size-24 [&_svg]:tw-w-full [&_svg]:tw-max-w-24 tw-mx-auto tw-content-center",4,"ngIf"],[1,"tw-text-sm","sm:tw-text-base"],[1,"tw-z-10","tw-grow","tw-w-full","tw-mx-auto","tw-flex","tw-flex-col","tw-items-center","sm:tw-min-w-[28rem]",3,"ngClass"],[1,"tw-mb-6","sm:tw-mb-10"],[1,"!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"],[1,"tw-text-center","tw-mt-4","sm:tw-mt-6"],[3,"icon","ariaLabel"],[1,"tw-size-20","sm:tw-size-24","[&_svg]:tw-w-full","[&_svg]:tw-max-w-24","tw-mx-auto","tw-content-center"],[3,"icon"],["bitTypography","h2",1,"tw-mt-2","sm:tw-hidden"],["bitTypography","h1",1,"tw-mt-2","tw-hidden","sm:tw-block"],[4,"ngTemplateOutlet"],["bitTypography","body2"],[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]"],[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){if(1&e&&(yl.NAR(NW),yl.j41(0,"main",1)(1,"div"),yl.nVh(2,jW,3,6,"a",2),yl.j41(3,"div",3),yl.SdG(4),yl.k0s()(),yl.j41(5,"div",4),yl.SS7(6),yl.DNE(7,GW,2,1,"div",5),yl.nVh(8,LW,4,2),yl.nVh(9,zW,2,1,"div",6),yl.k0s(),yl.j41(10,"div",7),yl.nVh(11,KW,2,1,"div",8)(12,qW,2,1,"bit-base-card",9),yl.SdG(13,1),yl.k0s(),yl.nVh(14,JW,4,2,"footer",10),yl.nVh(15,ZW,4,2),yl.k0s(),yl.DNE(16,QW,1,0,"ng-template",null,0,yl.C5r)),2&e){yl.Y8G("ngClass",yl.l_i(13,VW,"web"===t.clientType,"browser"===t.clientType||"desktop"===t.clientType)),yl.R7$(),yl.HbH("tw-flex tw-justify-between tw-items-center tw-w-full"+(t.hideLogo()?"":" tw-mb-12")),yl.R7$(),yl.vxM(t.hideLogo()?-1:2),yl.R7$(3),yl.Y8G("ngClass",t.maxWidthClass),yl.R7$();const e=yl.bH3(t.icon());yl.R7$(),yl.Y8G("ngIf",null!==e),yl.R7$(),yl.vxM(t.title()?8:-1),yl.R7$(),yl.vxM(t.subtitle()?9:-1),yl.R7$(),yl.Y8G("ngClass",t.maxWidthClass),yl.R7$(),yl.vxM(t.hideCardWrapper()?11:12),yl.R7$(3),yl.vxM(t.hideFooter()?-1:14),yl.R7$(),yl.vxM(t.hideBackgroundIllustration()?-1:15)}},dependencies:[$h,SC,pl.MD,pl.YU,pl.bT,pl.T3,Xl,Wl,Kl,sw.iI,sw.Wk,UW,Hl],encapsulation:2});class tH{constructor(e,t,i,n,r){this.router=e,this.route=t,this.i18nService=i,this.anonLayoutWrapperDataService=n,this.changeDetectorRef=r,this.destroy$=new go.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,To.p)(e=>e instanceof ud.wF),(0,Fo.M)(()=>this.resetPageData()),(0,co.n)(()=>{var e;return(null===(e=this.route.firstChild)||void 0===e?void 0:e.data)||(0,Oo.of)(null)}),(0,wl.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,wl.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}}function iH(e){return"string"==typeof e?JSON.parse(e):e}function nH(e){var t;const i=null!==(t=iH({accountSwitching:!0,sdk:!0}))&&void 0!==t?t:{};return null==i[e]||!!i[e]}function rH(){return!tl.isSafariApi&&nH("accountSwitching")}tH.ɵfac=function(e){return new(e||tH)(yl.rXU(ud.Ix),yl.rXU(ud.nX),yl.rXU(Pl),yl.rXU(sk),yl.rXU(o.gRc))},tH.ɵcmp=yl.VBU({type:tH,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&&(yl.j41(0,"auth-anon-layout",0),yl.nrm(1,"router-outlet",1)(2,"router-outlet")(3,"router-outlet",2)(4,"router-outlet",3),yl.k0s()),2&e&&yl.Y8G("title",t.pageTitle)("subtitle",t.pageSubtitle)("icon",t.pageIcon)("showReadonlyHostname",t.showReadonlyHostname)("maxWidth",t.maxWidth)("hideCardWrapper",t.hideCardWrapper)("hideBackgroundIllustration",t.hideBackgroundIllustration)},dependencies:[eH,sw.iI,ud.n3],encapsulation:2});var sH=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 oH=e=>({"tw-mb-6":e});function aH(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"div",8)(1,"auth-account",9),yl.bIt("loading",function(t){a.eBV(e);const i=yl.XpG(3);return a.Njj(i.loading=t)}),yl.k0s()()}if(2&e){const e=yl.XpG().$implicit,t=yl.XpG(2);yl.Y8G("ngClass",yl.eq3(2,oH,t.enableAccountSwitching)),yl.R7$(),yl.Y8G("account",e)}}function lH(e,t){1&e&&(yl.j41(0,"bit-section-header")(1,"h2",10),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s()()),2&e&&(yl.R7$(2),yl.JRh(yl.bMT(3,1,"availableAccounts")))}function cH(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"div")(1,"auth-account",9),yl.bIt("loading",function(t){a.eBV(e);const i=yl.XpG(4);return a.Njj(i.loading=t)}),yl.k0s()()}if(2&e){const e=yl.XpG(2).$implicit;yl.R7$(),yl.Y8G("account",e)}}function uH(e,t){if(1&e&&(yl.qex(0),yl.DNE(1,lH,4,3,"bit-section-header",3)(2,cH,2,1,"div",3),yl.bVm()),2&e){const e=yl.XpG(),t=e.$implicit,i=e.first;yl.R7$(),yl.Y8G("ngIf",i),yl.R7$(),yl.Y8G("ngIf",!t.isActive)}}function dH(e,t){if(1&e&&(yl.qex(0),yl.DNE(1,aH,2,4,"div",7)(2,uH,3,2,"ng-container",3),yl.bVm()),2&e){const e=t.$implicit,i=yl.XpG(2);yl.R7$(),yl.Y8G("ngIf",e.isActive),yl.R7$(),yl.Y8G("ngIf",i.enableAccountSwitching)}}function hH(e,t){1&e&&(yl.j41(0,"p",11),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()),2&e&&(yl.R7$(),yl.SpI(" ",yl.bMT(2,1,"accountLimitReached")," "))}function pH(e,t){if(1&e&&(yl.qex(0),yl.j41(1,"bit-section",4),yl.DNE(2,dH,3,2,"ng-container",5)(3,hH,3,3,"p",6),yl.k0s(),yl.bVm()),2&e){const e=t.ngIf,i=yl.XpG();yl.R7$(),yl.Y8G("disableMargin",!i.enableAccountSwitching),yl.R7$(),yl.Y8G("ngForOf",e),yl.R7$(),yl.Y8G("ngIf",e.length>=i.accountLimit&&e[e.length-1].id!==i.specialAddAccountId)}}function fH(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"bit-item")(1,"button",14),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG(2);return a.Njj(t.lockAll())}),yl.nrm(2,"i",13),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s()()}2&e&&(yl.R7$(3),yl.SpI(" ",yl.bMT(4,1,"lockAll")," "))}function vH(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"div")(1,"bit-section")(2,"bit-section-header")(3,"h2",10),yl.EFF(4),yl.nI1(5,"i18n"),yl.k0s()(),yl.j41(6,"bit-item")(7,"button",12),yl.nI1(8,"i18n"),yl.bIt("click",function(){const t=a.eBV(e).ngIf,i=yl.XpG();return a.Njj(i.lock(t.id))}),yl.nrm(9,"i",13),yl.EFF(10),yl.nI1(11,"i18n"),yl.k0s()(),yl.j41(12,"bit-item")(13,"button",14),yl.bIt("click",function(){const t=a.eBV(e).ngIf,i=yl.XpG();return a.Njj(i.logOut(t.id))}),yl.nrm(14,"i",15),yl.EFF(15),yl.nI1(16,"i18n"),yl.k0s()(),yl.DNE(17,fH,5,3,"bit-item",3),yl.nI1(18,"async"),yl.k0s()()}if(2&e){const e=t.ngIf,i=yl.XpG();yl.R7$(4),yl.JRh(yl.bMT(5,6,"options")),yl.R7$(3),yl.Y8G("disabled",e.status===i.lockedStatus||!i.activeUserCanLock)("title",i.activeUserCanLock?"":yl.bMT(8,8,"unlockMethodNeeded")),yl.R7$(3),yl.SpI(" ",yl.bMT(11,10,"lockNow")," "),yl.R7$(5),yl.SpI(" ",yl.bMT(16,12,"logOut")," "),yl.R7$(2),yl.Y8G("ngIf",yl.bMT(18,14,i.showLockAll$))}}class mH{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=cd.Locked,this.destroy$=new go.B,this.loading=!1,this.activeUserCanLock=!1,this.enableAccountSwitching=!0,this.availableAccounts$=this.accountSwitcherService.availableAccounts$,this.currentAccount$=this.accountService.activeAccount$.pipe((0,co.n)(e=>null==e?(0,Oo.of)(null):this.authService.activeAccountStatus$.pipe((0,l.T)(t=>Object.assign(Object.assign({},e),{status:t}))))),this.showLockAll$=this.availableAccounts$.pipe((0,sd.Z)([]),(0,l.T)(e=>e.filter(e=>!e.isActive)),(0,co.n)(e=>rH()?(0,Oo.of)(e.length>1):(0,Oo.of)(!1)))}get accountLimit(){return this.accountSwitcherService.ACCOUNT_LIMIT}get specialAddAccountId(){return this.accountSwitcherService.SPECIAL_ADD_ACCOUNT_ID}ngOnInit(){return sH(this,void 0,void 0,function*(){this.enableAccountSwitching=rH();const e=yield(0,ho._)(this.vaultTimeoutSettingsService.availableVaultTimeoutActions$());this.activeUserCanLock=e.includes(Zp.Lock)})}back(){this.location.back()}lock(e){return sH(this,void 0,void 0,function*(){this.loading=!0,yield this.lockService.lock(e),yield this.router.navigate(["lock"])})}lockAll(){return sH(this,void 0,void 0,function*(){this.loading=!0,yield this.lockService.lockAll(),yield this.router.navigate(["lock"])})}logOut(e){return sH(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()}}mH.ɵfac=function(e){return new(e||mH)(yl.rXU(fF),yl.rXU(Ok),yl.rXU(pf),yl.rXU(Jd),yl.rXU(sF.aZ),yl.rXU(ud.Ix),yl.rXU(Ep),yl.rXU(dd),yl.rXU(_S),yl.rXU(yw))},mH.ɵcmp=yl.VBU({type:mH,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&&(yl.j41(0,"popup-page",0)(1,"popup-header",1),yl.nI1(2,"i18n"),yl.qex(3,2),yl.nrm(4,"app-pop-out")(5,"app-current-account"),yl.bVm(),yl.k0s(),yl.DNE(6,pH,4,3,"ng-container",3),yl.nI1(7,"async"),yl.DNE(8,vH,19,16,"div",3),yl.nI1(9,"async"),yl.k0s()),2&e&&(yl.Y8G("loading",t.loading),yl.R7$(),yl.Y8G("pageTitle",yl.mNQ(yl.bMT(2,5,"accountActions"))),yl.R7$(5),yl.Y8G("ngIf",yl.bMT(7,7,t.availableAccounts$)),yl.R7$(2),yl.Y8G("ngIf",yl.bMT(9,9,t.currentAccount$)))},dependencies:[pl.MD,pl.YU,pl.Sq,pl.bT,qf,Xu,wP,IP,FP,uF,hD,yD,eD,PF,kF,ZR,ex,Xl,Wl,pl.Jj,Xf],encapsulation:2});const gH=Object.freeze({AccountSecurity:"account-security",DeviceManagement:"device-management",AccountSwitcher:"account-switcher"});class yH{constructor(e){this.previousUrl=void 0,e.events.pipe((0,To.p)(e=>e instanceof ud.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}}yH.ɵfac=function(e){return new(e||yH)(a.KVO(ud.Ix))},yH.ɵprov=a.jDH({token:yH,factory:yH.ɵfac,providedIn:"root"});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())})};var wH=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 SH=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 kH=m.array(E,"pendingAuthRequests",{deserializer:e=>e});class IH{constructor(e){this.stateProvider=e,this.state=this.stateProvider.getGlobal(kH)}getAll$(){return this.state.state$}add(e){return SH(this,void 0,void 0,function*(){const t=Date.now();yield this.stateProvider.getGlobal(kH).update(i=>[...(null!=i?i:[]).filter(t=>t.userId!==e),{userId:e,receivedAtMs:t}])})}pruneOlderThan(e){return SH(this,void 0,void 0,function*(){const t=Date.now()-e;yield this.stateProvider.getGlobal(kH).update(e=>(null!=e?e:[]).filter(e=>e.receivedAtMs>=t))})}clear(e){return SH(this,void 0,void 0,function*(){yield this.stateProvider.getGlobal(kH).update(t=>(null!=t?t:[]).filter(t=>t.userId!==e))})}}class CH{}class TH{}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())})};function FH(e,t){1&e&&(yl.j41(0,"div",7),yl.nrm(1,"i",8),yl.k0s())}function RH(e,t){if(1&e&&(yl.qex(0),yl.DNE(1,FH,2,0,"div",6),yl.bVm()),2&e){const e=yl.XpG();yl.R7$(),yl.Y8G("ngIf",e.loading)}}function xH(e,t){if(1&e&&(yl.qex(0),yl.j41(1,"p"),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.j41(4,"div")(5,"span",9),yl.EFF(6),yl.nI1(7,"i18n"),yl.k0s(),yl.j41(8,"p",10),yl.EFF(9),yl.k0s()(),yl.j41(10,"div")(11,"span",9),yl.EFF(12),yl.nI1(13,"i18n"),yl.k0s(),yl.j41(14,"p"),yl.EFF(15),yl.k0s()(),yl.j41(16,"div")(17,"span",9),yl.EFF(18),yl.nI1(19,"i18n"),yl.k0s(),yl.j41(20,"p")(21,"span",11),yl.EFF(22),yl.k0s(),yl.EFF(23),yl.k0s()(),yl.j41(24,"div")(25,"span",9),yl.EFF(26),yl.nI1(27,"i18n"),yl.k0s(),yl.j41(28,"p"),yl.EFF(29),yl.k0s()(),yl.bVm()),2&e){const e=yl.XpG();yl.R7$(2),yl.JRh(yl.i5U(3,10,"accessAttemptBy",e.email)),yl.R7$(4),yl.JRh(yl.bMT(7,13,"fingerprintPhraseHeader")),yl.R7$(3),yl.JRh(e.fingerprintPhrase),yl.R7$(3),yl.JRh(yl.bMT(13,15,"deviceType")),yl.R7$(3),yl.JRh(e.readableDeviceTypeName),yl.R7$(3),yl.JRh(yl.bMT(19,17,"location")),yl.R7$(4),yl.SpI("",null==e.authRequestResponse?null:e.authRequestResponse.requestCountryName," "),yl.R7$(),yl.SpI(" (",null==e.authRequestResponse?null:e.authRequestResponse.requestIpAddress,") "),yl.R7$(3),yl.JRh(yl.bMT(27,19,"time")),yl.R7$(3),yl.JRh(e.requestTimeText)}}const AH=3e5;class DH{constructor(e,t,i,n,r,s,o,a,l,c,u){this.params=e,this.accountService=t,this.apiService=i,this.authRequestService=n,this.devicesService=r,this.dialogRef=s,this.i18nService=o,this.loginApprovalDialogComponentService=a,this.logService=l,this.toastService=c,this.validationService=u,this.loading=!0,this.denyLogin=()=>PH(this,void 0,void 0,function*(){yield this.retrieveAuthRequestAndRespond(!1)}),this.approveLogin=()=>PH(this,void 0,void 0,function*(){yield this.retrieveAuthRequestAndRespond(!0)}),this.authRequestId=e.notificationId}ngOnDestroy(){return PH(this,void 0,void 0,function*(){clearInterval(this.interval)})}ngOnInit(){return PH(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=kd.fromB64ToArray(this.authRequestResponse.publicKey);this.email=yield(0,ho._)(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()},AH),yield this.loginApprovalDialogComponentService.showLoginRequestedAlertIfWindowNotVisible(this.email),this.loading=!1):this.logService.error("LoginApprovalDialogComponent: email not found")})}static open(e,t){return e.open(DH,{data:t})}retrieveAuthRequestAndRespond(e){return PH(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<=AH?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")}))}}DH.ɵfac=function(e){return new(e||DH)(yl.rXU(nd.Qs),yl.rXU(Ok),yl.rXU(Mk),yl.rXU(mw),yl.rXU(CH),yl.rXU(Xd),yl.rXU(Pl),yl.rXU(TH),yl.rXU(za),yl.rXU(xb),yl.rXU(Cd))},DH.ɵcmp=yl.VBU({type:DH,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&&(yl.j41(0,"bit-dialog")(1,"span",0),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.qex(4,1),yl.DNE(5,RH,2,1,"ng-container",2)(6,xH,30,21,"ng-container",2),yl.bVm(),yl.qex(7,3),yl.j41(8,"button",4),yl.EFF(9),yl.nI1(10,"i18n"),yl.k0s(),yl.j41(11,"button",5),yl.EFF(12),yl.nI1(13,"i18n"),yl.k0s(),yl.bVm(),yl.k0s()),2&e&&(yl.R7$(2),yl.JRh(yl.bMT(3,9,"loginRequest")),yl.R7$(3),yl.Y8G("ngIf",t.loading),yl.R7$(),yl.Y8G("ngIf",!t.loading),yl.R7$(2),yl.Y8G("bitAction",t.approveLogin)("disabled",t.loading),yl.R7$(),yl.SpI(" ",yl.bMT(10,11,"confirmAccess")," "),yl.R7$(2),yl.Y8G("bitAction",t.denyLogin)("disabled",t.loading),yl.R7$(),yl.SpI(" ",yl.bMT(13,13,"denyAccess")," "))},dependencies:[rc,Rd,Xu,Ku,pl.MD,pl.bT,dh,uh,qf,Xf],encapsulation:2});var EH=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 $H(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",3),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG().$implicit,i=yl.XpG();return a.Njj(i.answerAuthRequest(t.pendingAuthRequest))}),yl.j41(1,"span",4),yl.EFF(2),yl.k0s(),yl.j41(3,"span",5)(4,"span",6),yl.EFF(5),yl.nI1(6,"i18n"),yl.k0s()(),yl.j41(7,"span",7),yl.nrm(8,"br"),yl.j41(9,"div")(10,"span",8),yl.EFF(11),yl.nI1(12,"i18n"),yl.k0s(),yl.j41(13,"span"),yl.EFF(14),yl.nI1(15,"date"),yl.k0s()()()()}if(2&e){const e=yl.XpG().$implicit;yl.BMQ("tabindex",null!=e.pendingAuthRequest?0:null),yl.R7$(2),yl.JRh(e.displayName),yl.R7$(3),yl.SpI(" ",yl.bMT(6,5,"requestPending")," "),yl.R7$(6),yl.SpI(" ",yl.bMT(12,7,"firstLogin"),": "),yl.R7$(3),yl.JRh(yl.i5U(15,9,e.firstLogin,"medium"))}}function OH(e,t){1&e&&(yl.j41(0,"div",5)(1,"span",10),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s()()),2&e&&(yl.R7$(2),yl.SpI(" ",yl.bMT(3,1,"currentSession")," "))}function UH(e,t){1&e&&(yl.j41(0,"span"),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()),2&e&&(yl.R7$(),yl.JRh(yl.bMT(2,1,"trusted")))}function MH(e,t){1&e&&yl.nrm(0,"br")}function NH(e,t){if(1&e&&(yl.j41(0,"bit-item-content",2)(1,"span",4),yl.EFF(2),yl.k0s(),yl.DNE(3,OH,4,3,"div",9),yl.j41(4,"div",7),yl.nVh(5,UH,3,3,"span")(6,MH,1,0,"br"),yl.j41(7,"div")(8,"span",8),yl.EFF(9),yl.nI1(10,"i18n"),yl.k0s(),yl.j41(11,"span"),yl.EFF(12),yl.nI1(13,"date"),yl.k0s()()()()),2&e){const e=yl.XpG().$implicit;yl.R7$(2),yl.JRh(e.displayName),yl.R7$(),yl.Y8G("ngIf",e.isCurrentDevice),yl.R7$(2),yl.vxM(e.isTrusted?5:6),yl.R7$(4),yl.SpI("",yl.bMT(10,5,"firstLogin"),": "),yl.R7$(3),yl.JRh(yl.i5U(13,7,e.firstLogin,"medium"))}}function VH(e,t){if(1&e&&(yl.j41(0,"bit-item"),yl.nVh(1,$H,16,12,"button",1)(2,NH,14,10,"bit-item-content",2),yl.k0s()),2&e){const e=t.$implicit;yl.R7$(),yl.vxM(e.pendingAuthRequest?1:2)}}class BH{constructor(){this.devices=[],this.onAuthRequestAnswered=new yl.bkB}answerAuthRequest(e){null!=e&&this.onAuthRequestAnswered.emit(e)}}BH.ɵfac=function(e){return new(e||BH)},BH.ɵcmp=yl.VBU({type:BH,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&&(yl.j41(0,"bit-item-group"),yl.DNE(1,VH,3,1,"bit-item",0),yl.k0s()),2&e&&(yl.R7$(),yl.Y8G("ngForOf",t.devices))},dependencies:[Kc,_c,pl.MD,pl.YU,pl.Sq,pl.bT,wP,IP,FP,RP,pl.vh,Hl],encapsulation:2});class jH{constructor(e){this.table=e,this.bitSortable=o.hFB.required(),this.default=(0,o.hFB)(!1,{transform:e=>"desc"===e||"asc"===e?e:!!(0,HR.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 GH(e,t){if(1&e&&(yl.j41(0,"th",4),yl.EFF(1),yl.k0s()),2&e){const e=t.$implicit;yl.HbH(e.headerClass),yl.Y8G("bitSortable",e.sortable?e.name:""),yl.R7$(),yl.SpI(" ",e.title," ")}}function LH(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"a",12),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG().$implicit,i=yl.XpG();return a.Njj(i.answerAuthRequest(t.pendingAuthRequest))}),yl.EFF(1),yl.k0s(),yl.nrm(2,"br")}if(2&e){const e=yl.XpG().$implicit;yl.R7$(),yl.SpI(" ",e.displayName," ")}}function zH(e,t){1&e&&(yl.j41(0,"div",14),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()),2&e&&(yl.R7$(),yl.SpI(" ",yl.bMT(2,1,"trusted")," "))}function _H(e,t){if(1&e&&(yl.j41(0,"span"),yl.EFF(1),yl.k0s(),yl.DNE(2,zH,3,3,"div",13)),2&e){const e=yl.XpG().$implicit;yl.R7$(),yl.JRh(e.displayName),yl.R7$(),yl.Y8G("ngIf",e.isTrusted)}}function KH(e,t){1&e&&(yl.j41(0,"span",15),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()),2&e&&(yl.R7$(),yl.SpI(" ",yl.bMT(2,1,"currentSession")," "))}function XH(e,t){1&e&&(yl.j41(0,"span",16),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()),2&e&&(yl.R7$(),yl.SpI(" ",yl.bMT(2,1,"requestPending")," "))}function qH(e,t){if(1&e&&(yl.j41(0,"td",5)(1,"div",6),yl.nrm(2,"i",7),yl.k0s(),yl.j41(3,"div"),yl.nVh(4,LH,3,1)(5,_H,3,2),yl.k0s()(),yl.j41(6,"td",8)(7,"div",9),yl.DNE(8,KH,3,3,"span",10)(9,XH,3,3,"span",11),yl.k0s()(),yl.j41(10,"td",8),yl.EFF(11),yl.nI1(12,"date"),yl.k0s()),2&e){const e=t.$implicit;yl.R7$(2),yl.HbH(e.icon),yl.R7$(2),yl.vxM(e.pendingAuthRequest?4:5),yl.R7$(4),yl.Y8G("ngIf",e.isCurrentDevice),yl.R7$(),yl.Y8G("ngIf",e.pendingAuthRequest),yl.R7$(2),yl.JRh(yl.i5U(12,6,e.firstLogin,"medium"))}}jH.ɵfac=function(e){return new(e||jH)(yl.rXU(kh))},jH.ɵcmp=yl.VBU({type:jH,selectors:[["th","bitSortable",""]],hostVars:1,hostBindings:function(e,t){2&e&&yl.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&&(yl.NAR(),yl.j41(0,"button",0),yl.bIt("click",function(){return t.setActive()}),yl.SdG(1),yl.nrm(2,"i",1),yl.k0s()),2&e&&(yl.Y8G("ngClass",t.classList),yl.BMQ("aria-pressed",t.isActive),yl.R7$(2),yl.Y8G("ngClass",t.icon))},dependencies:[pl.YU],encapsulation:2});class YH{constructor(e){this.i18nService=e,this.devices=[],this.onAuthRequestAnswered=new yl.bkB,this.tableDataSource=new OL,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 WH(e,t){return e.pendingAuthRequest?-1:t.pendingAuthRequest?1:e.isCurrentDevice?-1:t.isCurrentDevice?1:e.creationDate>t.creationDate?-1:e.creationDate{"openLoginApproval"===e.command&&e.notificationId&&"string"==typeof e.notificationId&&this.upsertDeviceWithPendingAuthRequest(e.notificationId)})})}loadDevices(){return JH(this,void 0,void 0,function*(){try{const e=yield(0,ho._)(this.devicesService.getDevices$()),t=yield(0,ho._)(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(WH)}upsertDeviceWithPendingAuthRequest(e){return JH(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,ho._)(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(WH)):this.devices=[i,...this.devices].sort(WH)})}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=Pa[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 JH(this,void 0,void 0,function*(){const t=DH.open(this.dialogService,{notificationId:e.id}),i=yield(0,ho._)(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(WH)}(this.devices,e),yield this.pendingAuthRequestStateService.clear(yield(0,ho._)(this.accountService.activeAccount$.pipe(Gp))))})}}tJ.ɵfac=function(e){return new(e||tJ)(yl.rXU(Ok),yl.rXU(dw),yl.rXU(a.abz),yl.rXU(HH),yl.rXU(CH),yl.rXU(Jd),yl.rXU(Pl),yl.rXU(ZS),yl.rXU(IH),yl.rXU(Cd))},tJ.ɵcmp=yl.VBU({type:tJ,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&&(yl.DNE(0,ZH,16,13,"div",1),yl.nVh(1,QH,2,0,"div",2)(2,eJ,2,2)),2&e&&(yl.Y8G("ngIf",t.showHeaderInfo),yl.R7$(),yl.vxM(t.initializing?1:2))},dependencies:[Xu,pl.MD,pl.YU,pl.bT,BH,YH,HN,WN,yV,Hl],encapsulation:2});class iJ{}iJ.ɵfac=function(e){return new(e||iJ)},iJ.ɵcmp=yl.VBU({type:iJ,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&&(yl.j41(0,"popup-page")(1,"popup-header",0),yl.nI1(2,"i18n"),yl.qex(3,1),yl.nrm(4,"app-pop-out"),yl.bVm(),yl.k0s(),yl.j41(5,"div",2),yl.nrm(6,"auth-device-management"),yl.k0s()()),2&e&&(yl.R7$(),yl.Y8G("pageTitle",yl.mNQ(yl.bMT(2,2,"devices"))))},dependencies:[tJ,eD,yD,hD,Hl],encapsulation:2});class nJ{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 nJ.fromBufferToB64(nJ.bufferSourceToUint8Array(e)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}static stringToBuffer(e){return nJ.fromB64ToArray(nJ.fromUrlB64ToB64(e)).buffer}static bufferSourceToUint8Array(e){return nJ.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;ee.userHandle===t)}}function rJ(e){return t=>new ea.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()})}class sJ{constructor(e){this.ngZone=e}messageListener(e,t){tl.messageListener(e,(e,i,n)=>this.ngZone.run(()=>t(e,i,n)))}messageListener$(){return tl.messageListener$().pipe(rJ(this.ngZone))}}sJ.ɵfac=function(e){return new(e||sJ)(a.KVO(yl.SKi))},sJ.ɵprov=a.jDH({token:sJ,factory:sJ.ɵfac,providedIn:"root"});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())})};const aJ="vault_viewVaultItem",lJ="vault_AddEditVaultItem",cJ="vault_Fido2Popout";function uJ(e){return oJ(this,arguments,void 0,function*(e,t=0){yield rl.closeSingleActionPopout(e,t)})}function dJ(e,t){return oJ(this,void 0,void 0,function*(){yield function(e,t){return oJ(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 rl.openPopout(s,{singleActionKey:`${aJ}_${i}`,senderWindowId:e.windowId,forceCloseExistingWindows:r})})}(e,Object.assign({forceCloseExistingWindows:!0},t)),yield tl.tabSendMessageData(e,"bgVaultItemRepromptPopoutOpened")})}var hJ=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 pJ{constructor(e,t,i,n){this.passwordRepromptService=e,this.userDecryptionOptionsService=t,this.dialogService=i,this.accountService=n}handleUserVerification(e,t,i){return hJ(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 hJ(this,void 0,void 0,function*(){return yield this.passwordRepromptService.showPasswordPrompt()})}showUserVerificationDialog(){return hJ(this,void 0,void 0,function*(){const e=yield QC.open(this.dialogService,{verificationType:"client"});if("cancel"!==e.userAction)return e.verificationSuccess?e.verificationSuccess:e.noAvailableClientVerificationMethods?yield this.promptUserToSetPin():void 0})}handleMasterPasswordReprompt(){return hJ(this,void 0,void 0,function*(){const e=yield(0,ho._)(this.accountService.activeAccount$);if(!(null==e?void 0:e.id))return!1;return(yield(0,ho._)(this.userDecryptionOptionsService.hasMasterPasswordById$(e.id)))?yield this.showMasterPasswordReprompt():yield this.showUserVerificationDialog()})}promptUserToSetPin(){return hJ(this,void 0,void 0,function*(){const e=kD.open(this.dialogService);if(!e)return;return(yield(0,ho._)(e.closed))?yield this.showUserVerificationDialog():void 0})}}var fJ=i(88804);Error;var vJ=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 mJ={ConnectResponse:"ConnectResponse",NewSessionCreatedRequest:"NewSessionCreatedRequest",PickCredentialRequest:"PickCredentialRequest",PickCredentialResponse:"PickCredentialResponse",ConfirmNewCredentialRequest:"ConfirmNewCredentialRequest",ConfirmNewCredentialResponse:"ConfirmNewCredentialResponse",InformExcludedCredentialRequest:"InformExcludedCredentialRequest",InformCredentialNotFoundRequest:"InformCredentialNotFoundRequest",AbortRequest:"AbortRequest",AbortResponse:"AbortResponse"};class gJ extends Error{constructor(){super("Fido2UserInterfaceSession was closed")}}class yJ{static create(e,t,i,n){return vJ(this,void 0,void 0,function*(){return new yJ(e,t,i,n)})}static sendMessage(e){tl.sendMessage("BrowserFido2UserInterfaceServiceMessage",e)}static abortPopout(e,t=!1){this.sendMessage({sessionId:e,type:mJ.AbortResponse,fallbackRequested:t})}static confirmNewCredentialResponse(e,t,i){this.sendMessage({sessionId:e,type:mJ.ConfirmNewCredentialResponse,cipherId:t,userVerified:i})}constructor(e,t,i,n=new AbortController,r=kd.newGuid()){this.authService=e,this.fallbackSupported=t,this.tab=i,this.abortController=n,this.sessionId=r,this.closed=!1,this.messages$=tl.messageListener$().pipe((0,To.p)(e=>e.sessionId===this.sessionId)),this.connected$=new fd.t(!1),this.destroy$=new go.B,this.messages$.pipe((0,To.p)(e=>e.type===mJ.ConnectResponse),(0,No.s)(1),(0,Jv.Q)(this.destroy$)).subscribe(()=>{this.connected$.next(!0)}),(0,hh.R)(n.signal,"abort").pipe((0,Jv.Q)(this.destroy$)).subscribe(()=>{this.close(),yJ.sendMessage({type:mJ.AbortRequest,sessionId:this.sessionId})}),this.messages$.pipe((0,To.p)(e=>e.type===mJ.AbortResponse),(0,No.s)(1),(0,Jv.Q)(this.destroy$)).subscribe(e=>{e.type===mJ.AbortResponse&&(this.close(),this.abort(e.fallbackRequested))}),this.windowClosed$=dF(chrome.windows.onRemoved).pipe((0,l.T)(([e])=>e)),yJ.sendMessage({type:mJ.NewSessionCreatedRequest,sessionId:r})}pickCredential(e){return vJ(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:mJ.PickCredentialRequest,cipherIds:e,sessionId:this.sessionId,userVerification:t,fallbackSupported:this.fallbackSupported};yield this.send(r);const s=yield this.receive(mJ.PickCredentialResponse);return{cipherId:s.cipherId,userVerified:s.userVerified}})}confirmNewCredential(e){return vJ(this,arguments,void 0,function*({credentialName:e,userName:t,userHandle:i,userVerification:n,rpId:r}){const s={type:mJ.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(mJ.ConfirmNewCredentialResponse);return{cipherId:o.cipherId,userVerified:o.userVerified}})}informExcludedCredential(e){return vJ(this,void 0,void 0,function*(){const t={type:mJ.InformExcludedCredentialRequest,sessionId:this.sessionId,existingCipherIds:e,fallbackSupported:this.fallbackSupported};yield this.send(t),yield this.receive(mJ.AbortResponse)})}ensureUnlockedVault(){return vJ(this,void 0,void 0,function*(){(yield this.authService.getAuthStatus())!==cd.Unlocked&&(yield this.connect())})}informCredentialNotFound(){return vJ(this,void 0,void 0,function*(){const e={type:mJ.InformCredentialNotFoundRequest,sessionId:this.sessionId,fallbackSupported:this.fallbackSupported};yield this.send(e),yield this.receive(mJ.AbortResponse)})}close(){return vJ(this,void 0,void 0,function*(){yield function(e){return oJ(this,void 0,void 0,function*(){yield rl.closeSingleActionPopout(`${cJ}_${e}`)})}(this.sessionId),this.closed=!0,this.destroy$.next(),this.destroy$.complete()})}abort(){return vJ(this,arguments,void 0,function*(e=!1){this.abortController.abort(e?"UserRequestedFallback":void 0)})}send(e){return vJ(this,void 0,void 0,function*(){this.connected$.value||(yield this.connect()),yJ.sendMessage(e)})}receive(e){return vJ(this,void 0,void 0,function*(){try{return yield(0,ho._)(this.messages$.pipe((0,To.p)(t=>t.sessionId===this.sessionId&&t.type===e),(0,Jv.Q)(this.destroy$)))}catch(e){if(e instanceof fJ.G)throw new gJ;throw e}})}connect(){return vJ(this,void 0,void 0,function*(){if(this.closed)throw new Error("Cannot re-open closed session");const e=(0,ho._)((0,bo.h)(this.connected$.pipe((0,To.p)(e=>!0===e)),(0,hh.R)(this.abortController.signal,"abort").pipe((0,co.n)(()=>(0,fo.$)(()=>new gJ))))),t=yield function(e,t){return oJ(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 rl.openPopout(r,{singleActionKey:`${cJ}_${i}`,senderWindowId:e.windowId,forceCloseExistingWindows:!0,windowOptions:{height:570}})).id})}(this.tab,{sessionId:this.sessionId,fallbackSupported:this.fallbackSupported});this.windowClosed$.pipe((0,To.p)(e=>t===e),(0,Jv.Q)(this.destroy$)).subscribe(()=>{this.close(),this.abort(!0)}),yield e})}}function bJ(e,t){1&e&&(yl.nrm(0,"i",3),yl.nI1(1,"i18n")),2&e&&yl.Y8G("appA11yTitle",yl.bMT(1,1,"shared"))}function wJ(e,t){if(1&e&&(yl.j41(0,"div"),yl.EFF(1),yl.k0s()),2&e){const e=yl.XpG();yl.R7$(),yl.JRh(e.getSubName(e.cipher))}}function SJ(e,t){if(1&e&&(yl.j41(0,"div"),yl.EFF(1),yl.k0s()),2&e){const e=yl.XpG();yl.R7$(),yl.JRh(e.cipher.subTitle)}}class kJ{constructor(){this.onSelected=new yl.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 IJ(){return(0,a.WQX)(ud.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})))}kJ.ɵfac=function(e){return new(e||kJ)},kJ.ɵcmp=yl.VBU({type:kJ,selectors:[["app-fido2-cipher-row"]],inputs:{cipher:"cipher",last:"last",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&&(yl.j41(0,"bit-item")(1,"button",0),yl.bIt("click",function(){return t.selectCipher(t.cipher)}),yl.nrm(2,"app-vault-icon",1),yl.j41(3,"span",2),yl.EFF(4),yl.nVh(5,bJ,2,3,"i",3),yl.k0s(),yl.qex(6,4),yl.nVh(7,wJ,2,1,"div"),yl.nVh(8,SJ,2,1,"div"),yl.bVm(),yl.k0s()()),2&e&&(yl.R7$(),yl.Y8G("appA11yTitle",yl.ai1("",t.title," - ",t.cipher.name)),yl.R7$(),yl.Y8G("cipher",t.cipher),yl.R7$(2),yl.SpI(" ",t.cipher.name," "),yl.R7$(),yl.vxM(t.cipher.organizationId?5:-1),yl.R7$(2),yl.vxM(t.getSubName(t.cipher)?7:-1),yl.R7$(),yl.vxM(t.cipher.subTitle?8:-1))},dependencies:[Kc,Xu,pl.MD,_l,wP,IP,FP,qf,jb,GO,Xl,Xf],encapsulation:2,changeDetection:0});var CJ=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 TJ(e,t){1&e&&yl.nrm(0,"div",6)}function PJ(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"div",1)(1,"button",2)(2,"span",3),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s(),yl.nrm(5,"i",4),yl.k0s(),yl.j41(6,"bit-menu",null,0)(8,"button",5),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.abort(!1))}),yl.EFF(9),yl.nI1(10,"i18n"),yl.k0s(),yl.j41(11,"button",5),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.abort())}),yl.EFF(12),yl.nI1(13,"i18n"),yl.k0s()()(),yl.nVh(14,TJ,1,0,"div",6)}if(2&e){const e=yl.sdS(7),t=yl.XpG();yl.R7$(),yl.Y8G("bitMenuTriggerFor",e),yl.R7$(2),yl.SpI(" ",yl.bMT(4,5,"useDeviceOrHardwareKey")," "),yl.R7$(6),yl.SpI(" ",yl.bMT(10,7,"justOnce")," "),yl.R7$(3),yl.SpI(" ",yl.bMT(13,9,"alwaysForThisSite")," "),yl.R7$(2),yl.vxM(t.showOverlay?14:-1)}}class FJ{constructor(e,t,i){this.domainSettingsService=e,this.platformUtilsService=t,this.i18nService=i,this.showOverlay=!1,this.fido2PopoutSessionData$=IJ()}abort(){return CJ(this,arguments,void 0,function*(e=!0){const t=yield(0,ho._)(this.fido2PopoutSessionData$);e?(this.showOverlay=!0,yield this.handleDomainExclusion(t.senderUrl),yield kd.delay(2e3),this.abortSession(t.sessionId)):this.abortSession(t.sessionId)})}handleDomainExclusion(e){return CJ(this,void 0,void 0,function*(){const t=yield(0,ho._)(this.domainSettingsService.neverDomains$),i=kd.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){yJ.abortPopout(e,!0)}}FJ.ɵfac=function(e){return new(e||FJ)(yl.rXU(oE),yl.rXU(Eb),yl.rXU(Pl))},FJ.ɵcmp=yl.VBU({type:FJ,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&&(yl.nVh(0,PJ,15,11),yl.nI1(1,"async")),2&e&&yl.vxM(yl.bMT(1,1,t.fido2PopoutSessionData$).fallbackSupported?0:-1)},dependencies:[pl.MD,qf,Dh,gL,bL,LE,pl.Jj,Xf],encapsulation:2});class RJ{}var xJ=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 AJ=(e,t)=>t.id;function DJ(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",3),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG(2);return a.Njj(t.addCipher())}),yl.nrm(1,"i",4),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s()}2&e&&(yl.R7$(2),yl.SpI(" ",yl.bMT(3,1,"new")," "))}function EJ(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"bit-section")(1,"bit-search",5),yl.nI1(2,"i18n"),yl.bIt("ngModelChange",function(){a.eBV(e);const t=yl.XpG(2);return a.Njj(t.search())}),yl.mxI("ngModelChange",function(t){a.eBV(e);const i=yl.XpG(2);return yl.DH7(i.searchText,t)||(i.searchText=t),a.Njj(t)}),yl.k0s()()}if(2&e){const e=yl.XpG(2);yl.R7$(),yl.Y8G("placeholder",yl.mNQ(yl.bMT(2,3,"searchVault"))),yl.R50("ngModel",e.searchText)}}function $J(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"app-fido2-cipher-row",9),yl.nI1(1,"i18n"),yl.bIt("onSelected",function(t){a.eBV(e);const i=yl.XpG(4);return a.Njj(i.handleCipherItemSelect(t))}),yl.k0s()}if(2&e){const e=t.$implicit;yl.Y8G("title",yl.mNQ(yl.bMT(1,3,"passkeyItem")))("cipher",e)}}function OJ(e,t){if(1&e&&(yl.j41(0,"bit-section-header")(1,"h2",7),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s()(),yl.Z7z(4,$J,2,5,"app-fido2-cipher-row",8,AJ)),2&e){const e=yl.XpG(3);yl.R7$(2),yl.JRh(yl.bMT(3,1,"chooseCipherForPasskeySave")),yl.R7$(2),yl.Dyx(e.displayedCiphers)}}function UJ(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"bit-no-items",6),yl.qex(1,10),yl.EFF(2),yl.nI1(3,"i18n"),yl.bVm(),yl.qex(4,11),yl.EFF(5),yl.nI1(6,"i18n"),yl.bVm(),yl.j41(7,"button",12),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG(3);return a.Njj(t.hasSearched?t.clearSearch():t.saveNewLogin())}),yl.EFF(8),yl.nI1(9,"i18n"),yl.k0s()()}if(2&e){const e=yl.XpG(3);yl.Y8G("icon",e.noResultsIcon),yl.R7$(2),yl.JRh(yl.bMT(3,5,e.hasSearched?"noItemsMatchSearch":"noMatchingLoginsForSite")),yl.R7$(3),yl.JRh(yl.bMT(6,7,e.hasSearched?"searchSavePasskeyNewLogin":"clearFiltersOrTryAnother")),yl.R7$(2),yl.Y8G("loading",e.loading),yl.R7$(),yl.SpI(" ",yl.bMT(9,9,e.hasSearched?"multiSelectClearAll":"savePasskeyNewLogin")," ")}}function MJ(e,t){if(1&e&&(yl.j41(0,"bit-section"),yl.nVh(1,OJ,6,3),yl.nVh(2,UJ,10,11,"bit-no-items",6),yl.k0s()),2&e){const e=yl.XpG(2);yl.R7$(),yl.vxM(e.displayedCiphers.length>0?1:-1),yl.R7$(),yl.vxM(e.displayedCiphers.length?-1:2)}}function NJ(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"app-fido2-cipher-row",9),yl.nI1(1,"i18n"),yl.bIt("onSelected",function(t){a.eBV(e);const i=yl.XpG(3);return a.Njj(i.handleCipherItemSelect(t))}),yl.k0s()}if(2&e){const e=t.$implicit;yl.Y8G("title",yl.mNQ(yl.bMT(1,3,"passkeyItem")))("cipher",e)}}function VJ(e,t){if(1&e&&(yl.j41(0,"bit-section")(1,"div",13)(2,"p"),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s(),yl.j41(5,"div",14),yl.Z7z(6,NJ,2,5,"app-fido2-cipher-row",8,AJ),yl.k0s()()()),2&e){const e=yl.XpG(2);yl.R7$(3),yl.JRh(yl.bMT(4,1,"passkeyAlreadyExists")),yl.R7$(3),yl.Dyx(e.displayedCiphers)}}function BJ(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"app-fido2-cipher-row",9),yl.nI1(1,"i18n"),yl.bIt("onSelected",function(t){a.eBV(e);const i=yl.XpG(4);return a.Njj(i.handleCipherItemSelect(t))}),yl.k0s()}if(2&e){const e=t.$implicit;yl.Y8G("title",yl.mNQ(yl.bMT(1,3,"passkeyItem")))("cipher",e)}}function jJ(e,t){if(1&e&&(yl.qex(0,10),yl.EFF(1),yl.nI1(2,"i18n"),yl.bVm(),yl.Z7z(3,BJ,2,5,"app-fido2-cipher-row",8,AJ)),2&e){const e=yl.XpG(3);yl.R7$(),yl.JRh(yl.bMT(2,1,"chooseCipherForPasskeyAuth")),yl.R7$(2),yl.Dyx(e.displayedCiphers)}}function GJ(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"bit-no-items",6),yl.qex(1,10),yl.EFF(2),yl.nI1(3,"i18n"),yl.bVm(),yl.qex(4,11),yl.EFF(5),yl.nI1(6,"i18n"),yl.bVm(),yl.j41(7,"button",12),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG(3);return a.Njj(t.hasSearched?t.clearSearch():t.saveNewLogin())}),yl.EFF(8),yl.nI1(9,"i18n"),yl.k0s()()}if(2&e){const e=yl.XpG(3);yl.Y8G("icon",e.noResultsIcon),yl.R7$(2),yl.JRh(yl.bMT(3,5,e.hasSearched?"noItemsMatchSearch":"noMatchingLoginsForSite")),yl.R7$(3),yl.JRh(yl.bMT(6,7,e.hasSearched?"searchSavePasskeyNewLogin":"clearFiltersOrTryAnother")),yl.R7$(2),yl.Y8G("loading",e.loading),yl.R7$(),yl.SpI(" ",yl.bMT(9,9,e.hasSearched?"multiSelectClearAll":"savePasskeyNewLogin")," ")}}function LJ(e,t){if(1&e&&(yl.j41(0,"bit-section"),yl.nVh(1,jJ,5,3)(2,GJ,10,11,"bit-no-items",6),yl.k0s()),2&e){const e=yl.XpG(2);yl.R7$(),yl.vxM(e.displayedCiphers.length>0?1:2)}}function zJ(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"bit-section")(1,"div",13)(2,"p"),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s()(),yl.j41(5,"button",15),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG(2);return a.Njj(t.abort(!1))}),yl.EFF(6),yl.nI1(7,"i18n"),yl.k0s()()}if(2&e){const e=yl.XpG(2);yl.R7$(3),yl.JRh(yl.bMT(4,3,"noPasskeysFoundForThisApplication")),yl.R7$(2),yl.Y8G("loading",e.loading),yl.R7$(),yl.SpI(" ",yl.bMT(7,5,"close")," ")}}function _J(e,t){if(1&e&&(yl.j41(0,"popup-page")(1,"popup-header",0),yl.nI1(2,"i18n"),yl.nVh(3,DJ,4,3,"button",1),yl.k0s(),yl.j41(4,"div",2),yl.nVh(5,EJ,3,5,"bit-section"),yl.nVh(6,MJ,3,2,"bit-section")(7,VJ,8,3,"bit-section")(8,LJ,3,1,"bit-section")(9,zJ,8,7,"bit-section"),yl.nrm(10,"app-fido2-use-browser-link"),yl.k0s()()),2&e){let e;const i=yl.XpG();yl.R7$(),yl.Y8G("pageTitle",yl.mNQ(yl.bMT(2,5,i.passkeyAction===i.PasskeyActions.Register?"savePasskey":"logInWithPasskeyQuestion"))),yl.R7$(2),yl.vxM(i.showNewPasskeyButton?3:-1),yl.R7$(2),yl.vxM(i.passkeyAction===i.PasskeyActions.Register?5:-1),yl.R7$(),yl.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 KJ={Register:"register",Authenticate:"authenticate"};class XJ{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 go.B,this.message$=new fd.t(null),this.BrowserFido2MessageTypes=mJ,this.ciphers=[],this.displayedCiphers=[],this.loading=!1,this.noResultsIcon=dj,this.passkeyAction=KJ.Register,this.PasskeyActions=KJ,this.hasSearched=!1,this.searchTypeSearch=!1,this.showNewPasskeyButton=!1}ngOnInit(){this.searchTypeSearch=!this.platformUtilsService.isSafari();const e=this.activatedRoute.queryParamMap.pipe((0,No.s)(1),(0,l.T)(e=>({sessionId:e.get("sessionId"),senderTabId:e.get("senderTabId"),senderUrl:e.get("senderUrl")})));(0,$o.z)([e,this.browserMessagingApi.messageListener$()]).pipe((0,yo.H)(e=>xJ(this,[e],void 0,function*([e,t]){if(this.sessionId=e.sessionId,this.senderTabId=e.senderTabId,this.url=e.senderUrl,t.type!==mJ.NewSessionCreatedRequest||t.sessionId===e.sessionId){if(t.sessionId===e.sessionId){if(t.type!==mJ.AbortRequest)return t;this.abort(!1)}}else this.abort(!1)})),(0,To.p)(e=>!!e),(0,Jv.Q)(this.destroy$)).subscribe(e=>{this.message$.next(e)}),this.data$=this.message$.pipe((0,To.p)(e=>null!=e),(0,yo.H)(e=>xJ(this,void 0,void 0,function*(){switch(e.type){case mJ.ConfirmNewCredentialRequest:{const t=yield(0,ho._)(this.domainSettingsService.getUrlEquivalentDomains(this.url)),i=yield(0,ho._)(this.accountService.activeAccount$.pipe(Gp));this.ciphers=(yield this.cipherService.getAllDecrypted(i)).filter(e=>e.type===CR.Login&&!e.isDeleted),this.displayedCiphers=this.ciphers.filter(i=>i.login.matchesUri(this.url,t)&&nJ.cipherHasNoOtherPasskeys(i,e.userHandle)),this.passkeyAction=KJ.Register,this.showNewPasskeyButton=!0;break}case mJ.PickCredentialRequest:{const t=yield(0,ho._)(this.accountService.activeAccount$.pipe((0,l.T)(e=>null==e?void 0:e.id)));this.ciphers=yield Promise.all(e.cipherIds.map(e=>xJ(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=KJ.Authenticate;break}case mJ.InformExcludedCredentialRequest:{const t=yield(0,ho._)(this.accountService.activeAccount$.pipe((0,l.T)(e=>null==e?void 0:e.id)));this.ciphers=yield Promise.all(e.existingCipherIds.map(e=>xJ(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=KJ.Register;break}case mJ.InformCredentialNotFoundRequest:this.passkeyAction=KJ.Authenticate}return{message:e,fallbackSupported:"fallbackSupported"in e&&e.fallbackSupported}})),(0,Jv.Q)(this.destroy$)),e.pipe((0,Jv.Q)(this.destroy$)).subscribe(e=>{this.send({sessionId:e.sessionId,type:mJ.ConnectResponse})})}submit(){return xJ(this,void 0,void 0,function*(){const e=this.message$.value;if((null==e?void 0:e.type)===mJ.PickCredentialRequest){const t=yield this.handleUserVerification(e.userVerification,this.cipher);this.send({sessionId:this.sessionId,cipherId:this.cipher.id,type:mJ.PickCredentialResponse,userVerified:t})}else if((null==e?void 0:e.type)===mJ.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:mJ.ConfirmNewCredentialResponse,userVerified:t})}this.loading=!0})}saveNewLogin(){return xJ(this,void 0,void 0,function*(){var e;const t=this.message$.value;if((null==t?void 0:t.type)===mJ.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:mJ.ConfirmNewCredentialResponse,userVerified:t.userVerification})}this.loading=!0})}handleCipherItemSelect(e){return xJ(this,void 0,void 0,function*(){this.cipher=e,yield this.submit()})}addCipher(){return xJ(this,void 0,void 0,function*(){const e=this.message$.value;(null==e?void 0:e.type)===mJ.ConfirmNewCredentialRequest&&(yield this.router.navigate(["/add-cipher"],{queryParams:{type:CR.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:`${cJ}_${this.sessionId}`}}))})}getEquivalentDomains(){return xJ(this,void 0,void 0,function*(){return this.equivalentDomainsURL!==this.url&&(this.equivalentDomainsURL=this.url,this.equivalentDomains=yield(0,ho._)(this.domainSettingsService.getUrlEquivalentDomains(this.url))),this.equivalentDomains})}clearSearch(){return xJ(this,void 0,void 0,function*(){this.searchText="",yield this.setDisplayedCiphersToAllDomainMatch()})}setDisplayedCiphersToAllDomainMatch(){return xJ(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 xJ(this,void 0,void 0,function*(){const e=yield(0,ho._)(Gp(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:mJ.AbortResponse,fallbackRequested:e})}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}buildCipher(e,t){this.cipher=new L$,this.cipher.name=e,this.cipher.type=CR.Login,this.cipher.login=new V$,this.cipher.login.username=t,this.cipher.login.uris=[new uE],this.cipher.login.uris[0].uri=this.url,this.cipher.card=new x$,this.cipher.identity=new O$,this.cipher.secureNote=new j$,this.cipher.secureNote.type=$R,this.cipher.reprompt=kR.None}createNewCipher(e,t){return xJ(this,void 0,void 0,function*(){const i=yield(0,ho._)(this.accountService.activeAccount$.pipe((0,l.T)(e=>null==e?void 0:e.id)));this.buildCipher(e,t);const n=yield this.cipherService.encrypt(this.cipher,i);try{yield this.cipherService.createWithServer(n),this.cipher.id=n.cipher.id}catch(e){this.logService.error(e)}})}handleUserVerification(e,t){return xJ(this,void 0,void 0,function*(){return t&&0!==t.reprompt?yield this.passwordRepromptService.showPasswordPrompt():e})}send(e){yJ.sendMessage(Object.assign({sessionId:this.sessionId},e))}}XJ.ɵfac=function(e){return new(e||XJ)(yl.rXU(ud.Ix),yl.rXU(ud.nX),yl.rXU(Fb),yl.rXU(Eb),yl.rXU(oE),yl.rXU(RJ),yl.rXU(za),yl.rXU(Jd),yl.rXU(sJ),yl.rXU($E),yl.rXU(Ok),yl.rXU(pJ))},XJ.ɵcmp=yl.VBU({type:XJ,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&&(yl.nVh(0,_J,11,7,"popup-page"),yl.nI1(1,"async")),2&e){let e;yl.vxM((e=yl.bMT(1,1,t.data$))?0:-1,e)}},dependencies:[Xu,Ku,pl.MD,kJ,FJ,fl.YN,fl.BC,fl.vS,wP,qf,hk,Eh,pj,yD,hD,v$,f$,ZR,ex,pl.Jj,Xf],encapsulation:2});const qJ=["*",[["","slot","end"]]];class YJ{}YJ.ɵfac=function(e){return new(e||YJ)},YJ.ɵcmp=yl.VBU({type:YJ,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&&(yl.NAR(qJ),yl.rj2(0,"footer",0)(1,"div",1)(2,"div",2),yl.SdG(3),yl.eux(),yl.rj2(4,"div",3),yl.SdG(5,1),yl.eux()()())},encapsulation:2});var WJ=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 HJ=["uriInput"];function JJ(e,t){if(1&e&&(yl.j41(0,"bit-item-content")(1,"div",18),yl.EFF(2),yl.k0s()()),2&e){const e=yl.XpG(),t=e.$implicit,i=e.index;yl.R7$(),yl.Y8G("id",yl.VkB("blockedDomain",i)),yl.R7$(),yl.JRh(t)}}function ZJ(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",19),yl.nI1(1,"i18n"),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG().index,i=yl.XpG(2);return a.Njj(i.removeDomain(t))}),yl.k0s()}2&e&&yl.Y8G("label",yl.mNQ(yl.bMT(1,2,"remove")))}function QJ(e,t){if(1&e&&(yl.j41(0,"bit-item"),yl.DNE(1,JJ,3,3,"bit-item-content",6)(2,ZJ,2,4,"button",17),yl.k0s()),2&e){const e=t.index,i=yl.XpG(2);yl.R7$(),yl.Y8G("ngIf",ethis.handleStateUpdate(e)),this.uriInputElements.changes.pipe((0,Jv.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 WJ(this,void 0,void 0,function*(){this.domainForms.push(this.formBuilder.control(null)),yield this.fieldChange()})}removeDomain(e){return WJ(this,void 0,void 0,function*(){this.blockedDomainsState.splice(e,1),eObject.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 WJ(this,void 0,void 0,function*(){yield this.popupRouterCacheService.back()})}trackByFunction(e,t){return e}}iZ.ɵfac=function(e){return new(e||iZ)(yl.rXU(oE),yl.rXU(Pl),yl.rXU(xb),yl.rXU(fl.ok),yl.rXU(aD))},iZ.ɵcmp=yl.VBU({type:iZ,selectors:[["app-blocked-domains"]],viewQuery:function(e,t){if(1&e&&yl.GBs(HJ,5),2&e){let e;yl.mGM(e=yl.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&&(yl.j41(0,"popup-page")(1,"popup-header",1),yl.nI1(2,"i18n"),yl.qex(3,2),yl.nrm(4,"app-pop-out"),yl.bVm(),yl.k0s(),yl.j41(5,"div",3)(6,"bit-section")(7,"p",4),yl.EFF(8),yl.nI1(9,"i18n"),yl.k0s(),yl.j41(10,"a",5),yl.EFF(11),yl.nI1(12,"i18n"),yl.k0s()(),yl.DNE(13,tZ,14,11,"bit-section",6),yl.k0s(),yl.j41(14,"popup-footer",7)(15,"button",8),yl.bIt("click",function(){return t.saveChanges()}),yl.EFF(16),yl.nI1(17,"i18n"),yl.k0s(),yl.j41(18,"button",9),yl.bIt("click",function(){return t.goBack()}),yl.EFF(19),yl.nI1(20,"i18n"),yl.k0s()()()),2&e&&(yl.R7$(),yl.Y8G("pageTitle",yl.mNQ(yl.bMT(2,8,"blockedDomains"))),yl.R7$(7),yl.JRh(yl.bMT(9,10,"blockedDomainsDesc")),yl.R7$(3),yl.JRh(yl.bMT(12,12,"learnMoreAboutBlockedDomains")),yl.R7$(2),yl.Y8G("ngIf",!t.isLoading),yl.R7$(2),yl.Y8G("disabled",t.dataIsPristine),yl.R7$(),yl.SpI(" ",yl.bMT(17,14,"save")," "),yl.R7$(3),yl.SpI(" ",yl.bMT(20,16,"cancel")," "))},dependencies:[Xu,Ku,WR,pl.MD,pl.Sq,pl.bT,Eu,Sc,ou,Du,fl.YN,fl.qT,fl.me,fl.BC,fl.cb,fl.X1,fl.j4,fl.JD,fl.v8,_l,zl,wP,IP,FP,qf,II,Oh,_b,Kb,eD,YJ,yD,hD,sw.iI,ZR,ex,Xl,Wl,Xf],encapsulation:2});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 rZ=["uriInput"];function sZ(e,t){if(1&e&&(yl.j41(0,"bit-item-content")(1,"div",16),yl.EFF(2),yl.k0s()()),2&e){const e=yl.XpG(),t=e.$implicit,i=e.index;yl.R7$(),yl.Y8G("id",yl.VkB("excludedDomain",i)),yl.R7$(),yl.JRh(t)}}function oZ(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",17),yl.nI1(1,"i18n"),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG().index,i=yl.XpG(2);return a.Njj(i.removeDomain(t))}),yl.k0s()}2&e&&yl.Y8G("label",yl.mNQ(yl.bMT(1,2,"remove")))}function aZ(e,t){if(1&e&&(yl.j41(0,"bit-item"),yl.DNE(1,sZ,3,3,"bit-item-content",4)(2,oZ,2,4,"button",15),yl.k0s()),2&e){const e=t.index,i=yl.XpG(2);yl.R7$(),yl.Y8G("ngIf",ethis.handleStateUpdate(e)),this.uriInputElements.changes.pipe((0,Jv.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 nZ(this,void 0,void 0,function*(){this.domainForms.push(this.formBuilder.control(null)),yield this.fieldChange()})}removeDomain(e){return nZ(this,void 0,void 0,function*(){this.excludedDomainsState.splice(e,1),eObject.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}}uZ.ɵfac=function(e){return new(e||uZ)(yl.rXU(oE),yl.rXU(Pl),yl.rXU(xb),yl.rXU(fl.ok),yl.rXU(aD))},uZ.ɵcmp=yl.VBU({type:uZ,selectors:[["app-excluded-domains"]],viewQuery:function(e,t){if(1&e&&yl.GBs(rZ,5),2&e){let e;yl.mGM(e=yl.lsd())&&(t.uriInputElements=e)}},decls:18,vars:17,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&&(yl.j41(0,"popup-page")(1,"popup-header",1),yl.nI1(2,"i18n"),yl.qex(3,2),yl.nrm(4,"app-pop-out"),yl.bVm(),yl.k0s(),yl.j41(5,"div",3)(6,"p"),yl.EFF(7),yl.nI1(8,"i18n"),yl.nI1(9,"i18n"),yl.k0s(),yl.DNE(10,cZ,14,11,"bit-section",4),yl.k0s(),yl.j41(11,"popup-footer",5)(12,"button",6),yl.bIt("click",function(){return t.saveChanges()}),yl.EFF(13),yl.nI1(14,"i18n"),yl.k0s(),yl.j41(15,"button",7),yl.bIt("click",function(){return t.goBack()}),yl.EFF(16),yl.nI1(17,"i18n"),yl.k0s()()()),2&e&&(yl.R7$(),yl.Y8G("pageTitle",yl.mNQ(yl.bMT(2,7,"excludedDomains"))),yl.R7$(6),yl.SpI(" ",t.accountSwitcherEnabled?yl.bMT(8,9,"excludedDomainsDescAlt"):yl.bMT(9,11,"excludedDomainsDesc")," "),yl.R7$(3),yl.Y8G("ngIf",!t.isLoading),yl.R7$(2),yl.Y8G("disabled",t.dataIsPristine),yl.R7$(),yl.SpI(" ",yl.bMT(14,13,"save")," "),yl.R7$(3),yl.SpI(" ",yl.bMT(17,15,"cancel")," "))},dependencies:[Xu,Ku,WR,pl.MD,pl.Sq,pl.bT,Eu,Sc,ou,Du,fl.YN,fl.qT,fl.me,fl.BC,fl.cb,fl.X1,fl.j4,fl.JD,fl.v8,_l,zl,wP,IP,FP,qf,II,Oh,Kb,eD,YJ,yD,hD,sw.iI,ZR,ex,Xl,Wl,Xf],encapsulation:2});class dZ{}var hZ=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 pZ{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,co.n)(e=>o.hasPremiumFromAnySource$(e.id)))}ngOnInit(){return hZ(this,void 0,void 0,function*(){this.cloudWebVaultUrl=yield(0,ho._)(this.environmentService.cloudWebVaultUrl$);const e=yield this.billingApiService.getPremiumPlan();this.storageProvidedGb=e.storage.provided,this.price=e.seat.price})}refresh(){return hZ(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 hZ(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 hZ(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`)})}}pZ.ɵfac=function(e){return new(e||pZ)(yl.rXU(Pl),yl.rXU(Eb),yl.rXU(Mk),yl.rXU(za),yl.rXU(Jd),yl.rXU(JS),yl.rXU(ME),yl.rXU(xb),yl.rXU(Ok),yl.rXU(dZ))},pZ.ɵdir=yl.FsC({type:pZ});class fZ{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)}))}}fZ.ɵfac=function(e){return new(e||fZ)(yl.rXU(yl.aKT),yl.rXU(Cd),yl.rXU(za))},fZ.ɵdir=yl.FsC({type:fZ,selectors:[["","appApiAction",""]],inputs:{appApiAction:"appApiAction"},standalone:!1,features:[yl.OA$]});var vZ=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 mZ extends pZ{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 vZ(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()}}mZ.ɵfac=function(e){return new(e||mZ)(yl.rXU(Pl),yl.rXU(Eb),yl.rXU(Mk),yl.rXU(za),yl.rXU(sF.aZ),yl.rXU(pl.oe),yl.rXU(Jd),yl.rXU(JS),yl.rXU(ME),yl.rXU(xb),yl.rXU(Ok),yl.rXU(dZ))},mZ.ɵcmp=yl.VBU({type:mZ,selectors:[["app-premium"]],features:[yl.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=yl.RV6();yl.j41(0,"popup-page")(1,"popup-header",1),yl.nI1(2,"i18n"),yl.qex(3,2),yl.nrm(4,"app-pop-out"),yl.bVm(),yl.k0s(),yl.j41(5,"div",3)(6,"h2",4),yl.EFF(7),yl.nI1(8,"i18n"),yl.k0s(),yl.j41(9,"bit-section")(10,"bit-card")(11,"div",3)(12,"ul",5)(13,"li"),yl.EFF(14),yl.nI1(15,"i18n"),yl.k0s(),yl.j41(16,"li"),yl.EFF(17),yl.nI1(18,"i18n"),yl.k0s(),yl.j41(19,"li"),yl.EFF(20),yl.nI1(21,"i18n"),yl.k0s(),yl.j41(22,"li"),yl.EFF(23),yl.nI1(24,"i18n"),yl.k0s(),yl.j41(25,"li"),yl.EFF(26),yl.nI1(27,"i18n"),yl.k0s(),yl.j41(28,"li"),yl.EFF(29),yl.nI1(30,"i18n"),yl.k0s(),yl.j41(31,"li"),yl.EFF(32),yl.nI1(33,"i18n"),yl.k0s()()(),yl.j41(34,"p",6),yl.EFF(35),yl.k0s()()(),yl.j41(36,"button",7),yl.bIt("click",function(){return a.eBV(e),a.Njj(t.purchase())}),yl.j41(37,"b"),yl.EFF(38),yl.nI1(39,"i18n"),yl.k0s(),yl.nrm(40,"i",8),yl.k0s(),yl.j41(41,"button",9,0),yl.bIt("click",function(){return a.eBV(e),a.Njj(t.refresh())}),yl.j41(43,"span",10),yl.EFF(44),yl.nI1(45,"i18n"),yl.k0s(),yl.nrm(46,"i",11),yl.k0s()()()}if(2&e){const e=yl.sdS(42);yl.R7$(),yl.Y8G("pageTitle",yl.mNQ(yl.bMT(2,17,"premiumMembership"))),yl.R7$(6),yl.JRh(yl.bMT(8,19,"premiumFeatures")),yl.R7$(7),yl.SpI(" ",yl.i5U(15,21,"premiumSignUpStorageV2",`${t.storageProvidedGb} GB`)," "),yl.R7$(3),yl.SpI(" ",yl.bMT(18,24,"premiumSignUpTwoStepOptions")," "),yl.R7$(3),yl.SpI(" ",yl.bMT(21,26,"premiumSignUpEmergency")," "),yl.R7$(3),yl.SpI(" ",yl.bMT(24,28,"ppremiumSignUpReports")," "),yl.R7$(3),yl.SpI(" ",yl.bMT(27,30,"ppremiumSignUpTotp")," "),yl.R7$(3),yl.SpI(" ",yl.bMT(30,32,"ppremiumSignUpSupport")," "),yl.R7$(3),yl.SpI(" ",yl.bMT(33,34,"ppremiumSignUpFuture")," "),yl.R7$(3),yl.JRh(t.priceString),yl.R7$(3),yl.JRh(yl.bMT(39,36,"premiumPurchase")),yl.R7$(3),yl.Y8G("disabled",e.loading())("appApiAction",t.refreshPromise),yl.R7$(2),yl.Y8G("hidden",e.loading()),yl.R7$(),yl.JRh(yl.bMT(45,38,"premiumRefresh")),yl.R7$(2),yl.Y8G("hidden",!e.loading())}},dependencies:[Xu,Ku,WR,pl.MD,wP,qf,fZ,hD,yD,eD,sw.iI,ZR,Xf],encapsulation:2});const gZ={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"]},yZ={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"]}},bZ={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 wZ{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,bl.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",...gZ[e],...yZ[t].container,...bZ[i][t]]}),this.iconClasses=(0,bl.EW)(()=>{const e=this.size();return["bwi",this.icon(),...yZ[e].icon]})}}wZ.ɵfac=function(e){return new(e||wZ)},wZ.ɵcmp=yl.VBU({type:wZ,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&&(yl.j41(0,"div",0),yl.nrm(1,"i",1),yl.k0s()),2&e&&(yl.Y8G("ngClass",t.containerClasses()),yl.BMQ("aria-label",t.ariaLabel())("role",t.ariaLabel()?"img":null),yl.R7$(),yl.Y8G("ngClass",t.iconClasses()))},dependencies:[pl.YU],encapsulation:2});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())})};const kZ=new tk("phishing-detection-continue"),IZ=new tk("phishing-detection-cancel");class CZ{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..."),tl.addListener(chrome.tabs.onUpdated,this._handleTabUpdated.bind(this));const r=n.messages$(kZ).pipe((0,Fo.M)(t=>e.debug(`[PhishingDetectionService] user selected continue for ${t.url}`)),(0,yo.H)(e=>SZ(this,void 0,void 0,function*(){const t=new URL(e.url);this._ignoredHostnames.add(t.hostname),yield tl.navigateTabToUrl(e.tabId,t)}))),s=this._tabUpdated$.pipe((0,To.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,lo.F)((e,t)=>e.url.toString()===t.url.toString()&&e.tabId===t.tabId&&e.ignored===t.ignored),(0,Fo.M)(t=>e.debug("[PhishingDetectionService] processing event:",t)),(0,yo.H)(e=>SZ(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(tl.getRuntimeURL("popup/index.html#/security/phishing-warning")+`?phishingUrl=${i.toString()}`);yield tl.navigateTabToUrl(e,r)}))),o=n.messages$(IZ).pipe((0,co.n)(e=>tl.closeTab(e.tabId))),a=i.on$.pipe((0,lo.F)(),(0,co.n)(i=>i?(e.debug("[PhishingDetectionService] Enabling phishing detection service"),(0,bo.h)(t.update$,r,s,o)):(e.debug("[PhishingDetectionService] User does not have access to phishing detection service."),$p.w))).subscribe();return this._didInit=!0,()=>{a.unsubscribe(),this._didInit=!1,tl.removeListener(chrome.tabs.onUpdated,CZ._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://")}}CZ._tabUpdated$=new go.B,CZ._ignoredHostnames=new Set,CZ._didInit=!1;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())})};class PZ{constructor(){this.activatedRoute=(0,a.WQX)(ud.nX),this.messageSender=(0,a.WQX)(ek),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 TZ(this,void 0,void 0,function*(){const e=yield this.getTabId();this.messageSender.send(IZ,{tabId:e})})}continueAnyway(){return TZ(this,void 0,void 0,function*(){const e=yield(0,ho._)(this.phishingUrl$),t=yield this.getTabId();this.messageSender.send(kZ,{tabId:t,url:e})})}getTabId(){return TZ(this,void 0,void 0,function*(){var e;return null===(e=tl.getCurrentTab())||void 0===e?void 0:e.then(e=>e.id)})}}PZ.ɵfac=function(e){return new(e||PZ)},PZ.ɵcmp=yl.VBU({type:PZ,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&&(yl.j41(0,"div",0)(1,"div",1),yl.nrm(2,"bit-icon-tile",2),yl.j41(3,"h1",3),yl.EFF(4),yl.nI1(5,"i18n"),yl.k0s()(),yl.nrm(6,"hr",4),yl.j41(7,"p",5),yl.EFF(8),yl.nI1(9,"i18n"),yl.k0s(),yl.j41(10,"bit-callout",6)(11,"span",7),yl.EFF(12),yl.nI1(13,"async"),yl.k0s()(),yl.j41(14,"bit-callout",8)(15,"p",9),yl.EFF(16),yl.nI1(17,"i18n"),yl.j41(18,"b"),yl.EFF(19,"Phishing.Database"),yl.k0s(),yl.EFF(20),yl.nI1(21,"i18n"),yl.k0s(),yl.j41(22,"a",10),yl.EFF(23),yl.nI1(24,"i18n"),yl.nrm(25,"i",11),yl.k0s()(),yl.j41(26,"div",12)(27,"button",13),yl.bIt("click",function(){return t.closeTab()}),yl.EFF(28),yl.nI1(29,"i18n"),yl.k0s(),yl.j41(30,"button",14),yl.bIt("click",function(){return t.continueAnyway()}),yl.EFF(31),yl.nI1(32,"i18n"),yl.k0s()()()),2&e&&(yl.R7$(4),yl.JRh(yl.bMT(5,11,"phishingPageTitleV2")),yl.R7$(4),yl.JRh(yl.bMT(9,13,"phishingPageSummary")),yl.R7$(2),yl.Y8G("title",null),yl.R7$(2),yl.JRh(yl.bMT(13,15,t.phishingHostname$)),yl.R7$(2),yl.Y8G("icon",null),yl.R7$(2),yl.SpI(" ",yl.bMT(17,17,"phishingPageExplanation1")),yl.R7$(4),yl.SpI("",yl.bMT(21,19,"phishingPageExplanation2")," "),yl.R7$(3),yl.SpI(" ",yl.bMT(24,21,"phishingPageLearnMore")),yl.R7$(4),yl.Y8G("block",!0),yl.R7$(),yl.SpI(" ",yl.bMT(29,23,"phishingPageCloseTabV2")," "),yl.R7$(3),yl.SpI(" ",yl.bMT(32,25,"phishingPageContinueV2")," "))},dependencies:[pl.MD,$h,qf,Oh,_b,Kb,Eu,rc,id,Xu,Ku,sw.iI,wZ,ed,Xl,Wl,pl.Jj,Xf],encapsulation:2});class FZ{}FZ.ɵfac=function(e){return new(e||FZ)},FZ.ɵcmp=yl.VBU({type:FZ,selectors:[["dirt-phishing-protected-by"]],decls:3,vars:4,consts:[[1,"tw-text-muted"]],template:function(e,t){1&e&&(yl.rj2(0,"span",0),yl.EFF(1),yl.nI1(2,"i18n"),yl.eux()),2&e&&(yl.R7$(),yl.JRh(yl.i5U(2,1,"protectedBy","Bitwarden phishing blocker")))},dependencies:[pl.MD,qf,Xu,Oh,Xf],encapsulation:2});var RZ=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 xZ(e,t){1&e&&yl.nrm(0,"bit-empty-credential-history",6)}function AZ(e,t){if(1&e&&(yl.nrm(0,"bit-credential-generator-history",7),yl.nI1(1,"async")),2&e){const e=yl.XpG();yl.Y8G("account",yl.bMT(1,1,e.account$))}}class DZ{constructor(e,t,i,n){this.accountService=e,this.history=t,this.dialogService=i,this.logService=n,this.destroyed=new go.B,this.hasHistory$=new So.m(1),this.account$=new So.m(1),this.debug=!1,this.log=lB(),this.clear=()=>RZ(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,ho._)(this.account$)).id))})}ngOnChanges(e){return RZ(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 RZ(this,void 0,void 0,function*(){this.log=uB(this.debug,this.logService,{type:"CredentialGeneratorComponent"}),this.account||(this.account=yield(0,ho._)(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,co.n)(e=>e.id&&this.history.credentials$(e.id)),(0,l.T)(e=>e.length>0),(0,Jv.Q)(this.destroyed)).subscribe(this.hasHistory$)})}ngOnDestroy(){this.destroyed.next(),this.destroyed.complete(),this.log.debug("component destroyed")}}DZ.ɵfac=function(e){return new(e||DZ)(yl.rXU(Ok),yl.rXU(xy),yl.rXU(Jd),yl.rXU(za))},DZ.ɵcmp=yl.VBU({type:DZ,selectors:[["app-credential-generator-history"]],inputs:{account:"account",debug:"debug"},features:[yl.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&&(yl.j41(0,"popup-page")(1,"popup-header",0),yl.nI1(2,"i18n"),yl.qex(3,1),yl.nrm(4,"app-pop-out"),yl.bVm(),yl.k0s(),yl.DNE(5,xZ,1,0,"bit-empty-credential-history",2),yl.nI1(6,"async"),yl.DNE(7,AZ,2,3,"bit-credential-generator-history",3),yl.nI1(8,"async"),yl.j41(9,"popup-footer",4)(10,"button",5),yl.nI1(11,"async"),yl.bIt("click",function(){return t.clear()}),yl.EFF(12),yl.nI1(13,"i18n"),yl.k0s()()()),2&e&&(yl.R7$(),yl.Y8G("pageTitle",yl.bMT(2,5,"generatorHistory")),yl.R7$(4),yl.Y8G("ngIf",!yl.bMT(6,7,t.hasHistory$)),yl.R7$(2),yl.Y8G("ngIf",yl.bMT(8,9,t.hasHistory$)),yl.R7$(3),yl.Y8G("disabled",!yl.bMT(11,11,t.hasHistory$)),yl.R7$(2),yl.SpI(" ",yl.bMT(13,13,"clearHistory")," "))},dependencies:[Xu,Ku,pl.MD,pl.bT,qf,eD,yD,hD,cj,fj,YJ,pl.Jj,Xf],encapsulation:2});class EZ{}EZ.ɵfac=function(e){return new(e||EZ)},EZ.ɵcmp=yl.VBU({type:EZ,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&&(yl.j41(0,"popup-page")(1,"popup-header",0),yl.nI1(2,"i18n"),yl.qex(3,1),yl.nrm(4,"app-pop-out")(5,"app-current-account"),yl.bVm(),yl.k0s(),yl.nrm(6,"tools-credential-generator"),yl.j41(7,"bit-item")(8,"a",2),yl.EFF(9),yl.nI1(10,"i18n"),yl.nrm(11,"i",3),yl.k0s()()()),2&e&&(yl.R7$(),yl.Y8G("pageTitle",yl.bMT(2,2,"generator")),yl.R7$(8),yl.SpI(" ",yl.bMT(10,4,"generatorHistory")," "))},dependencies:[Mj,oj,PF,qf,eD,yD,hD,sw.iI,sw.Wk,wP,IP,FP,Xf],encapsulation:2});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())})};function OZ(){return(e,t)=>$Z(this,void 0,void 0,function*(){const e=Ha.getDevice(window)===Ta.FirefoxExtension,i=rl.inPopout(window),n=rl.inSidebar(window);return!(e&&!i&&!n)||(yield rl.openPopout(`popup/index.html#${t.url}`),tl.closePopup(window),!1)})}const UZ=Object.freeze({Text:0,File:1});class MZ{}class NZ{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 NZ,e)}}class VZ{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 VZ,e)}}class BZ{constructor(e){this.id=null,this.accessId=null,this.name=null,this.notes=null,this.type=null,this.text=new VZ,this.file=new NZ,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,e&&(this.id=e.id,this.accessId=e.accessId,this.type=e.type,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)}get urlB64Key(){return kd.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 kd.merge(Object.assign({},this),{key:kd.fromBufferToB64(this.key)})}static fromJSON(e){return null==e?null:Object.assign(new BZ,e,{key:kd.fromB64ToArray(e.key),cryptoKey:gf.fromJSON(e.cryptoKey),text:VZ.fromJSON(e.text),file:NZ.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 jZ{}class GZ{}var LZ=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 zZ(e,t){if(1&e&&(yl.j41(0,"bit-hint"),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()),2&e){const e=yl.XpG();yl.R7$(),yl.SpI(" ",yl.i5U(2,1,"limitSendViewsCount",e.viewsLeft))}}function _Z(e,t){1&e&&yl.nrm(0,"button",11)}function KZ(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",12),yl.nI1(1,"i18n"),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.generatePassword())}),yl.k0s()}if(2&e){const e=yl.XpG();yl.Y8G("label",yl.bMT(1,2,"generatePassword"))("disabled",!e.config.areSendsAllowed)}}function XZ(e,t){if(1&e&&(yl.nrm(0,"button",13),yl.nI1(1,"i18n"),yl.nI1(2,"i18n")),2&e){const e=yl.XpG();yl.Y8G("label",yl.bMT(1,4,"copyPassword"))("disabled",!e.config.areSendsAllowed||!e.sendOptionsForm.get("password").value)("valueLabel",yl.bMT(2,6,"password"))("appCopyClick",e.sendOptionsForm.get("password").value)}}function qZ(e,t){if(1&e&&(yl.nrm(0,"button",14),yl.nI1(1,"i18n")),2&e){const e=yl.XpG();yl.Y8G("label",yl.bMT(1,2,"removePassword"))("bitAction",e.removePassword)}}function YZ(e,t){if(1&e&&(yl.j41(0,"bit-form-control"),yl.nrm(1,"input",15),yl.j41(2,"bit-label"),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s()()),2&e){const e=yl.XpG();yl.R7$(),yl.Y8G("disabled",e.disableHideEmail&&!e.sendOptionsForm.get("hideEmail").value),yl.R7$(2),yl.JRh(yl.bMT(4,2,"hideYourEmail"))}}class WZ{get hasPassword(){return this.originalSendView&&null!==this.originalSendView.password}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,r,s,o,a,c){this.sendFormContainer=e,this.dialogService=t,this.sendApiService=i,this.formBuilder=n,this.policyService=r,this.i18nService=s,this.toastService=o,this.generatorService=a,this.accountService=c,this.disableHideEmail=!1,this.passwordRemoved=!1,this.sendOptionsForm=this.formBuilder.group({maxAccessCount:[null],accessCount:[null],notes:[null],password:[null],hideEmail:[!1]}),this.generatePassword=()=>LZ(this,void 0,void 0,function*(){const e=new fd.t({source:"send",type:bm.password}),t=this.accountService.activeAccount$.pipe(vm({name:()=>"send-options.component",distinct:(e,t)=>e.id===t.id})),i=yield(0,ho._)(this.generatorService.generate$({on$:e,account$:t}));this.sendOptionsForm.patchValue({password:i.credential})}),this.removePassword=()=>LZ(this,void 0,void 0,function*(){var e;if(!this.originalSendView||!this.originalSendView.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.sendOptionsForm.patchValue({password:null}),null===(e=this.sendOptionsForm.get("password"))||void 0===e||e.enable()}),this.sendFormContainer.registerChildForm("sendOptionsForm",this.sendOptionsForm),this.accountService.activeAccount$.pipe(Gp,(0,co.n)(e=>this.policyService.policiesByType$(_h.SendOptions,e)),(0,l.T)(e=>null==e?void 0:e.some(e=>e.data.disableHideEmail)),(0,wl.pQ)()).subscribe(e=>{this.disableHideEmail=e}),this.sendOptionsForm.valueChanges.pipe((0,Fo.M)(e=>{kd.isNullOrWhitespace(e.password)&&(e.password=null)}),(0,wl.pQ)()).subscribe(e=>{this.sendFormContainer.patchSend(t=>(Object.assign(t,{maxAccessCount:e.maxAccessCount,accessCount:e.accessCount,password:e.password,hideEmail:e.hideEmail,notes:e.notes}),t))})}ngOnInit(){var e;this.sendFormContainer.originalSendView&&this.sendOptionsForm.patchValue({maxAccessCount:this.sendFormContainer.originalSendView.maxAccessCount,accessCount:this.sendFormContainer.originalSendView.accessCount,password:this.hasPassword?"************":null,hideEmail:this.sendFormContainer.originalSendView.hideEmail,notes:this.sendFormContainer.originalSendView.notes}),this.hasPassword&&(null===(e=this.sendOptionsForm.get("password"))||void 0===e||e.disable()),this.config.areSendsAllowed||this.sendOptionsForm.disable()}}function HZ(e,t){if(1&e&&(yl.j41(0,"div")(1,"div",3),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.j41(4,"div",4),yl.EFF(5),yl.k0s(),yl.j41(6,"div",5),yl.EFF(7),yl.k0s()()),2&e){const e=yl.XpG();yl.R7$(2),yl.JRh(yl.bMT(3,3,"file")),yl.R7$(3),yl.SpI(" ",e.originalSendView().file.fileName," "),yl.R7$(2),yl.JRh(e.originalSendView().file.sizeName)}}function JZ(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"bit-form-field")(1,"bit-label",6),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.j41(4,"div",7)(5,"button",8),yl.bIt("click",function(){a.eBV(e);const t=yl.sdS(12);return a.Njj(t.click())}),yl.EFF(6),yl.nI1(7,"i18n"),yl.k0s(),yl.j41(8,"span",9),yl.EFF(9),yl.nI1(10,"i18n"),yl.k0s()(),yl.j41(11,"input",10,0),yl.bIt("change",function(t){a.eBV(e);const i=yl.XpG();return a.Njj(i.onFileSelected(t))}),yl.k0s(),yl.j41(13,"bit-hint"),yl.EFF(14),yl.nI1(15,"i18n"),yl.k0s()()}if(2&e){const e=yl.XpG();yl.R7$(2),yl.JRh(yl.bMT(3,5,"fileToShare")),yl.R7$(4),yl.SpI(" ",yl.bMT(7,7,"chooseFile")," "),yl.R7$(2),yl.Y8G("ngClass",e.fileName?"tw-text-main":"tw-text-muted"),yl.R7$(),yl.SpI(" ",e.fileName||yl.bMT(10,9,"noFileChosen")),yl.R7$(5),yl.SpI(" ",yl.bMT(15,11,"maxFileSize")," ")}}WZ.ɵfac=function(e){return new(e||WZ)(yl.rXU(jZ),yl.rXU(Jd),yl.rXU(GZ),yl.rXU(fl.ok),yl.rXU($b),yl.rXU(Pl),yl.rXU(xb),yl.rXU(sv),yl.rXU(Ok))},WZ.ɵcmp=yl.VBU({type:WZ,selectors:[["tools-send-options"]],inputs:{config:"config",originalSendView:"originalSendView"},decls:33,vars:25,consts:[["disableMargin","",3,"formGroup"],["bitTypography","h6",1,"tw-mt-4"],["bitInput","","type","number","formControlName","maxAccessCount","min","1"],[4,"ngIf"],["bitInput","","type","password","formControlName","password"],["data-testid","toggle-visibility-for-password","type","button","bitIconButton","","bitSuffix","","bitPasswordInputToggle","",4,"ngIf"],["type","button","bitIconButton","bwi-generate","bitSuffix","","data-testid","generate-password",3,"label","disabled","click",4,"ngIf"],["type","button","bitIconButton","bwi-clone","bitSuffix","","showToast","",3,"label","disabled","valueLabel","appCopyClick",4,"ngIf"],["class","tw-border-l-0 last:tw-rounded-r focus-visible:tw-border-l focus-visible:tw-ml-[-1px]","bitSuffix","","type","button","buttonType","danger","bitIconButton","bwi-minus-circle","showToast","",3,"label","bitAction",4,"ngIf"],["disableMargin",""],["bitInput","","rows","3","formControlName","notes"],["data-testid","toggle-visibility-for-password","type","button","bitIconButton","","bitSuffix","","bitPasswordInputToggle",""],["type","button","bitIconButton","bwi-generate","bitSuffix","","data-testid","generate-password",3,"click","label","disabled"],["type","button","bitIconButton","bwi-clone","bitSuffix","","showToast","",3,"label","disabled","valueLabel","appCopyClick"],["bitSuffix","","type","button","buttonType","danger","bitIconButton","bwi-minus-circle","showToast","",1,"tw-border-l-0","last:tw-rounded-r","focus-visible:tw-border-l","focus-visible:tw-ml-[-1px]",3,"label","bitAction"],["bitCheckbox","","type","checkbox","formControlName","hideEmail",3,"disabled"]],template:function(e,t){1&e&&(yl.j41(0,"bit-section",0)(1,"bit-section-header")(2,"h2",1),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s()(),yl.j41(5,"bit-card")(6,"bit-form-field")(7,"bit-label"),yl.EFF(8),yl.nI1(9,"i18n"),yl.k0s(),yl.nrm(10,"input",2),yl.j41(11,"bit-hint"),yl.EFF(12),yl.nI1(13,"i18n"),yl.k0s(),yl.DNE(14,zZ,3,4,"bit-hint",3),yl.k0s(),yl.j41(15,"bit-form-field")(16,"bit-label"),yl.EFF(17),yl.nI1(18,"i18n"),yl.k0s(),yl.nrm(19,"input",4),yl.DNE(20,_Z,1,0,"button",5)(21,KZ,2,4,"button",6)(22,XZ,3,8,"button",7)(23,qZ,2,4,"button",8),yl.j41(24,"bit-hint"),yl.EFF(25),yl.nI1(26,"i18n"),yl.k0s()(),yl.DNE(27,YZ,5,4,"bit-form-control",3),yl.j41(28,"bit-form-field",9)(29,"bit-label"),yl.EFF(30),yl.nI1(31,"i18n"),yl.k0s(),yl.nrm(32,"textarea",10),yl.k0s()()()),2&e&&(yl.Y8G("formGroup",t.sendOptionsForm),yl.R7$(3),yl.JRh(yl.bMT(4,13,"additionalOptions")),yl.R7$(5),yl.JRh(yl.bMT(9,15,"limitSendViews")),yl.R7$(4),yl.JRh(yl.bMT(13,17,"limitSendViewsHint")),yl.R7$(2),yl.Y8G("ngIf",t.shouldShowCount),yl.R7$(3),yl.JRh(yl.bMT(18,19,t.passwordRemoved?"newPassword":"password")),yl.R7$(3),yl.Y8G("ngIf",!t.hasPassword),yl.R7$(),yl.Y8G("ngIf",!t.hasPassword),yl.R7$(),yl.Y8G("ngIf",!t.hasPassword),yl.R7$(),yl.Y8G("ngIf",t.hasPassword),yl.R7$(2),yl.JRh(yl.bMT(26,21,"sendPasswordDescV3")),yl.R7$(2),yl.Y8G("ngIf",!t.disableHideEmail||(null==t.originalSendView?null:t.originalSendView.hideEmail)),yl.R7$(3),yl.JRh(yl.bMT(31,23,"privateNote")))},dependencies:[rc,Rd,Xu,WR,id,Ub,pl.MD,pl.bT,Eu,hc,Sc,nu,ou,Du,Vb,Bb,_l,zl,qf,g$,fl.X1,fl.me,fl.Q0,fl.Zm,fl.BC,fl.cb,fl.VZ,fl.j4,fl.JD,ZR,ex,Xl,Wl,Xf],encapsulation:2});class ZZ{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,fl.k0.required)}),this.FileSendType=UZ.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,wl.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()}}ZZ.ɵfac=function(e){return new(e||ZZ)(yl.rXU(fl.ok),yl.rXU(jZ))},ZZ.ɵcmp=yl.VBU({type:ZZ,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&&(yl.j41(0,"bit-section",1),yl.DNE(1,HZ,8,5,"div",2)(2,JZ,16,13,"bit-form-field",2),yl.k0s()),2&e&&(yl.Y8G("formGroup",t.sendFileDetailsForm),yl.R7$(),yl.Y8G("ngIf","edit"===t.config().mode),yl.R7$(),yl.Y8G("ngIf","edit"!==t.config().mode))},dependencies:[Xu,Ku,pl.MD,pl.YU,pl.bT,qf,fl.X1,fl.me,fl.BC,fl.cb,fl.j4,fl.JD,Eu,Sc,nu,ou,Du,ZR,fl.YN,Xl,Wl,Xf],encapsulation:2});var QZ=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 eQ{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 fl.MJ("",fl.k0.required),hidden:new fl.MJ(!1)}),this.sendFormContainer.registerChildForm("sendTextDetailsForm",this.sendTextDetailsForm),this.sendTextDetailsForm.valueChanges.pipe((0,wl.pQ)()).subscribe(e=>{this.sendFormContainer.patchSend(t=>Object.assign(t,{text:{text:e.text,hidden:e.hidden}}))})}ngOnInit(){return QZ(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()})}}eQ.ɵfac=function(e){return new(e||eQ)(yl.rXU(fl.ok),yl.rXU(jZ))},eQ.ɵcmp=yl.VBU({type:eQ,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&&(yl.j41(0,"bit-section",0)(1,"bit-form-field")(2,"bit-label"),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s(),yl.nrm(5,"textarea",1),yl.k0s(),yl.j41(6,"bit-form-control"),yl.nrm(7,"input",2),yl.j41(8,"bit-label"),yl.EFF(9),yl.nI1(10,"i18n"),yl.k0s()()()),2&e&&(yl.Y8G("formGroup",t.sendTextDetailsForm),yl.R7$(3),yl.JRh(yl.bMT(4,3,"sendTypeTextToShare")),yl.R7$(6),yl.JRh(yl.bMT(10,5,"hideTextByDefault")))},dependencies:[id,Ub,pl.MD,qf,fl.X1,fl.me,fl.Zm,fl.BC,fl.cb,fl.j4,fl.JD,Eu,hc,Sc,ou,Du,ZR,Xf],encapsulation:2});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){if(1&e&&yl.nrm(0,"tools-send-text-details",9),2&e){const e=yl.XpG();yl.Y8G("config",e.config)("originalSendView",e.originalSendView)}}function nQ(e,t){if(1&e&&yl.nrm(0,"tools-send-file-details",9),2&e){const e=yl.XpG();yl.Y8G("config",e.config)("originalSendView",e.originalSendView)}}function rQ(e,t){if(1&e&&(yl.j41(0,"bit-form-field")(1,"bit-label"),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.nrm(4,"input",10)(5,"button",11),yl.nI1(6,"i18n"),yl.k0s()),2&e){const e=yl.XpG();yl.R7$(2),yl.JRh(yl.bMT(3,4,"sendLink")),yl.R7$(2),yl.Y8G("value",e.sendLink),yl.R7$(),yl.Y8G("appCopyClick",e.sendLink)("label",yl.bMT(6,6,"copySendLink"))}}function sQ(e,t){if(1&e&&yl.nrm(0,"bit-option",12),2&e){const e=t.$implicit;yl.Y8G("value",e.value)("label",e.name)}}const oQ=Object.freeze({OneHour:1,OneDay:24,TwoDays:48,ThreeDays:72,SevenDays:168,FourteenDays:336,ThirtyDays:720}),aQ=new Map(Object.entries(oQ).map(([e,t])=>[t,e]));function lQ(e){return aQ.has(e)}class cQ{constructor(e,t,i,n,r){this.sendFormContainer=e,this.formBuilder=t,this.i18nService=i,this.datePipe=n,this.environmentService=r,this.FileSendType=UZ.File,this.TextSendType=UZ.Text,this.sendLink=null,this.customDeletionDateOption=null,this.datePresetOptions=[],this.sendDetailsForm=this.formBuilder.group({name:new fl.MJ("",fl.k0.required),selectedDeletionDatePreset:new fl.MJ(oQ.SevenDays||"",fl.k0.required)}),this.sendDetailsForm.valueChanges.pipe((0,wl.pQ)()).subscribe(e=>{this.sendFormContainer.patchSend(t=>Object.assign(t,{name:e.name,deletionDate:new Date(this.formattedDeletionDate),expirationDate:new Date(this.formattedDeletionDate)}))}),this.sendFormContainer.registerChildForm("sendDetailsForm",this.sendDetailsForm)}ngOnInit(){return tQ(this,void 0,void 0,function*(){if(this.setupDeletionDatePresets(),this.originalSendView){this.sendDetailsForm.patchValue({name:this.originalSendView.name,selectedDeletionDatePreset:this.originalSendView.deletionDate.toString()}),this.originalSendView.deletionDate&&(this.customDeletionDateOption={name:this.datePipe.transform(this.originalSendView.deletionDate,"short"),value:this.originalSendView.deletionDate.toString()},this.datePresetOptions.unshift(this.customDeletionDateOption));const e=yield(0,ho._)(this.environmentService.environment$);this.sendLink=e.getSendUrl()+this.originalSendView.accessId+"/"+this.originalSendView.urlB64Key}this.config.areSendsAllowed||this.sendDetailsForm.disable()})}setupDeletionDatePresets(){const e=[{name:this.i18nService.t("oneHour"),value:oQ.OneHour},{name:this.i18nService.t("oneDay"),value:oQ.OneDay},{name:this.i18nService.t("days","2"),value:oQ.TwoDays},{name:this.i18nService.t("days","3"),value:oQ.ThreeDays},{name:this.i18nService.t("days","7"),value:oQ.SevenDays},{name:this.i18nService.t("days","14"),value:oQ.FourteenDays},{name:this.i18nService.t("days","30"),value:oQ.ThirtyDays}];this.datePresetOptions=e}get formattedDeletionDate(){const e=new Date,t=this.sendDetailsForm.controls.selectedDeletionDatePreset.value;if("string"==typeof t)return t;const i=lQ(n=t)?n:void 0;var n;if(!lQ(i))return new Date(e).toString();const r=e.setTime(e.getTime()+60*i*60*1e3);return new Date(r).toString()}}cQ.ɵfac=function(e){return new(e||cQ)(yl.rXU(jZ),yl.rXU(fl.ok),yl.rXU(Pl),yl.rXU(pl.vh),yl.rXU(JS))},cQ.ɵcmp=yl.VBU({type:cQ,selectors:[["tools-send-details"]],inputs:{config:"config",originalSendView:"originalSendView"},decls:24,vars:19,consts:[["disableMargin","",3,"formGroup"],[1,"tw-mt-2"],["bitTypography","h6"],["appAutofocus","","bitInput","","type","text","formControlName","name"],[3,"config","originalSendView",4,"ngIf"],[4,"ngIf"],["disableMargin",""],["id","deletionDate","name","SelectedDeletionDatePreset","formControlName","selectedDeletionDatePreset"],[3,"value","label",4,"ngFor","ngForOf"],[3,"config","originalSendView"],["data-testid","send-link","bitInput","","type","text","disabled","",3,"value"],["type","button","bitSuffix","","showToast","","bitIconButton","bwi-clone",3,"appCopyClick","label"],[3,"value","label"]],template:function(e,t){1&e&&(yl.j41(0,"bit-section",0)(1,"bit-section-header",1)(2,"h2",2),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s()(),yl.j41(5,"bit-card")(6,"bit-form-field")(7,"bit-label"),yl.EFF(8),yl.nI1(9,"i18n"),yl.k0s(),yl.nrm(10,"input",3),yl.k0s(),yl.DNE(11,iQ,1,2,"tools-send-text-details",4)(12,nQ,1,2,"tools-send-file-details",4)(13,rQ,7,8,"bit-form-field",5),yl.j41(14,"bit-form-field",6)(15,"bit-label"),yl.EFF(16),yl.nI1(17,"i18n"),yl.k0s(),yl.j41(18,"bit-select",7),yl.DNE(19,sQ,1,2,"bit-option",8),yl.k0s(),yl.j41(20,"bit-hint"),yl.EFF(21),yl.nI1(22,"i18n"),yl.k0s()()(),yl.nrm(23,"tools-send-options",9),yl.k0s()),2&e&&(yl.Y8G("formGroup",t.sendDetailsForm),yl.R7$(3),yl.JRh(yl.bMT(4,11,"sendDetails")),yl.R7$(5),yl.JRh(yl.bMT(9,13,"name")),yl.R7$(3),yl.Y8G("ngIf",t.config.sendType===t.TextSendType),yl.R7$(),yl.Y8G("ngIf",t.config.sendType===t.FileSendType),yl.R7$(),yl.Y8G("ngIf",t.sendLink),yl.R7$(3),yl.JRh(yl.bMT(17,15,"deletionDate")),yl.R7$(3),yl.Y8G("ngForOf",t.datePresetOptions),yl.R7$(2),yl.JRh(yl.bMT(22,17,"deletionDateDescV2")),yl.R7$(2),yl.Y8G("config",t.config)("originalSendView",t.originalSendView))},dependencies:[ZR,ex,Xl,Wl,qf,hk,g$,WR,Eu,Sc,nu,ou,Du,Bb,fl.X1,fl.me,fl.BC,fl.cb,fl.j4,fl.JD,eQ,ZZ,WZ,_l,zl,id,pl.MD,pl.Sq,pl.bT,Bu,Vu,Ou,Xf],encapsulation:2});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())})};function dQ(e,t){if(1&e&&(yl.qex(0),yl.nrm(1,"tools-send-details",2),yl.bVm()),2&e){const e=yl.XpG();yl.R7$(),yl.Y8G("config",e.config)("originalSendView",e.originalSendView)}}class hQ{ngAfterViewInit(){this.submitBtn&&(this.bitSubmit.loading$.pipe((0,wl.pQ)(this.destroyRef)).subscribe(e=>{this.submitBtn.loading.set(e)}),this.bitSubmit.disabled$.pipe((0,wl.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 uQ(this,void 0,void 0,function*(){this._firstInitialized&&(yield this.init())})}ngOnInit(){return uQ(this,void 0,void 0,function*(){yield this.init(),this._firstInitialized=!0})}init(){return uQ(this,void 0,void 0,function*(){if(this.loading=!0,this.updatedSendView=new BZ,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 yl.bkB,this.onSendUpdated=new yl.bkB,this.sendForm=this.formBuilder.group({}),this.loading=!0,this.SendType=UZ,this.submit=()=>uQ(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}}hQ.ɵfac=function(e){return new(e||hQ)(yl.rXU(fl.ok),yl.rXU(MZ),yl.rXU(xb),yl.rXU(Pl))},hQ.ɵcmp=yl.VBU({type:hQ,selectors:[["tools-send-form"]],viewQuery:function(e,t){if(1&e&&yl.GBs(Td,5),2&e){let e;yl.mGM(e=yl.lsd())&&(t.bitSubmit=e.first)}},inputs:{formId:"formId",config:"config",submitBtn:"submitBtn"},outputs:{onSendCreated:"onSendCreated",onSendUpdated:"onSendUpdated"},features:[yl.Jv_([{provide:jZ,useExisting:(0,a.Rfq)(()=>hQ)}]),yl.OA$],decls:2,vars:4,consts:[[3,"id","formGroup","bitSubmit"],[4,"ngIf"],[3,"config","originalSendView"]],template:function(e,t){1&e&&(yl.j41(0,"form",0),yl.DNE(1,dQ,2,2,"ng-container",1),yl.k0s()),2&e&&(yl.Y8G("id",t.formId)("formGroup",t.sendForm)("bitSubmit",t.submit),yl.R7$(),yl.Y8G("ngIf",!t.loading))},dependencies:[rc,Td,Xl,wP,Eu,fl.X1,fl.qT,fl.cb,fl.j4,Bu,pl.bT,cQ],encapsulation:2});class pQ{}class fQ extends pQ{}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 mQ{constructor(){this.accountService=(0,a.WQX)(Ok),this.sendApiService=(0,a.WQX)(GZ),this.sendService=(0,a.WQX)(pQ)}decryptSend(e){return vQ(this,void 0,void 0,function*(){const t=yield(0,ho._)(this.accountService.activeAccount$.pipe(Gp));return yield e.decrypt(t)})}saveSend(e,t,i){return vQ(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)})}}mQ.ɵfac=function(e){return new(e||mQ)},mQ.ɵprov=a.jDH({token:mQ,factory:mQ.ɵfac});class gQ{}gQ.ɵfac=function(e){return new(e||gQ)},gQ.ɵmod=yl.$C({type:gQ}),gQ.ɵinj=a.G2t({providers:[{provide:MZ,useClass:mQ}],imports:[hQ,kG]});class yQ{}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(){this.policyService=(0,a.WQX)($b),this.sendService=(0,a.WQX)(pQ),this.accountService=(0,a.WQX)(Ok),this.areSendsEnabled$=this.accountService.activeAccount$.pipe(Gp,(0,co.n)(e=>this.policyService.policyAppliesToUser$(_h.DisableSend,e)),(0,l.T)(e=>!e))}buildConfig(e,t,i){return bQ(this,void 0,void 0,function*(){var n,r;const[s,o]=yield(0,ho._)((0,$o.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:UZ.Text,areSendsAllowed:s,originalSend:o}})}getSend(e){return null==e?Promise.resolve(null):this.sendService.get$(e)}}wQ.ɵfac=function(e){return new(e||wQ)},wQ.ɵprov=a.jDH({token:wQ,factory:wQ.ɵfac});var SQ=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 kQ(e,t){1&e&&yl.nrm(0,"i",8)}class IQ{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=UZ,this.hasNoPremium=!1}ngOnInit(){return SQ(this,void 0,void 0,function*(){const e=yield(0,ho._)(this.accountService.activeAccount$);this.hasNoPremium=!e||!(yield(0,ho._)(this.billingAccountProfileStateService.hasPremiumFromAnySource$(e.id)))})}buildRouterLink(){return"/add-send"}buildQueryParams(e){return{type:e,isNew:!0}}sendFileClick(){return SQ(this,void 0,void 0,function*(){this.hasNoPremium?yield this.premiumUpgradePromptService.promptForPremium():yield this.router.navigate([this.buildRouterLink()],{queryParams:this.buildQueryParams(UZ.File)})})}}IQ.ɵfac=function(e){return new(e||IQ)(yl.rXU(ME),yl.rXU(Ok),yl.rXU(ud.Ix),yl.rXU(sU))},IQ.ɵcmp=yl.VBU({type:IQ,selectors:[["tools-new-send-dropdown"]],inputs:{hideIcon:"hideIcon",buttonType:"buttonType"},decls:16,vars:14,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"],[1,"tw-flex","tw-items-center","tw-gap-2"],["slot","start","aria-hidden","true",1,"bwi","bwi-file"],["aria-hidden","true",1,"bwi","bwi-plus","tw-me-2"]],template:function(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",1),yl.DNE(1,kQ,1,0,"i",2),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.j41(4,"bit-menu",null,0)(6,"a",3),yl.nrm(7,"i",4),yl.EFF(8),yl.nI1(9,"i18n"),yl.k0s(),yl.j41(10,"a",5),yl.bIt("click",function(){return a.eBV(e),a.Njj(t.sendFileClick())}),yl.j41(11,"div",6),yl.nrm(12,"i",7),yl.EFF(13),yl.nI1(14,"i18n"),yl.nrm(15,"app-premium-badge"),yl.k0s()()()}if(2&e){const e=yl.sdS(5);yl.Y8G("bitMenuTriggerFor",e)("buttonType",t.buttonType),yl.R7$(),yl.Y8G("ngIf",!t.hideIcon),yl.R7$(),yl.SpI(" ",yl.bMT(3,8,t.hideIcon?"createSend":"new"),"\n"),yl.R7$(4),yl.Y8G("routerLink",t.buildRouterLink())("queryParams",t.buildQueryParams(t.sendType.Text)),yl.R7$(2),yl.SpI(" ",yl.bMT(9,10,"sendTypeText")," "),yl.R7$(5),yl.SpI(" ",yl.bMT(14,12,"sendTypeFile")," ")}},dependencies:[qf,pl.MD,pl.bT,Xu,Ku,sw.Wk,Dh,gL,bL,LE,uU,Xf],encapsulation:2});var CQ=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 TQ(e,t){if(1&e&&(yl.nrm(0,"button",11),yl.nI1(1,"i18n")),2&e){const e=yl.XpG();yl.Y8G("label",yl.mNQ(yl.bMT(1,3,"delete")))("bitAction",e.deleteSend)}}const PQ=Object.freeze({Saved:"saved",Deleted:"deleted"});class FQ{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=()=>CQ(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 CQ(this,void 0,void 0,function*(){this.dialogRef.close(PQ.Saved)})}onSendUpdated(e){return CQ(this,void 0,void 0,function*(){this.dialogRef.close(PQ.Saved)})}onSendDeleted(){return CQ(this,void 0,void 0,function*(){this.dialogRef.close(PQ.Deleted),this.toastService.showToast({variant:"success",title:null,message:this.i18nService.t("deletedSend")})})}getHeaderText(e,t){const i="edit"===e||"partial-edit"===e,n={[UZ.Text]:i?"editItemHeaderTextSend":"newItemHeaderTextSend",[UZ.File]:i?"editItemHeaderFileSend":"newItemHeaderFileSend"};return this.i18nService.t(n[t])}static open(e,t){return e.open(FQ,{data:t})}static openDrawer(e,t){return e.openDrawer(FQ,{data:t})}}FQ.ɵfac=function(e){return new(e||FQ)(yl.rXU(nd.Qs),yl.rXU(Xd),yl.rXU(Pl),yl.rXU(GZ),yl.rXU(xb),yl.rXU(Jd))},FQ.ɵcmp=yl.VBU({type:FQ,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=yl.RV6();yl.j41(0,"bit-dialog",2,0)(2,"span",3),yl.EFF(3),yl.k0s(),yl.j41(4,"span",4)(5,"tools-send-form",5),yl.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))}),yl.k0s()(),yl.qex(6,6),yl.j41(7,"button",7,1),yl.EFF(9),yl.nI1(10,"i18n"),yl.k0s(),yl.j41(11,"button",8),yl.EFF(12),yl.nI1(13,"i18n"),yl.k0s(),yl.j41(14,"div",9),yl.DNE(15,TQ,2,5,"button",10),yl.k0s(),yl.bVm(),yl.k0s()}if(2&e){const e=yl.sdS(8);yl.R7$(3),yl.SpI(" ",t.headerText," "),yl.R7$(2),yl.Y8G("config",t.config)("submitBtn",e),yl.R7$(4),yl.SpI(" ",yl.bMT(10,6,"save")," "),yl.R7$(3),yl.SpI(" ",yl.bMT(13,8,"cancel")," "),yl.R7$(3),yl.Y8G("ngIf","add"!==(null==t.config?null:t.config.mode))}},dependencies:[pl.MD,pl.bT,v$,qf,fl.YN,Xu,Ku,_l,zl,gQ,hQ,rc,Rd,dh,Zd,uh,Xf],encapsulation:2});class RQ{onClick(e){e.stopPropagation()}}RQ.ɵfac=function(e){return new(e||RQ)},RQ.ɵdir=yl.FsC({type:RQ,selectors:[["","appStopProp",""]],hostBindings:function(e,t){1&e&&yl.bIt("click",function(e){return t.onClick(e)})},standalone:!1});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())})};const AQ=(e,t)=>({sendId:e,type:t});function DQ(e,t){1&e&&yl.nrm(0,"i",14)}function EQ(e,t){1&e&&yl.nrm(0,"i",15)}function $Q(e,t){1&e&&(yl.qex(0),yl.nrm(1,"i",16),yl.nI1(2,"i18n"),yl.j41(3,"span",17),yl.EFF(4),yl.nI1(5,"i18n"),yl.k0s(),yl.bVm()),2&e&&(yl.R7$(),yl.Y8G("title",yl.mNQ(yl.bMT(2,3,"maxAccessCountReached"))),yl.R7$(3),yl.JRh(yl.bMT(5,5,"maxAccessCountReached")))}function OQ(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"bit-item")(1,"button",5),yl.nI1(2,"i18n"),yl.j41(3,"div",6),yl.DNE(4,DQ,1,0,"i",7)(5,EQ,1,0,"i",8),yl.k0s(),yl.EFF(6),yl.DNE(7,$Q,6,7,"ng-container",9),yl.j41(8,"span",10),yl.EFF(9),yl.nI1(10,"i18n"),yl.nI1(11,"date"),yl.k0s()(),yl.qex(12,11),yl.j41(13,"bit-item-action")(14,"button",12),yl.nI1(15,"i18n"),yl.bIt("click",function(){const t=a.eBV(e).$implicit,i=yl.XpG(2);return a.Njj(i.copySendLink(t))}),yl.k0s()(),yl.j41(16,"bit-item-action")(17,"button",13),yl.nI1(18,"i18n"),yl.bIt("click",function(){const t=a.eBV(e).$implicit,i=yl.XpG(2);return a.Njj(i.deleteSend(t))}),yl.k0s()(),yl.bVm(),yl.k0s()}if(2&e){const e=t.$implicit,i=yl.XpG(2);yl.R7$(),yl.Y8G("appA11yTitle",yl.ai1("",yl.bMT(2,16,"edit")," - ",e.name))("queryParams",yl.l_i(27,AQ,e.id,e.type)),yl.R7$(3),yl.Y8G("ngIf",e.type===i.sendType.Text),yl.R7$(),yl.Y8G("ngIf",e.type===i.sendType.File),yl.R7$(),yl.SpI(" ",e.name," "),yl.R7$(),yl.Y8G("ngIf",e.maxAccessCountReached),yl.R7$(2),yl.Lme(" ",yl.bMT(10,18,"deletionDate"),": ",yl.i5U(11,20,e.deletionDate,"mediumDate")," "),yl.R7$(5),yl.Y8G("label",yl.ai1("",yl.bMT(15,23,"copyLink")," - ",e.name)),yl.R7$(3),yl.Y8G("label",yl.ai1("",yl.bMT(18,25,"delete")," - ",e.name))}}function UQ(e,t){if(1&e&&(yl.j41(0,"bit-section",1)(1,"bit-section-header")(2,"h2",2),yl.EFF(3),yl.k0s(),yl.j41(4,"span",3),yl.EFF(5),yl.k0s()(),yl.j41(6,"bit-item-group"),yl.DNE(7,OQ,19,30,"bit-item",4),yl.k0s()()),2&e){const e=yl.XpG();yl.R7$(3),yl.SpI(" ",e.headerText," "),yl.R7$(2),yl.JRh(e.sends.length),yl.R7$(2),yl.Y8G("ngForOf",e.sends)}}class MQ{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=UZ,this.sends=[]}deleteSend(e){return xQ(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 xQ(this,void 0,void 0,function*(){const t=(yield(0,ho._)(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"))})})}}MQ.ɵfac=function(e){return new(e||MQ)(yl.rXU(Jd),yl.rXU(JS),yl.rXU(Pl),yl.rXU(za),yl.rXU(Eb),yl.rXU(GZ),yl.rXU(xb))},MQ.ɵcmp=yl.VBU({type:MQ,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"],[4,"ngIf"],["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"],["appStopProp","","aria-hidden","true",1,"bwi","bwi-exclamation-triangle",3,"title"],[1,"tw-sr-only"]],template:function(e,t){1&e&&yl.DNE(0,UQ,8,3,"bit-section",0),2&e&&yl.Y8G("ngIf",(null==t.sends?null:t.sends.length)>0)},dependencies:[pl.MD,pl.Sq,pl.bT,wP,IP,FP,SP,RP,Xu,Kc,_l,zl,ZR,Xl,Wl,qf,jb,sP,RQ,ex,sw.Wk,pl.vh,Xf],encapsulation:2});const NQ={sendType:null};class VQ{constructor(e,t){this.i18nService=e,this.formBuilder=t,this.filterForm=this.formBuilder.group(NQ),this.filters$=this.filterForm.valueChanges.pipe((0,sd.Z)(NQ)),this.filterFunction$=this.filters$.pipe((0,l.T)(e=>t=>t.filter(t=>null===e.sendType||t.type===e.sendType))),this.sendTypes=[{value:UZ.File,label:this.i18nService.t("sendTypeFile"),icon:"bwi-file"},{value:UZ.Text,label:this.i18nService.t("sendTypeText"),icon:"bwi-file-text"}]}resetFilterForm(){this.filterForm.reset(NQ)}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}}}VQ.ɵfac=function(e){return new(e||VQ)(a.KVO(Pl),a.KVO(fl.ok))},VQ.ɵprov=a.jDH({token:VQ,factory:VQ.ɵfac,providedIn:"root"});class BQ{constructor(e,t,i,n){this.sendService=e,this.sendListFiltersService=t,this.searchService=i,this.accountService=n,this._searchText$=new fd.t(""),this._sendsLoading$=new go.B,this.latestSearchText$=this._searchText$.asObservable(),this._sendList$=this.sendService.sendViews$,this.filteredAndSortedSends$=(0,$o.z)([this._sendList$,this._searchText$,this.sendListFiltersService.filterFunction$]).pipe((0,Fo.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,Pp.t)({refCount:!0,bufferSize:1})),this.loading$=(0,bo.h)(this._sendsLoading$.pipe((0,l.T)(()=>!0)),this.filteredAndSortedSends$.pipe((0,l.T)(()=>!1))).pipe((0,sd.Z)(!0),(0,lo.F)(),(0,Pp.t)({refCount:!1,bufferSize:1})),this.hasFilterApplied$=(0,$o.z)([this._searchText$,this.sendListFiltersService.filters$,Gp(this.accountService.activeAccount$)]).pipe((0,co.n)(([e,t,i])=>(0,md.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)}}BQ.ɵfac=function(e){return new(e||BQ)(a.KVO(pQ),a.KVO(VQ),a.KVO(RJ),a.KVO(Ok))},BQ.ɵprov=a.jDH({token:BQ,factory:BQ.ɵfac,providedIn:"root"});var jQ=i(36006);class GQ{constructor(e){this.sendListItemService=e,this.searchText="",this.searchText$=new go.B,this.subscribeToLatestSearchText(),this.subscribeToApplyFilter()}onSearchTextChanged(){this.searchText$.next(this.searchText)}subscribeToLatestSearchText(){return this.sendListItemService.latestSearchText$.pipe((0,wl.pQ)(),(0,To.p)(e=>!!e)).subscribe(e=>{this.searchText=e})}subscribeToApplyFilter(){return this.searchText$.pipe((0,jQ.B)(200),(0,wl.pQ)()).subscribe(e=>{this.sendListItemService.applyFilter(e)})}}function LQ(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)))}GQ.ɵfac=function(e){return new(e||GQ)(yl.rXU(BQ))},GQ.ɵcmp=yl.VBU({type:GQ,selectors:[["tools-send-search"]],decls:2,vars:4,consts:[["appAutofocus","",3,"ngModelChange","placeholder","ngModel"]],template:function(e,t){1&e&&(yl.j41(0,"bit-search",0),yl.nI1(1,"i18n"),yl.mxI("ngModelChange",function(e){return yl.DH7(t.searchText,e)||(t.searchText=e),e}),yl.bIt("ngModelChange",function(){return t.onSearchTextChanged()}),yl.k0s()),2&e&&(yl.Y8G("placeholder",yl.bMT(1,2,"search")),yl.R50("ngModel",t.searchText))},dependencies:[pl.MD,v$,f$,qf,hk,fl.YN,fl.BC,fl.vS,Xf],encapsulation:2});const zQ=["chipSelectButton"],_Q=(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}),KQ=(e,t)=>({"tw-cursor-not-allowed":e,"group-hover/chip-select:tw-text-secondary-700":t}),XQ=e=>({"tw-cursor-not-allowed":e}),qQ=e=>({width:e});function YQ(e,t){if(1&e&&yl.nrm(0,"i",7),2&e){yl.XpG();const e=yl.sdS(2);yl.Y8G("ngClass",e.isOpen?"bwi-angle-up":"bwi-angle-down")}}function WQ(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",11),yl.nI1(1,"i18n"),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.clear())}),yl.nrm(2,"i",12),yl.k0s()}if(2&e){const e=yl.XpG();yl.Y8G("disabled",e.disabled())("ngClass",yl.eq3(6,XQ,e.disabled())),yl.BMQ("aria-label",yl.i5U(1,3,"removeItem",e.label))}}function HQ(e,t){var i,n;if(1&e){const e=yl.RV6();yl.j41(0,"button",14),yl.nI1(1,"i18n"),yl.bIt("click",function(t){const i=a.eBV(e),n=yl.XpG(2);return a.Njj(n.viewOption(i,t))}),yl.nrm(2,"i",15),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s(),yl.j41(5,"button",14),yl.nI1(6,"i18n"),yl.bIt("click",function(t){a.eBV(e);const i=yl.XpG(2);return a.Njj(i.selectOption(i.renderedOptions,t))}),yl.nrm(7,"i",16),yl.EFF(8),yl.nI1(9,"i18n"),yl.k0s()}if(2&e){const e=t,r=yl.XpG(2);yl.Y8G("title",yl.i5U(1,4,"backTo",null!==(i=e.label)&&void 0!==i?i:r.placeholderText())),yl.R7$(3),yl.SpI(" ",yl.i5U(4,7,"backTo",null!==(n=e.label)&&void 0!==n?n:r.placeholderText())," "),yl.R7$(2),yl.Y8G("title",yl.i5U(6,10,"viewItemsIn",r.renderedOptions.label)),yl.R7$(3),yl.SpI(" ",yl.i5U(9,13,"viewItemsIn",r.renderedOptions.label)," ")}}function JQ(e,t){if(1&e&&yl.nrm(0,"i",18),2&e){const e=yl.XpG().$implicit;yl.Y8G("ngClass",e.icon)}}function ZQ(e,t){1&e&&yl.nrm(0,"i",19)}function QQ(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",17),yl.bIt("click",function(t){const i=a.eBV(e).$implicit,n=yl.XpG(2);return a.Njj(null!=i.children&&i.children.length?n.viewOption(i,t):n.selectOption(i,t))}),yl.nVh(1,JQ,1,1,"i",18),yl.EFF(2),yl.nVh(3,ZQ,1,0,"i",19),yl.k0s()}if(2&e){const e=t.$implicit;yl.Y8G("disabled",e.disabled)("title",e.label),yl.BMQ("aria-haspopup",null!=e.children&&e.children.length?"menu":null),yl.R7$(),yl.vxM(e.icon?1:-1),yl.R7$(),yl.SpI(" ",e.label," "),yl.R7$(),yl.vxM(null!=e.children&&e.children.length?3:-1)}}function e0(e,t){if(1&e&&(yl.j41(0,"div",10),yl.nVh(1,HQ,10,16),yl.Z7z(2,QQ,4,6,"button",13,yl.fX1),yl.k0s()),2&e){let e;const t=yl.XpG();yl.Y8G("ngStyle",t.menuWidth&&yl.eq3(2,qQ,t.menuWidth+"px")),yl.R7$(),yl.vxM((e=t.getParent(t.renderedOptions))?1:-1,e),yl.R7$(),yl.Dyx(t.renderedOptions.children)}}class t0{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)(gL),this.menuItems=(0,o.dtW)(LE),this.chipSelectButton=(0,o.ebz)("chipSelectButton"),this.menuTrigger=(0,o.ebz)(bL),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,bl.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,bl.QZ)(()=>{this.initializeRootTree(this.options()),void 0!==this.pendingValue&&(this.selectedOption=this.findOption(this.rootTree,this.pendingValue),this.setOrResetRenderedOptions(),this.pendingValue=void 0,this.cdr.markForCheck())}),(0,bl.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&&LQ(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 i0(e,t){if(1&e&&(yl.j41(0,"div",1),yl.nI1(1,"i18n"),yl.j41(2,"form",2),yl.nrm(3,"bit-chip-select",3),yl.nI1(4,"i18n"),yl.k0s()()),2&e){const e=yl.XpG();yl.Y8G("ariaLabel",yl.bMT(1,4,"filters")),yl.R7$(2),yl.Y8G("formGroup",e.filterForm),yl.R7$(),yl.Y8G("placeholderText",yl.bMT(4,6,"type"))("options",e.sendTypes)}}t0.ɵfac=function(e){return new(e||t0)},t0.ɵcmp=yl.VBU({type:t0,selectors:[["bit-chip-select"]],viewQuery:function(e,t){1&e&&(yl.wEZ(t.menu,gL,5),yl.wEZ(t.menuItems,LE,5),yl.wEZ(t.chipSelectButton,zQ,5),yl.wEZ(t.menuTrigger,bL,5)),2&e&&yl.NyB(4)},hostVars:2,hostBindings:function(e,t){1&e&&yl.bIt("focusin",function(e){return t.onFocusIn(e.target)})("focusout",function(){return t.onFocusOut()}),2&e&&yl.HbH(t.classList)},inputs:{placeholderText:[1,"placeholderText"],placeholderIcon:[1,"placeholderIcon"],options:[1,"options"],disabledInput:[1,"disabled","disabledInput"],fullWidth:[1,"fullWidth"]},features:[yl.Jv_([{provide:fl.kq,useExisting:t0,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=yl.RV6();yl.j41(0,"div",2)(1,"button",3,0),yl.bIt("click",function(){return a.eBV(e),a.Njj(t.setMenuWidth())}),yl.j41(4,"span",4),yl.nrm(5,"i",5),yl.j41(6,"span",6),yl.EFF(7),yl.k0s()(),yl.nVh(8,YQ,1,1,"i",7),yl.k0s(),yl.nVh(9,WQ,3,8,"button",8),yl.k0s(),yl.j41(10,"bit-menu",9,1),yl.bIt("closed",function(){return a.eBV(e),a.Njj(t.handleMenuClosed())}),yl.nVh(12,e0,4,4,"div",10),yl.k0s()}if(2&e){const e=yl.sdS(11);yl.Y8G("ngClass",yl.s1E(10,_Q,t.selectedOption&&!t.disabled(),!t.selectedOption&&!t.disabled(),t.disabled(),!t.disabled(),t.focusVisibleWithin())),yl.R7$(),yl.Y8G("ngClass",yl.l_i(16,KQ,t.disabled(),!t.selectedOption&&!t.disabled()))("bitMenuTriggerFor",e)("disabled",t.disabled())("title",t.label),yl.R7$(4),yl.Y8G("ngClass",t.icon),yl.R7$(2),yl.JRh(t.label),yl.R7$(),yl.vxM(t.selectedOption?-1:8),yl.R7$(),yl.vxM(t.selectedOption?9:-1),yl.R7$(3),yl.vxM(t.renderedOptions?12:-1)}},dependencies:[Kl,pl.YU,pl.B3,Xu,_l,Dh,gL,bL,LE,Xl,Wl,Hl],encapsulation:2,changeDetection:0});class n0{constructor(e,t,i){this.sendListFiltersService=e,this.filterForm=this.sendListFiltersService.filterForm,this.sendTypes=this.sendListFiltersService.sendTypes,this.canAccessPremium$=i.activeAccount$.pipe((0,co.n)(e=>e?t.hasPremiumFromAnySource$(e.id):(0,Oo.of)(!1)))}ngOnDestroy(){this.sendListFiltersService.resetFilterForm()}}function r0(e,t){1&e&&yl.nrm(0,"i",13)}function s0(e,t){1&e&&yl.nrm(0,"i",14)}function o0(e,t){1&e&&(yl.nrm(0,"i",25),yl.nI1(1,"i18n"),yl.j41(2,"span",26),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s()),2&e&&(yl.Y8G("title",yl.mNQ(yl.bMT(1,3,"disabled"))),yl.R7$(3),yl.JRh(yl.bMT(4,5,"disabled")))}function a0(e,t){1&e&&(yl.nrm(0,"i",27),yl.nI1(1,"i18n"),yl.j41(2,"span",26),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s()),2&e&&(yl.Y8G("title",yl.mNQ(yl.bMT(1,3,"password"))),yl.R7$(3),yl.JRh(yl.bMT(4,5,"password")))}function l0(e,t){1&e&&(yl.nrm(0,"i",25),yl.nI1(1,"i18n"),yl.j41(2,"span",26),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s()),2&e&&(yl.Y8G("title",yl.mNQ(yl.bMT(1,3,"maxAccessCountReached"))),yl.R7$(3),yl.JRh(yl.bMT(4,5,"maxAccessCountReached")))}function c0(e,t){1&e&&(yl.nrm(0,"i",28),yl.nI1(1,"i18n"),yl.j41(2,"span",26),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s()),2&e&&(yl.Y8G("title",yl.mNQ(yl.bMT(1,3,"expired"))),yl.R7$(3),yl.JRh(yl.bMT(4,5,"expired")))}function u0(e,t){1&e&&(yl.nrm(0,"i",29),yl.nI1(1,"i18n"),yl.j41(2,"span",26),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s()),2&e&&(yl.Y8G("title",yl.mNQ(yl.bMT(1,3,"pendingDeletion"))),yl.R7$(3),yl.JRh(yl.bMT(4,5,"pendingDeletion")))}function d0(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",20),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG().$implicit,i=yl.XpG(2);return a.Njj(i.onRemovePassword(t))}),yl.nrm(1,"i",30),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s()}2&e&&(yl.R7$(2),yl.SpI(" ",yl.bMT(3,1,"removePassword")," "))}function h0(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"tr",9)(1,"td",10),yl.bIt("click",function(){const t=a.eBV(e).$implicit,i=yl.XpG(2);return a.Njj(i.onEditSend(t))}),yl.j41(2,"div",11)(3,"span",12),yl.nVh(4,r0,1,0,"i",13),yl.nVh(5,s0,1,0,"i",14),yl.k0s(),yl.j41(6,"button",15),yl.EFF(7),yl.k0s(),yl.nVh(8,o0,5,7),yl.nVh(9,a0,5,7),yl.nVh(10,l0,5,7),yl.nVh(11,c0,5,7),yl.nVh(12,u0,5,7),yl.k0s()(),yl.j41(13,"td",16),yl.bIt("click",function(){const t=a.eBV(e).$implicit,i=yl.XpG(2);return a.Njj(i.onEditSend(t))}),yl.j41(14,"small",17),yl.EFF(15),yl.nI1(16,"date"),yl.k0s()(),yl.j41(17,"td",18),yl.nrm(18,"button",19),yl.nI1(19,"i18n"),yl.j41(20,"bit-menu",null,0)(22,"button",20),yl.bIt("click",function(){const t=a.eBV(e).$implicit,i=yl.XpG(2);return a.Njj(i.onCopy(t))}),yl.nrm(23,"i",21),yl.EFF(24),yl.nI1(25,"i18n"),yl.k0s(),yl.nVh(26,d0,4,3,"button",22),yl.j41(27,"button",20),yl.bIt("click",function(){const t=a.eBV(e).$implicit,i=yl.XpG(2);return a.Njj(i.onDelete(t))}),yl.j41(28,"span",23),yl.nrm(29,"i",24),yl.EFF(30),yl.nI1(31,"i18n"),yl.k0s()()()()()}if(2&e){const e=t.$implicit,i=yl.sdS(21),n=yl.XpG(2);yl.R7$(4),yl.vxM(e.type==n.sendType.File?4:-1),yl.R7$(),yl.vxM(e.type==n.sendType.Text?5:-1),yl.R7$(2),yl.SpI(" ",e.name," "),yl.R7$(),yl.vxM(e.disabled?8:-1),yl.R7$(),yl.vxM(e.password?9:-1),yl.R7$(),yl.vxM(e.maxAccessCountReached?10:-1),yl.R7$(),yl.vxM(e.expired?11:-1),yl.R7$(),yl.vxM(e.pendingDelete?12:-1),yl.R7$(3),yl.SpI(" ",yl.i5U(16,15,e.deletionDate,"medium")," "),yl.R7$(3),yl.Y8G("label",yl.mNQ(yl.bMT(19,18,"options")))("bitMenuTriggerFor",i),yl.R7$(6),yl.SpI(" ",yl.bMT(25,20,"copySendLink")," "),yl.R7$(2),yl.vxM(e.password&&!n.disableSend()?26:-1),yl.R7$(4),yl.SpI(" ",yl.bMT(31,22,"delete")," ")}}function p0(e,t){if(1&e&&(yl.DNE(0,h0,32,24,"tr",8),yl.nI1(1,"async")),2&e){const e=t.$implicit;yl.Y8G("ngForOf",yl.bMT(1,1,e))}}n0.ɵfac=function(e){return new(e||n0)(yl.rXU(VQ),yl.rXU(ME),yl.rXU(Ok))},n0.ɵcmp=yl.VBU({type:n0,selectors:[["app-send-list-filters"]],decls:2,vars:3,consts:[["role","toolbar",3,"ariaLabel",4,"ngIf"],["role","toolbar",3,"ariaLabel"],[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&&(yl.DNE(0,i0,5,8,"div",0),yl.nI1(1,"async")),2&e&&yl.Y8G("ngIf",yl.bMT(1,1,t.canAccessPremium$))},dependencies:[pl.MD,pl.bT,qf,t0,fl.X1,fl.qT,fl.BC,fl.cb,fl.j4,fl.JD,pl.Jj,Xf],encapsulation:2});class f0{constructor(){this.sendType=UZ,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)}}f0.ɵfac=function(e){return new(e||f0)},f0.ɵcmp=yl.VBU({type:f0,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"],[1,"bwi","bwi-fw","bwi-lg","bwi-file-text"],["type","button","bitLink",""],["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","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"],["appStopProp","","aria-hidden","true",1,"bwi","bwi-exclamation-triangle",3,"title"],[1,"tw-sr-only"],["appStopProp","","aria-hidden","true",1,"bwi","bwi-key",3,"title"],["appStopProp","","aria-hidden","true",1,"bwi","bwi-clock",3,"title"],["appStopProp","","aria-hidden","true",1,"bwi","bwi-trash",3,"title"],["aria-hidden","true",1,"bwi","bwi-fw","bwi-close"]],template:function(e,t){1&e&&(yl.j41(0,"div",1)(1,"bit-table",2),yl.qex(2,3),yl.j41(3,"tr")(4,"th",4),yl.EFF(5),yl.nI1(6,"i18n"),yl.k0s(),yl.j41(7,"th",5),yl.EFF(8),yl.nI1(9,"i18n"),yl.k0s(),yl.j41(10,"th",6),yl.EFF(11),yl.nI1(12,"i18n"),yl.k0s()(),yl.bVm(),yl.DNE(13,p0,2,3,"ng-template",7),yl.k0s()()),2&e&&(yl.R7$(),yl.Y8G("dataSource",t.dataSource()),yl.R7$(4),yl.JRh(yl.bMT(6,4,"name")),yl.R7$(3),yl.SpI(" ",yl.bMT(9,6,"deletionDate")," "),yl.R7$(3),yl.JRh(yl.bMT(12,8,"options")))},dependencies:[pl.MD,pl.Sq,qf,RQ,Ah,UL,mh,jH,Sh,kh,Xu,Oh,Kb,_l,zl,Dh,gL,bL,LE,Kc,Xl,Wl,pl.Jj,pl.vh,Xf],encapsulation:2,changeDetection:0});class v0 extends Rd{constructor(){super(...arguments),this.routerCacheService=(0,a.WQX)(aD),this.handler=(0,o.geq)(()=>this.routerCacheService.back(),{alias:"popupBackAction"})}}v0.ɵfac=(()=>{let e;return function(t){return(e||(e=yl.xGo(v0)))(t||v0)}})(),v0.ɵdir=yl.FsC({type:v0,selectors:[["","popupBackAction",""]],inputs:{handler:[1,"popupBackAction","handler"]},outputs:{handler:"popupBackActionChange"},features:[yl.Vt3]});var m0=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 g0{constructor(e){this.dialogService=e}popOutWindow(){return m0(this,void 0,void 0,function*(){yield rl.openCurrentPagePopout(window)})}close(){this.dialogService.closeAll()}}g0.ɵfac=function(e){return new(e||g0)(yl.rXU(Jd))},g0.ɵcmp=yl.VBU({type:g0,selectors:[["send-file-popout-dialog"]],decls:18,vars:12,consts:[["dialogSize","default"],["bitDialogIcon",""],["aria-hidden","true",1,"bwi","bwi-info-circle","bwi-2x","tw-text-info"],["bitDialogContent",""],["bitTypography","h3"],["bitTypography","body1"],["bitDialogFooter",""],["buttonType","primary","bitButton","","type","button",3,"click"],["aria-hidden","true",1,"bwi","bwi-popout","tw-ml-1"],["bitButton","","buttonType","secondary","type","button",3,"click"]],template:function(e,t){1&e&&(yl.j41(0,"bit-simple-dialog",0)(1,"div",1),yl.nrm(2,"i",2),yl.k0s(),yl.qex(3,3),yl.j41(4,"div",4),yl.EFF(5),yl.nI1(6,"i18n"),yl.k0s(),yl.j41(7,"div",5),yl.EFF(8),yl.nI1(9,"i18n"),yl.k0s(),yl.bVm(),yl.qex(10,6),yl.j41(11,"button",7),yl.bIt("click",function(){return t.popOutWindow()}),yl.EFF(12),yl.nI1(13,"i18n"),yl.nrm(14,"i",8),yl.k0s(),yl.j41(15,"button",9),yl.bIt("click",function(){return t.close()}),yl.EFF(16),yl.nI1(17,"i18n"),yl.k0s(),yl.bVm(),yl.k0s()),2&e&&(yl.R7$(5),yl.SpI(" ",yl.bMT(6,4,"sendFilePopoutDialogText")," "),yl.R7$(3),yl.JRh(yl.bMT(9,6,"sendFilePopoutDialogDesc")),yl.R7$(4),yl.SpI(" ",yl.bMT(13,8,"popOut")," "),yl.R7$(4),yl.SpI(" ",yl.bMT(17,10,"cancel")," "))},dependencies:[qf,pl.MD,dh,Nd,Vd,Xu,Ku,Xl,Wl,Xf],encapsulation:2});class y0{constructor(e,t){this.dialogService=e,this.filePopoutUtilsService=t,this.config=o.hFB.required()}ngOnInit(){this.config().sendType===UZ.File&&"add"===this.config().mode&&this.filePopoutUtilsService.showFilePopoutMessage(window)&&this.dialogService.open(g0,{positionStrategy:new Yd})}}y0.ɵfac=function(e){return new(e||y0)(yl.rXU(Jd),yl.rXU(TY))},y0.ɵcmp=yl.VBU({type:y0,selectors:[["send-file-popout-dialog-container"]],inputs:{config:[1,"config"]},decls:0,vars:0,template:function(e,t){},dependencies:[qf,pl.MD],encapsulation:2});var b0=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 w0(e,t){if(1&e&&(yl.nrm(0,"button",8),yl.nI1(1,"i18n")),2&e){const e=yl.XpG();yl.Y8G("label",yl.mNQ(yl.bMT(1,3,"delete")))("bitAction",e.deleteSend)}}class S0{constructor(e){this.sendId=e.sendId;const t=parseInt(e.type,10);if(t!==UZ.Text&&t!==UZ.File)throw new Error(`Invalid SendType: ${e.type}`);this.type=t}}class k0{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=()=>b0(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 b0(this,void 0,void 0,function*(){yield this.router.navigate(["/send-created"],{queryParams:{sendId:e.id}})})}onSendUpdated(e){return b0(this,void 0,void 0,function*(){yield this.router.navigate(["/tabs/send"])})}subscribeToParams(){this.route.queryParams.pipe((0,wl.pQ)(),(0,l.T)(e=>new S0(e)),(0,co.n)(e=>b0(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={[UZ.Text]:i?"editItemHeaderTextSend":"newItemHeaderTextSend",[UZ.File]:i?"editItemHeaderFileSend":"newItemHeaderFileSend"};return this.i18nService.t(n[t])}}k0.ɵfac=function(e){return new(e||k0)(yl.rXU(ud.nX),yl.rXU(sF.aZ),yl.rXU(Pl),yl.rXU(yQ),yl.rXU(GZ),yl.rXU(xb),yl.rXU(Jd),yl.rXU(ud.Ix))},k0.ɵcmp=yl.VBU({type:k0,selectors:[["tools-send-add-edit"]],features:[yl.Jv_([{provide:yQ,useClass:wQ}])],decls:13,vars:11,consts:[["submitBtn",""],["slot","header","showBackButton","",3,"pageTitle"],["formId","sendForm",3,"onSendCreated","onSendUpdated","config","submitBtn"],[3,"config"],["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=yl.RV6();yl.j41(0,"popup-page"),yl.nrm(1,"popup-header",1),yl.j41(2,"tools-send-form",2),yl.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))}),yl.k0s(),yl.nrm(3,"send-file-popout-dialog-container",3),yl.j41(4,"popup-footer",4)(5,"button",5,0),yl.EFF(7),yl.nI1(8,"i18n"),yl.k0s(),yl.j41(9,"button",6),yl.EFF(10),yl.nI1(11,"i18n"),yl.k0s(),yl.DNE(12,w0,2,5,"button",7),yl.k0s()()}if(2&e){const e=yl.sdS(6);yl.R7$(),yl.Y8G("pageTitle",t.headerText),yl.R7$(),yl.Y8G("config",t.config)("submitBtn",e),yl.R7$(),yl.Y8G("config",t.config),yl.R7$(4),yl.SpI(" ",yl.bMT(8,7,"save")," "),yl.R7$(3),yl.SpI(" ",yl.bMT(11,9,"cancel")," "),yl.R7$(2),yl.Y8G("ngIf","add"!==(null==t.config?null:t.config.mode))}},dependencies:[pl.MD,pl.bT,v$,qf,fl.YN,Xu,Ku,_l,zl,hD,yD,YJ,y0,gQ,hQ,rc,Rd,v0,Xf],encapsulation:2});const I0=lw` `;var C0=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 T0{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.sendCreatedIcon=I0,this.daysAvailable=0,this.hoursAvailable=0;const a=this.route.snapshot.queryParamMap.get("sendId");this.sendService.sendViews$.pipe((0,wl.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))})}formatExpirationDate(){return this.hoursAvailable<24?1===this.hoursAvailable?this.i18nService.t("sendExpiresInHoursSingle"):this.i18nService.t("sendExpiresInHours",String(this.hoursAvailable)):1===this.daysAvailable?this.i18nService.t("sendExpiresInDaysSingle"):this.i18nService.t("sendExpiresInDays",String(this.daysAvailable))}getHoursAvailable(e){const t=(new Date).getTime();return Math.max(0,Math.ceil((e.deletionDate.getTime()-t)/36e5))}goToEditSend(){return C0(this,void 0,void 0,function*(){yield this.router.navigate(["/edit-send"],{queryParams:{sendId:this.send.id,type:this.send.type}})})}goBack(){return C0(this,void 0,void 0,function*(){yield this.router.navigate(["/tabs/send"])})}copyLink(){return C0(this,void 0,void 0,function*(){if(!this.send||!this.send.accessId||!this.send.urlB64Key)return;const e=(yield(0,ho._)(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")})})}}T0.ɵfac=function(e){return new(e||T0)(yl.rXU(Pl),yl.rXU(Eb),yl.rXU(pQ),yl.rXU(ud.nX),yl.rXU(xb),yl.rXU(ud.Ix),yl.rXU(JS))},T0.ɵcmp=yl.VBU({type:T0,selectors:[["app-send-created"]],decls:25,vars:18,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,"icon"],["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){1&e&&(yl.j41(0,"popup-page")(1,"popup-header",0),yl.nI1(2,"i18n"),yl.qex(3,1),yl.nrm(4,"app-pop-out"),yl.bVm(),yl.k0s(),yl.j41(5,"div",2)(6,"div",3),yl.nrm(7,"bit-icon",4),yl.k0s(),yl.j41(8,"h3",5),yl.EFF(9),yl.nI1(10,"i18n"),yl.k0s(),yl.j41(11,"p",6),yl.EFF(12),yl.k0s(),yl.j41(13,"button",7),yl.bIt("click",function(){return t.copyLink()}),yl.j41(14,"b"),yl.EFF(15),yl.nI1(16,"i18n"),yl.k0s()()(),yl.j41(17,"popup-footer",8)(18,"button",7),yl.bIt("click",function(){return t.copyLink()}),yl.j41(19,"b"),yl.EFF(20),yl.nI1(21,"i18n"),yl.k0s()(),yl.j41(22,"button",9),yl.bIt("click",function(){return t.goBack()}),yl.EFF(23),yl.nI1(24,"i18n"),yl.k0s()()()),2&e&&(yl.R7$(),yl.Y8G("pageTitle",yl.bMT(2,8,"createdSend"))("backAction",t.goToEditSend.bind(t)),yl.R7$(6),yl.Y8G("icon",t.sendCreatedIcon),yl.R7$(2),yl.SpI(" ",yl.bMT(10,10,"createdSendSuccessfully")," "),yl.R7$(3),yl.SpI(" ",t.formatExpirationDate()," "),yl.R7$(3),yl.JRh(yl.bMT(16,12,"copyLink")),yl.R7$(5),yl.JRh(yl.bMT(21,14,"copyLink")),yl.R7$(3),yl.SpI(" ",yl.bMT(24,16,"close")," "))},dependencies:[Xu,Ku,pl.MD,qf,hk,eD,yD,hD,sw.iI,YJ,$h,SC,Xf],encapsulation:2});const P0=lw` `,F0=[[["","slot","start"]],"*",[["","slot","end"]]];class R0{}R0.ɵfac=function(e){return new(e||R0)},R0.ɵcmp=yl.VBU({type:R0,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&&(yl.NAR(F0),yl.rj2(0,"div",0)(1,"div",1),yl.SdG(2),yl.SdG(3,1),yl.eux(),yl.SdG(4,2),yl.eux())},dependencies:[pl.MD],encapsulation:2});const x0=(e,t)=>({"tw-rounded":e,"tw-rounded-full":t});class A0{constructor(){this.edgeShape=(0,o.hFB)("box")}}A0.ɵfac=function(e){return new(e||A0)},A0.ɵcmp=yl.VBU({type:A0,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&&yl.nrm(0,"div",0),2&e&&yl.Y8G("ngClass",yl.l_i(1,x0,"box"===t.edgeShape(),"circle"===t.edgeShape()))},dependencies:[pl.MD,pl.YU],encapsulation:2});const D0=(e,t)=>({"tw-w-full":e,"tw-w-1/3":t});function E0(e,t){if(1&e&&yl.nrm(0,"bit-skeleton",1),2&e){const e=t.$index,i=t.$count;yl.Y8G("ngClass",yl.l_i(1,D0,0===e||!(e===i-1),!(0===e)&&e===i-1))}}class $0{constructor(){this.lines=(0,o.hFB)(1),this.linesArray=(0,bl.EW)(()=>[...Array(this.lines()).keys()])}}function O0(e,t){1&e&&(yl.j41(0,"bit-skeleton-group",3),yl.nrm(1,"bit-skeleton",4),yl.j41(2,"div",5),yl.nrm(3,"bit-skeleton",6)(4,"bit-skeleton",7),yl.k0s()(),yl.nrm(5,"hr",8))}$0.ɵfac=function(e){return new(e||$0)},$0.ɵcmp=yl.VBU({type:$0,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&&(yl.j41(0,"div",0),yl.Z7z(1,E0,1,4,"bit-skeleton",1,yl.Vm6),yl.k0s()),2&e&&(yl.R7$(),yl.Dyx(t.linesArray()))},dependencies:[pl.MD,pl.YU,A0],encapsulation:2});class U0{constructor(){this.numberOfItems=new Array(15).fill(null)}}U0.ɵfac=function(e){return new(e||U0)},U0.ɵcmp=yl.VBU({type:U0,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&&(yl.j41(0,"section",0)(1,"div",1),yl.nrm(2,"bit-skeleton-text",2),yl.Z7z(3,O0,6,0,null,null,yl.Vm6),yl.k0s()()),2&e&&(yl.R7$(3),yl.Dyx(t.numberOfItems))},dependencies:[R0,A0,$0],encapsulation:2,changeDetection:0});const M0="premium",N0="families",V0="free",B0="teams",j0="enterprise",G0="custom",L0="annually",z0="monthly";class _0{}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&&(yl.j41(0,"div",9)(1,"div",15)(2,"span",16),yl.EFF(3),yl.nI1(4,"currency"),yl.k0s(),yl.j41(5,"span",17),yl.EFF(6),yl.nI1(7,"i18n"),yl.k0s()()()),2&e){const e=yl.XpG();yl.R7$(3),yl.JRh(yl.i5U(4,2,e.price.amount,"$")),yl.R7$(3),yl.SpI(" / ",yl.bMT(7,5,e.price.cadence)," ")}}function q0(e,t){if(1&e&&yl.nrm(0,"i",18),2&e){const e=yl.XpG();yl.HbH(yl.VkB("bwi ",e.button.icon.type," tw-me-2"))}}function Y0(e,t){if(1&e&&yl.nrm(0,"i",18),2&e){const e=yl.XpG();yl.HbH(yl.VkB("bwi ",e.button.icon.type," tw-ms-2"))}}function W0(e,t){if(1&e&&(yl.j41(0,"li",19),yl.nrm(1,"i",20),yl.j41(2,"span",21),yl.EFF(3),yl.k0s()()),2&e){const e=t.$implicit;yl.R7$(3),yl.JRh(e)}}function H0(e,t){if(1&e&&(yl.j41(0,"ul",14),yl.Z7z(1,W0,4,1,"li",19,yl.fX1),yl.k0s()),2&e){const e=yl.XpG();yl.R7$(),yl.Dyx(e.features)}}function J0(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"section",0)(1,"header",1)(2,"button",2),yl.nI1(3,"i18n"),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.close())}),yl.k0s()(),yl.j41(4,"div",3)(5,"div",4)(6,"div",5)(7,"h3",6),yl.EFF(8),yl.nI1(9,"i18n"),yl.k0s()(),yl.j41(10,"div",7)(11,"p",8),yl.EFF(12),yl.k0s()(),yl.nVh(13,X0,8,7,"div",9),yl.j41(14,"div",10)(15,"button",11),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.upgrade())}),yl.nVh(16,q0,1,3,"i",12),yl.EFF(17),yl.nVh(18,Y0,1,3,"i",12),yl.k0s()(),yl.j41(19,"div",13),yl.nVh(20,H0,3,0,"ul",14),yl.k0s()()()()}if(2&e){const e=t;yl.R7$(2),yl.Y8G("label",yl.bMT(3,10,"close")),yl.R7$(6),yl.SpI(" ",yl.bMT(9,12,"upgradeToPremium")," "),yl.R7$(4),yl.SpI(" ",e.tagline," "),yl.R7$(),yl.vxM(e.price?13:-1),yl.R7$(2),yl.Y8G("buttonType",e.button.type)("block",!0),yl.R7$(),yl.vxM("before"===(null==e.button.icon?null:e.button.icon.position)?16:-1),yl.R7$(),yl.SpI(" ",e.button.text," "),yl.R7$(),yl.vxM(!e.button.icon||"after"!==e.button.icon.position&&e.button.icon.position?-1:18),yl.R7$(2),yl.vxM(e.features.length>0?20:-1)}}function Z0(e,t){1&e&&(yl.nrm(0,"i",22),yl.nI1(1,"i18n"),yl.j41(2,"span",23),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s()),2&e&&(yl.Y8G("title",yl.mNQ(yl.bMT(1,3,"loading"))),yl.R7$(3),yl.JRh(yl.bMT(4,5,"loading")))}class Q0{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===M0)),(0,l.T)(e=>this.mapPremiumTierToCardDetails(e)),(0,vd.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(),$p.w)))}upgrade(){return K0(this,void 0,void 0,function*(){const e=(yield(0,ho._)(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:z0}: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(Q0,{positionStrategy:new Yd})}}Q0.ɵfac=function(e){return new(e||Q0)(yl.rXU(Xd),yl.rXU(_0),yl.rXU(Pl),yl.rXU(xb),yl.rXU(JS),yl.rXU(Eb),yl.rXU(za))},Q0.ɵcmp=yl.VBU({type:Q0,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"],["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&&(yl.nVh(0,J0,21,14,"section",0),yl.nI1(1,"async"),yl.vZN(2,Z0,5,7)),2&e){let e;yl.vxM((e=yl.bMT(1,1,t.cardDetails$))?0:2,e)}},dependencies:[pl.MD,dh,Xu,Ku,_l,zl,Xl,Wl,ll.kB,qf,pl.Jj,pl.oe,Xf],encapsulation:2,changeDetection:0});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.router=(0,a.WQX)(ud.Ix),this.configService=(0,a.WQX)(uk),this.dialogService=(0,a.WQX)(Jd)}promptForPremium(){return e1(this,void 0,void 0,function*(){(yield this.configService.getFeatureFlag(Nf.PM23713_PremiumBadgeOpensNewPremiumUpgradeDialog))?Q0.open(this.dialogService):yield this.router.navigate(["/premium"])})}}function i1(e=1e3,t=1e3){return i=>(0,Po.v)(()=>{let n=null;return i.pipe((0,co.n)(i=>{if(i)return null!==n?(0,Oo.of)(!0):(0,ko.O)(e).pipe((0,Fo.M)(()=>{n=Date.now()}),(0,l.T)(()=>!0));{if(null===n)return(0,Oo.of)(!1);const e=Date.now()-n,i=Math.max(0,t-e);return(0,ko.O)(i).pipe((0,Fo.M)(()=>{n=null}),(0,l.T)(()=>!1))}}))})}class n1{constructor(){this.fadeInOut=!0}}function r1(e,t){1&e&&yl.nrm(0,"tools-new-send-dropdown")}function s1(e,t){1&e&&(yl.j41(0,"bit-callout",7),yl.nI1(1,"i18n"),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s()),2&e&&(yl.Y8G("title",yl.bMT(1,2,"sendDisabled")),yl.R7$(2),yl.SpI(" ",yl.bMT(3,4,"sendDisabledWarning")," "))}function o1(e,t){1&e&&(yl.qex(0),yl.nrm(1,"tools-send-search")(2,"app-send-list-filters"),yl.bVm())}function a1(e,t){1&e&&yl.nrm(0,"tools-new-send-dropdown",14),2&e&&yl.Y8G("hideIcon",!0)("buttonType","secondary")}function l1(e,t){if(1&e&&(yl.j41(0,"div",8)(1,"bit-no-items",9),yl.qex(2,10),yl.EFF(3),yl.nI1(4,"i18n"),yl.bVm(),yl.qex(5,11),yl.j41(6,"p",12),yl.EFF(7),yl.nI1(8,"i18n"),yl.k0s(),yl.bVm(),yl.DNE(9,a1,1,2,"tools-new-send-dropdown",13),yl.k0s()()),2&e){const e=yl.XpG();yl.R7$(),yl.Y8G("icon",e.noItemIcon),yl.R7$(2),yl.JRh(yl.bMT(4,4,"sendsTitleNoItems")),yl.R7$(4),yl.JRh(yl.bMT(8,6,"sendsBodyNoItems")),yl.R7$(2),yl.Y8G("ngIf",!e.sendsDisabled)}}function c1(e,t){if(1&e&&(yl.j41(0,"div",17)(1,"bit-no-items",18),yl.qex(2,10),yl.EFF(3),yl.nI1(4,"i18n"),yl.bVm(),yl.qex(5,11),yl.EFF(6),yl.nI1(7,"i18n"),yl.bVm(),yl.k0s()()),2&e){const e=yl.XpG(2);yl.R7$(),yl.Y8G("icon",e.noResultsIcon),yl.R7$(2),yl.JRh(yl.bMT(4,3,"noItemsMatchSearch")),yl.R7$(3),yl.JRh(yl.bMT(7,5,"clearFiltersOrTryAnother"))}}function u1(e,t){if(1&e&&(yl.qex(0),yl.DNE(1,c1,8,7,"div",15),yl.nrm(2,"app-send-list-items-container",16),yl.nI1(3,"i18n"),yl.nI1(4,"async"),yl.bVm()),2&e){const e=yl.XpG();yl.R7$(),yl.Y8G("ngIf",e.listState===e.sendState.NoResults),yl.R7$(),yl.Y8G("headerText",yl.bMT(3,3,e.title))("sends",yl.bMT(4,5,e.sends$))}}function d1(e,t){1&e&&(yl.j41(0,"vault-fade-in-out-skeleton"),yl.nrm(1,"vault-loading-skeleton"),yl.k0s())}n1.ɵfac=function(e){return new(e||n1)},n1.ɵcmp=yl.VBU({type:n1,selectors:[["vault-fade-in-out-skeleton"]],hostVars:1,hostBindings:function(e,t){2&e&&yl.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&&(yl.NAR(),yl.rj2(0,"div",0),yl.SdG(1),yl.eux())},encapsulation:2,data:{animation:[(0,gl.hZ)("fadeInOut",[(0,gl.kY)(":enter",[(0,gl.iF)({opacity:0}),(0,gl.i0)("100ms ease-in",(0,gl.iF)({opacity:1}))]),(0,gl.kY)(":leave",[(0,gl.i0)("300ms ease-out",(0,gl.iF)({opacity:0}))])])]},changeDetection:0});const h1=Object.freeze({Empty:"Empty",NoResults:"NoResults"});class p1{constructor(e,t,i,n,r,s){this.sendItemsService=e,this.sendListFiltersService=t,this.policyService=i,this.accountService=n,this.configService=r,this.searchService=s,this.sendType=UZ,this.sendState=h1,this.listState=null,this.sends$=this.sendItemsService.filteredAndSortedSends$,this.skeletonFeatureFlag$=this.configService.getFeatureFlag$(Nf.VaultLoadingSkeletons),this.sendsLoading$=this.sendItemsService.loading$.pipe((0,lo.F)(),(0,Pp.t)({bufferSize:1,refCount:!0})),this.showSpinnerLoaders$=(0,$o.z)([this.sendsLoading$,this.skeletonFeatureFlag$]).pipe((0,l.T)(([e,t])=>e&&!t)),this.showSkeletonsLoaders$=(0,$o.z)([this.sendsLoading$,this.searchService.isSendSearching$,this.skeletonFeatureFlag$]).pipe((0,l.T)(([e,t,i])=>(e||t)&&i),(0,lo.F)(),i1()),this.title="allSends",this.noItemIcon=P0,this.noResultsIcon=dj,this.sendsDisabled=!1,this.sendTypeTitles={[UZ.File]:"fileSends",[UZ.Text]:"textSends"},(0,$o.z)([this.sendItemsService.emptyList$,this.sendItemsService.noFilteredResults$,this.sendListFiltersService.filters$]).pipe((0,wl.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?h1.Empty:t?h1.NoResults:null}),this.accountService.activeAccount$.pipe(Gp,(0,co.n)(e=>this.policyService.policyAppliesToUser$(_h.DisableSend,e)),(0,wl.pQ)()).subscribe(e=>{this.sendsDisabled=e})}ngOnDestroy(){}}p1.ɵfac=function(e){return new(e||p1)(yl.rXU(BQ),yl.rXU(VQ),yl.rXU($b),yl.rXU(Ok),yl.rXU(uk),yl.rXU(RJ))},p1.ɵcmp=yl.VBU({type:p1,selectors:[["ng-component"]],features:[yl.Jv_([{provide:sU,useClass:t1}])],decls:17,vars:19,consts:[[3,"loading","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&&(yl.j41(0,"popup-page",0),yl.nI1(1,"async"),yl.nI1(2,"async"),yl.j41(3,"popup-header",1),yl.nI1(4,"i18n"),yl.qex(5,2),yl.DNE(6,r1,1,0,"tools-new-send-dropdown",3),yl.nrm(7,"app-pop-out")(8,"app-current-account"),yl.bVm(),yl.k0s(),yl.qex(9,4),yl.DNE(10,s1,4,6,"bit-callout",5)(11,o1,3,0,"ng-container",3),yl.bVm(),yl.DNE(12,l1,10,8,"div",6)(13,u1,5,7,"ng-container",3),yl.nI1(14,"async"),yl.nVh(15,d1,2,0,"vault-fade-in-out-skeleton"),yl.nI1(16,"async"),yl.k0s()),2&e&&(yl.Y8G("loading",yl.bMT(1,9,t.showSpinnerLoaders$))("hideOverflow",yl.bMT(2,11,t.showSkeletonsLoaders$)),yl.R7$(3),yl.Y8G("pageTitle",yl.bMT(4,13,"send")),yl.R7$(3),yl.Y8G("ngIf",!t.sendsDisabled),yl.R7$(4),yl.Y8G("ngIf",t.sendsDisabled),yl.R7$(),yl.Y8G("ngIf",t.listState!==t.sendState.Empty),yl.R7$(),yl.Y8G("ngIf",t.listState===t.sendState.Empty),yl.R7$(),yl.Y8G("ngIf",t.listState!==t.sendState.Empty&&!yl.bMT(14,15,t.showSkeletonsLoaders$)),yl.R7$(2),yl.vxM(yl.bMT(16,17,t.showSkeletonsLoaders$)?15:-1))},dependencies:[td,ed,hD,yD,eD,PF,Eh,pj,qf,pl.MD,pl.bT,Xu,IQ,MQ,n0,GQ,Xl,Wl,n1,U0,Xf,pl.Jj],encapsulation:2});const f1=["version"];function v1(e,t){if(1&e&&(yl.j41(0,"span"),yl.EFF(1),yl.nI1(2,"date"),yl.nI1(3,"i18n"),yl.k0s()),2&e){const e=yl.XpG(2).ngIf;yl.R7$(),yl.SpI(" (",yl.i5U(3,4,"lastSeenOn",yl.i5U(2,1,e.serverConfig.utcDate,"mediumDate")),") ")}}function m1(e,t){if(1&e&&(yl.j41(0,"p"),yl.EFF(1),yl.nI1(2,"i18n"),yl.DNE(3,v1,4,7,"span",5),yl.k0s()),2&e){const e=yl.XpG().ngIf;yl.R7$(),yl.Lme(" ",yl.bMT(2,3,"serverVersion"),": ",null==e.serverConfig?null:e.serverConfig.version," "),yl.R7$(2),yl.Y8G("ngIf",!e.serverConfig.isValid())}}function g1(e,t){if(1&e&&(yl.j41(0,"span"),yl.EFF(1),yl.nI1(2,"date"),yl.nI1(3,"i18n"),yl.k0s()),2&e){const e=yl.XpG(3).ngIf;yl.R7$(),yl.SpI(" (",yl.i5U(3,4,"lastSeenOn",yl.i5U(2,1,e.serverConfig.utcDate,"mediumDate")),") ")}}function y1(e,t){if(1&e&&(yl.qex(0),yl.j41(1,"p"),yl.EFF(2),yl.nI1(3,"i18n"),yl.j41(4,"small"),yl.EFF(5),yl.nI1(6,"i18n"),yl.k0s(),yl.EFF(7),yl.DNE(8,g1,4,7,"span",5),yl.k0s(),yl.j41(9,"div")(10,"small"),yl.EFF(11),yl.nI1(12,"i18n"),yl.k0s()(),yl.bVm()),2&e){const e=yl.XpG(2).ngIf;yl.R7$(2),yl.SpI(" ",yl.bMT(3,5,"serverVersion")," "),yl.R7$(3),yl.SpI("(",yl.bMT(6,7,"thirdParty"),")"),yl.R7$(2),yl.SpI(": ",null==e.serverConfig?null:e.serverConfig.version," "),yl.R7$(),yl.Y8G("ngIf",!e.serverConfig.isValid()),yl.R7$(3),yl.JRh(yl.i5U(12,9,"thirdPartyServerMessage",null==e.serverConfig.server?null:e.serverConfig.server.name))}}function b1(e,t){if(1&e&&(yl.j41(0,"span"),yl.EFF(1),yl.nI1(2,"date"),yl.nI1(3,"i18n"),yl.k0s()),2&e){const e=yl.XpG(3).ngIf;yl.R7$(),yl.SpI(" (",yl.i5U(3,4,"lastSeenOn",yl.i5U(2,1,e.serverConfig.utcDate,"mediumDate")),") ")}}function w1(e,t){if(1&e&&(yl.j41(0,"p"),yl.EFF(1),yl.nI1(2,"i18n"),yl.j41(3,"small"),yl.EFF(4),yl.nI1(5,"i18n"),yl.k0s(),yl.EFF(6),yl.DNE(7,b1,4,7,"span",5),yl.k0s()),2&e){const e=yl.XpG(2).ngIf;yl.R7$(),yl.SpI(" ",yl.bMT(2,4,"serverVersion")," "),yl.R7$(3),yl.SpI("(",yl.bMT(5,6,"selfHostedServer"),")"),yl.R7$(2),yl.SpI(": ",null==e.serverConfig?null:e.serverConfig.version," "),yl.R7$(),yl.Y8G("ngIf",!e.serverConfig.isValid())}}function S1(e,t){if(1&e&&(yl.qex(0),yl.DNE(1,y1,13,12,"ng-container",5)(2,w1,8,8,"p",5),yl.bVm()),2&e){const e=yl.XpG().ngIf;yl.R7$(),yl.Y8G("ngIf",e.serverConfig.server),yl.R7$(),yl.Y8G("ngIf",!e.serverConfig.server)}}function k1(e,t){if(1&e&&(yl.qex(0),yl.DNE(1,m1,4,5,"p",5)(2,S1,3,2,"ng-container",5),yl.bVm()),2&e){const e=t.ngIf;yl.R7$(),yl.Y8G("ngIf",e.isCloud),yl.R7$(),yl.Y8G("ngIf",!e.isCloud)}}class I1{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,$o.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,Po.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()}}I1.ɵfac=function(e){return new(e||I1)(yl.rXU(Xd),yl.rXU(uk),yl.rXU(JS),yl.rXU(Eb),yl.rXU(xb),yl.rXU(Pl),yl.rXU($k))},I1.ɵcmp=yl.VBU({type:I1,selectors:[["ng-component"]],viewQuery:function(e,t){if(1&e&&yl.GBs(f1,5),2&e){let e;yl.mGM(e=yl.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=yl.RV6();yl.j41(0,"bit-simple-dialog")(1,"div",1),yl.nrm(2,"i",2),yl.k0s(),yl.j41(3,"div",3),yl.EFF(4,"Bitwarden"),yl.k0s(),yl.j41(5,"div",4)(6,"p"),yl.EFF(7),yl.k0s(),yl.j41(8,"div",null,0)(10,"p"),yl.EFF(11),yl.nI1(12,"i18n"),yl.nI1(13,"async"),yl.k0s(),yl.j41(14,"p"),yl.EFF(15),yl.nI1(16,"async"),yl.k0s(),yl.DNE(17,k1,3,2,"ng-container",5),yl.nI1(18,"async"),yl.k0s()(),yl.qex(19,6),yl.j41(20,"button",7),yl.EFF(21),yl.nI1(22,"i18n"),yl.k0s(),yl.j41(23,"button",8),yl.bIt("click",function(){return a.eBV(e),a.Njj(t.copyVersion())}),yl.EFF(24),yl.nI1(25,"i18n"),yl.k0s(),yl.bVm(),yl.k0s()}2&e&&(yl.R7$(7),yl.SpI("© Bitwarden Inc. 2015-",t.year),yl.R7$(4),yl.Lme("",yl.bMT(12,7,"version"),": ",yl.bMT(13,9,t.version$)),yl.R7$(4),yl.SpI("SDK: ",yl.bMT(16,11,t.sdkVersion$)),yl.R7$(2),yl.Y8G("ngIf",yl.bMT(18,13,t.data$)),yl.R7$(4),yl.SpI(" ",yl.bMT(22,15,"close")," "),yl.R7$(3),yl.SpI(" ",yl.bMT(25,17,"copy")," "))},dependencies:[pl.MD,pl.bT,qf,dh,Zd,Nd,Vd,Xu,Ku,Xl,pl.Jj,pl.vh,Xf],encapsulation:2});var C1=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 T1={[Ta.ChromeExtension]:"https://chromewebstore.google.com/detail/bitwarden-free-password-m/nngceckbapebfimnlniiiahkandclblb/reviews",[Ta.FirefoxExtension]:"https://addons.mozilla.org/en-US/firefox/addon/bitwarden-password-manager/#reviews",[Ta.OperaExtension]:"https://addons.opera.com/en/extensions/details/bitwarden-free-password-manager/#feedback-container",[Ta.EdgeExtension]:"https://microsoftedge.microsoft.com/addons/detail/jbkfoedolllekgbhcbcoahefnbanhhlh",[Ta.VivaldiExtension]:"https://chromewebstore.google.com/detail/bitwarden-free-password-m/nngceckbapebfimnlniiiahkandclblb/reviews",[Ta.SafariExtension]:"https://apps.apple.com/app/bitwarden/id1352778147"};class P1{constructor(e,t,i){this.dialogService=e,this.environmentService=t,this.platformUtilsService=i}about(){this.dialogService.open(I1,{positionStrategy:new Yd})}launchHelp(){return C1(this,void 0,void 0,function*(){(yield this.dialogService.openSimpleDialog({title:{key:"continueToHelpCenter"},content:{key:"continueToHelpCenterDesc"},type:"info",acceptButtonText:{key:"continue"}}))&&(yield tl.createNewTab("https://bitwarden.com/help/"))})}openWebVault(){return C1(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,ho._)(this.environmentService.environment$)).getWebVaultUrl();yield tl.createNewTab(e)}})}rate(){return C1(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 tl.createNewTab(T1[e])}})}}P1.ɵfac=function(e){return new(e||P1)(yl.rXU(Jd),yl.rXU(JS),yl.rXU(Eb))},P1.ɵcmp=yl.VBU({type:P1,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&&(yl.j41(0,"popup-page")(1,"popup-header",0),yl.nI1(2,"i18n"),yl.qex(3,1),yl.nrm(4,"app-pop-out"),yl.bVm(),yl.k0s(),yl.j41(5,"bit-item-group")(6,"bit-item")(7,"button",2),yl.bIt("click",function(){return t.about()}),yl.EFF(8),yl.nI1(9,"i18n"),yl.k0s()(),yl.j41(10,"bit-item")(11,"button",2),yl.bIt("click",function(){return t.launchHelp()}),yl.EFF(12),yl.nI1(13,"i18n"),yl.nrm(14,"i",3),yl.k0s()(),yl.j41(15,"bit-item")(16,"button",2),yl.bIt("click",function(){return t.openWebVault()}),yl.EFF(17),yl.nI1(18,"i18n"),yl.nrm(19,"i",3),yl.k0s()(),yl.j41(20,"bit-item")(21,"button",2),yl.bIt("click",function(){return t.rate()}),yl.EFF(22),yl.nI1(23,"i18n"),yl.nrm(24,"i",3),yl.k0s()()()()),2&e&&(yl.R7$(),yl.Y8G("pageTitle",yl.mNQ(yl.bMT(2,6,"about"))),yl.R7$(7),yl.SpI(" ",yl.bMT(9,8,"aboutBitwarden")," "),yl.R7$(4),yl.SpI(" ",yl.bMT(13,10,"helpCenter")," "),yl.R7$(5),yl.SpI(" ",yl.bMT(18,12,"bitWebVaultApp")," "),yl.R7$(5),yl.SpI(" ",yl.bMT(23,14,"rateExtension")," "))},dependencies:[pl.MD,qf,sw.iI,hD,yD,eD,wP,IP,FP,RP,Xf],encapsulation:2});class F1{}var R1=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 x1{}var A1=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 D1{constructor(e,t,i,n){this.keyGenerationService=e,this.encryptService=t,this.cryptoFunctionService=i,this.kdfConfigService=n}buildPasswordExport(e,t,i){return A1(this,void 0,void 0,function*(){const n=yield this.kdfConfigService.getKdfConfig(e),r=kd.fromBufferToB64(yield this.cryptoFunctionService.randomBytes(16)),s=yield this.keyGenerationService.deriveVaultExportKey(i,r,n),o=yield this.encryptService.encryptString(kd.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===Tf.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.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 CR.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 CR.SecureNote:e.type="note";break;default:return}return e}}class E1{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 $1=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 O1{}var U1=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 M1{}class N1 extends Uw{constructor(e){super(e);const t=this.getResponseProperty("Collections");null!=t&&(this.collections=t.map(e=>new qF(e)));const i=this.getResponseProperty("Ciphers");null!=i&&(this.ciphers=i.map(e=>new $x(e)))}}var V1=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 B1=Object.freeze({AccountEncrypted:0,FileEncrypted:1});var j1=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 G1(e,t){if(1&e&&(yl.qex(0),yl.j41(1,"bit-callout",1),yl.nI1(2,"i18n"),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s(),yl.bVm()),2&e){const e=yl.XpG();yl.R7$(),yl.Y8G("title",yl.mNQ(yl.bMT(2,3,e.scopeConfig.title))),yl.R7$(2),yl.SpI(" ",yl.i5U(4,5,e.scopeConfig.description,e.scopeConfig.scopeIdentifier)," ")}}class L1{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,bl.QZ)(()=>j1(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 j1(this,void 0,void 0,function*(){var n,r;const s=yield(0,ho._)(Gp(this.accountService.activeAccount$));if(e){const t=yield(0,ho._)(this.organizationService.organizations$(s).pipe(QE(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,ho._)(this.accountService.activeAccount$.pipe((0,l.T)(e=>null==e?void 0:e.email))))&&void 0!==r?r:""}})}}L1.ɵfac=function(e){return new(e||L1)(yl.rXU(AF),yl.rXU(Ok))},L1.ɵcmp=yl.VBU({type:L1,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&&yl.DNE(0,G1,5,8,"ng-container",0),2&e&&yl.Y8G("ngIf",t.show)},dependencies:[pl.MD,pl.bT,qf,td,ed,Xf],encapsulation:2});var z1=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 _1(e,t){1&e&&(yl.j41(0,"bit-callout",6),yl.nI1(1,"i18n"),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s()),2&e&&(yl.Y8G("title",yl.mNQ(yl.bMT(1,3,"vaultExportDisabled"))),yl.R7$(2),yl.SpI(" ",yl.bMT(3,5,"personalVaultExportPolicyInEffect"),"\n"))}function K1(e,t){1&e&&(yl.nrm(0,"bit-option",10),yl.nI1(1,"i18n")),2&e&&yl.Y8G("label",yl.bMT(1,1,"myVault"))}function X1(e,t){if(1&e&&yl.nrm(0,"bit-option",11),2&e){const e=t.$implicit;yl.Y8G("value",e.id)("label",e.name)}}function q1(e,t){if(1&e&&(yl.j41(0,"bit-form-field")(1,"bit-label"),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.j41(4,"bit-select",7),yl.DNE(5,K1,2,3,"bit-option",8),yl.nI1(6,"async"),yl.DNE(7,X1,1,2,"bit-option",9),yl.k0s()()),2&e){const e=yl.XpG().ngIf,t=yl.XpG();yl.R7$(2),yl.JRh(yl.bMT(3,3,"exportFrom")),yl.R7$(3),yl.Y8G("ngIf",!yl.bMT(6,5,t.organizationDataOwnershipPolicyAppliesToUser$)),yl.R7$(2),yl.Y8G("ngForOf",e)}}function Y1(e,t){if(1&e&&(yl.qex(0),yl.DNE(1,q1,8,7,"bit-form-field",3),yl.bVm()),2&e){const e=t.ngIf;yl.R7$(),yl.Y8G("ngIf",e.length>0)}}function W1(e,t){if(1&e&&yl.nrm(0,"bit-option",12),2&e){const e=t.$implicit;yl.Y8G("value",e.format)("label",e.name)}}function H1(e,t){if(1&e){const e=yl.RV6();yl.qex(0),yl.j41(1,"div",16)(2,"bit-form-field")(3,"bit-label"),yl.EFF(4),yl.nI1(5,"i18n"),yl.k0s(),yl.nrm(6,"input",17),yl.j41(7,"button",18),yl.mxI("toggledChange",function(t){a.eBV(e);const i=yl.XpG(2);return yl.DH7(i.showFilePassword,t)||(i.showFilePassword=t),a.Njj(t)}),yl.k0s(),yl.j41(8,"button",19),yl.nI1(9,"i18n"),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG(2);return a.Njj(t.generatePassword())}),yl.k0s(),yl.nrm(10,"button",20),yl.nI1(11,"i18n"),yl.nI1(12,"i18n"),yl.j41(13,"bit-hint"),yl.EFF(14),yl.nI1(15,"i18n"),yl.k0s()(),yl.nrm(16,"tools-password-strength",21),yl.k0s(),yl.j41(17,"bit-form-field")(18,"bit-label"),yl.EFF(19),yl.nI1(20,"i18n"),yl.k0s(),yl.nrm(21,"input",22),yl.j41(22,"button",18),yl.mxI("toggledChange",function(t){a.eBV(e);const i=yl.XpG(2);return yl.DH7(i.showFilePassword,t)||(i.showFilePassword=t),a.Njj(t)}),yl.k0s()(),yl.bVm()}if(2&e){const e=yl.XpG(2);yl.R7$(4),yl.JRh(yl.bMT(5,12,"filePassword")),yl.R7$(3),yl.R50("toggled",e.showFilePassword),yl.R7$(),yl.Y8G("label",yl.bMT(9,14,"generatePassword")),yl.R7$(2),yl.Y8G("disabled",!e.filePassword)("appCopyClick",e.filePassword)("valueLabel",yl.bMT(11,16,"password"))("label",yl.bMT(12,18,"password")),yl.R7$(4),yl.JRh(yl.bMT(15,20,"exportPasswordDescription")),yl.R7$(2),yl.Y8G("password",e.filePassword)("showText",!0),yl.R7$(3),yl.JRh(yl.bMT(20,22,"confirmFilePassword")),yl.R7$(3),yl.R50("toggled",e.showFilePassword)}}function J1(e,t){if(1&e&&(yl.qex(0),yl.j41(1,"bit-radio-group",13)(2,"bit-label"),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s(),yl.j41(5,"bit-radio-button",14)(6,"bit-label"),yl.EFF(7),yl.nI1(8,"i18n"),yl.k0s(),yl.j41(9,"bit-hint"),yl.EFF(10),yl.nI1(11,"i18n"),yl.k0s()(),yl.j41(12,"bit-radio-button",15)(13,"bit-label"),yl.EFF(14),yl.nI1(15,"i18n"),yl.k0s(),yl.j41(16,"bit-hint"),yl.EFF(17),yl.nI1(18,"i18n"),yl.k0s()()(),yl.DNE(19,H1,23,24,"ng-container",3),yl.bVm()),2&e){const e=yl.XpG();yl.R7$(3),yl.JRh(yl.bMT(4,8,"exportTypeHeading")),yl.R7$(2),yl.Y8G("value",e.encryptedExportType.AccountEncrypted),yl.R7$(2),yl.JRh(yl.bMT(8,10,"accountRestricted")),yl.R7$(3),yl.JRh(yl.bMT(11,12,"accountRestrictedOptionDescription")),yl.R7$(2),yl.Y8G("value",e.encryptedExportType.FileEncrypted),yl.R7$(2),yl.JRh(yl.bMT(15,14,"passwordProtected")),yl.R7$(3),yl.JRh(yl.bMT(18,16,"passwordProtectedOptionDescription")),yl.R7$(2),yl.Y8G("ngIf",e.fileEncryptionType==e.encryptedExportType.FileEncrypted)}}class Z1{set organizationId(e){kd.isNullOrEmpty(e)?this._organizationId$.next(void 0):Fz(e)?(this._organizationId$.next(e),Gp(this.accountService.activeAccount$).pipe((0,co.n)(t=>this.organizationService.organizations$(t).pipe(QE(e)))).pipe((0,Jv.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))===Ca.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,f,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.configService=p,this.platformUtilsService=f,this.router=v,this._organizationId$=new fd.t(void 0),this._showExcludeMyItems=!1,this.formLoading=new yl.bkB,this.formDisabled=new yl.bkB,this.onSuccessfulExport=new yl.bkB,this.encryptedExportType=B1,this._disabledByPolicy=!1,this.exportForm=this.formBuilder.group({vaultSelector:["myVault",{nonNullable:!0,validators:[fl.k0.required]}],format:["json",fl.k0.required],secret:[""],filePassword:["",fl.k0.required],confirmFilePassword:["",fl.k0.required],fileEncryptionType:[B1.AccountEncrypted]}),this.destroy$=new go.B,this.onlyManagedCollections=!0,this.onGenerate$=new go.B,this.generatePassword=()=>z1(this,void 0,void 0,function*(){this.onGenerate$.next({source:"export",type:bm.password})}),this.submit=()=>z1(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 z1(this,void 0,void 0,function*(){this.observeFeatureFlags(),this.observeFormState(),this.observePolicyStatus(),this.observeFormSelections(),this.observeMyItemsExclusionCriteria(),this.observeValidatorAdjustments(),this.setupPasswordGeneration(),this.organizationId?this.initOrganizationOnly():(this.initIndividual(),this.setupPolicyBasedFormState())})}observeFeatureFlags(){this.createDefaultLocationFlagEnabled$=(0,md.H)(this.configService.getFeatureFlag(Nf.CreateDefaultLocation)).pipe((0,Pp.t)({bufferSize:1,refCount:!0}))}observeFormState(){this.exportForm.statusChanges.pipe((0,Jv.Q)(this.destroy$)).subscribe(e=>{this.formDisabled.emit("DISABLED"===e)})}observePolicyStatus(){this.disablePersonalVaultExportPolicy$=this.accountService.activeAccount$.pipe(Gp,(0,co.n)(e=>this.policyService.policyAppliesToUser$(_h.DisablePersonalVaultExport,e))),this.organizationDataOwnershipPolicyAppliesToUser$=this.accountService.activeAccount$.pipe(Gp,(0,co.n)(e=>this.policyService.policyAppliesToUser$(_h.OrganizationDataOwnership,e))),this.organizationDataOwnershipPolicyEnabledForOrg$=(0,$o.z)([this.accountService.activeAccount$.pipe(Gp),this._organizationId$]).pipe((0,co.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===_h.OrganizationDataOwnership&&e.organizationId===t);return null!==(i=null==n?void 0:n.enabled)&&void 0!==i&&i})):(0,Oo.of)(!1)))}observeFormSelections(){this.exportForm.controls.vaultSelector.valueChanges.pipe((0,Jv.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,co.n)(e=>this.exportService.formats$(e)),(0,Fo.M)(e=>{const t=this.exportForm.get("format").value;e.some(e=>e.format===t)||this.exportForm.get("format").setValue("json")}),(0,Pp.t)({bufferSize:1,refCount:!0}))}observeMyItemsExclusionCriteria(){(0,$o.z)({createDefaultLocationFlagEnabled:this.createDefaultLocationFlagEnabled$,organizationDataOwnershipPolicyEnabledForOrg:this.organizationDataOwnershipPolicyEnabledForOrg$,organizationId:this._organizationId$}).pipe((0,Jv.Q)(this.destroy$)).subscribe(({createDefaultLocationFlagEnabled:e,organizationDataOwnershipPolicyEnabledForOrg:t,organizationId:i})=>{this._showExcludeMyItems=!(!e||!i)&&t})}observeValidatorAdjustments(){(0,bo.h)(this.exportForm.get("format").valueChanges,this.exportForm.get("fileEncryptionType").valueChanges).pipe((0,sd.Z)(0),(0,Jv.Q)(this.destroy$)).subscribe(()=>this.adjustValidators())}setupPasswordGeneration(){const e=this.accountService.activeAccount$.pipe(vm({name(){return"active export account"},distinct(e,t){return e.id===t.id}}));this.generatorService.generate$({on$:this.onGenerate$,account$:e}).pipe((0,Jv.Q)(this.destroy$)).subscribe(e=>{this.exportForm.patchValue({filePassword:e.credential,confirmFilePassword:e.credential})})}initOrganizationOnly(){this.organizations$=this.accountService.activeAccount$.pipe(Gp,(0,co.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(Gp,(0,co.n)(e=>(0,$o.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(kd.getSortFunction(this.i18nService,"name"))}))}setupPolicyBasedFormState(){(0,$o.z)([this.disablePersonalVaultExportPolicy$,this.organizationDataOwnershipPolicyAppliesToUser$,this.organizations$]).pipe((0,Fo.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,Jv.Q)(this.destroy$)).subscribe()}ngAfterViewInit(){this.bitSubmit.loading$.pipe((0,Jv.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===B1.FileEncrypted}get isAccountEncryptedExport(){return"encrypted_json"===this.format&&this.fileEncryptionType===B1.AccountEncrypted}doExport(){return z1(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 z1(this,void 0,void 0,function*(){let e="exportWarningDesc";this.isFileEncryptedExport?e="fileEncryptedExportWarningDesc":this.isAccountEncryptedExport&&(e="encExportKeyWarningDesc");const t=yield QC.open(this.dialogService,{title:"confirmVaultExport",bodyText:e,confirmButtonOptions:{text:"continue",type:"primary"}});return"cancel"!==t.userAction&&(!!t.verificationSuccess||(t.noAvailableClientVerificationMethods,!1))})}getExportData(){return z1(this,void 0,void 0,function*(){const e=yield(0,ho._)(this.accountService.activeAccount$.pipe(Gp));return kd.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 z1(this,void 0,void 0,function*(){return this.organizationId?yield this.eventCollectionService.collect(Ra.Organization_ClientExportedVault,null,!1,this.organizationId):yield this.eventCollectionService.collect(Ra.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==B1.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}})}}Z1.ɵfac=function(e){return new(e||Z1)(yl.rXU(Pl),yl.rXU(xb),yl.rXU(F1),yl.rXU(OE),yl.rXU(sv),yl.rXU($b),yl.rXU(za),yl.rXU(fl.ze),yl.rXU(z$),yl.rXU(Jd),yl.rXU(AF),yl.rXU(Ok),yl.rXU(BF),yl.rXU(uk),yl.rXU(Eb),yl.rXU(ud.Ix,8))},Z1.ɵcmp=yl.VBU({type:Z1,selectors:[["tools-export"]],viewQuery:function(e,t){if(1&e&&(yl.GBs(Td,5),yl.GBs(nv,5)),2&e){let e;yl.mGM(e=yl.lsd())&&(t.bitSubmit=e.first),yl.mGM(e=yl.lsd())&&(t.passwordStrengthComponent=e.first)}},inputs:{organizationId:"organizationId"},outputs:{formLoading:"formLoading",formDisabled:"formDisabled",onSuccessfulExport:"onSuccessfulExport"},decls:14,vars:18,consts:[["type","danger",3,"title",4,"ngIf"],[3,"organizationId","exportFormat","orgExportDescription"],["id","export_form_exportForm",3,"formGroup","bitSubmit"],[4,"ngIf"],["formControlName","format"],[3,"value","label",4,"ngFor","ngForOf"],["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"],[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&&(yl.DNE(0,_1,4,7,"bit-callout",0),yl.nI1(1,"async"),yl.nrm(2,"tools-export-scope-callout",1),yl.j41(3,"form",2),yl.DNE(4,Y1,2,1,"ng-container",3),yl.nI1(5,"async"),yl.j41(6,"bit-form-field")(7,"bit-label"),yl.EFF(8),yl.nI1(9,"i18n"),yl.k0s(),yl.j41(10,"bit-select",4),yl.DNE(11,W1,1,2,"bit-option",5),yl.nI1(12,"async"),yl.k0s()(),yl.DNE(13,J1,20,18,"ng-container",3),yl.k0s()),2&e&&(yl.Y8G("ngIf",yl.bMT(1,10,t.disablePersonalVaultExportPolicy$)),yl.R7$(2),yl.Y8G("organizationId",t.organizationId)("exportFormat",t.format)("orgExportDescription",t.orgExportDescription),yl.R7$(),yl.Y8G("formGroup",t.exportForm)("bitSubmit",t.submit),yl.R7$(),yl.Y8G("ngIf",yl.bMT(5,12,t.organizations$)),yl.R7$(4),yl.JRh(yl.bMT(9,14,"fileFormat")),yl.R7$(3),yl.Y8G("ngForOf",yl.bMT(12,16,t.formatOptions$)),yl.R7$(2),yl.Y8G("ngIf","encrypted_json"===t.format))},dependencies:[pl.MD,pl.Sq,pl.bT,fl.X1,fl.qT,fl.me,fl.BC,fl.cb,fl.j4,fl.JD,qf,sP,g$,Eu,Sc,nu,ou,Du,Vb,Bb,rc,Td,Xu,_l,zl,Bu,Vu,Ou,td,ed,Nc,Mc,$c,L1,nv,kG,pl.Jj,Xf],encapsulation:2});var Q1=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 e2{constructor(e){this.router=e,this.disabled=!1,this.loading=!1}onSuccessfulExport(e){return Q1(this,void 0,void 0,function*(){yield this.router.navigate(["/tabs/settings"])})}}e2.ɵfac=function(e){return new(e||e2)(yl.rXU(ud.Ix))},e2.ɵcmp=yl.VBU({type:e2,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&&(yl.j41(0,"popup-page")(1,"popup-header",0),yl.nI1(2,"i18n"),yl.qex(3,1),yl.nrm(4,"app-pop-out"),yl.bVm(),yl.k0s(),yl.j41(5,"tools-export",2),yl.bIt("formDisabled",function(e){return t.disabled=e})("formLoading",function(e){return t.loading=e})("onSuccessfulExport",function(e){return t.onSuccessfulExport(e)}),yl.k0s(),yl.j41(6,"popup-footer",3)(7,"button",4),yl.EFF(8),yl.nI1(9,"i18n"),yl.k0s(),yl.j41(10,"button",5),yl.EFF(11),yl.nI1(12,"i18n"),yl.k0s()()()),2&e&&(yl.R7$(),yl.Y8G("pageTitle",yl.bMT(2,5,"exportNoun")),yl.R7$(6),yl.Y8G("disabled",t.disabled)("loading",t.loading),yl.R7$(),yl.SpI(" ",yl.bMT(9,7,"exportVerb")," "),yl.R7$(3),yl.SpI(" ",yl.bMT(12,9,"cancel")," "))},dependencies:[pl.MD,qf,dh,rc,xd,Xu,Ku,Z1,hD,YJ,yD,eD,v0,Xf],encapsulation:2});var t2=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 i2{constructor(e){this.router=e,this.disabled=!1,this.loading=!1}onSuccessfulImport(e){return t2(this,void 0,void 0,function*(){yield this.router.navigate(["/vault-settings"])})}}i2.ɵfac=function(e){return new(e||i2)(yl.rXU(ud.Ix))},i2.ɵcmp=yl.VBU({type:i2,selectors:[["ng-component"]],features:[yl.Jv_([...RK,{provide:bK,useClass:class{constructor(e){this.system=e,this.importers=CK,this.logger=e.log({type:"ImportMetadataService"}),this.chromiumWithABE$=this.system.configService.getFeatureFlag$(Nf.ChromiumImporterWithABE)}init(){return TK(this,void 0,void 0,function*(){})}metadata$(e){const t=this.system.environment.getClientType(),i=(0,$o.z)([e,this.chromiumWithABE$]).pipe((0,l.T)(([e,i])=>{var n;if(!this.importers)return{type:e,loaders:[]};const r=this.availableLoaders(this.importers,e,t,i);if(!r||0===r.length)return{type:e,loaders:[]};const s={type:e,loaders:r};return e in this.importers&&(s.instructions=null===(n=this.importers[e])||void 0===n?void 0:n.instructions),this.logger.debug({importType:e,capabilities:s},"capabilities updated"),s}));return i}availableLoaders(e,t,i,n){let r=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=>kK[e].includes(i))}(e,t,i);if(n)return r;if("bravecsv"===t||"chromecsv"===t)try{const e=this.system.environment.getDevice();e===Ta.WindowsDesktop&&(r=null==r?void 0:r.filter(e=>e!==wK.chromium))}catch(e){r=null==r?void 0:r.filter(e=>e!==wK.chromium)}return r}},deps:[FK]}])],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&&(yl.j41(0,"popup-page")(1,"popup-header",0),yl.nI1(2,"i18n"),yl.qex(3,1),yl.nrm(4,"app-pop-out"),yl.bVm(),yl.k0s(),yl.j41(5,"tools-import",2),yl.bIt("formDisabled",function(e){return t.disabled=e})("formLoading",function(e){return t.loading=e})("onSuccessfulImport",function(e){return t.onSuccessfulImport(e)}),yl.k0s(),yl.j41(6,"popup-footer",3)(7,"button",4),yl.EFF(8),yl.nI1(9,"i18n"),yl.k0s()()()),2&e&&(yl.R7$(),yl.Y8G("pageTitle",yl.bMT(2,4,"importNoun")),yl.R7$(6),yl.Y8G("disabled",t.disabled)("loading",t.loading),yl.R7$(),yl.SpI(" ",yl.bMT(9,6,"importVerb")," "))},dependencies:[pl.MD,qf,dh,rc,xd,Xu,Ku,Bq,hD,YJ,yD,eD,Xf],encapsulation:2});var n2=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 r2(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"bit-spotlight",23)(1,"span",24),yl.EFF(2),yl.nI1(3,"i18n"),yl.j41(4,"button",25),yl.nI1(5,"i18n"),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.openUpgradeDialog())}),yl.EFF(6),yl.nI1(7,"i18n"),yl.k0s()()()}2&e&&(yl.R7$(2),yl.SpI("",yl.bMT(3,3,"unlockFeaturesWithPremium")," "),yl.R7$(2),yl.Y8G("title",yl.bMT(5,5,"upgradeNow")),yl.R7$(2),yl.SpI(" ",yl.bMT(7,7,"upgradeNow")," "))}function s2(e,t){1&e&&(yl.j41(0,"span",26),yl.nI1(1,"i18n"),yl.EFF(2,"1"),yl.k0s()),2&e&&yl.BMQ("aria-label",yl.bMT(1,1,"nudgeBadgeAria"))}function o2(e,t){1&e&&(yl.j41(0,"span",26),yl.nI1(1,"i18n"),yl.EFF(2,"1"),yl.k0s()),2&e&&yl.BMQ("aria-label",yl.bMT(1,1,"nudgeBadgeAria"))}function a2(e,t){1&e&&(yl.j41(0,"span",26),yl.nI1(1,"i18n"),yl.EFF(2,"1 "),yl.k0s()),2&e&&yl.BMQ("aria-label",yl.bMT(1,1,"nudgeBadgeAria"))}class l2{constructor(e,t,i,n,r){this.nudgesService=e,this.accountService=t,this.autofillBrowserSettingsService=i,this.accountProfileStateService=n,this.dialogService=r,this.NudgeType=VR,this.isBrowserAutofillSettingOverridden$=(0,md.H)(this.autofillBrowserSettingsService.isBrowserAutofillSettingOverridden(tl.getBrowserClientVendor(window))),this.authenticatedAccount$=this.accountService.activeAccount$.pipe((0,To.p)(e=>null!==e),(0,Pp.t)({bufferSize:1,refCount:!0})),this.hasPremium$=this.authenticatedAccount$.pipe((0,co.n)(e=>this.accountProfileStateService.hasPremiumFromAnySource$(e.id))),this.showDownloadBitwardenNudge$=this.authenticatedAccount$.pipe((0,co.n)(e=>this.nudgesService.showNudgeBadge$(VR.DownloadBitwarden,e.id))),this.showVaultBadge$=this.authenticatedAccount$.pipe((0,co.n)(e=>this.nudgesService.showNudgeBadge$(VR.EmptyVaultNudge,e.id))),this.showAutofillBadge$=(0,$o.z)([this.autofillBrowserSettingsService.defaultBrowserAutofillDisabled$,this.authenticatedAccount$]).pipe((0,co.n)(([e,t])=>this.nudgesService.showNudgeBadge$(VR.AutofillNudge,t.id).pipe((0,l.T)(t=>!e&&t))))}openUpgradeDialog(){Q0.open(this.dialogService)}dismissBadge(e){return n2(this,void 0,void 0,function*(){if(yield(0,ho._)(this.showVaultBadge$)){const t=yield(0,ho._)(this.authenticatedAccount$);yield this.nudgesService.dismissNudge(e,t.id,!0)}})}}l2.ɵfac=function(e){return new(e||l2)(yl.rXU(jR),yl.rXU(Ok),yl.rXU(Jq),yl.rXU(ME),yl.rXU(Jd))},l2.ɵcmp=yl.VBU({type:l2,selectors:[["ng-component"]],decls:70,vars:42,consts:[["persistent","",4,"ngIf"],["slot","header",3,"pageTitle"],["slot","end"],["bit-item-content","","routerLink","/account-security"],["slot","start","aria-hidden","true",1,"bwi","bwi-lock"],["slot","end","aria-hidden","true",1,"bwi","bwi-angle-right"],["bit-item-content","","routerLink","/autofill"],["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",4,"ngIf"],["bit-item-content","","routerLink","/notifications"],["slot","start","aria-hidden","true",1,"bwi","bwi-file-text"],["bit-item-content","","routerLink","/vault-settings",3,"click"],["slot","start","aria-hidden","true",1,"bwi","bwi-vault"],["bit-item-content","","routerLink","/appearance"],["slot","start","aria-hidden","true",1,"bwi","bwi-brush"],["bit-item-content","","routerLink","/about"],["slot","start","aria-hidden","true",1,"bwi","bwi-info-circle"],["bit-item-content","","routerLink","/download-bitwarden"],["slot","start","aria-hidden","true",1,"bwi","bwi-mobile"],["bit-item-content","","routerLink","/more-from-bitwarden"],["slot","start","aria-hidden","true",1,"bwi","bwi-filter"],["persistent",""],[1,"tw-text-xs"],["bitLink","","buttonType","primary","type","button",1,"tw-text-xs",3,"click","title"],["bitBadge","","variant","notification"]],template:function(e,t){1&e&&(yl.j41(0,"popup-page"),yl.DNE(1,r2,8,9,"bit-spotlight",0),yl.nI1(2,"async"),yl.j41(3,"popup-header",1),yl.nI1(4,"i18n"),yl.qex(5,2),yl.nrm(6,"app-pop-out")(7,"app-current-account"),yl.bVm(),yl.k0s(),yl.j41(8,"bit-item-group")(9,"bit-item")(10,"a",3),yl.nrm(11,"i",4),yl.EFF(12),yl.nI1(13,"i18n"),yl.nrm(14,"i",5),yl.k0s()(),yl.j41(15,"bit-item")(16,"a",6),yl.nrm(17,"i",7),yl.j41(18,"div",8)(19,"p",9),yl.EFF(20),yl.nI1(21,"i18n"),yl.k0s(),yl.DNE(22,s2,3,3,"span",10),yl.nI1(23,"async"),yl.nI1(24,"async"),yl.k0s(),yl.nrm(25,"i",5),yl.k0s()(),yl.j41(26,"bit-item")(27,"a",11),yl.nrm(28,"i",12),yl.EFF(29),yl.nI1(30,"i18n"),yl.nrm(31,"i",5),yl.k0s()(),yl.j41(32,"bit-item")(33,"a",13),yl.bIt("click",function(){return t.dismissBadge(t.NudgeType.EmptyVaultNudge)}),yl.nrm(34,"i",14),yl.j41(35,"div",8)(36,"p",9),yl.EFF(37),yl.nI1(38,"i18n"),yl.k0s(),yl.DNE(39,o2,3,3,"span",10),yl.nI1(40,"async"),yl.k0s(),yl.nrm(41,"i",5),yl.k0s()(),yl.j41(42,"bit-item")(43,"a",15),yl.nrm(44,"i",16),yl.EFF(45),yl.nI1(46,"i18n"),yl.nrm(47,"i",5),yl.k0s()(),yl.j41(48,"bit-item")(49,"a",17),yl.nrm(50,"i",18),yl.EFF(51),yl.nI1(52,"i18n"),yl.nrm(53,"i",5),yl.k0s()(),yl.j41(54,"bit-item")(55,"a",19),yl.nrm(56,"i",20),yl.j41(57,"div",8)(58,"p",9),yl.EFF(59),yl.nI1(60,"i18n"),yl.k0s(),yl.DNE(61,a2,3,3,"span",10),yl.nI1(62,"async"),yl.k0s(),yl.nrm(63,"i",5),yl.k0s()(),yl.j41(64,"bit-item")(65,"a",21),yl.nrm(66,"i",22),yl.EFF(67),yl.nI1(68,"i18n"),yl.nrm(69,"i",5),yl.k0s()()()()),2&e&&(yl.R7$(),yl.Y8G("ngIf",!yl.bMT(2,14,t.hasPremium$)),yl.R7$(2),yl.Y8G("pageTitle",yl.mNQ(yl.bMT(4,16,"settings"))),yl.R7$(9),yl.SpI(" ",yl.bMT(13,18,"accountSecurity")," "),yl.R7$(8),yl.JRh(yl.bMT(21,20,"autofill")),yl.R7$(2),yl.Y8G("ngIf",!yl.bMT(23,22,t.isBrowserAutofillSettingOverridden$)&&yl.bMT(24,24,t.showAutofillBadge$)),yl.R7$(7),yl.SpI(" ",yl.bMT(30,26,"notifications")," "),yl.R7$(8),yl.JRh(yl.bMT(38,28,"settingsVaultOptions")),yl.R7$(2),yl.Y8G("ngIf",yl.bMT(40,30,t.showVaultBadge$)),yl.R7$(6),yl.SpI(" ",yl.bMT(46,32,"appearance")," "),yl.R7$(6),yl.SpI(" ",yl.bMT(52,34,"about")," "),yl.R7$(8),yl.JRh(yl.bMT(60,36,"downloadBitwardenOnAllDevices")),yl.R7$(2),yl.Y8G("ngIf",yl.bMT(62,38,t.showDownloadBitwardenNudge$)),yl.R7$(6),yl.SpI(" ",yl.bMT(68,40,"moreFromBitwarden")," "))},dependencies:[pl.MD,pl.bT,qf,sw.iI,sw.Wk,hD,yD,eD,wP,IP,FP,RP,PF,_c,qR,Xl,Oh,Kb,pl.Jj,Xf],encapsulation:2,changeDetection:0});class c2{}class u2{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 d2{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 d2({}),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 h2 extends Uw{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 p2=k.array(Oe,"notifications",{deserializer:e=>d2.fromJSON(e),clearOn:["logout","lock"]});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())})};const v2=(0,l.T)(e=>Object.entries(null!=e?e:{}).filter(([,e])=>e>=cd.Locked).map(([e])=>e));var m2=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 g2="dismissed";class y2{constructor(){this.dialogRef=(0,a.WQX)(Xd),this.dismissBtnEnabled=(0,a.vPA)(!1)}dismiss(){return m2(this,void 0,void 0,function*(){this.dialogRef.close(g2)})}onSlideChange(e){2===e&&this.dismissBtnEnabled.set(!0)}static open(e){return e.open(y2,{disableClose:!0,positionStrategy:new Yd})}}y2.ɵfac=function(e){return new(e||y2)},y2.ɵcmp=yl.VBU({type:y2,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&&(yl.j41(0,"bit-simple-dialog",0)(1,"div",1)(2,"vault-carousel",2),yl.bIt("slideChange",function(e){return t.onSlideChange(e)}),yl.j41(3,"vault-carousel-slide",3),yl.nI1(4,"i18n"),yl.nrm(5,"img",4),yl.nI1(6,"i18n"),yl.j41(7,"h2",5),yl.EFF(8),yl.nI1(9,"i18n"),yl.k0s(),yl.j41(10,"p",6),yl.EFF(11),yl.nI1(12,"i18n"),yl.k0s()(),yl.j41(13,"vault-carousel-slide",3),yl.nI1(14,"i18n"),yl.nrm(15,"img",7),yl.nI1(16,"i18n"),yl.j41(17,"h2",5),yl.EFF(18),yl.nI1(19,"i18n"),yl.k0s(),yl.j41(20,"p",6),yl.EFF(21),yl.nI1(22,"i18n"),yl.k0s()(),yl.j41(23,"vault-carousel-slide",3),yl.nI1(24,"i18n"),yl.nrm(25,"img",8),yl.nI1(26,"i18n"),yl.j41(27,"h2",5),yl.EFF(28),yl.nI1(29,"i18n"),yl.k0s(),yl.j41(30,"p",6),yl.EFF(31),yl.nI1(32,"i18n"),yl.k0s()()()(),yl.qex(33,9),yl.j41(34,"button",10),yl.bIt("click",function(){return t.dismiss()}),yl.EFF(35),yl.nI1(36,"i18n"),yl.k0s(),yl.bVm(),yl.k0s()),2&e&&(yl.R7$(3),yl.Y8G("label",yl.bMT(4,14,"reviewAtRiskLogins")),yl.R7$(2),yl.Y8G("alt",yl.bMT(6,16,"reviewAtRiskLoginSlideImgAltPeriod")),yl.R7$(3),yl.JRh(yl.bMT(9,18,"reviewAtRiskLogins")),yl.R7$(3),yl.SpI(" ",yl.bMT(12,20,"reviewAtRiskLoginsSlideDesc")," "),yl.R7$(2),yl.Y8G("label",yl.bMT(14,22,"generatePassword")),yl.R7$(2),yl.Y8G("alt",yl.bMT(16,24,"generatePasswordSlideImgAltPeriod")),yl.R7$(3),yl.JRh(yl.bMT(19,26,"generatePassword")),yl.R7$(3),yl.SpI(" ",yl.bMT(22,28,"generatePasswordSlideDesc")," "),yl.R7$(2),yl.Y8G("label",yl.bMT(24,30,"updateInBitwarden")),yl.R7$(2),yl.Y8G("alt",yl.bMT(26,32,"updateInBitwardenSlideImgAltPeriod")),yl.R7$(3),yl.JRh(yl.bMT(29,34,"updateInBitwarden")),yl.R7$(3),yl.SpI(" ",yl.bMT(32,36,"updateInBitwardenSlideDesc")," "),yl.R7$(3),yl.Y8G("disabled",!t.dismissBtnEnabled()),yl.R7$(),yl.SpI(" ",yl.bMT(36,38,"reviewAtRiskPasswords")," "))},dependencies:[dh,Vd,fL,pL,ZG,Xl,Wl,Xu,Ku,o$,Hl],encapsulation:2});var b2=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 w2=new k($e,"autofillCalloutDismissed",{deserializer:e=>e,clearOn:[]}),S2=new k($e,"gettingStartedCarouselDismissed",{deserializer:e=>e,clearOn:[]});class k2{constructor(){this.stateProvider=(0,a.WQX)(u)}isCalloutDismissed(e){return this.stateProvider.getUser(e,w2).state$.pipe((0,l.T)(e=>!!e))}dismissCallout(e){return b2(this,void 0,void 0,function*(){yield this.stateProvider.getUser(e,w2).update(()=>!0)})}isGettingStartedDismissed(e){return this.stateProvider.getUser(e,S2).state$.pipe((0,l.T)(e=>!!e))}dismissGettingStarted(e){return b2(this,void 0,void 0,function*(){yield this.stateProvider.getUser(e,S2).update(()=>!0)})}}k2.ɵfac=function(e){return new(e||k2)},k2.ɵprov=a.jDH({token:k2,factory:k2.ɵfac});var I2=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 C2(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"bit-callout",5),yl.nI1(1,"i18n"),yl.j41(2,"p",6),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s(),yl.j41(5,"button",7),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.activateInlineAutofillMenuVisibility())}),yl.EFF(6),yl.nI1(7,"i18n"),yl.k0s(),yl.j41(8,"button",8),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.dismissCallout())}),yl.EFF(9),yl.nI1(10,"i18n"),yl.k0s()()}2&e&&(yl.Y8G("appA11yTitle",yl.bMT(1,4,"changeAtRiskPasswordsFaster")),yl.R7$(3),yl.JRh(yl.bMT(4,6,"changeAtRiskPasswordsFasterDesc")),yl.R7$(3),yl.SpI(" ",yl.bMT(7,8,"turnOnAutofill")," "),yl.R7$(3),yl.SpI(" ",yl.bMT(10,10,"dismiss")," "))}function T2(e,t){1&e&&(yl.nrm(0,"i",19),yl.nI1(1,"i18n")),2&e&&yl.Y8G("appA11yTitle",yl.bMT(1,1,"attachments"))}function P2(e,t){1&e&&(yl.qex(0),yl.EFF(1),yl.nI1(2,"i18n"),yl.bVm()),2&e&&(yl.R7$(),yl.SpI(" ",yl.bMT(2,1,"change")," "))}function F2(e,t){1&e&&yl.nrm(0,"i",22)}function R2(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",20),yl.nI1(1,"i18n"),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG().$implicit,i=yl.XpG(2);return a.Njj(i.launchChangePassword(t))}),yl.DNE(2,P2,3,3,"ng-container",4)(3,F2,1,0,"i",21),yl.k0s()}if(2&e){const e=yl.XpG().$implicit,t=yl.XpG(2);yl.Y8G("appA11yTitle",yl.i5U(1,4,"changeButtonTitle",e.name))("disabled",t.launchingCipher()==e),yl.R7$(2),yl.Y8G("ngIf",t.launchingCipher()!=e),yl.R7$(),yl.Y8G("ngIf",t.launchingCipher()==e)}}function x2(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",23),yl.nI1(1,"i18n"),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG().$implicit,i=yl.XpG(2);return a.Njj(i.viewCipher(t))}),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s()}if(2&e){const e=yl.XpG().$implicit;yl.Y8G("appA11yTitle",yl.i5U(1,2,"viewItemTitle",e.name)),yl.R7$(2),yl.SpI(" ",yl.bMT(3,5,"viewLogin")," ")}}function A2(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"bit-item")(1,"button",10),yl.nI1(2,"i18n"),yl.bIt("click",function(){const t=a.eBV(e).$implicit,i=yl.XpG(2);return a.Njj(i.viewCipher(t))}),yl.j41(3,"div",11),yl.nrm(4,"app-vault-icon",12),yl.k0s(),yl.j41(5,"span",13),yl.EFF(6),yl.k0s(),yl.j41(7,"span",14),yl.EFF(8),yl.k0s(),yl.j41(9,"div",15),yl.DNE(10,T2,2,3,"i",16),yl.k0s()(),yl.j41(11,"bit-item-action",2),yl.DNE(12,R2,4,7,"button",17)(13,x2,4,7,"button",18),yl.k0s()()}if(2&e){const e=t.$implicit,i=yl.XpG(2);yl.R7$(),yl.Y8G("appA11yTitle",yl.i5U(2,7,"viewItemTitle",e.name)),yl.R7$(3),yl.Y8G("cipher",e),yl.R7$(2),yl.JRh(e.name),yl.R7$(2),yl.JRh(e.subTitle),yl.R7$(2),yl.Y8G("ngIf",e.hasAttachments),yl.R7$(2),yl.Y8G("ngIf",i.hasLoginUri(e)),yl.R7$(),yl.Y8G("ngIf",!i.hasLoginUri(e))}}function D2(e,t){if(1&e&&(yl.qex(0),yl.j41(1,"p",6),yl.EFF(2),yl.nI1(3,"async"),yl.k0s(),yl.j41(4,"bit-item-group"),yl.DNE(5,A2,14,10,"bit-item",9),yl.k0s(),yl.bVm()),2&e){const e=t.ngIf,i=yl.XpG();yl.R7$(2),yl.JRh(yl.bMT(3,2,i.pageDescription$)),yl.R7$(3),yl.Y8G("ngForOf",e)}}class E2{constructor(){this.taskService=(0,a.WQX)(kE),this.organizationService=(0,a.WQX)(AF),this.cipherService=(0,a.WQX)(Fb),this.i18nService=(0,a.WQX)(Pl),this.accountService=(0,a.WQX)(Ok),this.passwordRepromptService=(0,a.WQX)($E),this.router=(0,a.WQX)(ud.Ix),this.autofillSettingsService=(0,a.WQX)(HD),this.toastService=(0,a.WQX)(xb),this.atRiskPasswordPageService=(0,a.WQX)(k2),this.changeLoginPasswordService=(0,a.WQX)(WU),this.platformUtilsService=(0,a.WQX)(Eb),this.dialogService=(0,a.WQX)(Jd),this.endUserNotificationService=(0,a.WQX)(c2),this.destroyRef=(0,a.WQX)(a.abz),this.atRiskPasswordCalloutService=(0,a.WQX)(xE),this.launchingCipher=(0,a.vPA)(null),this.activeUserData$=this.accountService.activeAccount$.pipe(CE(),(0,co.n)(e=>(0,$o.z)([this.taskService.pendingTasks$(e.id),this.cipherService.cipherViews$(e.id).pipe(CE(),(0,l.T)(e=>Object.fromEntries(e.map(e=>[e.id,e])))),(0,Oo.of)(e)])),(0,l.T)(([e,t,i])=>({tasks:e,ciphers:t,userId:i.id})),(0,Pp.t)({bufferSize:1,refCount:!0})),this.loading$=this.activeUserData$.pipe((0,l.T)(()=>!1),(0,sd.Z)(!0)),this.calloutDismissed$=this.activeUserData$.pipe((0,co.n)(({userId:e})=>this.atRiskPasswordPageService.isCalloutDismissed(e))),this.inlineAutofillSettingEnabled$=this.autofillSettingsService.inlineMenuVisibility$.pipe((0,l.T)(e=>e!==pa)),this.showAutofillCallout$=(0,$o.z)([this.calloutDismissed$,this.inlineAutofillSettingEnabled$]).pipe((0,l.T)(([e,t])=>!e&&!t),(0,sd.Z)(!1)),this.atRiskItems$=this.activeUserData$.pipe((0,l.T)(({tasks:e,ciphers:t})=>e.filter(e=>e.type===yE&&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,$o.z)([this.activeUserData$,this.atRiskItems$]).pipe((0,co.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(xF(n),(0,l.T)(e=>this.i18nService.t(1===t.length?"atRiskPasswordDescSingleOrg":"atRiskPasswordsDescSingleOrgPlural",null==e?void 0:e.name,t.length)))}return(0,Oo.of)(this.i18nService.t("atRiskPasswordsDescMultiOrgPlural",t.length))})),this.launchChangePassword=e=>I2(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=()=>I2(this,void 0,void 0,function*(){yield this.router.navigate(["/tabs/vault"])})}ngOnInit(){return I2(this,void 0,void 0,function*(){const{userId:e}=yield(0,ho._)(this.activeUserData$);if(!(yield(0,ho._)(this.atRiskPasswordPageService.isGettingStartedDismissed(e)))){const t=y2.open(this.dialogService);(yield(0,ho._)(t.closed))===g2&&(yield this.atRiskPasswordPageService.dismissGettingStarted(e))}this.markTaskNotificationsAsRead(),this.atRiskPasswordCalloutService.updateAtRiskPasswordState(e,{hasInteractedWithTasks:!0,tasksBannerDismissed:!1})})}markTaskNotificationsAsRead(){this.activeUserData$.pipe((0,co.n)(({tasks:e,userId:t})=>this.endUserNotificationService.unreadNotifications$(t).pipe((0,No.s)(1),(0,l.T)(t=>t.filter(t=>e.some(e=>e.id===t.taskId))),(0,yo.H)(e=>(0,rm.x)(...e.map(e=>this.endUserNotificationService.markAsRead(e.id,t)))))),(0,wl.pQ)(this.destroyRef)).subscribe()}viewCipher(e){return I2(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 I2(this,void 0,void 0,function*(){yield this.autofillSettingsService.setInlineMenuVisibility(fa),this.toastService.showToast({variant:"success",message:this.i18nService.t("turnedOnAutofill"),title:""})})}dismissCallout(){return I2(this,void 0,void 0,function*(){const{userId:e}=yield(0,ho._)(this.activeUserData$);yield this.atRiskPasswordPageService.dismissCallout(e)})}hasLoginUri(e){var t;return null===(t=e.login)||void 0===t?void 0:t.hasUris}}E2.ɵfac=function(e){return new(e||E2)},E2.ɵcmp=yl.VBU({type:E2,selectors:[["vault-at-risk-passwords"]],features:[yl.Jv_([k2,{provide:WU,useClass:qq},xE])],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&&(yl.j41(0,"popup-page",0),yl.nI1(1,"async"),yl.j41(2,"popup-header",1),yl.nI1(3,"i18n"),yl.qex(4,2),yl.nrm(5,"app-pop-out"),yl.bVm(),yl.k0s(),yl.DNE(6,C2,11,12,"bit-callout",3),yl.nI1(7,"async"),yl.DNE(8,D2,6,4,"ng-container",4),yl.nI1(9,"async"),yl.k0s()),2&e&&(yl.Y8G("loading",yl.bMT(1,5,t.loading$)),yl.R7$(2),yl.Y8G("pageTitle",yl.bMT(3,7,"atRiskPasswords"))("backAction",t.navigateToVault),yl.R7$(4),yl.Y8G("ngIf",yl.bMT(7,9,t.showAutofillCallout$)),yl.R7$(2),yl.Y8G("ngIf",yl.bMT(9,11,t.atRiskItems$)))},dependencies:[hD,yD,eD,wP,IP,FP,SP,RP,pl.MD,pl.Sq,pl.bT,qf,jb,GO,RQ,Xl,Wl,td,ed,Xu,Ku,Kc,_c,dh,fL,pl.Jj,Xf],encapsulation:2,changeDetection:0});class $2{enable(){this.disable(),this.unloadSubscription=(0,hh.R)(window,"beforeunload").subscribe(e=>{e.preventDefault();return e.returnValue="",""})}disable(){var e;null===(e=this.unloadSubscription)||void 0===e||e.unsubscribe()}}$2.ɵfac=function(e){return new(e||$2)},$2.ɵprov=a.jDH({token:$2,factory:$2.ɵfac});const O2="selected",U2="canceled";class M2{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:U2})},this.selectValue=()=>{this.dialogRef.close({action:O2,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(M2,Object.assign(Object.assign({},i),{positionStrategy:n,height:"100vh",width:"100vw"}))}}M2.ɵfac=function(e){return new(e||M2)(yl.rXU(nd.Qs),yl.rXU(Xd),yl.rXU(Pl))},M2.ɵcmp=yl.VBU({type:M2,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&&(yl.j41(0,"popup-page"),yl.nrm(1,"popup-header",0),yl.nI1(2,"i18n"),yl.j41(3,"vault-cipher-form-generator",1),yl.bIt("valueGenerated",function(e){return t.onValueGenerated(e)})("algorithmSelected",function(e){return t.onAlgorithmSelected(e)}),yl.k0s(),yl.j41(4,"popup-footer",2)(5,"button",3),yl.bIt("click",function(){return t.selectValue()}),yl.EFF(6),yl.k0s()()()),2&e&&(yl.R7$(),yl.Y8G("backAction",t.close)("pageTitle",yl.bMT(2,6,t.titleKey)),yl.R7$(2),yl.Y8G("type",t.params.type)("uri",t.uri),yl.R7$(2),yl.Y8G("disabled",!(t.selectButtonText&&t.generatedValue)),yl.R7$(),yl.SpI(" ",t.selectButtonText," "))},dependencies:[hD,yD,YJ,pl.MD,TG,Xu,Ku,Hl],encapsulation:2});var N2=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 V2{constructor(){this.dialogService=(0,a.WQX)(Jd),this.overlay=(0,a.WQX)(dl.hJ)}generatePassword(){return N2(this,void 0,void 0,function*(){const e=M2.open(this.dialogService,this.overlay,{data:{type:"password"}}),t=yield(0,ho._)(e.closed);return null==t||"canceled"===t.action?null:t.generatedValue})}generateUsername(e){return N2(this,void 0,void 0,function*(){const t=M2.open(this.dialogService,this.overlay,{data:{type:"username",uri:e}}),i=yield(0,ho._)(t.closed);return null==i||"canceled"===i.action?null:i.generatedValue})}}V2.ɵfac=function(e){return new(e||V2)},V2.ɵprov=a.jDH({token:V2,factory:V2.ɵfac});var B2=i(60545),j2=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 G2{captureTotpSecret(){return j2(this,void 0,void 0,function*(){const e=yield tl.captureVisibleTab(),t=yield(0,B2.A)(e),i=new URL(t.toString());return"otpauth:"===i.protocol&&i.searchParams.has("secret")?t.toString():null})}canCaptureTotp(e){return!rl.inPopout(e)}}G2.ɵfac=function(e){return new(e||G2)},G2.ɵprov=a.jDH({token:G2,factory:G2.ɵfac});var L2=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 z2(e,t){1&e&&yl.nrm(0,"i",5)}function _2(e,t){1&e&&yl.nrm(0,"i",6)}class K2{constructor(e,t,i,n,r,s,o,a,l,c){this.router=e,this.billingAccountProfileStateService=t,this.cipherService=i,this.organizationService=n,this.toastService=r,this.i18nService=s,this.filePopoutUtilsService=o,this.accountService=a,this.cipherFormContainer=l,this.premiumUpgradeService=c,this.accountService.activeAccount$.pipe((0,co.n)(e=>this.billingAccountProfileStateService.hasPremiumFromAnySource$(e.id)),(0,wl.pQ)()).subscribe(e=>{this.canAccessAttachments=e}),this.cipherFormContainer.formStatusChange$.pipe((0,wl.pQ)()).subscribe(e=>{this.parentFormDisabled="disabled"===e})}ngOnInit(){return L2(this,void 0,void 0,function*(){if(this.openAttachmentsInPopout=this.filePopoutUtilsService.showFilePopoutMessage(window),!this.cipherId)return;const e=yield(0,ho._)(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,ho._)(Gp(this.accountService.activeAccount$)),r=yield(0,ho._)(this.organizationService.organizations$(n).pipe(xF(i.organizationId)));this.cipherIsAPartOfFreeOrg=r.productTierType===qE.Free})}openAttachments(){return L2(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}}),this.openAttachmentsInPopout&&(yield rl.openCurrentPagePopout(window))):yield this.premiumUpgradeService.promptForPremium()})}}K2.ɵfac=function(e){return new(e||K2)(yl.rXU(ud.Ix),yl.rXU(ME),yl.rXU(Fb),yl.rXU(AF),yl.rXU(xb),yl.rXU(Pl),yl.rXU(TY),yl.rXU(Ok),yl.rXU(sN),yl.rXU(sU))},K2.ɵcmp=yl.VBU({type:K2,selectors:[["app-open-attachments"]],inputs:{cipherId:"cipherId"},decls:9,vars:6,consts:[["bit-item-content","","type","button",3,"click","disabled"],[1,"tw-flex","tw-items-center","tw-gap-2"],["slot","end"],["class","bwi bwi-popout","aria-hidden","true",4,"ngIf"],["class","bwi bwi-angle-right","aria-hidden","true",4,"ngIf"],["aria-hidden","true",1,"bwi","bwi-popout"],["aria-hidden","true",1,"bwi","bwi-angle-right"]],template:function(e,t){1&e&&(yl.j41(0,"bit-item")(1,"button",0),yl.bIt("click",function(){return t.openAttachments()}),yl.j41(2,"div",1),yl.EFF(3),yl.nI1(4,"i18n"),yl.nrm(5,"app-premium-badge"),yl.k0s(),yl.qex(6,2),yl.DNE(7,z2,1,0,"i",3)(8,_2,1,0,"i",4),yl.bVm(),yl.k0s()()),2&e&&(yl.R7$(),yl.Y8G("disabled",t.parentFormDisabled),yl.R7$(2),yl.SpI(" ",yl.bMT(4,4,"attachments")," "),yl.R7$(4),yl.Y8G("ngIf",t.openAttachmentsInPopout),yl.R7$(),yl.Y8G("ngIf",!t.openAttachmentsInPopout))},dependencies:[Kc,pl.MD,pl.bT,wP,IP,FP,qf,Xl,uU,Xf],encapsulation:2});var X2=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 q2(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"vault-cipher-form",8),yl.bIt("cipherSaved",function(t){a.eBV(e);const i=yl.XpG();return a.Njj(i.onCipherSaved(t))}),yl.nrm(1,"app-open-attachments",9),yl.k0s()}if(2&e){const e=yl.XpG(),t=yl.sdS(6);yl.Y8G("config",e.config)("beforeSubmit",e.checkFido2UserVerification)("submitBtn",t),yl.R7$(),yl.Y8G("cipherId",e.originalCipherId)}}function Y2(e,t){if(1&e&&(yl.nrm(0,"button",10),yl.nI1(1,"i18n")),2&e){const e=yl.XpG();yl.Y8G("bitAction",e.delete)("label",yl.bMT(1,2,"delete"))}}class W2{constructor(e){this.cipherId=e.cipherId,this.type=(e=>{if(PR(e))return e;if("string"==typeof e){const t=parseInt(e,10);if(PR(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}}class H2{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 inFido2PopoutWindow(){return rl.inPopout(window)&&this.fido2PopoutSessionData.isFido2Session}get inSingleActionPopout(){return rl.inSingleActionPopout(window,lJ)}constructor(e,t,i,n,r,s,o,a,l,c,u,d,h){this.route=e,this.i18nService=t,this.addEditFormConfigService=i,this.popupCloseWarningService=n,this.popupRouterCacheService=r,this.router=s,this.cipherService=o,this.eventCollectionService=a,this.logService=l,this.toastService=c,this.dialogService=u,this.cipherAuthorizationService=d,this.accountService=h,this.fido2PopoutSessionData$=IJ(),this.checkFido2UserVerification=()=>X2(this,void 0,void 0,function*(){return this.inFido2PopoutWindow,!0}),this.handleBackButton=()=>X2(this,void 0,void 0,function*(){if(this.inFido2PopoutWindow)return this.popupCloseWarningService.disable(),void yJ.abortPopout(this.fido2PopoutSessionData.sessionId);this.inSingleActionPopout?yield rl.closeSingleActionPopout(lJ):yield this.popupRouterCacheService.back()}),this.delete=()=>X2(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,ho._)(this.accountService.activeAccount$.pipe(Gp));yield this.deleteCipher(e)}catch(e){return this.logService.error(e),!1}return yield this.router.navigate(["/tabs/vault"]),this.toastService.showToast({variant:"success",title:null,message:this.i18nService.t("deletedItem")}),!0}),this.subscribeToParams()}ngOnInit(){return X2(this,void 0,void 0,function*(){this.fido2PopoutSessionData=yield(0,ho._)(this.fido2PopoutSessionData$),rl.inPopout(window)&&this.popupCloseWarningService.enable(),this.messageListener=e=>X2(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)}}),tl.addListener(chrome.runtime.onMessage,this.messageListener)})}ngOnDestroy(){this.messageListener&&tl.removeListener(chrome.runtime.onMessage,this.messageListener)}reloadCipherData(){return X2(this,void 0,void 0,function*(){if(!this.config)return;const e=yield(0,ho._)(this.accountService.activeAccount$.pipe(Gp)),t=yield(0,ho._)(this.cipherService.addEditCipherInfo$(e));null!=t&&(this.config=Object.assign(Object.assign({},this.config),{initialValues:J2(t)}),yield this.cipherService.setAddEditCipherInfo(null,e))})}onCipherSaved(e){return X2(this,void 0,void 0,function*(){rl.inPopout(window)&&this.popupCloseWarningService.disable(),this.inFido2PopoutWindow?yJ.confirmNewCredentialResponse(this.fido2PopoutSessionData.sessionId,e.id,this.fido2PopoutSessionData.userVerification):this.inSingleActionPopout?yield rl.closeSingleActionPopout(lJ,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 tl.sendMessage("addEditCipherSubmitted"))})}subscribeToParams(){this.route.queryParams.pipe((0,wl.pQ)(),(0,l.T)(e=>new W2(e)),(0,co.n)(e=>X2(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,ho._)(this.accountService.activeAccount$.pipe(Gp)),s=yield(0,ho._)(this.cipherService.addEditCipherInfo$(r));return null!=s&&(n.initialValues=Object.assign(Object.assign({},n.initialValues),J2(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(Ra.Cipher_ClientViewed,n.originalCipher.id,!1,n.originalCipher.organizationId)),n}))).subscribe(e=>{this.config=e,this.headerText=this.setHeader(e.mode,e.cipherType)})}setInitialValuesFromParams(e){return X2(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 tl.getTabFromCurrentWindow();t.loginUri=e.url,t.name=kd.getHostname(e.url)}return t})}setHeader(e,t){const i="edit"===e||"partial-edit"===e,n={[CR.Login]:i?"editItemHeaderLogin":"newItemHeaderLogin",[CR.Card]:i?"editItemHeaderCard":"newItemHeaderCard",[CR.Identity]:i?"editItemHeaderIdentity":"newItemHeaderIdentity",[CR.SecureNote]:i?"editItemHeaderNote":"newItemHeaderNote",[CR.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)}}H2.ɵfac=function(e){return new(e||H2)(yl.rXU(ud.nX),yl.rXU(Pl),yl.rXU(tB),yl.rXU($2),yl.rXU(aD),yl.rXU(ud.Ix),yl.rXU(Fb),yl.rXU(OE),yl.rXU(za),yl.rXU(xb),yl.rXU(Jd),yl.rXU(t$),yl.rXU(Ok))},H2.ɵcmp=yl.VBU({type:H2,selectors:[["app-add-edit-v2"]],features:[yl.Jv_([{provide:tB,useClass:nB},{provide:pV,useClass:G2},{provide:nN,useClass:V2},{provide:sU,useClass:t1}])],decls:14,vars:12,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"],["slot","end","type","button","buttonType","danger","bitIconButton","bwi-trash",3,"bitAction","label",4,"ngIf"],["formId","cipherForm",3,"cipherSaved","config","beforeSubmit","submitBtn"],["slot","attachment-button",3,"cipherId"],["slot","end","type","button","buttonType","danger","bitIconButton","bwi-trash",3,"bitAction","label"]],template:function(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"popup-page")(1,"popup-header",1),yl.nrm(2,"app-pop-out",2),yl.k0s(),yl.DNE(3,q2,2,4,"vault-cipher-form",3),yl.j41(4,"popup-footer",4)(5,"button",5,0),yl.EFF(7),yl.nI1(8,"i18n"),yl.k0s(),yl.j41(9,"button",6),yl.bIt("click",function(){return a.eBV(e),a.Njj(t.handleBackButton())}),yl.EFF(10),yl.nI1(11,"i18n"),yl.k0s(),yl.DNE(12,Y2,2,4,"button",7),yl.nI1(13,"async"),yl.k0s()()}2&e&&(yl.R7$(),yl.Y8G("pageTitle",t.headerText)("backAction",t.handleBackButton),yl.R7$(2),yl.Y8G("ngIf",!t.loading),yl.R7$(4),yl.SpI(" ",yl.bMT(8,6,"save")," "),yl.R7$(3),yl.SpI(" ",yl.bMT(11,8,"cancel")," "),yl.R7$(2),yl.Y8G("ngIf",yl.bMT(13,10,t.canDeleteCipher$)))},dependencies:[pl.MD,pl.bT,v$,qf,fl.YN,Xu,Ku,K2,hD,yD,YJ,eB,WV,rc,Rd,eD,_l,zl,pl.Jj,Xf],encapsulation:2});const J2=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===CR.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===CR.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===CR.Identity&&null!=(null===(t=n.identity)||void 0===t?void 0:t.username)&&(i.username=n.identity.username),n.type==CR.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 Z2=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 Q2(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"assign-collections",7),yl.bIt("onCollectionAssign",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.navigateBack())}),yl.k0s()}if(2&e){const e=yl.XpG(),t=yl.sdS(9);yl.Y8G("params",e.params)("submitBtn",t)}}class e3{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,To.p)(e=>null!=e),(0,co.n)(e=>r.queryParams.pipe((0,co.n)(t=>Z2(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(Gp,(0,co.n)(e=>this.collectionService.decryptedCollections$(e)));(0,$o.z)([s,o]).pipe((0,wl.pQ)(),(0,Yv.$)()).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()}}e3.ɵfac=function(e){return new(e||e3)(yl.rXU(sF.aZ),yl.rXU(BF),yl.rXU(Fb),yl.rXU(Ok),yl.rXU(ud.nX))},e3.ɵcmp=yl.VBU({type:e3,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=yl.RV6();yl.j41(0,"popup-page")(1,"popup-header",1),yl.nI1(2,"i18n"),yl.qex(3,2),yl.nrm(4,"app-pop-out"),yl.bVm(),yl.k0s(),yl.j41(5,"bit-card"),yl.DNE(6,Q2,1,2,"assign-collections",3),yl.k0s(),yl.j41(7,"popup-footer",4)(8,"button",5,0),yl.EFF(10),yl.nI1(11,"i18n"),yl.k0s(),yl.j41(12,"a",6),yl.bIt("click",function(){return a.eBV(e),a.Njj(t.navigateBack())}),yl.EFF(13),yl.nI1(14,"i18n"),yl.k0s()()()}2&e&&(yl.R7$(),yl.Y8G("pageTitle",yl.bMT(2,4,"assignToCollections")),yl.R7$(5),yl.Y8G("ngIf",t.params),yl.R7$(4),yl.SpI(" ",yl.bMT(11,6,"assign")," "),yl.R7$(3),yl.SpI(" ",yl.bMT(14,8,"cancel")," "))},dependencies:[rc,Xu,Ku,pl.MD,pl.bT,qf,Bu,Eu,UG,WR,fl.X1,hD,yD,YJ,eD,Xf],encapsulation:2});var t3=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 i3(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"app-cipher-attachments",7),yl.bIt("onUploadSuccess",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.navigateBack())}),yl.k0s()}if(2&e){const e=yl.XpG(),t=yl.sdS(7);yl.Y8G("cipherId",e.cipherId)("submitBtn",t)}}class n3{constructor(e,t){this.popupRouterCacheService=e,this.attachmentFormId=ZM.attachmentFormID,t.queryParams.pipe((0,wl.pQ)(),(0,Yv.$)()).subscribe(({cipherId:e})=>{this.cipherId=e})}navigateBack(){return t3(this,void 0,void 0,function*(){yield this.popupRouterCacheService.back(!0)})}}n3.ɵfac=function(e){return new(e||n3)(yl.rXU(aD),yl.rXU(ud.nX))},n3.ɵcmp=yl.VBU({type:n3,selectors:[["app-attachments-v2"]],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=yl.RV6();yl.j41(0,"popup-page")(1,"popup-header",1),yl.nI1(2,"i18n"),yl.nrm(3,"app-pop-out",2),yl.k0s(),yl.DNE(4,i3,1,2,"app-cipher-attachments",3),yl.j41(5,"popup-footer",4)(6,"button",5,0),yl.EFF(8),yl.nI1(9,"i18n"),yl.k0s(),yl.j41(10,"button",6),yl.bIt("click",function(){return a.eBV(e),a.Njj(t.navigateBack())}),yl.EFF(11),yl.nI1(12,"i18n"),yl.k0s()()()}2&e&&(yl.R7$(),yl.Y8G("pageTitle",yl.bMT(2,5,"attachments")),yl.R7$(3),yl.Y8G("ngIf",t.cipherId),yl.R7$(2),yl.BMQ("form",t.attachmentFormId),yl.R7$(2),yl.SpI(" ",yl.bMT(9,7,"upload")," "),yl.R7$(3),yl.SpI(" ",yl.bMT(12,9,"cancel")," "))},dependencies:[pl.MD,pl.bT,Xu,Ku,qf,ZM,hD,yD,YJ,eD,Xf],encapsulation:2});const r3=lw` `,s3=lw` `;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())})};const a3=new m(Me,"introCarouselDismissed",{deserializer:e=>e});class l3{constructor(e){this.stateProvider=e,this.introCarouselState=this.stateProvider.getGlobal(a3),this.introCarouselState$=this.introCarouselState.state$.pipe((0,l.T)(e=>null!=e&&e))}setIntroCarouselDismissed(){return o3(this,void 0,void 0,function*(){yield this.introCarouselState.update(()=>!0)})}}l3.ɵfac=function(e){return new(e||l3)(a.KVO(u))},l3.ɵprov=a.jDH({token:l3,factory:l3.ɵfac,providedIn:"root"});var c3=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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,t){this.router=e,this.introCarouselService=t,this.itemTypes=r3,this.loginCards=s3,this.noCredentials=uj,this.secureDevices=xW}navigateToSignup(){return c3(this,void 0,void 0,function*(){yield this.introCarouselService.setIntroCarouselDismissed(),yield this.router.navigate(["/signup"])})}navigateToLogin(){return c3(this,void 0,void 0,function*(){yield this.introCarouselService.setIntroCarouselDismissed(),yield this.router.navigate(["/login"])})}}u3.ɵfac=function(e){return new(e||u3)(yl.rXU(ud.Ix),yl.rXU(l3))},u3.ɵcmp=yl.VBU({type:u3,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,"icon"],["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&&(yl.j41(0,"vault-carousel",0),yl.nI1(1,"i18n"),yl.j41(2,"vault-carousel-slide",1),yl.nI1(3,"i18n"),yl.j41(4,"div",2)(5,"div",3),yl.nrm(6,"bit-icon",4),yl.k0s(),yl.j41(7,"h2",5),yl.EFF(8),yl.nI1(9,"i18n"),yl.k0s(),yl.j41(10,"p",6),yl.EFF(11),yl.nI1(12,"i18n"),yl.k0s()()(),yl.j41(13,"vault-carousel-slide",1),yl.nI1(14,"i18n"),yl.j41(15,"div",2)(16,"div",3),yl.nrm(17,"bit-icon",4),yl.k0s(),yl.j41(18,"h2",5),yl.EFF(19),yl.nI1(20,"i18n"),yl.k0s(),yl.j41(21,"p",6),yl.EFF(22),yl.nI1(23,"i18n"),yl.k0s()()(),yl.j41(24,"vault-carousel-slide",1),yl.nI1(25,"i18n"),yl.j41(26,"div",2)(27,"div",3),yl.nrm(28,"bit-icon",4),yl.k0s(),yl.j41(29,"h2",5),yl.EFF(30),yl.nI1(31,"i18n"),yl.k0s(),yl.j41(32,"p",6),yl.EFF(33),yl.nI1(34,"i18n"),yl.k0s()()(),yl.j41(35,"vault-carousel-slide",1),yl.nI1(36,"i18n"),yl.j41(37,"div",2)(38,"div",3),yl.nrm(39,"bit-icon",4),yl.k0s(),yl.j41(40,"h2",5),yl.EFF(41),yl.nI1(42,"i18n"),yl.k0s(),yl.j41(43,"p",6),yl.EFF(44),yl.nI1(45,"i18n"),yl.k0s()()()(),yl.j41(46,"button",7),yl.bIt("click",function(){return t.navigateToSignup()}),yl.EFF(47),yl.nI1(48,"i18n"),yl.k0s(),yl.j41(49,"button",8),yl.bIt("click",function(){return t.navigateToLogin()}),yl.EFF(50),yl.nI1(51,"i18n"),yl.k0s()),2&e&&(yl.Y8G("label",yl.bMT(1,23,"introCarouselLabel")),yl.R7$(2),yl.Y8G("label",yl.bMT(3,25,"securityPrioritized"))("disablePadding",!0),yl.R7$(4),yl.Y8G("icon",t.itemTypes),yl.R7$(2),yl.JRh(yl.bMT(9,27,"securityPrioritized")),yl.R7$(3),yl.JRh(yl.bMT(12,29,"securityPrioritizedBody")),yl.R7$(2),yl.Y8G("label",yl.bMT(14,31,"quickLogin"))("disablePadding",!0),yl.R7$(4),yl.Y8G("icon",t.loginCards),yl.R7$(2),yl.JRh(yl.bMT(20,33,"quickLogin")),yl.R7$(3),yl.JRh(yl.bMT(23,35,"quickLoginBody")),yl.R7$(2),yl.Y8G("label",yl.bMT(25,37,"secureUser"))("disablePadding",!0),yl.R7$(4),yl.Y8G("icon",t.noCredentials),yl.R7$(2),yl.JRh(yl.bMT(31,39,"secureUser")),yl.R7$(3),yl.JRh(yl.bMT(34,41,"secureUserBody")),yl.R7$(2),yl.Y8G("label",yl.bMT(36,43,"secureDevices"))("disablePadding",!0),yl.R7$(4),yl.Y8G("icon",t.secureDevices),yl.R7$(2),yl.JRh(yl.bMT(42,45,"secureDevices")),yl.R7$(3),yl.JRh(yl.bMT(45,47,"secureDevicesBody")),yl.R7$(3),yl.SpI(" ",yl.bMT(48,49,"createAccount"),"\n"),yl.R7$(3),yl.SpI(" ",yl.bMT(51,51,"logIn"),"\n"))},dependencies:[fL,pL,ZG,Xu,Ku,$h,SC,dh,Xl,Wl,qf,Hl],encapsulation:2});var d3=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 h3(e,t){if(1&e&&yl.nrm(0,"vault-password-history-view",4),2&e){const e=yl.XpG();yl.Y8G("cipher",e.cipher)}}class p3{constructor(e,t,i,n){this.browserRouterHistory=e,this.route=t,this.cipherService=i,this.accountService=n}ngOnInit(){this.route.queryParams.pipe((0,Yv.$)()).subscribe(e=>{e.cipherId?this.loadCipher(e.cipherId):this.close()})}close(){this.browserRouterHistory.back()}loadCipher(e){return d3(this,void 0,void 0,function*(){const t=yield(0,ho._)(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)})}}p3.ɵfac=function(e){return new(e||p3)(yl.rXU(aD),yl.rXU(ud.nX),yl.rXU(Fb),yl.rXU(Ok))},p3.ɵcmp=yl.VBU({type:p3,selectors:[["vault-password-history-v2"]],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&&(yl.j41(0,"popup-page",0)(1,"popup-header",1),yl.nI1(2,"i18n"),yl.qex(3,2),yl.nrm(4,"app-pop-out"),yl.bVm(),yl.k0s(),yl.DNE(5,h3,1,1,"vault-password-history-view",3),yl.k0s()),2&e&&(yl.Y8G("loading",!t.cipher),yl.R7$(),yl.Y8G("pageTitle",yl.mNQ(yl.bMT(2,4,"passwordHistory"))),yl.R7$(4),yl.Y8G("ngIf",t.cipher))},dependencies:[qf,hD,eD,yD,BG,pl.bT,Xf],encapsulation:2});const f3=lw` `;var v3=i(44111),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())})};class g3{constructor(){this.globalStateProvider=(0,a.WQX)(d),this.messageSender=(0,a.WQX)(ek),this.router=(0,a.WQX)(ud.Ix)}get cache(){if(!this._cache)throw new Error("Dirty View Cache not initialized");return this._cache}init(){return m3(this,void 0,void 0,function*(){const e=yield(0,ho._)(this.globalStateProvider.get(iD).state$);this._cache=Object.freeze(null!=e?e:{}),this.router.events.pipe((0,To.p)(e=>e instanceof ud.wF),(0,jg.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,bl.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,wl.pQ)(null==i?void 0:i.get(a.abz))).subscribe(()=>{n.set(t.getRawValue())}),t}updateState(e,t,i){this.messageSender.send(rD,{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(sD,{routeChange:e})}}g3.ɵfac=function(e){return new(e||g3)},g3.ɵprov=a.jDH({token:g3,factory:g3.ɵfac,providedIn:"root"});var y3=i(38382),b3=i(50203);const w3="collectPageDetails",S3="collectPageDetailsFromTabObservable",k3=new tk("collectPageDetailsResponse");class I3{}const C3="autofill-injected-script-port";var T3=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 P3(e){return T3(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 F3{}F3.EmailFieldNames=["email","email address","e-mail","e-mail address","email adresse","e-mail adresse"],F3.UsernameFieldNames=["username","user name","userid","user id","customer id","login id","login","benutzername","benutzer name","benutzerid","benutzer id",...F3.EmailFieldNames],F3.TotpFieldNames=["totp","totpcode","2facode","approvals_code","mfacode","otc-code","onetimecode","otp-code","otpcode","onetimepassword","security_code","second-factor","twofactor","twofa","twofactorcode","verificationcode","verification code"],F3.RecoveryCodeFieldNames=["backup","recovery"],F3.AmbiguousTotpFieldNames=["code","pin","otc","otp","2fa","mfa"],F3.SearchFieldNames=["search","query","find","go"],F3.NewEmailFieldKeywords=["new-email","newemail","new email","neue e-mail"],F3.RegistrationKeywords=["register","signup","sign-up","join","create"],F3.NewsletterFormNames=["newsletter"],F3.FieldIgnoreList=["captcha","findanything","forgot"],F3.PasswordFieldExcludeList=["hint",...F3.FieldIgnoreList,...F3.TotpFieldNames],F3.ExcludedAutofillLoginTypes=["hidden","file","button","image","reset","search"],F3.ExcludedAutofillTypes=["radio","checkbox",...F3.ExcludedAutofillLoginTypes],F3.ExcludedInlineMenuTypes=["textarea",...F3.ExcludedAutofillTypes],F3.ExcludedIdentityAutocompleteTypes=new Set(["current-password","new-password"]);class R3{}R3.CardAttributes=["autoCompleteType","data-stripe","htmlName","htmlID","title","label-tag","placeholder","label-left","label-top","data-recurly"],R3.CardAttributesExtended=[...R3.CardAttributes,"label-right"],R3.CardHolderFieldNames=["accountholdername","cc-name","card-name","cardholder-name","cardholder","name","nom"],R3.CardHolderFieldNameValues=["accountholdername","cc-name","card-name","cardholder-name","cardholder","tbName"],R3.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"],R3.CardNumberFieldNameValues=["cc-number","cc-num","card-number","card-num","cc-no","card-no","numero-carte","num-carte","cb-num"],R3.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"],R3.CardExpiryFieldNameValues=["mm-yy","mm-yyyy","yy-mm","yyyy-mm","expiration-date","payment-card-expiration"],R3.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"],R3.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"],R3.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"],R3.CardBrandFieldNames=["cc-type","card-type","card-brand","cc-brand","cb-type"],R3.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"}],R3.MonthAbbr=["mm","mm","mm","mm","мм","mm"],R3.YearAbbrShort=["yy","åå","jj","aa","гг","rr"],R3.YearAbbrLong=["yyyy","åååå","jjjj","aa","гггг","rrrr"];class x3{}x3.IdentityAttributes=["autoCompleteType","data-stripe","htmlName","htmlID","label-tag","placeholder","label-left","label-top","data-recurly","accountCreationFieldType"],x3.FullNameFieldNames=["name","full-name","your-name"],x3.FullNameFieldNameValues=["full-name","your-name"],x3.TitleFieldNames=["honorific-prefix","prefix","title","anrede"],x3.FirstnameFieldNames=["f-name","first-name","given-name","first-n","vorname"],x3.MiddlenameFieldNames=["m-name","middle-name","additional-name","middle-initial","middle-n","middle-i"],x3.LastnameFieldNames=["l-name","last-name","s-name","surname","family-name","family-n","last-n","nachname","familienname"],x3.EmailFieldNames=["e-mail","email-address"],x3.AddressFieldNames=["address","street-address","addr","street","mailing-addr","billing-addr","mail-addr","bill-addr","strasse","adresse"],x3.AddressFieldNameValues=["mailing-addr","billing-addr","mail-addr","bill-addr"],x3.Address1FieldNames=["address-1","address-line-1","addr-1","street-1"],x3.Address2FieldNames=["address-2","address-line-2","addr-2","street-2","address-ext"],x3.Address3FieldNames=["address-3","address-line-3","addr-3","street-3"],x3.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"],x3.CityFieldNames=["city","town","address-level-2","address-city","address-town","ort","stadt","wohnort"],x3.StateFieldNames=["state","province","provence","address-level-1","address-state","address-province","bundesland"],x3.CountryFieldNames=["country","country-code","country-name","address-country","address-country-name","address-country-code","land"],x3.PhoneFieldNames=["phone","mobile","mobile-phone","tel","telephone","phone-number","telefon","telefonnummer","mobil","handy"],x3.UserNameFieldNames=["user-name","user-id","screen-name"],x3.CompanyFieldNames=["company","company-name","organization","organization-name","firma"],x3.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"},x3.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"},x3.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 A3=["login","signin","submit","continue","next","verify"],D3=["change","save","savepassword","updatepassword","changepassword","resetpassword"],E3=6,$3=7;class O3{constructor(){this.script=[],this.properties={}}}var U3=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 M3{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=dJ,this.currentlyOpeningPasswordRepromptPopout=!1,this.autofillScriptPortsSet=new Set,this.handleInjectedScriptPortConnection=e=>{e.name===C3&&(this.autofillScriptPortsSet.add(e),e.onDisconnect.addListener(this.handleInjectScriptPortOnDisconnect))},this.handleInjectScriptPortOnDisconnect=e=>{e.name===C3&&this.autofillScriptPortsSet.delete(e)}}collectPageDetailsFromTab$(e){const t=new So.m(1),i=this.messageListener.messages$(k3).pipe((0,To.p)(t=>t.tab.id===e.id&&t.sender===S3),(0,om.S)((e,t)=>[...e,{frameId:t.webExtSender.frameId,tab:t.tab,details:t.details}],[]));tl.tabSendMessage(e,{tab:e,command:w3,sender:S3},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,wo.u)()),s=(0,ko.O)(1e3).pipe((0,l.T)(()=>[]),(0,Jv.Q)(r));return(0,bo.h)(r,t,s)}loadAutofillScriptsOnInstall(){return U3(this,void 0,void 0,function*(){tl.addListener(chrome.runtime.onConnect,this.handleInjectedScriptPortConnection),this.injectAutofillScriptsInAllTabs(),this.autofillSettingsService.inlineMenuVisibility$.pipe((0,sd.Z)(void 0),(0,Qv.J)()).subscribe(([e,t])=>this.handleInlineMenuVisibilitySettingsChange(e,t)),this.autofillSettingsService.showInlineMenuCards$.pipe((0,sd.Z)(void 0),(0,Qv.J)()).subscribe(([e,t])=>this.handleInlineMenuVisibilitySettingsChange(e,t)),this.autofillSettingsService.showInlineMenuIdentities$.pipe((0,sd.Z)(void 0),(0,Qv.J)()).subscribe(([e,t])=>this.handleInlineMenuVisibilitySettingsChange(e,t))})}reloadAutofillScripts(){return U3(this,void 0,void 0,function*(){this.autofillScriptPortsSet.forEach(e=>{e.disconnect(),this.autofillScriptPortsSet.delete(e)}),this.injectAutofillScriptsInAllTabs()})}injectAutofillScripts(e){return U3(this,arguments,void 0,function*(e,t=0,i=!0){const n=yield(0,ho._)(this.accountService.activeAccount$),r=(yield(0,ho._)(this.authService.activeAccountStatus$))===cd.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 U3(this,void 0,void 0,function*(){let t=pa;e&&(t=yield this.getInlineMenuVisibility());const i=yield(0,ho._)(this.userNotificationSettingsService.enableChangedPasswordPrompt$),n=yield(0,ho._)(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=M3.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 U3(this,void 0,void 0,function*(){return yield(0,ho._)(this.autofillSettingsService.inlineMenuVisibility$)})}getShouldAutoCopyTotp(){return U3(this,void 0,void 0,function*(){return yield(0,ho._)(this.autofillSettingsService.autoCopyTotp$)})}getAutofillOnPageLoad(){return U3(this,void 0,void 0,function*(){return yield(0,ho._)(this.autofillSettingsService.autofillOnPageLoad$)})}getDefaultUriMatchStrategy(){return U3(this,void 0,void 0,function*(){return yield(0,ho._)(this.domainSettingsService.resolvedDefaultUriMatchStrategy$)})}doAutoFill(e){return U3(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,ho._)(this.accountService.activeAccount$),r=yield(0,ho._)(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=>U3(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)),tl.tabSendMessage(t,{command:e.autoSubmitLogin?"triggerAutoSubmitLogin":"fillForm",fillScript:c,url:t.url,pageDetailsUrl:a.details.url},{frameId:a.frameId}),e.cipher.type!==CR.Login||null!==i||!e.cipher.login.totp||!r&&!e.cipher.organizationUseTotp)return;const u=yield this.getShouldAutoCopyTotp();i=u?(yield(0,ho._)(this.totpService.getCode$(e.cipher.login.totp))).code:null}))),o)return yield this.eventCollectionService.collect(Ra.Cipher_ClientAutofilled,e.cipher.id),null!==i?i:null;throw new Error("Did not autofill.")})}doAutoFillOnTab(e,t,i){return U3(this,arguments,void 0,function*(e,t,i,n=!1){var r,s;let o;const a=yield(0,ho._)(this.accountService.activeAccount$.pipe(Lp));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===kR.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 U3(this,void 0,void 0,function*(){const n=yield this.userVerificationService.hasMasterPasswordAndMasterKeyHash();return!(e.reprompt!==kR.Password||!n)&&(this.isDebouncingPasswordRepromptPopout()||(yield this.openVaultItemPasswordRepromptPopout(t,{cipherId:e.id,action:null!=i?i:"autofill"})),!0)})}doAutoFillActiveTab(e,t,i){return U3(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===CR.Login)return yield this.doAutoFillOnTab(e,o,t);let a,l="";const c=yield(0,ho._)(this.accountService.activeAccount$.pipe(Lp));if(null==c)return null;if(i===CR.Card?(l="cardCiphers",a=yield this.cipherService.getNextCardCipher(c)):(l="identityCiphers",a=yield this.cipherService.getNextIdentityCipher(c)),!a||!l||a.reprompt===kR.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 U3(this,void 0,void 0,function*(){(yield(0,ho._)(this.autofillSettingsService.activateAutofillOnPageLoadFromPolicy$))&&(yield this.autofillSettingsService.setAutofillOnPageLoad(!0))})}getActiveTab(){return U3(this,void 0,void 0,function*(){const e=yield tl.getTabFromCurrentWindow();if(!e)throw new Error("No tab found.");return e})}generateFillScript(e,t){return U3(this,void 0,void 0,function*(){if(!e||!t.cipher)return null;let i=new O3;const n={},r=t.cipher.fields;if(r&&r.length){const s=[];r.forEach(e=>{M3.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(M3.isSearchField(e))return;const o=this.findMatchingFieldIndex(e,s);if(o>-1){const s=r[o];let a;s.type===FR.Linked?a=t.cipher.linkedFieldValue(s.linkedId):(a=s.value,null==a&&s.type===FR.Boolean&&(a="false")),n[e.opid]=e,M3.fillByOpid(i,e,a)}})}switch(t.cipher.type){case CR.Login:i=yield this.generateLoginFillScript(i,e,n,t);break;case CR.Card:i=yield this.generateCardFillScript(i,e,n,t);break;case CR.Identity:i=yield this.generateIdentityFillScript(i,e,n,t);break;default:return null}return i})}generateLoginFillScript(e,t,i,n){return U3(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!=ZD.Never).map(e=>e.uri))&&void 0!==s?s:[],e.untrustedIframe=yield this.inUntrustedIframe(t.url,n);const p=M3.loadPasswordFields(t,!1,!1,n.onlyEmptyFields,n.fillNewPassword),f=[],v=[];p.forEach(e=>{this.isRegistrationPasswordField(t,e)?v.push(e):f.push(e)});const m=f.length>0?f:v,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)&&(M3.fieldIsFuzzyMatch(g,[...F3.TotpFieldNames,...F3.AmbiguousTotpFieldNames])||"one-time-code"===g.autoCompleteType)&&!M3.fieldIsFuzzyMatch(g,[...F3.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,M3.fillByOpid(e,w,h.username),n.autoSubmitLogin&&w.form&&(e.autosubmit=[w.form]),M3.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===E3,i=n.inlineMenuFillType===$3;if((e||i)&&g){const e=g.form;[...f,...v].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)&&(M3.fieldIsFuzzyMatch(e,[...F3.TotpFieldNames,...F3.AmbiguousTotpFieldNames])||"one-time-code"===e.autoCompleteType)&&!M3.fieldIsFuzzyMatch(e,[...F3.RecoveryCodeFieldNames]),i=!n.skipUsernameOnlyFill&&["email","tel","text"].some(t=>t===e.type)&&M3.fieldIsFuzzyMatch(e,F3.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,M3.fillByOpid(e,t,h.username),I.add(t.form))}),o.forEach(t=>{i.hasOwnProperty(t.opid)||(i[t.opid]=t,M3.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)=>U3(this,void 0,void 0,function*(){if(Object.prototype.hasOwnProperty.call(i,t.opid))return;i[t.opid]=t;let r=(yield(0,ho._)(this.totpService.getCode$(h.totp))).code;r.length==l.length&&(r=r.charAt(n)),M3.fillByOpid(e,t,r)})))),e=M3.setFillScriptForFocus(i,e)})}generateCardFillScript(e,t,i,n){return U3(this,void 0,void 0,function*(){if(!n.cipher.card)return null;const r={};t.fields.forEach(e=>{if(!M3.isExcludedFieldType(e,F3.ExcludedAutofillTypes))for(let t=0;t1&&(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,M3.fillByOpid(e,r.expMonth,t)}if(r.expYear&&M3.hasValue(s.expYear)){let t=s.expYear;if(r.expYear.selectInfo&&r.expYear.selectInfo.options)for(let e=0;e-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=a$(t)):(this.fieldAttrsContain(r.expYear,"yy")||2===r.expYear.maxLength)&&4===t.length&&(t=t.substr(2));i[r.expYear.opid]=r.expYear,M3.fillByOpid(e,r.expYear,t)}if(r.exp&&M3.hasValue(s.expMonth)&&M3.hasValue(s.expYear)){const t=this.generateCombinedExpiryValue(s,r.exp);this.makeScriptActionWithValue(e,t,r.exp,i)}return e})}inUntrustedIframe(e,t){return U3(this,void 0,void 0,function*(){if(e===t.tabUrl)return!1;const i=yield(0,ho._)(this.domainSettingsService.getUrlEquivalentDomains(e));return!t.cipher.login.matchesUri(e,i,t.defaultUriMatch)})}fieldAttrsContain(e,t){if(!e)return!1;let i=!1;return R3.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="\\"+ta.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="\\"+ta.join("\\");return R3.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 R3.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;nM3.isFieldMatch(e,x3.FullNameFieldNames,x3.FullNameFieldNameValues))}shouldMakeIdentityFirstNameFillScript(e,t){return!e.firstName&&M3.isFieldMatch(t,x3.FirstnameFieldNames)}shouldMakeIdentityMiddleNameFillScript(e,t){return!e.middleName&&M3.isFieldMatch(t,x3.MiddlenameFieldNames)}shouldMakeIdentityLastNameFillScript(e,t){return!e.lastName&&M3.isFieldMatch(t,x3.LastnameFieldNames)}shouldMakeIdentityEmailFillScript(e,t){return!e.email&&M3.isFieldMatch(t,x3.EmailFieldNames)}shouldMakeIdentityAddressFillScript(e,t){return!e.address&&t.some(e=>M3.isFieldMatch(e,x3.AddressFieldNames,x3.AddressFieldNameValues))}shouldMakeIdentityAddress1FillScript(e,t){return!e.address1&&M3.isFieldMatch(t,x3.Address1FieldNames)}shouldMakeIdentityAddress2FillScript(e,t){return!e.address2&&M3.isFieldMatch(t,x3.Address2FieldNames)}shouldMakeIdentityAddress3FillScript(e,t){return!e.address3&&M3.isFieldMatch(t,x3.Address3FieldNames)}shouldMakeIdentityPostalCodeFillScript(e,t){return!e.postalCode&&M3.isFieldMatch(t,x3.PostalCodeFieldNames)}shouldMakeIdentityCityFillScript(e,t){return!e.city&&M3.isFieldMatch(t,x3.CityFieldNames)}shouldMakeIdentityStateFillScript(e,t){return!e.state&&M3.isFieldMatch(t,x3.StateFieldNames)}shouldMakeIdentityCountryFillScript(e,t){return!e.country&&M3.isFieldMatch(t,x3.CountryFieldNames)}shouldMakeIdentityPhoneFillScript(e,t){return!e.phone&&M3.isFieldMatch(t,x3.PhoneFieldNames)}shouldMakeIdentityUserNameFillScript(e,t){return!e.username&&M3.isFieldMatch(t,x3.UserNameFieldNames)}shouldMakeIdentityCompanyFillScript(e,t){return!e.company&&M3.isFieldMatch(t,x3.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=x3.IsoStates[r]||x3.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=x3.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-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(M3.hasValue(t)&&i)if("select-one"===i.type&&i.selectInfo&&i.selectInfo.options)for(let e=0;e1&&(t=n[1]);break}if(r)break}else r=!0;r&&(n[i.opid]=i,M3.fillByOpid(e,i,t))}static valueIsLikePassword(e){if(null==e)return!1;const t=e.toLowerCase().replace(/[\s_-]/g,"");return!(t.indexOf("password")<0)&&!F3.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;er.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&&M3.isExcludedFieldType(e,F3.ExcludedAutofillLoginTypes))return;if(M3.fieldHasDisqualifyingAttributeValue(e))return;if(M3.fieldIsFuzzyMatch(e,F3.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;eF3.RegistrationKeywords.some(t=>e.includes(t)))}findUsernameField(e,t,i,n,r){let s=null,o=null;for(let a=0;a=t.elementNumber)break;const c=this.findMatchingFieldIndex(l,F3.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-1||"one-time-code"===a.autoCompleteType))break}return s}findMatchingFieldIndex(e,t){for(let i=0;i-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(!M3.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-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 U3(this,void 0,void 0,function*(){var e;const t=yield tl.tabsQuery({});for(let i=0;ithis.injectAutofillScripts(n,e.frameId,!1))}}})}handleInlineMenuVisibilitySettingsChange(e,t){return U3(this,void 0,void 0,function*(){if(null==e||e===t)return;("boolean"==typeof e||"boolean"==typeof t||e===pa||t===pa)&&(yield this.reloadAutofillScripts())})}}M3.searchFieldNamesSet=new Set(F3.SearchFieldNames);var N3=M3;class V3{isExplicitIdentityEmailField(e){const t=[e.type,e.htmlName,e.htmlID,e.placeholder];for(let e=0;e!!this.fieldContainsAutocompleteValues(e,this.creditCardNameAutocompleteValues)||this.keywordsFoundInFieldData(e,R3.CardHolderFieldNames,!1),this.isFieldForCardNumber=e=>!!this.fieldContainsAutocompleteValues(e,this.creditCardNumberAutocompleteValue)||this.keywordsFoundInFieldData(e,R3.CardNumberFieldNames,!1),this.isFieldForCardExpirationDate=e=>!!this.fieldContainsAutocompleteValues(e,this.creditCardExpirationDateAutocompleteValue)||this.keywordsFoundInFieldData(e,R3.CardExpiryFieldNames,!1),this.isFieldForCardExpirationMonth=e=>!!this.fieldContainsAutocompleteValues(e,this.creditCardExpirationMonthAutocompleteValue)||this.keywordsFoundInFieldData(e,R3.ExpiryMonthFieldNames,!1),this.isFieldForCardExpirationYear=e=>!!this.fieldContainsAutocompleteValues(e,this.creditCardExpirationYearAutocompleteValue)||this.keywordsFoundInFieldData(e,R3.ExpiryYearFieldNames,!1),this.isFieldForCardCvv=e=>!!this.fieldContainsAutocompleteValues(e,this.creditCardCvvAutocompleteValue)||this.keywordsFoundInFieldData(e,R3.CVVFieldNames,!1),this.isFieldForIdentityTitle=e=>!!this.fieldContainsAutocompleteValues(e,this.identityHonorificPrefixAutocompleteValue)||this.keywordsFoundInFieldData(e,x3.TitleFieldNames,!1),this.isFieldForIdentityFirstName=e=>!!this.fieldContainsAutocompleteValues(e,this.identityFirstNameAutocompleteValue)||this.keywordsFoundInFieldData(e,x3.FirstnameFieldNames,!1),this.isFieldForIdentityMiddleName=e=>!!this.fieldContainsAutocompleteValues(e,this.identityMiddleNameAutocompleteValue)||this.keywordsFoundInFieldData(e,x3.MiddlenameFieldNames,!1),this.isFieldForIdentityLastName=e=>!!this.fieldContainsAutocompleteValues(e,this.identityLastNameAutocompleteValue)||this.keywordsFoundInFieldData(e,x3.LastnameFieldNames,!1),this.isFieldForIdentityFullName=e=>!!this.fieldContainsAutocompleteValues(e,this.identityFullNameAutocompleteValue)||this.keywordsFoundInFieldData(e,x3.FullNameFieldNames,!1),this.isFieldForIdentityAddress1=e=>!!this.fieldContainsAutocompleteValues(e,this.identityAddressLine1AutocompleteValue)||this.keywordsFoundInFieldData(e,[...x3.AddressFieldNames,...x3.Address1FieldNames],!1),this.isFieldForIdentityAddress2=e=>!!this.fieldContainsAutocompleteValues(e,this.identityAddressLine2AutocompleteValue)||this.keywordsFoundInFieldData(e,x3.Address2FieldNames,!1),this.isFieldForIdentityAddress3=e=>!!this.fieldContainsAutocompleteValues(e,this.identityAddressLine3AutocompleteValue)||this.keywordsFoundInFieldData(e,x3.Address3FieldNames,!1),this.isFieldForIdentityCity=e=>!!this.fieldContainsAutocompleteValues(e,this.identityAddressCityAutocompleteValue)||this.keywordsFoundInFieldData(e,x3.CityFieldNames,!1),this.isFieldForIdentityState=e=>!!this.fieldContainsAutocompleteValues(e,this.identityAddressStateAutocompleteValue)||this.keywordsFoundInFieldData(e,x3.StateFieldNames,!1),this.isFieldForIdentityPostalCode=e=>!!this.fieldContainsAutocompleteValues(e,this.identityPostalCodeAutocompleteValue)||this.keywordsFoundInFieldData(e,x3.PostalCodeFieldNames,!1),this.isFieldForIdentityCountry=e=>!!this.fieldContainsAutocompleteValues(e,this.identityCountryAutocompleteValues)||this.keywordsFoundInFieldData(e,x3.CountryFieldNames,!1),this.isFieldForIdentityCompany=e=>!!this.fieldContainsAutocompleteValues(e,this.identityCompanyAutocompleteValue)||this.keywordsFoundInFieldData(e,x3.CompanyFieldNames,!1),this.isFieldForIdentityPhone=e=>!!this.fieldContainsAutocompleteValues(e,this.identityPhoneAutocompleteValue)||this.keywordsFoundInFieldData(e,x3.PhoneFieldNames,!1),this.isFieldForIdentityEmail=e=>!!this.isExplicitIdentityEmailField(e)||(!(!this.fieldContainsAutocompleteValues(e,this.emailAutocompleteValue)&&"email"!==e.type&&"email"!==e.htmlName)||this.keywordsFoundInFieldData(e,x3.EmailFieldNames,!1)),this.isFieldForIdentityUsername=e=>!!this.fieldContainsAutocompleteValues(e,this.usernameAutocompleteValue)||this.keywordsFoundInFieldData(e,x3.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,F3.UsernameFieldNames)},this.isEmailField=e=>"email"===e.type||!this.isExcludedFieldType(e,this.excludedAutofillFieldTypesSet)&&this.keywordsFoundInFieldData(e,F3.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=>!N3.fieldIsFuzzyMatch(e,[...F3.RecoveryCodeFieldNames])&&(!!this.fieldContainsAutocompleteValues(e,this.totpFieldAutocompleteValue)||!this.isExcludedFieldType(e,this.excludedAutofillFieldTypesSet)&&this.keywordsFoundInFieldData(e,F3.TotpFieldNames)),this.isElementLoginSubmitButton=e=>{const t=this.getSubmitButtonKeywords(e);return A3.some(e=>t.indexOf(e)>-1)},this.isElementChangePasswordSubmitButton=e=>{const t=this.getSubmitButtonKeywords(e);return D3.some(e=>t.indexOf(e)>-1)},P3("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;et.indexOf(e)>-1)}fieldHasDisqualifyingAttributeValue(e){const t=[e.htmlID,e.htmlName,e.placeholder];for(let e=0;e-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{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{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(null==e?void 0:e.senderTabId)?parseInt(e.senderTabId,10):void 0)),this.currentAutofillTab$=(0,$o.z)([this.senderTabId$,this._refreshCurrentTab$.pipe((0,sd.Z)(null))]).pipe((0,co.n)(e=>B3(this,[e],void 0,function*([e]){return e?yield tl.getTab(e):rl.inPopout(window)?null:yield tl.getTabFromCurrentWindow()})),(0,Pp.t)({refCount:!1,bufferSize:1})),this.currentTabIsOnBlocklist$=(0,$o.z)([this.domainSettingsService.blockedInteractionsUris$,this.currentAutofillTab$]).pipe((0,l.T)(([e,t])=>!(!e||!t)&&l$(null==t?void 0:t.url,e)),(0,Pp.t)({refCount:!1,bufferSize:1})),this.showCurrentTabIsBlockedBanner$=(0,$o.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=kd.getHostname(t.url);if(!i)return!1;return l$(t.url,e)&&!(null===(n=e[i])||void 0===n?void 0:n.bannerIsDismissed)}return!1}),(0,Pp.t)({refCount:!1,bufferSize:1})),this.autofillAllowed$=this.currentAutofillTab$.pipe((0,l.T)(e=>!!e)),this._currentPageDetails$=this.currentAutofillTab$.pipe((0,co.n)(e=>e?this.domainSettingsService.blockedInteractionsUris$.pipe((0,co.n)(t=>{var i;if(t&&(null===(i=null==e?void 0:e.url)||void 0===i?void 0:i.length)){if(l$(e.url,t))return(0,Oo.of)([])}return this.autofillService.collectPageDetailsFromTab$(e)})):(0,Oo.of)([])),(0,jQ.B)(50),(0,Pp.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{[CR.Card]:t,[CR.Identity]:i}})),this._currentPageDetails$.subscribe()}_internalDoAutofill(e,t,i){return B3(this,arguments,void 0,function*(e,t,i,n=!1){if(!n&&e.reprompt!==kR.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 B3(this,void 0,void 0,function*(){if(rl.inSingleActionPopout(window,aJ)&&t.id)return this.toastService.showToast({variant:"success",title:null,message:this.i18nService.t("autoFillSuccess")}),void setTimeout(()=>B3(this,void 0,void 0,function*(){yield tl.focusTab(t.id),yield uJ(`${aJ}_${e.id}`)}),1e3);rl.inPopup(window)&&(this.platformUtilService.isFirefox()||this.platformUtilService.isSafari()?tl.closePopup(window):setTimeout(()=>tl.closePopup(window),50))})}refreshCurrentTab(){this._refreshCurrentTab$.next(null)}doAutofill(e){return B3(this,arguments,void 0,function*(e,t=!0,i=!1){const n=yield(0,ho._)(this.currentAutofillTab$),r=yield(0,ho._)(this._currentPageDetails$),s=yield this._internalDoAutofill(e,n,r,i);return s&&t&&(yield this._closePopup(e,n)),s})}handleAutofillSuggestionUsed(e){return B3(this,void 0,void 0,function*(){const t=yield(0,ho._)(this.accountService.activeAccount$.pipe(Lp));t&&(yield this.cipherService.updateLastUsedDate(e.cipherId,t))})}doAutofillAndSave(e){return B3(this,arguments,void 0,function*(e,t=!0,i=!1){if(e.type!==CR.Login)return!1;const n=yield(0,ho._)(this._currentPageDetails$),r=yield(0,ho._)(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 B3(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 uE;r.uri=t.url,e.login.uris.push(r);try{const t=yield(0,ho._)(this.accountService.activeAccount$.pipe((0,l.T)(e=>null==e?void 0:e.id))),i=yield this.cipherService.encrypt(e,t);return yield this.cipherService.updateWithServer(i),this.messagingService.send("editedCipher"),!0}catch(e){return this.toastService.showToast({variant:"error",title:null,message:this.i18nService.t("unexpectedError")}),!1}})}}j3.ɵfac=function(e){return new(e||j3)(a.KVO(I3),a.KVO(oE),a.KVO(Pl),a.KVO(xb),a.KVO(Eb),a.KVO($E),a.KVO(Fb),a.KVO(ek),a.KVO(ud.nX),a.KVO(Ok),a.KVO(za),a.KVO(V3))},j3.ɵprov=a.jDH({token:j3,factory:j3.ɵfac,providedIn:"root"});class G3{hasId(e){return null!=this.fullList&&this.fullList.filter(t=>t.id===e).length>0}constructor(e){Object.assign(this,e)}}const L3=k.array(Te,"collapsedGroupings",{deserializer:e=>e,clearOn:["logout","lock"]});var z3=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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{collapsedGroupingsState(e){return this.stateProvider.getUser(e,L3)}constructor(e,t,i,n,r,s,o,a,l){this.organizationService=e,this.folderService=t,this.cipherService=i,this.collectionService=n,this.policyService=r,this.stateProvider=s,this.accountService=o,this.configService=a,this.i18nService=l}storeCollapsedFilterNodes(e,t){return z3(this,void 0,void 0,function*(){yield this.collapsedGroupingsState(t).update(()=>Array.from(e))})}buildCollapsedFilterNodes(e){return z3(this,void 0,void 0,function*(){return yield(0,ho._)(this.collapsedGroupingsState(e).state$.pipe((0,l.T)(e=>new Set(e))))})}buildOrganizations(){return z3(this,void 0,void 0,function*(){const e=yield(0,ho._)(Gp(this.accountService.activeAccount$));let t=yield(0,ho._)(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)=>z3(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)||null==e.id)}const r=yield this.getAllFoldersNested(n);return new G3({fullList:n,nestedList:r})});return this.accountService.activeAccount$.pipe((0,No.s)(1),Gp,(0,co.n)(e=>this.folderService.folderViews$(e).pipe((0,cx.Z)(i=>(0,md.H)(t(i,e))))))}buildCollections(e){return z3(this,void 0,void 0,function*(){const t=yield(0,ho._)(this.accountService.activeAccount$.pipe(Gp,(0,co.n)(e=>this.collectionService.decryptedCollections$(e)))),i=yield this.buildOrganizations(),n=yield this.configService.getFeatureFlag(Nf.CreateDefaultLocation);let r=null==e?t:t.filter(t=>t.organizationId===e);n&&(r=K3(r,i,this.i18nService.collator));const s=yield this.collectionService.getAllNested(r);return new G3({fullList:r,nestedList:s})})}checkForSingleOrganizationPolicy(){return z3(this,void 0,void 0,function*(){return yield(0,ho._)(this.accountService.activeAccount$.pipe(Gp,(0,co.n)(e=>this.policyService.policyAppliesToUser$(_h.SingleOrg,e))))})}checkForOrganizationDataOwnershipPolicy(){return z3(this,void 0,void 0,function*(){return yield(0,ho._)(this.accountService.activeAccount$.pipe(Gp,(0,co.n)(e=>this.policyService.policyAppliesToUser$(_h.OrganizationDataOwnership,e))))})}getAllFoldersNested(e){return z3(this,void 0,void 0,function*(){const t=[];return e.forEach(e=>{const i=new OO;i.id=e.id,i.revisionDate=e.revisionDate;const n=null!=e.name?e.name.replace(/^\/+|\/+$/g,"").split("/"):[];iR.nestedTraverse(t,0,n,i,void 0,"/")}),t})}getFolderNested(e){return z3(this,void 0,void 0,function*(){const t=yield(0,ho._)(this.accountService.activeAccount$.pipe(Gp)),i=yield this.getAllFoldersNested(yield(0,ho._)(this.folderService.folderViews$(t)));return iR.getTreeNodeObjectFromList(i,e)})}}function K3(e,t=[],i){const n=e.filter(e=>e.type===LF).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!==LF)]}_3.ɵfac=function(e){return new(e||_3)(a.KVO(AF),a.KVO(qU),a.KVO(Fb),a.KVO(BF),a.KVO($b),a.KVO(u),a.KVO(Ok),a.KVO(uk),a.KVO(Pl))},_3.ɵprov=a.jDH({token:_3,factory:_3.ɵfac});var X3=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 q3=new m(Pe,"filterVisibility",{deserializer:e=>e}),Y3="MyVault",W3={organization:null,collection:null,folder:null,cipherType:null};class H3{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,$o.z)([this.organizations$,this.collections$,this.folders$]).pipe((0,No.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===Y3)o.organization={id:Y3};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,h){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.configService=h,this.filterForm=this.formBuilder.group(W3),this.filters$=this.filterForm.valueChanges.pipe((0,sd.Z)(this.filterForm.value),(0,Pp.t)({bufferSize:1,refCount:!0})),this.numberOfAppliedFilters$=this.filters$.pipe((0,l.T)(e=>Object.values(e).filter(e=>Boolean(e)).length),(0,Pp.t)({refCount:!0,bufferSize:1})),this.filterVisibilityState=this.stateProvider.getGlobal(q3),this.cipherViews=[],this.activeUserId$=this.accountService.activeAccount$.pipe((0,l.T)(e=>null==e?void 0:e.id),(0,To.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(hE.isDeleted(t))return!1;if(null!==e.cipherType&&hE.getType(t)!==e.cipherType)return!1;if(e.collection&&!(null===(i=t.collectionIds)||void 0===i?void 0:i.includes(Dk(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)===Y3){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=>vL.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(Gp,(0,co.n)(e=>(0,$o.z)([this.organizationService.memberOrganizations$(e),this.policyService.policyAppliesToUser$(_h.OrganizationDataOwnership,e)])),(0,l.T)(([e,t])=>[e.sort(kd.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:Y3},label:this.i18nService.t("myVault"),icon:"bwi-user"}),[...i,...e.map(e=>{let t="bwi-business";return e.enabled?e.productTierType!==qE.Families&&e.productTierType!==qE.Free||(t="bwi-family"):t="bwi-exclamation-triangle tw-text-danger",{value:e,label:e.name,icon:t}})]}),(0,Pp.t)({refCount:!0,bufferSize:1})),this.folders$=this.activeUserId$.pipe((0,co.n)(e=>{const t=this.cipherService.cipherListViews$(e).pipe((0,l.T)(e=>(this.cipherViews=e?Object.values(e):[],this.cipherViews)));return(0,$o.z)([this.filters$.pipe((0,lo.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&&null===t[0].id)return[e,[],i];t.sort(kd.getSortFunction(this.i18nService,"name"));let n=t;const r=t.find(e=>null===e.id);if(r){const e=Object.assign(Object.assign({},r),{name:this.i18nService.t("itemsWithNoFolder")});n=[...t.filter(e=>null!==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===Y3)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 G3({fullList:e,nestedList:t})}),(0,l.T)(e=>e.nestedList.map(e=>this.convertToChipSelectOption(e,"bwi-folder"))))}),(0,Pp.t)({refCount:!0,bufferSize:1})),this.collections$=this.accountService.activeAccount$.pipe(Gp,(0,co.n)(e=>(0,$o.z)([this.filters$.pipe((0,lo.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),this.configService.getFeatureFlag$(Nf.CreateDefaultLocation)])),(0,l.T)(([e,t,i,n])=>{var r,s;const o=null!==(s=null===(r=e.organization)||void 0===r?void 0:r.id)&&void 0!==s?s:null,a=o?t.filter(e=>e.organizationId===o):t;return n?K3(a,i,this.i18nService.collator):a}),(0,l.T)(e=>new G3({fullList:e,nestedList:this.collectionService.getAllNested(e)})),(0,l.T)(e=>e.nestedList.map(e=>this.convertToChipSelectOption(e,e.node.type===LF?"bwi-user":"bwi-collection-shared"))),(0,Pp.t)({bufferSize:1,refCount:!0})),this.allFilters$=(0,$o.z)([this.organizations$,this.collections$,this.folders$]),this.filterForm.controls.organization.valueChanges.pipe((0,wl.pQ)()).subscribe(this.validateOrganizationChange.bind(this));const p=this.viewCacheService.signal({key:"vault-filters",initialValue:{},deserializer:e=>e,persistNavigation:!0});this.deserializeFilters(p()),this.filterForm.valueChanges.pipe((0,jQ.B)(300),(0,l.T)(()=>this.serializeFilters()),(0,lo.F)((e,t)=>JSON.stringify(e)===JSON.stringify(t))).subscribe(e=>{p.set(e)})}resetFilterForm(){this.filterForm.reset(W3)}updateFilterVisibility(e){return X3(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 OO;i.id=e.id,i.revisionDate=e.revisionDate;const n=null!=e.name?e.name.replace(/^\/+|\/+$/g,"").split("/"):[];iR.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&&null!==n.folder.id&&e.id!==Y3){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)}}}H3.ɵfac=function(e){return new(e||H3)(a.KVO(qU),a.KVO(Fb),a.KVO(AF),a.KVO(Pl),a.KVO(BF),a.KVO(fl.ok),a.KVO($b),a.KVO(u),a.KVO(Ok),a.KVO(sI),a.KVO(vE),a.KVO(uk))},H3.ɵprov=a.jDH({token:H3,factory:H3.ɵfac,providedIn:"root"});class J3{constructor(e,t,i,n,r,s,o,c,u,d,h,p,f){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=f,this.cachedSearchText=(0,a.WQX)(g3).signal({key:"vault-search-text",initialValue:"",persistNavigation:!0}),this.searchText$=(0,wl.br)(this.cachedSearchText),this._ciphersLoading$=new go.B,this.activeUserId$=this.accountService.activeAccount$.pipe((0,l.T)(e=>null==e?void 0:e.id),(0,To.p)(e=>null!==e)),this.organizations$=this.activeUserId$.pipe((0,co.n)(e=>this.organizationService.organizations$(e))),this.decryptedCollections$=this.activeUserId$.pipe((0,co.n)(e=>this.collectionService.decryptedCollections$(e))),this._otherAutoFillTypes$=(0,$o.z)([this.vaultSettingsService.showCardsCurrentTab$,this.vaultSettingsService.showIdentitiesCurrentTab$,this.vaultPopupAutofillService.nonLoginCipherTypesOnPage$]).pipe((0,l.T)(([e,t,i])=>{const n=e||i[CR.Card],r=t||i[CR.Identity];return[...n?[CR.Card]:[],...r?[CR.Identity]:[]]})),this._allDecryptedCiphers$=this.accountService.activeAccount$.pipe((0,l.T)(e=>null==e?void 0:e.id),(0,To.p)(e=>null!=e),(0,co.n)(e=>(0,bo.h)(this.cipherService.ciphers$(e),this.cipherService.localData$(e)).pipe(rJ(this.ngZone),(0,Fo.M)(()=>this._ciphersLoading$.next()),Z3(this.syncService),(0,co.n)(()=>(0,$o.z)([this.cipherService.cipherListViews$(e).pipe((0,To.p)(e=>null!=e)),this.cipherService.failedToDecryptCiphers$(e),this.restrictedItemTypesService.restricted$])),(0,l.T)(([e,t,i])=>[...t||[],...e].filter(e=>!this.restrictedItemTypesService.isCipherRestricted(e,i))))),(0,Pp.t)({refCount:!0,bufferSize:1})),this.userCanArchive$=this.activeUserId$.pipe((0,co.n)(e=>this.cipherArchiveService.userCanArchive$(e))),this._activeCipherList$=this._allDecryptedCiphers$.pipe((0,co.n)(e=>(0,$o.z)([this.organizations$,this.decryptedCollections$,this.userCanArchive$]).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=>!(hE.isDeleted(e)||n&&hE.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,$o.z)([this.searchText$,Gp(this.accountService.activeAccount$)]).pipe((0,co.n)(([e,t])=>this.searchService.isSearchable(t,e))),this._filteredCipherList$=(0,$o.z)([this._activeCipherList$,this.searchText$,this.vaultPopupListFiltersService.filterFunction$,Gp(this.accountService.activeAccount$)]).pipe((0,l.T)(([e,t,i,n])=>[i(e),t,n]),(0,co.n)(([e,t,i])=>this.searchService.searchCiphers(i,t,void 0,e)),(0,Pp.t)({refCount:!0,bufferSize:1})),this.autoFillCiphers$=(0,$o.z)([this._filteredCipherList$,this._otherAutoFillTypes$,this.vaultPopupAutofillService.currentAutofillTab$]).pipe((0,co.n)(([e,t,i])=>i&&i.url?this.cipherService.filterCiphersForUrl(e,i.url,t):(0,Oo.of)([])),(0,l.T)(e=>e.sort(this.sortCiphersForAutofill.bind(this))),(0,Pp.t)({refCount:!1,bufferSize:1})),this.favoriteCiphers$=this.autoFillCiphers$.pipe((0,sm.E)(this._filteredCipherList$),(0,l.T)(([e,t])=>t.filter(t=>t.favorite&&!e.includes(t))),(0,Pp.t)({refCount:!1,bufferSize:1})),this.remainingCiphers$=this.favoriteCiphers$.pipe((0,yo.H)(e=>(0,Oo.of)(e).pipe((0,sm.E)(this._filteredCipherList$,this.autoFillCiphers$))),(0,l.T)(([e,t,i])=>t.filter(t=>!i.includes(t)&&!e.includes(t))),(0,Pp.t)({refCount:!1,bufferSize:1})),this.loading$=(0,bo.h)(this._ciphersLoading$.pipe((0,l.T)(()=>!0)),this.remainingCiphers$.pipe((0,l.T)(()=>!1))).pipe((0,sd.Z)(!0),(0,lo.F)(),(0,Pp.t)({refCount:!1,bufferSize:1})),this.hasSearchText$=this._hasSearchText.pipe((0,lo.F)(),(0,Pp.t)({bufferSize:1,refCount:!0})),this.hasFilterApplied$=(0,$o.z)([this._hasSearchText,this.vaultPopupListFiltersService.filters$]).pipe((0,l.T)(([e,t])=>e||Object.values(t).some(e=>null!==e)),(0,Pp.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,$o.z)([this.vaultPopupListFiltersService.filters$.pipe((0,v3.w)("organization")),this.organizations$]).pipe((0,l.T)(([e,t])=>{if(!e.organization||e.organization.id===Y3)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,co.n)(e=>(0,$o.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=>hE.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,Pp.t)({refCount:!1,bufferSize:1}))}applyFilter(e){this.cachedSearchText.set(e)}sortCiphersForAutofill(e,t){const i={[CR.Login]:1,[CR.Card]:2,[CR.Identity]:3,[CR.SecureNote]:4,[CR.SshKey]:5},n=hE.getType(e),r=hE.getType(t);return i[n]i[r]?1:this.cipherService.sortCiphersByLastUsedThenName(e,t)}}J3.ɵfac=function(e){return new(e||J3)(a.KVO(Fb),a.KVO(Zq),a.KVO(H3),a.KVO(AF),a.KVO(RJ),a.KVO(BF),a.KVO(j3),a.KVO(ux),a.KVO(Ok),a.KVO(yl.SKi),a.KVO(vE),a.KVO(uk),a.KVO(BV))},J3.ɵprov=a.jDH({token:J3,factory:J3.ɵfac,providedIn:"root"});const Z3=e=>{return t=e.activeUserLastSync$().pipe((0,To.p)(e=>null!=e)),e=>{const i=e.pipe((0,wo.u)());return(0,bo.h)(i.pipe((0,y3.X)(t),(0,No.s)(1)),i.pipe((0,b3.U)(t)))};var t};var Q3=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 e4=new m(De,"copyButtons",{deserializer:e=>e});class t4{constructor(){this.DEFAULT_DISPLAY_MODE="combined",this.state=(0,a.WQX)(d).get(e4),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,Pp.t)({bufferSize:1,refCount:!0}))}setDisplayMode(e){return Q3(this,void 0,void 0,function*(){yield this.state.update(()=>e)})}setShowQuickCopyActions(e){return Q3(this,void 0,void 0,function*(){yield this.setDisplayMode(e?"quick":"combined")})}}t4.ɵfac=function(e){return new(e||t4)},t4.ɵprov=a.jDH({token:t4,factory:t4.ɵfac,providedIn:"root"});class i4{constructor(){this.vaultPopupItemsService=(0,a.WQX)(J3),this.vaultPopupListFiltersService=(0,a.WQX)(H3),this.vaultCopyButtonsService=(0,a.WQX)(t4),this.loading$=(0,$o.z)([this.vaultPopupItemsService.loading$,this.vaultPopupListFiltersService.allFilters$,this.vaultCopyButtonsService.showQuickCopyActions$]).pipe((0,l.T)(([e,t])=>e||!t),(0,Pp.t)({bufferSize:1,refCount:!0}),(0,sd.Z)(!0))}}i4.ɵfac=function(e){return new(e||i4)},i4.ɵprov=a.jDH({token:i4,factory:i4.ɵfac,providedIn:"root"});class n4{constructor(){this.router=(0,a.WQX)(ud.Ix),this.vaultPath="/tabs/vault",this.scrollPosition=null,this.scrollSubscription=null,this.router.events.pipe((0,wl.pQ)(),(0,To.p)(e=>e instanceof ud.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(),this.scrollSubscription=null==e?void 0:e.elementScrolled().pipe((0,jg.i)(1)).subscribe(()=>{const t=e.measureScrollOffset("top");this.scrollPosition=t})}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)}}n4.ɵfac=function(e){return new(e||n4)},n4.ɵprov=a.jDH({token:n4,factory:n4.ɵfac,providedIn:"root"});function r4(e,t){1&e&&yl.nrm(0,"i",4),2&e&&yl.HbH(t)}function s4(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",5),yl.nI1(1,"i18n"),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.onClose.emit())}),yl.k0s()}2&e&&yl.Y8G("label",yl.bMT(1,1,"close"))}const o4={premium:"bwi-star",info:"bwi-info-circle",warning:"bwi-exclamation-triangle",danger:"bwi-error"};class a4{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,bl.EW)(()=>{var e;return null===this.icon()?null:null!==(e=this.icon())&&void 0!==e?e:o4[this.bannerType()]}),this.bannerClass=(0,bl.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"}})}}a4.ɵfac=function(e){return new(e||a4)},a4.ɵcmp=yl.VBU({type:a4,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&&(yl.NAR(),yl.j41(0,"div",0),yl.nVh(1,r4,1,2,"i",1),yl.j41(2,"span",2),yl.SdG(3),yl.k0s(),yl.nVh(4,s4,2,3,"button",3),yl.k0s()),2&e){let e;yl.HbH(t.bannerClass()),yl.BMQ("role",t.useAlertRole()?"status":null)("aria-live",t.useAlertRole()?"polite":null),yl.R7$(),yl.vxM((e=t.displayIcon())?1:-1,e),yl.R7$(3),yl.vxM(t.showClose()?4:-1)}},dependencies:[_l,zl,Hl],encapsulation:2,changeDetection:0});class l4{}l4.ɵfac=function(e){return new(e||l4)},l4.ɵmod=yl.$C({type:l4}),l4.ɵinj=a.G2t({imports:[a4]});var c4=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 u4(e,t){if(1&e&&(yl.j41(0,"bit-banner",0)(1,"a",2),yl.EFF(2),yl.nI1(3,"async"),yl.nI1(4,"async"),yl.nI1(5,"i18n"),yl.k0s()()),2&e){let e;const t=yl.XpG();yl.Y8G("showClose",!1),yl.R7$(),yl.Y8G("routerLink","/at-risk-passwords"),yl.R7$(),yl.SpI(" ",yl.i5U(5,7,1===(null==(e=yl.bMT(3,3,t.currentPendingTasks$))?null:e.length)?"reviewAndChangeAtRiskPassword":"reviewAndChangeAtRiskPasswordsPlural",null==(e=yl.bMT(4,5,t.currentPendingTasks$))?null:e.length.toString())," ")}}function d4(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"bit-banner",3),yl.bIt("onClose",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.successBannerDismissed())}),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()}2&e&&(yl.Y8G("icon",null)("showClose",!0),yl.R7$(),yl.SpI(" ",yl.bMT(2,3,"atRiskLoginsSecured")," "))}class h4{constructor(){this.activeAccount$=(0,a.WQX)(Ok).activeAccount$.pipe(Gp),this.atRiskPasswordCalloutService=(0,a.WQX)(xE),this.showCompletedTasksBanner$=this.activeAccount$.pipe((0,co.n)(e=>this.atRiskPasswordCalloutService.showCompletedTasksBanner$(e))),this.currentPendingTasks$=this.activeAccount$.pipe((0,co.n)(e=>this.atRiskPasswordCalloutService.pendingTasks$(e)))}successBannerDismissed(){return c4(this,void 0,void 0,function*(){const e=yield(0,ho._)(this.activeAccount$);this.atRiskPasswordCalloutService.updateAtRiskPasswordState(e,{hasInteractedWithTasks:!0,tasksBannerDismissed:!0})})}}h4.ɵfac=function(e){return new(e||h4)},h4.ɵcmp=yl.VBU({type:h4,selectors:[["vault-at-risk-password-callout"]],features:[yl.Jv_([xE])],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&&(yl.nVh(0,u4,6,10,"bit-banner",0),yl.nI1(1,"async"),yl.nVh(2,d4,3,5,"bit-banner",1),yl.nI1(3,"async")),2&e){let e;yl.vxM((null==(e=yl.bMT(1,2,t.currentPendingTasks$))?null:e.length)>0?0:-1),yl.R7$(2),yl.vxM(yl.bMT(3,4,t.showCompletedTasksBanner$)?2:-1)}},dependencies:[_b,pl.MD,sw.iI,sw.Wk,td,l4,a4,qf,pl.Jj,Xf],encapsulation:2});class p4{constructor(){this.fadeInOut=!0}}p4.ɵfac=function(e){return new(e||p4)},p4.ɵcmp=yl.VBU({type:p4,selectors:[["vault-fade-in-out"]],hostVars:1,hostBindings:function(e,t){2&e&&yl.zvX("@fadeInOut",t.fadeInOut)},ngContentSelectors:["*"],decls:1,vars:0,template:function(e,t){1&e&&(yl.NAR(),yl.SdG(0))},encapsulation:2,data:{animation:[(0,gl.hZ)("fadeInOut",[(0,gl.kY)(":enter",[(0,gl.iF)({opacity:0}),(0,gl.i0)("100ms ease-in",(0,gl.iF)({opacity:1}))]),(0,gl.kY)(":leave",[(0,gl.i0)("300ms ease-out",(0,gl.iF)({opacity:0}))])])]},changeDetection:0});var f4=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 v4(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"bit-banner",1),yl.bIt("onClose",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.handleCurrentTabIsBlockedBannerDismiss())}),yl.EFF(1),yl.nI1(2,"i18n"),yl.j41(3,"a",2),yl.EFF(4),yl.nI1(5,"i18n"),yl.k0s()()}if(2&e){const e=yl.XpG();yl.R7$(),yl.SpI(" ",yl.bMT(2,3,"autofillBlockedNoticeV2")," "),yl.R7$(2),yl.Y8G("routerLink",e.blockedURISettingsRoute),yl.R7$(),yl.SpI(" ",yl.bMT(5,5,"autofillBlockedNoticeGuidance")," ")}}class m4{constructor(e){this.vaultPopupAutofillService=e,this.showCurrentTabIsBlockedBanner$=this.vaultPopupAutofillService.showCurrentTabIsBlockedBanner$,this.blockedURISettingsRoute="/blocked-domains"}ngOnInit(){return f4(this,void 0,void 0,function*(){})}handleCurrentTabIsBlockedBannerDismiss(){return f4(this,void 0,void 0,function*(){yield this.vaultPopupAutofillService.dismissCurrentTabIsBlockedBanner()})}}m4.ɵfac=function(e){return new(e||m4)(yl.rXU(j3))},m4.ɵcmp=yl.VBU({type:m4,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&&(yl.DNE(0,v4,6,7,"bit-banner",0),yl.nI1(1,"async")),2&e&&yl.Y8G("ngIf",yl.bMT(1,1,t.showCurrentTabIsBlockedBanner$))},dependencies:[l4,a4,pl.MD,pl.bT,_l,qf,Oh,_b,sw.iI,sw.Wk,Xl,pl.Jj,Xf],encapsulation:2});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 y4=()=>["/add-cipher"],b4=(e,t)=>t.type;function w4(e,t){if(1&e&&(yl.j41(0,"a",3),yl.nrm(1,"i",6),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s()),2&e){const e=t.$implicit,i=yl.XpG();yl.Y8G("routerLink",yl.lJ4(7,y4))("queryParams",i.buildQueryParams(e.type)),yl.R7$(),yl.HbH(`bwi ${e.icon}`),yl.R7$(),yl.SpI(" ",yl.bMT(3,5,e.labelKey)," ")}}class S4{constructor(e,t){this.dialogService=e,this.restrictedItemTypeService=t,this.cipherType=CR,this.cipherMenuItems$=this.restrictedItemTypeService.restricted$.pipe((0,l.T)(e=>{const t=e.map(e=>e.cipherType);return vL.filter(e=>!t.includes(e.type))}))}ngOnInit(){return g4(this,void 0,void 0,function*(){this.tab=yield tl.getTabFromCurrentWindow()})}buildQueryParams(e){var t,i,n;const r={};return!rl.inPopout(window)&&e===CR.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(){WG.open(this.dialogService)}}S4.ɵfac=function(e){return new(e||S4)(yl.rXU(Jd),yl.rXU(vE))},S4.ɵcmp=yl.VBU({type:S4,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=yl.RV6();yl.j41(0,"button",1),yl.nrm(1,"i",2),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.j41(4,"bit-menu",null,0),yl.Z7z(6,w4,4,8,"a",3,b4),yl.nI1(8,"async"),yl.nrm(9,"bit-menu-divider"),yl.j41(10,"button",4),yl.bIt("click",function(){return a.eBV(e),a.Njj(t.openFolderDialog())}),yl.nrm(11,"i",5),yl.EFF(12),yl.nI1(13,"i18n"),yl.k0s()()}if(2&e){const e=yl.sdS(5);yl.Y8G("bitMenuTriggerFor",e),yl.R7$(2),yl.SpI(" ",yl.bMT(3,3,"new"),"\n"),yl.R7$(4),yl.Dyx(yl.bMT(8,5,t.cipherMenuItems$)),yl.R7$(6),yl.SpI(" ",yl.bMT(13,7,"folder")," ")}},dependencies:[Eh,qf,pl.MD,Xu,Ku,sw.Wk,Dh,gL,bL,LE,wL,Xf,pl.Jj],encapsulation:2});let k4=0;class I4{constructor(){this.open=(0,o.geq)(!1),this.id="bit-disclosure-"+k4++,this.classList=(0,bl.EW)(()=>this.open()?"":"tw-hidden")}}I4.ɵfac=function(e){return new(e||I4)},I4.ɵcmp=yl.VBU({type:I4,selectors:[["bit-disclosure"]],hostVars:3,hostBindings:function(e,t){2&e&&(yl.Avn("id",t.id),yl.HbH(t.classList()))},inputs:{open:[1,"open"]},outputs:{open:"openChange"},ngContentSelectors:["*"],decls:1,vars:0,template:function(e,t){1&e&&(yl.NAR(),yl.SdG(0))},encapsulation:2,changeDetection:0});class C4{constructor(){this.disclosure=o.hFB.required({alias:"bitDisclosureTriggerFor"}),this.ariaExpanded=(0,bl.EW)(()=>this.disclosure().open()),this.ariaControls=(0,bl.EW)(()=>this.disclosure().id)}toggle(){this.disclosure().open.update(e=>!e)}}function T4(e,t){if(1&e&&(yl.nrm(0,"bit-chip-select",6),yl.nI1(1,"i18n")),2&e){const e=yl.XpG().ngIf;yl.Y8G("placeholderText",yl.bMT(1,2,"vault"))("options",e)}}function P4(e,t){if(1&e&&(yl.qex(0),yl.DNE(1,T4,2,4,"bit-chip-select",5),yl.bVm()),2&e){const e=t.ngIf;yl.R7$(),yl.Y8G("ngIf",e.length)}}function F4(e,t){if(1&e&&(yl.nrm(0,"bit-chip-select",8),yl.nI1(1,"i18n")),2&e){const e=yl.XpG().ngIf;yl.Y8G("placeholderText",yl.bMT(1,2,"collection"))("options",e)}}function R4(e,t){if(1&e&&(yl.qex(0),yl.DNE(1,F4,2,4,"bit-chip-select",7),yl.bVm()),2&e){const e=t.ngIf;yl.R7$(),yl.Y8G("ngIf",e.length)}}function x4(e,t){if(1&e&&(yl.nrm(0,"bit-chip-select",10),yl.nI1(1,"i18n")),2&e){const e=yl.XpG().ngIf;yl.Y8G("placeholderText",yl.bMT(1,2,"folder"))("options",e)}}function A4(e,t){if(1&e&&(yl.qex(0),yl.DNE(1,x4,2,4,"bit-chip-select",9),yl.bVm()),2&e){const e=t.ngIf;yl.R7$(),yl.Y8G("ngIf",e.length)}}function D4(e,t){if(1&e&&(yl.j41(0,"form",2),yl.DNE(1,P4,2,1,"ng-container",3)(2,R4,2,1,"ng-container",3)(3,A4,2,1,"ng-container",3),yl.nrm(4,"bit-chip-select",4),yl.nI1(5,"i18n"),yl.nI1(6,"async"),yl.k0s()),2&e){const e=t.ngIf,i=yl.XpG();yl.Y8G("formGroup",i.filterForm),yl.R7$(),yl.Y8G("ngIf",e.organizations),yl.R7$(),yl.Y8G("ngIf",e.collections),yl.R7$(),yl.Y8G("ngIf",e.folders),yl.R7$(),yl.Y8G("placeholderText",yl.bMT(5,6,"type"))("options",yl.bMT(6,8,i.cipherTypes$))}}C4.ɵfac=function(e){return new(e||C4)},C4.ɵdir=yl.FsC({type:C4,selectors:[["","bitDisclosureTriggerFor",""]],hostVars:2,hostBindings:function(e,t){1&e&&yl.bIt("click",function(){return t.toggle()}),2&e&&yl.BMQ("aria-expanded",t.ariaExpanded())("aria-controls",t.ariaControls())},inputs:{disclosure:[1,"bitDisclosureTriggerFor","disclosure"]},exportAs:["disclosureTriggerFor"]});class E4{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,$o.z)([this.organizations$,this.collections$,this.folders$]).pipe((0,l.T)(([e,t,i])=>({organizations:e,collections:t,folders:i})),(0,Pp.t)({bufferSize:1,refCount:!1}))}}E4.ɵfac=function(e){return new(e||E4)(yl.rXU(H3))},E4.ɵcmp=yl.VBU({type:E4,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&&(yl.j41(0,"div",0),yl.nI1(1,"i18n"),yl.DNE(2,D4,7,10,"form",1),yl.nI1(3,"async"),yl.k0s()),2&e&&(yl.BMQ("aria-label",yl.bMT(1,2,"filters")),yl.R7$(2),yl.Y8G("ngIf",yl.bMT(3,4,t.allFilters$)))},dependencies:[pl.MD,pl.bT,qf,t0,fl.X1,fl.qT,fl.BC,fl.cb,fl.j4,fl.JD,pl.Jj,Xf],encapsulation:2});var $4=i(38871),O4=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 U4=new k(Fe,"searchIndex",{deserializer:e=>e,clearOn:["lock","logout"]}),M4=new k(Fe,"searchIndexedEntityId",{deserializer:e=>e,clearOn:["lock","logout"]}),N4=new k(Fe,"isIndexing",{deserializer:e=>e,clearOn:["lock","logout"]});class V4{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 fd.t(!1),this.isCipherSearching$=this._isCipherSearching$.asObservable(),this._isSendSearching$=new fd.t(!1),this.isSendSearching$=this._isSendSearching$.asObservable(),this.index$=IE(e=>this.searchIndexState(e).state$.pipe((0,l.T)(e=>{let t=null;if(e){const i=performance.now();t=$4.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}),V4.registeredPipeline||(V4.registeredPipeline=!0,$4.Pipeline.registerFunction(this.normalizeAccentsPipelineFunction,"normalizeAccents"))}searchIndexState(e){return this.stateProvider.getUser(e,U4)}searchIndexEntityIdState(e){return this.stateProvider.getUser(e,M4)}indexedEntityId$(e){return this.searchIndexEntityIdState(e).state$.pipe((0,l.T)(e=>e))}searchIsIndexingState(e){return this.stateProvider.getUser(e,N4)}searchIsIndexing$(e){return this.searchIsIndexingState(e).state$.pipe((0,l.T)(e=>null!=e&&e))}clearIndex(e){return O4(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 O4(this,void 0,void 0,function*(){if(null==(t=V4.normalizeSearchQuery(t))||""===t)return!1;return 0===t.indexOf(">")?null!=(yield this.getIndexForSearch(e)):t.length>=this.searchableMinLength})}indexCiphers(e,t,i){return O4(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 $4.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=>null!=e.subTitle&&e.type===CR.Card?e.subTitle.replace(/\*/g,""):e.subTitle}),r.field("notes"),r.field("login.username",{extractor:e=>e.type===CR.Login&&null!=e.login?e.login.username: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 O4(this,arguments,void 0,function*(e,t,i=null,n){this._isCipherSearching$.next(!0);const r=[],s=performance.now();if(null!=t&&(t=V4.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=$4.Query.wildcard.LEADING|$4.Query.wildcard.TRAILING;l=o.query(i=>{$4.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=V4.normalizeSearchQuery(t.trim().toLowerCase()),e.filter(e=>{var r,s;if(i!==hE.isDeleted(e))return!1;if(n!==hE.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=hE.subtitle(e);if(null!=o&&o.toLowerCase().indexOf(t)>-1)return!0;const a=hE.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=V4.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 O4(this,void 0,void 0,function*(){return yield(0,ho._)(this.index$(e))})}setIndexForSearch(e,t){return O4(this,void 0,void 0,function*(){yield this.searchIndexState(e).update(()=>t)})}setIndexedEntityIdForSearch(e,t){return O4(this,void 0,void 0,function*(){yield this.searchIndexEntityIdState(e).update(()=>t)})}setIsIndexing(e,t){return O4(this,void 0,void 0,function*(){yield this.searchIsIndexingState(e).update(()=>t)})}getIsIndexing(e){return O4(this,void 0,void 0,function*(){return yield(0,ho._)(this.searchIsIndexing$(e))})}fieldExtractor(e,t){if(!e.hasFields)return null;let i=[];return e.fields.forEach(e=>{null!=e.name&&i.push(e.name),e.type===FR.Text&&null!=e.value&&i.push(e.value)}),i=i.filter(e=>""!==e.trim()),0===i.length?null:t?i.join(" "):i}attachmentExtractor(e,t){if(!e.hasAttachments)return null;let i=[];return e.attachments.forEach(e=>{null!=e&&null!=e.fileName&&(t&&e.fileName.indexOf(".")>-1?i.push(e.fileName.substr(0,e.fileName.lastIndexOf("."))):i.push(e.fileName))}),i=i.filter(e=>""!==e.trim()),0===i.length?null:t?i.join(" "):i}uriExtractor(e){if(e.type!==CR.Login||null==e.login||!e.login.hasUris)return null;const t=[];return e.login.uris.forEach(e=>{if(null==e.uri||""===e.uri)return;const i=e.uri.match(/:(\d+)(?:[/?#]|$)/),n=null==i?void 0:i[1];let r=e.uri;if(null!==e.hostname)return t.push(e.hostname),void(n&&(t.push(`${e.hostname}:${n}`),t.push(n)));{const e=r.indexOf("/"),i=e>-1?r.substring(0,e):r;t.push(i),n&&(t.push(`${i}`),t.push(n))}if(e.match!==ZD.RegularExpression){const e=r.indexOf("://");e>-1&&(r=r.substr(e+3));const t=r.search(/\?|&|#/);t>-1&&(r=r.substring(0,t))}t.push(r)}),t.length>0?t:null}normalizeAccentsPipelineFunction(e){const t=["name","login.username","subtitle","notes"];return e.metadata.fields.every(e=>t.includes(e))?V4.normalizeSearchQuery(e.toString()):e}static normalizeSearchQuery(e){return null==e?void 0:e.normalize("NFD").replace(/[\u0300-\u036f]/g,"")}}V4.registeredPipeline=!1;class B4{constructor(e,t,i,n){this.vaultPopupItemsService=e,this.vaultPopupLoadingService=t,this.configService=i,this.ngZone=n,this.searchText="",this.searchText$=new go.B,this.loading$=this.vaultPopupLoadingService.loading$,this.subscribeToLatestSearchText(),this.subscribeToApplyFilter()}onSearchTextChanged(){this.searchText$.next(this.searchText)}subscribeToLatestSearchText(){return this.vaultPopupItemsService.searchText$.pipe((0,wl.pQ)(),(0,To.p)(e=>!!e)).subscribe(e=>{this.searchText=e})}subscribeToApplyFilter(){this.configService.getFeatureFlag$(Nf.VaultLoadingSkeletons).pipe((0,co.n)(e=>e?(0,$o.z)([this.searchText$,this.loading$]).pipe((0,Sl.s)(([e,t])=>{const i=t?0:200;return(0,ko.O)(i)}),(0,lo.F)(([e,t],[i,n])=>e===i&&t===n),(0,l.T)(([e,t])=>e)):this.searchText$.pipe((0,jQ.B)(200),(0,lo.F)())),(0,wl.pQ)()).subscribe(e=>{this.ngZone.runOutsideAngular(()=>{this.ngZone.run(()=>{this.vaultPopupItemsService.applyFilter(e)})})})}}B4.ɵfac=function(e){return new(e||B4)(yl.rXU(J3),yl.rXU(i4),yl.rXU(uk),yl.rXU(yl.SKi))},B4.ɵcmp=yl.VBU({type:B4,selectors:[["app-vault-v2-search"]],decls:2,vars:4,consts:[["autocomplete","off","appAutofocus","",3,"ngModelChange","placeholder","ngModel"]],template:function(e,t){1&e&&(yl.j41(0,"bit-search",0),yl.nI1(1,"i18n"),yl.mxI("ngModelChange",function(e){return yl.DH7(t.searchText,e)||(t.searchText=e),e}),yl.bIt("ngModelChange",function(){return t.onSearchTextChanged()}),yl.k0s()),2&e&&(yl.Y8G("placeholder",yl.bMT(1,2,"search")),yl.R50("ngModel",t.searchText))},dependencies:[pl.MD,v$,f$,qf,hk,fl.YN,fl.BC,fl.vS,Xf],encapsulation:2});var 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())})};function G4(e,t){if(1&e&&(yl.j41(0,"p",8),yl.EFF(1),yl.k0s()),2&e){const e=t.ngIf;yl.R7$(),yl.SpI(" ",e," ")}}function L4(e,t){if(1&e&&(yl.j41(0,"div",9),yl.EFF(1),yl.nI1(2,"async"),yl.k0s()),2&e){const e=yl.XpG();yl.R7$(),yl.SpI(" ",yl.bMT(2,1,e.numberOfAppliedFilters$)," ")}}class z4{constructor(e,t){this.vaultPopupListFiltersService=e,this.i18nService=t,this.isDisclosureShown$=this.vaultPopupListFiltersService.filterVisibilityState$.pipe(rJ((0,a.WQX)(yl.SKi)),(0,l.T)(e=>null==e||e)),this.initialDisclosureVisibility$=this.isDisclosureShown$.pipe((0,No.s)(1)),this.numberOfAppliedFilters$=this.vaultPopupListFiltersService.numberOfAppliedFilters$,this.showBadge$=(0,$o.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 j4(this,void 0,void 0,function*(){yield this.vaultPopupListFiltersService.updateFilterVisibility(e)})}}z4.ɵfac=function(e){return new(e||z4)(yl.rXU(H3),yl.rXU(Pl))},z4.ɵcmp=yl.VBU({type:z4,selectors:[["app-vault-header-v2"]],viewQuery:function(e,t){if(1&e&&yl.GBs(I4,5),2&e){let e;yl.mGM(e=yl.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=yl.RV6();yl.j41(0,"div",1)(1,"div",2),yl.nrm(2,"app-vault-v2-search"),yl.k0s(),yl.j41(3,"div",3),yl.nrm(4,"button",4),yl.nI1(5,"i18n"),yl.DNE(6,G4,2,1,"p",5),yl.nI1(7,"async"),yl.DNE(8,L4,3,3,"div",6),yl.nI1(9,"async"),yl.k0s()(),yl.j41(10,"bit-disclosure",7,0),yl.nI1(12,"async"),yl.bIt("openChange",function(i){return a.eBV(e),a.Njj(t.toggleFilters(i))}),yl.nrm(13,"app-vault-list-filters"),yl.k0s()}if(2&e){const e=yl.sdS(11);yl.R7$(4),yl.Y8G("buttonType","muted")("bitDisclosureTriggerFor",e)("label",yl.bMT(5,6,"filterVault")),yl.R7$(2),yl.Y8G("ngIf",yl.bMT(7,8,t.buttonSupportingText$)),yl.R7$(2),yl.Y8G("ngIf",yl.bMT(9,10,t.showBadge$)),yl.R7$(2),yl.Y8G("open",yl.bMT(12,12,t.initialDisclosureVisibility$))}},dependencies:[B4,E4,I4,_l,zl,C4,pl.MD,pl.bT,qf,pl.Jj,Xf],encapsulation:2});class _4{}var K4=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 X4=new m(Pe,"sectionOpen",{deserializer:e=>e}),q4={favorites:!0,allItems:!0};class Y4{constructor(){this.vaultPopupItemsService=(0,a.WQX)(J3),this.stateProvider=(0,a.WQX)(u),this.hasFilterOrSearchApplied=(0,wl.ot)(this.vaultPopupItemsService.hasFilterApplied$.pipe((0,l.T)(e=>e))),this.temporaryStateOverride=(0,a.vPA)(null),this.sectionOpenStateProvider=this.stateProvider.getGlobal(X4),this.sectionOpenStoredState=(0,wl.ot)(this.sectionOpenStateProvider.state$.pipe((0,l.T)(e=>null!=e?e:q4)),{initialValue:null}),this.sectionOpenDisplayState=(0,bl.EW)(()=>Object.assign(Object.assign({},this.sectionOpenStoredState()),this.temporaryStateOverride())),(0,bl.QZ)(()=>{this.hasFilterOrSearchApplied()?this.temporaryStateOverride.set(q4):this.temporaryStateOverride.set(null)},{allowSignalWrites:!0})}getOpenDisplayStateForSection(e){return(0,bl.EW)(()=>{var t;return null===(t=this.sectionOpenDisplayState())||void 0===t?void 0:t[e]})}updateSectionOpenStoredState(e,t){return K4(this,void 0,void 0,function*(){yield this.sectionOpenStateProvider.update(i=>Object.assign(Object.assign({},null!=i?i:q4),{[e]:t})),this.temporaryStateOverride.update(i=>null!==i?Object.assign(Object.assign({},i),{[e]:t}):i)})}}function W4(e,t){if(1&e&&(yl.nrm(0,"button",11),yl.nI1(1,"i18n")),2&e){const e=yl.XpG(3);yl.Y8G("cipher",e.cipher)("label",yl.bMT(1,2,"copyPassword"))}}function H4(e,t){if(1&e&&(yl.qex(0),yl.j41(1,"bit-item-action"),yl.nrm(2,"button",8),yl.nI1(3,"i18n"),yl.k0s(),yl.j41(4,"bit-item-action"),yl.DNE(5,W4,2,4,"button",9),yl.k0s(),yl.j41(6,"bit-item-action"),yl.nrm(7,"button",10),yl.nI1(8,"i18n"),yl.k0s(),yl.bVm()),2&e){const e=yl.XpG(2);yl.R7$(2),yl.Y8G("cipher",e.cipher)("label",yl.bMT(3,5,"copyUsername")),yl.R7$(3),yl.Y8G("ngIf",e.cipher.viewPassword),yl.R7$(2),yl.Y8G("cipher",e.cipher)("label",yl.bMT(8,7,"copyVerificationCode"))}}function J4(e,t){if(1&e&&(yl.nrm(0,"button",13),yl.nI1(1,"i18n")),2&e){const e=yl.XpG(3);yl.Y8G("label",yl.brH(1,3,"copyFieldCipherName",e.singleCopyableLogin.key,e.cipher.name))("appCopyField",e.singleCopyableLogin.field)("cipher",e.cipher)}}function Z4(e,t){if(1&e&&(yl.j41(0,"button",18),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()),2&e){const e=yl.XpG(4);yl.Y8G("cipher",e.cipher),yl.R7$(),yl.SpI(" ",yl.bMT(2,2,"copyPassword")," ")}}function Q4(e,t){if(1&e&&(yl.qex(0),yl.nrm(1,"button",14),yl.nI1(2,"i18n"),yl.nI1(3,"i18n"),yl.j41(4,"bit-menu",null,1)(6,"button",15),yl.EFF(7),yl.nI1(8,"i18n"),yl.k0s(),yl.DNE(9,Z4,3,4,"button",16),yl.j41(10,"button",17),yl.EFF(11),yl.nI1(12,"i18n"),yl.k0s()(),yl.bVm()),2&e){const e=yl.sdS(5),t=yl.XpG(3);yl.R7$(),yl.Y8G("label",t.hasLoginValues?yl.i5U(2,8,"copyInfoTitle",t.cipher.name):yl.bMT(3,11,"noValuesToCopy"))("disabled",!t.hasLoginValues)("bitMenuTriggerFor",e),yl.R7$(5),yl.Y8G("cipher",t.cipher),yl.R7$(),yl.SpI(" ",yl.bMT(8,13,"copyUsername")," "),yl.R7$(2),yl.Y8G("ngIf",t.cipher.viewPassword),yl.R7$(),yl.Y8G("cipher",t.cipher),yl.R7$(),yl.SpI(" ",yl.bMT(12,15,"copyVerificationCode")," ")}}function e8(e,t){if(1&e&&(yl.j41(0,"bit-item-action"),yl.DNE(1,J4,2,7,"button",12)(2,Q4,13,17,"ng-container",6),yl.k0s()),2&e){const e=yl.XpG(2);yl.R7$(),yl.Y8G("ngIf",e.singleCopyableLogin),yl.R7$(),yl.Y8G("ngIf",!e.singleCopyableLogin)}}function t8(e,t){if(1&e&&(yl.qex(0),yl.DNE(1,H4,9,9,"ng-container",7),yl.nI1(2,"async"),yl.DNE(3,e8,3,2,"ng-template",null,0,yl.C5r),yl.bVm()),2&e){const e=yl.sdS(4),t=yl.XpG();yl.R7$(),yl.Y8G("ngIf",yl.bMT(2,2,t.showQuickCopyActions$))("ngIfElse",e)}}function i8(e,t){if(1&e&&(yl.qex(0),yl.j41(1,"bit-item-action"),yl.nrm(2,"button",19),yl.nI1(3,"i18n"),yl.k0s(),yl.j41(4,"bit-item-action"),yl.nrm(5,"button",20),yl.nI1(6,"i18n"),yl.k0s(),yl.bVm()),2&e){const e=yl.XpG(2);yl.R7$(2),yl.Y8G("cipher",e.cipher)("label",yl.bMT(3,4,"copyNumber")),yl.R7$(3),yl.Y8G("cipher",e.cipher)("label",yl.bMT(6,6,"copySecurityCode"))}}function n8(e,t){if(1&e&&(yl.nrm(0,"button",22),yl.nI1(1,"i18n")),2&e){const e=yl.XpG(3);yl.Y8G("label",yl.brH(1,3,"copyFieldCipherName",e.singleCopyableCard.key,e.cipher.name))("appCopyField",e.singleCopyableCard.field)("cipher",e.cipher)}}function r8(e,t){if(1&e&&(yl.qex(0),yl.nrm(1,"button",14),yl.nI1(2,"i18n"),yl.nI1(3,"i18n"),yl.j41(4,"bit-menu",null,3)(6,"button",23),yl.EFF(7),yl.nI1(8,"i18n"),yl.k0s(),yl.j41(9,"button",24),yl.EFF(10),yl.nI1(11,"i18n"),yl.k0s()(),yl.bVm()),2&e){const e=yl.sdS(5),t=yl.XpG(3);yl.R7$(),yl.Y8G("label",t.hasCardValues?yl.i5U(2,7,"copyInfoTitle",t.cipher.name):yl.bMT(3,10,"noValuesToCopy"))("disabled",!t.hasCardValues)("bitMenuTriggerFor",e),yl.R7$(5),yl.Y8G("cipher",t.cipher),yl.R7$(),yl.SpI(" ",yl.bMT(8,12,"copyNumber")," "),yl.R7$(2),yl.Y8G("cipher",t.cipher),yl.R7$(),yl.SpI(" ",yl.bMT(11,14,"copySecurityCode")," ")}}function s8(e,t){if(1&e&&(yl.j41(0,"bit-item-action"),yl.DNE(1,n8,2,7,"button",21)(2,r8,12,16,"ng-container",6),yl.k0s()),2&e){const e=yl.XpG(2);yl.R7$(),yl.Y8G("ngIf",e.singleCopyableCard),yl.R7$(),yl.Y8G("ngIf",!e.singleCopyableCard)}}function o8(e,t){if(1&e&&(yl.qex(0),yl.DNE(1,i8,7,8,"ng-container",7),yl.nI1(2,"async"),yl.DNE(3,s8,3,2,"ng-template",null,2,yl.C5r),yl.bVm()),2&e){const e=yl.sdS(4),t=yl.XpG();yl.R7$(),yl.Y8G("ngIf",yl.bMT(2,2,t.showQuickCopyActions$))("ngIfElse",e)}}function a8(e,t){if(1&e&&(yl.nrm(0,"button",22),yl.nI1(1,"i18n")),2&e){const e=yl.XpG(2);yl.Y8G("label",yl.brH(1,3,"copyFieldCipherName",e.singleCopyableIdentity.key,e.cipher.name))("appCopyField",e.singleCopyableIdentity.field)("cipher",e.cipher)}}function l8(e,t){if(1&e&&(yl.qex(0),yl.nrm(1,"button",14),yl.nI1(2,"i18n"),yl.nI1(3,"i18n"),yl.j41(4,"bit-menu",null,4)(6,"button",15),yl.EFF(7),yl.nI1(8,"i18n"),yl.k0s(),yl.j41(9,"button",25),yl.EFF(10),yl.nI1(11,"i18n"),yl.k0s(),yl.j41(12,"button",26),yl.EFF(13),yl.nI1(14,"i18n"),yl.k0s(),yl.j41(15,"button",27),yl.EFF(16),yl.nI1(17,"i18n"),yl.k0s()(),yl.bVm()),2&e){const e=yl.sdS(5),t=yl.XpG(2);yl.R7$(),yl.Y8G("label",t.hasIdentityValues?yl.i5U(2,11,"copyInfoTitle",t.cipher.name):yl.bMT(3,14,"noValuesToCopy"))("disabled",!t.hasIdentityValues)("bitMenuTriggerFor",e),yl.R7$(5),yl.Y8G("cipher",t.cipher),yl.R7$(),yl.SpI(" ",yl.bMT(8,16,"copyUsername")," "),yl.R7$(2),yl.Y8G("cipher",t.cipher),yl.R7$(),yl.SpI(" ",yl.bMT(11,18,"copyEmail")," "),yl.R7$(2),yl.Y8G("cipher",t.cipher),yl.R7$(),yl.SpI(" ",yl.bMT(14,20,"copyPhone")," "),yl.R7$(2),yl.Y8G("cipher",t.cipher),yl.R7$(),yl.SpI(" ",yl.bMT(17,22,"copyAddress")," ")}}function c8(e,t){if(1&e&&(yl.j41(0,"bit-item-action"),yl.DNE(1,a8,2,7,"button",21)(2,l8,18,24,"ng-container",6),yl.k0s()),2&e){const e=yl.XpG();yl.R7$(),yl.Y8G("ngIf",e.singleCopyableIdentity),yl.R7$(),yl.Y8G("ngIf",!e.singleCopyableIdentity)}}function u8(e,t){if(1&e&&(yl.j41(0,"bit-item-action"),yl.nrm(1,"button",28),yl.nI1(2,"i18n"),yl.nI1(3,"i18n"),yl.k0s()),2&e){const e=yl.XpG();yl.R7$(),yl.Y8G("label",e.hasSecureNoteValue?yl.i5U(2,2,"copyNoteTitle",e.cipher.name):yl.bMT(3,5,"noValuesToCopy"))("cipher",e.cipher)}}function d8(e,t){if(1&e&&(yl.j41(0,"bit-item-action"),yl.nrm(1,"button",14),yl.nI1(2,"i18n"),yl.nI1(3,"i18n"),yl.j41(4,"bit-menu",null,5)(6,"button",29),yl.EFF(7),yl.nI1(8,"i18n"),yl.k0s(),yl.j41(9,"button",30),yl.EFF(10),yl.nI1(11,"i18n"),yl.k0s(),yl.j41(12,"button",31),yl.EFF(13),yl.nI1(14,"i18n"),yl.k0s()()()),2&e){const e=yl.sdS(5),t=yl.XpG();yl.R7$(),yl.Y8G("label",t.hasSshKeyValues?yl.i5U(2,9,"copyInfoTitle",t.cipher.name):yl.bMT(3,12,"noValuesToCopy"))("disabled",!t.hasSshKeyValues)("bitMenuTriggerFor",e),yl.R7$(5),yl.Y8G("cipher",t.cipher),yl.R7$(),yl.SpI(" ",yl.bMT(8,14,"copyPrivateKey")," "),yl.R7$(2),yl.Y8G("cipher",t.cipher),yl.R7$(),yl.SpI(" ",yl.bMT(11,16,"copyPublicKey")," "),yl.R7$(2),yl.Y8G("cipher",t.cipher),yl.R7$(),yl.SpI(" ",yl.bMT(14,18,"copyFingerprint")," ")}}Y4.ɵfac=function(e){return new(e||Y4)},Y4.ɵprov=a.jDH({token:Y4,factory:Y4.ɵfac,providedIn:"root"});class h8{get singleCopyableLogin(){return!this.cipher.viewPassword&&hE.hasCopyableValue(this.cipher,"username")&&hE.hasCopyableValue(this.cipher,"password")&&!hE.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})=>hE.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)(t4).showQuickCopyActions$,this.CipherViewLikeUtils=hE,this.CipherType=CR}getNumberOfLoginValues(){if(hE.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(hE.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(hE.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 hE.isCipherListView(this.cipher)?this.cipher.copyableFields.includes("SecureNotes")?1:0:this.cipher.notes?1:0}getNumberOfSshKeyValues(){return hE.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 p8(e,t){if(1&e&&(yl.j41(0,"p",10),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s(),yl.j41(3,"bit-callout",11)(4,"div",5),yl.EFF(5),yl.k0s()()),2&e){const e=yl.XpG();yl.R7$(),yl.SpI(" ",yl.bMT(2,4,"savedWebsite")," "),yl.R7$(2),yl.Y8G("title",null),yl.R7$(),yl.Y8G("appA11yTitle",e.savedUrls()[0]),yl.R7$(),yl.SpI(" ",e.savedUrls()[0]," ")}}function f8(e,t){if(1&e&&(yl.j41(0,"div",16)(1,"bit-callout",11)(2,"div",5),yl.EFF(3),yl.k0s()()()),2&e){const e=t.$implicit;yl.R7$(),yl.Y8G("title",null),yl.R7$(),yl.Y8G("appA11yTitle",e),yl.R7$(),yl.SpI(" ",e," ")}}function v8(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"div",12)(1,"p",13),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.j41(4,"button",14),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.toggleSavedUrlExpandedState())}),yl.EFF(5),yl.nI1(6,"i18n"),yl.k0s()(),yl.j41(7,"div",15),yl.Z7z(8,f8,4,3,"div",16,yl.fX1),yl.k0s()}if(2&e){const e=yl.XpG();yl.R7$(2),yl.SpI(" ",yl.i5U(3,3,"savedWebsites",e.savedUrls().length.toString())," "),yl.R7$(3),yl.SpI(" ",yl.bMT(6,6,e.savedUrlsExpanded()?"showLess":"showAll")," "),yl.R7$(2),yl.Y8G("ngClass",e.savedUrlsListClass()),yl.R7$(),yl.Dyx(e.savedUrls())}}function m8(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",17),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.autofillAndAddUrl())}),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()}2&e&&(yl.R7$(),yl.SpI(" ",yl.bMT(2,1,"autofillAndAddWebsite")," "))}h8.ɵfac=function(e){return new(e||h8)(yl.rXU(Pl))},h8.ɵcmp=yl.VBU({type:h8,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&&yl.DNE(0,t8,5,4,"ng-container",6)(1,o8,5,4,"ng-container",6)(2,c8,3,2,"bit-item-action",6)(3,u8,4,7,"bit-item-action",6)(4,d8,15,20,"bit-item-action",6),2&e&&(yl.Y8G("ngIf",t.CipherViewLikeUtils.getType(t.cipher)===t.CipherType.Login),yl.R7$(),yl.Y8G("ngIf",t.CipherViewLikeUtils.getType(t.cipher)===t.CipherType.Card),yl.R7$(),yl.Y8G("ngIf",t.CipherViewLikeUtils.getType(t.cipher)===t.CipherType.Identity),yl.R7$(),yl.Y8G("ngIf",t.CipherViewLikeUtils.getType(t.cipher)===t.CipherType.SecureNote),yl.R7$(),yl.Y8G("ngIf",t.CipherViewLikeUtils.getType(t.cipher)===t.CipherType.SshKey))},dependencies:[wP,SP,_l,zl,qf,Dh,gL,bL,LE,pl.MD,pl.bT,JE,Xf,pl.Jj],encapsulation:2});const g8=Object.freeze({AutofillAndUrlAdded:"added",AutofilledOnly:"autofilled",Canceled:"canceled"});class y8{constructor(){var e,t;this.params=(0,a.WQX)(nd.Qs),this.dialogRef=(0,a.WQX)(Xd),this.currentUrl=(0,a.vPA)(kd.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=kd.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,bl.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(g8.Canceled)}autofillAndAddUrl(){this.dialogRef.close(g8.AutofillAndUrlAdded)}autofillOnly(){this.dialogRef.close(g8.AutofilledOnly)}static open(e,t){return e.open(y8,Object.assign({},t))}}y8.ɵfac=function(e){return new(e||y8)},y8.ɵcmp=yl.VBU({type:y8,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&&(yl.j41(0,"bit-dialog",0),yl.nI1(1,"i18n"),yl.j41(2,"div",1)(3,"p",2),yl.EFF(4),yl.nI1(5,"i18n"),yl.k0s(),yl.nVh(6,p8,6,6),yl.nVh(7,v8,10,8),yl.j41(8,"p",3),yl.EFF(9),yl.nI1(10,"i18n"),yl.k0s(),yl.j41(11,"bit-callout",4)(12,"div",5),yl.EFF(13),yl.k0s()(),yl.j41(14,"div",6),yl.nVh(15,m8,3,3,"button",7),yl.j41(16,"button",8),yl.bIt("click",function(){return t.autofillOnly()}),yl.EFF(17),yl.nI1(18,"i18n"),yl.k0s(),yl.j41(19,"button",9),yl.bIt("click",function(){return t.close()}),yl.EFF(20),yl.nI1(21,"i18n"),yl.k0s()()()()),2&e&&(yl.Y8G("title",yl.bMT(1,11,"confirmAutofill")),yl.R7$(4),yl.SpI(" ",yl.bMT(5,13,"confirmAutofillDesc")," "),yl.R7$(2),yl.vxM(1===t.savedUrls().length?6:-1),yl.R7$(),yl.vxM(t.savedUrls().length>1?7:-1),yl.R7$(2),yl.SpI(" ",yl.bMT(10,15,"currentWebsite")," "),yl.R7$(2),yl.Y8G("title",null),yl.R7$(),yl.Y8G("appA11yTitle",t.currentUrl()),yl.R7$(),yl.SpI(" ",t.currentUrl()," "),yl.R7$(2),yl.vxM(t.viewOnly()?-1:15),yl.R7$(2),yl.SpI(" ",yl.bMT(18,17,t.viewOnly()?"autofill":"autofillWithoutAdding")," "),yl.R7$(3),yl.SpI(" ",yl.bMT(21,19,"doNotAutofill")," "))},dependencies:[Xu,Ku,ed,pl.MD,pl.YU,dh,uh,Oh,Kb,Xl,Wl,qf,jb,Xf],encapsulation:2,changeDetection:0});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 w8(e,t){if(1&e){const e=yl.RV6();yl.qex(0),yl.j41(1,"button",4),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG(2);return a.Njj(t.doAutofill())}),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.bVm()}2&e&&(yl.R7$(2),yl.SpI(" ",yl.bMT(3,1,"autofill")," "))}function S8(e,t){if(1&e&&(yl.qex(0),yl.DNE(1,w8,4,3,"ng-container",3),yl.nI1(2,"async"),yl.bVm()),2&e){const e=yl.XpG();yl.R7$(),yl.Y8G("ngIf",yl.bMT(2,1,e.autofillAllowed$))}}function k8(e,t){if(1&e){const e=yl.RV6();yl.qex(0),yl.j41(1,"button",4),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.onView())}),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.bVm()}2&e&&(yl.R7$(2),yl.SpI(" ",yl.bMT(3,1,"view")," "))}function I8(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",4),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.edit())}),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()}2&e&&(yl.R7$(),yl.SpI(" ",yl.bMT(2,1,"edit")," "))}function C8(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"a",7),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG(2);return a.Njj(t.clone())}),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()}2&e&&(yl.R7$(),yl.SpI(" ",yl.bMT(2,1,"clone")," "))}function T8(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"a",7),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG(2);return a.Njj(t.conditionallyNavigateToAssignCollections())}),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()}2&e&&(yl.R7$(),yl.SpI(" ",yl.bMT(2,1,"assignToCollections")," "))}function P8(e,t){if(1&e&&(yl.qex(0),yl.DNE(1,C8,3,3,"a",6),yl.nI1(2,"async"),yl.DNE(3,T8,3,3,"a",6),yl.nI1(4,"async"),yl.bVm()),2&e){const e=yl.XpG();yl.R7$(),yl.Y8G("ngIf",yl.bMT(2,2,e.canClone$)),yl.R7$(2),yl.Y8G("ngIf",yl.bMT(4,4,e.canAssignCollections$))}}function F8(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",4),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG(2);return a.Njj(t.archive())}),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()}2&e&&(yl.R7$(),yl.SpI(" ",yl.bMT(2,1,"archiveVerb")," "))}function R8(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",4),yl.nI1(1,"i18n"),yl.bIt("click",function(t){a.eBV(e);const i=yl.sdS(7);return a.Njj(i.promptForPremium(t))}),yl.j41(2,"div",8),yl.EFF(3),yl.nI1(4,"i18n"),yl.j41(5,"div",9),yl.nrm(6,"app-premium-badge",null,1),yl.k0s()()()}2&e&&(yl.BMQ("aria-label",yl.bMT(1,2,"upgradeToUseArchive")),yl.R7$(3),yl.SpI(" ",yl.bMT(4,4,"archiveVerb")," "))}function x8(e,t){if(1&e&&(yl.nVh(0,F8,3,3,"button",5),yl.nI1(1,"async"),yl.vZN(2,R8,8,6,"button",5)),2&e){const e=yl.XpG();yl.vxM(yl.bMT(1,1,e.canArchive$)?0:2)}}function A8(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",4),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.delete())}),yl.j41(1,"span",10),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s()()}2&e&&(yl.R7$(2),yl.SpI(" ",yl.bMT(3,1,"delete")," "))}class D8{set cipher(e){this._cipher$.next(e)}get cipher(){return this._cipher$.value}constructor(e,t,i,n,r,s,o,a,c,u,d,h,p,f){this.cipherService=e,this.passwordRepromptService=t,this.toastService=i,this.dialogService=n,this.router=r,this.i18nService=s,this.vaultPopupAutofillService=o,this.accountService=a,this.organizationService=c,this.cipherAuthorizationService=u,this.collectionService=d,this.restrictedItemTypesService=h,this.cipherArchiveService=p,this.domainSettingsService=f,this._cipher$=new fd.t({}),this.showViewOption=!1,this.hideAutofillOptions=!1,this.autofillAllowed$=this.vaultPopupAutofillService.autofillAllowed$,this.uriMatchStrategy$=this.domainSettingsService.resolvedDefaultUriMatchStrategy$,this.canClone$=(0,$o.z)([this._cipher$,this.restrictedItemTypesService.restricted$]).pipe((0,To.p)(([e])=>null!=e),(0,co.n)(([e,t])=>t.some(t=>t.cipherType===hE.getType(e))?new fd.t(!1):this.cipherAuthorizationService.canCloneCipher$(e))),this.canAssignCollections$=this.accountService.activeAccount$.pipe(Gp,(0,co.n)(e=>(0,$o.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(Gp,(0,co.n)(e=>this.cipherArchiveService.userCanArchive$(e))),this.canDelete$=this._cipher$.pipe((0,co.n)(e=>this.cipherAuthorizationService.canDeleteCipher$(e)))}get canEdit(){return this.cipher.edit}get canViewPassword(){return this.cipher.viewPassword}get decryptionFailure(){return hE.decryptionFailure(this.cipher)}get canAutofill(){return[CR.Login,CR.Card,CR.Identity].includes(hE.getType(this.cipher))}get isLogin(){return hE.getType(this.cipher)===CR.Login}get favoriteText(){return this.cipher.favorite?"unfavorite":"favorite"}doAutofillAndSave(){return b8(this,void 0,void 0,function*(){const e=yield this.cipherService.getFullCipherView(this.cipher);yield this.vaultPopupAutofillService.doAutofillAndSave(e)})}doAutofill(){return b8(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=o.length>0&&o.every(e=>e.uri&&e.match===ZD.Exact),l=yield(0,ho._)(this.uriMatchStrategy$);if(a||l===ZD.Exact)return void(yield this.dialogService.openSimpleDialog({title:{key:"cannotAutofill"},content:{key:"cannotAutofillExactMatch"},type:"info",acceptButtonText:{key:"okay"},cancelButtonText:null}));const c=yield(0,ho._)(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=y8.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,ho._)(u.closed)){case g8.Canceled:return;case g8.AutofilledOnly:return void(yield this.vaultPopupAutofillService.doAutofill(s,!0,!0));case g8.AutofillAndUrlAdded:return void(yield this.vaultPopupAutofillService.doAutofillAndSave(s,!1,!0))}})}onView(){return b8(this,void 0,void 0,function*(){(yield this.passwordRepromptService.passwordRepromptCheck(this.cipher))&&(yield this.router.navigate(["/view-cipher"],{queryParams:{cipherId:this.cipher.id,type:hE.getType(this.cipher)}}))})}toggleFavorite(){return b8(this,void 0,void 0,function*(){const e=yield this.cipherService.getFullCipherView(this.cipher);e.favorite=!e.favorite;const t=yield(0,ho._)(this.accountService.activeAccount$.pipe((0,l.T)(e=>null==e?void 0:e.id))),i=yield this.cipherService.encrypt(e,t);yield this.cipherService.updateWithServer(i),this.toastService.showToast({variant:"success",message:this.i18nService.t(e.favorite?"itemAddedToFavorites":"itemRemovedFromFavorites")})})}clone(){return b8(this,void 0,void 0,function*(){if(this.cipher.reprompt!==kR.Password||(yield this.passwordRepromptService.showPasswordPrompt())){if(hE.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:hE.getType(this.cipher).toString()}})}})}conditionallyNavigateToAssignCollections(){return b8(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 b8(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:hE.getType(this.cipher)}}))})}delete(){return b8(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,ho._)(this.accountService.activeAccount$.pipe(Gp));yield this.cipherService.softDeleteWithServer(this.cipher.id,e),this.toastService.showToast({variant:"success",message:this.i18nService.t("deletedItem")})})}archive(){return b8(this,void 0,void 0,function*(){if(!(yield this.passwordRepromptService.passwordRepromptCheck(this.cipher)))return;if(!(yield this.dialogService.openSimpleDialog({title:{key:"archiveItem"},content:{key:"archiveItemConfirmDesc"},type:"info"})))return;const e=yield(0,ho._)(this.accountService.activeAccount$.pipe(Gp));yield this.cipherArchiveService.archiveWithServer(this.cipher.id,e),this.toastService.showToast({variant:"success",message:this.i18nService.t("itemWasSentToArchive")})})}}D8.ɵfac=function(e){return new(e||D8)(yl.rXU(Fb),yl.rXU($E),yl.rXU(xb),yl.rXU(Jd),yl.rXU(ud.Ix),yl.rXU(Pl),yl.rXU(j3),yl.rXU(Ok),yl.rXU(AF),yl.rXU(t$),yl.rXU(BF),yl.rXU(vE),yl.rXU(BV),yl.rXU(oE))},D8.ɵcmp=yl.VBU({type:D8,selectors:[["app-item-more-options"]],inputs:{cipher:"cipher",showViewOption:[2,"showViewOption","showViewOption",o.L39],hideAutofillOptions:[2,"hideAutofillOptions","hideAutofillOptions",o.L39]},features:[yl.Jv_([{provide:sU,useClass:t1}])],decls:16,vars:19,consts:[["moreOptions",""],["badge",""],["type","button","bitIconButton","bwi-ellipsis-v","size","small",3,"label","disabled","bitMenuTriggerFor"],[4,"ngIf"],["type","button","bitMenuItem","",3,"click"],["type","button","bitMenuItem",""],["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){const e=yl.RV6();yl.j41(0,"bit-item-action"),yl.nrm(1,"button",2),yl.nI1(2,"i18n"),yl.j41(3,"bit-menu",null,0),yl.DNE(5,S8,3,3,"ng-container",3)(6,k8,4,3,"ng-container",3),yl.j41(7,"button",4),yl.bIt("click",function(){return a.eBV(e),a.Njj(t.toggleFavorite())}),yl.EFF(8),yl.nI1(9,"i18n"),yl.k0s(),yl.nVh(10,I8,3,3,"button",5),yl.DNE(11,P8,5,6,"ng-container",3),yl.nVh(12,x8,3,3),yl.nI1(13,"async"),yl.nVh(14,A8,4,3,"button",5),yl.nI1(15,"async"),yl.k0s()()}if(2&e){const e=yl.sdS(4);yl.R7$(),yl.Y8G("label",yl.i5U(2,10,"moreOptionsLabel",t.cipher.name))("disabled",t.decryptionFailure)("bitMenuTriggerFor",e),yl.R7$(4),yl.Y8G("ngIf",t.canAutofill&&!t.hideAutofillOptions),yl.R7$(),yl.Y8G("ngIf",t.showViewOption),yl.R7$(2),yl.SpI(" ",yl.bMT(9,13,t.favoriteText)," "),yl.R7$(2),yl.vxM(t.canEdit?10:-1),yl.R7$(),yl.Y8G("ngIf",t.canEdit&&t.canViewPassword),yl.R7$(),yl.vxM(yl.bMT(13,15,t.showArchive$)?12:-1),yl.R7$(2),yl.vxM(yl.bMT(15,17,t.canDelete$)?14:-1)}},dependencies:[wP,SP,_l,zl,Dh,gL,bL,LE,pl.MD,pl.bT,qf,sw.iI,uU,pl.Jj,Xf],encapsulation:2});var E8=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 $8=(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}),O8=(e,t)=>({"group-hover/vault-section-header:tw-hidden group-focus-visible/vault-section-header:tw-hidden":e,"tw-hidden":t}),U8=(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}),M8=e=>({"!tw-mb-0":e});function N8(e,t){1&e&&yl.eu8(0)}function V8(e,t){1&e&&yl.eu8(0)}function B8(e,t){1&e&&yl.eu8(0)}function j8(e,t){if(1&e){const e=yl.RV6();yl.qex(0),yl.j41(1,"button",7),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG(2);return a.Njj(t.toggleSectionOpen())}),yl.DNE(2,N8,1,0,"ng-container",8),yl.k0s(),yl.DNE(3,V8,1,0,"ng-container",8),yl.j41(4,"bit-disclosure",9,3),yl.bIt("openChange",function(){a.eBV(e);const t=yl.XpG(2);return a.Njj(t.rerenderViewport())}),yl.DNE(6,B8,1,0,"ng-container",8),yl.k0s(),yl.bVm()}if(2&e){const e=yl.sdS(5),t=yl.XpG(2),i=yl.sdS(2),n=yl.sdS(4),r=yl.sdS(6);yl.R7$(),yl.Y8G("ngClass",yl.l_i(6,$8,!t.sectionOpenState(),t.sectionOpenState()))("bitDisclosureTriggerFor",e),yl.R7$(),yl.Y8G("ngTemplateOutlet",i),yl.R7$(),yl.Y8G("ngTemplateOutlet",n),yl.R7$(),yl.Y8G("open",t.sectionOpenState()),yl.R7$(2),yl.Y8G("ngTemplateOutlet",r)}}function G8(e,t){1&e&&yl.eu8(0)}function L8(e,t){1&e&&yl.eu8(0)}function z8(e,t){1&e&&yl.eu8(0)}function _8(e,t){if(1&e&&(yl.qex(0),yl.j41(1,"div",10),yl.DNE(2,G8,1,0,"ng-container",8),yl.k0s(),yl.DNE(3,L8,1,0,"ng-container",8)(4,z8,1,0,"ng-container",8),yl.bVm()),2&e){yl.XpG(2);const e=yl.sdS(2),t=yl.sdS(4),i=yl.sdS(6);yl.R7$(2),yl.Y8G("ngTemplateOutlet",e),yl.R7$(),yl.Y8G("ngTemplateOutlet",t),yl.R7$(),yl.Y8G("ngTemplateOutlet",i)}}function K8(e,t){if(1&e&&(yl.j41(0,"bit-section",5),yl.DNE(1,j8,7,9,"ng-container",6)(2,_8,5,3,"ng-container",6),yl.k0s()),2&e){const e=yl.XpG();yl.Y8G("disableMargin",e.disableSectionMargin()),yl.R7$(),yl.Y8G("ngIf",e.collapsibleKey()),yl.R7$(),yl.Y8G("ngIf",!e.collapsibleKey())}}function X8(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",17),yl.nI1(1,"i18n"),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG(2);return a.Njj(t.onRefresh.emit())}),yl.k0s()}2&e&&yl.Y8G("label",yl.bMT(1,1,"refresh"))}function q8(e,t){if(1&e&&(yl.j41(0,"span",18),yl.nrm(1,"i",19),yl.k0s()),2&e){const e=yl.XpG(2);yl.R7$(),yl.Y8G("ngClass",yl.l_i(1,U8,!e.sectionOpenState(),e.sectionOpenState()))}}function Y8(e,t){if(1&e&&(yl.j41(0,"bit-section-header",11)(1,"h2",12),yl.EFF(2),yl.k0s(),yl.DNE(3,X8,2,3,"button",13),yl.j41(4,"span",14)(5,"span",15),yl.EFF(6),yl.k0s(),yl.DNE(7,q8,2,4,"span",16),yl.k0s()()),2&e){const e=yl.XpG();yl.R7$(2),yl.SpI(" ",e.title()," "),yl.R7$(),yl.Y8G("ngIf",e.showRefresh()),yl.R7$(2),yl.Y8G("ngClass",yl.l_i(5,O8,e.collapsibleKey()&&e.sectionOpenState(),e.collapsibleKey()&&!e.sectionOpenState())),yl.R7$(),yl.SpI(" ",e.ciphers().length," "),yl.R7$(),yl.Y8G("ngIf",e.collapsibleKey())}}function W8(e,t){if(1&e&&(yl.j41(0,"div",21),yl.EFF(1),yl.k0s()),2&e){const e=yl.XpG(2);yl.Y8G("ngClass",yl.eq3(2,M8,e.disableDescriptionMargin())),yl.R7$(),yl.SpI(" ",e.description()," ")}}function H8(e,t){if(1&e&&yl.DNE(0,W8,2,4,"div",20),2&e){const e=yl.XpG();yl.Y8G("ngIf",e.description())}}function J8(e,t){if(1&e&&(yl.qex(0),yl.j41(1,"h3",25),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.bVm()),2&e){const e=yl.XpG().$implicit;yl.R7$(2),yl.SpI(" ",yl.bMT(3,1,e.subHeaderKey)," ")}}function Z8(e,t){if(1&e&&yl.nrm(0,"i",36),2&e){const e=yl.XpG().$implicit,t=yl.XpG(3);yl.Y8G("tierType",e.organization.productTierType)("size","small")("appA11yTitle",t.orgIconTooltip(e))}}function Q8(e,t){1&e&&(yl.nrm(0,"i",37),yl.nI1(1,"i18n")),2&e&&yl.Y8G("appA11yTitle",yl.bMT(1,1,"attachments"))}function e6(e,t){var i;if(1&e){const e=yl.RV6();yl.j41(0,"bit-item-action")(1,"button",38),yl.nI1(2,"i18n"),yl.nI1(3,"i18n"),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG().$implicit,i=yl.XpG(3);return a.Njj(i.doAutofill(t))}),yl.EFF(4),yl.nI1(5,"i18n"),yl.k0s()()}if(2&e){const e=yl.XpG().$implicit,t=yl.XpG(3);yl.R7$(),yl.Y8G("title",null!==(i=t.autofillShortcutTooltip())&&void 0!==i?i:yl.i5U(2,3,"autofillTitle",e.name)),yl.BMQ("aria-label",yl.i5U(3,6,"autofillTitle",e.name)),yl.R7$(3),yl.SpI(" ",yl.bMT(5,9,"fill")," ")}}function t6(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"bit-item-action")(1,"button",39),yl.nI1(2,"i18n"),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG().$implicit,i=yl.XpG(3);return a.Njj(i.launchCipher(t))}),yl.k0s()()}if(2&e){const e=yl.XpG().$implicit;yl.R7$(),yl.Y8G("label",yl.i5U(2,1,"launchWebsiteName",e.name))}}function i6(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"bit-item")(1,"button",26),yl.nI1(2,"i18n"),yl.bIt("click",function(){const t=a.eBV(e).$implicit,i=yl.XpG(3);return a.Njj(i.primaryActionOnSelect(t))})("dblclick",function(){const t=a.eBV(e).$implicit,i=yl.XpG(3);return a.Njj(i.launchCipher(t))}),yl.j41(3,"div",27),yl.nrm(4,"app-vault-icon",28),yl.k0s(),yl.j41(5,"span",29),yl.EFF(6),yl.k0s(),yl.j41(7,"div",30),yl.DNE(8,Z8,1,3,"i",31)(9,Q8,2,3,"i",32),yl.k0s(),yl.j41(10,"span",33),yl.EFF(11),yl.k0s()(),yl.qex(12,34),yl.DNE(13,e6,6,11,"bit-item-action",6)(14,t6,3,4,"bit-item-action",6),yl.nrm(15,"app-item-copy-actions",28)(16,"app-item-more-options",35),yl.bVm(),yl.k0s()}if(2&e){let e;const i=t.$implicit,n=yl.XpG(3);yl.R7$(),yl.HbH(n.itemHeightClass),yl.Y8G("appA11yTitle",yl.brH(2,14,n.cipherItemTitleKey()(i),i.name,null==(e=n.CipherViewLikeUtils.getLogin(i))?null:e.username)),yl.R7$(3),yl.Y8G("cipher",i),yl.R7$(2),yl.JRh(i.name),yl.R7$(2),yl.Y8G("ngIf",i.organizationId),yl.R7$(),yl.Y8G("ngIf",n.CipherViewLikeUtils.hasAttachments(i)),yl.R7$(2),yl.JRh(n.CipherViewLikeUtils.subtitle(i)),yl.R7$(2),yl.Y8G("ngIf",!n.hideAutofillButton()),yl.R7$(),yl.Y8G("ngIf",!n.showAutofillButton()&&n.CipherViewLikeUtils.canLaunch(i)),yl.R7$(),yl.Y8G("cipher",i),yl.R7$(),yl.Y8G("cipher",i)("hideAutofillOptions",n.hideAutofillMenuOptions())("showViewOption",n.primaryActionAutofill())}}function n6(e,t){if(1&e&&(yl.qex(0),yl.DNE(1,J8,4,3,"ng-container",6),yl.j41(2,"cdk-virtual-scroll-viewport",23),yl.nI1(3,"async"),yl.DNE(4,i6,17,18,"bit-item",24),yl.k0s(),yl.bVm()),2&e){const e=t.$implicit,i=yl.XpG(2);yl.R7$(),yl.Y8G("ngIf",e.subHeaderKey),yl.R7$(),yl.Y8G("itemSize",yl.bMT(3,3,i.itemHeight$)),yl.R7$(2),yl.Y8G("cdkVirtualForOf",e.ciphers)}}function r6(e,t){if(1&e&&(yl.j41(0,"bit-item-group"),yl.DNE(1,n6,5,5,"ng-container",22),yl.k0s()),2&e){const e=yl.XpG();yl.R7$(),yl.Y8G("ngForOf",e.cipherGroups())}}class s6{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)(_4),this.vaultPopupSectionService=(0,a.WQX)(Y4),this.CipherViewLikeUtils=hE,this.sectionOpenState=(0,bl.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,bl.EW)(()=>{const e=this.ciphers();if(!this.groupByType()&&e.length>0)return[{ciphers:e}];const t={};return e.forEach(e=>{let i="all";switch(hE.getType(e)){case CR.Card:i="cards";break;case CR.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 yl.bkB,this.currentURIIsBlocked=(0,wl.ot)(this.vaultPopupAutofillService.currentTabIsOnBlocklist$),this.cipherItemTitleKey=(0,bl.EW)(()=>e=>{const t=hE.getLogin(e),i=null!=(null==t?void 0:t.username),n=this.primaryActionAutofill()&&!this.currentURIIsBlocked()?"autofillTitle":"viewItemTitle";return i?`${n}WithField`:n}),this.showAutofillButton=(0,o.hFB)(!1,{transform:o.L39}),this.hideAutofillButton=(0,bl.EW)(()=>!this.showAutofillButton()||this.currentURIIsBlocked()||this.primaryActionAutofill()),this.hideAutofillMenuOptions=(0,bl.EW)(()=>this.currentURIIsBlocked()||this.showAutofillButton()),this.primaryActionAutofill=(0,o.hFB)(!1,{transform:o.L39}),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 E8(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}`)}})}primaryActionOnSelect(e){return this.primaryActionAutofill()&&!this.currentURIIsBlocked()?this.doAutofill(e):this.onViewCipher(e)}launchCipher(e){return E8(this,void 0,void 0,function*(){const t=hE.getLaunchUri(e);if(!hE.canLaunch(e)||!t)return;null!=this.viewCipherTimeout&&(window.clearTimeout(this.viewCipherTimeout),this.viewCipherTimeout=void 0);const i=yield(0,ho._)(this.accountService.activeAccount$.pipe(Gp));yield this.cipherService.updateLastLaunchedDate(e.id,i),yield tl.createNewTab(t),rl.inPopup(window)&&tl.closePopup(window)})}doAutofill(e){return E8(this,void 0,void 0,function*(){if(!hE.isCipherListView(e))return void(yield this.vaultPopupAutofillService.doAutofill(e));const t=yield(0,ho._)(this.accountService.activeAccount$.pipe(Gp)),i=yield this.cipherService.get(e.id,t),n=yield this.cipherService.decrypt(i,t);yield this.vaultPopupAutofillService.doAutofill(n)})}onViewCipher(e){return E8(this,void 0,void 0,function*(){null==this.viewCipherTimeout&&(this.viewCipherTimeout=window.setTimeout(()=>E8(this,void 0,void 0,function*(){try{if(hE.decryptionFailure(e))return void GG.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}}),hE.canLaunch(e)?200:0))})}toggleSectionOpen(){return E8(this,void 0,void 0,function*(){this.collapsibleKey()&&(yield this.vaultPopupSectionService.updateSectionOpenStoredState(this.collapsibleKey(),this.disclosure.open()))})}rerenderViewport(){setTimeout(()=>{this.viewPort.checkViewportSize()})}}function o6(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"app-vault-list-items-container",1),yl.nI1(1,"async"),yl.nI1(2,"i18n"),yl.nI1(3,"async"),yl.nI1(4,"i18n"),yl.nI1(5,"async"),yl.nI1(6,"async"),yl.bIt("onRefresh",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.refreshCurrentTab())}),yl.k0s()}if(2&e){const e=t.ngIf,i=yl.XpG();yl.Y8G("ciphers",e)("title",yl.bMT(2,9,yl.bMT(1,7,i.currentURIIsBlocked$)?"itemSuggestions":"autofillSuggestions"))("showRefresh",i.showRefresh)("description",yl.bMT(3,11,i.showEmptyAutofillTip$)?yl.bMT(4,13,"autofillSuggestionsTip"):void 0)("disableDescriptionMargin",yl.bMT(5,15,i.showEmptyAutofillTip$))("primaryActionAutofill",yl.bMT(6,17,i.clickItemsToAutofillVaultView$))("groupByType",i.groupByType())}}s6.ɵfac=function(e){return new(e||s6)(yl.rXU(Pl),yl.rXU(j3),yl.rXU($E),yl.rXU(Fb),yl.rXU(ud.Ix),yl.rXU(Eb),yl.rXU(Jd),yl.rXU(Ok))},s6.ɵcmp=yl.VBU({type:s6,selectors:[["app-vault-list-items-container"]],viewQuery:function(e,t){if(1&e&&(yl.GBs(hl.d6,5),yl.GBs(I4,5)),2&e){let e;yl.mGM(e=yl.lsd())&&(t.viewPort=e.first),yl.mGM(e=yl.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"],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"],[4,"cdkVirtualFor","cdkVirtualForOf"],[1,"tw-text-muted","tw-text-xs","tw-font-medium","tw-pl-1","tw-mb-1","bit-compact:tw-m-0"],["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","hideAutofillOptions","showViewOption"],["slot","default-trailing","appOrgIcon","",3,"tierType","size","appA11yTitle"],[1,"bwi","bwi-paperclip","bwi-sm",3,"appA11yTitle"],["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&&yl.DNE(0,K8,3,3,"bit-section",4)(1,Y8,8,8,"ng-template",null,0,yl.C5r)(3,H8,1,1,"ng-template",null,1,yl.C5r)(5,r6,2,1,"ng-template",null,2,yl.C5r),2&e&&yl.Y8G("ngIf",t.cipherGroups().length>0||t.description())},dependencies:[pl.MD,pl.YU,pl.Sq,pl.bT,pl.T3,wP,IP,FP,SP,RP,Xu,Kc,_c,_l,zl,ZR,Xl,Wl,qf,jb,GO,ex,h8,D8,ZE,hl.E9,hl.yg,hl.E$,hl.d6,I4,C4,vh,pl.Jj,Xf],encapsulation:2,changeDetection:0});class a6{constructor(e,t,i){this.vaultPopupItemsService=e,this.vaultPopupAutofillService=t,this.vaultSettingsService=i,this.autofillCiphers$=this.vaultPopupItemsService.autoFillCiphers$,this.showRefresh=rl.inSidebar(window),this.clickItemsToAutofillVaultView$=this.vaultSettingsService.clickItemsToAutofillVaultView$.pipe((0,sd.Z)(!0)),this.groupByType=(0,wl.ot)(this.vaultPopupItemsService.hasFilterApplied$.pipe((0,l.T)(e=>!e))),this.showEmptyAutofillTip$=(0,$o.z)([this.vaultPopupItemsService.hasFilterApplied$,this.autofillCiphers$,this.vaultPopupAutofillService.autofillAllowed$]).pipe((0,l.T)(([e,t,i])=>!e&&i&&0===t.filter(e=>hE.getType(e)==CR.Login).length)),this.currentURIIsBlocked$=this.vaultPopupAutofillService.currentTabIsOnBlocklist$}refreshCurrentTab(){this.vaultPopupAutofillService.refreshCurrentTab()}}a6.ɵfac=function(e){return new(e||a6)(yl.rXU(J3),yl.rXU(j3),yl.rXU(Zq))},a6.ɵcmp=yl.VBU({type:a6,selectors:[["app-autofill-vault-list-items"]],decls:2,vars:3,consts:[["showAutofillButton","",3,"ciphers","title","showRefresh","description","disableDescriptionMargin","primaryActionAutofill","groupByType","onRefresh",4,"ngIf"],["showAutofillButton","",3,"onRefresh","ciphers","title","showRefresh","description","disableDescriptionMargin","primaryActionAutofill","groupByType"]],template:function(e,t){1&e&&(yl.DNE(0,o6,7,19,"app-vault-list-items-container",0),yl.nI1(1,"async")),2&e&&yl.Y8G("ngIf",yl.bMT(1,1,t.autofillCiphers$))},dependencies:[pl.MD,pl.bT,Xl,s6,qf,_l,pl.Jj,Xf],encapsulation:2});var l6=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 c6=()=>["/add-cipher"],u6=()=>[];function d6(e,t){if(1&e&&(yl.j41(0,"div",10)(1,"bit-no-items",11),yl.qex(2,12),yl.EFF(3),yl.nI1(4,"i18n"),yl.bVm(),yl.qex(5,13),yl.j41(6,"p",14),yl.EFF(7),yl.nI1(8,"i18n"),yl.k0s(),yl.bVm(),yl.j41(9,"a",15),yl.EFF(10),yl.nI1(11,"i18n"),yl.k0s()()()),2&e){const e=yl.XpG(2);yl.R7$(),yl.Y8G("icon",e.vaultIcon),yl.R7$(2),yl.JRh(yl.bMT(4,5,"yourVaultIsEmpty")),yl.R7$(4),yl.SpI(" ",yl.bMT(8,7,"emptyVaultDescription")," "),yl.R7$(2),yl.Y8G("routerLink",yl.lJ4(11,c6)),yl.R7$(),yl.SpI(" ",yl.bMT(11,9,"newLogin")," ")}}function h6(e,t){if(1&e&&yl.DNE(0,d6,12,12,"div",9),2&e){const e=yl.XpG();yl.Y8G("ngIf",e.vaultState===e.VaultStateEnum.Empty)}}function p6(e,t){1&e&&yl.eu8(0)}function f6(e,t){if(1&e&&(yl.j41(0,"vault-fade-in-out"),yl.DNE(1,p6,1,0,"ng-container",16),yl.k0s()),2&e){yl.XpG(2);const e=yl.sdS(11);yl.R7$(),yl.Y8G("ngTemplateOutlet",e)}}function v6(e,t){if(1&e&&yl.DNE(0,f6,2,1,"vault-fade-in-out",8),2&e){const e=yl.XpG();yl.Y8G("ngIf",e.vaultState===e.VaultStateEnum.Empty)}}function m6(e,t){1&e&&yl.eu8(0)}function g6(e,t){if(1&e&&yl.DNE(0,m6,1,0,"ng-container",16),2&e){yl.XpG();const e=yl.sdS(11);yl.Y8G("ngTemplateOutlet",e)}}function y6(e,t){1&e&&yl.nrm(0,"blocked-injection-banner",17)}function b6(e,t){if(1&e){const e=yl.RV6();yl.qex(0),yl.j41(1,"bit-spotlight",18),yl.nI1(2,"i18n"),yl.nI1(3,"i18n"),yl.nI1(4,"i18n"),yl.bIt("onButtonClick",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.showPremiumDialog())})("onDismiss",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.dismissVaultNudgeSpotlight(t.NudgeType.PremiumUpgrade))}),yl.k0s(),yl.bVm()}2&e&&(yl.R7$(),yl.Y8G("title",yl.bMT(2,3,"unlockAdvancedSecurity"))("subtitle",yl.bMT(3,5,"unlockAdvancedSecurityDesc"))("buttonText",yl.bMT(4,7,"explorePremium")))}function w6(e,t){if(1&e){const e=yl.RV6();yl.qex(0),yl.j41(1,"bit-spotlight",18),yl.nI1(2,"i18n"),yl.nI1(3,"i18n"),yl.nI1(4,"i18n"),yl.bIt("onButtonClick",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.navigateToImport())})("onDismiss",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.dismissVaultNudgeSpotlight(t.NudgeType.EmptyVaultNudge))}),yl.k0s(),yl.bVm()}2&e&&(yl.R7$(),yl.Y8G("title",yl.bMT(2,3,"emptyVaultNudgeTitle"))("subtitle",yl.bMT(3,5,"emptyVaultNudgeBody"))("buttonText",yl.bMT(4,7,"emptyVaultNudgeButton")))}function S6(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"div",20)(1,"bit-spotlight",21),yl.nI1(2,"i18n"),yl.bIt("onDismiss",function(){a.eBV(e);const t=yl.XpG(2);return a.Njj(t.dismissVaultNudgeSpotlight(t.NudgeType.HasVaultItems))}),yl.j41(3,"ul",22)(4,"li"),yl.EFF(5),yl.nI1(6,"i18n"),yl.k0s(),yl.j41(7,"li"),yl.EFF(8),yl.nI1(9,"i18n"),yl.k0s(),yl.j41(10,"li"),yl.EFF(11),yl.nI1(12,"i18n"),yl.k0s()()()()}2&e&&(yl.R7$(),yl.Y8G("title",yl.bMT(2,4,"hasItemsVaultNudgeTitle")),yl.R7$(4),yl.JRh(yl.bMT(6,6,"hasItemsVaultNudgeBodyOne")),yl.R7$(3),yl.JRh(yl.bMT(9,8,"hasItemsVaultNudgeBodyTwo")),yl.R7$(3),yl.JRh(yl.bMT(12,10,"hasItemsVaultNudgeBodyThree")))}function k6(e,t){if(1&e&&(yl.qex(0),yl.nrm(1,"vault-at-risk-password-callout"),yl.DNE(2,S6,13,12,"div",19),yl.nI1(3,"async"),yl.nrm(4,"app-vault-header-v2"),yl.bVm()),2&e){const e=yl.XpG();yl.R7$(2),yl.Y8G("ngIf",yl.bMT(3,1,e.showHasItemsVaultSpotlight$))}}function I6(e,t){if(1&e&&(yl.j41(0,"div",25)(1,"bit-no-items",11),yl.qex(2,12),yl.EFF(3),yl.nI1(4,"i18n"),yl.bVm(),yl.qex(5,13),yl.EFF(6),yl.nI1(7,"i18n"),yl.bVm(),yl.k0s()()),2&e){const e=yl.XpG(2);yl.R7$(),yl.Y8G("icon",e.noResultsIcon),yl.R7$(2),yl.JRh(yl.bMT(4,3,"noItemsMatchSearch")),yl.R7$(3),yl.JRh(yl.bMT(7,5,"clearFiltersOrTryAnother"))}}function C6(e,t){if(1&e&&(yl.j41(0,"div",25)(1,"bit-no-items",11),yl.qex(2,12),yl.EFF(3),yl.nI1(4,"i18n"),yl.bVm(),yl.qex(5,13),yl.EFF(6),yl.nI1(7,"i18n"),yl.bVm(),yl.k0s()()),2&e){const e=yl.XpG(2);yl.R7$(),yl.Y8G("icon",e.deactivatedIcon),yl.R7$(2),yl.SpI(" ",yl.bMT(4,3,"organizationIsDeactivated")," "),yl.R7$(3),yl.JRh(yl.bMT(7,5,"contactYourOrgAdmin"))}}function T6(e,t){if(1&e&&(yl.qex(0),yl.nrm(1,"app-autofill-vault-list-items")(2,"app-vault-list-items-container",26),yl.nI1(3,"i18n"),yl.nI1(4,"async"),yl.nrm(5,"app-vault-list-items-container",27),yl.nI1(6,"i18n"),yl.nI1(7,"async"),yl.bVm()),2&e){const e=yl.XpG(3);yl.R7$(2),yl.Y8G("title",yl.bMT(3,4,"favorites"))("ciphers",yl.bMT(4,6,e.favoriteCiphers$)||yl.lJ4(12,u6)),yl.R7$(3),yl.Y8G("title",yl.bMT(6,8,"allItems"))("ciphers",yl.bMT(7,10,e.remainingCiphers$)||yl.lJ4(13,u6))}}function P6(e,t){if(1&e&&(yl.DNE(0,T6,8,14,"ng-container",8),yl.nI1(1,"async")),2&e){const e=yl.XpG(2);yl.Y8G("ngIf",null===e.vaultState&&!yl.bMT(1,1,e.loading$))}}function F6(e,t){1&e&&yl.eu8(0)}function R6(e,t){if(1&e&&(yl.j41(0,"vault-fade-in-out"),yl.DNE(1,F6,1,0,"ng-container",16),yl.k0s()),2&e){yl.XpG(2);const e=yl.sdS(5);yl.R7$(),yl.Y8G("ngTemplateOutlet",e)}}function x6(e,t){if(1&e&&yl.DNE(0,R6,2,1,"vault-fade-in-out",8),2&e){const e=yl.XpG(2);yl.Y8G("ngIf",null===e.vaultState)}}function A6(e,t){1&e&&yl.eu8(0)}function D6(e,t){if(1&e&&yl.DNE(0,A6,1,0,"ng-container",16),2&e){yl.XpG();const e=yl.sdS(5);yl.Y8G("ngTemplateOutlet",e)}}function E6(e,t){if(1&e&&(yl.qex(0),yl.DNE(1,I6,8,7,"div",23),yl.j41(2,"div",24),yl.DNE(3,C6,8,7,"div",23),yl.k0s(),yl.DNE(4,P6,2,3,"ng-template",null,1,yl.C5r),yl.nVh(6,x6,1,1,"vault-fade-in-out"),yl.nI1(7,"async"),yl.vZN(8,D6,1,1,"ng-container"),yl.bVm()),2&e){const e=yl.XpG();yl.R7$(),yl.Y8G("ngIf",e.vaultState===e.VaultStateEnum.NoResults),yl.R7$(2),yl.Y8G("ngIf",e.vaultState===e.VaultStateEnum.DeactivatedOrg),yl.R7$(3),yl.vxM(yl.bMT(7,3,e.skeletonFeatureFlag$)?6:8)}}function $6(e,t){1&e&&(yl.j41(0,"vault-fade-in-out-skeleton"),yl.nrm(1,"vault-loading-skeleton"),yl.k0s())}const O6={Empty:0,NoResults:1,DeactivatedOrg:2};class U6{showPremiumDialog(){Q0.open(this.dialogService)}constructor(e,t,i,n,r,s,o,a,c,u,d,h,p,f,v,m,g,y){this.vaultPopupItemsService=e,this.vaultPopupListFiltersService=t,this.vaultScrollPositionService=i,this.vaultPopupLoadingService=n,this.accountService=r,this.destroyRef=s,this.cipherService=o,this.dialogService=a,this.introCarouselService=c,this.nudgesService=u,this.router=d,this.vaultProfileService=h,this.billingAccountService=p,this.liveAnnouncer=f,this.i18nService=v,this.configService=m,this.searchService=g,this.vaultItemsTransferService=y,this.NudgeType=VR,this.cipherType=CR,this.activeUserId$=this.accountService.activeAccount$.pipe(Gp),this.showEmptyVaultSpotlight$=this.activeUserId$.pipe((0,co.n)(e=>this.nudgesService.showNudgeSpotlight$(VR.EmptyVaultNudge,e))),this.showHasItemsVaultSpotlight$=this.activeUserId$.pipe((0,co.n)(e=>this.nudgesService.showNudgeSpotlight$(VR.HasVaultItems,e))),this.activeUserId=null,this.readySubject=new fd.t(!1),this.loading$=(0,$o.z)([this.vaultPopupLoadingService.loading$,this.readySubject.asObservable()]).pipe((0,l.T)(([e,t])=>e||!t),(0,lo.F)(),(0,Fo.M)(e=>{const t=e?"loadingVault":"vaultLoaded";this.liveAnnouncer.announce(this.i18nService.translate(t),"polite")})),this.skeletonFeatureFlag$=this.configService.getFeatureFlag$(Nf.VaultLoadingSkeletons),this.premiumSpotlightFeatureFlag$=this.configService.getFeatureFlag$(Nf.BrowserPremiumSpotlight),this.showPremiumNudgeSpotlight$=this.activeUserId$.pipe((0,co.n)(e=>this.nudgesService.showNudgeSpotlight$(VR.PremiumUpgrade,e))),this.favoriteCiphers$=this.vaultPopupItemsService.favoriteCiphers$,this.remainingCiphers$=this.vaultPopupItemsService.remainingCiphers$,this.allFilters$=this.vaultPopupListFiltersService.allFilters$,this.cipherCount$=this.vaultPopupItemsService.cipherCount$,this.hasPremium$=this.activeUserId$.pipe((0,co.n)(e=>this.billingAccountService.hasPremiumFromAnySource$(e))),this.accountAgeInDays$=this.activeUserId$.pipe((0,co.n)(e=>(0,md.H)(this.vaultProfileService.getProfileCreationDate(e)).pipe((0,l.T)(e=>{if(!e)return 0;const t=Date.now()-e.getTime();return Math.floor(t/864e5)})))),this.showPremiumSpotlight$=(0,$o.z)([this.premiumSpotlightFeatureFlag$,this.showPremiumNudgeSpotlight$,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,Pp.t)({bufferSize:1,refCount:!0})),this.showSpinnerLoaders$=(0,$o.z)([this.loading$,this.skeletonFeatureFlag$]).pipe((0,l.T)(([e,t])=>e&&!t)),this.showSkeletonsLoaders$=(0,$o.z)([this.loading$,this.searchService.isCipherSearching$,this.vaultItemsTransferService.transferInProgress$,this.skeletonFeatureFlag$]).pipe((0,l.T)(([e,t,i,n])=>(e||t||i)&&n),(0,lo.F)(),i1(),(0,Pp.t)({bufferSize:1,refCount:!0})),this.newItemItemValues$=this.vaultPopupListFiltersService.filters$.pipe((0,co.n)(e=>l6(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,Pp.t)({refCount:!0,bufferSize:1})),this.vaultState=null,this.vaultIcon=f3,this.deactivatedIcon=vW,this.noResultsIcon=dj,this.VaultStateEnum=O6,this.FeatureFlag=Nf,(0,$o.z)([this.vaultPopupItemsService.emptyVault$,this.vaultPopupItemsService.noFilteredResults$,this.vaultPopupItemsService.showDeactivatedOrg$]).pipe((0,wl.pQ)()).subscribe(([e,t,i])=>{switch(!0){case e:this.vaultState=O6.Empty;break;case i:this.vaultState=O6.DeactivatedOrg;break;case t:this.vaultState=O6.NoResults;break;default:this.vaultState=null}})}ngAfterViewInit(){this.virtualScrollElement&&this.allFilters$.pipe((0,No.s)(1),(0,wl.pQ)(this.destroyRef)).subscribe(()=>{this.vaultScrollPositionService.start(this.virtualScrollElement)})}ngOnInit(){return l6(this,void 0,void 0,function*(){this.activeUserId=yield(0,ho._)(this.accountService.activeAccount$.pipe(Gp)),yield this.introCarouselService.setIntroCarouselDismissed(),this.cipherService.failedToDecryptCiphers$(this.activeUserId).pipe((0,l.T)(e=>e?e.filter(e=>!e.isDeleted):[]),(0,To.p)(e=>e.length>0),(0,No.s)(1),(0,wl.pQ)(this.destroyRef)).subscribe(e=>{GG.open(this.dialogService,{cipherIds:e.map(e=>e.id)})}),yield this.vaultItemsTransferService.enforceOrganizationDataOwnership(this.activeUserId),this.readySubject.next(!0)})}ngOnDestroy(){this.vaultScrollPositionService.stop()}navigateToImport(){return l6(this,void 0,void 0,function*(){yield this.router.navigate(["/import"]),(yield tl.isPopupOpen())&&(yield rl.openCurrentPagePopout(window))})}dismissVaultNudgeSpotlight(e){return l6(this,void 0,void 0,function*(){yield this.nudgesService.dismissNudge(e,this.activeUserId)})}}U6.ɵfac=function(e){return new(e||U6)(yl.rXU(J3),yl.rXU(H3),yl.rXU(n4),yl.rXU(i4),yl.rXU(Ok),yl.rXU(a.abz),yl.rXU(Fb),yl.rXU(Jd),yl.rXU(l3),yl.rXU(jR),yl.rXU(ud.Ix),yl.rXU(RF),yl.rXU(ME),yl.rXU(ll.Ai),yl.rXU(Pl),yl.rXU(uk),yl.rXU(RJ),yl.rXU(Lq))},U6.ɵcmp=yl.VBU({type:U6,selectors:[["app-vault"]],viewQuery:function(e,t){if(1&e&&yl.GBs(hl.fZ,5),2&e){let e;yl.mGM(e=yl.lsd())&&(t.virtualScrollElement=e.first)}},features:[yl.Jv_([{provide:Lq,useClass:_q}])],decls:25,vars:27,consts:[["emptyVaultTemplate",""],["vaultContentTemplate",""],[3,"loading","hideOverflow"],["slot","header",3,"pageTitle"],["slot","end"],[3,"initialValues"],["slot","full-width-notice",4,"ngIf"],["slot","above-scroll-area"],[4,"ngIf"],["class","tw-flex tw-flex-col tw-h-full tw-justify-center",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"],[4,"ngTemplateOutlet"],["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","favorites","collapsibleKey","favorites",3,"title","ciphers"],["id","allItems","disableSectionMargin","","collapsibleKey","allItems",3,"title","ciphers"]],template:function(e,t){1&e&&(yl.j41(0,"popup-page",2),yl.nI1(1,"async"),yl.nI1(2,"async"),yl.j41(3,"popup-header",3),yl.nI1(4,"i18n"),yl.qex(5,4),yl.nrm(6,"app-new-item-dropdown",5),yl.nI1(7,"async"),yl.nrm(8,"app-pop-out")(9,"app-current-account"),yl.bVm(),yl.k0s(),yl.DNE(10,h6,1,1,"ng-template",null,0,yl.C5r),yl.nVh(12,v6,1,1,"vault-fade-in-out"),yl.nI1(13,"async"),yl.vZN(14,g6,1,1,"ng-container"),yl.DNE(15,y6,1,0,"blocked-injection-banner",6),yl.qex(16,7),yl.DNE(17,b6,5,9,"ng-container",8),yl.nI1(18,"async"),yl.DNE(19,w6,5,9,"ng-container",8),yl.nI1(20,"async"),yl.DNE(21,k6,5,3,"ng-container",8),yl.bVm(),yl.DNE(22,E6,9,5,"ng-container",8),yl.nVh(23,$6,2,0,"vault-fade-in-out-skeleton"),yl.nI1(24,"async"),yl.k0s()),2&e&&(yl.Y8G("loading",yl.bMT(1,11,t.showSpinnerLoaders$))("hideOverflow",yl.bMT(2,13,t.showSkeletonsLoaders$)),yl.R7$(3),yl.Y8G("pageTitle",yl.bMT(4,15,"vault")),yl.R7$(3),yl.Y8G("initialValues",yl.bMT(7,17,t.newItemItemValues$)),yl.R7$(6),yl.vxM(yl.bMT(13,19,t.skeletonFeatureFlag$)?12:14),yl.R7$(3),yl.Y8G("ngIf",t.vaultState!==t.VaultStateEnum.Empty),yl.R7$(2),yl.Y8G("ngIf",yl.bMT(18,21,t.showPremiumSpotlight$)),yl.R7$(2),yl.Y8G("ngIf",yl.bMT(20,23,t.vaultState===t.VaultStateEnum.Empty&&t.showEmptyVaultSpotlight$)),yl.R7$(2),yl.Y8G("ngIf",t.vaultState!==t.VaultStateEnum.Empty),yl.R7$(),yl.Y8G("ngIf",t.vaultState!==t.VaultStateEnum.Empty),yl.R7$(),yl.vxM(yl.bMT(24,25,t.showSkeletonsLoaders$)?23:-1))},dependencies:[m4,hD,yD,eD,PF,Eh,pj,qf,pl.MD,pl.bT,pl.T3,a6,s6,Xu,Ku,S4,hl.E9,z4,h4,qR,sw.iI,sw.Wk,Xl,Wl,U0,n1,p4,Xf,pl.Jj],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())})};var N6=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 V6(e,t){if(1&e&&yl.nrm(0,"app-cipher-view",4),2&e){const e=yl.XpG();yl.Y8G("cipher",e.cipher)}}function B6(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",9),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG(2);return a.Njj(t.editCipher())}),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()}2&e&&(yl.R7$(),yl.SpI(" ",yl.bMT(2,1,"edit")," "))}function j6(e,t){if(1&e&&(yl.j41(0,"button",10),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()),2&e){const e=yl.XpG(2);yl.Y8G("bitAction",e.restore),yl.R7$(),yl.SpI(" ",yl.bMT(2,2,"restore")," ")}}function G6(e,t){if(1&e&&(yl.nrm(0,"button",11),yl.nI1(1,"i18n")),2&e){const e=yl.XpG(2);yl.Y8G("bitAction",e.delete)("label",yl.bMT(1,2,e.cipher.isDeleted?"deleteForever":"delete"))}}function L6(e,t){if(1&e&&(yl.j41(0,"popup-footer",5),yl.DNE(1,B6,3,3,"button",6)(2,j6,3,4,"button",7)(3,G6,2,4,"button",8),yl.nI1(4,"async"),yl.k0s()),2&e){const e=yl.XpG();yl.R7$(),yl.Y8G("ngIf",!e.cipher.isDeleted),yl.R7$(),yl.Y8G("ngIf",e.cipher.isDeleted&&e.cipher.permissions.restore),yl.R7$(),yl.Y8G("ngIf",yl.bMT(4,3,e.canDeleteCipher$))}}class z6{constructor(e,t,i,n,r,s,o,a,l,c,u,d,h,p,f){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=f,this.delete=()=>N6(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=()=>N6(this,void 0,void 0,function*(){try{yield this.cipherService.restoreWithServer(this.cipher.id,this.activeUserId)}catch(e){this.logService.error(e)}yield this.popupRouterCacheService.back(),this.toastService.showToast({variant:"success",title:null,message:this.i18nService.t("restoredItem")})}),this.subscribeToParams()}subscribeToParams(){this.route.queryParams.pipe((0,co.n)(e=>N6(this,void 0,void 0,function*(){this.loadAction=e.action,this.senderTabId=e.senderTabId?parseInt(e.senderTabId,10):void 0,this.activeUserId=yield(0,ho._)(this.accountService.activeAccount$.pipe(Gp));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([ua,da,ha].includes(this.loadAction)&&!1===e&&t.reprompt!==kR.None)return null}return t})),CE(),(0,co.n)(e=>N6(this,void 0,void 0,function*(){this.cipher=e,this.canDeleteCipher$=this.cipherAuthorizationService.canDeleteCipher$(e),this.showFooter$=(0,Oo.of)(e&&(!e.isDeleted||e.isDeleted&&(e.permissions.restore||e.permissions.delete))),yield this.eventCollectionService.collect(Ra.Cipher_ClientViewed,e.id,!1,e.organizationId)})),(0,wl.pQ)()).subscribe()}setHeader(e){const t={[CR.Login]:"viewItemHeaderLogin",[CR.Card]:"viewItemHeaderCard",[CR.Identity]:"viewItemHeaderIdentity",[CR.SecureNote]:"viewItemHeaderNote",[CR.SshKey]:"viewItemHeaderSshKey"};return this.i18nService.t(t[e])}getCipherData(e,t){return N6(this,void 0,void 0,function*(){return yield(0,ho._)(this.cipherService.cipherViews$(t).pipe(CE(),(0,l.T)(t=>t.find(t=>t.id===e))))})}editCipher(){return N6(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}}),!0)})}deleteCipher(){return this.cipher.isDeleted?this.cipherService.deleteWithServer(this.cipher.id,this.activeUserId):this.cipherService.softDeleteWithServer(this.cipher.id,this.activeUserId)}_handleLoadAction(e,t,i){return N6(this,void 0,void 0,function*(){let n=!1;switch(e){case"show-autofill-button":return void(t.reprompt===kR.None||(yield this.passwordRepromptService.showPasswordPrompt())||(yield uJ(`${aJ}_${t.id}`)));case ua:n=yield this.vaultPopupAutofillService.doAutofill(t,!1);break;case"copy-username":n=yield this.copyCipherFieldService.copy(t.login.username,"username",t);break;case da:n=yield this.copyCipherFieldService.copy(t.login.password,"password",t);break;case ha:n=yield this.copyCipherFieldService.copy(t.login.totp,"totp",t);break;case"update-password":{const e=yield this.passwordRepromptService.showPasswordPrompt(),n=yield tl.getTab(i);yield P3("bgHandleReprompt",{tab:n,cipherId:t.id,success:e}),yield uJ(`${aJ}_${t.id}`);break}}return rl.inPopout(window)&&setTimeout(()=>N6(this,void 0,void 0,function*(){rl.inSingleActionPopout(window,aJ)&&i?(yield tl.focusTab(i),yield uJ(`${aJ}_${t.id}`)):yield this.popupRouterCacheService.back()}),n?1e3:0),n})}}z6.ɵfac=function(e){return new(e||z6)(yl.rXU($E),yl.rXU(ud.nX),yl.rXU(ud.Ix),yl.rXU(Pl),yl.rXU(Fb),yl.rXU(Jd),yl.rXU(za),yl.rXU(xb),yl.rXU(j3),yl.rXU(Ok),yl.rXU(OE),yl.rXU(aD),yl.rXU(t$),yl.rXU(BE),yl.rXU(n4))},z6.ɵcmp=yl.VBU({type:z6,selectors:[["app-view-v2"]],features:[yl.Jv_([{provide:ZO,useClass:class{constructor(){this.router=(0,a.WQX)(ud.Ix)}viewPasswordHistory(e){return M6(this,void 0,void 0,function*(){yield this.router.navigate(["/cipher-password-history"],{queryParams:{cipherId:e.id}})})}}},{provide:sU,useClass:t1},{provide:WU,useClass:qq}])],decls:6,vars:5,consts:[["slot","header","showBackButton","",3,"pageTitle"],["slot","end"],[3,"cipher",4,"ngIf"],["slot","footer",4,"ngIf"],[3,"cipher"],["slot","footer"],["buttonType","primary","type","button","bitButton","",3,"click",4,"ngIf"],["buttonType","primary","type","button","bitButton","",3,"bitAction",4,"ngIf"],["slot","end","type","button","buttonType","danger","bitIconButton","bwi-trash",3,"bitAction","label",4,"ngIf"],["buttonType","primary","type","button","bitButton","",3,"click"],["buttonType","primary","type","button","bitButton","",3,"bitAction"],["slot","end","type","button","buttonType","danger","bitIconButton","bwi-trash",3,"bitAction","label"]],template:function(e,t){1&e&&(yl.j41(0,"popup-page")(1,"popup-header",0),yl.nrm(2,"app-pop-out",1),yl.k0s(),yl.DNE(3,V6,1,1,"app-cipher-view",2)(4,L6,5,5,"popup-footer",3),yl.nI1(5,"async"),yl.k0s()),2&e&&(yl.R7$(),yl.Y8G("pageTitle",t.headerText),yl.R7$(2),yl.Y8G("ngIf",t.cipher),yl.R7$(),yl.Y8G("ngIf",yl.bMT(5,3,t.showFooter$)))},dependencies:[pl.MD,pl.bT,v$,qf,fl.YN,Xu,Ku,hD,yD,YJ,_l,zl,uM,rc,Rd,eD,td,pl.Jj,Xf],encapsulation:2});const _6=e=>e.includes("view-cipher")||e.includes("assign-collections")||e.includes("edit-cipher")||e.includes("clone-cipher");var K6=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 X6=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 q6=new k(H,"enableBadgeCounter",{deserializer:e=>null==e||e,clearOn:[]});class Y6{}var W6=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 H6{}const J6=new m(de,"routing",{deserializer:e=>e});var Z6=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 Q6=new m(ce,"compactMode",{deserializer:e=>e});class e7{constructor(){this.state=(0,a.WQX)(d).get(Q6),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 Z6(this,void 0,void 0,function*(){yield this.state.update(()=>e)})}}e7.ɵfac=function(e){return new(e||e7)},e7.ɵprov=a.jDH({token:e7,factory:e7.ɵfac,providedIn:"root"});var t7=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 i7(e,t){if(1&e&&yl.nrm(0,"bit-option",16),2&e){const e=t.$implicit;yl.Y8G("value",e.value)("label",e.name)}}class n7{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)(e7),this.copyButtonsService=(0,a.WQX)(t4),this.popupSizeService=(0,a.WQX)(al),this.i18nService=(0,a.WQX)(Pl),this.appearanceForm=this.formBuilder.group({enableFavicon:!1,enableBadgeCounter:!0,theme:ap.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("extraWide"),value:"extra-wide"}],this.themeOptions=[{name:l.t("systemDefault"),value:ap.System},{name:l.t("light"),value:ap.Light},{name:l.t("dark"),value:ap.Dark}]}ngOnInit(){return t7(this,void 0,void 0,function*(){const e=yield(0,ho._)(this.domainSettingsService.showFavicons$),t=yield(0,ho._)(this.badgeSettingsService.enableBadgeCounter$),i=yield(0,ho._)(this.themeStateService.selectedTheme$),n=yield(0,ho._)(this.animationControlService.enableRoutingAnimation$),r=yield(0,ho._)(this.compactModeService.enabled$),s=yield(0,ho._)(this.copyButtonsService.showQuickCopyActions$),o=yield(0,ho._)(this.popupSizeService.width$),a=yield(0,ho._)(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,wl.pQ)(this.destroyRef)).subscribe(e=>{this.saveTheme(e)}),this.appearanceForm.controls.enableFavicon.valueChanges.pipe((0,wl.pQ)(this.destroyRef)).subscribe(e=>{this.updateFavicon(e)}),this.appearanceForm.controls.enableBadgeCounter.valueChanges.pipe((0,wl.pQ)(this.destroyRef)).subscribe(e=>{this.updateBadgeCounter(e)}),this.appearanceForm.controls.enableAnimations.valueChanges.pipe((0,wl.pQ)(this.destroyRef)).subscribe(e=>{this.updateAnimations(e)}),this.appearanceForm.controls.enableCompactMode.valueChanges.pipe((0,wl.pQ)(this.destroyRef)).subscribe(e=>{this.updateCompactMode(e)}),this.appearanceForm.controls.showQuickCopyActions.valueChanges.pipe((0,wl.pQ)(this.destroyRef)).subscribe(e=>{this.updateQuickCopyActions(e)}),this.appearanceForm.controls.width.valueChanges.pipe((0,wl.pQ)(this.destroyRef)).subscribe(e=>{this.updateWidth(e)}),this.appearanceForm.controls.clickItemsToAutofillVaultView.valueChanges.pipe((0,wl.pQ)(this.destroyRef)).subscribe(e=>{this.updateClickItemsToAutofillVaultView(e)})})}updateClickItemsToAutofillVaultView(e){return t7(this,void 0,void 0,function*(){yield this.vaultSettingsService.setClickItemsToAutofillVaultView(e)})}updateFavicon(e){return t7(this,void 0,void 0,function*(){yield this.domainSettingsService.setShowFavicons(e)})}updateBadgeCounter(e){return t7(this,void 0,void 0,function*(){yield this.badgeSettingsService.setEnableBadgeCounter(e),this.messagingService.send("bgUpdateContextMenu")})}saveTheme(e){return t7(this,void 0,void 0,function*(){yield this.themeStateService.setSelectedTheme(e)})}updateAnimations(e){return t7(this,void 0,void 0,function*(){yield this.animationControlService.setEnableRoutingAnimation(e)})}updateCompactMode(e){return t7(this,void 0,void 0,function*(){yield this.compactModeService.setEnabled(e)})}updateQuickCopyActions(e){return t7(this,void 0,void 0,function*(){yield this.copyButtonsService.setShowQuickCopyActions(e)})}updateWidth(e){return t7(this,void 0,void 0,function*(){yield this.popupSizeService.setWidth(e)})}}n7.ɵfac=function(e){return new(e||n7)(yl.rXU(ek),yl.rXU(oE),yl.rXU(Y6),yl.rXU(r$),yl.rXU(fl.ok),yl.rXU(a.abz),yl.rXU(H6),yl.rXU(Pl),yl.rXU(Zq))},n7.ɵcmp=yl.VBU({type:n7,selectors:[["ng-component"]],decls:56,vars:37,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"],["bitCheckbox","","formControlName","showQuickCopyActions","type","checkbox"],["bitCheckbox","","formControlName","clickItemsToAutofillVaultView","type","checkbox"],[3,"value","label"]],template:function(e,t){1&e&&(yl.j41(0,"popup-page",0)(1,"popup-header",1),yl.nI1(2,"i18n"),yl.qex(3,2),yl.nrm(4,"app-pop-out"),yl.bVm(),yl.k0s(),yl.j41(5,"form",3)(6,"bit-card")(7,"bit-form-field")(8,"bit-label"),yl.EFF(9),yl.nI1(10,"i18n"),yl.k0s(),yl.j41(11,"bit-select",4),yl.DNE(12,i7,1,2,"bit-option",5),yl.k0s()(),yl.j41(13,"bit-form-field")(14,"bit-label"),yl.EFF(15),yl.nI1(16,"i18n"),yl.k0s(),yl.nrm(17,"bit-select",6),yl.k0s(),yl.j41(18,"bit-form-control"),yl.nrm(19,"input",7),yl.j41(20,"bit-label"),yl.EFF(21),yl.nI1(22,"i18n"),yl.j41(23,"span",8),yl.EFF(24),yl.nI1(25,"i18n"),yl.k0s()()(),yl.j41(26,"bit-form-control"),yl.nrm(27,"input",9),yl.j41(28,"bit-label"),yl.EFF(29),yl.nI1(30,"i18n"),yl.k0s()(),yl.j41(31,"bit-form-control",10),yl.nrm(32,"input",11),yl.j41(33,"bit-label"),yl.EFF(34),yl.nI1(35,"i18n"),yl.k0s()()(),yl.j41(36,"h2",12),yl.EFF(37),yl.nI1(38,"i18n"),yl.k0s(),yl.j41(39,"bit-card")(40,"bit-form-control"),yl.nrm(41,"input",13),yl.j41(42,"bit-label"),yl.EFF(43),yl.nI1(44,"i18n"),yl.nrm(45,"vault-permit-cipher-details-popover"),yl.k0s()(),yl.j41(46,"bit-form-control"),yl.nrm(47,"input",14),yl.j41(48,"bit-label"),yl.EFF(49),yl.nI1(50,"i18n"),yl.k0s()(),yl.j41(51,"bit-form-control",10),yl.nrm(52,"input",15),yl.j41(53,"bit-label"),yl.EFF(54),yl.nI1(55,"i18n"),yl.k0s()()()()()),2&e&&(yl.Y8G("loading",t.formLoading),yl.R7$(),yl.Y8G("pageTitle",yl.bMT(2,15,"appearance")),yl.R7$(4),yl.Y8G("formGroup",t.appearanceForm),yl.R7$(4),yl.JRh(yl.bMT(10,17,"theme")),yl.R7$(3),yl.Y8G("ngForOf",t.themeOptions),yl.R7$(3),yl.JRh(yl.bMT(16,19,"extensionWidth")),yl.R7$(2),yl.Y8G("items",t.widthOptions),yl.R7$(4),yl.SpI("",yl.bMT(22,21,"compactMode")," "),yl.R7$(3),yl.JRh(yl.bMT(25,23,"beta")),yl.R7$(5),yl.JRh(yl.bMT(30,25,"showNumberOfAutofillSuggestions")),yl.R7$(5),yl.JRh(yl.bMT(35,27,"showAnimations")),yl.R7$(3),yl.JRh(yl.bMT(38,29,"vaultCustomization")),yl.R7$(6),yl.SpI(" ",yl.bMT(44,31,"showIconsChangePasswordUrls")," "),yl.R7$(6),yl.JRh(yl.bMT(50,33,"showQuickCopyActions")),yl.R7$(5),yl.SpI(" ",yl.bMT(55,35,"clickToAutofill")," "))},dependencies:[pl.MD,pl.Sq,qf,hD,yD,eD,WR,Eu,hc,Sc,Du,Bu,Vu,Ou,fl.X1,fl.qT,fl.Zm,fl.BC,fl.cb,fl.j4,fl.JD,id,Ub,Kc,_c,RL,Xf],encapsulation:2});var r7=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 s7=(e,t)=>t.id;function o7(e,t){1&e&&(yl.nrm(0,"i",11),yl.nI1(1,"i18n")),2&e&&yl.Y8G("appA11yTitle",yl.bMT(1,1,"attachments"))}function a7(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",14),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG().$implicit,i=yl.XpG(3);return a.Njj(i.delete(t))}),yl.j41(1,"span",16),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s()()}2&e&&(yl.R7$(2),yl.SpI(" ",yl.bMT(3,1,"delete")," "))}function l7(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"bit-item")(1,"button",7),yl.nI1(2,"i18n"),yl.bIt("click",function(){const t=a.eBV(e).$implicit,i=yl.XpG(3);return a.Njj(i.view(t))}),yl.j41(3,"div",8),yl.nrm(4,"app-vault-icon",9),yl.k0s(),yl.j41(5,"span",10),yl.EFF(6),yl.k0s(),yl.nVh(7,o7,2,3,"i",11),yl.j41(8,"span",12),yl.EFF(9),yl.k0s()(),yl.j41(10,"bit-item-action",3),yl.nrm(11,"button",13),yl.nI1(12,"i18n"),yl.nI1(13,"i18n"),yl.j41(14,"bit-menu",null,0)(16,"button",14),yl.bIt("click",function(){const t=a.eBV(e).$implicit,i=yl.XpG(3);return a.Njj(i.edit(t))}),yl.EFF(17),yl.nI1(18,"i18n"),yl.k0s(),yl.j41(19,"button",14),yl.bIt("click",function(){const t=a.eBV(e).$implicit,i=yl.XpG(3);return a.Njj(i.clone(t))}),yl.EFF(20),yl.nI1(21,"i18n"),yl.k0s(),yl.j41(22,"button",14),yl.bIt("click",function(){const t=a.eBV(e).$implicit,i=yl.XpG(3);return a.Njj(i.unarchive(t))}),yl.EFF(23),yl.nI1(24,"i18n"),yl.k0s(),yl.DNE(25,a7,4,3,"button",15),yl.k0s()()()}if(2&e){const e=t.$implicit,i=yl.sdS(15),n=yl.XpG(3);yl.R7$(),yl.Y8G("appA11yTitle",yl.i5U(2,13,"viewItemTitle",e.name)),yl.R7$(3),yl.Y8G("cipher",e),yl.R7$(2),yl.JRh(e.name),yl.R7$(),yl.vxM(n.CipherViewLikeUtils.hasAttachments(e)?7:-1),yl.R7$(2),yl.JRh(n.CipherViewLikeUtils.subtitle(e)),yl.R7$(2),yl.Y8G("label",yl.mNQ(yl.bMT(12,16,"options")))("appA11yTitle",yl.i5U(13,18,"moreOptionsTitle",e.name))("bitMenuTriggerFor",i),yl.R7$(6),yl.SpI(" ",yl.bMT(18,21,"edit")," "),yl.R7$(3),yl.SpI(" ",yl.bMT(21,23,"clone")," "),yl.R7$(3),yl.SpI(" ",yl.bMT(24,25,"unArchive")," "),yl.R7$(2),yl.Y8G("appCanDeleteCipher",e)}}function c7(e,t){if(1&e&&(yl.j41(0,"bit-section")(1,"bit-section-header")(2,"h2",5),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s(),yl.j41(5,"span",6),yl.EFF(6),yl.k0s()(),yl.j41(7,"bit-item-group"),yl.Z7z(8,l7,26,27,"bit-item",null,s7),yl.k0s()()),2&e){const e=yl.XpG();yl.R7$(3),yl.SpI(" ",yl.bMT(4,2,"itemsInArchive")," "),yl.R7$(3),yl.JRh(e.length),yl.R7$(2),yl.Dyx(e)}}function u7(e,t){1&e&&(yl.j41(0,"bit-no-items",4),yl.qex(1,17),yl.EFF(2),yl.nI1(3,"i18n"),yl.bVm(),yl.qex(4,18),yl.EFF(5),yl.nI1(6,"i18n"),yl.bVm(),yl.k0s()),2&e&&(yl.R7$(2),yl.SpI(" ",yl.bMT(3,2,"noItemsInArchive")," "),yl.R7$(3),yl.SpI(" ",yl.bMT(6,4,"noItemsInArchiveDesc")," "))}function d7(e,t){1&e&&yl.nVh(0,c7,10,4,"bit-section")(1,u7,7,6,"bit-no-items",4),2&e&&yl.vxM(t.length?0:1)}class h7{constructor(){this.dialogService=(0,a.WQX)(Jd),this.router=(0,a.WQX)(ud.Ix),this.cipherService=(0,a.WQX)(Fb),this.accountService=(0,a.WQX)(Ok),this.logService=(0,a.WQX)(za),this.toastService=(0,a.WQX)(xb),this.i18nService=(0,a.WQX)(Pl),this.cipherArchiveService=(0,a.WQX)(BV),this.passwordRepromptService=(0,a.WQX)($E),this.userId$=this.accountService.activeAccount$.pipe(Gp),this.archivedCiphers$=this.userId$.pipe((0,co.n)(e=>this.cipherArchiveService.archivedCiphers$(e))),this.CipherViewLikeUtils=hE,this.loading$=this.archivedCiphers$.pipe((0,l.T)(()=>!1),(0,sd.Z)(!0))}view(e){return r7(this,void 0,void 0,function*(){(yield this.canInteract(e))&&(yield this.router.navigate(["/view-cipher"],{queryParams:{cipherId:e.id,type:e.type}}))})}edit(e){return r7(this,void 0,void 0,function*(){(yield this.canInteract(e))&&(yield this.router.navigate(["/edit-cipher"],{queryParams:{cipherId:e.id,type:e.type}}))})}delete(e){return r7(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,ho._)(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 r7(this,void 0,void 0,function*(){if(!(yield this.canInteract(e)))return;const t=yield(0,ho._)(this.userId$);yield this.cipherArchiveService.unarchiveWithServer(e.id,t),this.toastService.showToast({variant:"success",message:this.i18nService.t("itemUnarchived")})})}clone(e){return r7(this,void 0,void 0,function*(){if(yield this.canInteract(e)){if(hE.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}})}})}canInteract(e){return hE.decryptionFailure(e)?(GG.open(this.dialogService,{cipherIds:[e.id]}),!1):this.passwordRepromptService.passwordRepromptCheck(e)}}h7.ɵfac=function(e){return new(e||h7)},h7.ɵcmp=yl.VBU({type:h7,selectors:[["ng-component"]],decls:8,vars:9,consts:[["moreOptions",""],[3,"loading"],["slot","header","showBackButton","",3,"pageTitle"],["slot","end"],[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"],[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","",3,"click",4,"appCanDeleteCipher"],[1,"tw-text-danger"],["slot","title"],["slot","description"]],template:function(e,t){if(1&e&&(yl.j41(0,"popup-page",1),yl.nI1(1,"async"),yl.j41(2,"popup-header",2),yl.nI1(3,"i18n"),yl.qex(4,3),yl.nrm(5,"app-pop-out"),yl.bVm(),yl.k0s(),yl.nVh(6,d7,2,1),yl.nI1(7,"async"),yl.k0s()),2&e){let e;yl.Y8G("loading",yl.bMT(1,3,t.loading$)),yl.R7$(2),yl.Y8G("pageTitle",yl.bMT(3,5,"archiveNoun")),yl.R7$(4),yl.vxM((e=yl.bMT(7,7,t.archivedCiphers$))?6:-1,e)}},dependencies:[pl.MD,qf,jb,GO,hD,yD,eD,Eh,pj,wP,IP,FP,SP,RP,Dh,gL,bL,LE,_l,zl,i$,ZR,ex,Xl,Wl,pl.Jj,Xf],encapsulation:2});var p7=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 f7{constructor(e,t){this.nudgesService=e,this.accountService=t}ngOnInit(){return p7(this,void 0,void 0,function*(){const e=yield(0,ho._)(this.accountService.activeAccount$.pipe(Gp));yield this.nudgesService.dismissNudge(VR.DownloadBitwarden,e)})}}f7.ɵfac=function(e){return new(e||f7)(yl.rXU(jR),yl.rXU(Ok))},f7.ɵcmp=yl.VBU({type:f7,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&&(yl.j41(0,"popup-page")(1,"popup-header",0),yl.nI1(2,"i18n"),yl.qex(3,1),yl.nrm(4,"app-pop-out"),yl.bVm(),yl.k0s(),yl.j41(5,"h2",2),yl.EFF(6),yl.nI1(7,"i18n"),yl.k0s(),yl.j41(8,"bit-card")(9,"span",3),yl.EFF(10),yl.nI1(11,"i18n"),yl.k0s(),yl.j41(12,"div",4),yl.nrm(13,"img",5),yl.k0s(),yl.j41(14,"div",6)(15,"a",7),yl.nrm(16,"img",8),yl.nI1(17,"i18n"),yl.k0s(),yl.j41(18,"a",9),yl.nrm(19,"img",10),yl.nI1(20,"i18n"),yl.k0s()()(),yl.j41(21,"h2",11),yl.EFF(22),yl.nI1(23,"i18n"),yl.k0s(),yl.j41(24,"bit-card")(25,"span",3),yl.EFF(26),yl.nI1(27,"i18n"),yl.k0s(),yl.j41(28,"a",12),yl.EFF(29),yl.nI1(30,"i18n"),yl.nrm(31,"i",13),yl.k0s()()()),2&e&&(yl.R7$(),yl.Y8G("pageTitle",yl.mNQ(yl.bMT(2,11,"downloadBitwarden"))),yl.R7$(5),yl.SpI(" ",yl.bMT(7,13,"getTheMobileApp")," "),yl.R7$(4),yl.SpI(" ",yl.bMT(11,15,"getTheMobileAppDesc")," "),yl.R7$(6),yl.Y8G("alt",yl.mNQ(yl.bMT(17,17,"downloadOnTheAppStore"))),yl.R7$(3),yl.Y8G("alt",yl.mNQ(yl.bMT(20,19,"getItOnGooglePlay"))),yl.R7$(3),yl.SpI(" ",yl.bMT(23,21,"getTheDesktopApp")," "),yl.R7$(4),yl.JRh(yl.bMT(27,23,"getTheDesktopAppDesc")),yl.R7$(3),yl.SpI(" ",yl.bMT(30,25,"downloadFromBitwardenNow")," "))},dependencies:[pl.MD,qf,sw.iI,hD,yD,eD,WR,Xl,Wl,Oh,_b,Xf],encapsulation:2});const v7=lw` `;function m7(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"bit-item")(1,"bit-item-content"),yl.EFF(2),yl.j41(3,"button",8),yl.nI1(4,"i18n"),yl.bIt("click",function(){const t=a.eBV(e).$implicit,i=yl.XpG(3);return a.Njj(i.openAddEditFolderDialog(t))}),yl.k0s()()()}if(2&e){const e=t.$implicit;yl.R7$(2),yl.SpI(" ",e.name," "),yl.R7$(),yl.Y8G("label",yl.i5U(4,2,"editFolderWithName",e.name))}}function g7(e,t){if(1&e&&(yl.qex(0),yl.j41(1,"bit-item-group"),yl.DNE(2,m7,5,5,"bit-item",7),yl.k0s(),yl.bVm()),2&e){const e=yl.XpG().ngIf;yl.R7$(2),yl.Y8G("ngForOf",e)}}function y7(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"bit-no-items",9),yl.qex(1,10),yl.EFF(2),yl.nI1(3,"i18n"),yl.bVm(),yl.qex(4,11),yl.EFF(5),yl.nI1(6,"i18n"),yl.bVm(),yl.j41(7,"button",12),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG(2);return a.Njj(t.openAddEditFolderDialog())}),yl.nrm(8,"i",4),yl.EFF(9),yl.nI1(10,"i18n"),yl.k0s()()}if(2&e){const e=yl.XpG(2);yl.Y8G("icon",e.NoFoldersIcon),yl.R7$(2),yl.JRh(yl.bMT(3,4,"noFoldersAdded")),yl.R7$(3),yl.JRh(yl.bMT(6,6,"createFoldersToOrganize")),yl.R7$(4),yl.SpI(" ",yl.bMT(10,8,"newFolder")," ")}}function b7(e,t){if(1&e&&(yl.qex(0),yl.DNE(1,g7,3,1,"ng-container",6)(2,y7,11,10,"ng-template",null,0,yl.C5r),yl.bVm()),2&e){const e=t.ngIf,i=yl.sdS(3);yl.R7$(),yl.Y8G("ngIf",e.length)("ngIfElse",i)}}class w7{constructor(e,t,i){this.folderService=e,this.dialogService=t,this.accountService=i,this.NoFoldersIcon=v7,this.activeUserId$=this.accountService.activeAccount$.pipe((0,l.T)(e=>null==e?void 0:e.id)),this.folders$=this.activeUserId$.pipe((0,To.p)(e=>null!==e),(0,co.n)(e=>this.folderService.folderViews$(e)),(0,l.T)(e=>e.length>0?e.slice(0,e.length-1):e))}openAddEditFolderDialog(e){const t=e?{folder:e}:void 0;WG.open(this.dialogService,{editFolderConfig:t})}}w7.ɵfac=function(e){return new(e||w7)(yl.rXU(qU),yl.rXU(Jd),yl.rXU(Ok))},w7.ɵcmp=yl.VBU({type:w7,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&&(yl.j41(0,"popup-page")(1,"popup-header",1),yl.nI1(2,"i18n"),yl.qex(3,2),yl.j41(4,"button",3),yl.bIt("click",function(){return t.openAddEditFolderDialog()}),yl.nrm(5,"i",4),yl.EFF(6),yl.nI1(7,"i18n"),yl.k0s(),yl.nrm(8,"app-pop-out"),yl.bVm(),yl.k0s(),yl.DNE(9,b7,4,2,"ng-container",5),yl.nI1(10,"async"),yl.k0s()),2&e&&(yl.R7$(),yl.Y8G("pageTitle",yl.bMT(2,3,"folders")),yl.R7$(5),yl.SpI(" ",yl.bMT(7,5,"new")," "),yl.R7$(3),yl.Y8G("ngIf",yl.bMT(10,7,t.folders$)))},dependencies:[pl.MD,pl.Sq,pl.bT,qf,eD,hD,yD,wP,IP,FP,RP,Eh,pj,_l,zl,Xu,Ku,rc,pl.Jj,Xf],encapsulation:2});class S7{constructor(e,t,i){this.policyService=e,this.organizationService=t,this.accountService=i}hasSingleEnterpriseOrg$(){return Gp(this.accountService.activeAccount$).pipe((0,co.n)(e=>this.organizationService.organizations$(e).pipe((0,l.T)(e=>1===e.filter(e=>e.canManageSponsorships).length))))}isFreeFamilyPolicyEnabled$(){return this.hasSingleEnterpriseOrg$().pipe((0,co.n)(e=>e?Gp(this.accountService.activeAccount$).pipe((0,co.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,co.n)(t=>this.policyService.policiesByType$(_h.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,Oo.of)(!1)))}}S7.ɵfac=function(e){return new(e||S7)(a.KVO($b),a.KVO(AF),a.KVO(Ok))},S7.ɵprov=a.jDH({token:S7,factory:S7.ɵfac,providedIn:"root"});var k7=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 I7(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"bit-item")(1,"button",3),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG();return a.Njj(t.openFreeBitwardenFamiliesPage())}),yl.EFF(2),yl.nI1(3,"i18n"),yl.nrm(4,"i",4),yl.k0s()()}2&e&&(yl.R7$(2),yl.SpI(" ",yl.bMT(3,1,"freeBitwardenFamilies")," "))}class C7{constructor(e,t,i,n,r){this.dialogService=e,this.environmentService=t,this.organizationService=i,this.familiesPolicyService=n,this.accountService=r,this.familySponsorshipAvailable$=Gp(this.accountService.activeAccount$).pipe((0,co.n)(e=>this.organizationService.familySponsorshipAvailable$(e))),this.hasSingleEnterpriseOrg$=this.familiesPolicyService.hasSingleEnterpriseOrg$(),this.isFreeFamilyPolicyEnabled$=this.familiesPolicyService.isFreeFamilyPolicyEnabled$()}openFreeBitwardenFamiliesPage(){return k7(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,ho._)(this.environmentService.environment$)).getWebVaultUrl();yield tl.createNewTab(e+"/#/settings/sponsored-families")}})}openBitwardenForBusinessPage(){return k7(this,void 0,void 0,function*(){(yield this.dialogService.openSimpleDialog({title:{key:"continueToBitwardenDotCom"},content:{key:"bitwardenForBusinessPageDesc"},type:"info",acceptButtonText:{key:"continue"}}))&&(yield tl.createNewTab("https://bitwarden.com/products/business/"))})}openAuthenticatorPage(){return k7(this,void 0,void 0,function*(){(yield this.dialogService.openSimpleDialog({title:{key:"continueToBitwardenDotCom"},content:{key:"continueToAuthenticatorPageDesc"},type:"info",acceptButtonText:{key:"continue"}}))&&(yield tl.createNewTab("https://bitwarden.com/products/authenticator"))})}openSecretsManagerPage(){return k7(this,void 0,void 0,function*(){(yield this.dialogService.openSimpleDialog({title:{key:"continueToBitwardenDotCom"},content:{key:"continueToSecretsManagerPageDesc"},type:"info",acceptButtonText:{key:"continue"}}))&&(yield tl.createNewTab("https://bitwarden.com/products/secrets-manager"))})}openPasswordlessDotDevPage(){return k7(this,void 0,void 0,function*(){(yield this.dialogService.openSimpleDialog({title:{key:"continueToBitwardenDotCom"},content:{key:"continueToPasswordlessDotDevPageDesc"},type:"info",acceptButtonText:{key:"continue"}}))&&(yield tl.createNewTab("https://bitwarden.com/products/passwordless"))})}}C7.ɵfac=function(e){return new(e||C7)(yl.rXU(Jd),yl.rXU(JS),yl.rXU(AF),yl.rXU(S7),yl.rXU(Ok))},C7.ɵcmp=yl.VBU({type:C7,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&&(yl.j41(0,"popup-page")(1,"popup-header",0),yl.nI1(2,"i18n"),yl.qex(3,1),yl.nrm(4,"app-pop-out"),yl.bVm(),yl.k0s(),yl.j41(5,"bit-item-group"),yl.DNE(6,I7,5,3,"bit-item",2),yl.nI1(7,"async"),yl.nI1(8,"async"),yl.nI1(9,"async"),yl.j41(10,"bit-item")(11,"button",3),yl.bIt("click",function(){return t.openBitwardenForBusinessPage()}),yl.EFF(12),yl.nI1(13,"i18n"),yl.nrm(14,"i",4),yl.k0s()(),yl.j41(15,"bit-item")(16,"button",3),yl.bIt("click",function(){return t.openAuthenticatorPage()}),yl.EFF(17),yl.nI1(18,"i18n"),yl.nrm(19,"i",4),yl.k0s()(),yl.j41(20,"bit-item")(21,"button",3),yl.bIt("click",function(){return t.openSecretsManagerPage()}),yl.EFF(22),yl.nI1(23,"i18n"),yl.nrm(24,"i",4),yl.k0s()(),yl.j41(25,"bit-item")(26,"button",3),yl.bIt("click",function(){return t.openPasswordlessDotDevPage()}),yl.EFF(27),yl.nI1(28,"i18n"),yl.nrm(29,"i",4),yl.k0s()()()()),2&e&&(yl.R7$(),yl.Y8G("pageTitle",yl.mNQ(yl.bMT(2,7,"moreFromBitwarden"))),yl.R7$(5),yl.Y8G("ngIf",yl.bMT(7,9,t.familySponsorshipAvailable$)&&!(yl.bMT(8,11,t.isFreeFamilyPolicyEnabled$)&&yl.bMT(9,13,t.hasSingleEnterpriseOrg$))),yl.R7$(6),yl.SpI(" ",yl.bMT(13,15,"bitwardenForBusiness")," "),yl.R7$(5),yl.SpI(" ",yl.bMT(18,17,"bitwardenAuthenticator")," "),yl.R7$(5),yl.SpI(" ",yl.bMT(23,19,"bitwardenSecretsManager")," "),yl.R7$(5),yl.SpI(" ",yl.bMT(28,21,"passwordlessDotDev")," "))},dependencies:[pl.MD,pl.bT,qf,sw.iI,hD,yD,eD,wP,IP,FP,RP,pl.Jj,Xf],encapsulation:2});const T7=lw` `;var P7=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 F7(e,t){if(1&e&&yl.nrm(0,"i",13),2&e){const e=yl.XpG().$implicit,t=yl.XpG(2);yl.Y8G("tierType",e.organization.productTierType)("size","small")("appA11yTitle",t.orgIconTooltip(e))}}function R7(e,t){1&e&&(yl.nrm(0,"i",14),yl.nI1(1,"i18n")),2&e&&yl.Y8G("appA11yTitle",yl.bMT(1,1,"attachments"))}function x7(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",19),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG(2).$implicit,i=yl.XpG(2);return a.Njj(i.restore(t))}),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()}2&e&&(yl.R7$(),yl.SpI(" ",yl.bMT(2,1,"restore")," "))}function A7(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"button",19),yl.bIt("click",function(){a.eBV(e);const t=yl.XpG(2).$implicit,i=yl.XpG(2);return a.Njj(i.delete(t))}),yl.EFF(1),yl.nI1(2,"i18n"),yl.k0s()}2&e&&(yl.R7$(),yl.SpI(" ",yl.bMT(2,1,"deleteForever")," "))}function D7(e,t){if(1&e&&(yl.qex(0,15),yl.j41(1,"bit-item-action"),yl.nrm(2,"button",16),yl.nI1(3,"i18n"),yl.j41(4,"bit-menu",null,0),yl.DNE(6,x7,3,3,"button",17)(7,A7,3,3,"button",18),yl.k0s()(),yl.bVm()),2&e){const e=yl.sdS(5),t=yl.XpG().$implicit,i=yl.XpG(2);yl.R7$(2),yl.Y8G("label",yl.i5U(3,4,"moreOptionsLabel",t.name))("bitMenuTriggerFor",e),yl.R7$(4),yl.Y8G("ngIf",!i.hasDecryptionFailure(t)),yl.R7$(),yl.Y8G("appCanDeleteCipher",t)}}function E7(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"bit-item")(1,"button",5),yl.nI1(2,"i18n"),yl.bIt("click",function(){const t=a.eBV(e).$implicit,i=yl.XpG(2);return a.Njj(i.onViewCipher(t))}),yl.j41(3,"div",6),yl.nrm(4,"app-vault-icon",7),yl.k0s(),yl.j41(5,"span",8),yl.EFF(6),yl.k0s(),yl.DNE(7,F7,1,3,"i",9)(8,R7,2,3,"i",10),yl.j41(9,"span",11),yl.EFF(10),yl.k0s()(),yl.DNE(11,D7,8,7,"ng-container",12),yl.k0s()}if(2&e){const e=t.$implicit,i=yl.XpG(2);yl.R7$(),yl.Y8G("appA11yTitle",yl.i5U(2,7,"viewItemTitle",e.name)),yl.R7$(3),yl.Y8G("cipher",e),yl.R7$(2),yl.JRh(e.name),yl.R7$(),yl.Y8G("ngIf",e.organizationId),yl.R7$(),yl.Y8G("ngIf",i.hasAttachments(e)),yl.R7$(2),yl.JRh(i.getSubtitle(e)),yl.R7$(),yl.Y8G("ngIf",e.permissions.restore)}}function $7(e,t){if(1&e&&(yl.j41(0,"bit-section")(1,"bit-section-header")(2,"h2",2),yl.EFF(3),yl.k0s(),yl.j41(4,"span",3),yl.EFF(5),yl.k0s()(),yl.j41(6,"bit-item-group"),yl.DNE(7,E7,12,10,"bit-item",4),yl.k0s()()),2&e){const e=yl.XpG();yl.R7$(3),yl.SpI(" ",e.headerText," "),yl.R7$(2),yl.JRh(e.ciphers.length),yl.R7$(2),yl.Y8G("ngForOf",e.ciphers)}}class O7{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 P7(this,void 0,void 0,function*(){try{const t=yield(0,ho._)(this.accountService.activeAccount$.pipe(Gp));yield this.cipherService.restoreWithServer(e.id,t),yield this.router.navigate(["/trash"]),this.toastService.showToast({variant:"success",title:null,message:this.i18nService.t("restoredItem")})}catch(e){this.logService.error(e)}})}delete(e){return P7(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,ho._)(this.accountService.activeAccount$.pipe(Gp));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 P7(this,void 0,void 0,function*(){if("decryptionFailure"in e&&e.decryptionFailure)return void GG.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 U7(e,t){1&e&&(yl.j41(0,"bit-callout",6),yl.nI1(1,"i18n"),yl.nI1(2,"titlecase"),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s()),2&e&&(yl.Y8G("title",yl.mNQ(yl.bMT(2,5,yl.bMT(1,3,"warning")))),yl.R7$(3),yl.SpI(" ",yl.bMT(4,7,"trashWarning")," "))}function M7(e,t){if(1&e&&(yl.qex(0),yl.nrm(1,"app-trash-list-items-container",7),yl.nI1(2,"i18n"),yl.bVm()),2&e){const e=yl.XpG().ngIf;yl.R7$(),yl.Y8G("headerText",yl.bMT(2,2,"itemsInTrash"))("ciphers",e)}}function N7(e,t){if(1&e&&(yl.j41(0,"bit-no-items",8),yl.qex(1,9),yl.EFF(2),yl.nI1(3,"i18n"),yl.bVm(),yl.qex(4,10),yl.EFF(5),yl.nI1(6,"i18n"),yl.bVm(),yl.k0s()),2&e){const e=yl.XpG(2);yl.Y8G("icon",e.emptyTrashIcon),yl.R7$(2),yl.SpI(" ",yl.bMT(3,3,"noItemsInTrash")," "),yl.R7$(3),yl.SpI(" ",yl.bMT(6,5,"noItemsInTrashDesc")," ")}}function V7(e,t){if(1&e&&(yl.qex(0),yl.DNE(1,U7,5,9,"bit-callout",4)(2,M7,3,4,"ng-container",5)(3,N7,7,7,"ng-template",null,0,yl.C5r),yl.bVm()),2&e){const e=t.ngIf,i=yl.sdS(4);yl.R7$(),yl.Y8G("ngIf",e.length),yl.R7$(),yl.Y8G("ngIf",e.length)("ngIfElse",i)}}O7.ɵfac=function(e){return new(e||O7)(yl.rXU(Fb),yl.rXU(za),yl.rXU(xb),yl.rXU(Pl),yl.rXU(Jd),yl.rXU($E),yl.rXU(Ok),yl.rXU(ud.Ix))},O7.ɵcmp=yl.VBU({type:O7,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&&yl.DNE(0,$7,8,3,"bit-section",1),2&e&&yl.Y8G("ngIf",null==t.ciphers?null:t.ciphers.length)},dependencies:[pl.MD,pl.Sq,pl.bT,wP,IP,FP,SP,RP,qf,jb,GO,ZR,ex,i$,Dh,gL,bL,LE,_l,zl,ZE,Xl,Wl,Xf],encapsulation:2,changeDetection:0});class B7{constructor(e){this.vaultPopupItemsService=e,this.deletedCiphers$=this.vaultPopupItemsService.deletedCiphers$,this.emptyTrashIcon=T7}}B7.ɵfac=function(e){return new(e||B7)(yl.rXU(J3))},B7.ɵcmp=yl.VBU({type:B7,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&&(yl.j41(0,"popup-page")(1,"popup-header",1),yl.nI1(2,"i18n"),yl.qex(3,2),yl.nrm(4,"app-pop-out"),yl.bVm(),yl.k0s(),yl.DNE(5,V7,5,3,"ng-container",3),yl.nI1(6,"async"),yl.k0s()),2&e&&(yl.R7$(),yl.Y8G("pageTitle",yl.bMT(2,2,"trash")),yl.R7$(4),yl.Y8G("ngIf",yl.bMT(6,4,t.deletedCiphers$)))},dependencies:[pl.MD,pl.bT,qf,hD,yD,eD,O7,td,ed,Eh,pj,pl.Jj,pl.PV,Xf],encapsulation:2,changeDetection:0});var j7=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 G7(e,t){1&e&&(yl.j41(0,"span",12),yl.nI1(1,"i18n"),yl.EFF(2," 1 "),yl.k0s()),2&e&&yl.BMQ("aria-label",yl.bMT(1,1,"nudgeBadgeAria"))}function L7(e,t){1&e&&(yl.j41(0,"bit-item")(1,"a",13),yl.EFF(2),yl.nI1(3,"i18n"),yl.nrm(4,"i",3),yl.k0s()()),2&e&&(yl.R7$(2),yl.SpI(" ",yl.bMT(3,1,"archiveNoun")," "))}function z7(e,t){1&e&&yl.nrm(0,"app-premium-badge")}function _7(e,t){if(1&e){const e=yl.RV6();yl.j41(0,"bit-item")(1,"a",14),yl.bIt("click",function(t){a.eBV(e);const i=yl.XpG(2);return a.Njj(i.conditionallyRouteToArchive(t))}),yl.j41(2,"span",15),yl.EFF(3),yl.nI1(4,"i18n"),yl.nVh(5,z7,1,0,"app-premium-badge"),yl.k0s(),yl.nrm(6,"i",3),yl.k0s()()}if(2&e){const e=yl.XpG(2);yl.R7$(3),yl.SpI(" ",yl.bMT(4,2,"archiveNoun")," "),yl.R7$(2),yl.vxM(e.userHasArchivedItems()?-1:5)}}function K7(e,t){if(1&e&&yl.nVh(0,L7,5,3,"bit-item")(1,_7,7,4,"bit-item"),2&e){const e=yl.XpG();yl.vxM(e.userCanArchive()?0:1)}}class X7{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)(uU),this.lastSync="--",this.userId$=this.accountService.activeAccount$.pipe(Gp),this.userCanArchive=(0,wl.ot)(this.userId$.pipe((0,co.n)(e=>this.cipherArchiveService.userCanArchive$(e)))),this.showArchiveItem=(0,wl.ot)(this.cipherArchiveService.hasArchiveFlagEnabled$),this.userHasArchivedItems=(0,wl.ot)(this.userId$.pipe((0,co.n)(e=>this.cipherArchiveService.archivedCiphers$(e).pipe((0,l.T)(e=>e.length>0))))),this.emptyVaultImportBadge$=this.accountService.activeAccount$.pipe(Gp,(0,co.n)(e=>this.nudgeService.showNudgeBadge$(VR.VaultSettingsImportNudge,e)))}ngOnInit(){return j7(this,void 0,void 0,function*(){yield this.setLastSync()})}ngOnDestroy(){return j7(this,void 0,void 0,function*(){const e=yield(0,ho._)(this.accountService.activeAccount$.pipe(Gp));yield this.nudgeService.dismissNudge(VR.VaultSettingsImportNudge,e)})}import(){return j7(this,void 0,void 0,function*(){yield this.router.navigate(["/import"]),(yield tl.isPopupOpen())&&(yield rl.openCurrentPagePopout(window))})}sync(){return j7(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 j7(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 j7(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))})}}X7.ɵfac=function(e){return new(e||X7)(yl.rXU(ud.Ix),yl.rXU(ux),yl.rXU(xb),yl.rXU(Pl),yl.rXU(jR),yl.rXU(Ok),yl.rXU(BV))},X7.ɵcmp=yl.VBU({type:X7,selectors:[["ng-component"]],viewQuery:function(e,t){1&e&&yl.wEZ(t.premiumBadgeComponent,uU,5),2&e&&yl.NyB()},features:[yl.Jv_([{provide:sU,useClass:t1}])],decls:38,vars:23,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"],[1,"tw-flex","tw-items-center","tw-justify-center","tw-gap-2"],["bitBadge","","variant","notification",4,"ngIf"],["slot","end","aria-hidden","true",1,"bwi","bwi-popout"],["bit-item-content","","routerLink","/export"],["bit-item-content","","routerLink","/trash"],["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&&(yl.j41(0,"popup-page")(1,"popup-header",0),yl.nI1(2,"i18n"),yl.qex(3,1),yl.nrm(4,"app-pop-out"),yl.bVm(),yl.k0s(),yl.j41(5,"bit-item-group")(6,"bit-item")(7,"a",2),yl.EFF(8),yl.nI1(9,"i18n"),yl.nrm(10,"i",3),yl.k0s()(),yl.j41(11,"bit-item")(12,"button",4),yl.bIt("click",function(){return t.import()}),yl.j41(13,"div",5)(14,"p"),yl.EFF(15),yl.nI1(16,"i18n"),yl.k0s(),yl.DNE(17,G7,3,3,"span",6),yl.nI1(18,"async"),yl.k0s(),yl.nrm(19,"i",7),yl.k0s()(),yl.j41(20,"bit-item")(21,"a",8),yl.EFF(22),yl.nI1(23,"i18n"),yl.nrm(24,"i",3),yl.k0s()(),yl.nVh(25,K7,2,1),yl.j41(26,"bit-item")(27,"a",9),yl.EFF(28),yl.nI1(29,"i18n"),yl.nrm(30,"i",3),yl.k0s()(),yl.j41(31,"bit-item")(32,"button",4),yl.bIt("click",function(){return t.sync()}),yl.EFF(33),yl.nI1(34,"i18n"),yl.j41(35,"span",10),yl.EFF(36),yl.k0s(),yl.nrm(37,"i",11),yl.k0s()()()()),2&e&&(yl.R7$(),yl.Y8G("pageTitle",yl.bMT(2,9,"settingsVaultOptions")),yl.R7$(7),yl.SpI(" ",yl.bMT(9,11,"folders")," "),yl.R7$(7),yl.JRh(yl.bMT(16,13,"importNoun")),yl.R7$(2),yl.Y8G("ngIf",yl.bMT(18,15,t.emptyVaultImportBadge$)),yl.R7$(5),yl.SpI(" ",yl.bMT(23,17,"exportNoun")," "),yl.R7$(3),yl.vxM(t.showArchiveItem()?25:-1),yl.R7$(3),yl.SpI(" ",yl.bMT(29,19,"trash")," "),yl.R7$(5),yl.SpI(" ",yl.bMT(34,21,"syncNow")," "),yl.R7$(3),yl.JRh(t.lastSync))},dependencies:[pl.MD,pl.bT,qf,sw.iI,sw.Wk,hD,yD,eD,wP,IP,FP,RP,_c,uU,pl.Jj,Xf],encapsulation:2});var q7=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 Y7(e,t){if(1&e&&(yl.nrm(0,"bit-icon",9),yl.nI1(1,"i18n")),2&e){const e=yl.XpG();yl.Y8G("icon",e.logo)("ariaLabel",yl.bMT(1,2,"appLogoLabel"))}}function W7(e,t){1&e&&yl.nrm(0,"app-current-account")}class H7{constructor(e,t,i,n,r){this.router=e,this.route=t,this.i18nService=i,this.extensionAnonLayoutWrapperDataService=n,this.accountSwitcherService=r,this.destroy$=new go.B,this.showLogo=!0,this.hasLoggedInAccount=!1,this.hideCardWrapper=!1,this.logo=OW}ngOnInit(){return q7(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,Jv.Q)(this.destroy$)).subscribe(e=>{this.hasLoggedInAccount=e.some(e=>"addAccount"!==e.id)})})}listenForPageDataChanges(){this.router.events.pipe((0,To.p)(e=>e instanceof ud.wF),(0,Fo.M)(()=>this.resetPageData()),(0,co.n)(()=>{var e;return(null===(e=this.route.firstChild)||void 0===e?void 0:e.data)||null}),(0,Jv.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,Jv.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()}}H7.ɵfac=function(e){return new(e||H7)(yl.rXU(ud.Ix),yl.rXU(ud.nX),yl.rXU(Pl),yl.rXU(sk),yl.rXU(fF))},H7.ɵcmp=yl.VBU({type:H7,selectors:[["ng-component"]],decls:11,vars:14,consts:[[3,"disablePadding"],["slot","header",3,"background","showBackButton","pageTitle"],[1,"tw-w-32"],[3,"icon","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,"icon","ariaLabel"]],template:function(e,t){1&e&&(yl.j41(0,"popup-page",0)(1,"popup-header",1)(2,"div",2),yl.DNE(3,Y7,2,4,"bit-icon",3),yl.k0s(),yl.qex(4,4),yl.nrm(5,"app-pop-out"),yl.DNE(6,W7,1,0,"app-current-account",5),yl.bVm(),yl.k0s(),yl.j41(7,"auth-anon-layout",6),yl.nrm(8,"router-outlet")(9,"router-outlet",7)(10,"router-outlet",8),yl.k0s()()),2&e&&(yl.Y8G("disablePadding",!0),yl.R7$(),yl.Y8G("background","alt")("showBackButton",t.showBackButton)("pageTitle",""),yl.R7$(2),yl.Y8G("ngIf",t.showLogo),yl.R7$(3),yl.Y8G("ngIf",t.showAcctSwitcher&&t.hasLoggedInAccount),yl.R7$(),yl.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:[eH,pl.MD,pl.bT,PF,$h,SC,eD,hD,yD,sw.iI,ud.n3,Hl],encapsulation:2});var J7=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 Z7(){return()=>J7(this,void 0,void 0,function*(){return(0,a.WQX)(Q7).canActivate()})}class Q7{constructor(e){this.router=e,this.navigationStartSub=this.router.events.pipe((0,To.p)(e=>e instanceof ud.Z),(0,Qv.J)()).subscribe(e=>[this.lastNavigation,this.thisNavigation]=e),this.navigationSuccessSub=this.router.events.pipe((0,To.p)(e=>e instanceof ud.wF)).subscribe(e=>this.lastNavigationSuccessId=e.id)}canActivate(){return J7(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()}}Q7.ɵfac=function(e){return new(e||Q7)(a.KVO(ud.Ix))},Q7.ɵprov=a.jDH({token:Q7,factory:Q7.ɵfac});const e5=lw` `,t5=lw` `,i5=lw` `,n5=lw` `,r5=lw` `,s5=lw` `,o5=lw` `,a5=lw` `;class l5{constructor(e,t){this.nudgesService=e,this.accountService=t,this.hasActiveBadges$=this.accountService.activeAccount$.pipe(Gp).pipe((0,co.n)(e=>this.nudgesService.hasActiveBadges$(e))),this.navButtons$=this.hasActiveBadges$.pipe((0,sd.Z)(!1),(0,l.T)(e=>[{label:"vault",page:"/tabs/vault",icon:e5,iconActive:t5},{label:"generator",page:"/tabs/generator",icon:i5,iconActive:n5},{label:"send",page:"/tabs/send",icon:r5,iconActive:s5},{label:"settings",page:"/tabs/settings",icon:o5,iconActive:a5,showBerry:e}]))}}l5.ɵfac=function(e){return new(e||l5)(yl.rXU(jR),yl.rXU(Ok))},l5.ɵcmp=yl.VBU({type:l5,selectors:[["app-tabs-v2"]],standalone:!1,decls:3,vars:3,consts:[[3,"navButtons"]],template:function(e,t){1&e&&(yl.j41(0,"popup-tab-navigation",0),yl.nI1(1,"async"),yl.nrm(2,"router-outlet"),yl.k0s()),2&e&&yl.Y8G("navButtons",yl.bMT(1,1,t.navButtons$))},dependencies:[ud.n3,CY,pl.Jj],encapsulation:2});const c5={homepage:()=>rl.inPopout(window)?"/tabs/vault":"/tabs/current"},u5=[{path:"",pathMatch:"full",children:[],canActivate:[()=>{const e=(0,a.WQX)(aD),t=(0,a.WQX)(ud.Sd);return e.hasRestoredCache?(0,Oo.of)(!0):e.last$().pipe((0,l.T)(i=>!i||(e.markCacheRestored(),t.parse(i.url))))},function(e={}){const t=Object.assign(Object.assign({},zY),e);return e=>LY(this,void 0,void 0,function*(){const i=(0,a.WQX)(dd),n=(0,a.WQX)(Cp),r=(0,a.WQX)(Nk),s=(0,a.WQX)(Ok),o=(0,a.WQX)(za),l=(0,a.WQX)(ud.Ix),c=yield i.getAuthStatus();if(c===cd.LoggedOut)return l.createUrlTree([t.loggedOut],{queryParams:e.queryParams});if(c===cd.Unlocked)return l.createUrlTree([t.loggedIn],{queryParams:e.queryParams});const u=yield(0,ho._)(r.supportsDeviceTrust$),d=yield(0,ho._)(s.activeAccount$.pipe(Gp)),h=yield(0,ho._)(n.everHadUserKey$(d));return c===cd.Locked&&u&&!h?(o.info("Sending user to TDE decryption options. AuthStatus is %s. TDE support is %s. Ever had user key is %s.",cd[c],u,h),l.createUrlTree([t.notDecrypted],{queryParams:e.queryParams})):c===cd.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:XJ,canActivate:[(e,t)=>bH(void 0,void 0,void 0,function*(){const i=(0,a.WQX)(yH),n=(0,a.WQX)(dd),r=(0,a.WQX)(ud.Ix);return(yield n.getAuthStatus())!==cd.Locked||(i.setPreviousUrl(t.url),r.createUrlTree(["/lock"],{queryParams:e.queryParams}))})],data:{elevation:1}},{path:"",component:H7,children:[{path:EY.AuthenticationTimeout,canActivate:[qY(c5)],children:[{path:"",component:DY}],data:{pageTitle:{key:"authenticationTimeout"},pageIcon:cC,elevation:1}}]},{path:EY.NewDeviceVerification,component:H7,canActivate:[qY(),function(){return()=>jY(this,void 0,void 0,function*(){const e=(0,a.WQX)(pw),t=(0,a.WQX)(za),i=(0,a.WQX)(ud.Ix);return null!==(yield(0,ho._)(e.currentAuthType$))||(t.error("No active login session found."),i.createUrlTree(["/login"]))})}()],children:[{path:"",component:lF}],data:{pageIcon:DT,pageTitle:{key:"verifyYourIdentity"},pageSubtitle:{key:"weDontRecognizeThisDevice"},showBackButton:!0,elevation:1}},{path:"remove-password",component:H7,canActivate:[BY],data:{elevation:1},children:[{path:"",component:bA,data:{pageTitle:{key:"verifyYourOrganization"},showBackButton:!1,pageIcon:iW}}]},{path:"view-cipher",component:z6,canActivate:[BY],data:{elevation:3}},{path:"cipher-password-history",component:p3,canActivate:[BY],data:{elevation:4}},{path:"add-cipher",component:H2,canActivate:[BY,Z7()],data:{elevation:1,resetRouterCacheOnTabChange:!0},runGuardsAndResolvers:"always"},{path:"edit-cipher",component:H2,canActivate:[BY,Z7()],data:{elevation:3,resetRouterCacheOnTabChange:!0},runGuardsAndResolvers:"always"},{path:"attachments",component:n3,canActivate:[BY],data:{elevation:4}},{path:"generator",component:EZ,canActivate:[BY],data:{elevation:0}},{path:"generator-history",component:DZ,canActivate:[BY],data:{elevation:1}},{path:"import",component:i2,canActivate:[BY,OZ()],data:{elevation:1}},{path:"export",component:e2,canActivate:[BY],data:{elevation:2}},{path:"autofill",component:vY,canActivate:[BY],data:{elevation:1}},{path:gH.AccountSecurity,component:VD,canActivate:[BY],data:{elevation:1}},{path:gH.DeviceManagement,component:iJ,canActivate:[BY],data:{elevation:1}},{path:"notifications",component:SY,canActivate:[BY],data:{elevation:1}},{path:"vault-settings",component:X7,canActivate:[BY],data:{elevation:1}},{path:"folders",component:w7,canActivate:[BY],data:{elevation:2}},{path:"blocked-domains",component:iZ,canActivate:[BY],data:{elevation:2}},{path:"excluded-domains",component:uZ,canActivate:[BY],data:{elevation:2}},{path:"premium",component:mZ,canActivate:[BY],data:{elevation:3}},{path:"appearance",component:n7,canActivate:[BY],data:{elevation:1}},{path:"clone-cipher",component:H2,canActivate:[BY],data:{elevation:1}},{path:"add-send",component:k0,canActivate:[BY,OZ()],data:{elevation:1}},{path:"edit-send",component:k0,canActivate:[BY,OZ()],data:{elevation:1}},{path:"send-created",component:T0,canActivate:[BY],data:{elevation:1}},{path:"",component:H7,children:[{path:EY.SignUp,canActivate:[qY()],data:{elevation:1,pageIcon:EI,pageTitle:{key:"createAccount"},showBackButton:!0},children:[{path:"",component:QI},{path:"",component:pC,outlet:"secondary",data:{loginRoute:`/${EY.Login}`}}]},{path:EY.FinishSignUp,canActivate:[qY()],data:{pageIcon:iW,elevation:1,showBackButton:!0},children:[{path:"",component:lC}]},{path:EY.SetInitialPassword,canActivate:[BY],component:RW,data:{elevation:1}},{path:EY.Login,canActivate:[qY(c5),()=>K6(void 0,void 0,void 0,function*(){const e=(0,a.WQX)(ud.Ix),t=(0,a.WQX)(l3);return!!(yield(0,ho._)(t.introCarouselState$))||e.createUrlTree(["/intro-carousel"])})],data:{pageIcon:uw,pageTitle:{key:"logInToBitwarden"},elevation:1,showAcctSwitcher:!0},children:[{path:"",component:Sk},{path:"",component:Ck,outlet:"secondary"},{path:"",component:NY,outlet:"environment-selector"}]},{path:EY.LoginWithPasskey,canActivate:[qY(c5),function(e,t=!1){return(i,n)=>wH(this,void 0,void 0,function*(){const i=yield tl.getPlatformInfo(),r=e.includes(i.os),s=rl.inPopout(window),o=rl.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 rl.openPopout(`popup/index.html#${r}`),tl.closePopup(window),!1}return!0})}(["linux"])],data:{pageIcon:$T,pageTitle:{key:"logInWithPasskey"},pageSubtitle:{key:"readingPasskeyLoadingInfo"},elevation:1,showBackButton:!0},children:[{path:"",component:tW},{path:"",component:NY,outlet:"environment-selector"}]},{path:EY.Sso,canActivate:[qY(c5)],data:{pageIcon:uw,pageTitle:{key:"enterpriseSingleSignOn"},pageSubtitle:{key:"singleSignOnEnterOrgIdentifierText"},elevation:1},children:[{path:"",component:aT},{path:"",component:NY,outlet:"environment-selector"}]},{path:EY.LoginWithDevice,canActivate:[WY()],data:{pageIcon:xW,pageTitle:{key:"logInRequestSent"},pageSubtitle:{key:"aNotificationWasSentToYourDevice"},showBackButton:!0,elevation:1},children:[{path:"",component:SI},{path:"",component:NY,outlet:"environment-selector"}]},{path:EY.PasswordHint,canActivate:[qY(c5)],data:{pageTitle:{key:"requestPasswordHint"},pageSubtitle:{key:"enterYourAccountEmailAddressAndYourPasswordHintWillBeSentToYou"},pageIcon:AW,showBackButton:!0,elevation:1},children:[{path:"",component:AI},{path:"",component:NY,outlet:"environment-selector"}]},{path:EY.AdminApprovalRequested,canActivate:[WY()],data:{pageIcon:xW,pageTitle:{key:"adminApprovalRequested"},pageSubtitle:{key:"adminApprovalRequestSentToAdmins"},showLogo:!1,showBackButton:!0,elevation:1},children:[{path:"",component:SI}]},{path:EY.LoginInitiated,canActivate:[function(){return(e,t)=>_Y(this,void 0,void 0,function*(){const e=(0,a.WQX)(dd),t=(0,a.WQX)(Cp),i=(0,a.WQX)(Nk),n=(0,a.WQX)(Ok),r=(0,a.WQX)(za),s=(0,a.WQX)(ud.Ix),o=yield(0,ho._)(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,ho._)(i.supportsDeviceTrust$),d=yield(0,ho._)(t.everHadUserKey$(o));return c!==cd.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.",cd[c],u,d),!0)})}()],data:{pageIcon:xW,showAcctSwitcher:!0},children:[{path:"",component:tI}]},{path:"lock",canActivate:[function(){return(e,t)=>GY(this,void 0,void 0,function*(){const t=(0,a.WQX)(dd),i=(0,a.WQX)(Cp),n=(0,a.WQX)(Nk),r=(0,a.WQX)(ud.Ix),s=(0,a.WQX)(bC),o=(0,a.WQX)(Ep),l=(0,a.WQX)(Ok),c=(0,a.WQX)(iT),u=yield(0,ho._)(l.activeAccount$);if(!u)return r.createUrlTree(["/"]);if((yield(0,ho._)(t.authStatusFor$(u.id)))!==cd.Locked)return r.createUrlTree(["/"]);if(null!=(yield(0,ho._)(c.requiresDomainConfirmation$(u.id))))return r.createUrlTree(["confirm-key-connector-domain"]);if(!(yield o.canLock(u.id)))return!1;const d=yield(0,ho._)(n.supportsDeviceTrust$);if("login-initiated"===e.queryParams.from&&d&&(yield s.hasMasterPassword()))return!0;const h=yield(0,ho._)(i.everHadUserKey$(u.id));return!(d&&!h)})}()],data:{pageIcon:iW,pageTitle:{key:"yourVaultIsLockedV2"},showReadonlyHostname:!0,showAcctSwitcher:!0,elevation:1,doNotSaveUrl:!0},children:[{path:"",component:aA}]},{path:EY.TwoFactor,canActivate:[qY(c5),(e,t)=>iF(void 0,void 0,void 0,function*(){const e=(0,a.WQX)(pw),t=(0,a.WQX)(BT),i=(0,a.WQX)(ud.Ix),n=null!==(yield(0,ho._)(e.currentAuthType$)),r=yield t.getProviders();return!(!n||null==r)||i.createUrlTree(["/login"])})],children:[{path:"",component:tF}],data:{elevation:1,pageTitle:{key:"verifyYourIdentity"},showBackButton:!0,pageIcon:null}},{path:EY.ChangePassword,data:{elevation:1,hideFooter:!0,pageIcon:iW},children:[{path:"",component:uW}],canActivate:[BY]}]},{path:"assign-collections",component:e3,canActivate:[BY],data:{elevation:1}},{path:"about",component:P1,canActivate:[BY],data:{elevation:1}},{path:"more-from-bitwarden",component:C7,canActivate:[BY],data:{elevation:2}},{path:"download-bitwarden",component:f7,canActivate:[BY],data:{elevation:2}},{path:"intro-carousel",component:H7,canActivate:[],data:{elevation:0,doNotSaveUrl:!0},children:[{path:"",component:u3,data:{pageIcon:null,hideFooter:!0}}]},{path:"confirm-key-connector-domain",component:H7,canActivate:[],data:{elevation:1},children:[{path:"",component:PA,data:{pageTitle:{key:"verifyYourOrganization"},showBackButton:!0,pageIcon:DW}}]},{path:"tabs",component:l5,data:{elevation:0},children:[{path:"",redirectTo:"/tabs/vault",pathMatch:"full"},{path:"current",redirectTo:"/tabs/vault"},{path:"vault",component:U6,canActivate:[BY],canDeactivate:[(e,t,i,n)=>{const r=(0,a.WQX)(J3),s=(0,a.WQX)(H3);return n&&!_6(n.url)&&(r.applyFilter(""),s.resetFilterForm()),!0}],data:{elevation:0}},{path:"generator",component:EZ,canActivate:[BY],data:{elevation:0}},{path:"settings",component:l2,canActivate:[BY],data:{elevation:0}},{path:"send",component:p1,canActivate:[BY],data:{elevation:0}}]},{path:"at-risk-passwords",component:E2,canActivate:[BY,()=>{const e=(0,a.WQX)(Ok),t=(0,a.WQX)(kE),i=(0,a.WQX)(xb),n=(0,a.WQX)(Pl),r=(0,a.WQX)(ud.Ix);return e.activeAccount$.pipe(CE(),(0,co.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)(Ok),t=(0,a.WQX)(kE),i=(0,a.WQX)(Fb),n=(0,a.WQX)(ud.Ix);return e.activeAccount$.pipe(CE(),(0,co.n)(e=>(0,$o.z)([t.pendingTasks$(e.id),i.cipherViews$(e.id).pipe(CE(),(0,l.T)(e=>Object.fromEntries(e.map(e=>[e.id,e]))))]).pipe((0,l.T)(([e,t])=>!!e.some(e=>e.type===yE&&null!=e.cipherId&&null!=t[e.cipherId]&&!t[e.cipherId].isDeleted)||n.createUrlTree(["/tabs/vault"])))))}]},{path:gH.AccountSwitcher,component:mH,data:{elevation:4,doNotSaveUrl:!0}},{path:"trash",component:B7,canActivate:[BY],data:{elevation:2}},{path:"archive",component:h7,canActivate:[BY],data:{elevation:2}},{path:"security",component:tH,children:[{path:"phishing-warning",children:[{path:"",component:PZ},{path:"",component:FZ,outlet:"secondary"}],data:{pageIcon:null,hideBackgroundIllustration:!0,showReadonlyHostname:!0}}]}];class d5{shouldDetach(e){return!1}store(e,t){}shouldAttach(e){return!1}retrieve(e){return null}shouldReuseRoute(e,t){return!1}}d5.ɵfac=function(e){return new(e||d5)},d5.ɵprov=a.jDH({token:d5,factory:d5.ɵfac});class h5{}h5.ɵfac=function(e){return new(e||h5)},h5.ɵmod=yl.$C({type:h5}),h5.ɵinj=a.G2t({providers:[{provide:ud.b,useClass:d5}],imports:[sw.iI.forRoot(u5,{useHash:!0,onSameUrlNavigation:"reload"}),sw.iI]});const p5=(0,gl.P)(":enter, :leave",[(0,gl.iF)({position:"fixed",width:"100%",height:"100%"})],{optional:!0}),f5=(0,gl.P)("router-outlet ~ *",[(0,gl.iF)({}),(0,gl.i0)(1,(0,gl.iF)({}))],{optional:!0});function v5(e,t,i,n,r=1e3){return(0,gl.P)(":"+e,[(0,gl.iF)({transform:"translate"+t+"("+i+"%)",zIndex:r,boxShadow:"0 3px 2px -2px gray"}),(0,gl.i0)(("X"===t?"0.225s":"0.3s")+" ease-in-out",(0,gl.iF)({transform:"translate"+t+"("+n+"%)"}))],{optional:!0})}const m5={slideInFromRight:[p5,(0,gl.Os)([v5("enter","X",100,0,1010),v5("leave","X",0,0),f5])],slideOutToRight:[p5,(0,gl.Os)([v5("enter","X",0,0),v5("leave","X",0,100,1010)])]},g5=(0,gl.hZ)("routerTransition",[(0,gl.kY)("0 => 1",m5.slideInFromRight),(0,gl.kY)("0 => 2",m5.slideInFromRight),(0,gl.kY)("0 => 3",m5.slideInFromRight),(0,gl.kY)("0 => 4",m5.slideInFromRight),(0,gl.kY)("1 => 2",m5.slideInFromRight),(0,gl.kY)("1 => 3",m5.slideInFromRight),(0,gl.kY)("1 => 4",m5.slideInFromRight),(0,gl.kY)("2 => 3",m5.slideInFromRight),(0,gl.kY)("2 => 4",m5.slideInFromRight),(0,gl.kY)("3 => 4",m5.slideInFromRight),(0,gl.kY)("1 => 0",m5.slideOutToRight),(0,gl.kY)("2 => 0",m5.slideOutToRight),(0,gl.kY)("2 => 1",m5.slideOutToRight),(0,gl.kY)("3 => 0",m5.slideOutToRight),(0,gl.kY)("3 => 1",m5.slideOutToRight),(0,gl.kY)("3 => 2",m5.slideOutToRight),(0,gl.kY)("4 => 0",m5.slideOutToRight),(0,gl.kY)("4 => 1",m5.slideOutToRight),(0,gl.kY)("4 => 2",m5.slideOutToRight),(0,gl.kY)("4 => 3",m5.slideOutToRight)]);class y5{constructor(e,t,i){this.params=e,this.dialogRef=t,this.messageListener=i,this.destroy$=new go.B}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}ngOnInit(){this.messageListener.allMessages$.pipe((0,To.p)(e=>"hideNativeMessagingFingerprintDialog"===e.command),(0,Jv.Q)(this.destroy$)).subscribe(()=>{this.dialogRef.close()})}static open(e,t){return e.open(y5,{data:t,positionStrategy:new Yd})}}y5.ɵfac=function(e){return new(e||y5)(yl.rXU(nd.Qs),yl.rXU(Xd),yl.rXU(ZS))},y5.ɵcmp=yl.VBU({type:y5,selectors:[["ng-component"]],decls:15,vars:10,consts:[["bitDialogTitle",""],["bitDialogContent",""],["bitDialogFooter",""],["bitButton","","type","button","buttonType","primary","bitDialogClose",""]],template:function(e,t){1&e&&(yl.j41(0,"bit-simple-dialog")(1,"span",0),yl.EFF(2),yl.nI1(3,"i18n"),yl.k0s(),yl.j41(4,"span",1)(5,"p"),yl.EFF(6),yl.nI1(7,"i18n"),yl.k0s(),yl.j41(8,"p")(9,"strong"),yl.EFF(10),yl.k0s()()(),yl.qex(11,2),yl.j41(12,"button",3),yl.EFF(13),yl.nI1(14,"i18n"),yl.k0s(),yl.bVm(),yl.k0s()),2&e&&(yl.R7$(2),yl.SpI(" ",yl.bMT(3,4,"desktopSyncVerificationTitle")," "),yl.R7$(4),yl.SpI(" ",yl.bMT(7,6,"desktopIntegrationVerificationText")," "),yl.R7$(4),yl.JRh(t.params.fingerprint.join("-")),yl.R7$(3),yl.SpI(" ",yl.bMT(14,8,"ok")," "))},dependencies:[qf,Xu,Ku,dh,Zd,Vd,Xf],encapsulation:2});class b5{}class w5{}class S5{constructor(e,t){this.document=e,this.i18nService=t}start(){return this.i18nService.locale$.subscribe(e=>{this.document.documentElement.lang=e})}}class k5{}class I5{constructor(e){this.toastrService=e,this.toastContainer=(0,o.ebz)(ml.kZ)}ngOnInit(){this.toastrService.overlayContainer=this.toastContainer()}}I5.ɵfac=function(e){return new(e||I5)(yl.rXU(ml.tw))},I5.ɵcmp=yl.VBU({type:I5,selectors:[["bit-toast-container"]],viewQuery:function(e,t){1&e&&yl.wEZ(t.toastContainer,ml.kZ,5),2&e&&yl.NyB()},decls:1,vars:0,consts:[["role","status","aria-live","polite","aria-atomic","true","toastContainer",""]],template:function(e,t){1&e&&yl.nrm(0,"div",0)},dependencies:[ml.kZ],encapsulation:2});var C5=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 T5(e,t){1&e&&(yl.j41(0,"div",1)(1,"bit-callout",3),yl.EFF(2),yl.nI1(3,"i18n"),yl.j41(4,"a",4),yl.EFF(5),yl.nI1(6,"i18n"),yl.k0s()()()),2&e&&(yl.R7$(2),yl.SpI(" ",yl.bMT(3,2,"wasmNotSupported")," "),yl.R7$(3),yl.SpI(" ",yl.bMT(6,4,"learnMore")," "))}function P5(e,t){if(1&e&&(yl.j41(0,"div",2)(1,"div",5),yl.nrm(2,"router-outlet",null,0),yl.k0s(),yl.nrm(4,"bit-toast-container"),yl.k0s()),2&e){const e=yl.sdS(3),t=yl.XpG();yl.R7$(),yl.Y8G("@routerTransition",t.getRouteElevation(e))}}class F5{constructor(e,t,i,n,r,s,o,c,u,d,h,p,f,v,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=f,this.biometricStateService=v,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)(e7),this.sdkService=(0,a.WQX)($k),this.routerAnimations=!1,this.processingPendingAuth=!1,this.destroy$=new go.B,this.showSdkWarning=this.sdkService.client$.pipe((0,l.T)(()=>!1),(0,vd.W)(()=>(0,Oo.of)(!0))),this.deviceTrustToastService.setupListeners$.pipe((0,wl.pQ)()).subscribe();const F=this.documentLangSetter.start();this.destoryRef.onDestroy(()=>F.unsubscribe())}ngOnInit(){return C5(this,void 0,void 0,function*(){chrome.runtime.connect({name:tD}),this.compactModeService.init(),yield this.popupSizeService.setHeight(),this.accountService.activeAccount$.pipe((0,Jv.Q)(this.destroy$)).subscribe(e=>{this.activeUserId=null==e?void 0:e.id}),this.accountService.activeAccount$.pipe((0,l.T)(e=>null==e?void 0:e.id),(0,lo.F)(),(0,To.p)(e=>null!=e),(0,co.n)(e=>this.authService.authStatusFor$(e).pipe((0,No.s)(1))),(0,To.p)(e=>e===cd.Unlocked),(0,Fo.M)(()=>{this.authRequestAnsweringService.processPendingAuthRequests()}),(0,Jv.Q)(this.destroy$)).subscribe(),this.authService.activeAccountStatus$.pipe((0,To.p)(e=>e===cd.Unlocked),(0,yo.H)(()=>C5(this,void 0,void 0,function*(){yield this.recordActivity()})),(0,Jv.Q)(this.destroy$)).subscribe(),this.authService.activeAccountStatus$.pipe((0,sd.Z)(null),(0,Qv.J)(),(0,To.p)(([e,t])=>e!==cd.Unlocked&&t===cd.Unlocked),(0,Jv.Q)(this.destroy$)).subscribe(()=>{this.authRequestAnsweringService.processPendingAuthRequests()}),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,Fo.M)(e=>C5(this,void 0,void 0,function*(){if("doneLoggingOut"===e.command)this.authService.logOut(()=>C5(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,ho._)(this.userDecryptionOptionsService.userDecryptionOptionsById$(e.userId).pipe((0,l.T)(e=>null!=(null==e?void 0:e.trustedDeviceOption)))),i=yield(0,ho._)(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.processingPendingAuth)return;this.processingPendingAuth=!0;try{const e=yield(0,ho._)(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=DH.open(this.dialogService,{notificationId:i.id}),r=yield(0,ho._)(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.processingPendingAuth=!1}}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(()=>C5(this,void 0,void 0,function*(){yield this.biometricStateService.updateLastProcessReload(),window.location.reload()}),2e3):rl.inPopup(window)&&tl.closePopup(window):"reloadPopup"===e.command?this.router.navigate(["/"]):"convertAccountToKeyConnector"===e.command&&this.router.navigate(["/remove-password"])})),(0,Jv.Q)(this.destroy$)).subscribe(),this.router.events.pipe((0,Jv.Q)(this.destroy$)).subscribe(e=>C5(this,void 0,void 0,function*(){if(e instanceof ud.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,Jv.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 C5(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 C5(this,void 0,void 0,function*(){yield this.dialogService.openSimpleDialog(e)})}showNativeMessagingFingerprintDialog(e){return C5(this,void 0,void 0,function*(){const t=y5.open(this.dialogService,{fingerprint:e.fingerprint});return(0,ho._)(t.closed)})}displayLogoutReason(e){return C5(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)})}}F5.ɵfac=function(e){return new(e||F5)(yl.rXU(dd),yl.rXU(Pl),yl.rXU(ud.Ix),yl.rXU(b5),yl.rXU(Fb),yl.rXU(o.gRc),yl.rXU(yl.SKi),yl.rXU(Eb),yl.rXU(Jd),yl.rXU(ZS),yl.rXU(xb),yl.rXU(Ok),yl.rXU(H6),yl.rXU(wp),yl.rXU(kp),yl.rXU(w5),yl.rXU(fw),yl.rXU(Cp),yl.rXU(a.abz),yl.rXU(S5),yl.rXU(al),yl.rXU(za),yl.rXU(mw),yl.rXU(IH),yl.rXU(k5))},F5.ɵcmp=yl.VBU({type:F5,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&&(yl.nVh(0,T5,7,6,"div",1),yl.nI1(1,"async"),yl.vZN(2,P5,5,1,"div",2)),2&e&&yl.vxM(yl.bMT(1,1,t.showSdkWarning)?0:2)},dependencies:[ud.n3,I5,ed,_b,pl.Jj,Xf],encapsulation:2,data:{animation:[g5]}});class R5{static createSystemThemeFromWindow(e){return(0,bo.h)((0,Oo.of)(R5.getSystemThemeFromWindow(e)),(0,hh.R)(e.matchMedia("(prefers-color-scheme: dark)"),"change").pipe((0,l.T)(e=>e.matches?ap.Dark:ap.Light)))}static getSystemThemeFromWindow(e){return e.matchMedia("(prefers-color-scheme: dark)").matches?ap.Dark:ap.Light}constructor(e,t){this.themeStateService=e,this.systemTheme$=t,this.theme$=this.themeStateService.selectedTheme$.pipe((0,co.n)(e=>e===ap.System?this.systemTheme$:(0,Oo.of)(e)))}applyThemeChangesTo(e){return this.theme$.subscribe(t=>{e.documentElement.classList.remove("theme_"+ap.Light,"theme_"+ap.Dark),e.documentElement.classList.add("theme_"+t)})}}R5.ɵfac=function(e){return new(e||R5)(a.KVO(r$),a.KVO(IT))},R5.ɵprov=a.jDH({token:R5,factory:R5.ɵfac});class x5{}class A5{}class D5 extends A5{}class E5{constructor(e,t){this.state$=e,this.set=t}}class $5{}class O5{constructor(e,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.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.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 O5,e,{familySponsorshipLastSyncDate:null!=e.familySponsorshipLastSyncDate?new Date(e.familySponsorshipLastSyncDate):e.familySponsorshipLastSyncDate,familySponsorshipValidUntil:null!=e.familySponsorshipValidUntil?new Date(e.familySponsorshipValidUntil):e.familySponsorshipValidUntil})}}const U5=k.record(T,"organizations",{deserializer:e=>O5.fromJSON(e),clearOn:["logout"]});var M5=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 N5(){return(0,l.T)(e=>e.length>0)}class V5 extends Uw{constructor(e){super(e),this.apiKey=this.getResponseProperty("ApiKey"),this.revisionDate=new Date(this.getResponseProperty("RevisionDate"))}}class B5 extends Uw{static fromView(e,t=new B5){return t.configType=e.configType,t.memberDecryptionType=e.memberDecryptionType,t.keyConnectorUrl=e.keyConnectorUrl,t.configType===FO.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===FO.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 j5 extends Uw{constructor(e){super(e),this.enabled=this.getResponseProperty("Enabled"),this.identifier=this.getResponseProperty("Identifier"),this.data=null!=this.getResponseProperty("Data")?new B5(this.getResponseProperty("Data")):null,this.urls=new G5(this.getResponseProperty("Urls"))}}class G5 extends Uw{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 L5 extends Uw{constructor(e){super(e),this.balance=this.getResponseProperty("Balance");const t=this.getResponseProperty("PaymentSource");this.paymentSource=null==t?null:new z5(t)}}class z5 extends Uw{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 _5 extends Uw{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 K5 extends Uw{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 X5 extends Uw{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 K5(e))),null!=i&&(this.invoices=i.map(e=>new _5(e)))}get hasNoHistory(){return 0==this.invoices.length&&0==this.transactions.length}}class q5 extends Uw{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 W5(t),this.SecretsManager=null==i?null:new Y5(i)}}class Y5 extends Uw{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 W5 extends Uw{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 H5 extends Uw{constructor(e){var t;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 i=this.getResponseProperty("Plan");this.plan=null==i?null:new q5(i),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.useAccessIntelligence=this.getResponseProperty("UseRiskInsights"),this.usePhishingBlocker=null!==(t=this.getResponseProperty("UsePhishingBlocker"))&&void 0!==t&&t}}class J5 extends Uw{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 Z5(t),this.upcomingInvoice=null==i?null:new e9(i),this.customerDiscount=null==n?null:new i9(n)}}class Z5 extends Uw{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 Q5(e))),this.collectionMethod=this.getResponseProperty("CollectionMethod"),this.suspensionDate=this.getResponseProperty("SuspensionDate"),this.unpaidPeriodEndDate=this.getResponseProperty("unpaidPeriodEndDate"),this.gracePeriod=this.getResponseProperty("GracePeriod")}}class Q5 extends Uw{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 e9 extends Uw{constructor(e){super(e),this.date=this.getResponseProperty("Date"),this.amount=this.getResponseProperty("Amount")}}class t9 extends H5{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 Z5(t);const i=this.getResponseProperty("UpcomingInvoice");this.upcomingInvoice=null==i?null:new e9(i);const n=this.getResponseProperty("CustomerDiscount");this.customerDiscount=null==n?null:new i9(n),this.expiration=this.getResponseProperty("Expiration"),this.expirationWithoutGracePeriod=this.getResponseProperty("ExpirationWithoutGracePeriod")}}class i9 extends Uw{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 n9 extends Uw{constructor(e){super(e);const t=this.getResponseProperty("UserProfile");null!=t&&(this.userProfile=new yx(t)),this.paymentIntentClientSecret=this.getResponseProperty("PaymentIntentClientSecret"),this.success=this.getResponseProperty("Success")}}class r9 extends Uw{constructor(e){super(e),this.keyType=this.getResponseProperty("KeyType")}}class s9 extends Uw{constructor(e){super(e),this.id=this.getResponseProperty("Id"),this.resetPasswordEnabled=this.getResponseProperty("ResetPasswordEnabled")}}class o9 extends Uw{constructor(e){super(e),this.privateKey=this.getResponseProperty("PrivateKey"),this.publicKey=this.getResponseProperty("PublicKey")}}class a9 extends o9{constructor(e){super(e)}}var l9=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 c9 extends Uw{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 u9 extends Uw{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 d9 extends Uw{constructor(e){super(e),this.organizationName=this.getResponseProperty("organizationName"),this.organizationIdentifier=this.getResponseProperty("organizationIdentifier"),this.domainName=this.getResponseProperty("domainName")}}class h9{constructor(e){this.email=e}}var p9=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 f9=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 v9=new k(R,"autoConfirmFingerPrints",{deserializer:e=>e,clearOn:["logout"]});var m9=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 g9 extends Uw{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 y9 extends Uw{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 b9 extends y9{constructor(e){super(e),this.organizationName=this.getResponseProperty("OrganizationName")}}class w9 extends Uw{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 S9=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 k9{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===Xh.Confirmed}get canCreateOrganizations(){return this.enabled&&this.isProviderAdmin}get canManageUsers(){return this.isProviderAdmin}get canAccessEventLogs(){return this.isProviderAdmin}get isProviderAdmin(){return this.type===qh.ProviderAdmin}}var I9=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 C9=k.record(F,"providers",{deserializer:e=>e,clearOn:["logout"]});class T9{}class P9{}class F9{}class R9{}class x9{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 x9(e.token,e.expiresAt)}static fromSendAccessTokenResponse(e){return new x9(e.token,e.expiresAt)}}const A9=m.record(X,"accessTokenDict",{deserializer:e=>x9.fromJson(e)});var D9=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})},E9=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);re,clearOn:[]});class iee{constructor(e){Object.assign(this,e),this.response=e}}var nee=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 ree extends Uw{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 see{constructor(e){this.devices=e}}class oee{constructor(e,t,i){this.encapsulatedDownstreamKey=e,this.encryptedPublicKey=t,this.encryptedPrivateKey=i}}class aee extends Uw{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 up(this.getResponseProperty("encryptedUserKey"))),e.encryptedPublicKey&&(this.encryptedPublicKey=new up(this.getResponseProperty("encryptedPublicKey")))}getRotateableKeyset(){return new oee(this.encryptedUserKey,this.encryptedPublicKey)}isTrusted(){return null!=this.encryptedUserKey&&null!=this.encryptedPublicKey}}class lee{constructor(e,t,i){this.encryptedUserKey=e,this.encryptedPublicKey=t,this.encryptedPrivateKey=i}}var cee=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 uee=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 dee=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 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 pee=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 fee=new m(G,"ssoCodeVerifier",{deserializer:e=>e}),vee=new m(G,"ssoState",{deserializer:e=>e}),mee=new k(G,"organizationSsoIdentifier",{deserializer:e=>e,clearOn:["logout"]}),gee=new m(G,"organizationSsoIdentifier",{deserializer:e=>e}),yee=new m(G,"ssoEmail",{deserializer:e=>e}),bee=new m(L,"ssoRequiredCache",{deserializer:e=>e});class wee{constructor(e,t,i){this.accessToken=e,this.refreshToken=t,this.clientIdSecretPair=i}}const See=new k(z,"accessToken",{deserializer:e=>e,clearOn:[]}),kee=new k(K,"accessToken",{deserializer:e=>e,clearOn:[]}),Iee=new k(z,"refreshToken",{deserializer:e=>e,clearOn:[]}),Cee=new k(K,"refreshToken",{deserializer:e=>e,clearOn:[]}),Tee=m.record(_,"emailTwoFactorTokenRecord",{deserializer:e=>e}),Pee=new k(z,"apiKeyClientId",{deserializer:e=>e,clearOn:[]}),Fee=new k(K,"apiKeyClientId",{deserializer:e=>e,clearOn:[]}),Ree=new k(z,"apiKeyClientSecret",{deserializer:e=>e,clearOn:[]}),xee=new k(K,"apiKeyClientSecret",{deserializer:e=>e,clearOn:[]}),Aee=new k(K,"securityStamp",{deserializer:e=>e,clearOn:["logout"]});var Dee,Eee=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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"}(Dee||(Dee={}));var $ee=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 Oee{constructor(e){this.OTP=e}}var Uee=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 Mee extends Uw{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:kd.fromUrlB64ToArray(e.id).buffer})),this.challenge=kd.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 Nee extends Uw{constructor(e){super(e),this.options=new Mee(this.getResponseProperty("options")),this.token=this.getResponseProperty("token")}}var Vee=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 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())})};class jee{constructor(e,t){this.options=e,this.token=t}}class Gee{constructor(e,t,i){this.token=e,this.deviceResponse=t,this.prfKey=i}}var Lee=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 zee=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 _ee=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 Kee=new k(A,"accountProfile",{deserializer:e=>e,clearOn:["logout"]});class Xee extends Uw{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 qee(t);const i=this.getResponseProperty("Storage");if(!i||"object"!=typeof i)throw new Error("PremiumPlanResponse: Missing or invalid 'Storage' property");this.storage=new qee(i)}}class qee extends Uw{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 Yee extends Uw{constructor(e){super(e),this.invoices=[];const t=this.getResponseProperty("Invoices");t&&t.length&&(this.invoices=t.map(e=>new Wee(e)))}}class Wee extends Uw{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 Hee extends Uw{constructor(e){super(e),this.isOnSecretsManagerStandalone=this.getResponseProperty("IsOnSecretsManagerStandalone"),this.organizationOccupiedSeats=this.getResponseProperty("OrganizationOccupiedSeats")}}class Jee extends Uw{constructor(e){super(e),this.type=this.getResponseProperty("Type"),this.description=this.getResponseProperty("Description"),this.needsVerification=this.getResponseProperty("NeedsVerification")}}class Zee extends Uw{constructor(e){super(e),this.suspensionDate=this.getResponseProperty("suspensionDate"),this.unpaidPeriodEndDate=this.getResponseProperty("unpaidPeriodEndDate"),this.gracePeriod=this.getResponseProperty("gracePeriod")}}class Qee extends Uw{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 ete extends Uw{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 tte(e))),this.accountCredit=this.getResponseProperty("accountCredit");const i=this.getResponseProperty("taxInformation");null!=i&&(this.taxInformation=new Qee(i)),this.cancelAt=this.getResponseProperty("cancelAt");const n=this.getResponseProperty("suspension");null!=n&&(this.suspension=new Zee(n)),this.providerType=this.getResponseProperty("providerType");const r=this.getResponseProperty("paymentSource");null!=r&&(this.paymentSource=new Jee(r))}}class tte extends Uw{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 ite=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 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())})};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 extends Uw{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 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())})};class ate{}class lte extends ate{}class cte extends oS{constructor(e,t){super(e,t)}}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 dte{constructor(e,t,i,n,r){this.billingApiService=e,this.configService=t,this.i18nService=i,this.logService=n,this.environmentService=r,this.getPersonalSubscriptionPricingTiers$=()=>(0,$o.z)([this.premium$,this.families$]).pipe((0,vd.W)(e=>(this.logService.error("Failed to load personal subscription pricing tiers",e),(0,fo.$)(()=>e)))),this.getBusinessSubscriptionPricingTiers$=()=>(0,$o.z)([this.teams$,this.enterprise$,this.custom$]).pipe((0,vd.W)(e=>(this.logService.error("Failed to load business subscription pricing tiers",e),(0,fo.$)(()=>e)))),this.getDeveloperSubscriptionPricingTiers$=()=>(0,$o.z)([this.free$,this.teams$,this.enterprise$]).pipe((0,vd.W)(e=>(this.logService.error("Failed to load developer subscription pricing tiers",e),(0,fo.$)(()=>e)))),this.organizationPlansResponse$=this.environmentService.environment$.pipe((0,No.s)(1),(0,co.n)(e=>e.isCloud()?(0,md.H)(this.billingApiService.getPlans()):(0,Oo.of)({data:[]})),(0,Pp.t)({bufferSize:1,refCount:!1})),this.premiumPlanResponse$=this.environmentService.environment$.pipe((0,No.s)(1),(0,co.n)(e=>e.isCloud()?(0,md.H)(this.billingApiService.getPremiumPlan()).pipe((0,vd.W)(e=>(this.logService.error("Failed to fetch premium plan from API",e),(0,fo.$)(()=>e)))):(0,Oo.of)({seat:void 0,storage:void 0})),(0,Pp.t)({bufferSize:1,refCount:!1})),this.premium$=this.configService.getFeatureFlag$(Nf.PM26793_FetchPremiumPriceFromPricingService).pipe((0,No.s)(1),(0,co.n)(e=>e?this.premiumPlanResponse$.pipe((0,l.T)(e=>{var t,i,n;return{seat:null===(t=e.seat)||void 0===t?void 0:t.price,storage:null===(i=e.storage)||void 0===i?void 0:i.price,provided:null===(n=e.storage)||void 0===n?void 0:n.provided}})):(0,Oo.of)({seat:dte.FALLBACK_PREMIUM_SEAT_PRICE,storage:dte.FALLBACK_PREMIUM_STORAGE_PRICE,provided:dte.FALLBACK_PREMIUM_PROVIDED_STORAGE_GB})),(0,l.T)(e=>({id:M0,name:this.i18nService.t("premium"),description:this.i18nService.t("advancedOnlineSecurity"),availableCadences:[L0],passwordManager:{type:"standalone",annualPrice:e.seat,annualPricePerAdditionalStorageGB:e.storage,providedStorageGB:e.provided,features:[this.featureTranslations.builtInAuthenticator(),this.featureTranslations.secureFileStorage(),this.featureTranslations.emergencyAccess(),this.featureTranslations.breachMonitoring(),this.featureTranslations.andMoreFeatures()]}}))),this.families$=this.organizationPlansResponse$.pipe((0,Op.v)(this.configService.getFeatureFlag$(Nf.PM26462_Milestone_3)),(0,l.T)(([e,t])=>{var i,n,r,s;const o=e.data.find(e=>e.type===(t?KE.FamiliesAnnually:KE.FamiliesAnnually2025));return{id:N0,name:this.i18nService.t("planNameFamilies"),description:this.i18nService.t("planDescFamiliesV2"),availableCadences:[L0],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===KE.Free);return{id:V0,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===KE.TeamsAnnually);return{id:B0,name:this.i18nService.t("planNameTeams"),description:this.i18nService.t("teamsPlanUpgradeMessage"),availableCadences:[L0,z0],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===KE.EnterpriseAnnually);return{id:j0,name:this.i18nService.t("planNameEnterprise"),description:this.i18nService.t("planDescEnterpriseV2"),availableCadences:[L0,z0],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:G0,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")})}}}dte.FALLBACK_PREMIUM_SEAT_PRICE=10,dte.FALLBACK_PREMIUM_STORAGE_PRICE=4,dte.FALLBACK_PREMIUM_PROVIDED_STORAGE_GB=1;class hte extends Uw{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 pte=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 fte{constructor(e){this.apiService=e}getHibpBreach(e){return pte(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 hte(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())})};const mte=new k(Le,"accountCryptographicState",{deserializer:e=>e,clearOn:["logout"]});var gte=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 yte=16;class bte{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 Hh.AesCbc256_HmacSha256_B64:{const e=50;t.length255*r)throw new Error("outputByteSize is too large.");if(new Uint8Array(e).length=i)break}return u.slice(0,i)})}hash(e,t){return kte(this,void 0,void 0,function*(){if("md5"===t){const t=Ste.md.md5.create(),i=this.toByteString(e);return t.update(i,"raw"),kd.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 kte(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=Ste.hmac.create();n.start(i,t),n.update(e);const r=n.digest().getBytes();return Promise.resolve(r)}compareFast(e,t){return kte(this,void 0,void 0,function*(){const i=yield this.randomBytes(32),n=new Uint32Array(i),r=Ste.util.createBuffer();for(let e=0;ee?gf.fromJSON(e):null,clearOn:[],cleanupDelayMs:0,debug:{enableRetrievalLogging:!0,enableUpdateLogging:!0}}),xte=new k(O,"shouldTrustDevice",{deserializer:e=>e,clearOn:[]});var Ate=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 Dte{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 Ate(this,void 0,void 0,function*(){LS(e,"userId"),LS(t,"masterPassword"),this.logService.info(`[MinimumKdfMigration] Updating user ${e} to minimum PBKDF2 iteration count ${xf.ITERATIONS.defaultValue}`),yield this.changeKdfService.updateUserKdfParams(t,new xf(xf.ITERATIONS.defaultValue),e),yield this.kdfConfigService.setKdfConfig(e,new xf(xf.ITERATIONS.defaultValue))})}needsMigration(e){return Ate(this,void 0,void 0,function*(){if(LS(e,"userId"),!(yield this.masterPasswordService.userHasMasterPassword(e)))return"noMigrationNeeded";const t=yield this.kdfConfigService.getKdfConfig(e);return t.kdfType!==Tf.PBKDF2_SHA256||t.iterations>=xf.ITERATIONS.min?"noMigrationNeeded":(yield this.configService.getFeatureFlag(Nf.ForceUpdateKDFSettings))?"needsMigrationWithMasterPassword":"noMigrationNeeded"})}}var Ete=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 $te=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 Ote{}class Ute extends dW{constructor(e,t){super(),this.newMasterPasswordHash=e.masterPasswordAuthenticationHash,this.key=t.masterKeyWrappedUserKey,this.authenticationData=e,this.unlockData=t}}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())})},Nte=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},Vte=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 Bte{constructor(e,t,i,n){this.changeKdfApiService=e,this.sdkService=t,this.keyService=i,this.masterPasswordService=n}updateUserKdfParams(e,t,i){return Mte(this,void 0,void 0,function*(){LS(e,"masterPassword"),LS(t,"kdf"),LS(i,"userId");const n=yield(0,ho._)(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=Nte(n,i.take(),!1);return r.value.crypto().make_update_kdf(e,t.toSdkConfig())}catch(e){n.error=e,n.hasError=!0}finally{Vte(n)}}))),r=Zw(n.masterPasswordAuthenticationData),s=Jw.fromSdk(n.masterPasswordUnlockData),o=Zw(n.oldMasterPasswordAuthenticationData),a=new Ute(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,ep.LocalAuthorization);yield this.masterPasswordService.setMasterKeyHash(u,i),yield this.masterPasswordService.setMasterKey(c,i)})}}class jte{}class Gte extends Uw{constructor(e){super(e),this.organizationName=this.getResponseProperty("OrganizationName")}}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{constructor(e){this.key=e}}class _te{constructor(e,t,i,n){this.key=e,this.kdf=t.kdfType,this.kdfIterations=t.iterations,t.kdfType===Tf.Argon2id&&(this.kdfMemory=t.memory,this.kdfParallelism=t.parallelism),this.orgIdentifier=i,this.keys=n}}var Kte=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 Xte=new k(Ke,"usesKeyConnector",{deserializer:e=>e,clearOn:["logout"],cleanupDelayMs:0}),qte=new k(Ke,"newSsoUserKeyConnectorConversion",{deserializer:e=>null==e?null:{kdfConfig:e.kdfConfig.kdfType===Tf.PBKDF2_SHA256?xf.fromJSON(e.kdfConfig):Af.fromJSON(e.kdfConfig),keyConnectorUrl:e.keyConnectorUrl,organizationId:e.organizationId},clearOn:["logout"],cleanupDelayMs:0});class Yte{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 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 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 k(B,"masterKey",{deserializer:e=>gf.fromJSON(e),clearOn:["lock","logout"]}),eie=new k(V,"masterKeyHash",{deserializer:e=>e,clearOn:["logout"]}),tie=new k(V,"masterKeyEncryptedUserKey",{deserializer:e=>e,clearOn:["logout"]}),iie=new k(V,"forceSetPasswordReason",{deserializer:e=>e,clearOn:["logout"]}),nie=new k(j,"masterPasswordUnlockKey",{deserializer:e=>Jw.fromJSON(e),clearOn:["logout"]});class rie{}const sie=new k(je,"pinProtectedUserKeyEnvelopePersistent",{deserializer:e=>e,clearOn:["logout"]}),oie=new k(Ge,"pinProtectedUserKeyEnvelopeEphemeral",{deserializer:e=>e,clearOn:["logout"]}),aie=new k(je,"userKeyEncryptedPin",{deserializer:e=>e,clearOn:["logout"]});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 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())})};function uie(e,t){return cie(this,void 0,void 0,function*(){const i=yield(0,ho._)(e);if(null==i)throw new Error(`Failed to get ${t}`);return i})}var die=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})},hie=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},pie=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 fie=new k(Le,"accountSecurityState",{deserializer:e=>e,clearOn:["logout"]});var vie=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 mie{}const gie=1e5;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{}class wie{}class Sie{}class kie{}class Iie{openPopup(){throw new Error("Open Popup unsupported.")}}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())})};const Tie=m.record(oe,"ipcSessions",{deserializer:e=>e});class Pie{constructor(e){this.stateProvider=e,this.states=this.stateProvider.getGlobal(Tie)}get(e){return(0,ho._)(this.states.state$.pipe((0,l.T)(t=>null==t?void 0:t[Fie(e)])))}save(e,t){return Cie(this,void 0,void 0,function*(){yield this.states.update(i=>Object.assign(Object.assign({},i),{[Fie(e)]:t}))})}remove(e){return Cie(this,void 0,void 0,function*(){yield this.states.update(t=>{const i=Object.assign({},t);return delete i[Fie(e)],i})})}}function Fie(e){return"object"==typeof e&&"Web"in e?`Web(${e.Web.id})`:e}class Rie{}var xie;!function(e){e[e.SignalR=0]="SignalR",e[e.WebPush=1]="WebPush"}(xie||(xie={}));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 Aie=i(91566),Die=i(63108);const Eie=12e4;class $ie{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 Aie.$.Critical:case Aie.$.Error:this.logService.error(i);break;case Aie.$.Warning:this.logService.warning(i);break;case Aie.$.Information:this.logService.info(i);break;case Aie.$.Debug:this.logService.debug(i)}}}class Oie{constructor(e,t,i,n=()=>new O9.$,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 W9;return new ea.c(i=>{const n=this.hubConnectionBuilderFactory().withUrl(t+"/hub",{accessTokenFactory:()=>this.apiService.getActiveBearerToken(e),skipNegotiation:!0,transport:U9.w.WebSockets}).withHubProtocol(new M9.E).configureLogging(new $ie(this.logService)).build();n.on("ReceiveMessage",e=>{i.next({type:"ReceiveMessage",message:new N9(e)})}),n.on("Heartbeat",()=>{i.next({type:"Heartbeat"})});let r=null;const s=()=>{if(null==n||n.state!==Die.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 Ma.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())+Eie}}var Uie=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 Mie=new Set([Ea.AuthRequest]);class Nie{}class Vie{static from(e){var t,i;const n=new Vie;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 Bie=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 jie{constructor(e,t){this.apiService=e,this.appIdService=t}putSubscription(e,t){return Bie(this,void 0,void 0,function*(){const i=Vie.from(e);yield this.apiService.send("POST",`/devices/identifier/${yield this.appIdService.getAppId()}/web-push-auth`,i,t,!1)})}}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())})};class Lie{constructor(e){var t;this.disableUserRegistration=null!==(t=null==e?void 0:e.disableUserRegistration)&&void 0!==t&&t}}class zie extends Uw{constructor(e){super(e),this.featureStates={},null!=e&&(this.version=this.getResponseProperty("Version"),this.gitHash=this.getResponseProperty("GitHash"),this.server=new Xie(this.getResponseProperty("Server")),this.environment=new Kie(this.getResponseProperty("Environment")),this.featureStates=this.getResponseProperty("FeatureStates"),this.push=new _ie(this.getResponseProperty("Push")),this.settings=new Lie(this.getResponseProperty("Settings")))}}class _ie extends Uw{constructor(e=null){super(e),null!=e&&(this.pushTechnology=this.getResponseProperty("PushTechnology"),this.vapidPublicKey=this.getResponseProperty("VapidPublicKey"))}}class Kie extends Uw{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 Xie extends Uw{constructor(e=null){super(e),null!=e&&(this.name=this.getResponseProperty("Name"),this.url=this.getResponseProperty("Url"))}}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())})};var Yie=i(62329);class Wie{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:xie.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 Wie(e)}}class Hie{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 Zie(e.server):null,this.utcDate=(new Date).toISOString(),this.environment=(null==e?void 0:e.environment)?new Qie(e.environment):null,this.featureStates=null==e?void 0:e.featureStates,this.settings=new Lie(e.settings),this.push=(null==e?void 0:e.push)?new Jie(e.push):null}static fromJSON(e){return Object.assign(new Hie({}),e,{server:(null==e?void 0:e.server)?Zie.fromJSON(e.server):null,environment:(null==e?void 0:e.environment)?Qie.fromJSON(e.environment):null})}}class Jie{constructor(e){this.pushTechnology=e.pushTechnology,this.vapidPublicKey=e.vapidPublicKey}static fromJSON(e){return Object.assign(new Jie({}),e)}}class Zie{constructor(e){this.name=e.name,this.url=e.url}static fromJSON(e){return Object.assign(new Zie({}),e)}}class Qie{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 Qie({}),e)}}var ene=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 tne=new k(ne,"serverConfig",{deserializer:e=>null==e?null:Wie.fromJSON(e),clearOn:["logout"]}),ine=m.record(ne,"byServer",{deserializer:e=>null==e?null:Wie.fromJSON(e)}),nne=(e,t)=>e.getApiUrl()===t.getApiUrl();class rne{constructor(e,t,i,n,r){this.configApiService=e,this.environmentService=t,this.logService=i,this.stateProvider=n,this.authService=r,this.failedFetchFallbackSubject=new go.B;const s=this.environmentService.globalEnvironment$.pipe((0,lo.F)(nne),(0,co.n)(e=>this.globalConfigFor$(e.getApiUrl()).pipe((0,l.T)(t=>[t,null,e,t]))));this.serverConfig$=this.stateProvider.activeUserId$.pipe((0,lo.F)(),(0,co.n)(e=>null==e?s:this.authService.authStatusFor$(e).pipe((0,l.T)(e=>e===cd.Unlocked),(0,lo.F)(),(0,co.n)(t=>t?(0,$o.z)([this.environmentService.getEnvironment$(e).pipe((0,lo.F)(nne)),this.userConfigFor$(e)]).pipe((0,co.n)(([t,i])=>null==i?this.globalConfigFor$(t.getApiUrl()).pipe((0,l.T)(i=>[null,e,t,i])):(0,Oo.of)([i,e,t,i]))):s))),(0,Fo.M)(e=>ene(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,co.n)(([e])=>!e||this.olderThanRetrievalInterval(e.utcDate)?uo.t:(0,Oo.of)(e)),(0,fV.X)(this.failedFetchFallbackSubject),(0,wo.u)({connector:()=>new So.m(1),resetOnRefCountZero:()=>(0,ko.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:qS.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 Lie}))}getFeatureFlag$(e){return this.serverConfig$.pipe((0,l.T)(t=>jf(t,e)))}userCachedFeatureFlag$(e,t){return this.stateProvider.getUser(t,tne).state$.pipe((0,l.T)(t=>jf(t,e)))}getFeatureFlag(e){return ene(this,void 0,void 0,function*(){return yield(0,ho._)(this.getFeatureFlag$(e))})}checkServerMeetsVersionRequirement$(e){return this.serverConfig$.pipe((0,l.T)(t=>{if(null==t)return!1;return new Yie.SemVer(t.version).compare(e)>=0}))}ensureConfigFetched(){return ene(this,void 0,void 0,function*(){yield(0,ho._)(this.serverConfig$)})}olderThanRetrievalInterval(e){return(new Date).getTime()-e.getTime()>36e5}renewConfig(e,t,i,n){return ene(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 Wie(new Hie(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(ine).update(e=>Object.assign(Object.assign({},e),{[i.getApiUrl()]:c})):yield this.stateProvider.setUserState(tne,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(ine).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,tne).state$}}var sne=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 one{static fromJSON(e){return Object.assign(new one,e)}}const ane=new m(re,"environment",{deserializer:one.fromJSON}),lne=new k(re,"environment",{deserializer:one.fromJSON,clearOn:["logout"]}),cne=new m(se,"cloudRegion",{deserializer:e=>e}),une=new k(se,"cloudRegion",{deserializer:e=>e,clearOn:["logout"]}),dne=[{key:qS.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:qS.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"}}],hne=qS.US,pne=dne.find(e=>e.key===hne);class fne{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(ane),this.globalCloudRegionState=this.stateProvider.getGlobal(cne);const n=this.activeAccountId$.pipe((0,lo.F)((e,t)=>e==t));this.globalEnvironment$=this.stateProvider.getGlobal(ane).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,co.n)(e=>e?this.stateProvider.getUser(e,lne).state$:this.stateProvider.getGlobal(ane).state$),(0,l.T)(e=>this.buildEnvironment(null==e?void 0:e.region,null==e?void 0:e.urls))),this.cloudWebVaultUrl$=n.pipe((0,co.n)(e=>e?this.stateProvider.getUser(e,une).state$:this.stateProvider.getGlobal(cne).state$),(0,l.T)(e=>{if(null!=e){const t=this.getRegionConfig(e);if(null!=t)return t.urls.webVault}return pne.urls.webVault}))}availableRegions(){return dne.concat(this.additionalRegionConfigs)}getRegionConfig(e){return this.availableRegions().find(t=>t.key===e)}setEnvironment(e,t){return sne(this,void 0,void 0,function*(){return null==this.getRegionConfig(e)&&(e=qS.SelfHosted),e==qS.SelfHosted&&mne(t)&&(e=hne),e!=qS.SelfHosted?(yield this.globalState.update(()=>({region:e,urls:null})),null):(t.base=vne(t.base),t.webVault=vne(t.webVault),t.api=vne(t.api),t.identity=vne(t.identity),t.icons=vne(t.icons),t.notifications=vne(t.notifications),t.events=vne(t.events),t.keyConnector=vne(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=qS.SelfHosted),e==qS.SelfHosted&&mne(t)&&(e=hne),e!=qS.SelfHosted){const t=this.getRegionConfig(e);if(null!=t)return new yne(t)}return new bne(t)}setCloudRegion(e,t){return sne(this,void 0,void 0,function*(){null==e?yield this.globalCloudRegionState.update(()=>t):yield this.stateProvider.getUser(e,une).update(()=>t)})}getEnvironment$(e){return this.stateProvider.getUser(e,lne).state$.pipe((0,l.T)(e=>this.buildEnvironment(null==e?void 0:e.region,null==e?void 0:e.urls)))}getEnvironment(e){return sne(this,void 0,void 0,function*(){const t=null!=e?e:yield(0,ho._)(this.activeAccountId$);return(0,ho._)(this.getEnvironment$(t))})}seedUserEnvironment(e){return sne(this,void 0,void 0,function*(){const t=yield(0,ho._)(this.globalState.state$);yield this.stateProvider.getUser(e,lne).update(()=>t)})}}function vne(e){return null==e||""===e?null:((e=e.replace(/\/+$/g,"")).startsWith("http://")||e.startsWith("https://")||(e="https://"+e),e.trim())}function mne(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 gne{constructor(e,t){this.region=e,this.urls=t,e==qS.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!==qS.SelfHosted}getUrl(e,t){return null!=this.urls[e]?this.urls[e]:this.urls.base?this.urls.base+t:pne.urls[e]}}class yne extends gne{constructor(e){super(e.key,e.urls),this.config=e}getHostname(){return this.config.domain}}class bne extends gne{constructor(e){super(qS.SelfHosted,e)}getHostname(){return kd.getHost(this.getWebVaultUrl())}}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())})};class Sne{constructor(e,t){this.logService=e,this.apiService=t}upload(e,t,i){return wne(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 wne(this,void 0,void 0,function*(){const i=kd.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 wne(this,void 0,void 0,function*(){const n=kd.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{t+=`${e}`}),t+="",t}getMaxBlockSize(e){return kne.compare(e,"2019-12-12")>=0?4194304e3:kne.compare(e,"2016-05-31")>=0?104857600:4194304}}class kne{static compare(e,t){return"string"==typeof e&&(e=new kne(e)),"string"==typeof t&&(t=new kne(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 kne.compare(this,e)}}var Ine=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 Cne{upload(e,t,i){return Ine(this,void 0,void 0,function*(){const n=new FormData;if(kd.isBrowser){const i=new Blob([t.buffer],{type:"application/octet-stream"});n.append("data",i,e)}else{if(!kd.isNode)throw new Error("Unsupported environment");n.append("data",Buffer.from(t.buffer),{filename:e,contentType:"application/octet-stream"})}yield i(n)})}}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())})};class Pne{build(){var e;return null!==(e=this.migrationBuilderCache)&&void 0!==e?e:this.migrationBuilderCache=Ye.create().with(eo).with(Yi,3,4).with(Ln,4,5).with(Fr,5,6).with(As,6,7).with(Hs,7,8).with(Zs,8,9).with(et,9,10).with(nt,10,11).with(lt,11,12).with(dt,12,13).with(ft,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(Yt,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(vi,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(fn,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(Wn,50,51).with(Jn,51,52).with(tr,52,53).with(sr,53,54).with(ur,54,55).with(fr,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(Ys,73,74)}}var Fne=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 Rne{constructor(e,t,i,n){this.diskStorage=e,this.logService=t,this.migrationBuilderService=i,this.clientType=n}run(){return Fne(this,void 0,void 0,function*(){const e=new so(yield no(this.diskStorage,this.logService),this.diskStorage,this.logService,"general",this.clientType);if(e.currentVersion<0)return void(yield this.diskStorage.save("stateVersion",74));const t=this.migrationBuilderService.build();yield t.migrate(e)})}waitForCompletion(){return Fne(this,void 0,void 0,function*(){yield function(e,t){return to(this,void 0,void 0,function*(){const i=()=>to(this,void 0,void 0,function*(){return(yield no(e,t))>=74}),n=e=>to(this,void 0,void 0,function*(){const r=2*e;if(!(r>8192))return new Promise(s=>{setTimeout(()=>to(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 xne=i(50572);class Ane{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 Dne(()=>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 Dne{constructor(e,t){this.release=e,this.value=t}[Symbol.dispose](){this.release()}}const Ene=k.record(Re,"ciphers",{deserializer:e=>SM.fromJSON(e),clearOn:["logout"]}),$ne=k.record(Ae,"decryptedCiphers",{deserializer:e=>L$.fromJSON(e),clearOn:["logout","lock"]}),One=k.array(Ae,"failedDecryptedCiphers",{deserializer:e=>L$.fromJSON(e),clearOn:["logout","lock"]}),Une=new k(xe,"localData",{deserializer:e=>e,clearOn:["logout"]}),Mne=new k(Ae,"addEditCipherInfo",{deserializer:e=>{if(null==e)return null;return{cipher:null!=(null==e?void 0:e.cipher.toJSON)?e.cipher:L$.fromJSON(null==e?void 0:e.cipher),collectionIds:e.collectionIds}},clearOn:["logout","lock"]});class Nne{userKeyDefinition(){return Ene}toSdk(e){return new GM(e).toSdkCipher()}fromSdk(e){return GM.fromSdkCipher(e).toCipherData()}}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())})};function Bne(e,t,i){return Vne(this,void 0,void 0,function*(){yield t.register_cipher_repository(new jne(e,i,new Nne))})}class jne{constructor(e,t,i){this.userId=e,this.stateProvider=t,this.mapper=i}get(e){return Vne(this,void 0,void 0,function*(){const t=this.stateProvider.getUser(this.userId,this.mapper.userKeyDefinition()),i=(yield(0,ho._)(t.state$.pipe((0,l.T)(e=>null!=e?e:{}))))[e];return i?this.mapper.toSdk(i):null})}list(){return Vne(this,void 0,void 0,function*(){const e=this.stateProvider.getUser(this.userId,this.mapper.userKeyDefinition()),t=yield(0,ho._)(e.state$.pipe((0,l.T)(e=>null!=e?e:{})));return Object.values(t).map(e=>this.mapper.toSdk(e))})}set(e,t){return Vne(this,void 0,void 0,function*(){const i=this.stateProvider.getUser(this.userId,this.mapper.userKeyDefinition()),n=yield(0,ho._)(i.state$.pipe((0,l.T)(e=>null!=e?e:{})));n[e]=this.mapper.fromSdk(t),yield i.update(()=>n)})}remove(e){return Vne(this,void 0,void 0,function*(){const t=this.stateProvider.getUser(this.userId,this.mapper.userKeyDefinition()),i=yield(0,ho._)(t.state$.pipe((0,l.T)(e=>null!=e?e:{})));i[e]&&(delete i[e],yield t.update(()=>i))})}}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())})};const Lne=Symbol("UnsetClient");class zne{constructor(e,t){this.apiService=e,this.userId=t}get_access_token(){return Gne(this,void 0,void 0,function*(){if(null!=this.userId)return yield this.apiService.getActiveBearerToken(this.userId)})}}var _ne=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 Kne=Symbol("UnsetClient");class Xne{constructor(e,t){this.apiService=e,this.userId=t}get_access_token(){return _ne(this,void 0,void 0,function*(){if(null!=this.userId)return yield this.apiService.getActiveBearerToken(this.userId)})}}var qne=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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{constructor(e){this.keyService=e}setUserKeyInMemoryIfAutoUserKeySet(e){return qne(this,void 0,void 0,function*(){if(null==e)return!1;const t=yield this.keyService.getUserKeyFromStorage(rp.Auto,e);return null!=t&&(yield this.keyService.setUserKey(t,e),!0)})}}class Wne{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 Hne{constructor(e){null!=e&&(this.id=e.id,this.fileName=e.fileName,this.size=e.size,this.sizeName=e.sizeName)}}class Jne{constructor(e){null!=e&&(this.text=e.text,this.hidden=e.hidden)}}class Zne{constructor(e){if(null!=e)switch(this.id=e.id,this.accessId=e.accessId,this.type=e.type,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.type){case UZ.Text:this.text=new Jne(e.text);break;case UZ.File:this.file=new Hne(e.file)}}}class Qne{constructor(e){this.name=null==e?void 0:e.name,this.id=null==e?void 0:e.id,this.revisionDate=null==e?void 0:e.revisionDate}static fromJSON(e){return Object.assign(new Qne({}),e)}}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(le,"lastSync",{deserializer:e=>null!=e?new Date(e):null,clearOn:["logout"]});class ire{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 ere(this,void 0,void 0,function*(){const e=yield(0,ho._)(this.accountService.activeAccount$.pipe((0,l.T)(e=>null==e?void 0:e.id)));return null==e?null:yield(0,ho._)(this.lastSync$(e))})}lastSync$(e){return this.stateProvider.getUser(e,tre).state$}activeUserLastSync$(){return this.accountService.activeAccount$.pipe((0,co.n)(e=>null==e?(0,Oo.of)(null):this.lastSync$(e.id)))}setLastSync(e,t){return ere(this,void 0,void 0,function*(){yield this.stateProvider.getUser(t,tre).update(()=>e)})}syncUpsertFolder(e,t,i){return ere(this,void 0,void 0,function*(){this.syncStarted();if((yield(0,ho._)(this.authService.authStatusFor$(i)))>=cd.Locked)try{const n=yield this.folderService.get(e.id,i);if(!t&&null==n||t&&null!=n&&n.revisionDate=cd.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 ere(this,void 0,void 0,function*(){this.syncStarted();if((yield(0,ho._)(this.authService.authStatusFor$(i)))>=cd.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,ho._)(this.collectionService.encryptedCollections$(i).pipe((0,l.T)(e=>null!=e?e:[])));if(null!=t)for(let i=0;i-1){n=!0;break}}if(n){const t=yield this.apiService.getFullCipherDetails(e.id);if(null!=t)return yield this.cipherService.upsert(new SM(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 ere(this,void 0,void 0,function*(){this.syncStarted();return(yield(0,ho._)(this.authService.authStatusFor$(t)))>=cd.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 ere(this,void 0,void 0,function*(){this.syncStarted();const[i,n]=yield(0,ho._)(this.accountService.activeAccount$.pipe((0,co.n)(e=>(null==e&&(0,Oo.of)([null,cd.LoggedOut]),this.authService.authStatusFor$(e.id).pipe((0,l.T)(t=>[e.id,t]))))));if(i===e.userId&&n!==cd.LoggedOut)try{const n=yield(0,ho._)(this.sendService.get$(e.id));if(!t&&null==n||t&&null!=n&&n.revisionDatenull==e?void 0:e.id)));return null!=t&&(yield(0,ho._)(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 nre=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 rre=Object.freeze({FirstOptionalButton:0,SecondOptionalButton:1,NotificationButton:2});class sre{}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())})};class are{constructor(){this.notificationClicked$=(0,fo.$)(()=>new Error("Notification clicked is not supported."))}create(e){return ore(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 lre{constructor(e){this.ids=null==e?[]:e}}class cre extends Uw{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 ure extends Uw{constructor(e){super(e);const t=this.getResponseProperty("LastSyncDate");t&&(this.lastSyncDate=new Date(t))}}class dre extends Uw{constructor(e){super(e),this.isTokenValid=this.getResponseProperty("IsTokenValid"),this.isFreeFamilyPolicyEnabled=this.getResponseProperty("IsFreeFamilyPolicyEnabled")}}class hre extends fR{}class pre extends Uw{constructor(e){super(e),this.id=this.getResponseProperty("Id"),this.error=this.getResponseProperty("Error")}}class fre extends Uw{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 lR(this.getResponseProperty("Permissions"))}}class vre extends fre{constructor(e){super(e),this.name=this.getResponseProperty("Name"),this.email=this.getResponseProperty("Email")}}class mre extends Uw{constructor(e){super(e),this.key=this.getResponseProperty("Key")}}class gre extends Uw{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 yre extends Uw{constructor(e){super(e),this.token=this.getResponseProperty("Token")}}class bre extends Uw{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 wre extends Uw{constructor(e){super(e),this.userId=this.getResponseProperty("UserId"),this.publicKey=this.getResponseProperty("PublicKey")}}class Sre extends Uw{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 $x(t),this.cipherMiniResponse=null==i?null:new $x(i),this.url=this.getResponseProperty("Url")}}class kre extends Uw{constructor(e){super(e),this.unavailable=this.getResponseProperty("Unavailable"),this.cipher=new $x(this.getResponseProperty("Cipher"))}}var Ire=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 Cre{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 Ire(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 bS?e.toIdentityToken():e.toIdentityToken(this.platformUtilsService.getClientType()),r=yield(0,ho._)(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 rS(o);if(400===s.status&&o.TwoFactorProviders2&&Object.keys(o.TwoFactorProviders2).length)return new sS(o);if(400===s.status&&(null===(t=null==o?void 0:o.ErrorModel)||void 0===t?void 0:t.Message)===Cre.NEW_DEVICE_VERIFICATION_REQUIRED_MESSAGE)return new zw(o);if(400===s.status&&(null==o?void 0:o.SsoOrganizationIdentifier))return new _w(o)}return Promise.reject(new Mw(o,s.status,!0))})}refreshIdentityToken(){return Ire(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 Ire(this,void 0,void 0,function*(){const t=`/auth-requests/${e}`,i=yield this.send("GET",t,null,!0,!0);return new NS(i)})}putAuthRequest(e,t){return Ire(this,void 0,void 0,function*(){const i=`/auth-requests/${e}`,n=yield this.send("PUT",i,t,!0,!0);return new NS(n)})}getAuthRequests(){return Ire(this,void 0,void 0,function*(){const e=yield this.send("GET","/auth-requests/",null,!0,!0);return new jS(e,NS)})}getLastAuthRequest(){return Ire(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 Ire(this,void 0,void 0,function*(){const e=yield this.send("GET","/accounts/profile",null,!0,!0);return new yx(e)})}getUserSubscription(){return Ire(this,void 0,void 0,function*(){const e=yield this.send("GET","/accounts/subscription",null,!0,!0);return new J5(e)})}putProfile(e){return Ire(this,void 0,void 0,function*(){const t=yield this.send("PUT","/accounts/profile",e,!0,!0);return new yx(t)})}putAvatar(e){return Ire(this,void 0,void 0,function*(){const t=yield this.send("PUT","/accounts/avatar",e,!0,!0);return new yx(t)})}postPrelogin(e){return Ire(this,void 0,void 0,function*(){const t=yield(0,ho._)(this.environmentService.environment$),i=yield this.send("POST","/accounts/prelogin",e,!1,!0,t.getIdentityUrl());return new gre(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 Ire(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 Ire(this,void 0,void 0,function*(){const t=yield this.send("POST","/accounts/premium",e,!0,!0);return new n9(t)})}postReinstatePremium(){return this.send("POST","/accounts/reinstate-premium",null,!0,!1)}postAccountStorage(e){return Ire(this,void 0,void 0,function*(){const t=yield this.send("POST","/accounts/storage",e,!0,!0);return new n9(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 Ire(this,void 0,void 0,function*(){return this.send("DELETE","/accounts/sso/"+e,null,!0,!1)})}getSsoUserIdentifier(){return Ire(this,void 0,void 0,function*(){return this.send("GET","/accounts/sso/user-identifier",null,!0,!0)})}postUserApiKey(e,t){return Ire(this,void 0,void 0,function*(){const e=yield this.send("POST","/accounts/api-key",t,!0,!0);return new V5(e)})}postUserRotateApiKey(e,t){return Ire(this,void 0,void 0,function*(){const e=yield this.send("POST","/accounts/rotate-api-key",t,!0,!0);return new V5(e)})}postConvertToKeyConnector(){return this.send("POST","/accounts/convert-to-key-connector",null,!0,!1)}getUserBillingHistory(){return Ire(this,void 0,void 0,function*(){const e=yield this.send("GET","/accounts/billing/history",null,!0,!0);return new X5(e)})}getCipher(e){return Ire(this,void 0,void 0,function*(){const t=yield this.send("GET","/ciphers/"+e,null,!0,!0);return new $x(t)})}getFullCipherDetails(e){return Ire(this,void 0,void 0,function*(){const t=yield this.send("GET","/ciphers/"+e+"/details",null,!0,!0);return new $x(t)})}getCipherAdmin(e){return Ire(this,void 0,void 0,function*(){const t=yield this.send("GET","/ciphers/"+e+"/admin",null,!0,!0);return new $x(t)})}getCiphersOrganization(e,t){return Ire(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 jS(n,$x)})}postCipher(e){return Ire(this,void 0,void 0,function*(){const t=yield this.send("POST","/ciphers",e,!0,!0);return new $x(t)})}postCipherCreate(e){return Ire(this,void 0,void 0,function*(){const t=yield this.send("POST","/ciphers/create",e,!0,!0);return new $x(t)})}postCipherAdmin(e){return Ire(this,void 0,void 0,function*(){const t=yield this.send("POST","/ciphers/admin",e,!0,!0);return new $x(t)})}putCipher(e,t){return Ire(this,void 0,void 0,function*(){const i=yield this.send("PUT","/ciphers/"+e,t,!0,!0);return new $x(i)})}putPartialCipher(e,t){return Ire(this,void 0,void 0,function*(){const i=yield this.send("PUT","/ciphers/"+e+"/partial",t,!0,!0);return new $x(i)})}putCipherAdmin(e,t){return Ire(this,void 0,void 0,function*(){const i=yield this.send("PUT","/ciphers/"+e+"/admin",t,!0,!0);return new $x(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 Ire(this,void 0,void 0,function*(){const i=yield this.send("PUT","/ciphers/"+e+"/share",t,!0,!0);return new $x(i)})}putShareCiphers(e){return Ire(this,void 0,void 0,function*(){const t=yield this.send("PUT","/ciphers/share",e,!0,!0);return new jS(t,$x)})}putCipherCollections(e,t){return Ire(this,void 0,void 0,function*(){const i=yield this.send("PUT","/ciphers/"+e+"/collections_v2",t,!0,!0);return new kre(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 Ire(this,void 0,void 0,function*(){const t=yield this.send("PUT","/ciphers/"+e+"/restore",null,!0,!0);return new $x(t)})}putRestoreCipherAdmin(e){return Ire(this,void 0,void 0,function*(){const t=yield this.send("PUT","/ciphers/"+e+"/restore-admin",null,!0,!0);return new $x(t)})}putRestoreManyCiphers(e){return Ire(this,void 0,void 0,function*(){const t=yield this.send("PUT","/ciphers/restore",e,!0,!0);return new jS(t,$x)})}putRestoreManyCiphersAdmin(e){return Ire(this,void 0,void 0,function*(){const t=yield this.send("PUT","/ciphers/restore-admin",e,!0,!0);return new jS(t,$x)})}getAttachmentData(e,t,i){return Ire(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 Dx(r)})}getAttachmentDataAdmin(e,t){return Ire(this,void 0,void 0,function*(){const i="/ciphers/"+e+"/attachment/"+t+"/admin",n=yield this.send("GET",i,null,!0,!0);return new Dx(n)})}postCipherAttachment(e,t){return Ire(this,void 0,void 0,function*(){const i=yield this.send("POST","/ciphers/"+e+"/attachment/v2",t,!0,!0);return new Sre(i)})}deleteCipherAttachment(e,t){return this.send("DELETE","/ciphers/"+e+"/attachment/"+t,null,!0,!0)}deleteCipherAttachmentAdmin(e,t){return this.send("DELETE","/ciphers/"+e+"/attachment/"+t+"/admin",null,!0,!0)}postShareCipherAttachment(e,t,i,n){return this.send("POST","/ciphers/"+e+"/attachment/"+t+"/share?organizationId="+n,i,!0,!1)}renewAttachmentUploadUrl(e,t){return Ire(this,void 0,void 0,function*(){const i=yield this.send("GET","/ciphers/"+e+"/attachment/"+t+"/renew",null,!0,!0);return new Sre(i)})}postAttachmentFile(e,t,i){return this.send("POST","/ciphers/"+e+"/attachment/"+t,i,!0,!1)}getCollectionAccessDetails(e,t){return Ire(this,void 0,void 0,function*(){const i=yield this.send("GET","/organizations/"+e+"/collections/"+t+"/details",null,!0,!0);return new WF(i)})}getUserCollections(){return Ire(this,void 0,void 0,function*(){const e=yield this.send("GET","/collections",null,!0,!0);return new jS(e,qF)})}getCollections(e){return Ire(this,void 0,void 0,function*(){const t=yield this.send("GET","/organizations/"+e+"/collections",null,!0,!0);return new jS(t,qF)})}getManyCollectionsWithAccessDetails(e){return Ire(this,void 0,void 0,function*(){const t=yield this.send("GET","/organizations/"+e+"/collections/details",null,!0,!0);return new jS(t,WF)})}getCollectionUsers(e,t){return Ire(this,void 0,void 0,function*(){return(yield this.send("GET","/organizations/"+e+"/collections/"+t+"/users",null,!0,!0)).map(e=>new XF(e))})}postCollection(e,t){return Ire(this,void 0,void 0,function*(){const i=yield this.send("POST","/organizations/"+e+"/collections",t,!0,!0);return new WF(i)})}putCollection(e,t,i){return Ire(this,void 0,void 0,function*(){const n=yield this.send("PUT","/organizations/"+e+"/collections/"+t,i,!0,!0);return new WF(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 lre(t),!0,!1)}getGroupUsers(e,t){return Ire(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 Ire(this,void 0,void 0,function*(){const e=yield this.send("GET","/plans",null,!1,!0);return new jS(e,q5)})}getSettingsDomains(){return Ire(this,void 0,void 0,function*(){const e=yield this.send("GET","/settings/domains",null,!0,!0);return new fx(e)})}putSettingsDomains(e){return Ire(this,void 0,void 0,function*(){const t=yield this.send("PUT","/settings/domains",e,!0,!0);return new fx(t)})}getSync(){return Ire(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 Ux(t)})}getCloudCommunicationsEnabled(){return Ire(this,void 0,void 0,function*(){return yield this.send("GET","/organizations/connections/enabled",null,!0,!0)})}getOrganizationConnection(e,t,i){return Ire(this,void 0,void 0,function*(){const n=yield this.send("GET",`/organizations/connections/${e}/${t}`,null,!0,!0);return new cre(n,i)})}createOrganizationConnection(e,t){return Ire(this,void 0,void 0,function*(){const i=yield this.send("POST","/organizations/connections/",e,!0,!0);return new cre(i,t)})}updateOrganizationConnection(e,t,i){return Ire(this,void 0,void 0,function*(){const n=yield this.send("PUT","/organizations/connections/"+i,e,!0,!0);return new cre(n,t)})}deleteOrganizationConnection(e){return Ire(this,void 0,void 0,function*(){return this.send("DELETE","/organizations/connections/"+e,null,!0,!1)})}getProviderUsers(e){return Ire(this,void 0,void 0,function*(){const t=yield this.send("GET","/providers/"+e+"/users",null,!0,!0);return new jS(t,vre)})}getProviderUser(e,t){return Ire(this,void 0,void 0,function*(){const i=yield this.send("GET","/providers/"+e+"/users/"+t,null,!0,!0);return new fre(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 Ire(this,void 0,void 0,function*(){const i=yield this.send("POST","/providers/"+e+"/users/reinvite",t,!0,!0);return new jS(i,pre)})}postProviderUserBulkConfirm(e,t){return Ire(this,void 0,void 0,function*(){const i=yield this.send("POST","/providers/"+e+"/users/confirm",t,!0,!0);return new jS(i,pre)})}deleteManyProviderUsers(e,t){return Ire(this,void 0,void 0,function*(){const i=yield this.send("DELETE","/providers/"+e+"/users",t,!0,!0);return new jS(i,pre)})}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 Ire(this,void 0,void 0,function*(){const i=yield this.send("POST","/providers/"+e+"/users/public-keys",t,!0,!0);return new jS(i,hre)})}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 Ire(this,void 0,void 0,function*(){const t=yield this.send("GET","/providers/"+e+"/organizations",null,!0,!0);return new jS(t,b9)})}postProviderAddOrganization(e,t){return this.send("POST","/providers/"+e+"/organizations/add",t,!0,!1)}postProviderCreateOrganization(e,t){return Ire(this,void 0,void 0,function*(){const i=yield this.send("POST","/providers/"+e+"/organizations",t,!0,!0);return new y9(i)})}deleteProviderOrganization(e,t){return this.send("DELETE","/providers/"+e+"/organizations/"+t,null,!0,!1)}getEvents(e,t,i){return Ire(this,void 0,void 0,function*(){const n=yield this.send("GET",this.addEventParameters("/events",e,t,i),null,!0,!0);return new jS(n,bre)})}getEventsCipher(e,t,i,n){return Ire(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 jS(r,bre)})}getEventsSecret(e,t,i,n,r){return Ire(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 jS(s,bre)})}getEventsServiceAccount(e,t,i,n,r){return Ire(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 jS(s,bre)})}getEventsProject(e,t,i,n,r){return Ire(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 jS(s,bre)})}getEventsOrganization(e,t,i,n){return Ire(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 jS(r,bre)})}getEventsOrganizationUser(e,t,i,n,r){return Ire(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 jS(s,bre)})}getEventsProvider(e,t,i,n){return Ire(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 jS(r,bre)})}getEventsProviderUser(e,t,i,n,r){return Ire(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 jS(s,bre)})}postEventsCollect(e,t){return Ire(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,ho._)(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 Ire(this,void 0,void 0,function*(){const t=yield this.send("GET","/users/"+e+"/public-key",null,!0,!0);return new wre(t)})}postBitPayInvoice(e){return Ire(this,void 0,void 0,function*(){return yield this.send("POST","/bitpay-invoice",e,!0,!0)})}postSetupPayment(){return Ire(this,void 0,void 0,function*(){return yield this.send("POST","/setup-payment",null,!0,!0)})}getMasterKeyFromKeyConnector(e){return Ire(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(200!==n.status){const e=yield this.handleError(n,!1,!0);return Promise.reject(e)}return new mre(yield n.json())})}postUserKeyToKeyConnector(e,t){return Ire(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(200!==r.status){const e=yield this.handleError(r,!1,!0);return Promise.reject(e)}})}getKeyConnectorAlive(e){return Ire(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(200!==t.status){const e=yield this.handleError(t,!1,!0);return Promise.reject(e)}})}getActiveBearerToken(e){return Ire(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 Ire(this,void 0,void 0,function*(){if(!e.url.startsWith("https://")&&!this.platformUtilsService.isDev())throw new W9;"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 Ire(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,ho._)(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 yre(e)}{const e=yield this.handleError(r,!1,!0);return Promise.reject(e)}})}postCreateSponsorship(e,t){return Ire(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 Ire(this,void 0,void 0,function*(){const t=yield this.send("GET","/organization/sponsorship/"+e+"/sync-status",null,!0,!0);return new ure(t)})}deleteRemoveSponsorship(e){return Ire(this,void 0,void 0,function*(){return yield this.send("DELETE","/organization/sponsorship/sponsored/"+e,null,!0,!1)})}postPreValidateSponsorshipToken(e){return Ire(this,void 0,void 0,function*(){const t=yield this.send("POST","/organization/sponsorship/validate-token?sponsorshipToken="+encodeURIComponent(e),null,!0,!0);return new dre(t)})}postRedeemSponsorship(e,t){return Ire(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 Ire(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(!kd.isNullOrWhitespace(i)&&!kd.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 Ire(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,ho._)(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 rS(e),i=(yield this.tokenService.decodeAccessToken(t.accessToken)).sub,n=yield(0,ho._)(this.vaultTimeoutSettingsService.getVaultTimeoutActionByUserId$(i)),r=yield(0,ho._)(this.vaultTimeoutSettingsService.getVaultTimeoutByUserId$(i));return(yield this.tokenService.setTokens(t.accessToken,n,r,t.refreshToken)).accessToken}{const e=yield this.handleError(s,!0,!0);return Promise.reject(e)}})}refreshApiToken(e){return Ire(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 Nw(n,this.platformUtilsService),s=new bS(t,i,new ww,r),o=yield this.postIdentityToken(s);if(!(o instanceof rS))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,ho._)(this.vaultTimeoutSettingsService.getVaultTimeoutActionByUserId$(e)),c=yield(0,ho._)(this.vaultTimeoutSettingsService.getVaultTimeoutByUserId$(e));return yield this.tokenService.setAccessToken(o.accessToken,l,c)})}send(e,t,i,n,r,s,o){return Ire(this,void 0,void 0,function*(){if(null==n)throw new Error("A user id was given but it was null, cannot complete API request.");let a=null;"boolean"==typeof n&&n?a=yield this.getActiveUser():"string"==typeof n&&(a=n);const l=yield(0,ho._)(null==a?this.environmentService.environment$:this.environmentService.getEnvironment$(a));s=kd.isNullOrWhitespace(s)?l.getApiUrl():s;const c=t.split("?"),u=s+c[0]+(c.length>1?`?${c[1]}`:"");if(kd.invalidUrlPatterns(u))throw new Error("The request URL contains dangerous patterns.");const d=s+kd.normalizePath(c[0])+(c.length>1?`?${c[1]}`:""),[h,p]=yield this.buildHeadersAndBody(a,r,i,o),f={cache:"no-store",credentials:yield this.getCredentials(l),method:e};f.headers=h,f.body=p;const v=yield this.fetch(this.httpOperations.createRequest(d,f)),m=v.headers.get("content-type"),g=null!=m&&-1!==m.indexOf("application/json"),y=null!=m&&-1!==m.indexOf("text/csv");if(r&&200===v.status&&g){return yield v.json()}if(r&&200===v.status&&y)return yield v.text();if(200!==v.status&&204!==v.status){const e=yield this.handleError(v,!1,null!=a);return Promise.reject(e)}})}buildHeadersAndBody(e,t,i,n){return Ire(this,void 0,void 0,function*(){let r=null;const s=new Headers({"Device-Type":this.deviceType});if(nH("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]})}handleError(e,t,i){return Ire(this,void 0,void 0,function*(){let n=null;return this.isJsonResponse(e)?n=yield e.json():this.isTextPlainResponse(e)&&(n={Message:yield e.text()}),i&&(401===e.status||403===e.status||t&&400===e.status&&null!=n&&"invalid_grant"===n.error)&&(yield this.logoutCallback("invalidGrantError")),new Mw(n,e.status,t)})}qsStringify(e){return Object.keys(e).map(t=>encodeURIComponent(t)+"="+encodeURIComponent(e[t])).join("&")}getActiveUser(){return Ire(this,void 0,void 0,function*(){return yield(0,ho._)(this.accountService.activeAccount$.pipe((0,l.T)(e=>null==e?void 0:e.id)))})}getCredentials(e){return Ire(this,void 0,void 0,function*(){if(this.platformUtilsService.getClientType()!==Ca.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}}Cre.NEW_DEVICE_VERIFICATION_REQUIRED_MESSAGE="new device verification required";var Tre=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 Pre{static fromJSON(e){return Object.assign(new Pre,e)}}const Fre=k.array(ye,"events",{deserializer:e=>Pre.fromJSON(e),clearOn:["logout"]});var Rre=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 xre{}var Are=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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())})};class Ere extends _p{constructor(e){super(),null!=e&&(this.size=e.size,this.buildDomainModel(this,e,{id:null,sizeName:null,fileName:null},["id","sizeName"]))}decrypt(e){return Dre(this,void 0,void 0,function*(){return yield this.decryptObj(this,new NZ(this),["fileName"],e)})}static fromJSON(e){return null==e?null:Object.assign(new Ere,e,{fileName:up.fromJSON(e.fileName)})}}class $re extends _p{constructor(e){super(),null!=e&&(this.hidden=e.hidden,this.buildDomainModel(this,e,{text:null},[]))}decrypt(e){return this.decryptObj(this,new VZ(this),["text"],e)}static fromJSON(e){return null==e?null:Object.assign(new $re,e,{text:up.fromJSON(e.text)})}}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())})};class Ure extends _p{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.maxAccessCount=e.maxAccessCount,this.accessCount=e.accessCount,this.password=e.password,this.emails=e.emails,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.type){case UZ.Text:this.text=new $re(e.text);break;case UZ.File:this.file=new Ere(e.file)}}decrypt(e){return Ore(this,void 0,void 0,function*(){if(!e)throw new Error("User ID must not be null or undefined");const t=new BZ(this),i=kd.getContainerService().getKeyService(),n=kd.getContainerService().getEncryptService(),r=yield(0,ho._)(i.userKey$(e));switch(t.key=yield n.decryptBytes(this.key,r),t.cryptoKey=yield i.makeSendKey(t.key),yield this.decryptObj(this,t,["name","notes"],t.cryptoKey),this.type){case UZ.File:t.file=yield this.file.decrypt(t.cryptoKey);break;case UZ.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 Ure,e,{key:up.fromJSON(e.key),name:up.fromJSON(e.name),notes:up.fromJSON(e.notes),text:$re.fromJSON(e.text),file:Ere.fromJSON(e.file),revisionDate:t,expirationDate:i,deletionDate:n})}}class Mre{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 UZ.Text:this.text=new wx,this.text.text=null!=e.text.text?e.text.text.encryptedString:null,this.text.hidden=e.text.hidden;break;case UZ.File:this.file=new bx,this.file.fileName=null!=e.file.fileName?e.file.fileName.encryptedString:null}}}class Nre extends Uw{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 wx(t));const i=this.getResponseProperty("File");null!=i&&(this.file=new bx(i)),this.expirationDate=this.getResponseProperty("ExpirationDate"),this.creatorIdentifier=this.getResponseProperty("CreatorIdentifier")}}class Vre extends Uw{constructor(e){super(e),this.id=null,this.url=null,this.id=this.getResponseProperty("Id"),this.url=this.getResponseProperty("Url")}}class Bre extends Uw{constructor(e){super(e),this.url=null,this.fileUploadType=this.getResponseProperty("FileUploadType");const t=this.getResponseProperty("SendResponse");this.sendResponse=null==t?null:new Sx(t),this.url=this.getResponseProperty("Url")}}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())})};const Gre=k.record(be,"sendUserEncrypted",{deserializer:e=>e,clearOn:["logout"]}),Lre=new k(we,"sendUserDecrypted",{deserializer:e=>e,clearOn:["lock"]});var zre=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 _re{}class Kre extends Mre{constructor(e){super(e),this.id=e.id}}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{}class Yre{}class Wre{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 Hre(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 Hre{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 Jre{constructor(e,t){this.ids=null==e?[]:e,this.organizationId=t}}class Zre{constructor(e,t){this.ids=null==e?[]:e,this.folderId=t}}class Qre{constructor(e,t){this.ids=null==e?[]:e,this.organizationId=t}}class ese extends iz{constructor({cipher:e,encryptedFor:t}){super({cipher:e,encryptedFor:t}),this.id=e.id}}class tse{constructor(e,t,i){this.encryptedFor=i,null!=e&&(this.ciphers=[],e.forEach(e=>{this.ciphers.push(new ese({cipher:e,encryptedFor:i}))})),this.collectionIds=t}}class ise{constructor(e,t,i,n=!1){this.organizationId=e,this.cipherIds=t,this.collectionIds=i,this.removeCollections=n}}class nse{constructor(e){this.collectionIds=null==e?[]:e}}class rse{constructor({cipher:e,encryptedFor:t}){this.cipher=new iz({cipher:e,encryptedFor:t}),this.collectionIds=e.collectionIds}}class sse{constructor(e){this.folderId=e.folderId,this.favorite=e.favorite}}class ose{constructor({cipher:e,encryptedFor:t}){this.cipher=new iz({cipher:e,encryptedFor:t}),this.collectionIds=e.collectionIds}}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())})};const lse=new Yie.SemVer("2024.2.0");class cse{constructor(e,t,i,n,r,s,o,a,c,u,d,h,p,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=f,this.sortedCiphersCache=new Wre(this.sortCiphersByLastUsed),this.clearCipherViewsForUser$=new go.B,this.cipherListViews$=IE(e=>{let t;return this.configService.getFeatureFlag$(Nf.PM22134SdkCipherListView).pipe((0,co.n)(i=>i?(0,$o.z)([this.encryptedCiphersState(e).state$,this.localData$(e),this.keyService.cipherDecryptionKeys$(e,!0)]).pipe((0,To.p)(([e,t,i])=>null!=e&&null!=i),(0,l.T)(([e,t])=>Object.values(e).map(e=>new GM(e,null==t?void 0:t[e.id]))),(0,Fo.M)(()=>{t=performance.now()}),(0,co.n)(t=>ase(this,void 0,void 0,function*(){const[i,n]=yield this.decryptCiphersWithSdk(t,e,!1);return this.setFailedDecryptedCiphers(n,e),this.getAllDecrypted(e),i})),(0,Fo.M)(e=>{this.logService.measure(t,"Vault","CipherService","listView decrypt complete",[["Items",e.length]])})):this.cipherViews$(e)))}),this.cipherViews$=IE(e=>(0,$o.z)([this.encryptedCiphersState(e).state$,this.localData$(e),this.keyService.cipherDecryptionKeys$(e)]).pipe((0,To.p)(([e,t,i])=>null!=e&&null!=i),(0,co.n)(()=>this.getAllDecrypted(e)),(0,Fo.M)(()=>{this.messageSender.send("updateOverlayCiphers")})),this.clearCipherViewsForUser$),this.failedToDecryptCiphers$=IE(e=>this.failedToDecryptCiphersState(e).state$.pipe((0,To.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 ase(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 ase(this,void 0,void 0,function*(){yield this.stateProvider.setUserState(One,e,t)})}setDecryptedCiphers(e,t){return ase(this,void 0,void 0,function*(){const i={};null==e||e.forEach(e=>{i[e.id]=e}),yield this.stateProvider.setUserState($ne,i,t)})}clearCache(e){return ase(this,void 0,void 0,function*(){const t=yield(0,ho._)(this.stateProvider.activeUserId$);null!=e||(e=t),yield this.clearDecryptedCiphersState(e),this.clearCipherViewsForUser$.next(e)})}adjustCipherHistory(e,t,i){return ase(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 ase(this,arguments,void 0,function*(e,t,i,n,r=null){var s;yield this.adjustCipherHistory(e,t,r);if((yield this.configService.getFeatureFlag(Nf.PM22136_SdkCipherEncryption))&&null==i&&null==n)return yield this.cipherEncryptionService.encrypt(e,t);const o=new GM;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}})}encryptAttachments(e,t){return ase(this,void 0,void 0,function*(){if(null==e||0===e.length)return null;const i=[],n=[];return e.forEach(e=>ase(this,void 0,void 0,function*(){const r=new TM;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(()=>ase(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 ase(this,void 0,void 0,function*(){if(!e||!e.length)return null;const i=this,n=[];return yield e.reduce((e,r)=>ase(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 ase(this,void 0,void 0,function*(){const i=new RM;return i.type=e.type,i.linkedId=e.linkedId,e.type===FR.Boolean&&"true"!==e.value&&(e.value="false"),yield this.encryptObjProperty(e,i,{name:null,value:null},t),i})}encryptPasswordHistories(e,t){return ase(this,void 0,void 0,function*(){if(!e||!e.length)return null;const i=this,n=[];return yield e.reduce((e,r)=>ase(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 ase(this,void 0,void 0,function*(){const i=new MM;return i.lastUsedDate=e.lastUsedDate,yield this.encryptObjProperty(e,i,{password:null},t),i})}get(e,t){return ase(this,void 0,void 0,function*(){const i=yield(0,ho._)(this.ciphers$(t));if(null==i||!i.hasOwnProperty(e))return null;const n=yield(0,ho._)(this.localData$(t)),r=e;return new GM(i[r],n?n[r]:null)})}getAll(e){return ase(this,void 0,void 0,function*(){const t=yield(0,ho._)(this.localData$(e)),i=yield(0,ho._)(this.ciphers$(e)),n=[];for(const e in i)if(i.hasOwnProperty(e)){const r=e;n.push(new GM(i[r],t?t[r]:null))}return n})}getAllDecrypted(e){return ase(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 ase(this,void 0,void 0,function*(){return Object.values(yield(0,ho._)(this.decryptedCiphersState(e).state$.pipe((0,l.T)(e=>null!=e?e:{}))))})}decryptCiphers(e,t){return ase(this,void 0,void 0,function*(){if(yield this.configService.getFeatureFlag(Nf.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,ho._)(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=>ase(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=>ase(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 ase(this,void 0,void 0,function*(){if(yield this.configService.getFeatureFlag(Nf.PM19941MigrateCipherDomainToSdk))return yield this.cipherEncryptionService.decrypt(e,t);{const i=yield this.getKeyForCipherKeyDecryption(e,t);return yield e.decrypt(i)}})}reindexCiphers(e){return ase(this,void 0,void 0,function*(){var t;null!=this.searchService&&(null!==(t=yield(0,ho._)(this.searchService.indexedEntityId$(e)))&&void 0!==t?t:e)!==e&&(yield this.searchService.indexCiphers(e,yield this.getDecryptedCiphers(e),e))})}getAllDecryptedForGrouping(e,t){return ase(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 ase(this,arguments,void 0,function*(e,t,i,n=null,r){return yield(0,ho._)(this.cipherViews$(t).pipe((0,To.p)(e=>null!=e),(0,co.n)(t=>ase(this,void 0,void 0,function*(){return yield this.filterCiphersForUrl(t,e,i,n,r)}))))})}getAllDecryptedForIds(e,t){return ase(this,void 0,void 0,function*(){return(0,ho._)(this.cipherViews$(e).pipe((0,To.p)(e=>null!=e),(0,l.T)(e=>e.filter(e=>t.includes(e.id)))))})}filterCiphersForUrl(e,t,i){return ase(this,arguments,void 0,function*(e,t,i,n=null,r){if(null==t&&null==i)return[];const s=yield(0,ho._)(this.domainSettingsService.getUrlEquivalentDomains(t));null!=n||(n=yield(0,ho._)(this.domainSettingsService.resolvedDefaultUriMatchStrategy$));const o=yield this.configService.getFeatureFlag(Nf.PM19148_InnovationArchive);return e.filter(e=>{const a=hE.getType(e),l=null!==hE.getLogin(e);return!hE.isDeleted(e)&&((!o||!hE.isArchived(e))&&(!(!Array.isArray(i)||!i.includes(a)||l)||!!l&&hE.matchesUri(e,t,s,n,r)))})})}getAllDecryptedCiphersOfType(e,t){return ase(this,void 0,void 0,function*(){const i=yield this.getAllDecrypted(t),n=yield this.configService.getFeatureFlag(Nf.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 ase(this,void 0,void 0,function*(){const i=yield this.apiService.getCiphersOrganization(e,t);return yield this.decryptOrganizationCiphersResponse(i,e)})}getManyFromApiForOrganization(e){return ase(this,void 0,void 0,function*(){const t=yield this.apiService.send("GET","/ciphers/organization-details/assigned?organizationId="+e,null,!0,!0),i=new jS(t,$x);return this.decryptOrganizationCiphersResponse(i,e)})}decryptOrganizationCiphersResponse(e,t){return ase(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 GM(new SM(e))),n=yield this.keyService.getOrgKey(t),r=yield Promise.all(i.map(e=>ase(this,void 0,void 0,function*(){return yield e.decrypt(n)})));return r.sort(this.getLocaleSortingFunction()),r})}getLastUsedForUrl(e,t){return ase(this,arguments,void 0,function*(e,t,i=!1){return this.getCipherForUrl(e,t,!0,!1,i)})}getLastLaunchedForUrl(e,t){return ase(this,arguments,void 0,function*(e,t,i=!1){return this.getCipherForUrl(e,t,!1,!0,i)})}getNextCipherForUrl(e,t){return ase(this,void 0,void 0,function*(){return this.getCipherForUrl(e,t,!1,!1,!1)})}getNextCardCipher(e){return ase(this,void 0,void 0,function*(){const t="cardCiphers";if(!this.sortedCiphersCache.isCached(t)){const i=yield this.getAllDecryptedCiphersOfType([CR.Card],e);if(!(null==i?void 0:i.length))return null;this.sortedCiphersCache.addCiphers(t,i)}return this.sortedCiphersCache.getNext(t)})}getNextIdentityCipher(e){return ase(this,void 0,void 0,function*(){const t="identityCiphers";if(!this.sortedCiphersCache.isCached(t)){const i=yield this.getAllDecryptedCiphersOfType([CR.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 ase(this,void 0,void 0,function*(){let i=yield(0,ho._)(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;ti);const r=yield this.getDecryptedCiphers(t);if(r){for(let t=0;t0){const i=new rse({cipher:e,encryptedFor:t});n=yield this.apiService.postCipherCreate(i)}else{const i=new iz({cipher:e,encryptedFor:t});n=yield this.apiService.postCipher(i)}e.id=n.id;const r=new SM(n,e.collectionIds),s=yield this.upsert(r);return new GM(s[e.id])})}updateWithServer(e,t){return ase(this,arguments,void 0,function*({cipher:e,encryptedFor:t},i){let n;if(i){const i=new iz({cipher:e,encryptedFor:t});n=yield this.apiService.putCipherAdmin(e.id,i);const r=new SM(n,e.collectionIds);return new GM(r,e.localData)}if(e.edit){const i=new iz({cipher:e,encryptedFor:t});n=yield this.apiService.putCipher(e.id,i)}else{const t=new sse(e);n=yield this.apiService.putPartialCipher(e.id,t)}const r=new SM(n,e.collectionIds),s=yield this.upsert(r);return new GM(s[e.id],e.localData)})}shareWithServer(e,t,i,n,r){return ase(this,void 0,void 0,function*(){const s=yield this.configService.getFeatureFlag(Nf.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 ose(o),l=yield this.apiService.putShareCipher(e.id,a),c=new SM(l,i);return yield this.upsert(c),new GM(c,e.localData)})}shareManyWithServer(e,t,i,n){return ase(this,void 0,void 0,function*(){const r=yield this.configService.getFeatureFlag(Nf.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 tse(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=>ase(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 ase(this,arguments,void 0,function*(e,t,i,n,r=!1){const s=yield this.getKeyForCipherKeyDecryption(e,n),o=yield this.getCipherKeyEncryptionEnabled(),a=o&&null!=e.key?yield this.encryptService.unwrapSymmetricKey(e.key,s):s;if(null!=e.key&&!o){const t=yield this.decrypt(e,n),i=yield this.encrypt(t,n);yield this.updateWithServer(i)}const l=yield this.encryptService.encryptString(t,a),c=yield this.keyService.makeDataEncKey(a),u=yield this.encryptService.encryptFileData(new Uint8Array(i),c[0]),d=yield this.cipherFileUploadService.upload(e,l,u,r,c),h=new SM(d,e.collectionIds);return r||(yield this.upsert(h)),new GM(h)})}saveCollectionsWithServer(e,t){return ase(this,void 0,void 0,function*(){const i=new nse(e.collectionIds),n=yield this.apiService.putCipherCollections(e.id,i);if(n.unavailable)return void(yield this.delete(e.id,t));const r=new SM(n.cipher),s=yield this.upsert(r);return new GM(s[e.id],e.localData)})}saveCollectionsWithServerAdmin(e){return ase(this,void 0,void 0,function*(){const t=new nse(e.collectionIds),i=yield this.apiService.putCipherCollectionsAdmin(e.id,t),n=new $x(i);n.edit=!0,n.viewPassword=!0,n.favorite=!1;const r=new SM(n);return new GM(r)})}bulkUpdateCollectionsWithServer(e,t,i,n){return ase(this,arguments,void 0,function*(e,t,i,n,r=!1){var s,o;const a=new ise(e,i,n,r);yield this.apiService.send("POST","/ciphers/bulk-collections",a,!0,!1);const l=yield(0,ho._)(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){return ase(this,void 0,void 0,function*(){const t=e instanceof SM?[e]:e,i=yield this.updateEncryptedCipherState(e=>(t.forEach(t=>e[t.id]=t),e));return yield new Promise(e=>setTimeout(e,0)),i})}replace(e,t){return ase(this,void 0,void 0,function*(){var i;const n=null!==(i=yield(0,ho._)(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 ase(this,arguments,void 0,function*(e,t=null){t||(t=yield(0,ho._)(this.stateProvider.activeUserId$)),yield this.clearCache(t);const i=yield this.stateProvider.getUser(t,Ene).update(t=>e(null!=t?t:{}));return yield new Promise(e=>setTimeout(e,0)),i})}clear(e){return ase(this,void 0,void 0,function*(){null!=e||(e=yield(0,ho._)(this.stateProvider.activeUserId$)),yield this.clearEncryptedCiphersState(e),yield this.clearCache(e)})}moveManyWithServer(e,t,i){return ase(this,void 0,void 0,function*(){yield this.apiService.putMoveCiphers(new Zre(e,t));let n=yield(0,ho._)(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 ase(this,void 0,void 0,function*(){const i=yield(0,ho._)(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 ase(this,arguments,void 0,function*(e,t,i=!1){i?yield this.apiService.deleteCipherAdmin(e):yield this.apiService.deleteCipher(e),yield this.delete(e,t)})}deleteManyWithServer(e,t){return ase(this,arguments,void 0,function*(e,t,i=!1){const n=new Jre(e);i?yield this.apiService.deleteManyCiphersAdmin(n):yield this.apiService.deleteManyCiphers(n),yield this.delete(e,t)})}deleteAttachment(e,t,i,n){return ase(this,void 0,void 0,function*(){let r=yield(0,ho._)(this.ciphers$(n));const s=e;if(null!=r&&r.hasOwnProperty(e)&&null!=r[s].attachments){for(let e=0;e(null==r&&(r={}),r)),r[s]}})}deleteAttachmentWithServer(e,t,i){return ase(this,arguments,void 0,function*(e,t,i,n=!1){let r=null;try{r=n?yield this.apiService.deleteCipherAttachmentAdmin(e,t):yield this.apiService.deleteCipherAttachment(e,t)}catch(e){return Promise.reject(e.getSingleMessage())}const s=SM.fromJSON(null==r?void 0: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&&in?-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=hE.getType(e),o=hE.getType(t);if(0!==r||s!==CR.Login||o!==CR.Login)return r;const a=hE.getLogin(e),l=hE.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 ase(this,void 0,void 0,function*(){let i=yield(0,ho._)(this.ciphers$(t));if(null==i)return;const n=e=>{null!=i[e]&&(i[e].deletedDate=(new Date).toISOString(),i[e].archivedDate=null)};"string"==typeof e?n(e):e.forEach(n),yield this.clearCache(),yield this.encryptedCiphersState(t).update(()=>(null==i&&(i={}),i))})}softDeleteWithServer(e,t){return ase(this,arguments,void 0,function*(e,t,i=!1){i?yield this.apiService.putDeleteCipherAdmin(e):yield this.apiService.putDeleteCipher(e),yield this.softDelete(e,t)})}softDeleteManyWithServer(e,t){return ase(this,arguments,void 0,function*(e,t,i=!1){const n=new Jre(e);i?yield this.apiService.putDeleteManyCiphersAdmin(n):yield this.apiService.putDeleteManyCiphers(n),yield this.softDelete(e,t)})}restore(e,t){return ase(this,void 0,void 0,function*(){let i=yield(0,ho._)(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 ase(this,arguments,void 0,function*(e,t,i=!1){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 ase(this,void 0,void 0,function*(){let n;if(i){const t=new Qre(e,i);n=yield this.apiService.putRestoreManyCiphersAdmin(t)}else{const t=new Qre(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 ase(this,void 0,void 0,function*(){return null==e.organizationId?yield(0,ho._)(this.keyService.userKey$(t)):yield(0,ho._)(this.keyService.orgKeys$(t).pipe((0,l.T)(t=>t[e.organizationId])))})}setAddEditCipherInfo(e,t){return ase(this,void 0,void 0,function*(){yield this.addEditCipherInfoState(t).update(()=>e,{shouldUpdate:t=>!(null==t&&null==e)})})}getRotatedData(e,t,i){return ase(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,ho._)(this.cipherViews$(i)),s=yield(0,ho._)(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(Nf.PM22136_SdkCipherEncryption);return n=yield Promise.all(o.map(n=>ase(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 ese(r)}))),n})}getDecryptedAttachmentBuffer(e,t,i,n,r){return ase(this,void 0,void 0,function*(){const s=yield this.configService.getFeatureFlag(Nf.PM19941MigrateCipherDomainToSdk),o=yield(0,ho._)(this.ciphers$(n).pipe((0,l.T)(t=>new GM(t[e]))));if(s&&!r){const e=yield i.arrayBuffer();return this.cipherEncryptionService.decryptAttachmentContent(o,t,new Uint8Array(e),n)}const a=yield bte.fromResponse(i),c=null!=t.key?t.key:o.organizationId?yield(0,ho._)(this.keyService.orgKeys$(n).pipe(CE(),(0,l.T)(e=>e[o.organizationId]))):yield(0,ho._)(this.keyService.userKey$(n).pipe(CE()));return yield this.encryptService.decryptFileData(a,c)})}localDataState(e){return this.stateProvider.getUser(e,Une)}encryptedCiphersState(e){return this.stateProvider.getUser(e,Ene)}decryptedCiphersState(e){return this.stateProvider.getUser(e,$ne)}addEditCipherInfoState(e){return this.stateProvider.getUser(e,Mne)}failedToDecryptCiphersState(e){return this.stateProvider.getUser(e,One)}encryptSharedCipher(e,t){return ase(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 ase(this,void 0,void 0,function*(){const n=yield this.decrypt(t,i);if(e.passwordHistory=n.passwordHistory||[],e.type===CR.Login&&n.type===CR.Login)if(null!=n.login.password&&""!==n.login.password&&n.login.password!==e.login.password){const t=new B$;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===FR.Hidden&&null!=e.name&&""!==e.name&&null!=e.value&&""!==e.value),i=null==e.fields?[]:e.fields.filter(e=>e.type===FR.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 B$;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 ase(this,void 0,void 0,function*(){const r=yield(0,ho._)(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 bte.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(!kd.isNode||kd.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 ase(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 GM(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 ase(this,void 0,void 0,function*(){try{return(yield this.apiService.getAttachmentData(e,t.id)).url}catch(e){if(e instanceof Mw&&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 ase(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 ase(this,void 0,void 0,function*(){switch(e.type){case CR.Login:if(e.login=new UM,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;nase(this,void 0,void 0,function*(){const t=new DM;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 CR.SecureNote:return e.secureNote=new VM,void(e.secureNote.type=t.secureNote.type);case CR.Card:return e.card=new FM,void(yield this.encryptObjProperty(t.card,e.card,{cardholderName:null,brand:null,number:null,expMonth:null,expYear:null,code:null},i));case CR.Identity:return e.identity=new xM,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 CR.SshKey:return e.sshKey=new BM,void(yield this.encryptObjProperty(t.sshKey,e.sshKey,{privateKey:null,publicKey:null,keyFingerprint:null},i));default:throw new Error("Unknown cipher type.")}})}getAutofillOnPageLoadDefault(){return ase(this,void 0,void 0,function*(){return yield(0,ho._)(this.autofillSettingsService.autofillOnPageLoadDefault$)})}getCipherForUrl(e,t,i,n,r){return ase(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,ho._)(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 ase(this,void 0,void 0,function*(){yield this.stateProvider.setUserState(Ene,{},e)})}clearDecryptedCiphersState(e){return ase(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 ase(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 ase(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 ase(this,void 0,void 0,function*(){const e=yield this.configService.getFeatureFlag(Nf.CipherKeyEncryption),t=yield(0,ho._)(this.configService.checkServerMeetsVersionRequirement$(lse));return e&&t})}decryptCiphersWithSdk(e,t){return ase(this,arguments,void 0,function*(e,t,i=!0){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 L$(e);return t.name="[error: cannot decrypt]",t.decryptionFailure=!0,t});return[n.sort(this.getLocaleSortingFunction()),s]})}getFullCipherView(e){return ase(this,void 0,void 0,function*(){if(hE.isCipherListView(e)){const t=yield(0,ho._)(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 use{constructor(e){this.ids=null==e?[]:e}}class dse{constructor(e){this.ids=null==e?[]:e}}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{constructor(e,t,i,n){this.cipherService=e,this.apiService=t,this.billingAccountProfileStateService=i,this.configService=n,this.hasArchiveFlagEnabled$=this.configService.getFeatureFlag$(Nf.PM19148_InnovationArchive).pipe((0,Pp.t)({refCount:!0,bufferSize:1}))}archivedCiphers$(e){return this.cipherService.cipherListViews$(e).pipe((0,To.p)(e=>null!=e),(0,l.T)(e=>e.filter(e=>hE.isArchived(e)&&!hE.isDeleted(e))))}userCanArchive$(e){return(0,$o.z)([this.billingAccountProfileStateService.hasPremiumFromAnySource$(e),this.configService.getFeatureFlag$(Nf.PM19148_InnovationArchive)]).pipe((0,l.T)(([e,t])=>e&&t),(0,Pp.t)({refCount:!0,bufferSize:1}))}userHasPremium$(e){return this.billingAccountProfileStateService.hasPremiumFromAnySource$(e).pipe((0,Pp.t)({refCount:!0,bufferSize:1}))}showSubscriptionEndedMessaging$(e){return(0,$o.z)([this.archivedCiphers$(e),this.userHasPremium$(e)]).pipe((0,l.T)(([e,t])=>e.length>0&&!t),(0,Pp.t)({refCount:!0,bufferSize:1}))}archiveWithServer(e,t){return hse(this,void 0,void 0,function*(){const i=new use(Array.isArray(e)?e:[e]),n=yield this.apiService.send("PUT","/ciphers/archive",i,!0,!0),r=new jS(n,$x),s=yield(0,ho._)(this.cipherService.ciphers$(t));for(const e of r.data){const t=s[e.id];null!=t&&(t.archivedDate=e.archivedDate,t.revisionDate=e.revisionDate)}yield this.cipherService.replace(s,t)})}unarchiveWithServer(e,t){return hse(this,void 0,void 0,function*(){const i=new dse(Array.isArray(e)?e:[e]),n=yield this.apiService.send("PUT","/ciphers/unarchive",i,!0,!0),r=new jS(n,$x),s=yield(0,ho._)(this.cipherService.ciphers$(t));for(const e of r.data){const t=s[e.id];null!=t&&(t.archivedDate=e.archivedDate,t.revisionDate=e.revisionDate)}yield this.cipherService.replace(s,t)})}}var fse=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})},vse=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},mse=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 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())})},yse=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},bse=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 wse=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 Sse=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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=k.record(Ie,"folders",{deserializer:e=>Qne.fromJSON(e),clearOn:["logout"]}),Ise=new k(Ce,"decryptedFolders",{deserializer:e=>{var t;return null!==(t=null==e?void 0:e.map(e=>OO.fromJSON(e)))&&void 0!==t?t:[]},clearOn:["logout","lock"]});var Cse=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 Tse{constructor(e){this.sdkService=e}getCode$(e){return(0,ko.O)(0,1e3).pipe((0,co.n)(()=>this.sdkService.client$.pipe((0,l.T)(t=>t.vault().totp().generate_totp(e)))),(0,Pp.t)({refCount:!0,bufferSize:1}))}}const Pse=new m(Pe,"enablePasskeys",{deserializer:e=>e}),Fse=new k(Pe,"showCardsCurrentTab",{deserializer:e=>e,clearOn:[]}),Rse=new k(Pe,"showIdentitiesCurrentTab",{deserializer:e=>e,clearOn:[]}),xse=new k(Pe,"clickItemsToAutofillOnVaultView",{deserializer:e=>e,clearOn:[]});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 Dse{constructor(){this.anonLayoutWrapperDataSubject=new go.B}setAnonLayoutWrapperData(e){this.anonLayoutWrapperDataSubject.next(e)}anonLayoutWrapperData$(){return this.anonLayoutWrapperDataSubject.asObservable()}}class Ese{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===Tf.PBKDF2_SHA256)this.kdf=Tf.PBKDF2_SHA256,this.kdfIterations=s.iterations;else{if(s.kdfType!==Tf.Argon2id)throw new Error(`Unsupported KDF type: ${s}`);this.kdf=Tf.Argon2id,this.kdfIterations=s.iterations,this.kdfMemory=s.memory,this.kdfParallelism=s.parallelism}}static newConstructor(e,t,i,n,r){return new Ese(e.masterPasswordAuthenticationHash,t.masterKeyWrappedUserKey,i,n,r,t.kdf)}}class $se extends yR{}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())})};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 Mse{getPremiumInterest(e){return Use(this,void 0,void 0,function*(){return null})}setPremiumInterest(e,t){return Use(this,void 0,void 0,function*(){})}clearPremiumInterest(e){return Use(this,void 0,void 0,function*(){})}}Mse.ɵfac=function(e){return new(e||Mse)},Mse.ɵprov=a.jDH({token:Mse,factory:Mse.ɵfac});var Nse=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 Vse{constructor(){this.dialogRef=(0,a.WQX)(Xd),this.formBuilder=(0,a.WQX)(fl.ok),this.masterPasswordUnlockService=(0,a.WQX)(Vx),this.accountService=(0,a.WQX)(Ok),this.migrationPasswordForm=this.formBuilder.group({masterPassword:["",[fl.k0.required]]}),this.submit=()=>Nse(this,void 0,void 0,function*(){const e=this.migrationPasswordForm.controls.masterPassword;if(!e.value||e.invalid)return;const{userId:t}=yield(0,ho._)(this.accountService.activeAccount$.pipe((0,To.p)(e=>null!=e),(0,l.T)(e=>({userId:e.id}))));(yield this.masterPasswordUnlockService.proofOfDecryption(e.value,t))&&this.dialogRef.close(e.value)})}static open(e){return e.open(Vse)}}Vse.ɵfac=function(e){return new(e||Vse)},Vse.ɵcmp=yl.VBU({type:Vse,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&&(yl.j41(0,"form",0)(1,"bit-dialog")(2,"div",1),yl.EFF(3),yl.nI1(4,"i18n"),yl.k0s(),yl.j41(5,"div",2)(6,"p"),yl.EFF(7),yl.nI1(8,"i18n"),yl.j41(9,"a",3),yl.EFF(10),yl.nI1(11,"i18n"),yl.nrm(12,"i",4),yl.k0s()(),yl.j41(13,"bit-form-field")(14,"bit-label"),yl.EFF(15),yl.nI1(16,"i18n"),yl.k0s(),yl.j41(17,"bit-hint"),yl.EFF(18),yl.nI1(19,"i18n"),yl.k0s(),yl.nrm(20,"input",5),yl.nI1(21,"i18n"),yl.nrm(22,"button",6),yl.nI1(23,"i18n"),yl.nI1(24,"i18n"),yl.k0s()(),yl.qex(25,7),yl.j41(26,"button",8)(27,"span"),yl.EFF(28),yl.nI1(29,"i18n"),yl.k0s()(),yl.j41(30,"button",9),yl.EFF(31),yl.nI1(32,"i18n"),yl.k0s(),yl.bVm(),yl.k0s()()),2&e&&(yl.Y8G("bitSubmit",t.submit)("formGroup",t.migrationPasswordForm),yl.R7$(3),yl.SpI(" ",yl.bMT(4,13,"updateEncryptionSettingsTitle")," "),yl.R7$(4),yl.SpI(" ",yl.bMT(8,15,"updateEncryptionSettingsDesc")," "),yl.R7$(3),yl.SpI(" ",yl.bMT(11,17,"learnMore")," "),yl.R7$(5),yl.JRh(yl.bMT(16,19,"masterPass")),yl.R7$(3),yl.JRh(yl.bMT(19,21,"confirmIdentityToContinue")),yl.R7$(2),yl.BMQ("title",yl.bMT(21,23,"masterPass")),yl.R7$(2),yl.BMQ("title",yl.bMT(23,25,"toggleVisibility"))("aria-label",yl.bMT(24,27,"toggleVisibility")),yl.R7$(4),yl.Y8G("disabled",t.migrationPasswordForm.invalid),yl.R7$(2),yl.JRh(yl.bMT(29,29,"updateSettings")),yl.R7$(3),yl.SpI(" ",yl.bMT(32,31,"later")," "))},dependencies:[dh,Zd,uh,Oh,_b,pl.MD,qf,Xu,Ku,_l,zl,fl.X1,fl.qT,fl.me,fl.BC,fl.cb,fl.j4,fl.JD,rc,xd,Td,Eu,Sc,nu,ou,Du,Vb,Bb,Xf],encapsulation:2,changeDetection:0});var Bse=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 jse=new k(Be,"encryptedMigrationDismissed",{deserializer:e=>null!=e?new Date(e):null,clearOn:[]}),Gse=["/vault","/tabs/vault","/tabs/current"];class Lse{}class zse 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)}}}zse.ɵfac=(()=>{let e;return function(t){return(e||(e=yl.xGo(zse)))(t||zse)}})(),zse.ɵprov=a.jDH({token:zse,factory:zse.ɵfac});class _se{}class Kse{signal(e){return(0,a.vPA)(e.initialValue)}formGroup(e){return e.control}}Kse.ɵfac=function(e){return new(e||Kse)},Kse.ɵprov=a.jDH({token:Kse,factory:Kse.ɵfac,providedIn:"root"});var Xse=i(63609);class qse{constructor(){this._onCreated=new go.B,this._onClose=new go.B,this._onClosed=new go.B,this._onShow=new go.B,this._onShown=new go.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,Yv.$)()).toPromise()}}const Yse=["modalContent"];function Wse(e,t){}class Hse{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()}}Hse.ɵfac=function(e){return new(e||Hse)(yl.rXU(o.gRc),yl.rXU(yl.aKT),yl.rXU(Xse.Fp),yl.rXU(qse))},Hse.ɵcmp=yl.VBU({type:Hse,selectors:[["app-modal"]],viewQuery:function(e,t){if(1&e&&yl.GBs(Yse,7,yl.c1b),2&e){let e;yl.mGM(e=yl.lsd())&&(t.modalContentRef=e.first)}},standalone:!1,decls:2,vars:0,consts:[["modalContent",""]],template:function(e,t){1&e&&yl.DNE(0,Wse,0,0,"ng-template",null,0,yl.C5r)},encapsulation:2});class Jse{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 Zse=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 Qse{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 Zse(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,Yv.$)()).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,Yv.$)()).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,Yv.$)()).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,Yv.$)()).subscribe(()=>{e.closed(),0===this.modalCount&&document.body.classList.remove("modal-open")})}createModalComponent(e){const t=new qse,i=new WeakMap;i.set(qse,t);const n=new Jse(this.injector,i);return[t,e.createComponent(Hse,{injector:n})]}}Qse.ɵfac=function(e){return new(e||Qse)(a.KVO(a.zZn))},Qse.ɵprov=a.jDH({token:Qse,factory:Qse.ɵfac});var eoe=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 toe=[Qse,$E,{provide:hT,useValue:window},{provide:pT,useValue:document},{provide:yl.xe9,useFactory:e=>e.translationLocale,deps:[Pl]},{provide:bT,useFactory:e=>e.supportsSecureStorage(),deps:[Eb]},{provide:wT,useValue:"./locales"},{provide:ST,useFactory:e=>e.navigator.language,deps:[hT]},{provide:yT,useFactory:e=>(t,i)=>eoe(void 0,void 0,void 0,function*(){return Promise.resolve(e.send("logout",{logoutReason:t,userId:i}))}),deps:[ek]},{provide:kT,useValue:!0},{provide:IT,useFactory:e=>R5.createSystemThemeFromWindow(e),deps:[hT]},{provide:r$,useClass:class{constructor(e,t=ap.System){this.globalStateProvider=e,this.defaultTheme=t,this.selectedThemeState=this.globalStateProvider.get(s$),this.selectedTheme$=this.selectedThemeState.state$.pipe((0,l.T)(e=>null==e||Object.values(ap).includes(e)?e:null),(0,l.T)(e=>null!=e?e:this.defaultTheme))}setSelectedTheme(e){return n$(this,void 0,void 0,function*(){yield this.selectedThemeState.update(()=>e,{shouldUpdate:t=>t!==e})})}},deps:[d]},{provide:_se,useClass:R5,deps:[r$,IT]},{provide:ok,useClass:class{constructor(e,t){this.storageService=e,this.logService=t}getAppId(){return Gie(this,void 0,void 0,function*(){return this.logService.info("Retrieving application id"),yield this.getEnsuredValue("global_applicationId_appId")})}getAnonymousAppId(){return Gie(this,void 0,void 0,function*(){return yield this.getEnsuredValue("global_applicationId_appId")})}getEnsuredValue(e){return Gie(this,void 0,void 0,function*(){let t=yield this.storageService.get(e);return null==t&&(t=kd.newGuid(),yield this.storageService.save(e,t)),t})}},deps:[vT,za]},{provide:Pb,useClass:class{constructor(e,t,i,n=100){this.cryptoFunctionService=e,this.apiService=t,this.hibpApiService=i,this.maxConcurrent=n,this.passwordLeakedSubject=new go.B,this.maxConcurrent=n,this.passwordLeakedSubject.pipe((0,cx.Z)(e=>Tre(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 Tre(this,void 0,void 0,function*(){return new Promise((t,i)=>{this.passwordLeakedSubject.next({password:e,resolve:t,reject:i})})})}fetchLeakedPasswordCount(e){return Tre(this,void 0,void 0,function*(){const t=yield this.cryptoFunctionService.hash(e,"sha1"),i=kd.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 Tre(this,void 0,void 0,function*(){return this.hibpApiService.getHibpBreach(e)})}},deps:[cI,Mk,fte]},{provide:fte,useClass:fte,deps:[Mk]},{provide:dd,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,co.n)(e=>this.authStatusFor$(e))),this.authStatuses$=this.accountService.accounts$.pipe((0,l.T)(e=>Object.keys(e)),(0,co.n)(e=>0===e.length?(0,Oo.of)([]):(0,$o.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 kd.isGuid(e)?(0,$o.z)([this.keyService.getInMemoryUserKeyFor$(e),this.tokenService.hasAccessToken$(e)]).pipe((0,l.T)(([e,t])=>t?e?cd.Unlocked:cd.Locked:cd.LoggedOut),(0,lo.F)(),(0,Pp.t)({bufferSize:1,refCount:!1})):(0,Oo.of)(cd.LoggedOut)}getAuthStatus(e){return Z9(this,void 0,void 0,function*(){return null!=e||(e=yield(0,ho._)(this.accountService.activeAccount$.pipe((0,l.T)(e=>null==e?void 0:e.id)))),yield(0,ho._)(this.authStatusFor$(e))})}logOut(e,t){e(),this.messageSender.send("loggedOut",{userId:t})}},deps:[Ok,ek,Cp,Mk,ao,b5]},{provide:jte,useClass:Bte,deps:[Ote,$k,Cp,Db]},{provide:zx,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 Dte(e,t,i,n,r)})}runMigrations(e,t){return Ete(this,void 0,void 0,function*(){LS(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 Ete(this,void 0,void 0,function*(){LS(e,"userId");const t=yield Promise.all(this.migrations.map(t=>Ete(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:[$f,jte,za,uk,Ab,ux]},{provide:pw,useClass:class{constructor(e,t,i,n,r,s,o,a,l,c,u,d,h,p,f,v,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=f,this.passwordStrengthService=v,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 fd.t(!1),this.passwordPrelogin={email:null,kdfConfig:null,promise:null,version:0},this.authenticationSessionTimeout$=this.authenticationTimeoutSubject.asObservable(),this.currentAuthnTypeState=this.stateProvider.get(FS),this.loginStrategyCacheState=this.stateProvider.get(AS),this.loginStrategyCacheExpirationState=this.stateProvider.get(RS),this.authRequestPushNotificationState=this.stateProvider.get(xS),this.taskSchedulerService.registerTaskHandler(Ba,()=>DS(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,lo.F)(),(0,Op.v)(this.loginStrategyCacheState.state$),this.initializeLoginStrategy.bind(this),(0,Pp.t)({refCount:!0,bufferSize:1}))}getEmail(){return DS(this,void 0,void 0,function*(){const e=yield(0,ho._)(this.loginStrategy$);return e&&"email$"in e?yield(0,ho._)(e.email$):null})}getMasterPasswordHash(){return DS(this,void 0,void 0,function*(){const e=yield(0,ho._)(this.loginStrategy$);return e&&"serverMasterKeyHash$"in e?yield(0,ho._)(e.serverMasterKeyHash$):null})}getSsoEmail2FaSessionToken(){return DS(this,void 0,void 0,function*(){const e=yield(0,ho._)(this.loginStrategy$);return e&&"ssoEmail2FaSessionToken$"in e?yield(0,ho._)(e.ssoEmail2FaSessionToken$):null})}getAccessCode(){return DS(this,void 0,void 0,function*(){const e=yield(0,ho._)(this.loginStrategy$);return e&&"accessCode$"in e?yield(0,ho._)(e.accessCode$):null})}getAuthRequestId(){return DS(this,void 0,void 0,function*(){const e=yield(0,ho._)(this.loginStrategy$);return e&&"authRequestId$"in e?yield(0,ho._)(e.authRequestId$):null})}logIn(e){return DS(this,void 0,void 0,function*(){yield this.clearCache(),this.authenticationTimeoutSubject.next(!1),yield this.currentAuthnTypeState.update(t=>e.type);const t=yield(0,ho._)(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 DS(this,void 0,void 0,function*(){if(!(yield this.isSessionValid()))throw new Error(this.i18nService.t("sessionTimeout"));const t=yield(0,ho._)(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 Mw||(yield this.clearCache()),e}})}logInNewDeviceVerification(e){return DS(this,void 0,void 0,function*(){if(!(yield this.isSessionValid()))throw new Error(this.i18nService.t("sessionTimeout"));const t=yield(0,ho._)(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 Mw||(yield this.clearCache()),e}})}makePasswordPreLoginMasterKey(e,t){return DS(this,void 0,void 0,function*(){var i;if(t=t.trim().toLowerCase(),yield this.configService.getFeatureFlag(Nf.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 Ow(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 Ow(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 DS(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=(()=>DS(this,void 0,void 0,function*(){try{const e=yield this.apiService.postPrelogin(new Ow(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 DS(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 DS(this,void 0,void 0,function*(){yield this.clearSessionTimeout(),yield this.loginStrategyCacheExpirationState.update(e=>new Date(Date.now()+ES)),this.sessionTimeoutSubscription=this.taskSchedulerService.setTimeout(Ba,ES)})}clearSessionTimeout(){return DS(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 DS(this,void 0,void 0,function*(){if(null==(yield(0,ho._)(this.loginStrategyCacheState.state$)))return!1;const e=yield(0,ho._)(this.loginStrategyCacheExpirationState.state$);return!(null!=e&&e{var n,r,s,o,a;if(null==e)return null;switch(e){case bw.Password:return new fS(null!==(n=null==i?void 0:i.password)&&void 0!==n?n:new pS,this.passwordStrengthService,this.policyService,this,...t);case bw.Sso:return new yS(null!==(r=null==i?void 0:i.sso)&&void 0!==r?r:new gS,this.keyConnectorService,this.deviceTrustService,this.authRequestService,this.i18nService,...t);case bw.UserApiKey:return new kS(null!==(s=null==i?void 0:i.userApiKey)&&void 0!==s?s:new SS,this.keyConnectorService,...t);case bw.AuthRequest:return new dS(null!==(o=null==i?void 0:i.authRequest)&&void 0!==o?o:new uS,this.deviceTrustService,...t);case bw.WebAuthn:return new PS(null!==(a=null==i?void 0:i.webAuthn)&&void 0!==a?a:new TS,...t)}}))}buildKdfConfigFromPrelogin(e){return null==e?null:e.kdf===Tf.PBKDF2_SHA256?new xf(e.kdfIterations):new Af(e.kdfIterations,e.kdfMemory,e.kdfParallelism)}},deps:[Ok,Db,Cp,Mk,b5,ok,Eb,ek,za,iT,JS,ao,BT,Pl,Nj,Wf,$b,Nk,mw,vw,d,ME,Ep,$f,Ua,uk,Lk]},{provide:wie,useClass:class{constructor(e,t){this.logService=e,this.azureFileUploadService=new Sne(e,t),this.bitwardenFileUploadService=new Cne}upload(e,t,i,n){return Tne(this,void 0,void 0,function*(){try{switch(e.fileUploadType){case Qh.Direct:yield this.bitwardenFileUploadService.upload(t.encryptedString,i,e=>n.postDirect(e));break;case Qh.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,Mk]},{provide:Yre,useClass:class{constructor(e,t){this.apiService=e,this.fileUploadService=t}upload(e,t,i,n,r){return wse(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 Mw?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()=>wse(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()=>i?this.apiService.deleteCipherAttachmentAdmin(e.id,t.attachmentId):this.apiService.deleteCipherAttachment(e.id,t.attachmentId)}},deps:[Mk,wie]},{provide:oE,useClass:aE,deps:[u,$b,Ok]},{provide:Fb,useFactory:(e,t,i,n,r,s,o,a,l,c,u,d,h,p)=>new cse(e,t,i,n,r,s,o,a,l,c,u,d,h,p),deps:[Cp,oE,Mk,Pl,RJ,HD,Nj,Yre,uk,u,Ok,za,qre,ek]},{provide:c$,useClass:class{constructor(e,t){this.sdkService=e,this.cipherService=t}computeRiskForCiphers(e,t,i){return gse(this,void 0,void 0,function*(){const n=this.mapToLoginDetails(e);return 0===n.length?[]:yield(0,ho._)(this.sdkService.userClient$(t).pipe((0,co.n)(e=>gse(this,void 0,void 0,function*(){const t={stack:[],error:void 0,hasError:!1};try{const r=yse(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{bse(t)}}))))})}computeCipherRiskForUser(e,t){return gse(this,arguments,void 0,function*(e,t,i=!0){const n=yield(0,ho._)(this.cipherService.cipherViews$(t).pipe(CE())),r=null==n?void 0:n.find(t=>Dk(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 gse(this,void 0,void 0,function*(){const i=this.mapToLoginDetails(e);return 0===i.length?{}:yield(0,ho._)(this.sdkService.userClient$(t).pipe((0,co.n)(e=>gse(this,void 0,void 0,function*(){const t={stack:[],error:void 0,hasError:!1};try{const n=yse(t,e.take(),!1);return n.value.vault().cipher_risk().password_reuse_map(i)}catch(e){t.error=e,t.hasError=!0}finally{bse(t)}}))))})}mapToLoginDetails(e){return e.filter(e=>{var t;return e.type===CR.Login&&null!=(null===(t=e.login)||void 0===t?void 0:t.password)&&""!==e.login.password}).map(e=>({id:Dk(e.id),password:e.login.password,username:e.login.username}))}},deps:[$k,Fb]},{provide:YU,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 Dz(e))))}folderViews$(e){if(!this.folderViewCache.has(e)){this.forceFolderViews[e]||(this.forceFolderViews[e]=new go.B);const t=(0,bo.h)(this.forceFolderViews[e],(0,$o.z)([this.encryptedFoldersState(e).state$,this.keyService.userKey$(e)]).pipe((0,To.p)(([e,t])=>null!=e&&null!=t),(0,co.n)(([t,i])=>this.decryptFolders(e,t)))).pipe((0,Pp.t)({refCount:!1,bufferSize:1}));this.folderViewCache.set(e,t)}return this.folderViewCache.get(e)}encrypt(e,t){return Cse(this,void 0,void 0,function*(){const i=new Dz;return i.id=e.id,i.name=yield this.encryptService.encryptString(e.name,t),i})}get(e,t){return Cse(this,void 0,void 0,function*(){return(yield(0,ho._)(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,Pp.t)({refCount:!0,bufferSize:1}))}getAllFromState(e){return Cse(this,void 0,void 0,function*(){return yield(0,ho._)(this.folders$(e))})}getFromState(e,t){return Cse(this,void 0,void 0,function*(){const i=yield this.get(e,t);return i||null})}getAllDecryptedFromState(e){return Cse(this,void 0,void 0,function*(){return yield(0,ho._)(this.folderViews$(e))})}upsert(e,t){return Cse(this,void 0,void 0,function*(){yield this.clearDecryptedFolderState(t),yield this.encryptedFoldersState(t).update(t=>{if(null==t&&(t={}),e instanceof Qne){const i=e;t[i.id]=i}else e.forEach(e=>{t[e.id]=e});return t})})}replace(e,t){return Cse(this,void 0,void 0,function*(){e&&(yield this.clearDecryptedFolderState(t),yield this.stateProvider.getUser(t,kse).update(()=>Object.assign({},e)))})}clearDecryptedFolderState(e){return Cse(this,void 0,void 0,function*(){if(null==e)throw new Error("User ID is required.");yield this.setDecryptedFolders([],e)})}clear(e){return Cse(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 Cse(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 Cse(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,ho._)(this.folderViews$(i));return n?(e=yield Promise.all(n.map(e=>Cse(this,void 0,void 0,function*(){const i=yield this.encrypt(e,t);return new rz(i)}))),e):e})}decryptFolders(e,t){return Cse(this,void 0,void 0,function*(){const i=yield(0,ho._)(this.stateProvider.getUser(e,Ise).state$);if(null==i?void 0:i.length)return i;if(null==t)return[];const n=Object.values(t).map(e=>new Dz(e)),r=yield(0,ho._)(this.keyService.userKey$(e));if(!r)return[];const s=n.map(e=>Cse(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(kd.getSortFunction(this.i18nService,"name")),a=new OO;return a.name=this.i18nService.t("noneFolder"),o.push(a),yield this.setDecryptedFolders(o,e),o})}encryptedFoldersState(e){return this.stateProvider.getUser(e,kse)}setDecryptedFolders(e,t){return Cse(this,void 0,void 0,function*(){yield this.stateProvider.setUserState(Ise,e,t)})}},deps:[Cp,Nj,Pl,Fb,u]},{provide:qU,useExisting:YU},{provide:zG,useClass:class{constructor(e,t){this.folderService=e,this.apiService=t}save(e,t){return Sse(this,void 0,void 0,function*(){const i=new nz(e);let n;null==e.id?(n=yield this.postFolder(i),e.id=n.id):n=yield this.putFolder(e.id,i);const r=new Qne(n);return yield this.folderService.upsert(r,t),r})}delete(e,t){return Sse(this,void 0,void 0,function*(){yield this.deleteFolder(e),yield this.folderService.delete(e,t)})}deleteAll(e){return Sse(this,void 0,void 0,function*(){yield this.apiService.send("DELETE","/folders/all",null,!0,!1),yield this.folderService.clear(e)})}get(e){return Sse(this,void 0,void 0,function*(){const t=yield this.apiService.send("GET","/folders/"+e,null,!0,!0);return new Ox(t)})}postFolder(e){return Sse(this,void 0,void 0,function*(){const t=yield this.apiService.send("POST","/folders",e,!0,!0);return new Ox(t)})}putFolder(e,t){return Sse(this,void 0,void 0,function*(){const i=yield this.apiService.send("PUT","/folders/"+e,t,!0,!0);return new Ox(i)})}deleteFolder(e){return this.apiService.send("DELETE","/folders/"+e,null,!0,!1)}},deps:[YU,Mk]},{provide:KI,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 $9(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 $9(this,void 0,void 0,function*(){const t=yield(0,ho._)(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 Mw&&204===e.statusCode)return null;throw this.logService.error(e),e}})}registerVerificationEmailClicked(e){return $9(this,void 0,void 0,function*(){const t=yield(0,ho._)(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 $9(this,void 0,void 0,function*(){const t=yield(0,ho._)(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 $9(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:[Mk,bC,za,Uk,JS]},{provide:Uk,useClass:class{constructor(e,t,i,n){this.messagingService=e,this.logService=t,this.globalStateProvider=i,this.singleUserStateProvider=n,this._showHeader$=new fd.t(!0),this.showHeader$=this._showHeader$.asObservable(),this.accountsState=this.globalStateProvider.get(Mp),this.activeAccountIdState=this.globalStateProvider.get(Np),this.accounts$=this.accountsState.state$.pipe((0,l.T)(e=>null==e?{}:e)),this.activeAccount$=this.activeAccountIdState.state$.pipe((0,Op.v)(this.accounts$),(0,l.T)(([e,t])=>e?Object.assign({id:e},t[e]):null),(0,lo.F)((e,t)=>(null==e?void 0:e.id)===(null==t?void 0:t.id)&&this.accountInfoEqual(e,t)),(0,Pp.t)({bufferSize:1,refCount:!1})),this.accountActivity$=this.globalStateProvider.get(Vp).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,$o.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,co.n)(e=>this.singleUserStateProvider.get(e,Bp).state$))}addAccount(e,t){return Up(this,void 0,void 0,function*(){if(!kd.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 Up(this,void 0,void 0,function*(){yield this.setAccountInfo(e,{name:t})})}setAccountEmail(e,t){return Up(this,void 0,void 0,function*(){yield this.setAccountInfo(e,{email:t})})}setAccountEmailVerified(e,t){return Up(this,void 0,void 0,function*(){yield this.setAccountInfo(e,{emailVerified:t})})}setAccountCreationDate(e,t){return Up(this,void 0,void 0,function*(){yield this.setAccountInfo(e,{creationDate:t})})}clean(e){return Up(this,void 0,void 0,function*(){yield this.setAccountInfo(e,jp),yield this.removeAccountActivity(e)})}switchAccount(e){return Up(this,void 0,void 0,function*(){let t=!1;yield this.activeAccountIdState.update((i,n)=>(t=!0,e),{combineLatestWith:this.accountsState.state$.pipe((0,To.p)(t=>null==e||null!=(null==t?void 0:t[e])),(0,po.w)({first:1e3,with:()=>(0,Oo.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 Up(this,void 0,void 0,function*(){kd.isGuid(e)&&(yield this.globalStateProvider.get(Vp).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 Up(this,void 0,void 0,function*(){kd.isGuid(e)&&(yield this.singleUserStateProvider.get(e,Bp).update(()=>t,{shouldUpdate:e=>e!==t}))})}removeAccountActivity(e){return Up(this,void 0,void 0,function*(){yield this.globalStateProvider.get(Vp).update(t=>(null==t||delete t[e],t),{shouldUpdate:t=>null!=(null==t?void 0:t[e])})})}delete(){return Up(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 Up(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 Up(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:[ek,za,d,h]},{provide:Ok,useExisting:Uk},{provide:hF,useClass:class{constructor(e,t){this.apiService=e,this.stateProvider=t,this.avatarColor$=this.stateProvider.getActive(tee).state$}setAvatarColor(e){return eee(this,void 0,void 0,function*(){const{avatarColor:t}=yield this.apiService.putAvatar(new Q9(e));yield this.stateProvider.setUserState(tee,t)})}setSyncAvatarColor(e,t){return eee(this,void 0,void 0,function*(){yield this.stateProvider.getUser(e,tee).update(()=>t)})}getUserAvatarColor$(e){return this.stateProvider.getUser(e,tee).state$}},deps:[Mk,u]},{provide:za,useFactory:()=>new Ka(!1),deps:[]},{provide:BF,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,nR)}decryptedState(e){return this.stateProvider.getUser(e,rR)}encryptedCollections$(e){return this.encryptedState(e).state$.pipe((0,l.T)(e=>null==e?null:Object.values(e).map(e=>zF.fromCollectionData(e))))}decryptedCollections$(e){const t=this.collectionViewCache.get(e);if(t)return t;const i=this.decryptedState(e).state$.pipe((0,co.n)(t=>null!==t?(0,Oo.of)(null!=t?t:[]):this.initializeDecryptedState(e).pipe((0,co.n)(()=>uo.t))),(0,Pp.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,$o.z)([this.encryptedCollections$(e),this.keyService.orgKeys$(e).pipe((0,To.p)(e=>!!e))]).pipe((0,co.n)(([t,i])=>this.decryptMany$(t,i).pipe((0,eR.o)(t=>this.setDecryptedCollections(t,e)))))}upsert(e,t){return sR(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,ho._)(this.keyService.orgKeys$(t).pipe((0,co.n)(t=>{if(!t)throw new Error("No key for this collection's organization.");return this.decryptMany$([zF.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 sR(this,void 0,void 0,function*(){yield this.encryptedState(t).update(()=>e),yield this.decryptedState(t).update(()=>null)})}delete(e,t){return sR(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 sR(this,void 0,void 0,function*(){const i=yield(0,ho._)(this.keyService.orgKeys$(t).pipe((0,To.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,Oo.of)([]);const i=[];return e.forEach(e=>{i.push((0,md.H)(e.decrypt(t[e.organizationId],this.encryptService)))}),(0,$o.z)(i).pipe((0,l.T)(e=>e.sort(kd.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 KF(Object.assign(Object.assign({},i),{name:i.name})),i),n=i.name?i.name.replace(/^\/+|\/+$/g,"").split("/"):[];iR.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 iR.getTreeNodeObjectFromList(i,t)}setDecryptedCollections(e,t){return sR(this,void 0,void 0,function*(){yield this.stateProvider.setUserState(rR,e,t)})}},deps:[Cp,Nj,Pl,u]},{provide:RT,useValue:{ENV:"production"}.ADDITIONAL_REGIONS},{provide:JS,useClass:fne,deps:[u,Ok,RT]},{provide:vw,useClass:class{constructor(e){this.singleUserStateProvider=e}userDecryptionOptionsById$(e){return this.singleUserStateProvider.get(e,OS).state$.pipe((0,To.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 $S(this,void 0,void 0,function*(){yield this.singleUserStateProvider.get(e,OS).update(e=>t)})}},deps:[h]},{provide:fw,useExisting:vw},{provide:UE,useClass:Tse,deps:[$k]},{provide:b5,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,$o.z)([this.singleUserStateProvider.get(e,See).state$,this.singleUserStateProvider.get(e,kee).state$]).pipe((0,l.T)(([e,t])=>Boolean(e||t)))}initializeState(){this.emailTwoFactorTokenRecordGlobalState=this.globalStateProvider.get(Tee),this.activeUserIdGlobalState=this.globalStateProvider.get(Np)}setTokens(e,t,i,n,r){return Eee(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 wee(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 Eee(this,void 0,void 0,function*(){const t=yield this.secureStorageService.get(`${e}${this.accessTokenKeySecureStorageKey}`,this.getSecureStorageOptions(e));if(!t)return null;return gf.fromJSON(t)})}createAndSaveAccessTokenKey(e){return Eee(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 Eee(this,void 0,void 0,function*(){yield this.secureStorageService.remove(`${e}${this.accessTokenKeySecureStorageKey}`,this.getSecureStorageOptions(e))})}getOrCreateAccessTokenKey(e){return Eee(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 Eee(this,void 0,void 0,function*(){const i=yield this.getOrCreateAccessTokenKey(t);return yield this.encryptService.encryptString(e,i)})}decryptAccessToken(e,t){return Eee(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 Eee(this,void 0,void 0,function*(){switch(yield this.determineStorageLocation(t,i,!0)){case Dee.SecureStorage:{let t=null;try{const i=yield this.encryptAccessToken(e,n);yield this.singleUserStateProvider.get(n,See).update(e=>i.encryptedString,{shouldUpdate:e=>e!==i.encryptedString}),t=e,yield this.singleUserStateProvider.get(n,kee).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,See).update(t=>e,{shouldUpdate:t=>t!==e})}return t}case Dee.Disk:return yield this.singleUserStateProvider.get(n,See).update(t=>e,{shouldUpdate:t=>t!==e});case Dee.Memory:return yield this.singleUserStateProvider.get(n,kee).update(t=>e)}})}setAccessToken(e,t,i){return Eee(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 Eee(this,void 0,void 0,function*(){if(null!=e||(e=yield(0,ho._)(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,See).update(e=>null,{shouldUpdate:e=>null!==e}),yield this.singleUserStateProvider.get(e,kee).update(e=>null)})}getAccessToken(e){return Eee(this,void 0,void 0,function*(){if(!e)return null;const t=yield this.getStateValueByUserIdAndKeyDef(e,kee);if(null!=t)return t;const i=yield this.getStateValueByUserIdAndKeyDef(e,See);if(!i)return null;if(this.platformSupportsSecureStorage){let t;try{t=yield this.getAccessTokenKey(e)}catch(t){return up.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 up.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 up(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 Eee(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 Dee.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,Iee).update(e=>null,{shouldUpdate:e=>null!==e}),yield this.singleUserStateProvider.get(n,Cee).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,Iee).update(t=>e,{shouldUpdate:t=>t!==e})}return t}case Dee.Disk:return yield this.singleUserStateProvider.get(n,Iee).update(t=>e,{shouldUpdate:t=>t!==e});case Dee.Memory:return yield this.singleUserStateProvider.get(n,Cee).update(t=>e)}})}getRefreshToken(e){return Eee(this,void 0,void 0,function*(){if(!e)return null;const t=yield this.getStateValueByUserIdAndKeyDef(e,Cee);if(null!=t)return t;const i=yield this.getStateValueByUserIdAndKeyDef(e,Iee);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 Eee(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,Cee).update(e=>null),yield this.singleUserStateProvider.get(e,Iee).update(e=>null,{shouldUpdate:e=>null!==e})})}setClientId(e,t,i,n){return Eee(this,void 0,void 0,function*(){if(null!=n||(n=yield(0,ho._)(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===Dee.Disk?yield this.singleUserStateProvider.get(n,Pee).update(t=>e):r===Dee.Memory?yield this.singleUserStateProvider.get(n,Fee).update(t=>e):void 0})}getClientId(e){return Eee(this,void 0,void 0,function*(){if(!e)return;const t=yield this.getStateValueByUserIdAndKeyDef(e,Fee);return null!=t?t:yield this.getStateValueByUserIdAndKeyDef(e,Pee)})}clearClientId(e){return Eee(this,void 0,void 0,function*(){if(null!=e||(e=yield(0,ho._)(this.activeUserIdGlobalState.state$)),!e)throw new Error("User id not found. Cannot clear client id.");yield this.singleUserStateProvider.get(e,Fee).update(e=>null),yield this.singleUserStateProvider.get(e,Pee).update(e=>null)})}setClientSecret(e,t,i,n){return Eee(this,void 0,void 0,function*(){if(null!=n||(n=yield(0,ho._)(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===Dee.Disk?yield this.singleUserStateProvider.get(n,Ree).update(t=>e):r===Dee.Memory?yield this.singleUserStateProvider.get(n,xee).update(t=>e):void 0})}getClientSecret(e){return Eee(this,void 0,void 0,function*(){if(!e)return;const t=yield this.getStateValueByUserIdAndKeyDef(e,xee);return null!=t?t:yield this.getStateValueByUserIdAndKeyDef(e,Ree)})}clearClientSecret(e){return Eee(this,void 0,void 0,function*(){if(null!=e||(e=yield(0,ho._)(this.activeUserIdGlobalState.state$)),!e)throw new Error("User id not found. Cannot clear client secret.");yield this.singleUserStateProvider.get(e,xee).update(e=>null),yield this.singleUserStateProvider.get(e,Ree).update(e=>null)})}setTwoFactorToken(e,t){return Eee(this,void 0,void 0,function*(){yield this.emailTwoFactorTokenRecordGlobalState.update(i=>(null!=i||(i={}),i[e]=t,i))})}getTwoFactorToken(e){return Eee(this,void 0,void 0,function*(){const t=yield(0,ho._)(this.emailTwoFactorTokenRecordGlobalState.state$);return t?t[e]:null})}clearTwoFactorToken(e){return Eee(this,void 0,void 0,function*(){yield this.emailTwoFactorTokenRecordGlobalState.update(t=>(null!=t||(t={}),delete t[e],t))})}clearTokens(e){return Eee(this,void 0,void 0,function*(){if(null!=e||(e=yield(0,ho._)(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 Eee(this,void 0,void 0,function*(){let t=e;if(kd.isGuid(e)?t=yield this.getAccessToken(e):null!=t||(t=yield this.getAccessToken(yield(0,ho._)(this.activeUserIdGlobalState.state$))),null==t)throw new Error("Access token not found.");return HS(t)})}getTokenExpirationDate(e){return Eee(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 Eee(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 Eee(this,arguments,void 0,function*(e,t=5){return(yield this.tokenSecondsRemaining(e))<60*t})}getUserId(){return Eee(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 Eee(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 Eee(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 Eee(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 Eee(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 Eee(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 Eee(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 Eee(this,void 0,void 0,function*(){if(null!=e||(e=yield(0,ho._)(this.activeUserIdGlobalState.state$)),!e)throw new Error("User id not found. Cannot get security stamp.");return yield this.getStateValueByUserIdAndKeyDef(e,Aee)})}setSecurityStamp(e,t){return Eee(this,void 0,void 0,function*(){if(null!=t||(t=yield(0,ho._)(this.activeUserIdGlobalState.state$)),!t)throw new Error("User id not found. Cannot set security stamp.");yield this.singleUserStateProvider.get(t,Aee).update(t=>e)})}getStateValueByUserIdAndKeyDef(e,t){return Eee(this,void 0,void 0,function*(){return yield(0,ho._)(this.singleUserStateProvider.get(e,t).state$)})}determineStorageLocation(e,t,i){return Eee(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===Zp.LogOut&&t!==Qp?Dee.Memory:i&&this.platformSupportsSecureStorage?Dee.SecureStorage:Dee.Disk})}saveStringToSecureStorage(e,t,i){return Eee(this,void 0,void 0,function*(){yield this.secureStorageService.save(`${e}${t}`,i,this.getSecureStorageOptions(e))})}getStringFromSecureStorage(e,t){return Eee(this,void 0,void 0,function*(){return yield this.secureStorageService.get(`${e}${t}`,this.getSecureStorageOptions(e))})}getSecureStorageOptions(e){return{storageLocation:np.Disk,useSecureStorage:!0,userId:e}}},deps:[h,d,bT,gT,_L,Nj,za,yT]},{provide:_L,useClass:class{constructor(e){this.cryptoFunctionService=e}createKey(e){return YL(this,void 0,void 0,function*(){const t=yield this.cryptoFunctionService.aesGenerateKey(e);return new gf(t)})}createKeyWithPurpose(e,t,i){return YL(this,void 0,void 0,function*(){if(null==i){const e=yield this.cryptoFunctionService.randomBytes(32);i=kd.fromBufferToUtf8(e)}const n=yield this.cryptoFunctionService.aesGenerateKey(e),r=yield this.cryptoFunctionService.hkdf(n,i,t,64,"sha256");return{salt:i,material:n,derivedKey:new gf(r)}})}deriveKeyFromMaterial(e,t,i){return YL(this,void 0,void 0,function*(){const n=yield this.cryptoFunctionService.hkdf(e,t,i,64,"sha256");return new gf(n)})}deriveKeyFromPassword(e,t,i){return YL(this,void 0,void 0,function*(){return"string"==typeof e&&(e=(new TextEncoder).encode(e)),"string"==typeof t&&(t=(new TextEncoder).encode(t)),yield qL.Ready,new gf(A$.IEs.derive_kdf_material(e,t,i.toSdkConfig()))})}stretchKey(e){return YL(this,void 0,void 0,function*(){if(e.inner().type!=Hh.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 gf(t)})}deriveVaultExportKey(e,t,i){return YL(this,void 0,void 0,function*(){return yield this.stretchKey(yield this.deriveKeyFromPassword(e,t,i))})}},deps:[cI]},{provide:Cp,useClass:Ff,deps:[Db,_L,cI,Nj,Eb,za,ao,Ok,u,$f]},{provide:Gk,useClass:class{constructor(e){this.stateProvider=e}accountSecurityState$(e){return this.stateProvider.getUserState$(fie,e)}setAccountSecurityState(e,t){return vie(this,void 0,void 0,function*(){yield this.stateProvider.setUserState(fie,e,t)})}},deps:[u]},{provide:vE,useClass:vE,deps:[Ok,AF,$b]},{provide:Wf,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 Hf(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:rv,useFactory:function(e,t,i,n,r){const s=new Zy(t),o=new Qy(s,Date.now),a=new eb(new Jy(o,r),i),l=new eb(new Hy(o,r),i),c=new Ky(r,i),u=new Vy(e,t,r);return new Yy(n,c,a,l,u)},deps:[Nj,Cp,$b,Ok,u]},{provide:xy,useClass:Vy,deps:[Nj,Cp,u]},{provide:tb,useFactory:function(e,t,i,n,r,s,o){const a=new ab(i),l=new nb(e,t),c=new lb(a),u=new cb(a),d=new ub,h=new db(new fb(c,o),r),p=new db(new pb(d,u,o),r),f=new db(new hb(d,u,o),r),v=new db(new vb(Lv.AddyIo,l,t,n,i,o),r),m=new db(new vb(Lv.DuckDuckGo,l,t,n,i,o),r),g=new db(new vb(Lv.Fastmail,l,t,n,i,o),r),y=new db(new vb(Lv.FirefoxRelay,l,t,n,i,o),r),b=new db(new vb(Lv.ForwardEmail,l,t,n,i,o),r),w=new db(new vb(Lv.SimpleLogin,l,t,n,i,o),r),S=new Ky(o,r);return new ob(s,S,f,h,p,v,m,g,y,b,w)},deps:[Mk,Pl,Cp,Nj,$b,Ok,u]},{provide:FT,useFactory:(e,t)=>()=>{e.showToast({variant:"error",title:t.t("errorRefreshingAccessToken"),message:t.t("errorRefreshingAccessTokenDesc")})},deps:[xb,Pl]},{provide:xT,useValue:{createRequest:(e,t)=>new Request(e,t)}},{provide:Mk,useClass:Cre,deps:[b5,Eb,JS,ok,FT,za,yT,Ep,Ok,xT]},{provide:pQ,useExisting:fQ},{provide:fQ,useClass:class{constructor(e,t,i,n,r,s){this.accountService=e,this.keyService=t,this.i18nService=i,this.keyGenerationService=n,this.stateProvider=r,this.encryptService=s,this.sendKeySalt="bitwarden-send",this.sendKeyPurpose="send",this.sends$=this.stateProvider.encryptedState$.pipe((0,l.T)(([,e])=>Object.values(e||{}).map(e=>new Ure(e)))),this.sendViews$=this.stateProvider.encryptedState$.pipe((0,yo.H)(([e,t])=>this.decryptSends(Object.values(t||{}).map(e=>new Ure(e)),e)))}encrypt(e,t,i,n){return Xre(this,void 0,void 0,function*(){var r,s;let o=null;const a=new Ure;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}if((null!==(s=null===(r=e.emails)||void 0===r?void 0:r.length)&&void 0!==s?s:0)>0)a.emails=e.emails.join(","),a.password=null;else if(null!=i){const t=yield this.keyGenerationService.deriveKeyFromPassword(i,e.key,new xf(gie));a.password=t.keyB64}const l=(yield(0,ho._)(this.accountService.activeAccount$)).id;if(null==n&&(n=yield(0,ho._)(this.keyService.userKey$(l))),a.key=yield this.encryptService.encryptBytes(e.key,n),a.name=yield this.encryptService.encryptString(e.name,e.cryptoKey),a.notes=yield this.encryptService.encryptString(e.notes,e.cryptoKey),a.type===UZ.Text)a.text=new $re,a.text.text=yield this.encryptService.encryptString(e.text.text,e.cryptoKey),a.text.hidden=e.text.hidden;else if(a.type===UZ.File&&(a.file=new Ere,null!=t))if(t instanceof ArrayBuffer){const[i,n]=yield this.encryptFileData(e.file.fileName,t,e.cryptoKey,l);a.file.fileName=i,o=n}else o=yield this.parseFile(a,t,e.cryptoKey,l);return[a,o]})}get$(e){return this.sends$.pipe((0,lo.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 Xre(this,void 0,void 0,function*(){const[,t]=yield this.stateProvider.getEncryptedSends();return null!=t&&t.hasOwnProperty(e)?new Ure(t[e]):null})}getAll(){return Xre(this,void 0,void 0,function*(){const[,e]=yield this.stateProvider.getEncryptedSends(),t=[];for(const i in e)e.hasOwnProperty(i)&&t.push(new Ure(e[i]));return t})}getAllDecryptedFromState(e){return Xre(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(kd.getSortFunction(this.i18nService,"name")),yield this.stateProvider.setDecryptedSends(t),t})}upsert(e){return Xre(this,void 0,void 0,function*(){const[t,i]=yield this.stateProvider.getEncryptedSends();let n=i;if(null==n&&(n={}),e instanceof Zne){const t=e;n[t.id]=t}else e.forEach(e=>{n[e.id]=e});yield this.replace(n,t)})}delete(e){return Xre(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 Xre(this,void 0,void 0,function*(){yield this.stateProvider.setEncryptedSends(e,t)})}getRotatedData(e,t,i){return Xre(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,ho._)(this.sends$.pipe((0,yo.H)(i=>Xre(this,void 0,void 0,function*(){return this.toRotatedKeyRequestMap(i,e,t)}))))})}toRotatedKeyRequestMap(e,t,i){return Xre(this,void 0,void 0,function*(){return yield Promise.all(e.map(e=>Xre(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 Kre(e)})))})}parseFile(e,t,i,n){return new Promise((r,s)=>{const o=new FileReader;o.readAsArrayBuffer(t),o.onload=o=>Xre(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 Xre(this,void 0,void 0,function*(){null==i&&(i=yield(0,ho._)(this.keyService.userKey$(n)));return[yield this.encryptService.encryptString(e,i),yield this.encryptService.encryptFileData(new Uint8Array(t),i)]})}decryptSends(e,t){return Xre(this,void 0,void 0,function*(){const i=e.map(e=>e.decrypt(t)),n=yield Promise.all(i);return n.sort(kd.getSortFunction(this.i18nService,"name")),n})}},deps:[Ok,Cp,Pl,_L,_re,Nj]},{provide:_re,useClass:class{constructor(e){this.stateProvider=e,this.activeUserEncryptedState=this.stateProvider.getActive(Gre),this.encryptedState$=this.activeUserEncryptedState.combinedState$,this.activeUserDecryptedState=this.stateProvider.getActive(Lre),this.decryptedState$=this.activeUserDecryptedState.state$}getEncryptedSends(){return zre(this,void 0,void 0,function*(){return yield(0,ho._)(this.encryptedState$)})}setEncryptedSends(e,t){return zre(this,void 0,void 0,function*(){yield this.stateProvider.getUser(t,Gre).update(()=>e)})}getDecryptedSends(){return zre(this,void 0,void 0,function*(){return yield(0,ho._)(this.decryptedState$)})}setDecryptedSends(e){return zre(this,void 0,void 0,function*(){yield this.activeUserDecryptedState.update(()=>e)})}},deps:[u]},{provide:GZ,useClass:class{constructor(e,t,i){this.apiService=e,this.fileUploadService=t,this.sendService=i}getSend(e){return jre(this,void 0,void 0,function*(){const t=yield this.apiService.send("GET","/sends/"+e,null,!0,!0);return new Sx(t)})}postSendAccess(e,t,i){return jre(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 Nre(n)})}getSendFileDownloadData(e,t,i){return jre(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 Vre(n)})}getSends(){return jre(this,void 0,void 0,function*(){const e=yield this.apiService.send("GET","/sends",null,!0,!0);return new jS(e,Sx)})}postSend(e){return jre(this,void 0,void 0,function*(){const t=yield this.apiService.send("POST","/sends",e,!0,!0);return new Sx(t)})}postFileTypeSend(e){return jre(this,void 0,void 0,function*(){const t=yield this.apiService.send("POST","/sends/file/v2",e,!0,!0);return new Bre(t)})}renewSendFileUploadUrl(e,t){return jre(this,void 0,void 0,function*(){const i=yield this.apiService.send("GET","/sends/"+e+"/file/"+t,null,!0,!0);return new Bre(i)})}postSendFile(e,t,i){return this.apiService.send("POST","/sends/"+e+"/file/"+t,i,!0,!1)}putSend(e,t){return jre(this,void 0,void 0,function*(){const i=yield this.apiService.send("PUT","/sends/"+e,t,!0,!0);return new Sx(i)})}putSendRemovePassword(e){return jre(this,void 0,void 0,function*(){const t=yield this.apiService.send("PUT","/sends/"+e+"/remove-password",null,!0,!0);return new Sx(t)})}deleteSend(e){return this.apiService.send("DELETE","/sends/"+e,null,!0,!1)}save(e){return jre(this,void 0,void 0,function*(){const t=yield this.upload(e),i=new Zne(t);return yield this.sendService.upsert(i),new Ure(i)})}delete(e){return jre(this,void 0,void 0,function*(){yield this.deleteSend(e),yield this.sendService.delete(e)})}removePassword(e){return jre(this,void 0,void 0,function*(){const t=yield this.putSendRemovePassword(e),i=new Zne(t);yield this.sendService.upsert(i)})}upload(e){return jre(this,void 0,void 0,function*(){var t;const i=new Mre(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===UZ.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 Mw?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()=>jre(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:[Mk,wie,fQ]},{provide:class{},useClass:class{constructor(e){this.apiService=e}getUserPublicKeys(e){return Wte(this,void 0,void 0,function*(){const t=yield this.apiService.send("GET","/users/"+e+"/keys",null,!0,!0);return new Yte(t)})}},deps:[Mk]},{provide:ux,useClass:class extends ire{constructor(e,t,i,n,r,s,o,a,l,c,u,d,h,p,f,v,m,g,y,b,w,S,k,I,C,T,P){super(S,r,f,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=v,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 nre(this,void 0,void 0,function*(){const{allowThrowOnError:i=!1,skipTokenRefresh:n=!1}="boolean"==typeof t?{allowThrowOnError:t}:null!=t?t:{},r=yield(0,ho._)(this.accountService.activeAccount$.pipe((0,l.T)(e=>null==e?void 0:e.id)));this.syncStarted();if((yield(0,ho._)(this.authService.authStatusFor$(r)))===cd.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.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 nre(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 nre(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.keyService.setPrivateKey(e.accountKeys.publicKeyEncryptionKeyPair.wrappedPrivateKey,e.id),e.accountKeys.isV2Encryption()&&(yield this.keyService.setUserSigningKey(e.accountKeys.signatureKeyPair.wrappedSigningKey,e.id),yield this.securityStateService.setAccountSecurityState(e.accountKeys.securityState.securityState,e.id),yield this.keyService.setSignedPublicKey(e.accountKeys.publicKeyEncryptionKeyPair.signedPublicKey,e.id))):yield this.keyService.setPrivateKey(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 Wne(e)}),yield this.providerService.save(i,e.id),yield this.syncProfileOrganizations(e,e.id),(yield(0,ho._)(this.keyConnectorService.convertAccountRequired$))&&this.messageSender.send("convertAccountToKeyConnector")})}setForceSetPasswordReasonIfNeeded(e){return nre(this,void 0,void 0,function*(){var t;e.forcePasswordReset&&(yield this.masterPasswordService.setForceSetPasswordReason(Gw.AdminForcePasswordReset,e.id));const i=yield(0,ho._)(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===zh.Admin,i=t.type===zh.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,ho._)(this.accountService.activeAccount$))||void 0===t?void 0:t.id;yield this.masterPasswordService.setForceSetPasswordReason(Gw.TdeUserWithoutPasswordHasPasswordResetPermission,e)}})}syncProfileOrganizations(e,t){return nre(this,void 0,void 0,function*(){const i={};e.organizations.forEach(e=>{i[e.id]=new O5(e,{isMember:!0,isProviderUser:!1})}),e.providerOrganizations.forEach(e=>{null==i[e.id]?i[e.id]=new O5(e,{isMember:!1,isProviderUser:!0}):i[e.id].isProviderUser=!0}),yield this.organizationService.replace(i,t)})}syncFolders(e,t){return nre(this,void 0,void 0,function*(){const i={};return e.forEach(e=>{i[e.id]=new Qne(e)}),yield this.folderService.replace(i,t)})}syncCollections(e,t){return nre(this,void 0,void 0,function*(){const i={};return e.forEach(e=>{i[e.id]=new HF(e)}),yield this.collectionService.replace(i,t)})}syncCiphers(e,t){return nre(this,void 0,void 0,function*(){const i={};return e.forEach(e=>{i[e.id]=new SM(e)}),yield this.cipherService.replace(i,t)})}syncSends(e,t){return nre(this,void 0,void 0,function*(){const i={};return e.forEach(e=>{i[e.id]=new Zne(e)}),yield this.sendService.replace(i,t)})}syncSettings(e,t){return nre(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 nre(this,void 0,void 0,function*(){const i={};return null!=e&&e.forEach(e=>{i[e.id]=new Xp(e)}),yield this.policyService.replace(i,t)})}syncUserDecryption(e,t){return nre(this,void 0,void 0,function*(){if(null!=t&&null!=t.masterPasswordUnlock){const i=t.masterPasswordUnlock.toMasterPasswordUnlockData();yield this.masterPasswordService.setMasterPasswordUnlockData(i,e),yield this.kdfConfigService.setKdfConfig(e,i.kdf)}})}},deps:[Db,Ok,Mk,oE,YU,Fb,Cp,BF,ek,Ob,fQ,za,iT,$5,zG,DF,GZ,fw,hF,yT,ME,b5,dd,u,Gk,$f,Lk]},{provide:Lk,useClass:class{constructor(e){this.stateProvider=e}accountCryptographicState$(e){return this.stateProvider.getUserState$(mte,e)}setAccountCryptographicState(e,t){return vte(this,void 0,void 0,function*(){yield this.stateProvider.setUserState(mte,e,t)})}},deps:[u]},{provide:ak,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:[ZS]},{provide:Ep,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 hf(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!=Qp&&i===Zp.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(0,Po.v)(()=>this.getAvailableVaultTimeoutActions(e))}canLock(e){return hf(this,void 0,void 0,function*(){const t=yield(0,ho._)(this.availableVaultTimeoutActions$(e));return(null==t?void 0:t.includes(Zp.Lock))||!1})}isBiometricLockSet(e){return hf(this,void 0,void 0,function*(){const t=null==e?(0,ho._)(this.biometricStateService.biometricUnlockEnabled$):this.biometricStateService.getBiometricUnlockEnabled(e);return yield t})}setVaultTimeout(e,t){return hf(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(df,t,e)})}getVaultTimeoutByUserId$(e){if(!e)throw new Error("User id required. Cannot get vault timeout.");return(0,$o.z)([this.stateProvider.getUserState$(df,e),this.getMaxSessionTimeoutPolicyDataByUserId$(e)]).pipe((0,co.n)(([t,i])=>(this.logService.debug("[VaultTimeoutSettingsService] Current vault timeout is %o for user id %s, max session policy %o",t,e,i),(0,md.H)(this.determineVaultTimeout(t,i)).pipe((0,yo.H)(i=>hf(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(df,i,e)),i})),(0,vd.W)(e=>(this.logService.error(`Error getting vault timeout: ${e}`),$p.w))))),(0,lo.F)(),(0,Pp.t)({refCount:!0,bufferSize:1}))}determineVaultTimeout(e,t){return hf(this,void 0,void 0,function*(){if(e=null!=e?e:this.defaultVaultTimeout,null==t)return e;switch(t.type){case"immediately":return yield this.sessionTimeoutTypeService.getOrPromoteToAvailable(of);case"custom":case null:case void 0:return e===of?e:cf(e)?Math.min(e,t.minutes):t.minutes;case"onSystemLock":if(e===Qp||e===ef||e===tf||e===rf||e===nf)return yield this.sessionTimeoutTypeService.getOrPromoteToAvailable(tf);break;case"onAppRestart":if(e===Qp||e===tf||e===rf||e===nf)return ef;break;case"never":if(e===Qp)return yield this.sessionTimeoutTypeService.getOrPromoteToAvailable(Qp)}return e})}setVaultTimeoutAction(e,t){return hf(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(uf,t,e)})}getVaultTimeoutActionByUserId$(e){if(!e)throw new Error("User id required. Cannot get vault timeout action.");return(0,$o.z)([this.stateProvider.getUserState$(uf,e),this.getMaxSessionTimeoutPolicyDataByUserId$(e)]).pipe((0,co.n)(([t,i])=>(0,md.H)(this.determineVaultTimeoutAction(e,t,i)).pipe((0,Fo.M)(i=>{if(i!==t)return this.stateProvider.setUserState(uf,i,e)}),(0,vd.W)(e=>(this.logService.error(`Error getting vault timeout: ${e}`),$p.w)))),(0,lo.F)(),(0,Pp.t)({refCount:!0,bufferSize:1}))}determineVaultTimeoutAction(e,t,i){return hf(this,void 0,void 0,function*(){const n=yield this.getAvailableVaultTimeoutActions(e);return 1===n.length?n[0]:(null==i?void 0:i.action)&&n.includes(i.action)?i.action:null==t&&n.includes(Zp.Lock)?Zp.Lock:t})}getMaxSessionTimeoutPolicyDataByUserId$(e){if(!e)throw new Error("User id required. Cannot get max session timeout policy.");return this.policyService.policiesByType$(_h.MaximumVaultTimeout,e).pipe(Jp,(0,l.T)(e=>{var t;return null!==(t=null==e?void 0:e.data)&&void 0!==t?t:null}))}getAvailableVaultTimeoutActions(e){return hf(this,void 0,void 0,function*(){var t;null!=e||(e=null===(t=yield(0,ho._)(this.accountService.activeAccount$))||void 0===t?void 0:t.id);const i=[Zp.LogOut];return((yield this.userHasMasterPassword(e))||(yield this.pinStateService.isPinSet(e))||(yield this.isBiometricLockSet(e)))&&i.push(Zp.Lock),i})}userHasMasterPassword(e){return hf(this,void 0,void 0,function*(){let t;if(e)t=e;else{const e=yield(0,ho._)(this.accountService.activeAccount$);if(!e)return!1;t=e.id}return yield(0,ho._)(this.userDecryptionOptionsService.hasMasterPasswordById$(t))})}},deps:[Ok,rie,fw,Cp,b5,$b,wp,u,za,CT,xA]},{provide:vf,useClass:vf,deps:[Ok,Eb,dd,Ep,Ua,za,_S,yw]},{provide:pf,useExisting:vf},{provide:dk,useClass:class{constructor(e,t,i){this.stateProvider=e,this.logService=t,this.policyService=i,this.codeVerifierState=this.stateProvider.getGlobal(fee),this.ssoState=this.stateProvider.getGlobal(vee),this.orgSsoIdentifierState=this.stateProvider.getGlobal(gee),this.ssoEmailState=this.stateProvider.getGlobal(yee),this.ssoRequiredCacheState=this.stateProvider.getGlobal(bee),this.ssoRequiredCache$=this.ssoRequiredCacheState.state$.pipe((0,l.T)(e=>new Set(e)))}getCodeVerifier(){return(0,ho._)(this.codeVerifierState.state$)}setCodeVerifier(e){return pee(this,void 0,void 0,function*(){yield this.codeVerifierState.update(t=>e)})}getSsoState(){return(0,ho._)(this.ssoState.state$)}setSsoState(e){return pee(this,void 0,void 0,function*(){yield this.ssoState.update(t=>e)})}getOrganizationSsoIdentifier(){return(0,ho._)(this.orgSsoIdentifierState.state$)}setOrganizationSsoIdentifier(e){return pee(this,void 0,void 0,function*(){yield this.orgSsoIdentifierState.update(t=>e)})}getSsoEmail(){return(0,ho._)(this.ssoEmailState.state$)}setSsoEmail(e){return pee(this,void 0,void 0,function*(){yield this.ssoEmailState.update(t=>e)})}clearSsoEmail(){return pee(this,void 0,void 0,function*(){yield this.ssoEmailState.update(e=>null)})}getActiveUserOrganizationSsoIdentifier(e){return(0,ho._)(this.userOrgSsoIdentifierState(e).state$)}setActiveUserOrganizationSsoIdentifier(e,t){return pee(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,mee)}addToSsoRequiredCache(e){return pee(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 pee(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 pee(this,void 0,void 0,function*(){(yield(0,ho._)(this.policyService.policyAppliesToUser$(_h.RequireSso,t)))?yield this.addToSsoRequiredCache(e.toLowerCase()):yield this.removeFromSsoRequiredCacheIfPresent(e.toLowerCase())})}},deps:[u,za,$b]},{provide:ao,useClass:class{constructor(e,t,i){this.storageService=e,this.secureStorageService=t,this.activeUserAccessor=i}clean(e){return zo(this,void 0,void 0,function*(){yield this.setUserKeyAutoUnlock(null,e),yield this.clearUserKeyBiometric(e.userId)})}getUserKeyAutoUnlock(e){return zo(this,void 0,void 0,function*(){return null==e.userId?null:yield this.secureStorageService.get(`${e.userId}${Ko}`,{userId:e.userId,keySuffix:"auto"})})}setUserKeyAutoUnlock(e,t){return zo(this,void 0,void 0,function*(){null!=t.userId&&(yield this.saveSecureStorageKey(Ko,e,t.userId,"auto"))})}clearUserKeyBiometric(e){return zo(this,void 0,void 0,function*(){null!=e&&(yield this.saveSecureStorageKey(Xo,null,e,"biometric"))})}getDuckDuckGoSharedKey(){return zo(this,void 0,void 0,function*(){return null==(yield this.getActiveUserIdFromStorage())?null:yield this.secureStorageService.get(qo)})}setDuckDuckGoSharedKey(e){return zo(this,void 0,void 0,function*(){null!=(yield this.getActiveUserIdFromStorage())&&(null==e?yield this.secureStorageService.remove(qo):yield this.secureStorageService.save(qo,e))})}setEnableDuckDuckGoBrowserIntegration(e){return zo(this,void 0,void 0,function*(){var t;const i=null!==(t=yield this.storageService.get(_o))&&void 0!==t?t:new Lo;i.enableDuckDuckGoBrowserIntegration=e,yield this.storageService.save(_o,i)})}getActiveUserIdFromStorage(){return zo(this,void 0,void 0,function*(){return yield(0,ho._)(this.activeUserAccessor.activeUserId$)})}saveSecureStorageKey(e,t,i,n){return zo(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:[ip,gT,Go]},{provide:O1,useClass:class extends D1{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 U1(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 U1(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:E1.getFileName("","encrypted_json")}})}getDecryptedExportZip(e){return U1(this,void 0,void 0,function*(){const t=new xK,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:E1.getFileName("","zip")}})}downloadAttachment(e,t){return U1(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 U1(this,void 0,void 0,function*(){let i=[],n=[];const r=[];r.push((0,ho._)(this.folderService.folderViews$(e)).then(e=>{i=e}));const s=yield(0,ho._)(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:E1.getFileName("","csv")}:{type:"text/plain",data:this.buildJsonExport(i,n),fileName:E1.getFileName("","json")}})}getEncryptedExport(e){return U1(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,ho._)(this.folderService.folders$(e)).then(e=>{t=e}));const r=yield(0,ho._)(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,ho._)(this.keyService.userKey$(e)),o={encrypted:!0,encKeyValidation_DO_NOT_EDIT:(yield this.encryptService.encryptString(kd.newGuid(),s)).encryptedString,folders:[],items:[]};return t.forEach(e=>{if(null==e.id)return;const t=new $z;t.build(e),o.folders.push(t)}),i.forEach(e=>{if(null!=e.organizationId)return;const t=new Pz;t.build(e),t.collectionIds=null,o.items.push(t)}),{type:"text/plain",data:JSON.stringify(o,null," "),fileName:E1.getFileName("","encrypted_json")}})}buildCsvExport(e,t){const i=new Map;e.forEach(e=>{null!=e.id&&i.set(e.id,e)});const n=[];return t.forEach(e=>{if(e.type!==CR.Login&&e.type!==CR.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)}),oz.unparse(n)}buildJsonExport(e,t){const i={encrypted:!1,folders:[],items:[]};return e.forEach(e=>{if(null==e.id)return;const t=new $z;t.build(e),i.folders.push(t)}),t.forEach(e=>{if(null!=e.organizationId)return;const t=new Pz;t.build(e),t.collectionIds=null,i.items.push(t)}),JSON.stringify(i,null," ")}},deps:[qU,Fb,_L,Cp,Nj,cI,$f,Mk,vE]},{provide:M1,useClass:class{constructor(e){this.apiService=e}getOrganizationExport(e){return V1(this,void 0,void 0,function*(){const t=yield this.apiService.send("GET","/organizations/"+e+"/export",void 0,!0,!0);return new N1(t)})}},deps:[Mk]},{provide:x1,useClass:class extends D1{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 $1(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:E1.getFileName("org","encrypted_json")}})}getOrganizationExport(e,t){return $1(this,arguments,void 0,function*(e,t,i="csv",n){if(kd.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:E1.getFileName("org","encrypted_json")}:{type:"text/plain",data:n?yield this.getDecryptedManagedExport(e,t,i):yield this.getOrganizationDecryptedExport(e,t,i),fileName:E1.getFileName("org",i)}})}getOrganizationDecryptedExport(e,t,i){return $1(this,void 0,void 0,function*(){const n=[],r=[],s=[],o=yield(0,ho._)(this.keyService.orgKeys$(e).pipe((0,To.p)(e=>null!=e))),a=yield(0,ho._)(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=zF.fromCollectionData(new HF(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=>$1(this,void 0,void 0,function*(){const i=new GM(new SM(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 $1(this,void 0,void 0,function*(){const i=[],n=[],r=yield(0,ho._)(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=zF.fromCollectionData(new HF(e));i.push(t)}),null!=s.ciphers&&s.ciphers.length>0&&s.ciphers.filter(e=>null===e.deletedDate).forEach(e=>{const t=new GM(new SM(e));this.restrictedItemTypesService.isCipherRestricted(t,r)||n.push(t)}),this.BuildEncryptedExport(e,t,i,n)})}getDecryptedManagedExport(e,t,i){return $1(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,ho._)(this.collectionService.decryptedCollections$(e).pipe((0,l.T)(e=>e.filter(e=>e.organizationId==t&&e.manage)))),a=yield(0,ho._)(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 $1(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,ho._)(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,ho._)(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 $1(this,void 0,void 0,function*(){const r=yield(0,ho._)(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 xz;t.build(e),o.collections.push(t)}),n.forEach(e=>{const t=new Pz;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!==CR.Login&&e.type!==CR.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)}),oz.unparse(n)}buildJsonExport(e,t){const i={encrypted:!1,collections:[],items:[]};return e.forEach(e=>{const t=new xz;t.build(e),i.collections.push(t)}),t.forEach(e=>{const t=new Pz;t.build(e),i.items.push(t)}),JSON.stringify(i,null," ")}},deps:[Fb,M1,_L,Cp,Nj,cI,BF,$f,vE]},{provide:F1,useClass:class{constructor(e,t,i){this.individualVaultExportService=e,this.organizationVaultExportService=t,this.accountService=i}getExport(e){return R1(this,arguments,void 0,function*(e,t="csv",i=""){if(yield this.checkForImpersonation(e),!kd.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 R1(this,arguments,void 0,function*(e,t,i,n,r=!1){if(yield this.checkForImpersonation(e),!kd.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,Oo.of)([...t,{name:".zip (with attachments)",format:"zip"}]):(0,Oo.of)(t)}checkForImpersonation(e){return R1(this,void 0,void 0,function*(){const t=yield(0,ho._)(this.accountService.activeAccount$.pipe(Gp));if(e!==t)throw new Error("UserId does not match the currently authenticated user")})}},deps:[O1,x1,Ok]},{provide:RJ,useClass:V4,deps:[za,Pl,u]},{provide:jie,useClass:jie,deps:[Mk,ok]},{provide:Oie,useClass:Oie,deps:[Mk,za,Eb]},{provide:Nie,useClass:class{supportStatus$(e){return(0,Oo.of)({type:"not-supported",reason:"client-not-supported"})}},deps:[]},{provide:kie,useClass:Iie,deps:[]},{provide:kie,useClass:Iie,deps:[]},{provide:sre,useClass:are,deps:[]},{provide:IH,useClass:IH,deps:[u]},{provide:k5,useClass:class{constructor(){}receivedPendingAuthRequest(e,t){return J9(this,void 0,void 0,function*(){})}handleAuthRequestNotificationClicked(e){return J9(this,void 0,void 0,function*(){})}processPendingAuthRequests(){return J9(this,void 0,void 0,function*(){})}},deps:[]},{provide:Rie,useClass:class{constructor(e,t,i,n,r,s,o,a,c,u,d,h,p){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.activitySubject=new fd.t("active"),this.notifications$=this.configService.getFeatureFlag$(Nf.InactiveUserServerNotification).pipe((0,lo.F)(),(0,co.n)(e=>{return e?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)}),(t=e=>this.userNotifications$(e).pipe((0,l.T)(t=>[t,e])),e=>{const i=new Map,n=()=>{for(const[,e]of i.entries())e.unsubscribe();i.clear()};return new ea.c(r=>{const s=e.subscribe({next:e=>{var n;for(const t of i.keys())e.has(t)?e.delete(t):(null===(n=i.get(t))||void 0===n||n.unsubscribe(),i.delete(t));for(const n of e.keys())i.set(n,t(n).subscribe({next:e=>{r.next(e)},error:e=>{r.error(e)},complete:()=>{i.delete(n)}}))},error:e=>{r.error(e)},complete:()=>{n(),r.complete()}});return()=>{n(),s.unsubscribe()}})})):this.accountService.activeAccount$.pipe((0,l.T)(e=>null==e?void 0:e.id),(0,lo.F)(),(0,co.n)(e=>null==e?$p.w:this.userNotifications$(e).pipe((0,l.T)(t=>[t,e]))));var t}),(0,wo.u)())}userNotifications$(e){return this.environmentService.getEnvironment$(e).pipe((0,l.T)(e=>e.getNotificationsUrl()),(0,lo.F)(),(0,co.n)(t=>"http://-"===t?$p.w:this.userNotificationsHelper$(e,t)))}userNotificationsHelper$(e,t){return this.hasAccessToken$(e).pipe((0,co.n)(e=>e?this.activitySubject:$p.w),(0,co.n)(t=>"inactive"===t?$p.w:this.webPushConnectionService.supportStatus$(e)),(i={supported:i=>(this.logService.info("Using WebPush for server notifications"),i.notifications$.pipe((0,vd.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,co.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,To.p)(e=>"ReceiveMessage"===e.type),(0,l.T)(e=>e.message))}hasAccessToken$(e){return this.configService.getFeatureFlag$(Nf.PushNotificationsWhenLocked).pipe((0,lo.F)(),(0,co.n)(t=>t?this.authService.authStatusFor$(e).pipe((0,l.T)(e=>e===cd.Locked||e===cd.Unlocked),(0,lo.F)()):this.authService.authStatusFor$(e).pipe((0,l.T)(e=>e===cd.Unlocked),(0,lo.F)())))}processNotification(e,t){return Uie(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){if(yield(0,ho._)(this.configService.getFeatureFlag$(Nf.InactiveUserServerNotification))){if(!((yield(0,ho._)(this.accountService.activeAccount$.pipe((0,l.T)(e=>null==e?void 0:e.id))))===t)&&!Mie.has(e.type))return}switch(e.type){case Ea.SyncCipherCreate:case Ea.SyncCipherUpdate:yield this.syncService.syncUpsertCipher(e.payload,e.type===Ea.SyncCipherUpdate,t);break;case Ea.SyncCipherDelete:case Ea.SyncLoginDelete:yield this.syncService.syncDeleteCipher(e.payload,t);break;case Ea.SyncFolderCreate:case Ea.SyncFolderUpdate:yield this.syncService.syncUpsertFolder(e.payload,e.type===Ea.SyncFolderUpdate,t);break;case Ea.SyncFolderDelete:yield this.syncService.syncDeleteFolder(e.payload,t);break;case Ea.SyncVault:case Ea.SyncCiphers:case Ea.SyncSettings:yield this.syncService.fullSync(!1);break;case Ea.SyncOrganizations:yield this.syncService.fullSync(!0);break;case Ea.SyncOrgKeys:yield this.syncService.fullSync(!0),this.activitySubject.next("inactive"),this.activitySubject.next("active");break;case Ea.LogOut:{this.logService.info("[Notifications Service] Received logout notification");const i=e.payload;(yield(0,ho._)(this.configService.getFeatureFlag$(Nf.NoLogoutOnKdfChange)))&&i.reason===$a.KdfChange?this.logService.info("[Notifications Service] Skipping logout due to no logout KDF change"):yield this.logoutCallback("logoutNotification",t);break}case Ea.SyncSendCreate:case Ea.SyncSendUpdate:yield this.syncService.syncUpsertSend(e.payload,e.type===Ea.SyncSendUpdate);break;case Ea.SyncSendDelete:yield this.syncService.syncDeleteSend(e.payload);break;case Ea.AuthRequest:yield this.authRequestAnsweringService.receivedPendingAuthRequest(e.payload.userId,e.payload.id),this.messagingService.send("openLoginApproval",{notificationId:e.payload.id});break;case Ea.SyncOrganizationStatusChanged:case Ea.SyncOrganizationCollectionSettingChanged:yield this.syncService.fullSync(!0);break;case Ea.OrganizationBankAccountVerified:this.messagingService.send("organizationBankAccountVerified",{organizationId:e.payload.organizationId});break;case Ea.ProviderBankAccountVerified:this.messagingService.send("providerBankAccountVerified",{providerId:e.payload.providerId,adminId:e.payload.adminId});break;case Ea.SyncPolicy:yield this.policyService.syncPolicy(Xp.fromPolicy(e.payload.policy))}}})}startListening(){return this.notifications$.pipe((0,cx.Z)(e=>Uie(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,ux,ok,JS,yT,ek,Ok,Oie,dd,Nie,k5,uk,Ob]},{provide:cI,useClass:Ite,deps:[hT]},{provide:Nj,useClass:class{constructor(e,t,i){this.cryptoFunctionService=e,this.logService=t,this.logMacFailures=i,this.disableType0Decryption=!1}init(e){e.serverConfig$.subscribe(e=>{null!=e&&this.setDisableType0Decryption(!0===e.featureStates[Nf.PM25174_DisableType0Decryption])})}setDisableType0Decryption(e){this.disableType0Decryption=e}encryptString(e,t){return wte(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 qL.Ready,new up(A$.IEs.symmetric_encrypt_string(e,t.toEncoded())))})}encryptBytes(e,t){return wte(this,void 0,void 0,function*(){return yield qL.Ready,new up(A$.IEs.symmetric_encrypt_bytes(e,t.toEncoded()))})}encryptFileData(e,t){return wte(this,void 0,void 0,function*(){return yield qL.Ready,new bte(A$.IEs.symmetric_encrypt_filedata(e,t.toEncoded()))})}decryptString(e,t){return wte(this,void 0,void 0,function*(){if(this.disableType0Decryption&&e.encryptionType===Hh.AesCbc256_B64)throw new Error("Decryption of AesCbc256_B64 encrypted data is disabled.");return yield qL.Ready,A$.IEs.symmetric_decrypt_string(e.encryptedString,t.toEncoded())})}decryptBytes(e,t){return wte(this,void 0,void 0,function*(){if(this.disableType0Decryption&&e.encryptionType===Hh.AesCbc256_B64)throw new Error("Decryption of AesCbc256_B64 encrypted data is disabled.");return yield qL.Ready,A$.IEs.symmetric_decrypt_bytes(e.encryptedString,t.toEncoded())})}decryptFileData(e,t){return wte(this,void 0,void 0,function*(){if(this.disableType0Decryption&&e.encryptionType===Hh.AesCbc256_B64)throw new Error("Decryption of AesCbc256_B64 encrypted data is disabled.");return yield qL.Ready,A$.IEs.symmetric_decrypt_filedata(e.buffer,t.toEncoded())})}wrapDecapsulationKey(e,t){return wte(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 qL.Ready,new up(A$.IEs.wrap_decapsulation_key(e,t.toEncoded()))})}wrapEncapsulationKey(e,t){return wte(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 qL.Ready,new up(A$.IEs.wrap_encapsulation_key(e,t.toEncoded()))})}wrapSymmetricKey(e,t){return wte(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 qL.Ready,new up(A$.IEs.wrap_symmetric_key(e.toEncoded(),t.toEncoded()))})}unwrapDecapsulationKey(e,t){return wte(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(this.disableType0Decryption&&e.encryptionType===Hh.AesCbc256_B64)throw new Error("Decryption of AesCbc256_B64 encrypted data is disabled.");return yield qL.Ready,A$.IEs.unwrap_decapsulation_key(e.encryptedString,t.toEncoded())})}unwrapEncapsulationKey(e,t){return wte(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(this.disableType0Decryption&&e.encryptionType===Hh.AesCbc256_B64)throw new Error("Decryption of AesCbc256_B64 encrypted data is disabled.");return yield qL.Ready,A$.IEs.unwrap_encapsulation_key(e.encryptedString,t.toEncoded())})}unwrapSymmetricKey(e,t){return wte(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(this.disableType0Decryption&&e.encryptionType===Hh.AesCbc256_B64)throw new Error("Decryption of AesCbc256_B64 encrypted data is disabled.");return yield qL.Ready,new gf(A$.IEs.unwrap_symmetric_key(e.encryptedString,t.toEncoded()))})}hash(e,t){return wte(this,void 0,void 0,function*(){const i=yield this.cryptoFunctionService.hash(e,t);return kd.fromBufferToB64(i)})}encapsulateKeyUnsigned(e,t){return wte(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 qL.Ready,new up(A$.IEs.encapsulate_key_unsigned(e.toEncoded(),t))})}decapsulateKeyUnsigned(e,t){return wte(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 qL.Ready;const i=A$.IEs.decapsulate_key_unsigned(e.encryptedString,t);return new gf(i)})}rsaDecrypt(e,t){return wte(this,void 0,void 0,function*(){if(null==e)throw new Error("[Encrypt service] rsaDecrypt: No data provided for decryption.");switch(e.encryptionType){case Hh.Rsa2048_OaepSha1_B64:case Hh.Rsa2048_OaepSha1_HmacSha256_B64:break;default:throw new Error("Invalid encryption type.")}if(null==t)throw new Error("[Encrypt service] rsaDecrypt: No private key provided for decryption.");return this.cryptoFunctionService.rsaDecrypt(e.dataBytes,t,"sha1")})}},deps:[cI,za,kT]},{provide:x5,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(ja,()=>this.uploadEvents())}init(e){this.inited||(this.inited=!0,e&&(this.uploadEvents(),this.taskSchedulerService.setInterval(ja,6e4)))}uploadEvents(e){return Are(this,void 0,void 0,function*(){if(e||(e=yield(0,ho._)(this.stateProvider.activeUserId$)),!e)return;if(!(yield(0,ho._)(this.authService.authStatusFor$(e).pipe((0,l.T)(e=>e===cd.Unlocked)))))return;const t=yield this.takeEvents(e);if(null==t||0===t.length)return;const i=t.map(e=>{const t=new xre;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(Fre,t,e)}})}takeEvents(e){return Are(this,void 0,void 0,function*(){let t=null;return yield this.stateProvider.getUser(e,Fre).update(e=>(t=null!=e?e:[],[])),t})}},deps:[Mk,u,za,dd,Ua]},{provide:OE,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 Rre(this,arguments,void 0,function*(e,t,i=!1){const n=yield(0,ho._)(Gp(this.accountService.activeAccount$)),r=this.stateProvider.getUser(n,Fre);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 Rre(this,arguments,void 0,function*(e,t=null,i=!1,n=null){const r=yield(0,ho._)(Gp(this.accountService.activeAccount$)),s=this.stateProvider.getUser(r,Fre);if(!(yield this.shouldUpdate(r,n,e,void 0,t)))return;const o=new Pre;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 Rre(this,arguments,void 0,function*(e,t=null,i=null,n=[],r){const s=(0,md.H)(this.cipherService.get(r,e)),o=this.organizationService.organizations$(e).pipe((0,l.T)(e=>this.getOrgIds(e))),[a,c,u]=yield(0,ho._)((0,Wv.y)(this.authService.activeAccountStatus$,o,s));if(a!=cd.Unlocked)return!1;if(null==c||0==c.length)return!1;if(i==Ra.User_ClientExportedVault)return!0;if(null!=u&&n.push(new L$(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:[Fb,u,AF,x5,dd,Ok]},{provide:Ob,useClass:class{constructor(e,t,i){this.stateProvider=e,this.organizationService=t,this.accountService=i}policyState(e){return this.stateProvider.getUser(e,Wp)}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 qp(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,$o.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(Jp,(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>=Lh.Accepted&&n.usePolicies&&!this.isExemptFromPolicy(t.type,n,e)})}masterPasswordPolicyOptions$(e,t){return(t?(0,Oo.of)(t):this.policies$(e)).pipe((0,l.T)(e=>{var t;let i;const n=null!==(t=e.filter(e=>e.type===_h.MasterPassword))&&void 0!==t?t:[];if(0!==n.length)return n.forEach(e=>{e.enabled&&e.data&&(i||(i=new Kp),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===_h.MasterPassword))&&void 0!==t?t:[];if(0!==n.length)return n.forEach(e=>{e.enabled&&e.data&&(i||(i=new Kp),this.mergeMasterPasswordPolicyOptions(i,e.data))}),i}combineMasterPasswordPolicyOptions(...e){let t;return e.forEach(e=>{t||(t=new Kp),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 Yp;if(!e||!t)return[s,!1];const o=e.find(e=>e.organizationId===t&&e.type===_h.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 Hp(this,void 0,void 0,function*(){yield this.policyState(t).update(t=>(null!=t||(t={}),t[e.id]=e,t))})}replace(e,t){return Hp(this,void 0,void 0,function*(){yield this.stateProvider.setUserState(Wp,e,t)})}isExemptFromPolicy(e,t,i){switch(e){case _h.MaximumVaultTimeout:return t.isOwner;case _h.PasswordGenerator:case _h.FreeFamiliesSponsorshipPolicy:case _h.RestrictedItemTypes:case _h.RemoveUnlockWithPin:case _h.AutoConfirm:return!1;case _h.OrganizationDataOwnership:return t.isAdmin;case _h.SingleOrg:return!i.find(e=>e.organizationId===t.id&&e.type===_h.AutoConfirm&&e.enabled)&&t.canManagePolicies;default:return t.canManagePolicies}}mergeMasterPasswordPolicyOptions(e,t){var i,n;e||(e=new Kp),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 Hp(this,void 0,void 0,function*(){yield(0,ho._)(this.accountService.activeAccount$.pipe(Gp,(0,co.n)(t=>this.upsert(e,t))))})}},deps:[u,AF,Ok]},{provide:$b,useExisting:Ob},{provide:bW,useClass:class{constructor(e,t,i){this.policyService=e,this.apiService=t,this.accountService=i}getPolicy(e,t){return m9(this,void 0,void 0,function*(){const i=yield this.apiService.send("GET","/organizations/"+e+"/policies/"+t,null,!0,!0);return new dx(i)})}getPolicies(e){return m9(this,void 0,void 0,function*(){const t=yield this.apiService.send("GET","/organizations/"+e+"/policies",null,!0,!0);return new jS(t,dx)})}getPoliciesByToken(e,t,i,n){return m9(this,void 0,void 0,function*(){const r=yield this.apiService.send("GET","/organizations/"+e+"/policies/token?token="+encodeURIComponent(t)+"&email="+kd.encodeRFC3986URIComponent(i)+"&organizationUserId="+n,null,!1,!0);return qp.fromListResponse(new jS(r,dx))})}getMasterPasswordPolicyResponseForOrgUser(e){return m9(this,void 0,void 0,function*(){const t=yield this.apiService.send("GET","/organizations/"+e+"/policies/master-password",null,!0,!0);return new dx(t)})}getMasterPasswordPolicyOptsForOrgUser(e){return m9(this,void 0,void 0,function*(){try{const t=yield this.getMasterPasswordPolicyResponseForOrgUser(e),i=qp.fromResponse(t);return i?(0,ho._)(this.accountService.activeAccount$.pipe(Gp,(0,co.n)(e=>this.policyService.masterPasswordPolicyOptions$(e,[i])),(0,l.T)(e=>null!=e?e:null))):null}catch(e){if(e instanceof Mw&&e.statusCode===xa.NotFound)return null;throw e}})}putPolicy(e,t,i){return m9(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 m9(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 m9(this,void 0,void 0,function*(){const t=yield(0,ho._)(this.accountService.activeAccount$.pipe(Gp)),i=new dx(e),n=new Xp(i);yield this.policyService.upsert(n,t)})}},deps:[Ob,Mk,Ok]},{provide:Db,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 Zte(this,void 0,void 0,function*(){LS(e,"userId");const t=yield(0,ho._)(this.stateProvider.getUser(e,Xte).state$);return(yield(0,ho._)(this.stateProvider.getUser(e,tie).state$))&&!t})}saltForUser$(e){return LS(e,"userId"),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,Qte).state$}masterKeyHash$(e){if(null==e)throw new Error("User ID is required.");return this.stateProvider.getUser(e,eie).state$}forceSetPasswordReason$(e){if(null==e)throw new Error("User ID is required.");return this.stateProvider.getUser(e,iie).state$.pipe((0,l.T)(e=>null!=e?e:Gw.None))}getMasterKeyEncryptedUserKey(e){return Zte(this,void 0,void 0,function*(){if(null==e)throw new Error("User ID is required.");const t=yield(0,ho._)(this.stateProvider.getUser(e,tie).state$);return up.fromJSON(t)})}emailToSalt(e){return e.toLowerCase().trim()}setMasterKey(e,t){return Zte(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,Qte).update(t=>e)})}clearMasterKey(e){return Zte(this,void 0,void 0,function*(){if(null==e)throw new Error("User ID is required.");yield this.stateProvider.getUser(e,Qte).update(e=>null)})}setMasterKeyHash(e,t){return Zte(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,eie).update(t=>e,{shouldUpdate:t=>t!==e})})}clearMasterKeyHash(e){return Zte(this,void 0,void 0,function*(){if(null==e)throw new Error("User ID is required.");yield this.stateProvider.getUser(e,eie).update(e=>null,{shouldUpdate:e=>null!==e})})}setMasterKeyEncryptedUserKey(e,t){return Zte(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,tie).update(t=>e.toJSON())})}setForceSetPasswordReason(e,t){return Zte(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,ho._)(this.forceSetPasswordReason$(t)))===Gw.AdminForcePasswordReset&&e!==Gw.None||(yield this.stateProvider.getUser(t,iie).update(t=>e))})}decryptUserKeyWithMasterKey(e,t,i){return Zte(this,void 0,void 0,function*(){if(null!=i||(i=yield this.getMasterKeyEncryptedUserKey(t)),null!=e||(e=yield(0,ho._)(this.masterKey$(t))),null==e)throw new Error("No master key found.");yield qL.Ready;try{return new gf(A$.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 Zte(this,void 0,void 0,function*(){if(LS(e,"password"),LS(t,"kdf"),LS(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=kd.fromBufferToB64(yield this.cryptoFunctionService.pbkdf2(n.toEncoded(),e,"sha256",1));return{salt:i,kdf:t,masterPasswordAuthenticationHash:r}})}makeMasterPasswordUnlockData(e,t,i,n){return Zte(this,void 0,void 0,function*(){if(LS(e,"password"),LS(t,"kdf"),LS(i,"salt"),LS(n,"userKey"),""===e)throw new Error("Master password cannot be empty.");i=i.toLowerCase().trim(),yield qL.Ready;const r=A$.IEs.encrypt_user_key_with_master_password(n.toEncoded(),e,i,t.toSdkConfig());return new Jw(i,t,r)})}unwrapUserKeyFromMasterPasswordUnlockData(e,t){return Zte(this,void 0,void 0,function*(){LS(e,"password"),LS(t,"masterPasswordUnlockData"),yield qL.Ready;return new gf(A$.IEs.decrypt_user_key_with_master_password(t.masterKeyWrappedUserKey,e,t.salt,t.kdf.toSdkConfig()))})}setMasterPasswordUnlockData(e,t){return Zte(this,void 0,void 0,function*(){LS(e,"masterPasswordUnlockData"),LS(t,"userId"),yield this.stateProvider.getUser(t,nie).update(()=>e.toJSON())})}masterPasswordUnlockData$(e){return LS(e,"userId"),this.stateProvider.getUser(e,nie).state$}},deps:[u,_L,za,cI,Ok]},{provide:Ab,useExisting:Db},{provide:Vx,useClass:class{constructor(e,t,i){this.masterPasswordService=e,this.keyService=t,this.logService=i}unlockWithMasterPassword(e,t){return Jte(this,void 0,void 0,function*(){this.validateInput(e,t);const i=yield(0,ho._)(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 Jte(this,void 0,void 0,function*(){this.validateInput(e,t);try{const i=yield(0,ho._)(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,A$.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 Jte(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,ep.LocalAuthorization);yield this.masterPasswordService.setMasterKeyHash(r,i),yield this.masterPasswordService.setMasterKey(n,i)})}},deps:[Db,Cp,za]},{provide:iT,useClass:class{constructor(e,t,i,n,r,s,o,a,l,c){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.convertAccountRequired$=e.activeAccount$.pipe((0,To.p)(e=>null!=e),(0,co.n)(e=>(0,$o.z)([(0,Oo.of)(e.id),this.organizationService.organizations$(e.id).pipe((0,To.p)(e=>null!=e)),this.stateProvider.getUserState$(Xte,e.id).pipe((0,To.p)(e=>null!=e)),r.hasAccessToken$(e.id).pipe((0,To.p)(e=>e))])),(0,co.n)(e=>Kte(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 Kte(this,void 0,void 0,function*(){yield this.stateProvider.getUser(t,Xte).update(()=>e)})}getUsesKeyConnector(e){return Kte(this,void 0,void 0,function*(){var t;return null!==(t=yield(0,ho._)(this.stateProvider.getUserState$(Xte,e)))&&void 0!==t&&t})}migrateUser(e,t){return Kte(this,void 0,void 0,function*(){const i=yield(0,ho._)(this.masterPasswordService.masterKey$(t)),n=new zte(kd.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 Kte(this,void 0,void 0,function*(){try{const i=yield this.apiService.getMasterKeyFromKeyConnector(e),n=kd.fromB64ToArray(i.key),r=new gf(n);yield this.masterPasswordService.setMasterKey(r,t)}catch(e){this.handleKeyConnectorError(e)}})}getManagingOrganization(e){return Kte(this,void 0,void 0,function*(){const t=yield(0,ho._)(this.organizationService.organizations$(e));return this.findManagingOrganization(t)})}convertNewSsoUserToKeyConnector(e){return Kte(this,void 0,void 0,function*(){const t=yield(0,ho._)(this.stateProvider.getUserState$(qte,e));if(null==t)throw new Error("Key Connector conversion not found");const{kdfConfig:i,keyConnectorUrl:n,organizationId:r}=t,s=yield this.keyGenerationService.createKey(512),o=yield this.keyService.makeMasterKey(s.keyB64,yield this.tokenService.getEmail(),i),a=new zte(kd.fromBufferToB64(o.inner().encryptionKey));yield this.masterPasswordService.setMasterKey(o,e);const l=yield this.keyService.makeUserKey(o);yield this.keyService.setUserKey(l[0],e),yield this.masterPasswordService.setMasterKeyEncryptedUserKey(l[1],e);const[c,u]=yield this.keyService.makeKeyPair(l[0]);try{yield this.apiService.postUserKeyToKeyConnector(n,a)}catch(e){this.handleKeyConnectorError(e)}const d=new oS(c,u.encryptedString),h=new _te(l[1].encryptedString,i,r,d);yield this.apiService.postSetKeyConnectorKey(h),yield this.stateProvider.getUser(e,qte).update(()=>null)})}setNewSsoUserKeyConnectorConversionData(e,t){return Kte(this,void 0,void 0,function*(){yield this.stateProvider.getUser(t,qte).update(()=>e)})}requiresDomainConfirmation$(e){return this.stateProvider.getUserState$(qte,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!==zh.Admin&&e.type!==zh.Owner&&!e.isProviderUser)}},deps:[Ok,Db,Cp,Mk,b5,za,AF,_L,yT,u]},{provide:bC,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 Uee(this,void 0,void 0,function*(){var t;const i=null===(t=yield(0,ho._)(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===gp.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 Uee(this,void 0,void 0,function*(){this.validateSecretInput(e);const i=null!=t?new t:new tP;if(e.type===yC.OTP)i.otp=e.secret;else{const t=yield(0,ho._)(this.accountService.activeAccount$.pipe(Gp)),n=yield this.kdfConfigService.getKdfConfig(t),r=yield(0,ho._)(this.masterPasswordService.saltForUser$(t)),s=yield this.masterPasswordService.makeMasterPasswordAuthenticationData(e.secret,n,r);i.authenticateWith(s)}return i})}verifyUser(e){return Uee(this,void 0,void 0,function*(){if(null==e)throw new Error("Verification is required.");const[t,i]=yield(0,ho._)(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 yC.OTP:return this.verifyUserByOTP(e);case yC.MasterPassword:return yield this.verifyUserByMasterPassword(e,t,i),!0;case yC.PIN:return this.verifyUserByPIN(e,t);case yC.Biometrics:return this.verifyUserByBiometrics();default:return e}})}verifyUserByOTP(e){return Uee(this,void 0,void 0,function*(){const t=new Oee(e.secret);try{yield this.userVerificationApiService.postAccountVerifyOTP(t)}catch(e){throw new Error(this.i18nService.t("invalidVerificationCode"))}return!0})}verifyUserByMasterPassword(e,t,i){return Uee(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,ho._)(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 tP,i=yield this.keyService.hashMasterKey(e.secret,s,ep.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,ep.LocalAuthorization);return yield this.masterPasswordService.setMasterKeyHash(o,t),yield this.masterPasswordService.setMasterKey(s,t),{policyOptions:r,masterKey:s,email:i}})}verifyUserByPIN(e,t){return Uee(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 Uee(this,void 0,void 0,function*(){return this.biometricsService.authenticateWithBiometrics()})}requestOTP(){return Uee(this,void 0,void 0,function*(){yield this.userVerificationApiService.postAccountRequestOTP()})}hasMasterPassword(e){return Uee(this,void 0,void 0,function*(){var t;const i=null!=e?e:null===(t=yield(0,ho._)(this.accountService.activeAccount$))||void 0===t?void 0:t.id;return!!i&&(yield(0,ho._)(this.userDecryptionOptionsService.hasMasterPasswordById$(i)))})}hasMasterPasswordAndMasterKeyHash(e){return Uee(this,void 0,void 0,function*(){var t;return null!=e||(e=null===(t=yield(0,ho._)(this.accountService.activeAccount$))||void 0===t?void 0:t.id),(yield this.hasMasterPassword(e))&&null!=(yield(0,ho._)(this.masterPasswordService.masterKeyHash$(e)))})}validateSecretInput(e){if(null==(null==e?void 0:e.secret)||""===e.secret)switch(e.type){case yC.OTP:throw new Error(this.i18nService.t("verificationCodeRequired"));case yC.MasterPassword:throw new Error(this.i18nService.t("masterPasswordRequired"));case yC.PIN:throw new Error(this.i18nService.t("pinRequired"))}}},deps:[Cp,Ok,Db,Pl,P9,fw,EF,$f,kp]},{provide:DF,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)),N5())}familySponsorshipAvailable$(e){return this.organizations$(e).pipe((0,l.T)(e=>e.some(e=>e.familySponsorshipAvailable)))}hasOrganizations(e){return this.organizations$(e).pipe(N5())}upsert(e,t){return M5(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 M5(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,U5)}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 $O(e))})}},deps:[u]},{provide:class{},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(Gp,(0,co.n)(e=>this.keyService.orgKeys$(e)),(0,To.p)(e=>!!e),(0,l.T)(t=>t[e.id]))}buildConfirmRequest(e,t){const i=this.getEncryptedDefaultCollectionName$(e),n=this.orgKey$(e).pipe((0,co.n)(e=>this.encryptService.encapsulateKeyUnsigned(e,t)));return(0,$o.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,co.n)(i=>this.organizationUserApiService.postOrganizationUserConfirm(e.id,t,i)))}bulkConfirmUsers(e,t){return this.getEncryptedDefaultCollectionName$(e).pipe((0,co.n)(i=>{const n=new gR(t,i.encryptedString);return this.organizationUserApiService.postOrganizationUserBulkConfirm(e.id,n)}))}getEncryptedDefaultCollectionName$(e){return this.orgKey$(e).pipe((0,co.n)(e=>this.encryptService.encryptString(this.i18nService.t("myItems"),e)))}},deps:[Cp,Nj,oR,Ok,Pl]},{provide:AF,useExisting:DF},{provide:oR,useClass:class{constructor(e){this.apiService=e}getOrganizationUser(e,t,i){return mR(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 dR(r)})}getAllUsers(e,t){return mR(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 jS(n,uR)})}getAllMiniUserDetails(e){return mR(this,void 0,void 0,function*(){const t=yield this.apiService.send("GET",`/organizations/${e}/users/mini-details`,null,!0,!0);return new jS(t,vR)})}getOrganizationUserResetPasswordDetails(e,t){return mR(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 hR(i)})}getManyOrganizationUserAccountRecoveryDetails(e,t){return mR(this,void 0,void 0,function*(){const i=yield this.apiService.send("POST","/organizations/"+e+"/users/account-recovery-details",new aR(t),!0,!0);return new jS(i,hR)})}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 mR(this,void 0,void 0,function*(){const i=yield this.apiService.send("POST","/organizations/"+e+"/users/reinvite",new aR(t),!0,!0);return new jS(i,pR)})}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 mR(this,void 0,void 0,function*(){const i=yield this.apiService.send("POST","/organizations/"+e+"/users/public-keys",new aR(t),!0,!0);return new jS(i,fR)})}postOrganizationUserBulkConfirm(e,t){return mR(this,void 0,void 0,function*(){const i=yield this.apiService.send("POST","/organizations/"+e+"/users/confirm",t,!0,!0);return new jS(i,pR)})}putOrganizationUserBulkEnableSecretsManager(e,t){return mR(this,void 0,void 0,function*(){yield this.apiService.send("PUT","/organizations/"+e+"/users/enable-secrets-manager",new aR(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 mR(this,void 0,void 0,function*(){const i=yield this.apiService.send("DELETE","/organizations/"+e+"/users",new aR(t),!0,!0);return new jS(i,pR)})}revokeOrganizationUser(e,t){return this.apiService.send("PUT","/organizations/"+e+"/users/"+t+"/revoke",null,!0,!1)}revokeManyOrganizationUsers(e,t){return mR(this,void 0,void 0,function*(){const i=yield this.apiService.send("PUT","/organizations/"+e+"/users/revoke",new aR(t),!0,!0);return new jS(i,pR)})}restoreOrganizationUser(e,t){return this.apiService.send("PUT","/organizations/"+e+"/users/"+t+"/restore",null,!0,!1)}restoreManyOrganizationUsers(e,t){return mR(this,void 0,void 0,function*(){const i=yield this.apiService.send("PUT","/organizations/"+e+"/users/restore",new aR(t),!0,!0);return new jS(i,pR)})}deleteOrganizationUser(e,t){return this.apiService.send("DELETE","/organizations/"+e+"/users/"+t+"/delete-account",null,!0,!1)}deleteManyOrganizationUsers(e,t){return mR(this,void 0,void 0,function*(){const i=yield this.apiService.send("DELETE","/organizations/"+e+"/users/delete-account",new aR(t),!0,!0);return new jS(i,pR)})}},deps:[Mk]},{provide:jk,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 hee(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 hee(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=kd.fromB64ToArray(n.publicKey);if(null==(t=null!=t?t:yield(0,ho._)(this.accountService.activeAccount$.pipe(Gp))))throw new Error("User ID is required");i=null!=i?i:yield(0,ho._)(this.keyService.userKey$(t));const s=yield this.encryptService.encapsulateKeyUnsigned(i,r),o=new bR;o.resetPasswordKey=s.encryptedString,yield this.organizationUserApiService.putOrganizationUserResetPasswordEnrollment(e,t,o)})}},deps:[Bk,Ok,Cp,Nj,oR,Pl]},{provide:$5,useClass:class{constructor(e){this.stateProvider=e}providers$(e){return this.stateProvider.getUser(e,C9).state$.pipe(this.mapProviderRecordToArray())}mapProviderRecordToArray(){return(0,l.T)(e=>Object.values(null!=e?e:{}).map(e=>new k9(e)))}get$(e,t){return this.providers$(t).pipe(QE(e))}save(e,t){return I9(this,void 0,void 0,function*(){yield this.stateProvider.setUserState(C9,e,t)})}},deps:[u]},{provide:BT,useClass:class{constructor(e,t,i,n){this.i18nService=e,this.platformUtilsService=t,this.globalStateProvider=i,this.twoFactorApiService=n,this.providersState=this.globalStateProvider.get(NT),this.selectedState=this.globalStateProvider.get(VT),this.providers$=this.providersState.state$.pipe((0,l.T)(e=>kd.recordToMap(e))),this.selected$=this.selectedState.state$}init(){MT[jw.Email].name=this.i18nService.t("emailTitle"),MT[jw.Email].description=this.i18nService.t("emailDescV2"),MT[jw.Authenticator].name=this.i18nService.t("authenticatorAppTitle"),MT[jw.Authenticator].description=this.i18nService.t("authenticatorAppDescV2"),MT[jw.Duo].description=this.i18nService.t("duoDescV2"),MT[jw.OrganizationDuo].name="Duo ("+this.i18nService.t("organization")+")",MT[jw.OrganizationDuo].description=this.i18nService.t("duoOrganizationDesc"),MT[jw.WebAuthn].name=this.i18nService.t("webAuthnTitle"),MT[jw.WebAuthn].description=this.i18nService.t("webAuthnDesc"),MT[jw.Yubikey].name=this.i18nService.t("yubiKeyTitleV2"),MT[jw.Yubikey].description=this.i18nService.t("yubiKeyDesc")}getSupportedProviders(e){return HT(this,void 0,void 0,function*(){const t=yield(0,ho._)(this.providers$),i=[];return null==t||(t.has(jw.OrganizationDuo)&&this.platformUtilsService.supportsDuo()&&i.push(MT[jw.OrganizationDuo]),t.has(jw.Authenticator)&&i.push(MT[jw.Authenticator]),t.has(jw.Yubikey)&&i.push(MT[jw.Yubikey]),t.has(jw.Duo)&&this.platformUtilsService.supportsDuo()&&i.push(MT[jw.Duo]),t.has(jw.WebAuthn)&&this.platformUtilsService.supportsWebAuthn(e)&&i.push(MT[jw.WebAuthn]),t.has(jw.Email)&&i.push(MT[jw.Email])),i})}getDefaultProvider(e){return HT(this,void 0,void 0,function*(){const t=yield(0,ho._)(this.providers$),i=yield(0,ho._)(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=MT[i];if(null!=s&&s.priority>r){if(i===jw.WebAuthn&&!e)return;n=i,r=s.priority}}),n})}setSelectedProvider(e){return HT(this,void 0,void 0,function*(){yield this.selectedState.update(()=>e)})}clearSelectedProvider(){return HT(this,void 0,void 0,function*(){yield this.selectedState.update(()=>null)})}setProviders(e){return HT(this,void 0,void 0,function*(){yield this.providersState.update(()=>e.twoFactorProviders2)})}clearProviders(){return HT(this,void 0,void 0,function*(){yield this.providersState.update(()=>null)})}getProviders(){return(0,ho._)(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:[Pl,Eb,d,UT]},{provide:class{},useClass:class{getFormValidationErrors(e){let t=[];return Object.keys(e).forEach(i=>{const n=e[i];n instanceof fl.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:P9,useClass:class{constructor(e){this.apiService=e}postAccountVerifyOTP(e){return this.apiService.send("POST","/accounts/verify-otp",e,!0,!1)}postAccountRequestOTP(){return $ee(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:[Mk]},{provide:Bk,useClass:class{constructor(e,t){this.apiService=e,this.syncService=t}get(e){return l9(this,void 0,void 0,function*(){const t=yield this.apiService.send("GET","/organizations/"+e,null,!0,!0);return new H5(t)})}getBilling(e){return l9(this,void 0,void 0,function*(){const t=yield this.apiService.send("GET","/organizations/"+e+"/billing",null,!0,!0);return new L5(t)})}getBillingHistory(e){return l9(this,void 0,void 0,function*(){const t=yield this.apiService.send("GET","/organizations/"+e+"/billing/history",null,!0,!0);return new X5(t)})}getSubscription(e){return l9(this,void 0,void 0,function*(){const t=yield this.apiService.send("GET","/organizations/"+e+"/subscription",null,!0,!0);return new t9(t)})}getLicense(e,t){return l9(this,void 0,void 0,function*(){return this.apiService.send("GET","/organizations/"+e+"/license?installationId="+t,null,!0,!0)})}getAutoEnrollStatus(e){return l9(this,void 0,void 0,function*(){const t=yield this.apiService.send("GET","/organizations/"+e+"/auto-enroll-status",null,!0,!0);return new s9(t)})}create(e){return l9(this,void 0,void 0,function*(){const t=yield this.apiService.send("POST","/organizations",e,!0,!0);return yield this.syncService.fullSync(!0),new H5(t)})}createWithoutPayment(e){return l9(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 H5(t)})}createLicense(e){return l9(this,void 0,void 0,function*(){const t=yield this.apiService.send("POST","/organizations/licenses/self-hosted",e,!0,!0);return new H5(t)})}save(e,t){return l9(this,void 0,void 0,function*(){const i=yield this.apiService.send("PUT","/organizations/"+e,t,!0,!0),n=new H5(i);return yield this.syncService.fullSync(!0),n})}upgrade(e,t){return l9(this,void 0,void 0,function*(){const i=yield this.apiService.send("POST","/organizations/"+e+"/upgrade",t,!0,!0);return new n9(i)})}updatePasswordManagerSeats(e,t){return l9(this,void 0,void 0,function*(){const i=yield this.apiService.send("POST","/organizations/"+e+"/subscription",t,!0,!0);return new vx(i)})}updateSecretsManagerSubscription(e,t){return l9(this,void 0,void 0,function*(){const i=yield this.apiService.send("POST","/organizations/"+e+"/sm-subscription",t,!0,!0);return new vx(i)})}updateSeats(e,t){return l9(this,void 0,void 0,function*(){const i=yield this.apiService.send("POST","/organizations/"+e+"/seat",t,!0,!0);return new n9(i)})}updateStorage(e,t){return l9(this,void 0,void 0,function*(){const i=yield this.apiService.send("POST","/organizations/"+e+"/storage",t,!0,!0);return new n9(i)})}reinstate(e){return l9(this,void 0,void 0,function*(){return this.apiService.send("POST","/organizations/"+e+"/reinstate",null,!0,!1)})}leave(e){return l9(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 l9(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 l9(this,void 0,void 0,function*(){yield this.apiService.send("POST","/organizations/licenses/self-hosted/"+e,t,!0,!1)})}importDirectory(e,t){return l9(this,void 0,void 0,function*(){return this.apiService.send("POST","/organizations/"+e+"/import",t,!0,!1)})}getOrCreateApiKey(e,t){return l9(this,void 0,void 0,function*(){const i=yield this.apiService.send("POST","/organizations/"+e+"/api-key",t,!0,!0);return new V5(i)})}getApiKeyInformation(e){return l9(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 jS(n,r9)})}rotateApiKey(e,t){return l9(this,void 0,void 0,function*(){const i=yield this.apiService.send("POST","/organizations/"+e+"/rotate-api-key",t,!0,!0);return new V5(i)})}getKeys(e){return l9(this,void 0,void 0,function*(){const t=yield this.apiService.send("GET","/organizations/"+e+"/keys",null,!0,!0);return new a9(t)})}updateKeys(e,t){return l9(this,void 0,void 0,function*(){const i=yield this.apiService.send("POST","/organizations/"+e+"/keys",t,!0,!0);return new a9(i)})}getSso(e){return l9(this,void 0,void 0,function*(){const t=yield this.apiService.send("GET","/organizations/"+e+"/sso",null,!0,!0);return new j5(t)})}updateSso(e,t){return l9(this,void 0,void 0,function*(){const i=yield this.apiService.send("POST","/organizations/"+e+"/sso",t,!0,!0);return new j5(i)})}selfHostedSyncLicense(e){return l9(this,void 0,void 0,function*(){yield this.apiService.send("POST","/organizations/licenses/self-hosted/"+e+"/sync/",null,!0,!1)})}subscribeToSecretsManager(e,t){return l9(this,void 0,void 0,function*(){const i=yield this.apiService.send("POST","/organizations/"+e+"/subscribe-secrets-manager",t,!0,!0);return new vx(i)})}updateCollectionManagement(e,t){return l9(this,void 0,void 0,function*(){const i=yield this.apiService.send("PUT","/organizations/"+e+"/collection-management",t,!0,!0),n=new H5(i);return yield this.syncService.fullSync(!0),n})}},deps:[Mk,ux]},{provide:class{},useClass:class{constructor(e,t){this.apiService=e,this.platformUtilsService=t}getOrganizationSponsorship(e){return ote(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 jS(t,ste)})}postResendSponsorshipOffer(e,t){return ote(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 ote(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 ote(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:[Mk,Eb]},{provide:class{},useClass:class{constructor(e){this.apiService=e}getBillingInvoices(e,t,i){return nte(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 _5(e)))||[]})}getBillingTransactions(e,t){return nte(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 K5(e)))||[]})}setupBusinessUnit(e,t){return nte(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 nte(this,void 0,void 0,function*(){return yield this.apiService.send("POST","/organizations/"+e+"/billing/change-frequency",t,!0,!1)})}},deps:[Mk]},{provide:class{},useClass:class{constructor(e){this.apiService=e}getBillingInvoices(e,t){return zee(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 _5(e)))||[]})}getBillingTransactions(e){return zee(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 K5(e)))||[]})}},deps:[Mk]},{provide:rne,useClass:rne,deps:[bie,JS,za,u,dd]},{provide:uk,useExisting:rne},{provide:bie,useClass:class{constructor(e){this.apiService=e}get(e){return qie(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 zie(t)})}},deps:[Mk]},{provide:lI,useClass:class{constructor(e,t,i){this.environmentService=e,this.authRequestService=t,this.platformUtilsService=i}createHubConnection(e){return H9(this,void 0,void 0,function*(){if(this.url=(yield(0,ho._)(this.environmentService.environment$)).getNotificationsUrl(),!this.url.startsWith("https://")&&!this.platformUtilsService.isDev())throw new W9;this.anonHubConnection=(new O9.$).withUrl(this.url+"/anonymous-hub?Token="+e,{skipNegotiation:!0,transport:U9.w.WebSockets}).withHubProtocol(new M9.E).build(),yield this.anonHubConnection.start(),this.anonHubConnection.on("AuthRequestResponseRecieved",e=>{this.ProcessNotification(new N9(e))})})}stopHubConnection(){return H9(this,void 0,void 0,function*(){this.anonHubConnection&&(yield this.anonHubConnection.stop())})}ProcessNotification(e){if(e.type===Ea.AuthRequestResponse)this.authRequestService.sendAuthRequestPushNotification(e.payload)}},deps:[JS,mw,Eb]},{provide:Cd,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:[Pl,Eb]},{provide:hw,useClass:$w,deps:[Ok,dd,u]},{provide:D5,useClass:class{constructor(e,t){this.platformUtilsService=e,this.i18nService=t,this._orgDomains$=new fd.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:[Eb,Pl]},{provide:A5,useExisting:D5},{provide:eT,useClass:class{constructor(e,t){this.orgDomainService=e,this.apiService=t}getAllByOrgId(e){return p9(this,void 0,void 0,function*(){const t=(yield this.apiService.send("GET",`/organizations/${e}/domain`,null,!0,!0)).data.map(e=>new u9(e));return this.orgDomainService.replace(t),t})}getByOrgIdAndOrgDomainId(e,t){return p9(this,void 0,void 0,function*(){const i=yield this.apiService.send("GET",`/organizations/${e}/domain/${t}`,null,!0,!0),n=new u9(i);return this.orgDomainService.upsert([n]),n})}post(e,t){return p9(this,void 0,void 0,function*(){const i=yield this.apiService.send("POST",`/organizations/${e}/domain`,t,!0,!0),n=new u9(i);return this.orgDomainService.upsert([n]),n})}verify(e,t){return p9(this,void 0,void 0,function*(){const i=yield this.apiService.send("POST",`/organizations/${e}/domain/${t}/verify`,null,!0,!0),n=new u9(i);return this.orgDomainService.upsert([n]),n})}delete(e,t){return p9(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 p9(this,void 0,void 0,function*(){const t=yield this.apiService.send("POST","/organizations/domain/sso/details",new h9(e),!1,!0);return new c9(t)})}getVerifiedOrgDomainsByEmail(e){return p9(this,void 0,void 0,function*(){const t=yield this.apiService.send("POST","/organizations/domain/sso/verified",new h9(e),!1,!0);return new jS(t,d9)})}},deps:[D5,Mk]},{provide:lk,useClass:class{constructor(e){this.apiService=e}getKnownDevice(e,t){return cee(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",kd.fromUtf8ToUrlB64(e))})})}getDeviceByIdentifier(e){return cee(this,void 0,void 0,function*(){const t=yield this.apiService.send("GET",`/devices/identifier/${e}`,null,!0,!0);return new ree(t)})}getDevices(){return cee(this,void 0,void 0,function*(){const e=yield this.apiService.send("GET","/devices",null,!0,!0,null);return new jS(e,ree)})}updateTrustedDeviceKeys(e,t,i,n){return cee(this,void 0,void 0,function*(){const r=new lee(t,i,n),s=yield this.apiService.send("PUT",`/devices/${e}/keys`,r,!0,!0);return new ree(s)})}updateTrust(e,t){return cee(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 cee(this,void 0,void 0,function*(){const t=yield this.apiService.send("POST",`/devices/${e}/retrieve-keys`,null,!0,!0);return new aee(t)})}postDeviceTrustLoss(e){return cee(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 cee(this,void 0,void 0,function*(){yield this.apiService.send("POST",`/devices/${e}/deactivate`,null,!0,!1)})}untrustDevices(e){return cee(this,void 0,void 0,function*(){yield this.apiService.send("POST","/devices/untrust",new see(e),!0,!1)})}},deps:[Mk]},{provide:CH,useClass:class{constructor(e,t,i){this.appIdService=e,this.devicesApiService=t,this.i18nService=i}getDevices$(){return(0,Po.v)(()=>this.devicesApiService.getDevices()).pipe((0,l.T)(e=>e.data.map(e=>new iee(e))))}getDeviceByIdentifier$(e){return(0,Po.v)(()=>this.devicesApiService.getDeviceByIdentifier(e)).pipe((0,l.T)(e=>new iee(e)))}isDeviceKnownForUser$(e,t){return(0,Po.v)(()=>this.devicesApiService.getKnownDevice(e,t))}updateTrustedDeviceKeys$(e,t,i,n){return(0,Po.v)(()=>this.devicesApiService.updateTrustedDeviceKeys(e,t,i,n)).pipe((0,l.T)(e=>new iee(e)))}deactivateDevice$(e){return(0,Po.v)(()=>this.devicesApiService.deactivateDevice(e))}getCurrentDevice$(){return(0,Po.v)(()=>nee(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=Pa[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:[ok,lk,Pl]},{provide:dw,useClass:class{constructor(e,t){this.apiService=e,this.logService=t}getPendingAuthRequests(){return GS(this,void 0,void 0,function*(){const e=yield this.apiService.send("GET","/auth-requests/pending",null,!0,!0);return new jS(e,NS)})}getAuthRequest(e){return GS(this,void 0,void 0,function*(){try{const t=`/auth-requests/${e}`,i=yield this.apiService.send("GET",t,null,!0,!0);return new NS(i)}catch(e){throw this.logService.error(e),e}})}getAuthResponse(e,t){return GS(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 NS(n)}catch(e){throw this.logService.error(e),e}})}postAdminAuthRequest(e){return GS(this,void 0,void 0,function*(){try{const t=yield this.apiService.send("POST","/auth-requests/admin-request",e,!0,!0);return new NS(t)}catch(e){throw this.logService.error(e),e}})}postAuthRequest(e){return GS(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 NS(t)}catch(e){throw this.logService.error(e),e}})}},deps:[Mk,za]},{provide:Nk,useClass:class{constructor(e,t,i,n,r,s,o,a,c,u,d,h,p,f){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=f,this.platformSupportsSecureStorage=this.platformUtilsService.supportsSecureStorage(),this.deviceKeySecureStorageKey="_deviceKey",this.deviceTrustedSubject=new go.B,this.deviceTrusted$=this.deviceTrustedSubject.asObservable(),this.supportsDeviceTrust$=this.accountService.activeAccount$.pipe((0,co.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 Fte(this,void 0,void 0,function*(){if(!e)throw new Error("UserId is required. Cannot get should trust device.");return yield(0,ho._)(this.stateProvider.getUserState$(xte,e))})}setShouldTrustDevice(e,t){return Fte(this,void 0,void 0,function*(){if(!e)throw new Error("UserId is required. Cannot set should trust device.");yield this.stateProvider.setUserState(xte,t,e)})}trustDeviceIfRequired(e){return Fte(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 Fte(this,void 0,void 0,function*(){if(!e)throw new Error("UserId is required. Cannot trust device.");const t=yield(0,ho._)(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 Fte(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=>Fte(this,void 0,void 0,function*(){const n=yield this.encryptService.unwrapEncapsulationKey(new up(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 oee(o,s),l=new Pte;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 Fte(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,ho._)(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 tP).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 Tte;c.encryptedUserKey=a.encryptedString,c.encryptedPublicKey=l.encryptedString;const u=new Cte;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 Fte(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 gf.fromJSON(t)}return yield(0,ho._)(this.stateProvider.getUserState$(Rte,e))}catch(e){this.logService.error("Failed to get device key",e)}})}setDeviceKey(e,t){return Fte(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(Rte,null==t?void 0:t.toJSON(),e)}catch(e){this.logService.error("Failed to set device key",e)}})}makeDeviceKey(){return Fte(this,void 0,void 0,function*(){return yield this.keyGenerationService.createKey(512)})}decryptUserKeyWithDeviceKey(e,t,i,n){return Fte(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 up(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 Fte(this,void 0,void 0,function*(){const e=yield this.appIdService.getAppId();yield this.devicesApiService.postDeviceTrustLoss(e)})}getSecureStorageOptions(e){return{storageLocation:np.Disk,useSecureStorage:!0,userId:e}}},deps:[_L,cI,Cp,Nj,ok,lk,Pl,Eb,u,gT,fw,za,uk,Ok]},{provide:Ote,useClass:class{constructor(e){this.apiService=e}updateUserKdfParams(e){return $te(this,void 0,void 0,function*(){return this.apiService.send("POST","/accounts/kdf",e,!0,!1)})}},deps:[Mk]},{provide:jte,useClass:Bte,deps:[Ote,$k,Cp,Db]},{provide:mw,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 go.B,this.adminLoginApprovedSubject=new go.B,this.authRequestPushNotification$=this.authRequestPushNotificationSubject.asObservable(),this.adminLoginApproved$=this.adminLoginApprovedSubject.asObservable()}getAdminAuthRequest(e){return VS(this,void 0,void 0,function*(){if(null==e)throw new Error("User ID is required");const t=yield(0,ho._)(this.stateProvider.getUser(e,BS).state$);return US.fromJSON(t)})}setAdminAuthRequest(e,t){return VS(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(BS,e.toJSON(),t)})}clearAdminAuthRequest(e){return VS(this,void 0,void 0,function*(){if(null==e)throw new Error("User ID is required");yield this.stateProvider.setUserState(BS,null,e)})}getPendingAuthRequests$(){return(0,Po.v)(()=>this.authRequestApiService.getPendingAuthRequests()).pipe((0,l.T)(e=>e.data.map(e=>new NS(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 VS(this,void 0,void 0,function*(){const i=yield(0,ho._)(this.accountService.activeAccount$.pipe(Gp));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=kd.fromB64ToArray(t.publicKey),r=yield(0,ho._)(this.keyService.userKey$(i)),s=yield this.encryptService.encapsulateKeyUnsigned(r,n),o=new MS(s.encryptedString,void 0,yield this.appIdService.getAppId(),e);return yield this.apiService.putAuthRequest(t.id,o)})}setUserKeyAfterDecryptingSharedUserKey(e,t,i){return VS(this,void 0,void 0,function*(){const n=yield this.decryptPubKeyEncryptedUserKey(e.key,t);yield this.keyService.setUserKey(n,i)})}setKeysAfterDecryptingSharedMasterKeyAndHash(e,t,i){return VS(this,void 0,void 0,function*(){const{masterKey:n,masterKeyHash:r}=yield this.decryptPubKeyEncryptedMasterKeyAndHash(e.key,e.masterPasswordHash,t),s=yield this.masterPasswordService.decryptUserKeyWithMasterKey(n,i);yield this.masterPasswordService.setMasterKey(n,i),yield this.masterPasswordService.setMasterKeyHash(r,i),yield this.keyService.setUserKey(s,i)})}decryptPubKeyEncryptedUserKey(e,t){return VS(this,void 0,void 0,function*(){return yield this.encryptService.decapsulateKeyUnsigned(new up(e),t)})}decryptPubKeyEncryptedMasterKeyAndHash(e,t,i){return VS(this,void 0,void 0,function*(){const n=yield this.encryptService.rsaDecrypt(new up(e),i),r=yield this.encryptService.rsaDecrypt(new up(t),i);return{masterKey:new gf(n),masterKeyHash:kd.fromBufferToUtf8(r)}})}sendAuthRequestPushNotification(e){null!=e.id&&this.authRequestPushNotificationSubject.next(e.id)}getFingerprintPhrase(e,t){return VS(this,void 0,void 0,function*(){return(yield this.keyService.getFingerprint(e.toLowerCase(),t)).join("-")})}emitAdminLoginApproved(){this.adminLoginApprovedSubject.next()}},deps:[ok,Db,Cp,Nj,Mk,u,dw,Ok]},{provide:rie,useClass:class{constructor(e){this.stateProvider=e}userKeyEncryptedPin$(e){return LS(e,"userId"),this.stateProvider.getUserState$(aie,e).pipe((0,l.T)(e=>e?new up(e):null))}isPinSet(e){return lie(this,void 0,void 0,function*(){return LS(e,"userId"),"DISABLED"!==(yield this.getPinLockType(e))})}getPinLockType(e){return lie(this,void 0,void 0,function*(){LS(e,"userId");const t=null!=(yield this.getPinProtectedUserKeyEnvelope(e,"PERSISTENT")),i=null!=(yield(0,ho._)(this.stateProvider.getUserState$(aie,e)));return t?"PERSISTENT":i?"EPHEMERAL":"DISABLED"})}getPinProtectedUserKeyEnvelope(e,t){return lie(this,void 0,void 0,function*(){if(LS(e,"userId"),"EPHEMERAL"===t)return yield(0,ho._)(this.stateProvider.getUserState$(oie,e));if("PERSISTENT"===t)return yield(0,ho._)(this.stateProvider.getUserState$(sie,e));throw new Error(`Unsupported PinLockType: ${t}`)})}setPinState(e,t,i,n){return lie(this,void 0,void 0,function*(){if(LS(e,"userId"),LS(t,"pinProtectedUserKeyEnvelope"),LS(n,"pinLockType"),"EPHEMERAL"===n)yield this.stateProvider.setUserState(oie,t,e);else{if("PERSISTENT"!==n)throw new Error(`Cannot set up PIN with pin lock type ${n}`);yield this.stateProvider.setUserState(sie,t,e)}yield this.stateProvider.setUserState(aie,i,e)})}clearPinState(e){return lie(this,void 0,void 0,function*(){LS(e,"userId"),yield this.stateProvider.setUserState(aie,null,e),yield this.stateProvider.setUserState(oie,null,e),yield this.stateProvider.setUserState(sie,null,e)})}clearEphemeralPinState(e){return lie(this,void 0,void 0,function*(){LS(e,"userId"),yield this.stateProvider.setUserState(oie,null,e)})}},deps:[u]},{provide:EF,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 LS(e,"userId"),this.pinStateService.getPinLockType(e)}isPinSet(e){return die(this,void 0,void 0,function*(){return LS(e,"userId"),"DISABLED"!==(yield this.pinStateService.getPinLockType(e))})}logout(e){return die(this,void 0,void 0,function*(){LS(e,"userId"),yield this.pinStateService.clearPinState(e)})}userUnlocked(e){return die(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 die(this,void 0,void 0,function*(){LS(e,"userId");const t=yield uie(this.keyService.userKey$(e),"userKey"),i=yield uie(this.pinStateService.userKeyEncryptedPin$(e),"userKeyEncryptedPin");return this.encryptService.decryptString(i,t)})}setPin(e,t,i){return die(this,void 0,void 0,function*(){LS(e,"pin"),LS(t,"pinLockType"),LS(i,"userId");const{pinProtectedUserKeyEnvelope:n,userKeyEncryptedPin:r}=yield(0,ho._)(this.sdkService.userClient$(i).pipe((0,l.T)(t=>{const i={stack:[],error:void 0,hasError:!1};try{return hie(i,t.take(),!1).value.crypto().enroll_pin(e)}catch(e){i.error=e,i.hasError=!0}finally{pie(i)}})));yield this.pinStateService.setPinState(i,n,r,t)})}unsetPin(e){return die(this,void 0,void 0,function*(){LS(e,"userId"),yield this.pinStateService.clearPinState(e)})}isPinDecryptionAvailable(e){return die(this,void 0,void 0,function*(){LS(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 die(this,void 0,void 0,function*(){LS(e,"pin"),LS(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,ho._)(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 gf(i)}catch(e){return this.logService.error(`Failed to unseal pin: ${e}`),null}})}},deps:[Nj,za,Cp,$k,rie]},{provide:R9,useClass:class{constructor(e){this.cryptoFunctionService=e}getLoginWithPrfSalt(){return Bee(this,void 0,void 0,function*(){return yield this.cryptoFunctionService.hash("passwordless-login","sha256")})}createSymmetricKeyFromPrf(e){return Bee(this,void 0,void 0,function*(){return yield this.stretchKey(new Uint8Array(e))})}stretchKey(e){return Bee(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 gf(t)})}},deps:[cI]},{provide:F9,useClass:class{constructor(e,t){this.apiService=e,this.environmentService=t}getCredentialAssertionOptions(){return Vee(this,void 0,void 0,function*(){const e=yield(0,ho._)(this.environmentService.environment$),t=yield this.apiService.send("GET","/accounts/webauthn/assertion-options",null,!1,!0,e.getIdentityUrl());return new Nee(t)})}},deps:[Mk,JS]},{provide:JY,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 Lee(this,void 0,void 0,function*(){const e=yield this.webAuthnLoginApiService.getCredentialAssertionOptions();return new jee(e.options,e.token)})}assertCredential(e){return Lee(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 kw(n);if("prf"in a.extensions)throw new Error("PRF information is not allowed to be sent to the server.");return new Gee(e.token,a,o)}catch(e){return void(null===(n=this.logService)||void 0===n||n.error(e))}})}logIn(e){return Lee(this,void 0,void 0,function*(){const t=new Pw(e.token,e.deviceResponse,e.prfKey);return yield this.loginStrategyService.logIn(t)})}},deps:[F9,pw,R9,hT,za]},{provide:op,useClass:op,deps:[vT,fT]},{provide:Xe,useClass:class{constructor(e,t){this.storageServiceProvider=t,this.stateEventStateMap={lock:e.get(Wo),logout:e.get(Ho)}}registerEvents(e){return Yo(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,op]},{provide:I,useClass:class{constructor(e,t){this.storageServiceProvider=t,this.stateEventMap={lock:e.get(Wo),logout:e.get(Ho)}}handleEvent(e,t){return Jo(this,void 0,void 0,function*(){let i=yield(0,ho._)(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,op]},{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 Eo(e,i,this.logService);return this.globalStateCache[n]=s,s}buildCacheKey(e,t){return`${e}_${t.fullName}`}},deps:[op,za]},{provide:Go,useClass:class{constructor(e){this.accountService=e,this.activeUserId$=this.accountService.activeAccount$.pipe((0,l.T)(e=>null!=e?e.id:null))}},deps:[Ok]},{provide:p,useClass:class{constructor(e,t){this.activeAccountAccessor=e,this.singleUserStateProvider=t,this.activeUserId$=this.activeAccountAccessor.activeUserId$.pipe((0,lo.F)((e,t)=>null==e||null==t?e==t:e===t))}get(e){return new mo(e,this.activeUserId$,this.singleUserStateProvider)}},deps:[Go,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 Mo(e,t,n,this.stateEventRegistrarService,this.logService);return this.cache[r]=o,o}buildCacheKey(e,t,i){return`${e}_${i.fullName}_${t}`}},deps:[op,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 Co(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,To.p)(e=>null!=e),(0,No.s)(1),(0,co.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,No.s)(1),(0,co.n)(t=>null!=t?this.getUser(t,e).state$:(0,Oo.of)(n)))}setUserState(e,t,i){return Vo(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 ute(this,void 0,void 0,function*(){const i=new lte,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 ute(this,void 0,void 0,function*(){const i=new ate,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 ute(this,void 0,void 0,function*(){const i=new lte,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 ute(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 KE.Free:case KE.FamiliesAnnually:case KE.FamiliesAnnually2019:case KE.FamiliesAnnually2025:case KE.TeamsStarter2023:case KE.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 cte(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 ute(this,void 0,void 0,function*(){const n=new lte,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:[Mk,dZ,Cp,Nj,Pl,Bk,ux]},{provide:HD,useClass:JD,deps:[u,$b,Ok,vE]},{provide:Y6,useClass:class{constructor(e){this.stateProvider=e,this.enableBadgeCounterState=this.stateProvider.getActive(q6),this.enableBadgeCounter$=this.enableBadgeCounterState.state$.pipe((0,l.T)(e=>null==e||e))}setEnableBadgeCounter(e){return X6(this,void 0,void 0,function*(){yield this.enableBadgeCounterState.update(()=>e)})}},deps:[u]},{provide:wp,useClass:class{constructor(e){this.stateProvider=e,this.biometricUnlockEnabledState=this.stateProvider.getActive(dp),this.biometricUnlockEnabled$=this.biometricUnlockEnabledState.state$.pipe((0,l.T)(Boolean)),this.encryptedClientKeyHalfState=this.stateProvider.getActive(hp),this.encryptedClientKeyHalf$=this.encryptedClientKeyHalfState.state$.pipe((0,l.T)(Sp)),this.promptCancelledState=this.stateProvider.getGlobal(pp),this.promptCancelled$=(0,$o.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(fp),this.promptAutomatically$=this.promptAutomaticallyState.state$.pipe((0,l.T)(Boolean)),this.fingerprintValidatedState=this.stateProvider.getGlobal(vp),this.fingerprintValidated$=this.fingerprintValidatedState.state$.pipe((0,l.T)(Boolean)),this.lastProcessReloadState=this.stateProvider.getGlobal(mp),this.lastProcessReload$=this.lastProcessReloadState.state$}setBiometricUnlockEnabled(e){return bp(this,void 0,void 0,function*(){yield this.biometricUnlockEnabledState.update(()=>e)})}getBiometricUnlockEnabled(e){return bp(this,void 0,void 0,function*(){return yield(0,ho._)(this.stateProvider.getUser(e,dp).state$.pipe((0,l.T)(Boolean)))})}setEncryptedClientKeyHalf(e,t){return bp(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,hp).update(()=>n):yield this.encryptedClientKeyHalfState.update(()=>n)})}getEncryptedClientKeyHalf(e){return bp(this,void 0,void 0,function*(){return yield(0,ho._)(this.stateProvider.getUser(e,hp).state$.pipe((0,l.T)(Sp)))})}logout(e){return bp(this,void 0,void 0,function*(){yield this.stateProvider.getUser(e,hp).update(()=>null),yield this.resetUserPromptCancelled(e)})}resetUserPromptCancelled(e){return bp(this,void 0,void 0,function*(){yield this.stateProvider.getGlobal(pp).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 bp(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 bp(this,void 0,void 0,function*(){yield this.promptCancelledState.update(()=>null)})}setPromptAutomatically(e){return bp(this,void 0,void 0,function*(){yield this.promptAutomaticallyState.update(()=>e)})}setFingerprintValidated(e){return bp(this,void 0,void 0,function*(){yield this.fingerprintValidatedState.update(()=>e)})}updateLastProcessReload(){return bp(this,void 0,void 0,function*(){yield this.lastProcessReloadState.update(()=>new Date)})}getLastProcessReload(){return bp(this,void 0,void 0,function*(){return yield(0,ho._)(this.lastProcessReload$)})}},deps:[u]},{provide:Zq,useClass:class{constructor(e,t){this.stateProvider=e,this.restrictedItemTypesService=t,this.enablePasskeysState=this.stateProvider.getGlobal(Pse),this.enablePasskeys$=this.enablePasskeysState.state$.pipe((0,l.T)(e=>null==e||e)),this.showCardsCurrentTabState=this.stateProvider.getActive(Fse),this.showCardsCurrentTab$=(0,$o.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===CR.Card))),this.showIdentitiesCurrentTabState=this.stateProvider.getActive(Rse),this.showIdentitiesCurrentTab$=this.showIdentitiesCurrentTabState.state$.pipe((0,l.T)(e=>null==e||e)),this.clickItemsToAutofillVaultViewState=this.stateProvider.getActive(xse),this.clickItemsToAutofillVaultView$=this.clickItemsToAutofillVaultViewState.state$.pipe((0,l.T)(e=>null!=e&&e),(0,Pp.t)({bufferSize:1,refCount:!1}))}setShowCardsCurrentTab(e){return Ase(this,void 0,void 0,function*(){yield this.showCardsCurrentTabState.update(()=>e)})}setShowIdentitiesCurrentTab(e){return Ase(this,void 0,void 0,function*(){yield this.showIdentitiesCurrentTabState.update(()=>e)})}setClickItemsToAutofillVaultView(e){return Ase(this,void 0,void 0,function*(){yield this.clickItemsToAutofillVaultViewState.update(()=>e)})}setEnablePasskeys(e){return Ase(this,void 0,void 0,function*(){yield this.enablePasskeysState.update(()=>e)})}},deps:[u,vE]},{provide:Rne,useClass:Rne,deps:[ip,za,Pne,PT]},{provide:Pne,useClass:Pne,deps:[]},{provide:dZ,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 ite(this,void 0,void 0,function*(){const t=yield this.apiService.send("GET","/organizations/"+e+"/billing/metadata",null,!0,!0);return new Hee(t)})}getOrganizationBillingMetadataVNext(e){return ite(this,void 0,void 0,function*(){const t=yield this.apiService.send("GET","/organizations/"+e+"/billing/vnext/metadata",null,!0,!0);return new Hee(t)})}getOrganizationBillingMetadataVNextSelfHost(e){return ite(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 Hee(t)})}getPlans(){return ite(this,void 0,void 0,function*(){const e=yield this.apiService.send("GET","/plans",null,!0,!0);return new jS(e,q5)})}getPremiumPlan(){return ite(this,void 0,void 0,function*(){const e=yield this.apiService.send("GET","/plans/premium",null,!0,!0);return new Xee(e)})}getProviderClientInvoiceReport(e,t){return ite(this,void 0,void 0,function*(){return yield this.apiService.send("GET","/providers/"+e+"/billing/invoices/"+t,null,!0,!0)})}getProviderInvoices(e){return ite(this,void 0,void 0,function*(){const t=yield this.apiService.send("GET","/providers/"+e+"/billing/invoices",null,!0,!0);return new Yee(t)})}getProviderSubscription(e){return ite(this,void 0,void 0,function*(){const t=yield this.apiService.send("GET","/providers/"+e+"/billing/subscription",null,!0,!0);return new ete(t)})}restartSubscription(e,t){return ite(this,void 0,void 0,function*(){return yield this.apiService.send("POST","/organizations/"+e+"/billing/restart-subscription",t,!0,!1)})}},deps:[Mk]},{provide:class{},useClass:class{constructor(e,t,i){this.billingApiService=e,this.configService=t,this.platformUtilsService=i,this.metadataCache=new Map,this.refreshMetadataTrigger=new fd.t(void 0),this.refreshMetadataCache=()=>{this.metadataCache.clear(),this.refreshMetadataTrigger.next()}}getOrganizationMetadata$(e){return(0,$o.z)([this.refreshMetadataTrigger,this.configService.getFeatureFlag$(Nf.PM25379_UseNewOrganizationMetadataStructure)]).pipe((0,co.n)(([t,i])=>i?this.vNextGetOrganizationMetadataInternal$(e):this.getOrganizationMetadataInternal$(e)))}vNextGetOrganizationMetadataInternal$(e){const t=this.metadataCache.get(e);if(t)return t;const i=(0,md.H)(this.fetchMetadata(e,!0)).pipe((0,Pp.t)({bufferSize:1,refCount:!1}));return this.metadataCache.set(e,i),i}getOrganizationMetadataInternal$(e){return(0,md.H)(this.fetchMetadata(e,!1)).pipe((0,Pp.t)({bufferSize:1,refCount:!1}))}fetchMetadata(e,t){return rte(this,void 0,void 0,function*(){return t?this.platformUtilsService.isSelfHost()?yield this.billingApiService.getOrganizationBillingMetadataVNextSelfHost(e):yield this.billingApiService.getOrganizationBillingMetadataVNext(e):yield this.billingApiService.getOrganizationBillingMetadata(e)})}},deps:[dZ,uk,Eb]},{provide:ME,useClass:class{constructor(e,t,i){this.stateProvider=e,this.platformUtilsService=t,this.apiService=i}hasPremiumFromAnyOrganization$(e){return this.stateProvider.getUser(e,Kee).state$.pipe((0,l.T)(e=>!!(null==e?void 0:e.hasPremiumFromAnyOrganization)))}hasPremiumPersonally$(e){return this.stateProvider.getUser(e,Kee).state$.pipe((0,l.T)(e=>!!(null==e?void 0:e.hasPremiumPersonally)))}hasPremiumFromAnySource$(e){return this.stateProvider.getUser(e,Kee).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 _ee(this,void 0,void 0,function*(){yield this.stateProvider.getUser(i,Kee).update(i=>({hasPremiumPersonally:e,hasPremiumFromAnyOrganization:t}),{shouldUpdate:i=>null==i||i.hasPremiumFromAnyOrganization!==t||i.hasPremiumPersonally!==e})})}canViewSubscription$(e){return(0,$o.z)([this.hasPremiumPersonally$(e),this.hasPremiumFromAnyOrganization$(e)]).pipe((0,yo.H)(e=>_ee(this,[e],void 0,function*([e,t]){if(!0===e||!0==!t)return!0;if(!this.platformUtilsService.isSelfHost()){const e=yield this.apiService.getUserBillingHistory();return!(null==e?void 0:e.hasNoHistory)}return!1})))}},deps:[u,Eb,Mk]},{provide:_0,useClass:dte,deps:[dZ,uk,Pl,za,JS]},{provide:class{},useClass:class{constructor(e){this.stateProvider=e,this.autoConfirmFingerPrints=this.buildOrganizationManagementPreference(v9,!1)}buildOrganizationManagementPreference(e,t){return new E5(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=>f9(this,void 0,void 0,function*(){yield this.getKeyFromState(e).update(()=>t)})}},deps:[u]},{provide:Yne,useClass:Yne,deps:[Cp]},{provide:a.zcH,useClass:zse,deps:[]},{provide:TT,useFactory:()=>new go.B,deps:[]},{provide:ZS,useFactory:e=>new ZS(e.asObservable()),deps:[TT]},{provide:ek,useFactory:e=>new rk(e),deps:[TT]},{provide:Ua,useClass:Va,deps:[za]},{provide:class{},useClass:class{constructor(e){this.apiService=e}postProviderSetup(e,t){return S9(this,void 0,void 0,function*(){const i=yield this.apiService.send("POST","/providers/"+e+"/setup",t,!0,!0);return new w9(i)})}getProvider(e){return S9(this,void 0,void 0,function*(){const t=yield this.apiService.send("GET","/providers/"+e,null,!0,!0);return new w9(t)})}putProvider(e,t){return S9(this,void 0,void 0,function*(){const i=yield this.apiService.send("PUT","/providers/"+e,t,!0,!0);return new w9(i)})}providerRecoverDeleteToken(e,t){return this.apiService.send("POST","/providers/"+e+"/delete-recover-token",t,!1,!1)}deleteProvider(e){return S9(this,void 0,void 0,function*(){yield this.apiService.send("DELETE","/providers/"+e,null,!0,!1)})}getProviderOrganizations(e){return S9(this,void 0,void 0,function*(){const t=yield this.apiService.send("GET","/providers/"+e+"/organizations",null,!0,!0);return new jS(t,b9)})}getProviderAddableOrganizations(e){return S9(this,void 0,void 0,function*(){return(yield this.apiService.send("GET","/providers/"+e+"/clients/addable",null,!0,!0)).map(e=>new g9(e))})}addOrganizationToProvider(e,t){return this.apiService.send("POST","/providers/"+e+"/clients/existing",t,!0,!1)}updateProviderOrganization(e,t,i){return S9(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:[Mk]},{provide:$f,useClass:class{constructor(e){this.stateProvider=e}setKdfConfig(e,t){return Of(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(Uf,t,e)})}getKdfConfig(e){return Of(this,void 0,void 0,function*(){if(null==e)throw new Error("userId cannot be null");const t=yield(0,ho._)(this.stateProvider.getUser(e,Uf).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,Uf).state$}},deps:[u]},{provide:rW,useClass:class{getOrganizationInvite(){return dee(this,void 0,void 0,function*(){return null})}setOrganizationInvitation(e){return dee(this,void 0,void 0,function*(){})}clearOrganizationInvitation(){return dee(this,void 0,void 0,function*(){})}},deps:[]},{provide:yW,useClass:class{constructor(e,t,i,n,r,s,o,a,l,c,u){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}setInitialPassword(e,t,i){return Ose(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 f=null,v=null;if(t===gW.JIT_PROVISIONED_MP_ORG_USER){const e=yield(0,ho._)(this.keyService.userPrivateKey$(i)),t=yield(0,ho._)(this.keyService.userPublicKey$(i));if(null!=e&&null!=t){f=[kd.fromBufferToB64(t),yield this.encryptService.wrapDecapsulationKey(e,p[0])]}else f=yield this.keyService.makeKeyPair(p[0]);if(null==f)throw new Error("keyPair not found. Could not set password.");if(!f[1].encryptedString)throw new Error("encrypted private key not found. Could not set password.");v=new oS(f[0],f[1].encryptedString)}const m=new Ese(r,p[1].encryptedString,o,l,v,a);if(yield this.masterPasswordApiService.setPassword(m),yield this.masterPasswordService.setForceSetPasswordReason(Gw.None,i),yield this.updateAccountDecryptionProperties(n,a,p,i),yield this.setMasterPasswordUnlockData(d,h,a,p[0],i),null!=f&&t===gW.JIT_PROVISIONED_MP_ORG_USER){if(!f[1].encryptedString)throw new Error("encrypted private key not found. Could not set private key in state.");yield this.keyService.setPrivateKey(f[1].encryptedString,i),yield this.accountCryptographicStateService.setAccountCryptographicState({V1:{private_key:f[1].encryptedString}},i)}yield this.masterPasswordService.setMasterKeyHash(s,i),u&&(yield this.handleResetPasswordAutoEnroll(r,c,i))})}makeMasterKeyEncryptedUserKey(e,t){return Ose(this,void 0,void 0,function*(){let i=null;const n=yield(0,ho._)(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 Ose(this,void 0,void 0,function*(){const r=yield(0,ho._)(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)})}setMasterPasswordUnlockData(e,t,i,n,r){return Ose(this,void 0,void 0,function*(){const s=yield this.masterPasswordService.makeMasterPasswordUnlockData(e,i,t,n);yield this.masterPasswordService.setMasterPasswordUnlockData(s,r)})}handleResetPasswordAutoEnroll(e,t,i){return Ose(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=kd.fromB64ToArray(n.publicKey),s=yield(0,ho._)(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 bR;a.masterPasswordHash=e,a.resetPasswordKey=o.encryptedString,yield this.organizationUserApiService.putOrganizationUserResetPasswordEnrollment(t,i,a)})}setInitialPasswordTdeOffboarding(e,t){return Ose(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,ho._)(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 $se;a.key=o[1].encryptedString,a.newMasterPasswordHash=n,a.masterPasswordHint=r,yield this.masterPasswordApiService.putUpdateTdeOffboardingPassword(a),yield this.masterPasswordService.setForceSetPasswordReason(Gw.None,t)})}},deps:[Mk,Nj,Pl,$f,Cp,T9,Db,Bk,oR,vw,Lk]},{provide:kk,useClass:kk,deps:[uk]},{provide:sk,useClass:Dse,deps:[]},{provide:tC,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 mC(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 mC(this,void 0,void 0,function*(){const s=new oS(n[0],n[1].encryptedString),o=new fC(e,t.newServerMasterKeyHash,t.newPasswordHint,i,s,t.kdfConfig.kdfType,t.kdfConfig.iterations);return r&&(o.emailVerificationToken=r),o})}},deps:[Cp,KI]},{provide:cT,useClass:uT,deps:[]},{provide:cP,useClass:nF,deps:[]},{provide:UT,useClass:class{constructor(e){this.apiService=e}getTwoFactorProviders(){return WT(this,void 0,void 0,function*(){const e=yield this.apiService.send("GET","/two-factor",null,!0,!0);return new jS(e,zT)})}getTwoFactorOrganizationProviders(e){return WT(this,void 0,void 0,function*(){const t=yield this.apiService.send("GET",`/organizations/${e}/two-factor`,null,!0,!0);return new jS(t,zT)})}getTwoFactorAuthenticator(e){return WT(this,void 0,void 0,function*(){const t=yield this.apiService.send("POST","/two-factor/get-authenticator",e,!0,!0);return new jT(t)})}putTwoFactorAuthenticator(e){return WT(this,void 0,void 0,function*(){const t=yield this.apiService.send("PUT","/two-factor/authenticator",e,!0,!0);return new jT(t)})}deleteTwoFactorAuthenticator(e){return WT(this,void 0,void 0,function*(){const t=yield this.apiService.send("DELETE","/two-factor/authenticator",e,!0,!0);return new zT(t)})}getTwoFactorEmail(e){return WT(this,void 0,void 0,function*(){const t=yield this.apiService.send("POST","/two-factor/get-email",e,!0,!0);return new LT(t)})}postTwoFactorEmailSetup(e){return WT(this,void 0,void 0,function*(){return this.apiService.send("POST","/two-factor/send-email",e,!0,!1)})}postTwoFactorEmail(e){return WT(this,void 0,void 0,function*(){return this.apiService.send("POST","/two-factor/send-email-login",e,!1,!1)})}putTwoFactorEmail(e){return WT(this,void 0,void 0,function*(){const t=yield this.apiService.send("PUT","/two-factor/email",e,!0,!0);return new LT(t)})}getTwoFactorDuo(e){return WT(this,void 0,void 0,function*(){const t=yield this.apiService.send("POST","/two-factor/get-duo",e,!0,!0);return new GT(t)})}getTwoFactorOrganizationDuo(e,t){return WT(this,void 0,void 0,function*(){const i=yield this.apiService.send("POST",`/organizations/${e}/two-factor/get-duo`,t,!0,!0);return new GT(i)})}putTwoFactorDuo(e){return WT(this,void 0,void 0,function*(){const t=yield this.apiService.send("PUT","/two-factor/duo",e,!0,!0);return new GT(t)})}putTwoFactorOrganizationDuo(e,t){return WT(this,void 0,void 0,function*(){const i=yield this.apiService.send("PUT",`/organizations/${e}/two-factor/duo`,t,!0,!0);return new GT(i)})}getTwoFactorYubiKey(e){return WT(this,void 0,void 0,function*(){const t=yield this.apiService.send("POST","/two-factor/get-yubikey",e,!0,!0);return new YT(t)})}putTwoFactorYubiKey(e){return WT(this,void 0,void 0,function*(){const t=yield this.apiService.send("PUT","/two-factor/yubikey",e,!0,!0);return new YT(t)})}getTwoFactorWebAuthn(e){return WT(this,void 0,void 0,function*(){const t=yield this.apiService.send("POST","/two-factor/get-webauthn",e,!0,!0);return new KT(t)})}getTwoFactorWebAuthnChallenge(e){return WT(this,void 0,void 0,function*(){const t=yield this.apiService.send("POST","/two-factor/get-webauthn-challenge",e,!0,!0);return new qT(t)})}putTwoFactorWebAuthn(e){return WT(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:kd.fromBufferToB64(t.attestationObject),clientDataJson:kd.fromBufferToB64(t.clientDataJSON)}};const n=yield this.apiService.send("PUT","/two-factor/webauthn",i,!0,!0);return new KT(n)})}deleteTwoFactorWebAuthn(e){return WT(this,void 0,void 0,function*(){const t=yield this.apiService.send("DELETE","/two-factor/webauthn",e,!0,!0);return new KT(t)})}getTwoFactorRecover(e){return WT(this,void 0,void 0,function*(){const t=yield this.apiService.send("POST","/two-factor/get-recover",e,!0,!0);return new _T(t)})}putTwoFactorDisable(e){return WT(this,void 0,void 0,function*(){const t=yield this.apiService.send("PUT","/two-factor/disable",e,!0,!0);return new zT(t)})}putTwoFactorOrganizationDisable(e,t){return WT(this,void 0,void 0,function*(){const i=yield this.apiService.send("PUT",`/organizations/${e}/two-factor/disable`,t,!0,!0);return new zT(i)})}},deps:[Mk]},{provide:sI,useExisting:Kse,deps:[]},{provide:ck,useClass:Pk,deps:[cI,JS,rv,Eb,dk]},{provide:Fk,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 fd.t({}),this.sdkClientCache=new Map,this.client$=this.environmentService.environment$.pipe((0,yo.H)(e=>_ne(this,void 0,void 0,function*(){yield qL.Ready;const t=this.toSettings(e),i=yield this.sdkClientFactory.createSdkClient(new Xne(this.apiService),t);return yield this.loadFeatureFlags(i),i})),(0,Pp.t)({refCount:!0,bufferSize:1}))}registerClient$(e){return this.sdkClientOverrides.pipe((0,Qo.v)(t=>t[e]!==Kne,!1),(0,l.T)(t=>{if(t[e]===Kne)throw new Error("Encountered UnsetClient even though it should have been filtered out");return t[e]}),(0,lo.F)(),(0,co.n)(t=>t?(0,Oo.of)(t):this.internalClient$(e)),(0,Qo.v)(e=>void 0!==e,!1),(0,xne.v)(()=>new Rk(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,lo.F)()),n=(0,$o.z)([this.environmentService.getEnvironment$(e),i,qL.Ready]).pipe((0,co.n)(([t,i])=>new ea.c(n=>{let r;return(()=>_ne(this,void 0,void 0,function*(){if(null==t||null==i)return;const n=this.toSettings(t),r=yield this.sdkClientFactory.createSdkClient(new Xne(this.apiService,e),n);return yield Bne(e,r.platform().state(),this.stateProvider),yield this.loadFeatureFlags(r),r}))().then(e=>{r=void 0===e?void 0:new Ane(e),n.next(r)}).catch(e=>{n.error(e)}),()=>null==r?void 0:r.markForDisposal()})),(0,Fo.M)({finalize:()=>this.sdkClientCache.delete(e)}),(0,Pp.t)({refCount:!0,bufferSize:1}));return this.sdkClientCache.set(e,n),n}loadFeatureFlags(e){return _ne(this,void 0,void 0,function*(){var t;const i=yield(0,ho._)(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){var t;return{apiUrl:e.getApiUrl(),identityUrl:e.getIdentityUrl(),deviceType:Ak(this.platformUtilsService.getDevice()),userAgent:null!==(t=this.userAgent)&&void 0!==t?t:navigator.userAgent}}},deps:[Sie,JS,Eb,Ok,Mk,u,uk]},{provide:$k,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 fd.t({}),this.sdkClientCache=new Map,this.client$=this.environmentService.environment$.pipe((0,yo.H)(e=>Gne(this,void 0,void 0,function*(){yield qL.Ready;const t=this.toSettings(e),i=yield this.sdkClientFactory.createSdkClient(new zne(this.apiService),t);return yield this.loadFeatureFlags(i),i})),(0,Pp.t)({refCount:!0,bufferSize:1})),this.version$=this.client$.pipe((0,l.T)(e=>e.version()),(0,vd.W)(()=>"Unsupported"))}userClient$(e){return this.sdkClientOverrides.pipe((0,Qo.v)(t=>t[e]!==Lne,!1),(0,l.T)(t=>{if(t[e]===Lne)throw new Error("Encountered UnsetClient even though it should have been filtered out");return t[e]}),(0,lo.F)(),(0,co.n)(t=>t?(0,Oo.of)(t):this.internalClient$(e)),(0,Qo.v)(e=>void 0!==e,!1),(0,xne.v)(()=>new Rk(e)))}setClient(e,t){const i=this.sdkClientOverrides.value[e];this.sdkClientOverrides.next(Object.assign(Object.assign({},this.sdkClientOverrides.value),{[e]:t?new Ane(t):Lne})),i!==Lne&&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,lo.F)()),n=this.kdfConfigService.getKdfConfig$(e).pipe((0,lo.F)()),r=this.keyService.userEncryptedPrivateKey$(e).pipe((0,lo.F)()),s=this.keyService.userSigningKey$(e).pipe((0,lo.F)()),o=this.keyService.userKey$(e).pipe((0,lo.F)()),a=this.keyService.encryptedOrgKeys$(e).pipe((0,lo.F)(LQ)),c=this.securityStateService.accountSecurityState$(e).pipe((0,lo.F)(LQ)),u=this.keyService.userSignedPublicKey$(e).pipe((0,lo.F)(LQ)),d=(0,$o.z)([this.environmentService.getEnvironment$(e),i,n,r,o,s,a,c,u,qL.Ready]).pipe((0,co.n)(([t,i,n,r,s,o,a,l,c])=>new ea.c(u=>{let d;return(()=>Gne(this,void 0,void 0,function*(){if(null==t||null==n||null==r||null==s)return;const u=this.toSettings(t),d=yield this.sdkClientFactory.createSdkClient(new zne(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 Ane(e),u.next(d)}).catch(e=>{u.error(e)}),()=>null==d?void 0:d.markForDisposal()})),(0,Fo.M)({finalize:()=>this.sdkClientCache.delete(e)}),(0,Pp.t)({refCount:!0,bufferSize:1}));return this.sdkClientCache.set(e,d),d}initializeClient(e,t,i,n,r,s,o){return Gne(this,void 0,void 0,function*(){yield t.crypto().initialize_user_crypto({userId:Dk(e),email:i.email,method:{decryptedKey:{decrypted_user_key:r.keyB64}},kdfParams:n.kdfType===Tf.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])=>[Dk(e),t.toJSON()]))}),yield Bne(e,t.platform().state(),this.stateProvider),yield this.loadFeatureFlags(t)})}loadFeatureFlags(e){return Gne(this,void 0,void 0,function*(){var t;const i=yield(0,ho._)(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){var t;return{apiUrl:e.getApiUrl(),identityUrl:e.getIdentityUrl(),deviceType:Ak(this.platformUtilsService.getDevice()),userAgent:null!==(t=this.userAgent)&&void 0!==t?t:navigator.userAgent}}},deps:[Sie,JS,Eb,Ok,$f,Cp,Gk,Mk,u,uk]},{provide:t$,useClass:class{constructor(e,t,i){this.collectionService=e,this.organizationService=t,this.accountService=i,this.organization$=e=>this.accountService.activeAccount$.pipe(Gp,(0,co.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)}))}canCloneCipher$(e,t){return null==e.organizationId?(0,Oo.of)(!0):(0,$o.z)([this.organization$(e),this.accountService.activeAccount$.pipe(Gp)]).pipe((0,co.n)(([i,n])=>{var r;return t&&i&&(i.isAdmin||(null===(r=i.permissions)||void 0===r?void 0:r.editAnyCollection))?(0,Oo.of)(!0):this.collectionService.decryptedCollections$(n).pipe(e$(e.collectionIds.map(Ek)),(0,l.T)(e=>e.some(e=>e.manage)))}),(0,Pp.t)({bufferSize:1,refCount:!1}))}},deps:[BF,AF,Ok]},{provide:mie,useClass:class{constructor(e){this.cryptoFunctionService=e}hashPassword(e,t){return yie(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",gie)})}},deps:[cI]},{provide:TH,useClass:class{showLoginRequestedAlertIfWindowNotVisible(e){return EH(this,void 0,void 0,function*(){})}},deps:[]},{provide:Vk,useClass:class{constructor(e){this.messagingService=e}handleCreateUserSuccess(){return null}logOut(){return nI(this,void 0,void 0,function*(){this.messagingService.send("logout")})}},deps:[ek]},{provide:Lf,useClass:class{constructor(e){this.apiService=e}regenerateUserAsymmetricKeys(e,t){return zf(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:[Mk]},{provide:Mf,useClass:class{constructor(e,t,i,n,r,s,o){this.keyService=e,this.cipherService=t,this.userAsymmetricKeysRegenerationApiService=i,this.logService=n,this.sdkService=r,this.apiService=s,this.configService=o}regenerateIfNeeded(e){return Gf(this,void 0,void 0,function*(){try{if(yield this.configService.getFeatureFlag(Nf.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 Gf(this,void 0,void 0,function*(){const t=yield(0,ho._)(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===Hh.CoseEncrypt0)return this.logService.error("[UserAsymmetricKeyRegeneration] Cannot regenerate asymmetric keys for accounts on V2 encryption."),!1;const[i,n]=yield(0,ho._)((0,$o.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,ho._)(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 Gf(this,void 0,void 0,function*(){const t=yield(0,ho._)(this.keyService.userKey$(e));if(null==t)throw new Error("User key not found");if(t.inner().type!==Hh.AesCbc256_HmacSha256_B64)throw new Error("User key is not V1 encryption type");const i=yield(0,ho._)(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 up(i.userKeyEncryptedPrivateKey))}catch(e){return void("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."):this.logService.error("[UserAsymmetricKeyRegeneration] Regeneration error when submitting the request to the server: "+e))}yield this.keyService.setPrivateKey(i.userKeyEncryptedPrivateKey,e),this.logService.info("[UserAsymmetricKeyRegeneration] User's asymmetric keys successfully regenerated.")})}userKeyCanDecrypt(e,t){return Gf(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:[Cp,Fb,Lf,za,$k,Mk,uk]},{provide:gw,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 KS(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:[uk,$w,dk,ux,Mf,zx,za]},{provide:kE,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$=IE(e=>this.organizationService.organizations$(e).pipe((0,l.T)(e=>e.some(e=>e.canUseAccessIntelligence)),(0,lo.F)())),this.tasks$=IE(e=>this.tasksEnabled$(e).pipe((0,co.n)(t=>t?this.taskState(e).state$.pipe((0,co.n)(t=>PE(this,void 0,void 0,function*(){return null==t?(yield this.fetchTasksFromApi(e),null):t})),CE(),(0,l.T)(e=>e.map(e=>new bE(e)))):(0,Oo.of)([])))),this.pendingTasks$=IE(e=>this.tasks$(e).pipe((0,l.T)(e=>e.filter(e=>e.status===mE)))),this.completedTasks$=IE(e=>this.tasks$(e).pipe((0,l.T)(e=>e.filter(e=>e.status===gE)))),this.getOnlyTaskEnabledUsers=(0,co.n)(e=>0===e.length?(0,Oo.of)([]):(0,$o.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 PE(this,void 0,void 0,function*(){yield this.fetchTasksFromApi(e)})}clear(e){return PE(this,void 0,void 0,function*(){yield this.updateTaskState(e,[])})}markAsComplete(e,t){return PE(this,void 0,void 0,function*(){yield this.apiService.send("PATCH",`/tasks/${e}/complete`,null,!0,!1),yield this.refreshTasks(t)})}fetchTasksFromApi(e){return PE(this,void 0,void 0,function*(){const t=yield this.apiService.send("GET","/tasks",null,!0,!0),i=new jS(t,SE).data.map(e=>new wE(e));yield this.updateTaskState(e,i)})}taskState(e){return this.stateProvider.getUser(e,TE)}updateTaskState(e,t){return this.taskState(e).update(()=>t)}securityTaskNotifications$(e){return this.notificationService.notifications$.pipe((0,To.p)(([t,i])=>t.type===Ea.RefreshSecurityTasks&&e.includes(i)),(0,l.T)(([,e])=>e))}syncCompletedMessage$(e){return this.messageListener.allMessages$.pipe((0,To.p)(e=>"syncCompleted"===e.command&&!!e.successfully&&!!e.userId),(0,l.T)(e=>e.userId),(0,To.p)(t=>e.includes(t)))}listenForTaskNotifications(){return this.authService.authStatuses$.pipe(FE,this.getOnlyTaskEnabledUsers,(0,To.p)(e=>e.length>0),(0,co.n)(e=>(0,bo.h)(this.securityTaskNotifications$(e),this.syncCompletedMessage$(e))),(0,co.n)(e=>this.refreshTasks(e))).subscribe()}},deps:[u,Mk,AF,dd,Rie,ZS]},{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(A9)}tryGetSendAccessToken$(e){return(0,Po.v)(()=>(0,md.H)(this._tryGetSendAccessToken(e)))}_tryGetSendAccessToken(e){return D9(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,ho._)(this.sdkService.client$);try{const t=yield n.auth().send_access().request_send_access_token(i),r=x9.fromSendAccessTokenResponse(t);return yield this.setSendAccessTokenInStorage(e,r),r}catch(e){return this.normalizeSendAccessTokenError(e)}})}getSendAccessToken$(e,t){return(0,Po.v)(()=>(0,md.H)(this._getSendAccessToken(e,t)))}_getSendAccessToken(e,t){return D9(this,void 0,void 0,function*(){this.validateCredentialsRequest(e,t);const i={sendId:e,sendAccessCredentials:this.convertDomainCredentialsToSdkCredentials(t)},n=yield(0,ho._)(this.sdkService.client$);try{const t=yield n.auth().send_access().request_send_access_token(i),r=x9.fromSendAccessTokenResponse(t);return yield this.setSendAccessTokenInStorage(e,r),r}catch(e){return this.normalizeSendAccessTokenError(e)}})}invalidateSendAccessToken(e){return D9(this,void 0,void 0,function*(){yield this.clearSendAccessTokenFromStorage(e)})}hashSendPassword(e,t){return D9(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=kd.fromUrlB64ToArray(t),n=yield this.sendPasswordService.hashPassword(e,i);return kd.fromBufferToB64(n)})}getSendAccessTokenFromStorage(e){return D9(this,void 0,void 0,function*(){if(null!=this.sendAccessTokenDictGlobalState){const t=yield(0,ho._)(this.sendAccessTokenDictGlobalState.state$);return null==t?void 0:t[e]}})}setSendAccessTokenInStorage(e,t){return D9(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 D9(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 E9(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,$k,mie]},{provide:c2,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$=IE(e=>this.notificationState(e).state$.pipe((0,co.n)(t=>f2(this,void 0,void 0,function*(){return null==t?(yield this.fetchNotificationsFromApi(e),null):t})),CE(),(0,l.T)(e=>e.map(e=>new u2(e))))),this.unreadNotifications$=IE(e=>this.notifications$(e).pipe((0,l.T)(e=>e.filter(e=>null==e.readDate))))}markAsRead(e,t){return f2(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 f2(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 f2(this,void 0,void 0,function*(){yield this.replaceNotificationState(e,[])})}refreshNotifications(e){return f2(this,void 0,void 0,function*(){yield this.fetchNotificationsFromApi(e)})}filteredEndUserNotifications$(e){return 0==e.length?$p.w:this.notificationService.notifications$.pipe((0,To.p)(([{type:t},i])=>(t===Ea.Notification||t===Ea.NotificationStatus)&&e.includes(i)))}listenForEndUserNotifications(){return this.authService.authStatuses$.pipe(v2,(0,co.n)(e=>this.filteredEndUserNotifications$(e)),(0,yo.H)(([e,t])=>this.upsertNotification(t,new d2(e.payload)))).subscribe()}fetchNotificationsFromApi(e){return f2(this,void 0,void 0,function*(){const t=yield this.apiService.send("GET","/notifications?pageSize=50",null,!0,!0),i=new jS(t,h2);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 d2(e));yield this.replaceNotificationState(e,n)})}replaceNotificationState(e,t){return this.notificationState(e).update(()=>t)}upsertNotification(e,t){return f2(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,p2)}},deps:[u,Mk,Rie,dd,za]},{provide:w5,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,Fo.M)(()=>{this.toastService.showToast({variant:"success",title:"",message:this.i18nService.t("loginApproved")})})),this.deviceTrusted$=this.deviceTrustService.deviceTrusted$.pipe((0,Fo.M)(()=>{this.toastService.showToast({variant:"success",title:"",message:this.i18nService.t("deviceTrusted")})})),this.setupListeners$=(0,bo.h)(this.adminLoginApproved$,this.deviceTrusted$)}},deps:[mw,Nk,Pl,xb]},{provide:T9,useClass:class{constructor(e,t){this.apiService=e,this.logService=t}setPassword(e){return uee(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 uee(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 uee(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 uee(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:[Mk,za]},{provide:yw,useClass:WS,deps:[ek]},{provide:S5,useClass:S5,deps:[pT,Pl]},{provide:qre,useClass:class{constructor(e,t){this.sdkService=e,this.logService=t}encrypt(e,t){return fse(this,void 0,void 0,function*(){return(0,ho._)(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=vse(i,t.take(),!1),r=this.toSdkCipherView(e,n.value),s=n.value.vault().ciphers().encrypt(r);return{cipher:GM.fromSdkCipher(s.cipher),encryptedFor:s.encryptedFor}}catch(e){i.error=e,i.hasError=!0}finally{mse(i)}}),(0,vd.W)(e=>(this.logService.error(`Failed to encrypt cipher: ${e}`),$p.w))))})}moveToOrganization(e,t,i){return fse(this,void 0,void 0,function*(){return(0,ho._)(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=vse(n,i.take(),!1),s=this.toSdkCipherView(e,r.value),o=r.value.vault().ciphers().move_to_organization(s,Dk(t)),a=r.value.vault().ciphers().encrypt(o);return{cipher:GM.fromSdkCipher(a.cipher),encryptedFor:a.encryptedFor}}catch(e){n.error=e,n.hasError=!0}finally{mse(n)}}),(0,vd.W)(e=>(this.logService.error(`Failed to move cipher to organization: ${e}`),$p.w))))})}encryptCipherForRotation(e,t,i){return fse(this,void 0,void 0,function*(){return(0,ho._)(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=vse(n,t.take(),!1),s=this.toSdkCipherView(e,r.value),o=r.value.vault().ciphers().encrypt_cipher_for_rotation(s,i.toBase64());return{cipher:GM.fromSdkCipher(o.cipher),encryptedFor:o.encryptedFor}}catch(e){n.error=e,n.hasError=!0}finally{mse(n)}}),(0,vd.W)(e=>(this.logService.error(`Failed to rotate cipher data: ${e}`),$p.w))))})}decrypt(e,t){return fse(this,void 0,void 0,function*(){return(0,ho._)(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=vse(r,t.take(),!1),o=s.value.vault().ciphers().decrypt(e.toSdkCipher()),a=L$.fromSdkCipherView(o);if(a.type===CR.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=U$.fromSdkFido2CredentialView(e);return i.keyValue=t,i}).filter(e=>void 0!==e)}return a}catch(e){r.error=e,r.hasError=!0}finally{mse(r)}}),(0,vd.W)(e=>(this.logService.error(`Failed to decrypt cipher ${e}`),$p.w))))})}decryptManyLegacy(e,t){return(0,ho._)(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=vse(i,t.take(),!1),r=[],s=[];return e.forEach(e=>{var t,i;try{const s=n.value.vault().ciphers().decrypt(e.toSdkCipher()),o=L$.fromSdkCipherView(s);if(o.type===CR.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=U$.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 L$(e);i.name="[error: cannot decrypt]",i.decryptionFailure=!0,s.push(i)}}),[r,s]}catch(e){i.error=e,i.hasError=!0}finally{mse(i)}}),(0,vd.W)(e=>(this.logService.error(`Failed to decrypt ciphers: ${e}`),$p.w))))}decryptManyWithFailures(e,t){return fse(this,void 0,void 0,function*(){return(0,ho._)(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=vse(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=>GM.fromSdkCipher(e)).filter(e=>void 0!==e)]}catch(e){i.error=e,i.hasError=!0}finally{mse(i)}})))})}decryptAttachmentContent(e,t,i,n){return fse(this,void 0,void 0,function*(){return(0,ho._)(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 vse(r,n.take(),!1).value.vault().attachments().decrypt_buffer(e.toSdkCipher(),t.toSdkAttachmentView(),i)}catch(e){r.error=e,r.hasError=!0}finally{mse(r)}}),(0,vd.W)(e=>(this.logService.error(`Failed to decrypt cipher buffer: ${e}`),$p.w))))})}toSdkCipherView(e,t){var i,n;let r=e.toSdkCipherView();if(e.type===CR.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:[$k,za]},{provide:nW,useClass:fW,deps:[Cp,T9,Db]},{provide:Lse,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,To.p)(e=>e instanceof ud.wF),(0,l.T)(e=>e.url)),this.accountService.accounts$.pipe((0,co.n)(e=>{const t=Object.keys(e);return 0===t.length?(0,Oo.of)([]):(0,$o.z)(t.map(e=>(0,$o.z)([this.authService.authStatusFor$(e),this.syncService.lastSync$(e).pipe((0,To.p)(e=>null!=e)),this.url$]).pipe((0,To.p)(([e,t,i])=>e===cd.Unlocked&&Gse.includes(i)),(0,yo.H)(()=>this.runMigrationsIfNeeded(e)))))})).subscribe()}runMigrationsIfNeeded(e){return Bse(this,void 0,void 0,function*(){if((yield(0,ho._)(this.authService.authStatusFor$(e)))===cd.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 Bse(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 Bse(this,void 0,void 0,function*(){const t=yield(0,ho._)(this.stateProvider.getUser(e,jse).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=Vse.open(this.dialogService),i=yield(0,ho._)(t.closed);kd.isNullOrWhitespace(i)?yield this.stateProvider.setUserState(jse,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:[ux,Ok,u,zx,dd,za,Jd,xb,Pl,ud.Ix]},{provide:yl.hnV,useFactory:e=>()=>{},deps:[Lse],multi:!0},{provide:_S,useClass:class{constructor(e,t,i,n,r,s,o,a,l,c,u,d,h,p,f){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=f}lockAll(){return zS(this,void 0,void 0,function*(){const e=yield(0,ho._)((0,$o.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 zS(this,void 0,void 0,function*(){if(LS(e,"userId","LockService"),this.logService.info(`[LockService] Locking user ${e}`),(yield(0,ho._)(this.authService.authStatusFor$(e)))!==cd.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 zS(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 zS(this,void 0,void 0,function*(){yield(0,ho._)(this.authService.authStatusFor$(e).pipe((0,To.p)(e=>e===cd.Locked),(0,po.w)({first:5e3,with:()=>{throw new Error("The lock process did not complete in a reasonable amount of time.")}})))})}runPlatformOnLockActions(){return zS(this,void 0,void 0,function*(){})}},deps:[Ok,kp,Ep,yw,ek,RJ,qU,Db,I,Fb,dd,class{},class{},za,Cp]},{provide:BV,useClass:pse,deps:[Fb,Mk,ME,uk]},{provide:class{},useClass:class{constructor(e,t){this.keyService=e,this.encryptService=t}createKeySet(e,t){return Hte(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=kd.fromB64ToArray(i),s=yield this.encryptService.encapsulateKeyUnsigned(t,r),o=yield this.encryptService.wrapEncapsulationKey(r,t);return new oee(s,o,n)})}rotateKeySet(e,t,i){return Hte(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 oee(s,r,e.encryptedPrivateKey)})}},deps:[Cp,Nj]},{provide:rF,useClass:cF,deps:[]},{provide:Pie,useClass:Pie,deps:[u]},{provide:wA,useClass:class{constructor(e){this.apiService=e}getConfirmationDetails(e){return Lte(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 Gte(t)})}},deps:[Mk]},{provide:iC,useClass:Mse,deps:[]}];class ioe{}ioe.ɵfac=function(e){return new(e||ioe)},ioe.ɵmod=yl.$C({type:ioe}),ioe.ɵinj=a.G2t({providers:toe});const noe=Object.freeze({AuthRequest:"authRequest"});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())})};var soe=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 ooe=new k(te,"enablePhishingDetection",{deserializer:e=>null==e||e,clearOn:[]});class aoe{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 loe=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 coe{createSdkClient(...e){return loe(this,void 0,void 0,function*(){return Promise.resolve(new A$.cPU(...e))})}}class uoe{createSdkClient(...e){return Promise.reject(new Error("SDK not available"))}}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){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 doe(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 doe(this,void 0,void 0,function*(){return(yield this.primaryStorageService.has(e,t))||(yield this.secondaryStorageService.has(e,t))})}save(e,t,i){return doe(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 doe(this,void 0,void 0,function*(){yield Promise.allSettled([this.primaryStorageService.remove(e,t),this.secondaryStorageService.remove(e,t)])})}}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 foe{constructor(e){this.storage=e,this.updatesSubject=new go.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 poe(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 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())})};const moe=new tk("lockAllFinished"),goe=new tk("lockAll"),yoe=new tk("lockUserFinished"),boe=new tk("lockUser");class woe extends Dse{constructor(){super(...arguments),this.anonLayoutWrapperDataSubject=new go.B}setAnonLayoutWrapperData(e){this.anonLayoutWrapperDataSubject.next(e)}anonLayoutWrapperData$(){return this.anonLayoutWrapperDataSubject.asObservable()}}var Soe=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 koe extends Pk{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 Soe(this,void 0,void 0,function*(){const r=(yield(0,ho._)(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()}}koe.ɵfac=function(e){return new(e||koe)(a.KVO(cI),a.KVO(JS),a.KVO(rv),a.KVO(Eb),a.KVO(dk),a.KVO(woe),a.KVO(XS))},koe.ɵprov=a.jDH({token:koe,factory:koe.ɵfac});var Ioe=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 Coe extends lT{constructor(e,t,i,n,r){super(),this.syncService=e,this.authService=t,this.environmentService=i,this.i18nService=n,this.logService=r}closeWindow(){return Ioe(this,void 0,void 0,function*(){window.close()})}}Coe.ɵfac=function(e){return new(e||Coe)(a.KVO(ux),a.KVO(dd),a.KVO(JS),a.KVO(Pl),a.KVO(za))},Coe.ɵprov=a.jDH({token:Coe,factory:Coe.ɵfac});var Toe=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 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())})};const Foe="auth_ssoAuthResult",Roe="auth_twoFactorAuthWebAuthn",xoe="auth_twoFactorAuthEmail",Aoe="auth_twoFactorAuthDuo";new Set([chrome.runtime.getURL("popup/index.html#/lock"),chrome.runtime.getURL("popup/index.html#/login")]);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())})};var Eoe=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 $oe=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 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())})};var Uoe=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 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())})};var Noe=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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{constructor(e,t){this.logService=e,this.platformUtilsService=t}openPopup(){return Noe(this,void 0,void 0,function*(){const e=this.platformUtilsService.getDevice();try{switch(e){case Ta.FirefoxExtension:case Ta.ChromeExtension:{const t=tl.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: ${Ta[e]} and manifest version: ${tl.manifestVersion}`);break}case Ta.SafariExtension:return void(yield La.sendMessageToApp("showPopover",null,!0));default:this.logService.warning(`Tried to open the popup from an unsupported device type: ${Ta[e]}`)}}catch(t){this.logService.error(`Failed to open the popup on ${Ta[e]} with manifest ${tl.manifestVersion} and error: ${t}`)}})}}const Boe={"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 joe{constructor(e){this.logService=e}send(e,t={}){const i=nk(e);chrome.runtime.sendMessage(Object.assign(t,{command:i}),()=>{if(chrome.runtime.lastError){const e=Boe[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 Goe{}var Loe=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 zoe{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 _oe=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 Koe{download(e){const t=new zoe(e);if(tl.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 _oe(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=kd.fromBufferToB64(t)}else i=kd.fromBufferToB64(e.blobData);yield La.sendMessageToApp("downloadFile",JSON.stringify({blobData:i,blobOptions:e.blobOptions,fileName:e.fileName}),!0)})}}Koe.ɵfac=function(e){return new(e||Koe)},Koe.ɵprov=a.jDH({token:Koe,factory:Koe.ɵfac});class Xoe{}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())})};class Yoe extends fne{constructor(e,t,i,n=[]){super(t,i,n),this.logService=e}hasManagedEnvironment(){return qoe(this,void 0,void 0,function*(){try{return null!=(yield this.getManagedEnvironment())}catch(e){return this.logService.error(e),!1}})}settingsHaveChanged(){return qoe(this,void 0,void 0,function*(){if(!(yield this.hasManagedEnvironment()))return!1;const e=yield this.getManagedEnvironment(),t=(yield(0,ho._)(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 qoe(this,void 0,void 0,function*(){const e=yield this.getManagedEnvironment();yield this.setEnvironment(qS.SelfHosted,{base:e.base,webVault:e.webVault,api:e.api,identity:e.identity,icons:e.icons,notifications:e.notifications,events:e.events})})}}var Woe=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 Hoe="__json__";class Joe{constructor(e){this.chromeStorageApi=e,this.updates$=dF(this.chromeStorageApi.onChanged).pipe((0,To.p)(([e])=>1===Object.keys(e).length),(0,cx.Z)(([e])=>Object.entries(e).map(([e,t])=>({key:e,updateType:"newValue"in t?"save":"remove"}))))}get valuesRequireDeserialization(){return!0}get(e){return Woe(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 Woe(this,void 0,void 0,function*(){return null!=(yield this.get(e))})}save(e,t){return Woe(this,void 0,void 0,function*(){if(null==(t=(e=>null==e?null:(e instanceof Set&&(e=Array.from(e)),{[Hoe]:!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 Woe(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[Hoe]&&"string"==typeof t.value}}var Zoe=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 Qoe extends Joe{constructor(){super(chrome.storage.session)}}var eae=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 tae=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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(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 tae(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 tae(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 nae=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 rae=new m(ue,"locale",{deserializer:e=>e});class sae extends iae{constructor(e,t,i,n){super(e,t,i),this.systemLanguage=e,this.localesDirectory=t,this.getLocalesJson=i,this.translationLocaleState=n.get(rae),this.userSetLocale$=this.translationLocaleState.state$,this.locale$=this.userSetLocale$.pipe((0,l.T)(e=>null!=e?e:this.translationLocale))}setLocale(e){return nae(this,void 0,void 0,function*(){yield this.translationLocaleState.update(()=>e)})}init(){const e=Object.create(null,{init:{get:()=>super.init}});return nae(this,void 0,void 0,function*(){const t=yield(0,ho._)(this.translationLocaleState.state$);yield e.init.call(this,t)})}}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())})};class aae extends sae{constructor(e,t){super(e,null,e=>oae(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 lae extends Ha{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 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())})};const uae=(()=>{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 dae;tl.isManifestVersion(3)&&(uae?(console.info("WebAssembly is supported in this environment"),dae=i.e(635).then(i.bind(i,20635))):dae=new Promise((e,t)=>{t(new Error("WebAssembly is not supported in this environment"))}));const hae="setTimeout",pae="setInterval";var fae=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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=new m(he,"activeAlarms",{deserializer:e=>null!=e?e:[]});class mae extends Va{constructor(e,t){super(e),this.stateProvider=t,this.handleOnAlarm=e=>fae(this,void 0,void 0,function*(){const{name:t,periodInMinutes:i}=e;yield this.triggerTask(t,i)}),this.activeAlarmsState=this.stateProvider.getGlobal(vae),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)),nfae(this,void 0,void 0,function*(){yield this.clearScheduledAlarm(e),yield this.triggerTask(e)}),t)),new Ma.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 nthis.logService.error("Failed to schedule alarm",e)),new Ma.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;tthis.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(()=>fae(this,void 0,void 0,function*(){a+=t;a/1e3/60>=i?globalThis.clearInterval(l):yield this.triggerTask(e,n)}),t);return new Ma.yU(()=>{l&&globalThis.clearInterval(l),o.forEach(e=>this.clearScheduledAlarm(e).catch(e=>this.logService.error("Failed to clear alarm",e)))})}clearAllScheduledTasks(){return fae(this,void 0,void 0,function*(){yield this.clearAllAlarms(),yield this.updateActiveAlarms([])})}verifyAlarmsState(){return fae(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.whenthis.logService.error("Failed to schedule alarm",e))}})}scheduleAlarm(e,t){return fae(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 fae(this,void 0,void 0,function*(){return yield(0,ho._)(this.activeAlarms$)})}setActiveAlarm(e,t){return fae(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 fae(this,void 0,void 0,function*(){const t=(yield this.getActiveAlarms()).filter(t=>t.alarmName!==e);yield this.updateActiveAlarms(t||[])})}clearScheduledAlarm(e){return fae(this,void 0,void 0,function*(){(yield this.clearAlarm(e))&&(yield this.deleteActiveAlarm(e))})}updateActiveAlarms(e){return fae(this,void 0,void 0,function*(){yield this.activeAlarmsState.update(()=>e)})}setupOnAlarmListener(){tl.addListener(chrome.alarms.onAlarm,this.handleOnAlarm)}triggerTask(e,t){return fae(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 fae(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 fae(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 gae extends mae{constructor(e,t){super(e,t),this.port=chrome.runtime.connect({name:"browser-task-scheduler-port"})}setTimeout(e,t){return this.sendPortMessage({action:hae,taskName:e,delayInMs:t}),super.setTimeout(e,t)}setInterval(e,t,i){return this.sendPortMessage({action:pae,taskName:e,intervalInMs:t}),super.setInterval(e,t,i)}sendPortMessage(e){this.port.postMessage(e)}}var yae=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 bae extends ip{get valuesRequireDeserialization(){return!0}constructor(e){super(),this.partitionName=e,this.updatesSubject=new go.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$=dF(this._port.onMessage).pipe((0,l.T)(([e])=>e),(0,To.p)(e=>"background"===e.originator)),this._backgroundResponses$.pipe((0,To.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 yae(this,void 0,void 0,function*(){return yield this.delegateToBackground("get",e)})}has(e){return yae(this,void 0,void 0,function*(){return yield this.delegateToBackground("has",e)})}save(e,t){return yae(this,void 0,void 0,function*(){yield this.delegateToBackground("save",e,t)})}remove(e){return yae(this,void 0,void 0,function*(){yield this.delegateToBackground("remove",e)})}delegateToBackground(e,t,i){return yae(this,void 0,void 0,function*(){const n=kd.newGuid(),r=(0,ho._)(this._backgroundResponses$.pipe((0,To.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 wae=new tk("fullSyncFinished");var Sae=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 kae=new tk("doFullSync");var Iae=function(e,t,i,n){return new(i||(i=Promise))(function(r,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.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 Cae{constructor(e){this.platformUtilsService=e,this.notificationClicked$=(0,bo.h)(dF(chrome.notifications.onButtonClicked).pipe((0,l.T)(([e,t])=>({id:e,buttonIdentifier:t}))),dF(chrome.notifications.onClicked).pipe((0,l.T)(([e])=>({id:e,buttonIdentifier:rre.NotificationButton}))))}create(e){return Iae(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===Ta.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 Iae(this,void 0,void 0,function*(){yield chrome.notifications.clear(e.id)})}isSupported(){return"notifications"in chrome}}const Tae=()=>dF(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,{[ik]:!0})),(0,wo.u)());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())})};class Fae{constructor(e,t,i,n,r,s,o,l,c,u,d,h){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.configService=u,this.encryptService=d,this.document=h,this.sizeService=(0,a.WQX)(al)}init(){return()=>Pae(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(),this.encryptService.init(this.configService);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&&rl.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(){tl.messageListener("vaultPopupHeartbeat",(e,t,i)=>{"checkVaultPopupHeartbeat"===(null==e?void 0:e.command)&&i(!0)})}}Fae.ɵfac=function(e){return new(e||Fae)(a.KVO(Eb),a.KVO(Pl),a.KVO(ao),a.KVO(BT),a.KVO(za),a.KVO(_se),a.KVO(qL),a.KVO(g3),a.KVO(Rne),a.KVO(uk),a.KVO(Nj),a.KVO(a.qQL))},Fae.ɵprov=a.jDH({token:Fae,factory:Fae.ɵfac});const Rae=new sc("OBSERVABLE_LARGE_OBJECT_MEMORY_STORAGE"),xae=new sc("DISK_BACKUP_LOCAL_STORAGE"),Aae=[Fae,Q7,Jd,$2,V3,{provide:CT,useValue:ef},{provide:yl.hnV,useFactory:e=>e.init(),deps:[Fae],multi:!0},{provide:cI,useFactory:()=>new Ite(window),deps:[]},{provide:za,useFactory:()=>new Ka(!1),deps:[]},{provide:JS,useExisting:Yoe},{provide:Yoe,useClass:Yoe,deps:[za,u,Ok,RT]},{provide:Pl,useFactory:e=>new aae(tl.getUILanguage(),e),deps:[d]},{provide:kie,useClass:Voe,deps:[za,Eb]},{provide:Cp,useFactory:(e,t,i,n,r,s,o,a,l,c)=>{const u=new Ff(e,t,i,n,r,s,o,a,l,c);return new aoe(u,n).attachToGlobal(self),u},deps:[Db,_L,cI,Nj,Eb,za,ao,Ok,u,$f]},{provide:UE,useClass:Tse,deps:[$k]},{provide:Goe,useClass:class{constructor(e){this.logService=e,this.workerCount=0}offscreenApiSupported(){return void 0!==chrome.offscreen}withDocument(e,t,i){return Loe(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 Loe(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 Loe(this,void 0,void 0,function*(){yield chrome.offscreen.closeDocument()})}documentExists(){return Loe(this,void 0,void 0,function*(){return yield chrome.offscreen.hasDocument()})}},deps:[za]},{provide:Eb,useFactory:(e,t)=>new lae(e,(e,t)=>{tl.sendMessage("clearClipboard",{clipboardValue:e,clearMs:t})},window,t),deps:[xb,Goe]},{provide:kp,useClass:class extends kp{constructor(e){super(),this.platformUtilsService=e,this.shouldAutopromptNow=!0}authenticateWithBiometrics(){return $oe(this,void 0,void 0,function*(){const e=yield tl.sendMessageWithResponse(yp.AuthenticateWithBiometrics);if(!e.result)throw e.error;return e.result})}getBiometricsStatus(){return $oe(this,void 0,void 0,function*(){return(yield tl.sendMessageWithResponse(yp.GetBiometricsStatus)).result})}unlockWithBiometricsForUser(e){return $oe(this,void 0,void 0,function*(){const t=yield tl.sendMessageWithResponse(yp.UnlockWithBiometricsForUser,{userId:e});return t.result?gf.fromString(t.result.keyB64):null})}getBiometricsStatusForUser(e){return $oe(this,void 0,void 0,function*(){const t=yield tl.sendMessageWithResponse(yp.GetBiometricsStatusForUser,{userId:e});return null!=t?t.result:gp.DesktopDisconnected})}getShouldAutopromptNow(){return $oe(this,void 0,void 0,function*(){return this.shouldAutopromptNow})}setShouldAutopromptNow(e){return $oe(this,void 0,void 0,function*(){this.shouldAutopromptNow=e})}canEnableBiometricUnlock(){return $oe(this,void 0,void 0,function*(){return!(yield tl.permissionsGranted(["nativeMessaging"]))&&!this.platformUtilsService.isSafari()||(yield tl.sendMessageWithResponse(yp.CanEnableBiometricUnlock)).result})}},deps:[Eb]},{provide:ux,useClass:class extends ire{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 Sae(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=kd.newGuid(),o=(0,ho._)(this.messageListener.messages$(wae).pipe((0,To.p)(e=>e.requestId===s),(0,po.w)({first:3e4,with:()=>(this.logService.warning("ForegroundSyncService did not receive a message back in a reasonable time."),(0,Oo.of)({successfully:!1,errorMessage:"Sync timed out."}))})));this.messageSender.send(kae,{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:[b5,YU,zG,ek,za,Fb,BF,Mk,Ok,dd,fQ,GZ,ZS,u]},{provide:oE,useClass:aE,deps:[u,$b,Ok]},{provide:ip,useClass:class extends Joe{constructor(e){super(chrome.storage.local),this.logService=e}get(e){return Zoe(this,void 0,void 0,function*(){return yield this.getWithRetries(e,0)})}getWithRetries(e,t){return Zoe(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 Zoe(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 Zoe(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:I3,useExisting:N3},{provide:sI,useExisting:g3,deps:[]},{provide:N3,deps:[Fb,HD,UE,OE,za,oE,bC,ME,Xoe,Ok,dd,uk,bY,ZS]},{provide:Xoe,useClass:class extends Xoe{constructor(e,t,i){super(),this.domainSettingsService=e,this.platformUtilsService=t,this.logService=i,this.blockedDomains=null}inject(e){return eae(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 tl.getTab(i));let a=!0;const l=yield(0,ho._)(this.domainSettingsService.blockedInteractionsUris$);if(l&&(null==o?void 0:o.url)&&(a=!l$(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(tl.isManifestVersion(3))try{yield tl.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 tl.executeScriptInTab(i,c)})}getScriptFile(e){var t,i;const{injectDetails:n,mv2Details:r,mv3Details:s}=e;return tl.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:[oE,Eb,za]},{provide:pf,useClass:class{constructor(e){this.messagingService=e}checkVaultTimeout(){return Moe(this,void 0,void 0,function*(){})}},deps:[ek]},{provide:gT,useExisting:ip},{provide:mT,useFactory:e=>e,deps:[fT]},{provide:fT,useFactory:()=>tl.isManifestVersion(2)?new bae:new Qoe,deps:[]},{provide:Rae,useFactory:e=>tl.isManifestVersion(2)?e:new bae,deps:[fT]},{provide:vT,useExisting:ip},{provide:z$,useClass:Koe,deps:[]},{provide:IT,useFactory:e=>{const t=tl.getBackgroundPage();return e.isSafari()&&t?(0,Oo.of)(R5.getSystemThemeFromWindow(t)):R5.createSystemThemeFromWindow(window)},deps:[Eb]},{provide:TY,useFactory:e=>new TY(e),deps:[Eb]},{provide:c,useClass:class{get(e,t,i){return new jo(e,t,i)}},deps:[]},{provide:k5,useClass:class{constructor(e,t,i,n,r,s,o,a,l){this.accountService=e,this.actionService=t,this.authService=i,this.i18nService=n,this.masterPasswordService=r,this.messagingService=s,this.pendingAuthRequestsState=o,this.platformUtilsService=a,this.systemNotificationsService=l}receivedPendingAuthRequest(e,t){return roe(this,void 0,void 0,function*(){const i=yield(0,ho._)(this.authService.activeAccountStatus$),n=yield(0,ho._)(this.accountService.activeAccount$.pipe(Lp)),r=yield(0,ho._)(this.masterPasswordService.forceSetPasswordReason$(e)),s=yield this.platformUtilsService.isPopupOpen();yield this.pendingAuthRequestsState.add(e);if(!(s&&i===cd.Unlocked&&n===e&&r===Gw.None)){const i=(yield(0,ho._)(this.accountService.accounts$))[e].email;return void(yield this.systemNotificationsService.create({id:`${noe.AuthRequest}_${t}`,title:this.i18nService.t("accountAccessRequested"),body:this.i18nService.t("confirmAccessAttempt",i),buttons:[]}))}this.messagingService.send("openLoginApproval")})}handleAuthRequestNotificationClicked(e){return roe(this,void 0,void 0,function*(){e.buttonIdentifier===rre.NotificationButton&&(yield this.systemNotificationsService.clear({id:`${e.id}`}),yield this.actionService.openPopup())})}processPendingAuthRequests(){return roe(this,void 0,void 0,function*(){var e;yield this.pendingAuthRequestsState.pruneOlderThan(9e5);const t=null!==(e=yield(0,ho._)(this.pendingAuthRequestsState.getAll$()))&&void 0!==e?e:[];if(t.length>0){const e=yield(0,ho._)(this.accountService.activeAccount$.pipe(Gp));t.some(t=>t.userId===e)&&this.messagingService.send("openLoginApproval")}})}},deps:[Ok,kie,dd,Pl,Ab,ek,IH,Eb,sre]},{provide:HD,useClass:JD,deps:[u,$b,Ok,vE]},{provide:bY,useClass:class{constructor(e){this.stateProvider=e,this.enableAddedLoginPromptState=this.stateProvider.getGlobal(gY),this.enableAddedLoginPrompt$=this.enableAddedLoginPromptState.state$.pipe((0,l.T)(e=>null==e||e)),this.enableChangedPasswordPromptState=this.stateProvider.getGlobal(yY),this.enableChangedPasswordPrompt$=this.enableChangedPasswordPromptState.state$.pipe((0,l.T)(e=>null==e||e))}setEnableAddedLoginPrompt(e){return mY(this,void 0,void 0,function*(){yield this.enableAddedLoginPromptState.update(()=>e)})}setEnableChangedPasswordPrompt(e){return mY(this,void 0,void 0,function*(){yield this.enableChangedPasswordPromptState.update(()=>e)})}},deps:[u]},{provide:CD,useClass:class{constructor(e,t,i,n,r,s){this.accountService=e,this.billingService=t,this.configService=i,this.organizationService=n,this.platformService=r,this.stateProvider=s,this.available$=this.buildAvailablePipeline$().pipe((0,lo.F)(),(0,Pp.t)({bufferSize:1,refCount:!0})),this.enabled$=this.buildEnabledPipeline$().pipe((0,lo.F)(),(0,Pp.t)({bufferSize:1,refCount:!0})),this.on$=(0,$o.z)([this.available$,this.enabled$]).pipe((0,l.T)(([e,t])=>e&&t),(0,lo.F)(),(0,Pp.t)({bufferSize:1,refCount:!0}))}setEnabled(e,t){return soe(this,void 0,void 0,function*(){yield this.stateProvider.getUser(e,ooe).update(()=>t)})}buildAvailablePipeline$(){return this.platformService.isSafari()?(0,Oo.of)(!1):(0,$o.z)([this.accountService.activeAccount$,this.configService.getFeatureFlag$(Nf.PhishingDetection)]).pipe((0,co.n)(([e,t])=>e&&t?(0,$o.z)([this.billingService.hasPremiumPersonally$(e.id).pipe((0,vd.W)(()=>(0,Oo.of)(!1))),this.organizationService.organizations$(e.id).pipe((0,vd.W)(()=>(0,Oo.of)([])))]).pipe((0,l.T)(([e,t])=>e||this.orgGrantsAccess(t)),(0,vd.W)(()=>(0,Oo.of)(!1))):(0,Oo.of)(!1)))}buildEnabledPipeline$(){return this.accountService.activeAccount$.pipe((0,co.n)(e=>e?this.stateProvider.getUserState$(ooe,e.id):(0,Oo.of)(!1)),(0,l.T)(e=>null==e||e))}orgGrantsAccess(e){return e.some(e=>!!(e.canAccess&&e.isMember&&e.usersGetPremium)&&(e.productTierType===qE.Families||e.productTierType===qE.Enterprise&&e.usePhishingBlocker))}},deps:[Ok,ME,uk,AF,Eb,u]},{provide:ZS,useFactory:(e,t)=>new ZS((0,bo.h)(e.asObservable(),Tae().pipe(rJ(t)))),deps:[TT,yl.SKi]},{provide:ek,useFactory:(e,t)=>ek.combine(new rk(e),new joe(t)),deps:[TT,za]},{provide:TT,useFactory:()=>new go.B,deps:[]},{provide:ek,useFactory:(e,t)=>ek.combine(new rk(e),new joe(t)),deps:[TT,za]},{provide:xae,useFactory:e=>new hoe(e,new foe(self.localStorage)),deps:[vT]},{provide:op,useClass:class extends op{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:[vT,fT,Rae,xae]},{provide:PT,useValue:Ca.Browser},{provide:Nx,useClass:class{constructor(){this.userDecryptionOptionsService=(0,a.WQX)(fw),this.biometricsService=(0,a.WQX)(kp),this.pinService=(0,a.WQX)(EF),this.routerService=(0,a.WQX)(yH),this.biometricStateService=(0,a.WQX)(wp)}getPreviousUrl(){var e;return null!==(e=this.routerService.getPreviousUrl())&&void 0!==e?e:null}getBiometricsError(e){const t=JA[null==e?void 0:e.message];return t?t.description:null}popOutBrowserExtension(){return Ooe(this,void 0,void 0,function*(){rl.inPopout(i.g.window)||rl.inSidebar(i.g.window)||(yield rl.openCurrentPagePopout(i.g.window))})}closeBrowserExtensionPopout(){rl.inPopout(i.g.window)&&tl.closePopup(i.g.window)}isWindowVisible(){return Ooe(this,void 0,void 0,function*(){throw new Error("Method not implemented.")})}getBiometricsUnlockBtnText(){return"unlockWithBiometrics"}getAvailableUnlockOptions$(e){return(0,$o.z)([(0,Po.v)(()=>Ooe(this,void 0,void 0,function*(){if(yield(0,ho._)(this.biometricStateService.biometricUnlockEnabled$)){return yield Promise.race([this.biometricsService.getBiometricsStatusForUser(e),new Promise(e=>setTimeout(()=>e(gp.DesktopDisconnected),1e3))])}return gp.NotEnabledLocally})),this.userDecryptionOptionsService.userDecryptionOptionsById$(e),(0,Po.v)(()=>this.pinService.isPinDecryptionAvailable(e))]).pipe((0,l.T)(([e,t,i])=>({masterPassword:{enabled:null==t?void 0:t.hasMasterPassword},pin:{enabled:i},biometrics:{enabled:e===gp.Available,biometricsStatus:e}})))}},deps:[]},{provide:cT,useClass:class extends uT{constructor(e){super(),this.window=e}shouldCheckForWebAuthnQueryParamResponse(){return!0}extendPopupWidthIfRequired(e){return Doe(this,void 0,void 0,function*(){const t=yield this.isLinux();e===jw.WebAuthn&&t&&document.body.classList.add("linux-webauthn")})}removePopupWidthExtension(){document.body.classList.remove("linux-webauthn")}reloadOpenWindows(){tl.reloadOpenWindows(!0)}closeSingleActionPopouts(){return Doe(this,void 0,void 0,function*(){if(rl.inSingleActionPopout(this.window,Foe))return yield function(){return Poe(this,void 0,void 0,function*(){yield rl.closeSingleActionPopout(Foe)})}(),!0;if(rl.inSingleActionPopout(this.window,Roe))return yield function(){return Poe(this,void 0,void 0,function*(){yield rl.closeSingleActionPopout(Roe)})}(),!0;if(rl.inSingleActionPopout(this.window,xoe))return yield function(){return Poe(this,void 0,void 0,function*(){yield rl.closeSingleActionPopout(xoe)})}(),!0;return!!rl.inSingleActionPopout(this.window,Aoe)&&(yield function(){return Poe(this,void 0,void 0,function*(){yield rl.closeSingleActionPopout(Aoe)})}(),!0)})}isLinux(){return Doe(this,void 0,void 0,function*(){return"linux"===(yield tl.getPlatformInfo()).os})}determineDuoLaunchAction(){const e=rl.inSingleActionPopout(this.window,Aoe),t=rl.inPopout(this.window);return e||t?nT.DIRECT_LAUNCH:nT.SINGLE_ACTION_POPOUT}},deps:[hT]},{provide:cP,useClass:class extends nF{shouldOpenWebAuthnInNewTab(){return!0}},deps:[]},{provide:ZT,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,To.p)(e=>"duoResult"===e.command),(0,l.T)(e=>({code:e.code,state:e.state,token:`${e.code}|${e.state}`})))}launchDuoFrameless(e){return Eoe(this,void 0,void 0,function*(){const t={title:this.i18nService.t("youSuccessfullyLoggedIn"),message:this.i18nService.t("youMayCloseThisWindow"),isCountdown:!1},i=(yield(0,ho._)(this.environmentService.environment$)).getWebVaultUrl()+"/duo-redirect-connector.html?duoFramelessUrl="+encodeURIComponent(e)+"&handOffMessage="+encodeURIComponent(JSON.stringify(t));this.platformUtilsService.launchUri(i)})}openTwoFactorAuthDuoPopout(){return Eoe(this,void 0,void 0,function*(){yield function(){return Poe(this,void 0,void 0,function*(){yield rl.openPopout("popup/index.html#/2fa",{singleActionKey:Aoe})})}()})}},deps:[sJ,JS,Pl,Eb]},{provide:kie,useClass:Voe,deps:[za,Eb]},{provide:sre,useFactory:e=>"notifications"in chrome&&null!=chrome.notifications?new Cae(e):new are,deps:[Eb]},{provide:pJ,useClass:pJ,deps:[$E,fw,Jd,Ok]},{provide:H6,useClass:class{constructor(e,t=!0){this.globalStateProvider=e,this.defaultEnableRoutingAnimation=t,this.enableRoutingAnimationState=this.globalStateProvider.get(J6),this.enableRoutingAnimation$=this.enableRoutingAnimationState.state$.pipe((0,l.T)(e=>null!=e?e:this.defaultEnableRoutingAnimation))}setEnableRoutingAnimation(e){return W6(this,void 0,void 0,function*(){yield this.enableRoutingAnimationState.update(()=>e,{shouldUpdate:t=>t!==e})})}},deps:[d]},{provide:Ua,useExisting:gae},{provide:gae,useClass:gae,deps:[za,u]},{provide:sk,useExisting:woe,deps:[]},{provide:XS,useClass:XS,deps:[]},{provide:ck,useClass:koe,deps:[cI,JS,rv,Eb,dk,woe,XS]},{provide:_S,useClass:class{constructor(e,t){this.messageSender=e,this.messageListener=t}lockAll(){return voe(this,void 0,void 0,function*(){const e=y(),t=(0,ho._)(this.messageListener.messages$(moe).pipe((0,To.p)(t=>t.requestId===e)));this.messageSender.send(goe,{requestId:e}),yield t})}lock(e){return voe(this,void 0,void 0,function*(){const t=y(),i=(0,ho._)(this.messageListener.messages$(yoe).pipe((0,To.p)(e=>e.requestId===t)));this.messageSender.send(boe,{requestId:t,userId:e}),yield i})}runPlatformOnLockActions(){return voe(this,void 0,void 0,function*(){})}},deps:[ek,ZS]},{provide:qL,useClass:class extends qL{constructor(e){super(),this.logService=e}load(){return cae(this,void 0,void 0,function*(){const e=performance.now();yield function(){return cae(this,void 0,void 0,function*(){if(tl.isManifestVersion(3))yield dae;else{if(!uae)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:Sie,useFactory:()=>nH("sdk")?new coe:new uoe,deps:[]},{provide:$w,useClass:$w,deps:[Ok,dd,u]},{provide:woe,useClass:woe,deps:[]},{provide:yw,useClass:class extends WS{constructor(e,t){super(e),this.messagingService=e,this.accountSwitcherService=t}logout(e,t){return Toe(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:[ek,fF]},{provide:_4,useExisting:e7,deps:[]},{provide:tT,useClass:Coe,deps:[ux,dd,JS,Pl,za]},{provide:UV,useClass:Gq,deps:[Jd,xb,Eb,Pl]},{provide:nW,useClass:class extends fW{constructor(e,t,i,n){super(e,t,i),this.keyService=e,this.masterPasswordApiService=t,this.masterPasswordService=i,this.win=n}closeBrowserExtensionPopout(){rl.inPopout(this.win)&&tl.closePopup(this.win)}},deps:[Cp,T9,Db,hT]},{provide:Rie,useClass:class{constructor(e){this.logService=e,this.notifications$=new ea.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:HH,useClass:class{showHeaderInformation(){return!1}},deps:[]},{provide:BV,useClass:pse,deps:[Fb,Mk,ME,uk]},{provide:rF,useClass:class extends cF{showBackButton(){return!1}},deps:[]},{provide:xA,useClass:class{constructor(e){this.platformUtilsService=e}isAvailable(e){return Uoe(this,void 0,void 0,function*(){switch(e){case of:case ef:case Qp:case sf:return!0;case tf:return!(this.platformUtilsService.isFirefox()||this.platformUtilsService.isSafari()||this.platformUtilsService.isOpera()&&"MacIntel"===navigator.platform);default:if(cf(e))return!0}return!1})}getOrPromoteToAvailable(e){return Uoe(this,void 0,void 0,function*(){return(yield this.isAvailable(e))?e:ef})}},deps:[Eb]},{provide:RA,useClass:class extends RA{constructor(e,t,i,n){super(e,t,i),this.messagingService=n}onTimeoutSave(e){e===Qp&&this.messagingService.send("bgReseedStorage")}},deps:[Pl,xA,$b,ek]}];class Dae{}Dae.ɵfac=function(e){return new(e||Dae)},Dae.ɵmod=yl.$C({type:Dae}),Dae.ɵinj=a.G2t({providers:Aae,imports:[ioe,kG]});var Eae=i(52981),$ae=i(67819),Oae=i(91267),Uae=i(32661),Mae=i(34067),Nae=i(45524),Vae=i(46215),Bae=i(51728),jae=i(2570),Gae=i(85096),Lae=i(53011),zae=i(34423),_ae=i(56773),Kae=i(26293),Xae=i(62263),qae=i(64008),Yae=i(60573),Wae=i(11006),Hae=i(25367),Jae=i(90973),Zae=i(56693),Qae=i(63757),ele=i(39140),tle=i(99911),ile=i(32435),nle=i(19711),rle=i(98330),sle=i(18371),ole=i(83049),ale=i(97369),lle=i(6433),cle=i(11128),ule=i(85884),dle=i(92837),hle=i(62118),ple=i(41528),fle=i(87970),vle=i(15069),mle=i(9799),gle=i(77058),yle=i(79516),ble=i(11625),wle=i(58146),Sle=i(85528),kle=i(74341),Ile=i(70860),Cle=i(17476),Tle=i(41829),Ple=i(93323),Fle=i(5205),Rle=i(89672),xle=i(65906),Ale=i(21819),Dle=i(50121),Ele=i(82437),$le=i(52611),Ole=i(95175),Ule=i(64068),Mle=i(12854),Nle=i(28416),Vle=i(97413),Ble=i(37447),jle=i(60294);(0,Eae.EO)($ae.A,"ar"),(0,Eae.EO)(Oae.A,"az"),(0,Eae.EO)(Uae.A,"be"),(0,Eae.EO)(Mae.A,"bg"),(0,Eae.EO)(Nae.A,"bn"),(0,Eae.EO)(Vae.A,"bs"),(0,Eae.EO)(Bae.A,"ca"),(0,Eae.EO)(jae.A,"cs"),(0,Eae.EO)(Gae.A,"cy"),(0,Eae.EO)(Lae.A,"da"),(0,Eae.EO)(zae.A,"de"),(0,Eae.EO)(_ae.A,"el"),(0,Eae.EO)(Kae.A,"en-GB"),(0,Eae.EO)(Xae.A,"en-IN"),(0,Eae.EO)(qae.A,"es"),(0,Eae.EO)(Yae.A,"et"),(0,Eae.EO)(Wae.A,"eu"),(0,Eae.EO)(Jae.A,"fa"),(0,Eae.EO)(Zae.A,"fi"),(0,Eae.EO)(Qae.A,"fil"),(0,Eae.EO)(ele.A,"fr"),(0,Eae.EO)(tle.A,"gl"),(0,Eae.EO)(ile.A,"he"),(0,Eae.EO)(nle.A,"hi"),(0,Eae.EO)(rle.A,"hr"),(0,Eae.EO)(sle.A,"hu"),(0,Eae.EO)(ole.A,"id"),(0,Eae.EO)(ale.A,"it"),(0,Eae.EO)(lle.A,"ja"),(0,Eae.EO)(cle.A,"ka"),(0,Eae.EO)(ule.A,"km"),(0,Eae.EO)(dle.A,"kn"),(0,Eae.EO)(hle.A,"ko"),(0,Eae.EO)(ple.A,"lt"),(0,Eae.EO)(fle.A,"lv"),(0,Eae.EO)(vle.A,"ml"),(0,Eae.EO)(mle.A,"mr"),(0,Eae.EO)(gle.A,"my"),(0,Eae.EO)(yle.A,"nb"),(0,Eae.EO)(ble.A,"ne"),(0,Eae.EO)(wle.A,"nl"),(0,Eae.EO)(Sle.A,"nn"),(0,Eae.EO)(kle.A,"or"),(0,Eae.EO)(Ile.A,"pl"),(0,Eae.EO)(Cle.A,"pt-BR"),(0,Eae.EO)(Tle.A,"pt-PT"),(0,Eae.EO)(Ple.A,"ro"),(0,Eae.EO)(Fle.A,"ru"),(0,Eae.EO)(Rle.A,"si"),(0,Eae.EO)(xle.A,"sk"),(0,Eae.EO)(Ale.A,"sl"),(0,Eae.EO)(Dle.A,"sr"),(0,Eae.EO)(Ele.A,"sv"),(0,Eae.EO)($le.A,"ta"),(0,Eae.EO)(Ole.A,"te"),(0,Eae.EO)(Ule.A,"th"),(0,Eae.EO)(Mle.A,"tr"),(0,Eae.EO)(Nle.A,"uk"),(0,Eae.EO)(Vle.A,"vi"),(0,Eae.EO)(Ble.A,"zh-CN"),(0,Eae.EO)(jle.A,"zh-TW",Hae.A);class Gle{}Gle.ɵfac=function(e){return new(e||Gle)},Gle.ɵmod=yl.$C({type:Gle,bootstrap:[F5]}),Gle.ɵinj=a.G2t({providers:[pl.oe,pl.vh],imports:[ll.Pd,h5,vY,VD,ic.forRoot({maxOpened:2,autoDismiss:!0,closeButton:!0,positionClass:"toast-top-full-width"}),vl.wb,s.Bb,cl.ad,fl.YN,qf,ul.RH,dl.z_,fl.X1,hl.E9,Dae,dh,AY,uF,kF,Xu,SY,eD,hD,CY,yD,QC,PF,Eu,H7,td,Oh,td]});i(3095);al.initBodyWidthFromLocalStorage(),Ha.shouldApplySafariHeightFix(window)&&document.documentElement.classList.add("safari_height_fix"),(0,o.SmG)(),s.sG().bootstrapModule(Gle)},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(){},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=n)&&Object.keys(u.O).every(function(e){return u.O[e](t[a])})?t.splice(a--,1):(o=!1,n0&&s[c-1][2]>n;c--)s[c]=s[c-1];s[c]=[t,i,n]},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-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