选煤厂安全管理系统前端代码
houzhongjian
2024-11-25 37b2044f04a09e89f82f8484279b5f06b7194481
1
2
import{b0 as ot,d as it,as as G,w as Y,r as V,ad as _,o as U,c as B,k as H,B as lt,m as ct,a as S,I as ht,n as R,C as ut,h as dt,ac as gt,a7 as pt,U as ft,H as mt}from"./index-CHTXMeh8.js";const N=(r,t)=>r.push.apply(r,t),C=r=>r.sort((t,e)=>t.i-e.i||t.j-e.j),Z=r=>{const t={};let e=1;return r.forEach(s=>{t[s]=e,e+=1}),t},bt={4:[[1,2],[2,3]],5:[[1,3],[2,3],[2,4]],6:[[1,2],[2,4],[4,5]],7:[[1,3],[2,3],[4,5],[4,6]],8:[[2,4],[4,6]]},X=/^[A-Z\xbf-\xdf][^A-Z\xbf-\xdf]+$/,yt=/^[^A-Z\xbf-\xdf]+[A-Z\xbf-\xdf]$/,wt=/^[A-Z\xbf-\xdf]+$/,K=/^[^a-z\xdf-\xff]+$/,kt=/^[a-z\xdf-\xff]+$/,xt=/^[^A-Z\xbf-\xdf]+$/,Mt=/[a-z\xdf-\xff]/,St=/[A-Z\xbf-\xdf]/,vt=/[^A-Za-z\xbf-\xdf]/gi,It=/^\d+$/,O=new Date().getFullYear(),Tt={recentYear:/19\d\d|200\d|201\d|202\d/g},J=[" ",",",";",":","|","/","\\","_",".","-"],jt=J.length;class At{match({password:t}){const e=[...this.getMatchesWithoutSeparator(t),...this.getMatchesWithSeparator(t)],s=this.filterNoise(e);return C(s)}getMatchesWithSeparator(t){const e=[],s=/^(\d{1,4})([\s/\\_.-])(\d{1,2})\2(\d{1,4})$/;for(let n=0;n<=Math.abs(t.length-6);n+=1)for(let a=n+5;a<=n+9&&!(a>=t.length);a+=1){const o=t.slice(n,+a+1||9e9),i=s.exec(o);if(i!=null){const l=this.mapIntegersToDayMonthYear([parseInt(i[1],10),parseInt(i[3],10),parseInt(i[4],10)]);l!=null&&e.push({pattern:"date",token:o,i:n,j:a,separator:i[2],year:l.year,month:l.month,day:l.day})}}return e}getMatchesWithoutSeparator(t){const e=[],s=/^\d{4,8}$/,n=a=>Math.abs(a.year-O);for(let a=0;a<=Math.abs(t.length-4);a+=1)for(let o=a+3;o<=a+7&&!(o>=t.length);o+=1){const i=t.slice(a,+o+1||9e9);if(s.exec(i)){const l=[],c=i.length;if(bt[c].forEach(([h,d])=>{const g=this.mapIntegersToDayMonthYear([parseInt(i.slice(0,h),10),parseInt(i.slice(h,d),10),parseInt(i.slice(d),10)]);g!=null&&l.push(g)}),l.length>0){let h=l[0],d=n(l[0]);l.slice(1).forEach(g=>{const f=n(g);f<d&&(h=g,d=f)}),e.push({pattern:"date",token:i,i:a,j:o,separator:"",year:h.year,month:h.month,day:h.day})}}}return e}filterNoise(t){return t.filter(e=>{let s=!1;const n=t.length;for(let a=0;a<n;a+=1){const o=t[a];if(e!==o&&o.i<=e.i&&o.j>=e.j){s=!0;break}}return!s})}mapIntegersToDayMonthYear(t){if(t[1]>31||t[1]<=0)return null;let e=0,s=0,n=0;for(let a=0,o=t.length;a<o;a+=1){const i=t[a];if(i>99&&i<1e3||i>2050)return null;i>31&&(s+=1),i>12&&(e+=1),i<=0&&(n+=1)}return s>=2||e===3||n>=2?null:this.getDayMonth(t)}getDayMonth(t){const e=[[t[2],t.slice(0,2)],[t[0],t.slice(1,3)]],s=e.length;for(let n=0;n<s;n+=1){const[a,o]=e[n];if(1e3<=a&&a<=2050){const i=this.mapIntegersToDayMonth(o);return i!=null?{year:a,month:i.month,day:i.day}:null}}for(let n=0;n<s;n+=1){const[a,o]=e[n],i=this.mapIntegersToDayMonth(o);if(i!=null)return{year:this.twoToFourDigitYear(a),month:i.month,day:i.day}}return null}mapIntegersToDayMonth(t){const e=[t,t.slice().reverse()];for(let s=0;s<e.length;s+=1){const n=e[s],a=n[0],o=n[1];if(a>=1&&a<=31&&o>=1&&o<=12)return{day:a,month:o}}return null}twoToFourDigitYear(t){return t>99?t:t>50?t+1900:t+2e3}}const j=new Uint32Array(65536),Ct=(r,t)=>{if(r.length<t.length){const e=t;t=r,r=e}return t.length===0?r.length:r.length<=32?((e,s)=>{const n=e.length,a=s.length,o=1<<n-1;let i=-1,l=0,c=n,h=n;for(;h--;)j[e.charCodeAt(h)]|=1<<h;for(h=0;h<a;h++){let d=j[s.charCodeAt(h)];const g=d|l;d|=(d&i)+i^i,l|=~(d|i),i&=d,l&o&&c++,i&o&&c--,l=l<<1|1,i=i<<1|~(g|l),l&=g}for(h=n;h--;)j[e.charCodeAt(h)]=0;return c})(r,t):((e,s)=>{const n=s.length,a=e.length,o=[],i=[],l=Math.ceil(n/32),c=Math.ceil(a/32);for(let p=0;p<l;p++)i[p]=-1,o[p]=0;let h=0;for(;h<c-1;h++){let p=0,b=-1;const v=32*h,M=Math.min(32,a)+v;for(let m=v;m<M;m++)j[e.charCodeAt(m)]|=1<<m;for(let m=0;m<n;m++){const y=j[s.charCodeAt(m)],w=i[m/32|0]>>>m&1,T=o[m/32|0]>>>m&1,z=y|p,W=((y|T)&b)+b^b|y|T;let D=p|~(W|b),L=b&W;D>>>31^w&&(i[m/32|0]^=1<<m),L>>>31^T&&(o[m/32|0]^=1<<m),D=D<<1|w,L=L<<1|T,b=L|~(z|D),p=D&z}for(let m=v;m<M;m++)j[e.charCodeAt(m)]=0}let d=0,g=-1;const f=32*h,k=Math.min(32,a-f)+f;for(let p=f;p<k;p++)j[e.charCodeAt(p)]|=1<<p;let x=a;for(let p=0;p<n;p++){const b=j[s.charCodeAt(p)],v=i[p/32|0]>>>p&1,M=o[p/32|0]>>>p&1,m=b|d,y=((b|M)&g)+g^g|b|M;let w=d|~(y|g),T=g&y;x+=w>>>a-1&1,x-=T>>>a-1&1,w>>>31^v&&(i[p/32|0]^=1<<p),T>>>31^M&&(o[p/32|0]^=1<<p),w=w<<1|v,T=T<<1|M,g=T|~(m|w),d=w&m}for(let p=f;p<k;p++)j[e.charCodeAt(p)]=0;return x})(r,t)},Dt=(r,t,e)=>{let s=0;const n=Object.keys(t).find(a=>{const o=((c,h,d)=>{const g=c.length<=h.length,f=c.length<=d;return g||f?Math.ceil(c.length/4):d})(r,a,e);if(Math.abs(r.length-a.length)>o)return!1;const i=Ct(r,a),l=i<=o;return l&&(s=i),l});return n?{levenshteinDistance:s,levenshteinDistanceEntry:n}:{}};var Q={a:["4","@"],b:["8"],c:["(","{","[","<"],d:["6","|)"],e:["3"],f:["#"],g:["6","9","&"],h:["#","|-|"],i:["1","!","|"],k:["<","|<"],l:["!","1","|","7"],m:["^^","nn","2n","/\\\\/\\\\"],n:["//"],o:["0","()"],q:["9"],u:["|_|"],s:["$","5"],t:["+","7"],v:["<",">","/"],w:["^/","uu","vv","2u","2v","\\\\/\\\\/"],x:["%","><"],z:["2"]},F={warnings:{straightRow:"straightRow",keyPattern:"keyPattern",simpleRepeat:"simpleRepeat",extendedRepeat:"extendedRepeat",sequences:"sequences",recentYears:"recentYears",dates:"dates",topTen:"topTen",topHundred:"topHundred",common:"common",similarToCommon:"similarToCommon",wordByItself:"wordByItself",namesByThemselves:"namesByThemselves",commonNames:"commonNames",userInputs:"userInputs",pwned:"pwned"},suggestions:{l33t:"l33t",reverseWords:"reverseWords",allUppercase:"allUppercase",capitalization:"capitalization",dates:"dates",recentYears:"recentYears",associatedYears:"associatedYears",sequences:"sequences",repeated:"repeated",longerKeyboardPattern:"longerKeyboardPattern",anotherWord:"anotherWord",useWords:"useWords",noNeed:"noNeed",pwned:"pwned"},timeEstimation:{ltSecond:"ltSecond",second:"second",seconds:"seconds",minute:"minute",minutes:"minutes",hour:"hour",hours:"hours",day:"day",days:"days",month:"month",months:"months",year:"year",years:"years",centuries:"centuries"}};class E{constructor(t=[]){this.parents=t,this.children=new Map}addSub(t,...e){const s=t.charAt(0);this.children.has(s)||this.children.set(s,new E([...this.parents,s]));let n=this.children.get(s);for(let a=1;a<t.length;a+=1){const o=t.charAt(a);n.hasChild(o)||n.addChild(o),n=n.getChild(o)}return n.subs=(n.subs||[]).concat(e),this}getChild(t){return this.children.get(t)}isTerminal(){return!!this.subs}addChild(t){this.hasChild(t)||this.children.set(t,new E([...this.parents,t]))}hasChild(t){return this.children.has(t)}}var tt=(r,t)=>(Object.entries(r).forEach(([e,s])=>{s.forEach(n=>{t.addSub(n,e)})}),t);const u=new class{constructor(){this.matchers={},this.l33tTable=Q,this.trieNodeRoot=tt(Q,new E),this.dictionary={userInputs:[]},this.rankedDictionaries={},this.rankedDictionariesMaxWordSize={},this.translations=F,this.graphs={},this.useLevenshteinDistance=!1,this.levenshteinThreshold=2,this.l33tMaxSubstitutions=100,this.maxLength=256,this.setRankedDictionaries()}setOptions(r={}){r.l33tTable&&(this.l33tTable=r.l33tTable,this.trieNodeRoot=tt(r.l33tTable,new E)),r.dictionary&&(this.dictionary=r.dictionary,this.setRankedDictionaries()),r.translations&&this.setTranslations(r.translations),r.graphs&&(this.graphs=r.graphs),r.useLevenshteinDistance!==void 0&&(this.useLevenshteinDistance=r.useLevenshteinDistance),r.levenshteinThreshold!==void 0&&(this.levenshteinThreshold=r.levenshteinThreshold),r.l33tMaxSubstitutions!==void 0&&(this.l33tMaxSubstitutions=r.l33tMaxSubstitutions),r.maxLength!==void 0&&(this.maxLength=r.maxLength)}setTranslations(r){if(!this.checkCustomTranslations(r))throw new Error("Invalid translations object fallback to keys");this.translations=r}checkCustomTranslations(r){let t=!0;return Object.keys(F).forEach(e=>{if(e in r){const s=e;Object.keys(F[s]).forEach(n=>{n in r[s]||(t=!1)})}else t=!1}),t}setRankedDictionaries(){const r={},t={};Object.keys(this.dictionary).forEach(e=>{r[e]=Z(this.dictionary[e]),t[e]=this.getRankedDictionariesMaxWordSize(this.dictionary[e])}),this.rankedDictionaries=r,this.rankedDictionariesMaxWordSize=t}getRankedDictionariesMaxWordSize(r){const t=r.map(e=>typeof e!="string"?e.toString().length:e.length);return t.length===0?0:t.reduce((e,s)=>Math.max(e,s),-1/0)}buildSanitizedRankedDictionary(r){const t=[];return r.forEach(e=>{const s=typeof e;s!=="string"&&s!=="number"&&s!=="boolean"||t.push(e.toString().toLowerCase())}),Z(t)}extendUserInputsDictionary(r){this.dictionary.userInputs||(this.dictionary.userInputs=[]);const t=[...this.dictionary.userInputs,...r];this.rankedDictionaries.userInputs=this.buildSanitizedRankedDictionary(t),this.rankedDictionariesMaxWordSize.userInputs=this.getRankedDictionariesMaxWordSize(t)}addMatcher(r,t){this.matchers[r]?console.info(`Matcher ${r} already exists`):this.matchers[r]=t}};class Et{constructor(t){this.defaultMatch=t}match({password:t}){const e=t.split("").reverse().join("");return this.defaultMatch({password:e}).map(s=>({...s,token:s.token.split("").reverse().join(""),reversed:!0,i:t.length-1-s.j,j:t.length-1-s.i}))}}class Lt{constructor({substr:t,limit:e,trieRoot:s}){this.buffer=[],this.finalPasswords=[],this.substr=t,this.limit=e,this.trieRoot=s}getAllPossibleSubsAtIndex(t){const e=[];let s=this.trieRoot;for(let n=t;n<this.substr.length;n+=1){const a=this.substr.charAt(n);if(s=s.getChild(a),!s)break;e.push(s)}return e}helper({onlyFullSub:t,isFullSub:e,index:s,subIndex:n,changes:a,lastSubLetter:o,consecutiveSubCount:i}){if(this.finalPasswords.length>=this.limit)return;if(s===this.substr.length)return void(t===e&&this.finalPasswords.push({password:this.buffer.join(""),changes:a}));const l=[...this.getAllPossibleSubsAtIndex(s)];let c=!1;for(let h=s+l.length-1;h>=s;h-=1){const d=l[h-s];if(d.isTerminal()){if(o===d.parents.join("")&&i>=3)continue;c=!0;const g=d.subs;for(const f of g){this.buffer.push(f);const k=a.concat({i:n,letter:f,substitution:d.parents.join("")});if(this.helper({onlyFullSub:t,isFullSub:e,index:h+1,subIndex:n+f.length,changes:k,lastSubLetter:d.parents.join(""),consecutiveSubCount:o===d.parents.join("")?i+1:1}),this.buffer.pop(),this.finalPasswords.length>=this.limit)return}}}if(!t||!c){const h=this.substr.charAt(s);this.buffer.push(h),this.helper({onlyFullSub:t,isFullSub:e&&!c,index:s+1,subIndex:n+1,changes:a,lastSubLetter:o,consecutiveSubCount:i}),this.buffer.pop()}}getAll(){return this.helper({onlyFullSub:!0,isFullSub:!0,index:0,subIndex:0,changes:[],lastSubLetter:void 0,consecutiveSubCount:0}),this.helper({onlyFullSub:!1,isFullSub:!0,index:0,subIndex:0,changes:[],lastSubLetter:void 0,consecutiveSubCount:0}),this.finalPasswords}}class Pt{constructor(t){this.defaultMatch=t}isAlreadyIncluded(t,e){return t.some(s=>Object.entries(s).every(([n,a])=>n==="subs"||a===e[n]))}match({password:t}){const e=[],s=((o,i,l)=>new Lt({substr:o,limit:i,trieRoot:l}).getAll())(t,u.l33tMaxSubstitutions,u.trieNodeRoot);let n=!1,a=!0;return s.forEach(o=>{if(n)return;const i=this.defaultMatch({password:o.password,useLevenshtein:a});a=!1,i.forEach(l=>{n||(n=l.i===0&&l.j===t.length-1);const c=((f,k,x)=>{const p=f.changes.filter(y=>y.i<k).reduce((y,w)=>y-w.letter.length+w.substitution.length,k),b=f.changes.filter(y=>y.i>=k&&y.i<=x),v=b.reduce((y,w)=>y-w.letter.length+w.substitution.length,x-k+p),M=[],m=[];return b.forEach(y=>{M.findIndex(w=>w.letter===y.letter&&w.substitution===y.substitution)<0&&(M.push({letter:y.letter,substitution:y.substitution}),m.push(`${y.substitution} -> ${y.letter}`))}),{i:p,j:v,subs:M,subDisplay:m.join(", ")}})(o,l.i,l.j),h=t.slice(c.i,+c.j+1||9e9),d={...l,l33t:!0,token:h,...c},g=this.isAlreadyIncluded(e,d);h.toLowerCase()===l.matchedWord||g||e.push(d)})}),e.filter(o=>o.token.length>1)}}class Rt{constructor(){this.l33t=new Pt(this.defaultMatch),this.reverse=new Et(this.defaultMatch)}match({password:t}){const e=[...this.defaultMatch({password:t}),...this.reverse.match({password:t}),...this.l33t.match({password:t})];return C(e)}defaultMatch({password:t,useLevenshtein:e=!0}){const s=[],n=t.length,a=t.toLowerCase();return Object.keys(u.rankedDictionaries).forEach(o=>{const i=u.rankedDictionaries[o],l=u.rankedDictionariesMaxWordSize[o],c=Math.min(l,n);for(let h=0;h<n;h+=1){const d=Math.min(h+c,n);for(let g=h;g<d;g+=1){const f=a.slice(h,+g+1||9e9),k=f in i;let x={};const p=h===0&&g===n-1;u.useLevenshteinDistance&&p&&!k&&e&&(x=Dt(f,i,u.levenshteinThreshold));const b=Object.keys(x).length!==0;if(k||b){const v=i[b?x.levenshteinDistanceEntry:f];s.push({pattern:"dictionary",i:h,j:g,token:t.slice(h,+g+1||9e9),matchedWord:f,rank:v,dictionaryName:o,reversed:!1,l33t:!1,...x})}}}}),s}}class Nt{match({password:t,regexes:e=Tt}){const s=[];return Object.keys(e).forEach(n=>{const a=e[n];let o;for(a.lastIndex=0;o=a.exec(t);)if(o){const i=o[0];s.push({pattern:"regex",token:i,i:o.index,j:o.index+o[0].length-1,regexName:n,regexMatch:o})}}),C(s)}}var A={nCk(r,t){let e=r;if(t>e)return 0;if(t===0)return 1;let s=1;for(let n=1;n<=t;n+=1)s*=e,s/=n,e-=1;return s},log10:r=>r===0?0:Math.log(r)/Math.log(10),log2:r=>Math.log(r)/Math.log(2),factorial(r){let t=1;for(let e=2;e<=r;e+=1)t*=e;return t}},Ot=r=>{const t=r.replace(vt,"");if(t.match(xt)||t.toLowerCase()===t)return 1;const e=[X,yt,K],s=e.length;for(let n=0;n<s;n+=1){const a=e[n];if(t.match(a))return 2}return(n=>{const a=n.split(""),o=a.filter(h=>h.match(St)).length,i=a.filter(h=>h.match(Mt)).length;let l=0;const c=Math.min(o,i);for(let h=1;h<=c;h+=1)l+=A.nCk(o+i,h);return l})(t)};const et=(r,t)=>{let e=0,s=r.indexOf(t);for(;s>=0;)e+=1,s=r.indexOf(t,s+t.length);return e};var Ft=({l33t:r,subs:t,token:e})=>{if(!r)return 1;let s=1;return t.forEach(n=>{const{subbedCount:a,unsubbedCount:o}=(({sub:i,token:l})=>{const c=l.toLowerCase();return{subbedCount:et(c,i.substitution),unsubbedCount:et(c,i.letter)}})({sub:n,token:e});if(a===0||o===0)s*=2;else{const i=Math.min(o,a);let l=0;for(let c=1;c<=i;c+=1)l+=A.nCk(o+a,c);s*=l}}),s};const qt=({token:r,graph:t,turns:e})=>{const s=Object.keys(u.graphs[t]).length,n=(i=>{let l=0;return Object.keys(i).forEach(c=>{const h=i[c];l+=h.filter(d=>!!d).length}),l/=Object.entries(i).length,l})(u.graphs[t]);let a=0;const o=r.length;for(let i=2;i<=o;i+=1){const l=Math.min(e,i-1);for(let c=1;c<=l;c+=1)a+=A.nCk(i-1,c-1)*s*n**c}return a},st={bruteforce:({token:r})=>{let t,e=10**r.length;return e===Number.POSITIVE_INFINITY&&(e=Number.MAX_VALUE),t=r.length===1?11:51,Math.max(e,t)},date:({year:r,separator:t})=>{let e=365*Math.max(Math.abs(r-O),20);return t&&(e*=4),e},dictionary:({rank:r,reversed:t,l33t:e,subs:s,token:n,dictionaryName:a})=>{const o=r,i=Ot(n),l=Ft({l33t:e,subs:s,token:n});let c;return c=a==="diceware"?3888:o*i*l*(t?2:1),{baseGuesses:o,uppercaseVariations:i,l33tVariations:l,calculation:c}},regex:({regexName:r,regexMatch:t,token:e})=>{const s={alphaLower:26,alphaUpper:26,alpha:52,alphanumeric:62,digits:10,symbols:33};return r in s?s[r]**e.length:r==="recentYear"?Math.max(Math.abs(parseInt(t[0],10)-O),20):0},repeat:({baseGuesses:r,repeatCount:t})=>r*t,sequence:({token:r,ascending:t})=>{const e=r.charAt(0);let s=0;return s=["a","A","z","Z","0","1","9"].includes(e)?4:e.match(/\d/)?10:26,t||(s*=2),s*r.length},spatial:({graph:r,token:t,shiftedCount:e,turns:s})=>{let n=qt({token:t,graph:r,turns:s});if(e){const a=t.length-e;if(e===0||a===0)n*=2;else{let o=0;for(let i=1;i<=Math.min(e,a);i+=1)o+=A.nCk(e+a,i);n*=o}}return Math.round(n)},separator:()=>jt};var $t=(r,t)=>{const e={};if("guesses"in r&&r.guesses!=null)return r;const s=((i,l)=>{let c=1;return i.token.length<l.length&&(c=i.token.length===1?10:50),c})(r,t),n=((i,l)=>st[i]?st[i](l):u.matchers[i]&&"scoring"in u.matchers[i]?u.matchers[i].scoring(l):0)(r.pattern,r);let a=0;typeof n=="number"?a=n:r.pattern==="dictionary"&&(a=n.calculation,e.baseGuesses=n.baseGuesses,e.uppercaseVariations=n.uppercaseVariations,e.l33tVariations=n.l33tVariations);const o=Math.max(a,s);return{...r,...e,guesses:o,guessesLog10:A.log10(o)}};const I={password:"",optimal:{},excludeAdditive:!1,separatorRegex:void 0,fillArray(r,t){const e=[];for(let s=0;s<r;s+=1){let n=[];t==="object"&&(n={}),e.push(n)}return e},makeBruteforceMatch(r,t){return{pattern:"bruteforce",token:this.password.slice(r,+t+1||9e9),i:r,j:t}},update(r,t){const e=r.j,s=$t(r,this.password);let n=s.guesses;t>1&&(n*=this.optimal.pi[s.i-1][t-1]);let a=A.factorial(t)*n;this.excludeAdditive||(a+=1e4**(t-1));let o=!1;Object.keys(this.optimal.g[e]).forEach(i=>{const l=this.optimal.g[e][i];parseInt(i,10)<=t&&l<=a&&(o=!0)}),o||(this.optimal.g[e][t]=a,this.optimal.m[e][t]=s,this.optimal.pi[e][t]=n)},bruteforceUpdate(r){let t=this.makeBruteforceMatch(0,r);this.update(t,1);for(let e=1;e<=r;e+=1){t=this.makeBruteforceMatch(e,r);const s=this.optimal.m[e-1];Object.keys(s).forEach(n=>{s[n].pattern!=="bruteforce"&&this.update(t,parseInt(n,10)+1)})}},unwind(r){const t=[];let e=r-1,s=0,n=1/0;const a=this.optimal.g[e];for(a&&Object.keys(a).forEach(o=>{const i=a[o];i<n&&(s=parseInt(o,10),n=i)});e>=0;){const o=this.optimal.m[e][s];t.unshift(o),e=o.i-1,s-=1}return t}};var q={mostGuessableMatchSequence(r,t,e=!1){I.password=r,I.excludeAdditive=e;const s=r.length;let n=I.fillArray(s,"array");t.forEach(l=>{n[l.j].push(l)}),n=n.map(l=>l.sort((c,h)=>c.i-h.i)),I.optimal={m:I.fillArray(s,"object"),pi:I.fillArray(s,"object"),g:I.fillArray(s,"object")};for(let l=0;l<s;l+=1)n[l].forEach(c=>{c.i>0?Object.keys(I.optimal.m[c.i-1]).forEach(h=>{I.update(c,parseInt(h,10)+1)}):I.update(c,1)}),I.bruteforceUpdate(l);const a=I.unwind(s),o=a.length,i=this.getGuesses(r,o);return{password:r,guesses:i,guessesLog10:A.log10(i),sequence:a}},getGuesses(r,t){const e=r.length;let s=0;return s=r.length===0?1:I.optimal.g[e-1][t],s}};class zt{match({password:t,omniMatch:e}){const s=[];let n=0;for(;n<t.length;){const a=this.getGreedyMatch(t,n),o=this.getLazyMatch(t,n);if(a==null)break;const{match:i,baseToken:l}=this.setMatchToken(a,o);if(i){const c=i.index+i[0].length-1,h=this.getBaseGuesses(l,e);s.push(this.normalizeMatch(l,c,i,h)),n=c+1}}return s.some(a=>a instanceof Promise)?Promise.all(s):s}normalizeMatch(t,e,s,n){const a={pattern:"repeat",i:s.index,j:e,token:s[0],baseToken:t,baseGuesses:0,repeatCount:s[0].length/t.length};return n instanceof Promise?n.then(o=>({...a,baseGuesses:o})):{...a,baseGuesses:n}}getGreedyMatch(t,e){const s=/(.+)\1+/g;return s.lastIndex=e,s.exec(t)}getLazyMatch(t,e){const s=/(.+?)\1+/g;return s.lastIndex=e,s.exec(t)}setMatchToken(t,e){const s=/^(.+?)\1+$/;let n,a="";if(e&&t[0].length>e[0].length){n=t;const o=s.exec(n[0]);o&&(a=o[1])}else n=e,n&&(a=n[1]);return{match:n,baseToken:a}}getBaseGuesses(t,e){const s=e.match(t);return s instanceof Promise?s.then(n=>q.mostGuessableMatchSequence(t,n).guesses):q.mostGuessableMatchSequence(t,s).guesses}}class Wt{constructor(){this.MAX_DELTA=5}match({password:t}){const e=[];if(t.length===1)return[];let s=0,n=null;const a=t.length;for(let o=1;o<a;o+=1){const i=t.charCodeAt(o)-t.charCodeAt(o-1);if(n==null&&(n=i),i!==n){const l=o-1;this.update({i:s,j:l,delta:n,password:t,result:e}),s=l,n=i}}return this.update({i:s,j:a-1,delta:n,password:t,result:e}),e}update({i:t,j:e,delta:s,password:n,result:a}){if(e-t>1||Math.abs(s)===1){const o=Math.abs(s);if(o>0&&o<=this.MAX_DELTA){const i=n.slice(t,+e+1||9e9),{sequenceName:l,sequenceSpace:c}=this.getSequence(i);return a.push({pattern:"sequence",i:t,j:e,token:n.slice(t,+e+1||9e9),sequenceName:l,sequenceSpace:c,ascending:s>0})}}return null}getSequence(t){let e="unicode",s=26;return kt.test(t)?(e="lower",s=26):wt.test(t)?(e="upper",s=26):It.test(t)&&(e="digits",s=10),{sequenceName:e,sequenceSpace:s}}}class Gt{constructor(){this.SHIFTED_RX=/[~!@#$%^&*()_+QWERTYUIOP{}|ASDFGHJKL:"ZXCVBNM<>?]/}match({password:t}){const e=[];return Object.keys(u.graphs).forEach(s=>{const n=u.graphs[s];N(e,this.helper(t,n,s))}),C(e)}checkIfShifted(t,e,s){return!t.includes("keypad")&&this.SHIFTED_RX.test(e.charAt(s))?1:0}helper(t,e,s){let n;const a=[];let o=0;const i=t.length;for(;o<i-1;){let l=o+1,c=null,h=0;for(n=this.checkIfShifted(s,t,o);;){const d=e[t.charAt(l-1)]||[];let g=!1,f=-1,k=-1;if(l<i){const x=t.charAt(l),p=d.length;for(let b=0;b<p;b+=1){const v=d[b];if(k+=1,v){const M=v.indexOf(x);if(M!==-1){g=!0,f=k,M===1&&(n+=1),c!==f&&(h+=1,c=f);break}}}}if(!g){l-o>2&&a.push({pattern:"spatial",i:o,j:l-1,token:t.slice(o,l),graph:s,turns:h,shiftedCount:n}),o=l;break}l+=1}}return a}}const Yt=new RegExp(`[${J.join("")}]`);class P{static getMostUsedSeparatorChar(t){const e=[...t.split("").filter(n=>Yt.test(n)).reduce((n,a)=>{const o=n.get(a);return o?n.set(a,o+1):n.set(a,1),n},new Map).entries()].sort(([n,a],[o,i])=>i-a);if(!e.length)return;const s=e[0];return s[1]<2?void 0:s[0]}static getSeparatorRegex(t){return new RegExp(`([^${t}
])(${t})(?!${t})`,"g")}match({password:t}){const e=[];if(t.length===0)return e;const s=P.getMostUsedSeparatorChar(t);if(s===void 0)return e;const n=P.getSeparatorRegex(s);for(const a of t.matchAll(n)){if(a.index===void 0)continue;const o=a.index+1;e.push({pattern:"separator",token:s,i:o,j:o})}return e}}class Vt{constructor(){this.matchers={date:At,dictionary:Rt,regex:Nt,repeat:zt,sequence:Wt,spatial:Gt,separator:P}}match(t){const e=[],s=[];return[...Object.keys(this.matchers),...Object.keys(u.matchers)].forEach(n=>{if(!this.matchers[n]&&!u.matchers[n])return;const a=new(this.matchers[n]?this.matchers[n]:u.matchers[n].Matching)().match({password:t,omniMatch:this});a instanceof Promise?(a.then(o=>{N(e,o)}),s.push(a)):N(e,a)}),s.length>0?new Promise((n,a)=>{Promise.all(s).then(()=>{n(C(e))}).catch(o=>{a(o)})}):C(e)}}const _t=2678400,nt=32140800,$={second:1,minute:60,hour:3600,day:86400,month:_t,year:nt,century:100*nt};class Ut{translate(t,e){let s=t;e!==void 0&&e!==1&&(s+="s");const{timeEstimation:n}=u.translations;return n[s].replace("{base}",`${e}`)}estimateAttackTimes(t){const e={onlineThrottling100PerHour:t/.027777777777777776,onlineNoThrottling10PerSecond:t/10,offlineSlowHashing1e4PerSecond:t/1e4,offlineFastHashing1e10PerSecond:t/1e10},s={onlineThrottling100PerHour:"",onlineNoThrottling10PerSecond:"",offlineSlowHashing1e4PerSecond:"",offlineFastHashing1e10PerSecond:""};return Object.keys(e).forEach(n=>{const a=e[n];s[n]=this.displayTime(a)}),{crackTimesSeconds:e,crackTimesDisplay:s,score:this.guessesToScore(t)}}guessesToScore(t){return t<1005?0:t<1000005?1:t<100000005?2:t<10000000005?3:4}displayTime(t){let e,s="centuries";const n=Object.keys($),a=n.findIndex(o=>t<$[o]);return a>-1&&(s=n[a-1],a!==0?e=Math.round(t/$[s]):s="ltSecond"),this.translate(s,e)}}var Bt=()=>null,Ht=()=>({warning:u.translations.warnings.dates,suggestions:[u.translations.suggestions.dates]});const Zt=(r,t)=>{let e=null;const s=r.dictionaryName,n=s==="lastnames"||s.toLowerCase().includes("firstnames");return s==="passwords"?e=((a,o)=>{let i=null;return!o||a.l33t||a.reversed?a.guessesLog10<=4&&(i=u.translations.warnings.similarToCommon):i=a.rank<=10?u.translations.warnings.topTen:a.rank<=100?u.translations.warnings.topHundred:u.translations.warnings.common,i})(r,t):s.includes("wikipedia")?e=((a,o)=>{let i=null;return o&&(i=u.translations.warnings.wordByItself),i})(0,t):n?e=((a,o)=>o?u.translations.warnings.namesByThemselves:u.translations.warnings.commonNames)(0,t):s==="userInputs"&&(e=u.translations.warnings.userInputs),e};var Xt=(r,t)=>{const e=Zt(r,t),s=[],n=r.token;return n.match(X)?s.push(u.translations.suggestions.capitalization):n.match(K)&&n.toLowerCase()!==n&&s.push(u.translations.suggestions.allUppercase),r.reversed&&r.token.length>=4&&s.push(u.translations.suggestions.reverseWords),r.l33t&&s.push(u.translations.suggestions.l33t),{warning:e,suggestions:s}},Kt=r=>r.regexName==="recentYear"?{warning:u.translations.warnings.recentYears,suggestions:[u.translations.suggestions.recentYears,u.translations.suggestions.associatedYears]}:{warning:null,suggestions:[]},Jt=r=>{let t=u.translations.warnings.extendedRepeat;return r.baseToken.length===1&&(t=u.translations.warnings.simpleRepeat),{warning:t,suggestions:[u.translations.suggestions.repeated]}},Qt=()=>({warning:u.translations.warnings.sequences,suggestions:[u.translations.suggestions.sequences]}),te=r=>{let t=u.translations.warnings.keyPattern;return r.turns===1&&(t=u.translations.warnings.straightRow),{warning:t,suggestions:[u.translations.suggestions.longerKeyboardPattern]}},ee=()=>null;const rt={warning:null,suggestions:[]};class se{constructor(){this.matchers={bruteforce:Bt,date:Ht,dictionary:Xt,regex:Kt,repeat:Jt,sequence:Qt,spatial:te,separator:ee},this.defaultFeedback={warning:null,suggestions:[]},this.setDefaultSuggestions()}setDefaultSuggestions(){this.defaultFeedback.suggestions.push(u.translations.suggestions.useWords,u.translations.suggestions.noNeed)}getFeedback(t,e){if(e.length===0)return this.defaultFeedback;if(t>2)return rt;const s=u.translations.suggestions.anotherWord,n=this.getLongestMatch(e);let a=this.getMatchFeedback(n,e.length===1);return a!=null?a.suggestions.unshift(s):a={warning:null,suggestions:[s]},a}getLongestMatch(t){let e=t[0];return t.slice(1).forEach(s=>{s.token.length>e.token.length&&(e=s)}),e}getMatchFeedback(t,e){return this.matchers[t.pattern]?this.matchers[t.pattern](t,e):u.matchers[t.pattern]&&"feedback"in u.matchers[t.pattern]?u.matchers[t.pattern].feedback(t,e):rt}}const at=()=>new Date().getTime(),ne=(r,t)=>{const e=at(),s=(n=>new Vt().match(n))(r);if(s instanceof Promise)throw new Error("You are using a Promised matcher, please use `zxcvbnAsync` for it.");return((n,a,o)=>{const i=new se,l=new Ut,c=q.mostGuessableMatchSequence(a,n),h=at()-o,d=l.estimateAttackTimes(c.guesses);return{calcTime:h,...c,...d,feedback:i.getFeedback(d.score,c.sequence)}})(s,r,e)},re=["data-score"],ae=mt(it({name:"InputPassword",__name:"InputPassword",props:{strength:G.bool.def(!1),modelValue:G.string.def("")},emits:["update:modelValue"],setup(r,{emit:t}){const{getPrefixCls:e}=gt(),s=e("input-password"),n=r;Y(()=>n.modelValue,g=>{g!==S(c)&&(c.value=g)});const{configGlobal:a}={configGlobal:ot("configGlobal",{})},o=t,i=V("password"),l=()=>{i.value=S(i)==="text"?"password":"text"},c=V(n.modelValue);Y(()=>c.value,g=>{o("update:modelValue",g)});const h=_(()=>{const g=S(c),f=ne(S(c));return g?f.score:-1}),d=_(()=>S(i)==="password"?"ep:hide":"ep:view");return(g,f)=>{var p;const k=ft,x=pt;return U(),B("div",{class:R([S(s),`${S(s)}--${(p=S(a))==null?void 0:p.size}`])},[H(x,ct({modelValue:S(c),"onUpdate:modelValue":f[0]||(f[0]=b=>ht(c)?c.value=b:null),type:S(i)},g.$attrs),{suffix:lt(()=>[H(k,{icon:S(d),class:"el-input__icon cursor-pointer",onClick:l},null,8,["icon"])]),_:1},16,["modelValue","type"]),r.strength?(U(),B("div",{key:0,class:R([`${S(s)}__bar`,"relative mb-6px ml-auto mr-auto mt-10px h-6px"])},[ut("div",{class:R(`${S(s)}__bar--fill`),"data-score":S(h)},null,10,re)],2)):dt("",!0)],2)}}}),[["__scopeId","data-v-38c93dba"]]);export{ae as I};