Neben "Von anderem Modell kopieren" (alle Pakete) lassen sich jetzt einzelne
Pakete kopieren: "Kopieren" im Paket-Panel, in der Auswahl (Nach Modell) und
in der Liste "Alle Pakete". Ein einzelnes Paket kann dabei als andere Stufe
landen (z. B. Drive als Grundlage fuer Prime im selben Modell). Gibt es die
Stufe im Ziel schon: ersetzen oder ueberspringen.
API: POST /packages/copy {items [{id, name?, sort_order?}], target_model_id,
include_upgrades, replace_existing}; copyPackages nutzt dieselbe
Kopierfunktion (copyOne).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01H18w9G2ZdEdGJ3E3goxdQE
8 lines
39 KiB
JavaScript
8 lines
39 KiB
JavaScript
import{k as Fe,r as B,j as d,c as _}from"./index-C_s9-1Hj.js";var O={},Ue=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then},ye={},S={};let ce;const ze=[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 ze[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.');ce=t};S.isKanjiModeEnabled=function(){return typeof ce<"u"};S.toSJIS=function(t){return ce(t)};var W={};(function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(o){if(typeof o!="string")throw new Error("Param is not a string");switch(o.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: "+o)}}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 Ne(){this.buffer=[],this.length=0}Ne.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 o=0;o<t;o++)this.putBit((e>>>t-o-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 Ke=Ne;function Y(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)}Y.prototype.set=function(e,t,o,n){const r=e*this.size+t;this.data[r]=o,n&&(this.reservedBit[r]=!0)};Y.prototype.get=function(e,t){return this.data[e*this.size+t]};Y.prototype.xor=function(e,t,o){this.data[e*this.size+t]^=o};Y.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]};var Ve=Y,Ce={};(function(e){const t=S.getSymbolSize;e.getRowColCoords=function(n){if(n===1)return[];const r=Math.floor(n/7)+2,s=t(n),i=s===145?26:Math.ceil((s-13)/(2*r-2))*2,l=[s-7];for(let a=1;a<r-1;a++)l[a]=l[a-1]-i;return l.push(6),l.reverse()},e.getPositions=function(n){const r=[],s=e.getRowColCoords(n),i=s.length;for(let l=0;l<i;l++)for(let a=0;a<i;a++)l===0&&a===0||l===0&&a===i-1||l===i-1&&a===0||r.push([s[l],s[a]]);return r}})(Ce);var Ee={};const He=S.getSymbolSize,be=7;Ee.getPositions=function(t){const o=He(t);return[[0,0],[o-be,0],[0,o-be]]};var ke={};(function(e){e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(r){return r!=null&&r!==""&&!isNaN(r)&&r>=0&&r<=7},e.from=function(r){return e.isValid(r)?parseInt(r,10):void 0},e.getPenaltyN1=function(r){const s=r.size;let i=0,l=0,a=0,u=null,c=null;for(let y=0;y<s;y++){l=a=0,u=c=null;for(let p=0;p<s;p++){let h=r.get(y,p);h===u?l++:(l>=5&&(i+=t.N1+(l-5)),u=h,l=1),h=r.get(p,y),h===c?a++:(a>=5&&(i+=t.N1+(a-5)),c=h,a=1)}l>=5&&(i+=t.N1+(l-5)),a>=5&&(i+=t.N1+(a-5))}return i},e.getPenaltyN2=function(r){const s=r.size;let i=0;for(let l=0;l<s-1;l++)for(let a=0;a<s-1;a++){const u=r.get(l,a)+r.get(l,a+1)+r.get(l+1,a)+r.get(l+1,a+1);(u===4||u===0)&&i++}return i*t.N2},e.getPenaltyN3=function(r){const s=r.size;let i=0,l=0,a=0;for(let u=0;u<s;u++){l=a=0;for(let c=0;c<s;c++)l=l<<1&2047|r.get(u,c),c>=10&&(l===1488||l===93)&&i++,a=a<<1&2047|r.get(c,u),c>=10&&(a===1488||a===93)&&i++}return i*t.N3},e.getPenaltyN4=function(r){let s=0;const i=r.data.length;for(let a=0;a<i;a++)s+=r.data[a];return Math.abs(Math.ceil(s*100/i/5)-10)*t.N4};function o(n,r,s){switch(n){case e.Patterns.PATTERN000:return(r+s)%2===0;case e.Patterns.PATTERN001:return r%2===0;case e.Patterns.PATTERN010:return s%3===0;case e.Patterns.PATTERN011:return(r+s)%3===0;case e.Patterns.PATTERN100:return(Math.floor(r/2)+Math.floor(s/3))%2===0;case e.Patterns.PATTERN101:return r*s%2+r*s%3===0;case e.Patterns.PATTERN110:return(r*s%2+r*s%3)%2===0;case e.Patterns.PATTERN111:return(r*s%3+(r+s)%2)%2===0;default:throw new Error("bad maskPattern:"+n)}}e.applyMask=function(r,s){const i=s.size;for(let l=0;l<i;l++)for(let a=0;a<i;a++)s.isReserved(a,l)||s.xor(a,l,o(r,a,l))},e.getBestMask=function(r,s){const i=Object.keys(e.Patterns).length;let l=0,a=1/0;for(let u=0;u<i;u++){s(u),e.applyMask(u,r);const c=e.getPenaltyN1(r)+e.getPenaltyN2(r)+e.getPenaltyN3(r)+e.getPenaltyN4(r);e.applyMask(u,r),c<a&&(a=c,l=u)}return l}})(ke);var Z={};const R=W,$=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],q=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];Z.getBlocksCount=function(t,o){switch(o){case R.L:return $[(t-1)*4+0];case R.M:return $[(t-1)*4+1];case R.Q:return $[(t-1)*4+2];case R.H:return $[(t-1)*4+3];default:return}};Z.getTotalCodewordsCount=function(t,o){switch(o){case R.L:return q[(t-1)*4+0];case R.M:return q[(t-1)*4+1];case R.Q:return q[(t-1)*4+2];case R.H:return q[(t-1)*4+3];default:return}};var Ae={},X={};const H=new Uint8Array(512),G=new Uint8Array(256);(function(){let t=1;for(let o=0;o<255;o++)H[o]=t,G[t]=o,t<<=1,t&256&&(t^=285);for(let o=255;o<512;o++)H[o]=H[o-255]})();X.log=function(t){if(t<1)throw new Error("log("+t+")");return G[t]};X.exp=function(t){return H[t]};X.mul=function(t,o){return t===0||o===0?0:H[G[t]+G[o]]};(function(e){const t=X;e.mul=function(n,r){const s=new Uint8Array(n.length+r.length-1);for(let i=0;i<n.length;i++)for(let l=0;l<r.length;l++)s[i+l]^=t.mul(n[i],r[l]);return s},e.mod=function(n,r){let s=new Uint8Array(n);for(;s.length-r.length>=0;){const i=s[0];for(let a=0;a<r.length;a++)s[a]^=t.mul(r[a],i);let l=0;for(;l<s.length&&s[l]===0;)l++;s=s.slice(l)}return s},e.generateECPolynomial=function(n){let r=new Uint8Array([1]);for(let s=0;s<n;s++)r=e.mul(r,new Uint8Array([1,t.exp(s)]));return r}})(Ae);const Be=Ae;function fe(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}fe.prototype.initialize=function(t){this.degree=t,this.genPoly=Be.generateECPolynomial(this.degree)};fe.prototype.encode=function(t){if(!this.genPoly)throw new Error("Encoder not initialized");const o=new Uint8Array(t.length+this.degree);o.set(t);const n=Be.mod(o,this.genPoly),r=this.degree-n.length;if(r>0){const s=new Uint8Array(this.degree);return s.set(n,r),s}return n};var Je=fe,je={},L={},he={};he.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40};var T={};const Se="[0-9]+",Oe="[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
|
||
]))+`;T.KANJI=new RegExp(J,"g");T.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");T.BYTE=new RegExp(Ye,"g");T.NUMERIC=new RegExp(Se,"g");T.ALPHANUMERIC=new RegExp(Oe,"g");const $e=new RegExp("^"+J+"$"),qe=new RegExp("^"+Se+"$"),Ge=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");T.testKanji=function(t){return $e.test(t)};T.testNumeric=function(t){return qe.test(t)};T.testAlphanumeric=function(t){return Ge.test(t)};(function(e){const t=he,o=T;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(s,i){if(!s.ccBits)throw new Error("Invalid mode: "+s);if(!t.isValid(i))throw new Error("Invalid version: "+i);return i>=1&&i<10?s.ccBits[0]:i<27?s.ccBits[1]:s.ccBits[2]},e.getBestModeForData=function(s){return o.testNumeric(s)?e.NUMERIC:o.testAlphanumeric(s)?e.ALPHANUMERIC:o.testKanji(s)?e.KANJI:e.BYTE},e.toString=function(s){if(s&&s.id)return s.id;throw new Error("Invalid mode")},e.isValid=function(s){return s&&s.bit&&s.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(s,i){if(e.isValid(s))return s;try{return n(s)}catch{return i}}})(L);(function(e){const t=S,o=Z,n=W,r=L,s=he,i=7973,l=t.getBCHDigit(i);function a(p,h,w){for(let x=1;x<=40;x++)if(h<=e.getCapacity(x,w,p))return x}function u(p,h){return r.getCharCountIndicator(p,h)+4}function c(p,h){let w=0;return p.forEach(function(x){const k=u(x.mode,h);w+=k+x.getBitsLength()}),w}function y(p,h){for(let w=1;w<=40;w++)if(c(p,w)<=e.getCapacity(w,h,r.MIXED))return w}e.from=function(h,w){return s.isValid(h)?parseInt(h,10):w},e.getCapacity=function(h,w,x){if(!s.isValid(h))throw new Error("Invalid QR Code version");typeof x>"u"&&(x=r.BYTE);const k=t.getSymbolTotalCodewords(h),g=o.getTotalCodewordsCount(h,w),f=(k-g)*8;if(x===r.MIXED)return f;const m=f-u(x,h);switch(x){case r.NUMERIC:return Math.floor(m/10*3);case r.ALPHANUMERIC:return Math.floor(m/11*2);case r.KANJI:return Math.floor(m/13);case r.BYTE:default:return Math.floor(m/8)}},e.getBestVersionForData=function(h,w){let x;const k=n.from(w,n.M);if(Array.isArray(h)){if(h.length>1)return y(h,k);if(h.length===0)return 1;x=h[0]}else x=h;return a(x.mode,x.getLength(),k)},e.getEncodedBits=function(h){if(!s.isValid(h)||h<7)throw new Error("Invalid QR Code version");let w=h<<12;for(;t.getBCHDigit(w)-l>=0;)w^=i<<t.getBCHDigit(w)-l;return h<<12|w}})(je);var ve={};const ae=S,Pe=1335,Qe=21522,pe=ae.getBCHDigit(Pe);ve.getEncodedBits=function(t,o){const n=t.bit<<3|o;let r=n<<10;for(;ae.getBCHDigit(r)-pe>=0;)r^=Pe<<ae.getBCHDigit(r)-pe;return(n<<10|r)^Qe};var Me={};const We=L;function F(e){this.mode=We.NUMERIC,this.data=e.toString()}F.getBitsLength=function(t){return 10*Math.floor(t/3)+(t%3?t%3*3+1:0)};F.prototype.getLength=function(){return this.data.length};F.prototype.getBitsLength=function(){return F.getBitsLength(this.data.length)};F.prototype.write=function(t){let o,n,r;for(o=0;o+3<=this.data.length;o+=3)n=this.data.substr(o,3),r=parseInt(n,10),t.put(r,10);const s=this.data.length-o;s>0&&(n=this.data.substr(o),r=parseInt(n,10),t.put(r,s*3+1))};var Ze=F;const Xe=L,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 U(e){this.mode=Xe.ALPHANUMERIC,this.data=e}U.getBitsLength=function(t){return 11*Math.floor(t/2)+6*(t%2)};U.prototype.getLength=function(){return this.data.length};U.prototype.getBitsLength=function(){return U.getBitsLength(this.data.length)};U.prototype.write=function(t){let o;for(o=0;o+2<=this.data.length;o+=2){let n=te.indexOf(this.data[o])*45;n+=te.indexOf(this.data[o+1]),t.put(n,11)}this.data.length%2&&t.put(te.indexOf(this.data[o]),6)};var et=U;const tt=L;function z(e){this.mode=tt.BYTE,typeof e=="string"?this.data=new TextEncoder().encode(e):this.data=new Uint8Array(e)}z.getBitsLength=function(t){return t*8};z.prototype.getLength=function(){return this.data.length};z.prototype.getBitsLength=function(){return z.getBitsLength(this.data.length)};z.prototype.write=function(e){for(let t=0,o=this.data.length;t<o;t++)e.put(this.data[t],8)};var nt=z;const rt=L,st=S;function K(e){this.mode=rt.KANJI,this.data=e}K.getBitsLength=function(t){return t*13};K.prototype.getLength=function(){return this.data.length};K.prototype.getBitsLength=function(){return K.getBitsLength(this.data.length)};K.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let o=st.toSJIS(this.data[t]);if(o>=33088&&o<=40956)o-=33088;else if(o>=57408&&o<=60351)o-=49472;else throw new Error("Invalid SJIS character: "+this.data[t]+`
|
||
Make sure your charset is UTF-8`);o=(o>>>8&255)*192+(o&255),e.put(o,13)}};var ot=K,Ie={exports:{}};(function(e){var t={single_source_shortest_paths:function(o,n,r){var s={},i={};i[n]=0;var l=t.PriorityQueue.make();l.push(n,0);for(var a,u,c,y,p,h,w,x,k;!l.empty();){a=l.pop(),u=a.value,y=a.cost,p=o[u]||{};for(c in p)p.hasOwnProperty(c)&&(h=p[c],w=y+h,x=i[c],k=typeof i[c]>"u",(k||x>w)&&(i[c]=w,l.push(c,w),s[c]=u))}if(typeof r<"u"&&typeof i[r]>"u"){var g=["Could not find a path from ",n," to ",r,"."].join("");throw new Error(g)}return s},extract_shortest_path_from_predecessor_list:function(o,n){for(var r=[],s=n;s;)r.push(s),o[s],s=o[s];return r.reverse(),r},find_path:function(o,n,r){var s=t.single_source_shortest_paths(o,n,r);return t.extract_shortest_path_from_predecessor_list(s,r)},PriorityQueue:{make:function(o){var n=t.PriorityQueue,r={},s;o=o||{};for(s in n)n.hasOwnProperty(s)&&(r[s]=n[s]);return r.queue=[],r.sorter=o.sorter||n.default_sorter,r},default_sorter:function(o,n){return o.cost-n.cost},push:function(o,n){var r={value:o,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})(Ie);var it=Ie.exports;(function(e){const t=L,o=Ze,n=et,r=nt,s=ot,i=T,l=S,a=it;function u(g){return unescape(encodeURIComponent(g)).length}function c(g,f,m){const b=[];let N;for(;(N=g.exec(m))!==null;)b.push({data:N[0],index:N.index,mode:f,length:N[0].length});return b}function y(g){const f=c(i.NUMERIC,t.NUMERIC,g),m=c(i.ALPHANUMERIC,t.ALPHANUMERIC,g);let b,N;return l.isKanjiModeEnabled()?(b=c(i.BYTE,t.BYTE,g),N=c(i.KANJI,t.KANJI,g)):(b=c(i.BYTE_KANJI,t.BYTE,g),N=[]),f.concat(m,b,N).sort(function(A,j){return A.index-j.index}).map(function(A){return{data:A.data,mode:A.mode,length:A.length}})}function p(g,f){switch(f){case t.NUMERIC:return o.getBitsLength(g);case t.ALPHANUMERIC:return n.getBitsLength(g);case t.KANJI:return s.getBitsLength(g);case t.BYTE:return r.getBitsLength(g)}}function h(g){return g.reduce(function(f,m){const b=f.length-1>=0?f[f.length-1]:null;return b&&b.mode===m.mode?(f[f.length-1].data+=m.data,f):(f.push(m),f)},[])}function w(g){const f=[];for(let m=0;m<g.length;m++){const b=g[m];switch(b.mode){case t.NUMERIC:f.push([b,{data:b.data,mode:t.ALPHANUMERIC,length:b.length},{data:b.data,mode:t.BYTE,length:b.length}]);break;case t.ALPHANUMERIC:f.push([b,{data:b.data,mode:t.BYTE,length:b.length}]);break;case t.KANJI:f.push([b,{data:b.data,mode:t.BYTE,length:u(b.data)}]);break;case t.BYTE:f.push([{data:b.data,mode:t.BYTE,length:u(b.data)}])}}return f}function x(g,f){const m={},b={start:{}};let N=["start"];for(let E=0;E<g.length;E++){const A=g[E],j=[];for(let P=0;P<A.length;P++){const v=A[P],D=""+E+P;j.push(D),m[D]={node:v,lastCount:0},b[D]={};for(let V=0;V<N.length;V++){const M=N[V];m[M]&&m[M].node.mode===v.mode?(b[M][D]=p(m[M].lastCount+v.length,v.mode)-p(m[M].lastCount,v.mode),m[M].lastCount+=v.length):(m[M]&&(m[M].lastCount=v.length),b[M][D]=p(v.length,v.mode)+4+t.getCharCountIndicator(v.mode,f))}}N=j}for(let E=0;E<N.length;E++)b[N[E]].end=0;return{map:b,table:m}}function k(g,f){let m;const b=t.getBestModeForData(g);if(m=t.from(f,b),m!==t.BYTE&&m.bit<b.bit)throw new Error('"'+g+'" cannot be encoded with mode '+t.toString(m)+`.
|
||
Suggested mode is: `+t.toString(b));switch(m===t.KANJI&&!l.isKanjiModeEnabled()&&(m=t.BYTE),m){case t.NUMERIC:return new o(g);case t.ALPHANUMERIC:return new n(g);case t.KANJI:return new s(g);case t.BYTE:return new r(g)}}e.fromArray=function(f){return f.reduce(function(m,b){return typeof b=="string"?m.push(k(b,null)):b.data&&m.push(k(b.data,b.mode)),m},[])},e.fromString=function(f,m){const b=y(f,l.isKanjiModeEnabled()),N=w(b),E=x(N,m),A=a.find_path(E.map,"start","end"),j=[];for(let P=1;P<A.length-1;P++)j.push(E.table[A[P]].node);return e.fromArray(h(j))},e.rawSplit=function(f){return e.fromArray(y(f,l.isKanjiModeEnabled()))}})(Me);const ee=S,ne=W,at=Ke,lt=Ve,dt=Ce,ut=Ee,le=ke,de=Z,ct=Je,Q=je,ft=ve,ht=L,re=Me;function gt(e,t){const o=e.size,n=ut.getPositions(t);for(let r=0;r<n.length;r++){const s=n[r][0],i=n[r][1];for(let l=-1;l<=7;l++)if(!(s+l<=-1||o<=s+l))for(let a=-1;a<=7;a++)i+a<=-1||o<=i+a||(l>=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(s+l,i+a,!0,!0):e.set(s+l,i+a,!1,!0))}}function mt(e){const t=e.size;for(let o=8;o<t-8;o++){const n=o%2===0;e.set(o,6,n,!0),e.set(6,o,n,!0)}}function bt(e,t){const o=dt.getPositions(t);for(let n=0;n<o.length;n++){const r=o[n][0],s=o[n][1];for(let i=-2;i<=2;i++)for(let l=-2;l<=2;l++)i===-2||i===2||l===-2||l===2||i===0&&l===0?e.set(r+i,s+l,!0,!0):e.set(r+i,s+l,!1,!0)}}function pt(e,t){const o=e.size,n=Q.getEncodedBits(t);let r,s,i;for(let l=0;l<18;l++)r=Math.floor(l/3),s=l%3+o-8-3,i=(n>>l&1)===1,e.set(r,s,i,!0),e.set(s,r,i,!0)}function se(e,t,o){const n=e.size,r=ft.getEncodedBits(t,o);let s,i;for(s=0;s<15;s++)i=(r>>s&1)===1,s<6?e.set(s,8,i,!0):s<8?e.set(s+1,8,i,!0):e.set(n-15+s,8,i,!0),s<8?e.set(8,n-s-1,i,!0):s<9?e.set(8,15-s-1+1,i,!0):e.set(8,15-s-1,i,!0);e.set(n-8,8,1,!0)}function wt(e,t){const o=e.size;let n=-1,r=o-1,s=7,i=0;for(let l=o-1;l>0;l-=2)for(l===6&&l--;;){for(let a=0;a<2;a++)if(!e.isReserved(r,l-a)){let u=!1;i<t.length&&(u=(t[i]>>>s&1)===1),e.set(r,l-a,u),s--,s===-1&&(i++,s=7)}if(r+=n,r<0||o<=r){r-=n,n=-n;break}}}function xt(e,t,o){const n=new at;o.forEach(function(a){n.put(a.mode.bit,4),n.put(a.getLength(),ht.getCharCountIndicator(a.mode,e)),a.write(n)});const r=ee.getSymbolTotalCodewords(e),s=de.getTotalCodewordsCount(e,t),i=(r-s)*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<l;a++)n.put(a%2?17:236,8);return yt(n,e,t)}function yt(e,t,o){const n=ee.getSymbolTotalCodewords(t),r=de.getTotalCodewordsCount(t,o),s=n-r,i=de.getBlocksCount(t,o),l=n%i,a=i-l,u=Math.floor(n/i),c=Math.floor(s/i),y=c+1,p=u-c,h=new ct(p);let w=0;const x=new Array(i),k=new Array(i);let g=0;const f=new Uint8Array(e.buffer);for(let A=0;A<i;A++){const j=A<a?c:y;x[A]=f.slice(w,w+j),k[A]=h.encode(x[A]),w+=j,g=Math.max(g,j)}const m=new Uint8Array(n);let b=0,N,E;for(N=0;N<g;N++)for(E=0;E<i;E++)N<x[E].length&&(m[b++]=x[E][N]);for(N=0;N<p;N++)for(E=0;E<i;E++)m[b++]=k[E][N];return m}function Nt(e,t,o,n){let r;if(Array.isArray(e))r=re.fromArray(e);else if(typeof e=="string"){let u=t;if(!u){const c=re.rawSplit(e);u=Q.getBestVersionForData(c,o)}r=re.fromString(e,u||40)}else throw new Error("Invalid data");const s=Q.getBestVersionForData(r,o);if(!s)throw new Error("The amount of data is too big to be stored in a QR Code");if(!t)t=s;else if(t<s)throw new Error(`
|
||
The chosen QR Code version cannot contain this amount of data.
|
||
Minimum version required to store current data is: `+s+`.
|
||
`);const i=xt(t,o,r),l=ee.getSymbolSize(t),a=new lt(l);return gt(a,t),mt(a),bt(a,t),se(a,o,0),t>=7&&pt(a,t),wt(a,i),isNaN(n)&&(n=le.getBestMask(a,se.bind(null,a,o))),le.applyMask(n,a),se(a,o,n),{modules:a,version:t,errorCorrectionLevel:o,maskPattern:n,segments:r}}ye.create=function(t,o){if(typeof t>"u"||t==="")throw new Error("No input text");let n=ne.M,r,s;return typeof o<"u"&&(n=ne.from(o.errorCorrectionLevel,ne.M),r=Q.from(o.version),s=le.from(o.maskPattern),o.toSJISFunc&&ee.setToSJISFunction(o.toSJISFunc)),Nt(t,r,n,s)};var Te={},ge={};(function(e){function t(o){if(typeof o=="number"&&(o=o.toString()),typeof o!="string")throw new Error("Color should be defined as hex string");let n=o.slice().replace("#","").split("");if(n.length<3||n.length===5||n.length>8)throw new Error("Invalid hex color: "+o);(n.length===3||n.length===4)&&(n=Array.prototype.concat.apply([],n.map(function(s){return[s,s]}))),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,s=n.width&&n.width>=21?n.width:void 0,i=n.scale||4;return{width:s,scale:s?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 s=e.getScale(n,r);return Math.floor((n+r.margin*2)*s)},e.qrToImageData=function(n,r,s){const i=r.modules.size,l=r.modules.data,a=e.getScale(i,s),u=Math.floor((i+s.margin*2)*a),c=s.margin*a,y=[s.color.light,s.color.dark];for(let p=0;p<u;p++)for(let h=0;h<u;h++){let w=(p*u+h)*4,x=s.color.light;if(p>=c&&h>=c&&p<u-c&&h<u-c){const k=Math.floor((p-c)/a),g=Math.floor((h-c)/a);x=y[l[k*i+g]?1:0]}n[w++]=x.r,n[w++]=x.g,n[w++]=x.b,n[w]=x.a}}})(ge);(function(e){const t=ge;function o(r,s,i){r.clearRect(0,0,s.width,s.height),s.style||(s.style={}),s.height=i,s.width=i,s.style.height=i+"px",s.style.width=i+"px"}function n(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}e.render=function(s,i,l){let a=l,u=i;typeof a>"u"&&(!i||!i.getContext)&&(a=i,i=void 0),i||(u=n()),a=t.getOptions(a);const c=t.getImageWidth(s.modules.size,a),y=u.getContext("2d"),p=y.createImageData(c,c);return t.qrToImageData(p.data,s,a),o(y,u,c),y.putImageData(p,0,0),u},e.renderToDataURL=function(s,i,l){let a=l;typeof a>"u"&&(!i||!i.getContext)&&(a=i,i=void 0),a||(a={});const u=e.render(s,i,a),c=a.type||"image/png",y=a.rendererOpts||{};return u.toDataURL(c,y.quality)}})(Te);var _e={};const Ct=ge;function we(e,t){const o=e.a/255,n=t+'="'+e.hex+'"';return o<1?n+" "+t+'-opacity="'+o.toFixed(2).slice(1)+'"':n}function oe(e,t,o){let n=e+t;return typeof o<"u"&&(n+=" "+o),n}function Et(e,t,o){let n="",r=0,s=!1,i=0;for(let l=0;l<e.length;l++){const a=Math.floor(l%t),u=Math.floor(l/t);!a&&!s&&(s=!0),e[l]?(i++,l>0&&a>0&&e[l-1]||(n+=s?oe("M",a+o,.5+u+o):oe("m",r,0),r=0,s=!1),a+1<t&&e[l+1]||(n+=oe("h",i),i=0)):r++}return n}_e.render=function(t,o,n){const r=Ct.getOptions(o),s=t.modules.size,i=t.modules.data,l=s+r.margin*2,a=r.color.light.a?"<path "+we(r.color.light,"fill")+' d="M0 0h'+l+"v"+l+'H0z"/>':"",u="<path "+we(r.color.dark,"stroke")+' d="'+Et(i,s,r.margin)+'"/>',c='viewBox="0 0 '+l+" "+l+'"',p='<svg xmlns="http://www.w3.org/2000/svg" '+(r.width?'width="'+r.width+'" height="'+r.width+'" ':"")+c+' shape-rendering="crispEdges">'+a+u+`</svg>
|
||
`;return typeof n=="function"&&n(null,p),p};const kt=Ue,ue=ye,Re=Te,At=_e;function me(e,t,o,n,r){const s=[].slice.call(arguments,1),i=s.length,l=typeof s[i-1]=="function";if(!l&&!kt())throw new Error("Callback required as last argument");if(l){if(i<2)throw new Error("Too few arguments provided");i===2?(r=o,o=t,t=n=void 0):i===3&&(t.getContext&&typeof r>"u"?(r=n,n=void 0):(r=n,n=o,o=t,t=void 0))}else{if(i<1)throw new Error("Too few arguments provided");return i===1?(o=t,t=n=void 0):i===2&&!t.getContext&&(n=o,o=t,t=void 0),new Promise(function(a,u){try{const c=ue.create(o,n);a(e(c,t,n))}catch(c){u(c)}})}try{const a=ue.create(o,n);r(null,e(a,t,n))}catch(a){r(a)}}O.create=ue.create;O.toCanvas=me.bind(null,Re.render);O.toDataURL=me.bind(null,Re.renderToDataURL);O.toString=me.bind(null,function(e,t,o){return At.render(e,o)});const xe={current_password:"",new_password:"",new_password_confirmation:"",two_factor_code:""},ie="w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900";function Bt({user:e,refreshUser:t}){const[o,n]=B.useState("idle"),[r,s]=B.useState(""),[i,l]=B.useState(""),[a,u]=B.useState(""),[c,y]=B.useState(""),[p,h]=B.useState(!1),w=async(f,m)=>{u(""),y(""),h(!0);try{await f(),await t(),n("idle"),l(""),m&&y(m)}catch(b){u(b.message)}finally{h(!1)}},x=f=>{f.preventDefault(),w(()=>_.post("/auth/email",{email:r,password:i}),`Bestätigungslink an ${r} gesendet. Die Adresse gilt erst nach dem Klick darauf.`)},k=f=>{f.preventDefault(),w(()=>_.post("/auth/email/remove",{password:i}),"E-Mail-Adresse entfernt.")},g=()=>{n("idle"),l(""),u("")};return d.jsxs("div",{className:"mb-6 rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900",children:[d.jsx("h2",{className:"mb-1 font-semibold text-neutral-900 dark:text-white",children:"E-Mail-Adresse"}),d.jsx("p",{className:"mb-4 text-sm text-neutral-500 dark:text-neutral-400",children:e!=null&&e.two_factor_enabled?"Beim Login fragen wir die Authenticator-App ab. Mit bestätigter Adresse kannst du dort stattdessen einen Code per Mail anfordern. Außerdem brauchst du sie für „Passwort vergessen“.":"Mit bestätigter Adresse bekommst du beim Login einen Code per Mail, den du zusätzlich zum Passwort eingibst. Außerdem brauchst du sie für „Passwort vergessen“."}),o==="idle"&&d.jsxs(d.Fragment,{children:[d.jsx("p",{className:"mb-2 text-sm",children:e!=null&&e.email&&(e!=null&&e.email_verified)?d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"font-medium text-neutral-800 dark:text-neutral-100",children:e.email})," ",d.jsx("span",{className:"font-semibold text-green-600 dark:text-green-400",children:"· bestätigt"})]}):d.jsx("span",{className:"text-neutral-500 dark:text-neutral-400",children:"Keine E-Mail-Adresse hinterlegt."})}),(e==null?void 0:e.pending_email)&&d.jsxs("div",{className:"mb-4 rounded-md border border-amber-200 bg-amber-50 p-3 text-sm text-amber-800 dark:border-amber-900/50 dark:bg-amber-900/20 dark:text-amber-300",children:[d.jsx("strong",{children:e.pending_email})," wartet auf Bestätigung. Klick auf den Link in der Mail.",d.jsxs("div",{className:"mt-2 flex flex-wrap gap-3",children:[d.jsx("button",{type:"button",disabled:p,onClick:()=>w(()=>_.post("/auth/email/resend",{}),`Neuer Link an ${e.pending_email} gesendet.`),className:"font-medium hover:underline disabled:opacity-60",children:"Link erneut senden"}),d.jsx("button",{type:"button",disabled:p,onClick:()=>w(()=>_.post("/auth/email/cancel",{})),className:"font-medium hover:underline disabled:opacity-60",children:"Änderung verwerfen"})]})]}),c&&d.jsx("p",{className:"mb-4 text-sm text-green-600 dark:text-green-400",children:c}),a&&d.jsx("p",{className:"mb-4 text-sm text-red-600",children:a}),d.jsxs("div",{className:"flex flex-wrap gap-2",children:[d.jsx("button",{onClick:()=>{n("edit"),s(""),u(""),y("")},className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600",children:e!=null&&e.email?"E-Mail-Adresse ändern":"E-Mail-Adresse hinterlegen"}),((e==null?void 0:e.email)||(e==null?void 0:e.pending_email))&&d.jsx("button",{onClick:()=>{n("remove"),u(""),y("")},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:"Entfernen"})]})]}),o==="edit"&&d.jsxs("form",{onSubmit:x,children:[d.jsxs("div",{className:"mb-4",children:[d.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Neue E-Mail-Adresse"}),d.jsx("input",{type:"email",value:r,onChange:f=>s(f.target.value),required:!0,autoFocus:!0,className:ie})]}),d.jsxs("div",{className:"mb-4",children:[d.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Passwort zur Bestätigung"}),d.jsx("input",{type:"password",value:i,onChange:f=>l(f.target.value),required:!0,className:ie})]}),a&&d.jsx("p",{className:"mb-4 text-sm text-red-600",children:a}),d.jsxs("div",{className:"flex gap-2",children:[d.jsx("button",{type:"submit",disabled:p,className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-60",children:p?"Wird gesendet…":"Bestätigungslink senden"}),d.jsx("button",{type:"button",onClick:g,className:"rounded-md border border-neutral-300 px-4 py-2 text-sm dark:border-neutral-700",children:"Abbrechen"})]})]}),o==="remove"&&d.jsxs("form",{onSubmit:k,children:[d.jsx("p",{className:"mb-3 text-sm text-neutral-500 dark:text-neutral-400",children:"Ohne E-Mail-Adresse (und ohne Authenticator-App) reicht beim Login wieder das Passwort."}),d.jsxs("div",{className:"mb-4",children:[d.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Passwort zur Bestätigung"}),d.jsx("input",{type:"password",value:i,onChange:f=>l(f.target.value),required:!0,autoFocus:!0,className:ie})]}),a&&d.jsx("p",{className:"mb-4 text-sm text-red-600",children:a}),d.jsxs("div",{className:"flex gap-2",children:[d.jsx("button",{type:"submit",disabled:p,className:"rounded-md bg-red-600 px-4 py-2 text-sm font-semibold text-white hover:bg-red-700 disabled:opacity-60",children:"E-Mail-Adresse entfernen"}),d.jsx("button",{type:"button",onClick:g,className:"rounded-md border border-neutral-300 px-4 py-2 text-sm dark:border-neutral-700",children:"Abbrechen"})]})]})]})}function St(){const{user:e,refreshUser:t}=Fe(),[o,n]=B.useState("idle"),[r,s]=B.useState(""),[i,l]=B.useState(""),[a,u]=B.useState(""),[c,y]=B.useState(""),[p,h]=B.useState([]),[w,x]=B.useState(""),[k,g]=B.useState(!1),[f,m]=B.useState(xe),[b,N]=B.useState(""),[E,A]=B.useState(""),[j,P]=B.useState(!1),v=async C=>{if(C.preventDefault(),N(""),A(""),f.new_password!==f.new_password_confirmation){N("Die neuen Passwörter stimmen nicht überein");return}P(!0);try{await _.post("/auth/change-password",f),m(xe),A("Passwort erfolgreich geändert.")}catch(I){N(I.message)}finally{P(!1)}},D=async()=>{x(""),g(!0);try{const C=await _.get("/auth/2fa/setup");l(C.secret),s(await O.toDataURL(C.otpauth_url)),u(""),n("setup")}catch(C){x(C.message)}finally{g(!1)}},V=async C=>{C.preventDefault(),x(""),g(!0);try{const I=await _.post("/auth/2fa/enable",{code:a});h(I.recovery_codes),n("recovery-codes"),await t()}catch(I){x(I.message)}finally{g(!1)}},M=()=>{n("idle"),h([]),y("")},Le=async C=>{C.preventDefault(),x(""),g(!0);try{await _.post("/auth/2fa/disable",{password:c}),y(""),n("idle"),await t()}catch(I){x(I.message)}finally{g(!1)}},De=async C=>{C.preventDefault(),x(""),g(!0);try{const I=await _.post("/auth/2fa/recovery-codes",{password:c});h(I.recovery_codes),n("recovery-codes")}catch(I){x(I.message)}finally{g(!1)}};return d.jsxs("div",{className:"max-w-xl",children:[d.jsx("h1",{className:"mb-1 text-xl font-bold text-neutral-900 dark:text-white",children:"Mein Konto"}),d.jsxs("p",{className:"mb-6 text-sm text-neutral-500 dark:text-neutral-400",children:["Angemeldet als ",d.jsx("strong",{children:e==null?void 0:e.username}),e!=null&&e.is_super_admin?" (Super-Admin)":"","."]}),d.jsx(Bt,{user:e,refreshUser:t}),d.jsxs("div",{className:"mb-6 rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900",children:[d.jsx("h2",{className:"mb-1 font-semibold text-neutral-900 dark:text-white",children:"Passwort ändern"}),d.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."]}),d.jsxs("form",{onSubmit:v,children:[d.jsxs("div",{className:"mb-4",children:[d.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Aktuelles Passwort"}),d.jsx("input",{type:"password",value:f.current_password,onChange:C=>m({...f,current_password:C.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"})]}),d.jsxs("div",{className:"mb-4",children:[d.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Neues Passwort"}),d.jsx("input",{type:"password",value:f.new_password,onChange:C=>m({...f,new_password:C.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"})]}),d.jsxs("div",{className:"mb-4",children:[d.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Neues Passwort wiederholen"}),d.jsx("input",{type:"password",value:f.new_password_confirmation,onChange:C=>m({...f,new_password_confirmation:C.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)&&d.jsxs("div",{className:"mb-4",children:[d.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"2FA-Code zur Bestätigung"}),d.jsx("input",{value:f.two_factor_code,onChange:C=>m({...f,two_factor_code:C.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"})]}),b&&d.jsx("p",{className:"mb-4 text-sm text-red-600",children:b}),E&&d.jsx("p",{className:"mb-4 text-sm text-green-600 dark:text-green-400",children:E}),d.jsx("button",{type:"submit",disabled:j,className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-60",children:j?"Wird geändert…":"Passwort ändern"})]})]}),d.jsxs("div",{className:"rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900",children:[d.jsx("h2",{className:"mb-1 font-semibold text-neutral-900 dark:text-white",children:"Zwei-Faktor-Authentifizierung"}),d.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."}),o==="idle"&&d.jsxs(d.Fragment,{children:[d.jsxs("p",{className:"mb-4 text-sm",children:["Status:"," ",e!=null&&e.two_factor_enabled?d.jsx("span",{className:"font-semibold text-green-600 dark:text-green-400",children:"Aktiv"}):d.jsx("span",{className:"font-semibold text-neutral-500 dark:text-neutral-400",children:"Nicht aktiv"})]}),e!=null&&e.two_factor_enabled?d.jsxs("div",{className:"flex flex-wrap gap-2",children:[d.jsx("button",{onClick:()=>{n("regenerate"),x("")},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"}),d.jsx("button",{onClick:()=>{n("disable"),x("")},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"})]}):d.jsx("button",{onClick:D,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:"2FA aktivieren"})]}),o==="setup"&&d.jsxs("form",{onSubmit:V,children:[d.jsxs("ol",{className:"mb-4 list-decimal space-y-2 pl-5 text-sm text-neutral-700 dark:text-neutral-300",children:[d.jsx("li",{children:"Öffne die Google Authenticator App (oder eine kompatible App)."}),d.jsx("li",{children:"Scanne den folgenden QR-Code:"})]}),d.jsx("div",{className:"mb-4 flex justify-center",children:r&&d.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"})}),d.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: ",d.jsx("br",{}),d.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})]}),d.jsxs("div",{className:"mb-4",children:[d.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Bestätigungscode aus der App"}),d.jsx("input",{value:a,onChange:C=>u(C.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"})]}),w&&d.jsx("p",{className:"mb-4 text-sm text-red-600",children:w}),d.jsxs("div",{className:"flex gap-2",children:[d.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:"Bestätigen & aktivieren"}),d.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"})]})]}),o==="recovery-codes"&&d.jsxs("div",{children:[d.jsx("p",{className:"mb-3 text-sm font-semibold text-neutral-900 dark:text-white",children:"Wiederherstellungscodes – jetzt sicher speichern!"}),d.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."}),d.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:p.map(C=>d.jsx("span",{children:C},C))}),d.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"})]}),o==="disable"&&d.jsxs("form",{onSubmit:Le,children:[d.jsxs("div",{className:"mb-4",children:[d.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Passwort zur Bestätigung"}),d.jsx("input",{type:"password",value:c,onChange:C=>y(C.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"})]}),w&&d.jsx("p",{className:"mb-4 text-sm text-red-600",children:w}),d.jsxs("div",{className:"flex gap-2",children:[d.jsx("button",{type:"submit",disabled:k,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"}),d.jsx("button",{type:"button",onClick:()=>{n("idle"),y("")},className:"rounded-md border border-neutral-300 px-4 py-2 text-sm dark:border-neutral-700",children:"Abbrechen"})]})]}),o==="regenerate"&&d.jsxs("form",{onSubmit:De,children:[d.jsx("p",{className:"mb-3 text-sm text-neutral-500 dark:text-neutral-400",children:"Die bisherigen Wiederherstellungscodes werden ungültig."}),d.jsxs("div",{className:"mb-4",children:[d.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Passwort zur Bestätigung"}),d.jsx("input",{type:"password",value:c,onChange:C=>y(C.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"})]}),w&&d.jsx("p",{className:"mb-4 text-sm text-red-600",children:w}),d.jsxs("div",{className:"flex gap-2",children:[d.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:"Neue Codes erzeugen"}),d.jsx("button",{type:"button",onClick:()=>{n("idle"),y("")},className:"rounded-md border border-neutral-300 px-4 py-2 text-sm dark:border-neutral-700",children:"Abbrechen"})]})]})]})]})}export{St as default};
|