Safe3-openresty-manager/frontend/dist/assets/users-CPSOZInX.js
UUSEC Technology 12467d8fd1 open source
2025-04-30 13:05:17 +08:00

5 lines
27 KiB
JavaScript
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{R as ue,_ as $e,a as xe,b as Le,D as Be,d as ze,S as Te,c as Ue}from"./index-fvitOmZ4.js";import{h as Fe,m as De,j as L,k as He,c,a0 as Ve,A as ne,o as je,d as X,n as ce,a2 as Q,al as de,w as Ge,_ as D,O as H,B as Ye,az as Ke,u as Xe,aE as We,r as x,K as qe,L as ee,F as Ze,M as K,U as te,N as w,i as Je,Q as B,R as O,S as k,T as P,V as A,a7 as Qe,a9 as F,a8 as z,ab as et,ac as tt,$ as nt}from"./index-sY8U2mN5.js";import{B as ot,_ as st}from"./index-DF6QHY1m.js";import{I as lt,_ as rt}from"./index-CuhAjkvG.js";import{S as at}from"./SearchOutlined-BLCZb9-5.js";import{B as fe,P as it}from"./Col-CfXYHSRU.js";import{T as ut}from"./index-DiwXkr_y.js";import{F as ct,_ as dt}from"./TextArea-eBr-9_0I.js";import{U as ft}from"./UserOutlined-Dj8xeDjL.js";import{S as ht,_ as mt,a as pt,b as gt}from"./index-ByZ25-ct.js";import{L as ae,C as vt}from"./LockOutlined-Dhk9PlHs.js";import{_ as wt}from"./index-C4JfeY-V.js";import{_ as _t}from"./index-BCEZO0Ve.js";const bt=a=>{const{componentCls:o}=a;return{[o]:L(L({},He(a)),{display:"flex",justifyContent:"center",alignItems:"center",padding:a.paddingSM,backgroundColor:a.colorWhite,borderRadius:a.borderRadiusLG,border:`${a.lineWidth}px ${a.lineType} ${a.colorSplit}`,position:"relative",width:"100%",height:"100%",overflow:"hidden",[`& > ${o}-mask`]:{position:"absolute",insetBlockStart:0,insetInlineStart:0,zIndex:10,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",width:"100%",height:"100%",color:a.colorText,lineHeight:a.lineHeight,background:a.QRCodeMaskBackgroundColor,textAlign:"center",[`& > ${o}-expired , & > ${o}-scanned`]:{color:a.QRCodeTextColor}},"&-icon":{marginBlockEnd:a.marginXS,fontSize:a.controlHeight}}),[`${o}-borderless`]:{borderColor:"transparent"}}},Et=Fe("QRCode",a=>bt(De(a,{QRCodeTextColor:"rgba(0, 0, 0, 0.88)",QRCodeMaskBackgroundColor:"rgba(255, 255, 255, 0.96)"})));var Ct={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M928 160H96c-17.7 0-32 14.3-32 32v640c0 17.7 14.3 32 32 32h832c17.7 0 32-14.3 32-32V192c0-17.7-14.3-32-32-32zm-40 110.8V792H136V270.8l-27.6-21.5 39.3-50.5 42.8 33.3h643.1l42.8-33.3 39.3 50.5-27.7 21.5zM833.6 232L512 482 190.4 232l-42.8-33.3-39.3 50.5 27.6 21.5 341.6 265.6a55.99 55.99 0 0068.7 0L888 270.8l27.6-21.5-39.3-50.5-42.7 33.2z"}}]},name:"mail",theme:"outlined"};function ie(a){for(var o=1;o<arguments.length;o++){var r=arguments[o]!=null?Object(arguments[o]):{},p=Object.keys(r);typeof Object.getOwnPropertySymbols=="function"&&(p=p.concat(Object.getOwnPropertySymbols(r).filter(function(m){return Object.getOwnPropertyDescriptor(r,m).enumerable}))),p.forEach(function(m){yt(a,m,r[m])})}return a}function yt(a,o,r){return o in a?Object.defineProperty(a,o,{value:r,enumerable:!0,configurable:!0,writable:!0}):a[o]=r,a}var se=function(o,r){var p=ie({},o,r.attrs);return c(Ve,ie({},p,{icon:Ct}),null)};se.displayName="MailOutlined";se.inheritAttrs=!1;const le=()=>({size:{type:Number,default:160},value:{type:String,required:!0},type:ne("canvas"),color:String,bgColor:String,includeMargin:Boolean,imageSettings:je()}),Mt=()=>L(L({},le()),{errorLevel:ne("M"),icon:String,iconSize:{type:Number,default:40},status:ne("active"),bordered:{type:Boolean,default:!0}});/**
* @license QR Code generator library (TypeScript)
* Copyright (c) Project Nayuki.
* SPDX-License-Identifier: MIT
*/var S;(function(a){class o{static encodeText(e,n){const t=a.QrSegment.makeSegments(e);return o.encodeSegments(t,n)}static encodeBinary(e,n){const t=a.QrSegment.makeBytes(e);return o.encodeSegments([t],n)}static encodeSegments(e,n){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:40,l=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1,f=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;if(!(o.MIN_VERSION<=t&&t<=s&&s<=o.MAX_VERSION)||l<-1||l>7)throw new RangeError("Invalid value");let d,u;for(d=t;;d++){const _=o.getNumDataCodewords(d,n)*8,C=i.getTotalBits(e,d);if(C<=_){u=C;break}if(d>=s)throw new RangeError("Data too long")}for(const _ of[o.Ecc.MEDIUM,o.Ecc.QUARTILE,o.Ecc.HIGH])f&&u<=o.getNumDataCodewords(d,_)*8&&(n=_);const v=[];for(const _ of e){r(_.mode.modeBits,4,v),r(_.numChars,_.mode.numCharCountBits(d),v);for(const C of _.getData())v.push(C)}m(v.length==u);const M=o.getNumDataCodewords(d,n)*8;m(v.length<=M),r(0,Math.min(4,M-v.length),v),r(0,(8-v.length%8)%8,v),m(v.length%8==0);for(let _=236;v.length<M;_^=253)r(_,8,v);const y=[];for(;y.length*8<v.length;)y.push(0);return v.forEach((_,C)=>y[C>>>3]|=_<<7-(C&7)),new o(d,n,y,l)}constructor(e,n,t,s){if(this.version=e,this.errorCorrectionLevel=n,this.modules=[],this.isFunction=[],e<o.MIN_VERSION||e>o.MAX_VERSION)throw new RangeError("Version value out of range");if(s<-1||s>7)throw new RangeError("Mask value out of range");this.size=e*4+17;const l=[];for(let d=0;d<this.size;d++)l.push(!1);for(let d=0;d<this.size;d++)this.modules.push(l.slice()),this.isFunction.push(l.slice());this.drawFunctionPatterns();const f=this.addEccAndInterleave(t);if(this.drawCodewords(f),s==-1){let d=1e9;for(let u=0;u<8;u++){this.applyMask(u),this.drawFormatBits(u);const v=this.getPenaltyScore();v<d&&(s=u,d=v),this.applyMask(u)}}m(0<=s&&s<=7),this.mask=s,this.applyMask(s),this.drawFormatBits(s),this.isFunction=[]}getModule(e,n){return 0<=e&&e<this.size&&0<=n&&n<this.size&&this.modules[n][e]}getModules(){return this.modules}drawFunctionPatterns(){for(let t=0;t<this.size;t++)this.setFunctionModule(6,t,t%2==0),this.setFunctionModule(t,6,t%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const e=this.getAlignmentPatternPositions(),n=e.length;for(let t=0;t<n;t++)for(let s=0;s<n;s++)t==0&&s==0||t==0&&s==n-1||t==n-1&&s==0||this.drawAlignmentPattern(e[t],e[s]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){const n=this.errorCorrectionLevel.formatBits<<3|e;let t=n;for(let l=0;l<10;l++)t=t<<1^(t>>>9)*1335;const s=(n<<10|t)^21522;m(s>>>15==0);for(let l=0;l<=5;l++)this.setFunctionModule(8,l,p(s,l));this.setFunctionModule(8,7,p(s,6)),this.setFunctionModule(8,8,p(s,7)),this.setFunctionModule(7,8,p(s,8));for(let l=9;l<15;l++)this.setFunctionModule(14-l,8,p(s,l));for(let l=0;l<8;l++)this.setFunctionModule(this.size-1-l,8,p(s,l));for(let l=8;l<15;l++)this.setFunctionModule(8,this.size-15+l,p(s,l));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;const n=this.version<<12|e;m(n>>>18==0);for(let t=0;t<18;t++){const s=p(n,t),l=this.size-11+t%3,f=Math.floor(t/3);this.setFunctionModule(l,f,s),this.setFunctionModule(f,l,s)}}drawFinderPattern(e,n){for(let t=-4;t<=4;t++)for(let s=-4;s<=4;s++){const l=Math.max(Math.abs(s),Math.abs(t)),f=e+s,d=n+t;0<=f&&f<this.size&&0<=d&&d<this.size&&this.setFunctionModule(f,d,l!=2&&l!=4)}}drawAlignmentPattern(e,n){for(let t=-2;t<=2;t++)for(let s=-2;s<=2;s++)this.setFunctionModule(e+s,n+t,Math.max(Math.abs(s),Math.abs(t))!=1)}setFunctionModule(e,n,t){this.modules[n][e]=t,this.isFunction[n][e]=!0}addEccAndInterleave(e){const n=this.version,t=this.errorCorrectionLevel;if(e.length!=o.getNumDataCodewords(n,t))throw new RangeError("Invalid argument");const s=o.NUM_ERROR_CORRECTION_BLOCKS[t.ordinal][n],l=o.ECC_CODEWORDS_PER_BLOCK[t.ordinal][n],f=Math.floor(o.getNumRawDataModules(n)/8),d=s-f%s,u=Math.floor(f/s),v=[],M=o.reedSolomonComputeDivisor(l);for(let _=0,C=0;_<s;_++){const R=e.slice(C,C+u-l+(_<d?0:1));C+=R.length;const I=o.reedSolomonComputeRemainder(R,M);_<d&&R.push(0),v.push(R.concat(I))}const y=[];for(let _=0;_<v[0].length;_++)v.forEach((C,R)=>{(_!=u-l||R>=d)&&y.push(C[_])});return m(y.length==f),y}drawCodewords(e){if(e.length!=Math.floor(o.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let n=0;for(let t=this.size-1;t>=1;t-=2){t==6&&(t=5);for(let s=0;s<this.size;s++)for(let l=0;l<2;l++){const f=t-l,u=(t+1&2)==0?this.size-1-s:s;!this.isFunction[u][f]&&n<e.length*8&&(this.modules[u][f]=p(e[n>>>3],7-(n&7)),n++)}}m(n==e.length*8)}applyMask(e){if(e<0||e>7)throw new RangeError("Mask value out of range");for(let n=0;n<this.size;n++)for(let t=0;t<this.size;t++){let s;switch(e){case 0:s=(t+n)%2==0;break;case 1:s=n%2==0;break;case 2:s=t%3==0;break;case 3:s=(t+n)%3==0;break;case 4:s=(Math.floor(t/3)+Math.floor(n/2))%2==0;break;case 5:s=t*n%2+t*n%3==0;break;case 6:s=(t*n%2+t*n%3)%2==0;break;case 7:s=((t+n)%2+t*n%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[n][t]&&s&&(this.modules[n][t]=!this.modules[n][t])}}getPenaltyScore(){let e=0;for(let l=0;l<this.size;l++){let f=!1,d=0;const u=[0,0,0,0,0,0,0];for(let v=0;v<this.size;v++)this.modules[l][v]==f?(d++,d==5?e+=o.PENALTY_N1:d>5&&e++):(this.finderPenaltyAddHistory(d,u),f||(e+=this.finderPenaltyCountPatterns(u)*o.PENALTY_N3),f=this.modules[l][v],d=1);e+=this.finderPenaltyTerminateAndCount(f,d,u)*o.PENALTY_N3}for(let l=0;l<this.size;l++){let f=!1,d=0;const u=[0,0,0,0,0,0,0];for(let v=0;v<this.size;v++)this.modules[v][l]==f?(d++,d==5?e+=o.PENALTY_N1:d>5&&e++):(this.finderPenaltyAddHistory(d,u),f||(e+=this.finderPenaltyCountPatterns(u)*o.PENALTY_N3),f=this.modules[v][l],d=1);e+=this.finderPenaltyTerminateAndCount(f,d,u)*o.PENALTY_N3}for(let l=0;l<this.size-1;l++)for(let f=0;f<this.size-1;f++){const d=this.modules[l][f];d==this.modules[l][f+1]&&d==this.modules[l+1][f]&&d==this.modules[l+1][f+1]&&(e+=o.PENALTY_N2)}let n=0;for(const l of this.modules)n=l.reduce((f,d)=>f+(d?1:0),n);const t=this.size*this.size,s=Math.ceil(Math.abs(n*20-t*10)/t)-1;return m(0<=s&&s<=9),e+=s*o.PENALTY_N4,m(0<=e&&e<=2568888),e}getAlignmentPatternPositions(){if(this.version==1)return[];{const e=Math.floor(this.version/7)+2,n=this.version==32?26:Math.ceil((this.version*4+4)/(e*2-2))*2,t=[6];for(let s=this.size-7;t.length<e;s-=n)t.splice(1,0,s);return t}}static getNumRawDataModules(e){if(e<o.MIN_VERSION||e>o.MAX_VERSION)throw new RangeError("Version number out of range");let n=(16*e+128)*e+64;if(e>=2){const t=Math.floor(e/7)+2;n-=(25*t-10)*t-55,e>=7&&(n-=36)}return m(208<=n&&n<=29648),n}static getNumDataCodewords(e,n){return Math.floor(o.getNumRawDataModules(e)/8)-o.ECC_CODEWORDS_PER_BLOCK[n.ordinal][e]*o.NUM_ERROR_CORRECTION_BLOCKS[n.ordinal][e]}static reedSolomonComputeDivisor(e){if(e<1||e>255)throw new RangeError("Degree out of range");const n=[];for(let s=0;s<e-1;s++)n.push(0);n.push(1);let t=1;for(let s=0;s<e;s++){for(let l=0;l<n.length;l++)n[l]=o.reedSolomonMultiply(n[l],t),l+1<n.length&&(n[l]^=n[l+1]);t=o.reedSolomonMultiply(t,2)}return n}static reedSolomonComputeRemainder(e,n){const t=n.map(s=>0);for(const s of e){const l=s^t.shift();t.push(0),n.forEach((f,d)=>t[d]^=o.reedSolomonMultiply(f,l))}return t}static reedSolomonMultiply(e,n){if(e>>>8||n>>>8)throw new RangeError("Byte out of range");let t=0;for(let s=7;s>=0;s--)t=t<<1^(t>>>7)*285,t^=(n>>>s&1)*e;return m(t>>>8==0),t}finderPenaltyCountPatterns(e){const n=e[1];m(n<=this.size*3);const t=n>0&&e[2]==n&&e[3]==n*3&&e[4]==n&&e[5]==n;return(t&&e[0]>=n*4&&e[6]>=n?1:0)+(t&&e[6]>=n*4&&e[0]>=n?1:0)}finderPenaltyTerminateAndCount(e,n,t){return e&&(this.finderPenaltyAddHistory(n,t),n=0),n+=this.size,this.finderPenaltyAddHistory(n,t),this.finderPenaltyCountPatterns(t)}finderPenaltyAddHistory(e,n){n[0]==0&&(e+=this.size),n.pop(),n.unshift(e)}}o.MIN_VERSION=1,o.MAX_VERSION=40,o.PENALTY_N1=3,o.PENALTY_N2=3,o.PENALTY_N3=40,o.PENALTY_N4=10,o.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],o.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],a.QrCode=o;function r(E,e,n){if(e<0||e>31||E>>>e)throw new RangeError("Value out of range");for(let t=e-1;t>=0;t--)n.push(E>>>t&1)}function p(E,e){return(E>>>e&1)!=0}function m(E){if(!E)throw new Error("Assertion error")}class i{static makeBytes(e){const n=[];for(const t of e)r(t,8,n);return new i(i.Mode.BYTE,e.length,n)}static makeNumeric(e){if(!i.isNumeric(e))throw new RangeError("String contains non-numeric characters");const n=[];for(let t=0;t<e.length;){const s=Math.min(e.length-t,3);r(parseInt(e.substring(t,t+s),10),s*3+1,n),t+=s}return new i(i.Mode.NUMERIC,e.length,n)}static makeAlphanumeric(e){if(!i.isAlphanumeric(e))throw new RangeError("String contains unencodable characters in alphanumeric mode");const n=[];let t;for(t=0;t+2<=e.length;t+=2){let s=i.ALPHANUMERIC_CHARSET.indexOf(e.charAt(t))*45;s+=i.ALPHANUMERIC_CHARSET.indexOf(e.charAt(t+1)),r(s,11,n)}return t<e.length&&r(i.ALPHANUMERIC_CHARSET.indexOf(e.charAt(t)),6,n),new i(i.Mode.ALPHANUMERIC,e.length,n)}static makeSegments(e){return e==""?[]:i.isNumeric(e)?[i.makeNumeric(e)]:i.isAlphanumeric(e)?[i.makeAlphanumeric(e)]:[i.makeBytes(i.toUtf8ByteArray(e))]}static makeEci(e){const n=[];if(e<0)throw new RangeError("ECI assignment value out of range");if(e<128)r(e,8,n);else if(e<16384)r(2,2,n),r(e,14,n);else if(e<1e6)r(6,3,n),r(e,21,n);else throw new RangeError("ECI assignment value out of range");return new i(i.Mode.ECI,0,n)}static isNumeric(e){return i.NUMERIC_REGEX.test(e)}static isAlphanumeric(e){return i.ALPHANUMERIC_REGEX.test(e)}constructor(e,n,t){if(this.mode=e,this.numChars=n,this.bitData=t,n<0)throw new RangeError("Invalid argument");this.bitData=t.slice()}getData(){return this.bitData.slice()}static getTotalBits(e,n){let t=0;for(const s of e){const l=s.mode.numCharCountBits(n);if(s.numChars>=1<<l)return 1/0;t+=4+l+s.bitData.length}return t}static toUtf8ByteArray(e){e=encodeURI(e);const n=[];for(let t=0;t<e.length;t++)e.charAt(t)!="%"?n.push(e.charCodeAt(t)):(n.push(parseInt(e.substring(t+1,t+3),16)),t+=2);return n}}i.NUMERIC_REGEX=/^[0-9]*$/,i.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,i.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",a.QrSegment=i})(S||(S={}));(function(a){(function(o){class r{constructor(m,i){this.ordinal=m,this.formatBits=i}}r.LOW=new r(0,1),r.MEDIUM=new r(1,0),r.QUARTILE=new r(2,3),r.HIGH=new r(3,2),o.Ecc=r})(a.QrCode||(a.QrCode={}))})(S||(S={}));(function(a){(function(o){class r{constructor(m,i){this.modeBits=m,this.numBitsCharCount=i}numCharCountBits(m){return this.numBitsCharCount[Math.floor((m+7)/17)]}}r.NUMERIC=new r(1,[10,12,14]),r.ALPHANUMERIC=new r(2,[9,11,13]),r.BYTE=new r(4,[8,16,16]),r.KANJI=new r(8,[8,10,12]),r.ECI=new r(7,[0,0,0]),o.Mode=r})(a.QrSegment||(a.QrSegment={}))})(S||(S={}));const he={L:S.QrCode.Ecc.LOW,M:S.QrCode.Ecc.MEDIUM,Q:S.QrCode.Ecc.QUARTILE,H:S.QrCode.Ecc.HIGH},oe=128,me="L",pe="#FFFFFF",ge="#000000",ve=!1,Rt=4,At=0,St=.1;function we(a){let o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;const r=[];return a.forEach(function(p,m){let i=null;p.forEach(function(E,e){if(!E&&i!==null){r.push(`M${i+o} ${m+o}h${e-i}v1H${i+o}z`),i=null;return}if(e===p.length-1){if(!E)return;i===null?r.push(`M${e+o},${m+o} h1v1H${e+o}z`):r.push(`M${i+o},${m+o} h${e+1-i}v1H${i+o}z`);return}E&&i===null&&(i=e)})}),r.join("")}function _e(a,o){return a.slice().map((r,p)=>p<o.y||p>=o.y+o.h?r:r.map((m,i)=>i<o.x||i>=o.x+o.w?m:!1))}function be(a,o,r,p){if(p==null)return null;const m=a.length+r*2,i=Math.floor(o*St),E=m/o,e=(p.width||i)*E,n=(p.height||i)*E,t=p.x==null?a.length/2-e/2:p.x*E,s=p.y==null?a.length/2-n/2:p.y*E;let l=null;if(p.excavate){const f=Math.floor(t),d=Math.floor(s),u=Math.ceil(e+t-f),v=Math.ceil(n+s-d);l={x:f,y:d,w:u,h:v}}return{x:t,y:s,h:n,w:e,excavation:l}}function Ee(a,o){return o!=null?Math.floor(o):a?Rt:At}const It=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),Pt=X({name:"QRCodeCanvas",inheritAttrs:!1,props:L(L({},le()),{level:String,bgColor:String,fgColor:String,marginSize:Number}),setup(a,o){let{attrs:r,expose:p}=o;const m=ce(()=>{var n;return(n=a.imageSettings)===null||n===void 0?void 0:n.src}),i=Q(null),E=Q(null),e=Q(!1);return p({toDataURL:(n,t)=>{var s;return(s=i.value)===null||s===void 0?void 0:s.toDataURL(n,t)}}),de(()=>{const{value:n,size:t=oe,level:s=me,bgColor:l=pe,fgColor:f=ge,includeMargin:d=ve,marginSize:u,imageSettings:v}=a;if(i.value!=null){const M=i.value,y=M.getContext("2d");if(!y)return;let _=S.QrCode.encodeText(n,he[s]).getModules();const C=Ee(d,u),R=_.length+C*2,I=be(_,t,C,v),N=E.value,V=e.value&&I!=null&&N!==null&&N.complete&&N.naturalHeight!==0&&N.naturalWidth!==0;V&&I.excavation!=null&&(_=_e(_,I.excavation));const j=window.devicePixelRatio||1;M.height=M.width=t*j;const G=t/R*j;y.scale(G,G),y.fillStyle=l,y.fillRect(0,0,R,R),y.fillStyle=f,It?y.fill(new Path2D(we(_,C))):_.forEach(function(h,g){h.forEach(function(Y,W){Y&&y.fillRect(W+C,g+C,1,1)})}),V&&y.drawImage(N,I.x+C,I.y+C,I.w,I.h)}},{flush:"post"}),Ge(m,()=>{e.value=!1}),()=>{var n;const t=(n=a.size)!==null&&n!==void 0?n:oe,s={height:`${t}px`,width:`${t}px`};let l=null;return m.value!=null&&(l=c("img",{src:m.value,key:m.value,style:{display:"none"},onLoad:()=>{e.value=!0},ref:E},null)),c(H,null,[c("canvas",D(D({},r),{},{style:[s,r.style],ref:i}),null),l])}}}),Nt=X({name:"QRCodeSVG",inheritAttrs:!1,props:L(L({},le()),{color:String,level:String,bgColor:String,fgColor:String,marginSize:Number,title:String}),setup(a){let o=null,r=null,p=null,m=null,i=null,E=null;return de(()=>{const{value:e,size:n=oe,level:t=me,includeMargin:s=ve,marginSize:l,imageSettings:f}=a;o=S.QrCode.encodeText(e,he[t]).getModules(),r=Ee(s,l),p=o.length+r*2,m=be(o,n,r,f),f!=null&&m!=null&&(m.excavation!=null&&(o=_e(o,m.excavation)),E=c("image",{"xlink:href":f.src,height:m.h,width:m.w,x:m.x+r,y:m.y+r,preserveAspectRatio:"none"},null)),i=we(o,r)}),()=>{const e=a.bgColor&&pe,n=a.fgColor&&ge;return c("svg",{height:a.size,width:a.size,viewBox:`0 0 ${p} ${p}`},[!!a.title&&c("title",null,[a.title]),c("path",{fill:e,d:`M0,0 h${p}v${p}H0z`,"shape-rendering":"crispEdges"},null),c("path",{fill:n,d:i,"shape-rendering":"crispEdges"},null),E])}}}),Ot=X({name:"AQrcode",inheritAttrs:!1,props:Mt(),emits:["refresh"],setup(a,o){let{emit:r,attrs:p,expose:m}=o;const[i]=Ke("QRCode"),{prefixCls:E}=Xe("qrcode",a),[e,n]=Et(E),[,t]=We(),s=x();m({toDataURL:(f,d)=>{var u;return(u=s.value)===null||u===void 0?void 0:u.toDataURL(f,d)}});const l=ce(()=>{const{value:f,icon:d="",size:u=160,iconSize:v=40,color:M=t.value.colorText,bgColor:y="transparent",errorLevel:_="M"}=a,C={src:d,x:void 0,y:void 0,height:v,width:v,excavate:!0};return{value:f,size:u-(t.value.paddingSM+t.value.lineWidth)*2,level:_,bgColor:y,fgColor:M,imageSettings:d?C:void 0}});return()=>{const f=E.value;return e(c("div",D(D({},p),{},{style:[p.style,{width:`${a.size}px`,height:`${a.size}px`,backgroundColor:l.value.bgColor}],class:[n.value,f,{[`${f}-borderless`]:!a.bordered}]}),[a.status!=="active"&&c("div",{class:`${f}-mask`},[a.status==="loading"&&c(ht,null,null),a.status==="expired"&&c(H,null,[c("p",{class:`${f}-expired`},[i.value.expired]),c(fe,{type:"link",onClick:d=>r("refresh",d)},{default:()=>[i.value.refresh],icon:()=>c(ue,null,null)})]),a.status==="scanned"&&c("p",{class:`${f}-scanned`},[i.value.scanned])]),a.type==="canvas"?c(Pt,D({ref:s},l.value),null):c(Nt,l.value,null)]))}}}),kt=Ye(Ot),$t={style:{padding:"24px",minHeight:"calc(100vh - 110px)",width:"100%"},class:"charmful"},xt={key:3},Lt={href:"https://freeotp.github.io/",target:"_blank"},Bt=X({__name:"users",setup(a){const{t:o}=qe(),r=Je("$http"),p=x(""),m=x([]),i=x([]),E=x(!1),e=x(!1),n=x(""),t=x(),s=[{label:o("users.administrator"),value:0},{label:o("users.operator"),value:1},{label:o("users.auditor"),value:2}],l=ee({selectedRowKeys:[]}),f=ee({showSizeChanger:!0,showQuickJumper:!0,pageSizeOptions:["10","20","50"],showTotal:h=>o("common.showTotal",{total:h})}),d={id:0,username:"",password:"",role:1,email:"",confirm_password:"",enable_otp:!1,otp:"",otp_url:""},u=ee({...d}),v=async(h,g)=>g===""?Promise.reject(o("users.required")):g!==u.password?Promise.reject(o("users.validator")):Promise.resolve(),M={username:[{required:!0,message:o("common.required"),trigger:"change",transform(h){return h.trim()}}],password:[{required:!0,message:o("common.required"),trigger:"change",transform(h){return h.trim()}}],confirm_password:[{required:!0,validator:v,trigger:"change"}]},y=[{title:"ID",dataIndex:"id",width:"8%",ellipsis:!0},{title:o("users.username"),dataIndex:"username",width:"15%",ellipsis:!0},{title:o("users.role"),dataIndex:"role",width:"10%",align:"center",ellipsis:!0},{title:"OTP",dataIndex:"enable_otp",width:"10%",align:"center",ellipsis:!0},{title:o("common.email"),dataIndex:"email",ellipsis:!0},{title:o("common.updatedAt"),dataIndex:"updated_at",width:"15%",ellipsis:!0},{key:"action",title:o("common.setting"),width:"10%",align:"center",ellipsis:!0}],_=h=>{for(let g of s)if(g.value===h)return g.label;return""},C=h=>{l.selectedRowKeys=h},R=h=>{h?(n.value=o("users.setUser"),u.id=h.id,u.username=h.username,u.email=h.email,u.role=h.role,u.enable_otp=h.enable_otp,u.otp_url=h.otp_url):(n.value=o("users.addUser"),Object.assign(u,d)),e.value=!0},I=h=>{if(h.length===0){B.warn(o("common.delSelected"));return}r({url:"/admin/users",method:"delete",data:{keys:h}}).then(g=>{g.error?B.error(g.error):(l.selectedRowKeys=[],B.success(o("common.delOk")),N(!1))}).catch(g=>{console.log("error",g)})},N=h=>{E.value=!0,r.get("/admin/users").then(g=>{g.error?B.error(g.error):(m.value=g,i.value=g,h&&B.success(o("common.refreshOk"))),E.value=!1})},V=()=>{t.value.validate().then(()=>{r({url:"/admin/users",method:u.id===0?"POST":"PUT",data:u}).then(h=>{h.error?B.error(h.error):(B.success(o("common.submitOk")),t.value.resetFields(),N(!1),e.value=!1)}).catch(h=>{console.log("error",h)})}).catch(h=>{console.log("error",h)})},j=()=>{t.value.resetFields()},G=()=>{p.value!=""?m.value=i.value.filter(h=>h.username.match(p.value)):m.value=i.value};return Ze(()=>{N(!1)}),(h,g)=>{const Y=st,W=ot,q=lt,Z=pt,T=fe,re=Qe,Ce=Le,ye=mt,Me=ut,Re=$e,$=dt,Ae=gt,J=rt,Se=wt,Ie=_t,Pe=kt,Ne=Ue,Oe=ct,ke=xe;return O(),K(H,null,[c(W,{style:{margin:"16px 0"}},{default:w(()=>[c(Y,null,{default:w(()=>[k(P(h.$t("common.navigation")),1)]),_:1}),c(Y,null,{default:w(()=>[k(P(h.$t("menu.users")),1)]),_:1})]),_:1}),te("div",$t,[c(ye,{style:{"margin-bottom":"10px"}},{default:w(()=>[c(Z,{flex:"200px"},{default:w(()=>[c(q,{value:p.value,"onUpdate:value":g[0]||(g[0]=b=>p.value=b),name:"search",placeholder:h.$t("common.search"),onChange:G},{addonAfter:w(()=>[c(A(at),{style:{color:"#00b96b"}})]),_:1},8,["value","placeholder"])]),_:1}),c(Z,{flex:"auto"}),c(Z,{flex:"120px"},{default:w(()=>[c(re,null,{title:w(()=>[k(P(h.$t("common.new")),1)]),default:w(()=>[c(T,{type:"primary",shape:"circle",onClick:g[1]||(g[1]=b=>R(null))},{icon:w(()=>[c(A(it))]),_:1})]),_:1}),c(Ce,{title:h.$t("common.delConfirm"),"ok-text":h.$t("common.ok"),"cancel-text":h.$t("common.cancel"),onConfirm:g[2]||(g[2]=b=>I(l.selectedRowKeys))},{default:w(()=>[c(T,{type:"primary",shape:"circle",style:{"margin-left":"10px"},danger:""},{icon:w(()=>[c(A(Be))]),_:1})]),_:1},8,["title","ok-text","cancel-text"]),c(re,null,{title:w(()=>[k(P(h.$t("common.refresh")),1)]),default:w(()=>[c(T,{type:"primary",shape:"circle",style:{"margin-left":"10px"},onClick:g[3]||(g[3]=b=>N(!0))},{icon:w(()=>[c(A(ue))]),_:1})]),_:1})]),_:1})]),_:1}),c(Re,{dataSource:m.value,columns:y,pagination:f,loading:E.value,rowSelection:{selectedRowKeys:l.selectedRowKeys,onChange:C},rowKey:b=>b.id},{bodyCell:w(({column:b,record:U})=>[b.dataIndex==="enable_otp"?(O(),F(Me,{key:0,color:U.enable_otp?"#87d068":"#ff4d4f"},{default:w(()=>[k(P(U.enable_otp?h.$t("common.on"):h.$t("common.off")),1)]),_:2},1032,["color"])):z("",!0),b.dataIndex==="role"?(O(),K(H,{key:1},[k(P(_(U.role)),1)],64)):z("",!0),b.dataIndex==="updated_at"?(O(),K(H,{key:2},[k(P(A(ze)(U.updated_at,"yyyy-MM-dd HH:mm:ss")),1)],64)):b.key==="action"?(O(),K("span",xt,[c(T,{type:"primary",shape:"circle",onClick:zt=>R(U)},{icon:w(()=>[c(A(Te))]),_:2},1032,["onClick"])])):z("",!0)]),_:1},8,["dataSource","pagination","loading","rowSelection","rowKey"]),c(ke,{open:e.value,"onUpdate:open":g[13]||(g[13]=b=>e.value=b),title:n.value,width:"480px",closable:!1},{default:w(()=>[c(Oe,{layout:"vertical",ref_key:"formRef",ref:t,model:u,rules:M},{default:w(()=>[c($,{label:h.$t("users.username"),"has-feedback":"",name:"username"},{default:w(()=>[c(q,{value:u.username,"onUpdate:value":g[4]||(g[4]=b=>u.username=b),placeholder:h.$t("login.userInput")},{addonBefore:w(()=>[c(A(ft),{style:{color:"#00b96b"}})]),_:1},8,["value","placeholder"])]),_:1},8,["label"]),c($,{label:h.$t("users.role"),name:"role"},{default:w(()=>[c(Ae,{value:u.role,"onUpdate:value":g[5]||(g[5]=b=>u.role=b),options:s},null,8,["value"])]),_:1},8,["label"]),c($,{label:h.$t("common.email"),name:"email"},{default:w(()=>[c(q,{value:u.email,"onUpdate:value":g[6]||(g[6]=b=>u.email=b)},{addonBefore:w(()=>[c(A(se),{style:{color:"#00b96b"}})]),_:1},8,["value"])]),_:1},8,["label"]),c($,{label:h.$t("users.password"),"has-feedback":"",name:"password"},{default:w(()=>[c(J,{value:u.password,"onUpdate:value":g[7]||(g[7]=b=>u.password=b),autocomplete:"off",placeholder:h.$t("login.pwdInput")},{addonBefore:w(()=>[c(A(ae),{style:{color:"#00b96b"}})]),_:1},8,["value","placeholder"])]),_:1},8,["label"]),c($,{label:h.$t("users.confirmPassword"),"has-feedback":"",name:"confirm_password"},{default:w(()=>[c(J,{value:u.confirm_password,"onUpdate:value":g[8]||(g[8]=b=>u.confirm_password=b),autocomplete:"off"},{addonBefore:w(()=>[c(A(ae),{style:{color:"#00b96b"}})]),_:1},8,["value"])]),_:1},8,["label"]),u.otp_url!==""?(O(),F($,{key:0,name:"enable_otp"},{default:w(()=>[c(Se,{checked:u.enable_otp,"onUpdate:checked":g[9]||(g[9]=b=>u.enable_otp=b)},null,8,["checked"]),te("span",null,"  "+P(h.$t("users.enableOtp")),1)]),_:1})):z("",!0),u.enable_otp?(O(),F(Ie,{key:1,message:h.$t("users.info"),type:"info","show-icon":"",style:{margin:"10px 0"}},{action:w(()=>[te("a",Lt,P(h.$t("common.more")),1)]),_:1},8,["message"])):z("",!0),u.enable_otp?(O(),F(Ne,{key:2,style:{display:"flex","justify-content":"center","margin-bottom":"10px"}},{default:w(()=>[c(Pe,{value:u.otp_url,color:"#00b96b"},null,8,["value"])]),_:1})):z("",!0),u.enable_otp?(O(),F($,{key:3,label:"OTP","has-feedback":"",name:"otp"},{default:w(()=>[c(J,{value:u.otp,"onUpdate:value":g[10]||(g[10]=b=>u.otp=b),placeholder:h.$t("login.otpInput"),autocomplete:"off"},{addonBefore:w(()=>[c(A(vt),{style:{color:"#00b96b"}})]),_:1},8,["value","placeholder"])]),_:1})):z("",!0),c($,{style:{"text-align":"center","margin-top":"42px"}},{default:w(()=>[c(T,{type:"primary",shape:"round",onClick:g[11]||(g[11]=b=>V())},{icon:w(()=>[c(A(et))]),default:w(()=>[k(" "+P(h.$t("common.submit")),1)]),_:1}),c(T,{type:"primary",shape:"round",style:{"margin-left":"120px"},onClick:g[12]||(g[12]=b=>j())},{icon:w(()=>[c(A(tt))]),default:w(()=>[k(" "+P(h.$t("common.reset")),1)]),_:1})]),_:1})]),_:1},8,["model"])]),_:1},8,["open","title"])])],64)}}}),Zt=nt(Bt,[["__scopeId","data-v-d9d35f41"]]);export{Zt as default};