"use strict";(self.webpackChunk_bitwarden_web_vault=self.webpackChunk_bitwarden_web_vault||[]).push([[968],{20968:(t,e,n)=>{n.r(e),n.d(e,{MigrateFromLegacyEncryptionComponent:()=>q});var r=n(98645),i=n(71146),o=n(41366),s=n(92879),u=n(24852),c=n(78627),a=n(99721),p=n(76528),l=n(34961),d=n(66459),y=n(4871),h=n(62357),m=n(46246),w=n(36338),b=n(81974),f=n(24083),g=n(24637),_=n(11512),U=n(54666),v=n(1e4),Z=n(36179),S=n(21656),A=n(28315),k=n(82933),T=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(e){o(e)}}function u(t){try{c(r.throw(t))}catch(e){o(e)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,u)}c((r=r.apply(t,e||[])).next())}))};class q{constructor(t,e,n,i,o,s,u){this.keyRotationService=t,this.i18nService=e,this.platformUtilsService=n,this.cryptoService=i,this.messagingService=o,this.logService=s,this.syncService=u,this.formGroup=new r.cw({masterPassword:new r.NI("",[r.kI.required])}),this.submit=()=>T(this,void 0,void 0,(function*(){if(this.formGroup.markAsTouched(),this.formGroup.invalid)return;if(yield this.cryptoService.hasUserKey())throw this.messagingService.send("logout"),new Error("User key already exists, cannot migrate legacy encryption.");const t=this.formGroup.value.masterPassword;try{yield this.syncService.fullSync(!1,!0),yield this.keyRotationService.rotateUserKeyAndEncryptedData(t),this.platformUtilsService.showToast("success",this.i18nService.t("keyUpdated"),this.i18nService.t("logBackInOthersToo"),{timeout:15e3}),this.messagingService.send("logout")}catch(e){throw this.logService.error(e),e}}))}}q.ɵfac=function(t){return new(t||q)(u.Y36(s.j),u.Y36(c.D),u.Y36(a.P),u.Y36(p.$),u.Y36(l.o),u.Y36(d.$),u.Y36(y._))},q.ɵcmp=u.Xpm({type:q,selectors:[["ng-component"]],standalone:!0,features:[u.jDz],decls:43,vars:20,consts:[[3,"formGroup","bitSubmit"],[1,"tw-mt-12","tw-flex","tw-justify-center"],[1,"tw-max-w-xl"],["bitTypography","h1",1,"tw-mb-4","tw-text-center"],[1,"tw-block","tw-rounded","tw-border","tw-border-solid","tw-border-secondary-300","tw-bg-background","tw-p-8"],["href","https://bitwarden.com/help/account-encryption-key/#rotate-your-encryption-key","target","_blank","rel","noopener"],["type","warning"],["id","masterPassword","bitInput","","type","password","formControlName","masterPassword","appAutofocus",""],["type","button","bitIconButton","","bitSuffix","","bitPasswordInputToggle",""],["type","submit","bitButton","","bitFormButton","","buttonType","primary","block",""]],template:function(t,e){1&t&&(u.TgZ(0,"form",0),u._uU(1,"\n  "),u.TgZ(2,"div",1),u._uU(3,"\n    "),u.TgZ(4,"div",2),u._uU(5,"\n      "),u.TgZ(6,"h1",3),u._uU(7),u.ALo(8,"i18n"),u.qZA(),u._uU(9,"\n      "),u.TgZ(10,"div",4),u._uU(11,"\n        "),u.TgZ(12,"p"),u._uU(13),u.ALo(14,"i18n"),u.TgZ(15,"a",5),u._uU(16),u.ALo(17,"i18n"),u.qZA(),u._uU(18,"\n        "),u.qZA(),u._uU(19,"\n        "),u.TgZ(20,"bit-callout",6),u._uU(21),u.ALo(22,"i18n"),u.qZA(),u._uU(23,"\n\n        "),u.TgZ(24,"bit-form-field"),u._uU(25,"\n          "),u.TgZ(26,"bit-label"),u._uU(27),u.ALo(28,"i18n"),u.qZA(),u._uU(29,"\n          "),u._UZ(30,"input",7),u._uU(31,"\n          "),u._UZ(32,"button",8),u._uU(33,"\n        "),u.qZA(),u._uU(34,"\n        "),u.TgZ(35,"button",9),u._uU(36),u.ALo(37,"i18n"),u.qZA(),u._uU(38,"\n      "),u.qZA(),u._uU(39,"\n    "),u.qZA(),u._uU(40,"\n  "),u.qZA(),u._uU(41,"\n"),u.qZA(),u._uU(42,"\n")),2&t&&(u.Q6J("formGroup",e.formGroup)("bitSubmit",e.submit),u.xp6(7),u.Oqu(u.lcZ(8,8,"updateEncryptionKey")),u.xp6(6),u.hij("\n          ",u.lcZ(14,10,"updateEncryptionSchemeDesc"),"\n          "),u.xp6(3),u.Oqu(u.lcZ(17,12,"learnMore")),u.xp6(5),u.Oqu(u.lcZ(22,14,"updateEncryptionKeyWarning")),u.xp6(6),u.Oqu(u.lcZ(28,16,"masterPass")),u.xp6(9),u.hij("\n          ",u.lcZ(37,18,"updateEncryptionKey"),"\n        "))},dependencies:[i.m,r._Y,r.Fj,r.JJ,r.JL,r.sg,r.u,h.U,m.b,w.u,b.r,f.O,g.d,_.G,U.w,v.e,Z.u,S.Q,A.t,k.C,o.N],encapsulation:2})}}]);
//# sourceMappingURL=968.4502fe302db58aaeb677.js.map