/*! For license information please see twofactor_backupcodes-settings.js.LICENSE.txt */ (()=>{"use strict";var e,n={27342:(e,n,o)=>{var a=o(38613),s=o(85471),r=o(36124);o(51257);var c=o(96763);const d={name:"PersonalSettings",data:()=>({generatingCodes:!1}),computed:{downloadUrl(){return this.codes?"data:text/plain,"+encodeURIComponent(this.codes.reduce(((t,e)=>t+e+"\r\n"),"")):""},downloadFilename:()=>(OC.theme.name||"Nextcloud")+"-backup-codes.txt",enabled(){return this.$store.state.enabled},total(){return this.$store.state.total},used(){return this.$store.state.used},codes(){return this.$store.state.codes},name:()=>OC.theme.name||"Nextcloud",haveCodes(){return this.codes&&this.codes.length>0}},methods:{generateBackupCodes(){(0,r.C)().then((()=>{this.generatingCodes=!0,this.$store.dispatch("generate").then((t=>{this.generatingCodes=!1})).catch((e=>{throw OC.Notification.showTemporary(t("twofactor_backupcodes","An error occurred while generating your backup codes")),this.generatingCodes=!1,e}))})).catch(c.error.bind(this))},getPrintData:t=>t?t.reduce(((t,e)=>t+e+"
"),""):"",printCodes(){!function(e){const n=OC.theme.name||"Nextcloud",o=window.open("",t("twofactor_backupcodes","{name} backup codes",{name:n}));o.document.write("

"+t("twofactor_backupcodes","{name} backup codes",{name:n})+"

"),o.document.write("
"+e+"
"),o.print(),o.close()}(this.getPrintData(this.codes))}}};var i=o(85072),l=o.n(i),u=o(97825),p=o.n(u),b=o(77659),h=o.n(b),m=o(55056),f=o.n(m),g=o(10540),v=o.n(g),k=o(41113),w=o.n(k),C=o(53673),A={};A.styleTagTransform=w(),A.setAttributes=f(),A.insert=h().bind(null,"head"),A.domAPI=p(),A.insertStyleElement=v(),l()(C.A,A),C.A&&C.A.locals&&C.A.locals;const y=(0,o(14486).A)(d,(function(){var t=this,e=t._self._c;return e("div",[t.enabled?[e("p",[t.haveCodes?[t._v("\n\t\t\t\t"+t._s(t.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"),e("ul",t._l(t.codes,(function(n){return e("li",{key:n,staticClass:"backup-code"},[t._v("\n\t\t\t\t\t\t"+t._s(n)+"\n\t\t\t\t\t")])})),0),t._v(" "),e("a",{staticClass:"button primary",attrs:{href:t.downloadUrl,download:t.downloadFilename}},[t._v(t._s(t.t("twofactor_backupcodes","Save backup codes")))]),t._v(" "),e("button",{staticClass:"button",on:{click:t.printCodes}},[t._v("\n\t\t\t\t\t"+t._s(t.t("twofactor_backupcodes","Print backup codes"))+"\n\t\t\t\t")])]:[t._v("\n\t\t\t\t"+t._s(t.t("twofactor_backupcodes","Backup codes have been generated. {used} of {total} codes have been used.",{used:t.used,total:t.total}))+"\n\t\t\t")]],2),t._v(" "),e("p",[e("button",{attrs:{id:"generate-backup-codes"},on:{click:t.generateBackupCodes}},[t._v("\n\t\t\t\t"+t._s(t.t("twofactor_backupcodes","Regenerate backup codes"))+"\n\t\t\t")])]),t._v(" "),e("p",[e("em",[t._v("\n\t\t\t\t"+t._s(t.t("twofactor_backupcodes","If you regenerate backup codes, you automatically invalidate old codes."))+"\n\t\t\t")])])]:e("button",{attrs:{id:"generate-backup-codes",disabled:t.generatingCodes},on:{click:t.generateBackupCodes}},[t._v("\n\t\t"+t._s(t.t("twofactor_backupcodes","Generate backup codes"))+"\n\t\t"),e("span",{class:{"icon-loading-small":t.generatingCodes}})])],2)}),[],!1,null,"142ef146",null).exports;var _=o(95353),x=o(26287),O=o(99498);s.Ay.use(_.Ay);const P={setEnabled(t,e){s.Ay.set(t,"enabled",e)},setTotal(t,e){s.Ay.set(t,"total",e)},setUsed(t,e){s.Ay.set(t,"used",e)},setCodes(t,e){s.Ay.set(t,"codes",e)}},S={generate(t){let{commit:e}=t;return e("setEnabled",!1),function(){const t=(0,O.Jv)("/apps/twofactor_backupcodes/settings/create");return x.A.post(t,{}).then((t=>t.data))}().then((t=>{let{codes:n,state:o}=t;return e("setEnabled",o.enabled),e("setTotal",o.total),e("setUsed",o.used),e("setCodes",n),!0}))}},B=new _.il({strict:!1,state:{enabled:!1,total:0,used:0,codes:[]},mutations:P,actions:S});s.Ay.prototype.t=t;const T=(0,a.C)("twofactor_backupcodes","state");B.replaceState(T),new(s.Ay.extend(y))({store:B}).$mount("#twofactor-backupcodes-settings")},53673:(t,e,n)=>{n.d(e,{A:()=>c});var o=n(71354),a=n.n(o),s=n(76314),r=n.n(s)()(a());r.push([t.id,"\n.backup-code[data-v-142ef146] {\n\tfont-family: monospace;\n\tletter-spacing: 0.02em;\n\tfont-size: 1.2em;\n}\n.button[data-v-142ef146] {\n\tdisplay: inline-block;\n}\n","",{version:3,sources:["webpack://./apps/twofactor_backupcodes/src/views/PersonalSettings.vue"],names:[],mappings:";AAoIA;CACA,sBAAA;CACA,sBAAA;CACA,gBAAA;AACA;AACA;CACA,qBAAA;AACA",sourcesContent:["\n\n