import{b as De,r as I,j as u,a as V}from"./index-D6g8QQLx.js";var Y={},Fe=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then},ye={},S={};let de;const Ue=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];S.getSymbolSize=function(t){if(!t)throw new Error('"version" cannot be null or undefined');if(t<1||t>40)throw new Error('"version" should be in range from 1 to 40');return t*4+17};S.getSymbolTotalCodewords=function(t){return Ue[t]};S.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t};S.setToSJISFunction=function(t){if(typeof t!="function")throw new Error('"toSJISFunc" is not a valid function.');de=t};S.isKanjiModeEnabled=function(){return typeof de<"u"};S.toSJIS=function(t){return de(t)};var W={};(function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(s){if(typeof s!="string")throw new Error("Param is not a string");switch(s.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+s)}}e.isValid=function(n){return n&&typeof n.bit<"u"&&n.bit>=0&&n.bit<4},e.from=function(n,r){if(e.isValid(n))return n;try{return t(n)}catch{return r}}})(W);function xe(){this.buffer=[],this.length=0}xe.prototype={get:function(e){const t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)===1},put:function(e,t){for(let s=0;s>>t-s-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(e){const t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}};var ze=xe;function O(e){if(!e||e<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}O.prototype.set=function(e,t,s,n){const r=e*this.size+t;this.data[r]=s,n&&(this.reservedBit[r]=!0)};O.prototype.get=function(e,t){return this.data[e*this.size+t]};O.prototype.xor=function(e,t,s){this.data[e*this.size+t]^=s};O.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]};var Ke=O,Ce={};(function(e){const t=S.getSymbolSize;e.getRowColCoords=function(n){if(n===1)return[];const r=Math.floor(n/7)+2,o=t(n),i=o===145?26:Math.ceil((o-13)/(2*r-2))*2,l=[o-7];for(let a=1;a=0&&r<=7},e.from=function(r){return e.isValid(r)?parseInt(r,10):void 0},e.getPenaltyN1=function(r){const o=r.size;let i=0,l=0,a=0,c=null,d=null;for(let x=0;x=5&&(i+=t.N1+(l-5)),c=f,l=1),f=r.get(y,x),f===d?a++:(a>=5&&(i+=t.N1+(a-5)),d=f,a=1)}l>=5&&(i+=t.N1+(l-5)),a>=5&&(i+=t.N1+(a-5))}return i},e.getPenaltyN2=function(r){const o=r.size;let i=0;for(let l=0;l=10&&(l===1488||l===93)&&i++,a=a<<1&2047|r.get(d,c),d>=10&&(a===1488||a===93)&&i++}return i*t.N3},e.getPenaltyN4=function(r){let o=0;const i=r.data.length;for(let a=0;a=0;){const i=o[0];for(let a=0;a0){const o=new Uint8Array(this.degree);return o.set(n,r),o}return n};var He=ce,ke={},R={},fe={};fe.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40};var _={};const Se="[0-9]+",Je="[A-Z $%*+\\-./:]+";let J="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";J=J.replace(/u/g,"\\u");const Ye="(?:(?![A-Z0-9 $%*+\\-./:]|"+J+`)(?:.|[\r ]))+`;_.KANJI=new RegExp(J,"g");_.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");_.BYTE=new RegExp(Ye,"g");_.NUMERIC=new RegExp(Se,"g");_.ALPHANUMERIC=new RegExp(Je,"g");const Oe=new RegExp("^"+J+"$"),$e=new RegExp("^"+Se+"$"),qe=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");_.testKanji=function(t){return Oe.test(t)};_.testNumeric=function(t){return $e.test(t)};_.testAlphanumeric=function(t){return qe.test(t)};(function(e){const t=fe,s=_;e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(o,i){if(!o.ccBits)throw new Error("Invalid mode: "+o);if(!t.isValid(i))throw new Error("Invalid version: "+i);return i>=1&&i<10?o.ccBits[0]:i<27?o.ccBits[1]:o.ccBits[2]},e.getBestModeForData=function(o){return s.testNumeric(o)?e.NUMERIC:s.testAlphanumeric(o)?e.ALPHANUMERIC:s.testKanji(o)?e.KANJI:e.BYTE},e.toString=function(o){if(o&&o.id)return o.id;throw new Error("Invalid mode")},e.isValid=function(o){return o&&o.bit&&o.ccBits};function n(r){if(typeof r!="string")throw new Error("Param is not a string");switch(r.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+r)}}e.from=function(o,i){if(e.isValid(o))return o;try{return n(o)}catch{return i}}})(R);(function(e){const t=S,s=Z,n=W,r=R,o=fe,i=7973,l=t.getBCHDigit(i);function a(y,f,p){for(let w=1;w<=40;w++)if(f<=e.getCapacity(w,p,y))return w}function c(y,f){return r.getCharCountIndicator(y,f)+4}function d(y,f){let p=0;return y.forEach(function(w){const B=c(w.mode,f);p+=B+w.getBitsLength()}),p}function x(y,f){for(let p=1;p<=40;p++)if(d(y,p)<=e.getCapacity(p,f,r.MIXED))return p}e.from=function(f,p){return o.isValid(f)?parseInt(f,10):p},e.getCapacity=function(f,p,w){if(!o.isValid(f))throw new Error("Invalid QR Code version");typeof w>"u"&&(w=r.BYTE);const B=t.getSymbolTotalCodewords(f),h=s.getTotalCodewordsCount(f,p),b=(B-h)*8;if(w===r.MIXED)return b;const g=b-c(w,f);switch(w){case r.NUMERIC:return Math.floor(g/10*3);case r.ALPHANUMERIC:return Math.floor(g/11*2);case r.KANJI:return Math.floor(g/13);case r.BYTE:default:return Math.floor(g/8)}},e.getBestVersionForData=function(f,p){let w;const B=n.from(p,n.M);if(Array.isArray(f)){if(f.length>1)return x(f,B);if(f.length===0)return 1;w=f[0]}else w=f;return a(w.mode,w.getLength(),B)},e.getEncodedBits=function(f){if(!o.isValid(f)||f<7)throw new Error("Invalid QR Code version");let p=f<<12;for(;t.getBCHDigit(p)-l>=0;)p^=i<=0;)r^=Ie<0&&(n=this.data.substr(s),r=parseInt(n,10),t.put(r,o*3+1))};var We=D;const Ze=R,te=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function F(e){this.mode=Ze.ALPHANUMERIC,this.data=e}F.getBitsLength=function(t){return 11*Math.floor(t/2)+6*(t%2)};F.prototype.getLength=function(){return this.data.length};F.prototype.getBitsLength=function(){return F.getBitsLength(this.data.length)};F.prototype.write=function(t){let s;for(s=0;s+2<=this.data.length;s+=2){let n=te.indexOf(this.data[s])*45;n+=te.indexOf(this.data[s+1]),t.put(n,11)}this.data.length%2&&t.put(te.indexOf(this.data[s]),6)};var Xe=F;const et=R;function U(e){this.mode=et.BYTE,typeof e=="string"?this.data=new TextEncoder().encode(e):this.data=new Uint8Array(e)}U.getBitsLength=function(t){return t*8};U.prototype.getLength=function(){return this.data.length};U.prototype.getBitsLength=function(){return U.getBitsLength(this.data.length)};U.prototype.write=function(e){for(let t=0,s=this.data.length;t=33088&&s<=40956)s-=33088;else if(s>=57408&&s<=60351)s-=49472;else throw new Error("Invalid SJIS character: "+this.data[t]+` Make sure your charset is UTF-8`);s=(s>>>8&255)*192+(s&255),e.put(s,13)}};var ot=z,Me={exports:{}};(function(e){var t={single_source_shortest_paths:function(s,n,r){var o={},i={};i[n]=0;var l=t.PriorityQueue.make();l.push(n,0);for(var a,c,d,x,y,f,p,w,B;!l.empty();){a=l.pop(),c=a.value,x=a.cost,y=s[c]||{};for(d in y)y.hasOwnProperty(d)&&(f=y[d],p=x+f,w=i[d],B=typeof i[d]>"u",(B||w>p)&&(i[d]=p,l.push(d,p),o[d]=c))}if(typeof r<"u"&&typeof i[r]>"u"){var h=["Could not find a path from ",n," to ",r,"."].join("");throw new Error(h)}return o},extract_shortest_path_from_predecessor_list:function(s,n){for(var r=[],o=n;o;)r.push(o),s[o],o=s[o];return r.reverse(),r},find_path:function(s,n,r){var o=t.single_source_shortest_paths(s,n,r);return t.extract_shortest_path_from_predecessor_list(o,r)},PriorityQueue:{make:function(s){var n=t.PriorityQueue,r={},o;s=s||{};for(o in n)n.hasOwnProperty(o)&&(r[o]=n[o]);return r.queue=[],r.sorter=s.sorter||n.default_sorter,r},default_sorter:function(s,n){return s.cost-n.cost},push:function(s,n){var r={value:s,cost:n};this.queue.push(r),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};e.exports=t})(Me);var st=Me.exports;(function(e){const t=R,s=We,n=Xe,r=tt,o=ot,i=_,l=S,a=st;function c(h){return unescape(encodeURIComponent(h)).length}function d(h,b,g){const m=[];let C;for(;(C=h.exec(g))!==null;)m.push({data:C[0],index:C.index,mode:b,length:C[0].length});return m}function x(h){const b=d(i.NUMERIC,t.NUMERIC,h),g=d(i.ALPHANUMERIC,t.ALPHANUMERIC,h);let m,C;return l.isKanjiModeEnabled()?(m=d(i.BYTE,t.BYTE,h),C=d(i.KANJI,t.KANJI,h)):(m=d(i.BYTE_KANJI,t.BYTE,h),C=[]),b.concat(g,m,C).sort(function(A,k){return A.index-k.index}).map(function(A){return{data:A.data,mode:A.mode,length:A.length}})}function y(h,b){switch(b){case t.NUMERIC:return s.getBitsLength(h);case t.ALPHANUMERIC:return n.getBitsLength(h);case t.KANJI:return o.getBitsLength(h);case t.BYTE:return r.getBitsLength(h)}}function f(h){return h.reduce(function(b,g){const m=b.length-1>=0?b[b.length-1]:null;return m&&m.mode===g.mode?(b[b.length-1].data+=g.data,b):(b.push(g),b)},[])}function p(h){const b=[];for(let g=0;g=0&&l<=6&&(a===0||a===6)||a>=0&&a<=6&&(l===0||l===6)||l>=2&&l<=4&&a>=2&&a<=4?e.set(o+l,i+a,!0,!0):e.set(o+l,i+a,!1,!0))}}function gt(e){const t=e.size;for(let s=8;s>l&1)===1,e.set(r,o,i,!0),e.set(o,r,i,!0)}function oe(e,t,s){const n=e.size,r=ct.getEncodedBits(t,s);let o,i;for(o=0;o<15;o++)i=(r>>o&1)===1,o<6?e.set(o,8,i,!0):o<8?e.set(o+1,8,i,!0):e.set(n-15+o,8,i,!0),o<8?e.set(8,n-o-1,i,!0):o<9?e.set(8,15-o-1+1,i,!0):e.set(8,15-o-1,i,!0);e.set(n-8,8,1,!0)}function wt(e,t){const s=e.size;let n=-1,r=s-1,o=7,i=0;for(let l=s-1;l>0;l-=2)for(l===6&&l--;;){for(let a=0;a<2;a++)if(!e.isReserved(r,l-a)){let c=!1;i>>o&1)===1),e.set(r,l-a,c),o--,o===-1&&(i++,o=7)}if(r+=n,r<0||s<=r){r-=n,n=-n;break}}}function pt(e,t,s){const n=new it;s.forEach(function(a){n.put(a.mode.bit,4),n.put(a.getLength(),ft.getCharCountIndicator(a.mode,e)),a.write(n)});const r=ee.getSymbolTotalCodewords(e),o=le.getTotalCodewordsCount(e,t),i=(r-o)*8;for(n.getLengthInBits()+4<=i&&n.put(0,4);n.getLengthInBits()%8!==0;)n.putBit(0);const l=(i-n.getLengthInBits())/8;for(let a=0;a=7&&bt(a,t),wt(a,i),isNaN(n)&&(n=ae.getBestMask(a,oe.bind(null,a,s))),ae.applyMask(n,a),oe(a,s,n),{modules:a,version:t,errorCorrectionLevel:s,maskPattern:n,segments:r}}ye.create=function(t,s){if(typeof t>"u"||t==="")throw new Error("No input text");let n=ne.M,r,o;return typeof s<"u"&&(n=ne.from(s.errorCorrectionLevel,ne.M),r=Q.from(s.version),o=ae.from(s.maskPattern),s.toSJISFunc&&ee.setToSJISFunction(s.toSJISFunc)),xt(t,r,n,o)};var je={},he={};(function(e){function t(s){if(typeof s=="number"&&(s=s.toString()),typeof s!="string")throw new Error("Color should be defined as hex string");let n=s.slice().replace("#","").split("");if(n.length<3||n.length===5||n.length>8)throw new Error("Invalid hex color: "+s);(n.length===3||n.length===4)&&(n=Array.prototype.concat.apply([],n.map(function(o){return[o,o]}))),n.length===6&&n.push("F","F");const r=parseInt(n.join(""),16);return{r:r>>24&255,g:r>>16&255,b:r>>8&255,a:r&255,hex:"#"+n.slice(0,6).join("")}}e.getOptions=function(n){n||(n={}),n.color||(n.color={});const r=typeof n.margin>"u"||n.margin===null||n.margin<0?4:n.margin,o=n.width&&n.width>=21?n.width:void 0,i=n.scale||4;return{width:o,scale:o?4:i,margin:r,color:{dark:t(n.color.dark||"#000000ff"),light:t(n.color.light||"#ffffffff")},type:n.type,rendererOpts:n.rendererOpts||{}}},e.getScale=function(n,r){return r.width&&r.width>=n+r.margin*2?r.width/(n+r.margin*2):r.scale},e.getImageWidth=function(n,r){const o=e.getScale(n,r);return Math.floor((n+r.margin*2)*o)},e.qrToImageData=function(n,r,o){const i=r.modules.size,l=r.modules.data,a=e.getScale(i,o),c=Math.floor((i+o.margin*2)*a),d=o.margin*a,x=[o.color.light,o.color.dark];for(let y=0;y=d&&f>=d&&y"u"&&(!i||!i.getContext)&&(a=i,i=void 0),i||(c=n()),a=t.getOptions(a);const d=t.getImageWidth(o.modules.size,a),x=c.getContext("2d"),y=x.createImageData(d,d);return t.qrToImageData(y.data,o,a),s(x,c,d),x.putImageData(y,0,0),c},e.renderToDataURL=function(o,i,l){let a=l;typeof a>"u"&&(!i||!i.getContext)&&(a=i,i=void 0),a||(a={});const c=e.render(o,i,a),d=a.type||"image/png",x=a.rendererOpts||{};return c.toDataURL(d,x.quality)}})(je);var _e={};const Ct=he;function we(e,t){const s=e.a/255,n=t+'="'+e.hex+'"';return s<1?n+" "+t+'-opacity="'+s.toFixed(2).slice(1)+'"':n}function se(e,t,s){let n=e+t;return typeof s<"u"&&(n+=" "+s),n}function Nt(e,t,s){let n="",r=0,o=!1,i=0;for(let l=0;l0&&a>0&&e[l-1]||(n+=o?se("M",a+s,.5+c+s):se("m",r,0),r=0,o=!1),a+1':"",c="',d='viewBox="0 0 '+l+" "+l+'"',y=''+a+c+` `;return typeof n=="function"&&n(null,y),y};const Et=Fe,ue=ye,ve=je,Bt=_e;function ge(e,t,s,n,r){const o=[].slice.call(arguments,1),i=o.length,l=typeof o[i-1]=="function";if(!l&&!Et())throw new Error("Callback required as last argument");if(l){if(i<2)throw new Error("Too few arguments provided");i===2?(r=s,s=t,t=n=void 0):i===3&&(t.getContext&&typeof r>"u"?(r=n,n=void 0):(r=n,n=s,s=t,t=void 0))}else{if(i<1)throw new Error("Too few arguments provided");return i===1?(s=t,t=n=void 0):i===2&&!t.getContext&&(n=s,s=t,t=void 0),new Promise(function(a,c){try{const d=ue.create(s,n);a(e(d,t,n))}catch(d){c(d)}})}try{const a=ue.create(s,n);r(null,e(a,t,n))}catch(a){r(a)}}Y.create=ue.create;Y.toCanvas=ge.bind(null,ve.render);Y.toDataURL=ge.bind(null,ve.renderToDataURL);Y.toString=ge.bind(null,function(e,t,s){return Bt.render(e,s)});const pe={current_password:"",new_password:"",new_password_confirmation:"",two_factor_code:""};function kt(){const{user:e,refreshUser:t}=De(),[s,n]=I.useState("idle"),[r,o]=I.useState(""),[i,l]=I.useState(""),[a,c]=I.useState(""),[d,x]=I.useState(""),[y,f]=I.useState([]),[p,w]=I.useState(""),[B,h]=I.useState(!1),[b,g]=I.useState(pe),[m,C]=I.useState(""),[E,A]=I.useState(""),[k,T]=I.useState(!1),P=async N=>{if(N.preventDefault(),C(""),A(""),b.new_password!==b.new_password_confirmation){C("Die neuen Passwörter stimmen nicht überein");return}T(!0);try{await V.post("/auth/change-password",b),g(pe),A("Passwort erfolgreich geändert.")}catch(j){C(j.message)}finally{T(!1)}},L=async()=>{w(""),h(!0);try{const N=await V.get("/auth/2fa/setup");l(N.secret),o(await Y.toDataURL(N.otpauth_url)),c(""),n("setup")}catch(N){w(N.message)}finally{h(!1)}},K=async N=>{N.preventDefault(),w(""),h(!0);try{const j=await V.post("/auth/2fa/enable",{code:a});f(j.recovery_codes),n("recovery-codes"),await t()}catch(j){w(j.message)}finally{h(!1)}},M=()=>{n("idle"),f([]),x("")},Re=async N=>{N.preventDefault(),w(""),h(!0);try{await V.post("/auth/2fa/disable",{password:d}),x(""),n("idle"),await t()}catch(j){w(j.message)}finally{h(!1)}},Le=async N=>{N.preventDefault(),w(""),h(!0);try{const j=await V.post("/auth/2fa/recovery-codes",{password:d});f(j.recovery_codes),n("recovery-codes")}catch(j){w(j.message)}finally{h(!1)}};return u.jsxs("div",{className:"max-w-xl",children:[u.jsx("h1",{className:"mb-1 text-xl font-bold text-neutral-900 dark:text-white",children:"Mein Konto"}),u.jsxs("p",{className:"mb-6 text-sm text-neutral-500 dark:text-neutral-400",children:["Angemeldet als ",u.jsx("strong",{children:e==null?void 0:e.username}),e!=null&&e.is_super_admin?" (Super-Admin)":"","."]}),u.jsxs("div",{className:"mb-6 rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900",children:[u.jsx("h2",{className:"mb-1 font-semibold text-neutral-900 dark:text-white",children:"Passwort ändern"}),u.jsxs("p",{className:"mb-4 text-sm text-neutral-500 dark:text-neutral-400",children:["Vergib ein neues Passwort für dein Konto.",(e==null?void 0:e.two_factor_enabled)&&" Da 2FA aktiv ist, musst du die Änderung zusätzlich mit deinem Code bestätigen."]}),u.jsxs("form",{onSubmit:P,children:[u.jsxs("div",{className:"mb-4",children:[u.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Aktuelles Passwort"}),u.jsx("input",{type:"password",value:b.current_password,onChange:N=>g({...b,current_password:N.target.value}),required:!0,className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),u.jsxs("div",{className:"mb-4",children:[u.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Neues Passwort"}),u.jsx("input",{type:"password",value:b.new_password,onChange:N=>g({...b,new_password:N.target.value}),required:!0,minLength:8,className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),u.jsxs("div",{className:"mb-4",children:[u.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Neues Passwort wiederholen"}),u.jsx("input",{type:"password",value:b.new_password_confirmation,onChange:N=>g({...b,new_password_confirmation:N.target.value}),required:!0,minLength:8,className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),(e==null?void 0:e.two_factor_enabled)&&u.jsxs("div",{className:"mb-4",children:[u.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"2FA-Code zur Bestätigung"}),u.jsx("input",{value:b.two_factor_code,onChange:N=>g({...b,two_factor_code:N.target.value}),required:!0,inputMode:"numeric",placeholder:"123456 oder Wiederherstellungscode",className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),m&&u.jsx("p",{className:"mb-4 text-sm text-red-600",children:m}),E&&u.jsx("p",{className:"mb-4 text-sm text-green-600 dark:text-green-400",children:E}),u.jsx("button",{type:"submit",disabled:k,className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-60",children:k?"Wird geändert…":"Passwort ändern"})]})]}),u.jsxs("div",{className:"rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900",children:[u.jsx("h2",{className:"mb-1 font-semibold text-neutral-900 dark:text-white",children:"Zwei-Faktor-Authentifizierung"}),u.jsx("p",{className:"mb-4 text-sm text-neutral-500 dark:text-neutral-400",children:"Schützt dein Konto zusätzlich mit einem Code aus der Google Authenticator App."}),s==="idle"&&u.jsxs(u.Fragment,{children:[u.jsxs("p",{className:"mb-4 text-sm",children:["Status:"," ",e!=null&&e.two_factor_enabled?u.jsx("span",{className:"font-semibold text-green-600 dark:text-green-400",children:"Aktiv"}):u.jsx("span",{className:"font-semibold text-neutral-500 dark:text-neutral-400",children:"Nicht aktiv"})]}),e!=null&&e.two_factor_enabled?u.jsxs("div",{className:"flex flex-wrap gap-2",children:[u.jsx("button",{onClick:()=>{n("regenerate"),w("")},className:"rounded-md border border-neutral-300 px-4 py-2 text-sm font-medium hover:bg-neutral-50 dark:border-neutral-700 dark:hover:bg-neutral-800",children:"Neue Wiederherstellungscodes erzeugen"}),u.jsx("button",{onClick:()=>{n("disable"),w("")},className:"rounded-md border border-red-300 px-4 py-2 text-sm font-medium text-red-600 hover:bg-red-50 dark:border-red-900 dark:hover:bg-red-900/20",children:"2FA deaktivieren"})]}):u.jsx("button",{onClick:L,disabled:B,className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-60",children:"2FA aktivieren"})]}),s==="setup"&&u.jsxs("form",{onSubmit:K,children:[u.jsxs("ol",{className:"mb-4 list-decimal space-y-2 pl-5 text-sm text-neutral-700 dark:text-neutral-300",children:[u.jsx("li",{children:"Öffne die Google Authenticator App (oder eine kompatible App)."}),u.jsx("li",{children:"Scanne den folgenden QR-Code:"})]}),u.jsx("div",{className:"mb-4 flex justify-center",children:r&&u.jsx("img",{src:r,alt:"QR-Code für Zwei-Faktor-Authentifizierung",className:"h-48 w-48 rounded-lg border border-neutral-200 dark:border-neutral-700"})}),u.jsxs("p",{className:"mb-4 text-center text-xs text-neutral-500 dark:text-neutral-400",children:["Geht das Scannen nicht? Gib diesen Code manuell ein: ",u.jsx("br",{}),u.jsx("code",{className:"mt-1 inline-block rounded bg-neutral-100 px-2 py-1 font-mono tracking-wider dark:bg-neutral-800",children:i})]}),u.jsxs("div",{className:"mb-4",children:[u.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Bestätigungscode aus der App"}),u.jsx("input",{value:a,onChange:N=>c(N.target.value),required:!0,autoFocus:!0,inputMode:"numeric",placeholder:"123456",className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-center text-lg tracking-widest dark:border-neutral-700 dark:bg-neutral-900"})]}),p&&u.jsx("p",{className:"mb-4 text-sm text-red-600",children:p}),u.jsxs("div",{className:"flex gap-2",children:[u.jsx("button",{type:"submit",disabled:B,className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-60",children:"Bestätigen & aktivieren"}),u.jsx("button",{type:"button",onClick:()=>n("idle"),className:"rounded-md border border-neutral-300 px-4 py-2 text-sm dark:border-neutral-700",children:"Abbrechen"})]})]}),s==="recovery-codes"&&u.jsxs("div",{children:[u.jsx("p",{className:"mb-3 text-sm font-semibold text-neutral-900 dark:text-white",children:"Wiederherstellungscodes – jetzt sicher speichern!"}),u.jsx("p",{className:"mb-3 text-sm text-neutral-500 dark:text-neutral-400",children:"Jeder Code funktioniert einmalig, falls du keinen Zugriff mehr auf die Authenticator-App hast. Diese Codes werden nur jetzt angezeigt."}),u.jsx("div",{className:"mb-4 grid grid-cols-2 gap-2 rounded-md bg-neutral-100 p-4 font-mono text-sm dark:bg-neutral-800",children:y.map(N=>u.jsx("span",{children:N},N))}),u.jsx("button",{onClick:M,className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600",children:"Ich habe die Codes gespeichert"})]}),s==="disable"&&u.jsxs("form",{onSubmit:Re,children:[u.jsxs("div",{className:"mb-4",children:[u.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Passwort zur Bestätigung"}),u.jsx("input",{type:"password",value:d,onChange:N=>x(N.target.value),required:!0,autoFocus:!0,className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),p&&u.jsx("p",{className:"mb-4 text-sm text-red-600",children:p}),u.jsxs("div",{className:"flex gap-2",children:[u.jsx("button",{type:"submit",disabled:B,className:"rounded-md bg-red-600 px-4 py-2 text-sm font-semibold text-white hover:bg-red-700 disabled:opacity-60",children:"2FA jetzt deaktivieren"}),u.jsx("button",{type:"button",onClick:()=>{n("idle"),x("")},className:"rounded-md border border-neutral-300 px-4 py-2 text-sm dark:border-neutral-700",children:"Abbrechen"})]})]}),s==="regenerate"&&u.jsxs("form",{onSubmit:Le,children:[u.jsx("p",{className:"mb-3 text-sm text-neutral-500 dark:text-neutral-400",children:"Die bisherigen Wiederherstellungscodes werden ungültig."}),u.jsxs("div",{className:"mb-4",children:[u.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Passwort zur Bestätigung"}),u.jsx("input",{type:"password",value:d,onChange:N=>x(N.target.value),required:!0,autoFocus:!0,className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),p&&u.jsx("p",{className:"mb-4 text-sm text-red-600",children:p}),u.jsxs("div",{className:"flex gap-2",children:[u.jsx("button",{type:"submit",disabled:B,className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-60",children:"Neue Codes erzeugen"}),u.jsx("button",{type:"button",onClick:()=>{n("idle"),x("")},className:"rounded-md border border-neutral-300 px-4 py-2 text-sm dark:border-neutral-700",children:"Abbrechen"})]})]})]})]})}export{kt as default};