(()=>{"use strict";vare,o,a,n={19452:(e,o,a)=>{varn=a(81222),s=a(85471),r=a(56760),c=a(74095),d=a(88289);consti=(0,a(35947).YK)().detectLogLevel().setApp("twofactor_backupcodes");a(51257);constl={name:"PersonalSettings",components:{NcButton:c.A,NcLoadingIcon:d.A},data:()=>({generatingCodes:!1}),computed:{downloadUrl(){returnthis.codes?"data:text/plain,"+encodeURIComponent(this.codes.reduce((e,t)=>e+t+"\r\n","")):""},downloadFilename:()=>(OC.theme.name||"Nextcloud")+"-backup-codes.txt",enabled(){returnthis.$store.state.enabled},total(){returnthis.$store.state.total},used(){returnthis.$store.state.used},codes(){returnthis.$store.state.codes},name:()=>OC.theme.name||"Nextcloud",haveCodes(){returnthis.codes&&this.codes.length>0}},methods:{generateBackupCodes(){(0,r.C5)().then(()=>{this.generatingCodes=!0,this.$store.dispatch("generate").then(()=>{this.generatingCodes=!1}).catch(e=>{throwOC.Notification.showTemporary(t("twofactor_backupcodes","An error occurred while generating your backup codes")),this.generatingCodes=!1,e})}).catch(i.error)},getPrintData:e=>e?e.reduce((e,t)=>e+t+"<br>",""):"",printCodes(){!function(e){consto=OC.theme.name||"Nextcloud",a=window.open("",t("twofactor_backupcodes","{name} backup codes",{name:o}));a.document.write("<h1>"+t("twofactor_backupcodes","{name} backup codes",{name:o})+"</h1>"),a.document.write("<pre>"+e+"</pre>"),a.print(),a.close()}(this.getPrintData(this.codes))}}};varu=a(85072),p=a.n(u),b=a(97825),f=a.n(b),g=a(77659),h=a.n(g),v=a(55056),m=a.n(v),_=a(10540),A=a.n(_),k=a(41113),w=a.n(k),C=a(42121),y={};y.styleTagTransform=w(),y.setAttributes=m(),y.insert=h().bind(null,"head"),y.domAPI=f(),y.insertStyleElement=A(),p()(C.A,y),C.A&&C.A.locals&&C.A.locals;constx=(0,a(14486).A)(l,function(){vare=this,t=e._self._c;returnt("div",{staticClass:"backupcodes-settings"},[e.enabled?[t("p",{staticClass:"backupcodes-settings__codes"},[e.haveCodes?[e._v("\n\t\t\t\t"+e._s(e.t("twofactor_backupcodes","These are your backup codes. Please save and/or print them as you will not be able to read the codes again later."))+"\n\t\t\t\t"),t("ul",e._l(e.codes,function(o){returnt("li",{key:o,staticClass:"backupcodes-settings__codes__code"},[e._v("\n\t\t\t\t\t\t"+e._s(o)+"\n\t\t\t\t\t")])}),0)]:[e._v("\n\t\t\t\t"+e._s(e.t("twofactor_backupcodes","Backup codes have been generated. {used} of {total} codes have been used.",{used:e.used,total:e.total}))+"\n\t\t\t")]],2),e._v(" "),t("p",{staticClass:"backupcodes-settings__actions"},[e.haveCodes?[t("NcButton",{attrs:{href:e.downloadUrl,download:e.downloadFilename,variant:"primary"}},[e._v("\n\t\t\t\t\t"+e._s(e.t("twofactor_backupcodes","Save backup codes"))+"\n\t\t\t\t")]),e._v(" "),t("NcButton",{on:{click:e.printCodes}},[e._v("\n\t\t\t\t\t"+e._s(e.t("twofactor_backupcodes","Print backup codes"))+"\n\t\t\t\t")])]:e._e(),e._v(" "),t("NcButton",{attrs:{id:"generate-backup-codes"},on:{click:e.generateBackupCodes}},[e._v("\n\t\t\t\t"+e._s(e.t("twofactor_backupcodes","Regenerate backup codes"))+"\n\t\t\t")])],2),e._v(" "),t("p",[t("em",[e._v("\n\t\t\t\t"+e._s(e.t("twofactor_backupcodes","If you regenerate backup codes, you automatically invalidate old codes."))+"\n\t\t\t")])])]:t("NcButton",{attrs:{id:"generate-backup-codes",disabled:e.generatingCodes},on:{click:e.generateBackupCodes},scopedSlots:e._u([{key:"icon",fn:function(){return[e.generatingCodes?t("NcLoadingIcon"):e._e()]},proxy:!0}],null,!1,4108280908)},[e._v("\n\t\t"+e._s(e.t("twofactor_backupcodes","Generate backup codes"))+"\n\t")])],2)},[],!1,null,"22851aa6",null).exports;varO=a(95353),N=a(65043),S=a(63814);s.Ay.use(O.Ay);constP={setEnabled(e,t){s.Ay.set(e,"enabled",t)},setTotal(e,t){s.Ay.set(e,"total",t)},setUsed(e,t){s.Ay.set(e,"used",t)},setCodes(e,t){s.Ay.set(e,"codes",t)}},T={generate(e){let{commit:t}=e;returnt("setEnabled",!1),function(){conste=(0,S.Jv)("/apps/twofactor_backupcodes/settings/create");returnN.Ay.post(e,{}).then(e=>e.data)}().then(e=>{let{codes:o,state:a}=e;returnt("setEnabled",a.enabled),t("setTotal",a.total),t("setUsed",a.used),t("setCodes",o),!0})}},B=newO.il({stric