"use strict";(self.webpackChunkprestashop_core_theme_js=self.webpackChunkprestashop_core_theme_js||[]).push([[736],{736:(e,t,s)=>{s.r(t),s.d(t,{Options:()=>T,debounce:()=>tt,zxcvbn:()=>pt,zxcvbnAsync:()=>gt,zxcvbnOptions:()=>A});const n=(e,t)=>e.push.apply(e,t),r=e=>e.sort(((e,t)=>e.i-t.i||e.j-t.j)),a=e=>{const t={};let s=1;return e.forEach((e=>{t[e]=s,s+=1})),t};const o={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]]},i=/^[A-Z\xbf-\xdf][^A-Z\xbf-\xdf]+$/,l=/^[^A-Z\xbf-\xdf]+[A-Z\xbf-\xdf]$/,c=/^[A-Z\xbf-\xdf]+$/,h=/^[^a-z\xdf-\xff]+$/,u=/^[a-z\xdf-\xff]+$/,d=/^[^A-Z\xbf-\xdf]+$/,p=/[a-z\xdf-\xff]/,g=/[A-Z\xbf-\xdf]/,f=/[^A-Za-z\xbf-\xdf]/gi,b=/^\d+$/,m=(new Date).getFullYear(),y={recentYear:/19\d\d|200\d|201\d|202\d/g},w=[" ",",",";",":","|","/","\\","_",".","-"],k=w.length;class x{match({password:e}){const t=[...this.getMatchesWithoutSeparator(e),...this.getMatchesWithSeparator(e)],s=this.filterNoise(t);return r(s)}getMatchesWithSeparator(e){const t=[],s=/^(\d{1,4})([\s/\\_.-])(\d{1,2})\2(\d{1,4})$/;for(let n=0;n<=Math.abs(e.length-6);n+=1)for(let r=n+5;r<=n+9&&!(r>=e.length);r+=1){const a=e.slice(n,+r+1||9e9),o=s.exec(a);if(null!=o){const e=this.mapIntegersToDayMonthYear([parseInt(o[1],10),parseInt(o[3],10),parseInt(o[4],10)]);null!=e&&t.push({pattern:"date",token:a,i:n,j:r,separator:o[2],year:e.year,month:e.month,day:e.day})}}return t}getMatchesWithoutSeparator(e){const t=[],s=/^\d{4,8}$/,n=e=>Math.abs(e.year-m);for(let r=0;r<=Math.abs(e.length-4);r+=1)for(let a=r+3;a<=r+7&&!(a>=e.length);a+=1){const i=e.slice(r,+a+1||9e9);if(s.exec(i)){const e=[],s=i.length;if(o[s].forEach((([t,s])=>{const n=this.mapIntegersToDayMonthYear([parseInt(i.slice(0,t),10),parseInt(i.slice(t,s),10),parseInt(i.slice(s),10)]);null!=n&&e.push(n)})),e.length>0){let s=e[0],o=n(e[0]);e.slice(1).forEach((e=>{const t=n(e);t{let s=!1;const n=e.length;for(let r=0;r=t.j){s=!0;break}}return!s}))}mapIntegersToDayMonthYear(e){if(e[1]>31||e[1]<=0)return null;let t=0,s=0,n=0;for(let r=0,a=e.length;r99&&a<1e3||a>2050)return null;a>31&&(s+=1),a>12&&(t+=1),a<=0&&(n+=1)}return s>=2||3===t||n>=2?null:this.getDayMonth(e)}getDayMonth(e){const t=[[e[2],e.slice(0,2)],[e[0],e.slice(1,3)]],s=t.length;for(let e=0;e=1&&n<=31&&r>=1&&r<=12)return{day:n,month:r}}return null}twoToFourDigitYear(e){return e>99?e:e>50?e+1900:e+2e3}}const v=new Uint32Array(65536),M=(e,t)=>{if(e.length{const s=e.length,n=t.length,r=1<{const s=t.length,n=e.length,r=[],a=[],o=Math.ceil(s/32),i=Math.ceil(n/32);for(let e=0;e>>e&1,l=r[e/32|0]>>>e&1,c=s|o,h=((s|l)&i)+i^i|s|l;let u=o|~(h|i),d=i&h;u>>>31^n&&(a[e/32|0]^=1<>>31^l&&(r[e/32|0]^=1<>>e&1,i=r[e/32|0]>>>e&1,l=s|c,u=((s|i)&h)+h^h|s|i;let d=c|~(u|h),g=h&u;p+=d>>>n-1&1,p-=g>>>n-1&1,d>>>31^o&&(a[e/32|0]^=1<>>31^i&&(r[e/32|0]^=1<{let n=0;const r=Object.keys(t).find((t=>{const r=((e,t,s)=>{const n=e.length<=t.length,r=e.length<=s;return n||r?Math.ceil(e.length/4):s})(e,t,s);if(Math.abs(e.length-t.length)>r)return!1;const a=M(e,t),o=a<=r;return o&&(n=a),o}));return r?{levenshteinDistance:n,levenshteinDistanceEntry:r}:{}};var S={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"]},O={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 I{constructor(e=[]){this.parents=e,this.children=new Map}addSub(e,...t){const s=e.charAt(0);this.children.has(s)||this.children.set(s,new I([...this.parents,s]));let n=this.children.get(s);for(let t=1;t(Object.entries(e).forEach((([e,s])=>{s.forEach((s=>{t.addSub(s,e)}))})),t);class T{constructor(){this.matchers={},this.l33tTable=S,this.trieNodeRoot=P(S,new I),this.dictionary={userInputs:[]},this.rankedDictionaries={},this.rankedDictionariesMaxWordSize={},this.translations=O,this.graphs={},this.useLevenshteinDistance=!1,this.levenshteinThreshold=2,this.l33tMaxSubstitutions=100,this.maxLength=256,this.setRankedDictionaries()}setOptions(e={}){e.l33tTable&&(this.l33tTable=e.l33tTable,this.trieNodeRoot=P(e.l33tTable,new I)),e.dictionary&&(this.dictionary=e.dictionary,this.setRankedDictionaries()),e.translations&&this.setTranslations(e.translations),e.graphs&&(this.graphs=e.graphs),void 0!==e.useLevenshteinDistance&&(this.useLevenshteinDistance=e.useLevenshteinDistance),void 0!==e.levenshteinThreshold&&(this.levenshteinThreshold=e.levenshteinThreshold),void 0!==e.l33tMaxSubstitutions&&(this.l33tMaxSubstitutions=e.l33tMaxSubstitutions),void 0!==e.maxLength&&(this.maxLength=e.maxLength)}setTranslations(e){if(!this.checkCustomTranslations(e))throw new Error("Invalid translations object fallback to keys");this.translations=e}checkCustomTranslations(e){let t=!0;return Object.keys(O).forEach((s=>{if(s in e){const n=s;Object.keys(O[n]).forEach((s=>{s in e[n]||(t=!1)}))}else t=!1})),t}setRankedDictionaries(){const e={},t={};Object.keys(this.dictionary).forEach((s=>{e[s]=a(this.dictionary[s]),t[s]=this.getRankedDictionariesMaxWordSize(this.dictionary[s])})),this.rankedDictionaries=e,this.rankedDictionariesMaxWordSize=t}getRankedDictionariesMaxWordSize(e){const t=e.map((e=>"string"!=typeof e?e.toString().length:e.length));return 0===t.length?0:t.reduce(((e,t)=>Math.max(e,t)),-1/0)}buildSanitizedRankedDictionary(e){const t=[];return e.forEach((e=>{const s=typeof e;"string"!==s&&"number"!==s&&"boolean"!==s||t.push(e.toString().toLowerCase())})),a(t)}extendUserInputsDictionary(e){this.dictionary.userInputs||(this.dictionary.userInputs=[]);const t=[...this.dictionary.userInputs,...e];this.rankedDictionaries.userInputs=this.buildSanitizedRankedDictionary(t),this.rankedDictionariesMaxWordSize.userInputs=this.getRankedDictionariesMaxWordSize(t)}addMatcher(e,t){this.matchers[e]?console.info(`Matcher ${e} already exists`):this.matchers[e]=t}}const A=new T;var C=Object.defineProperty,D=Object.defineProperties,E=Object.getOwnPropertyDescriptors,L=Object.getOwnPropertySymbols,R=Object.prototype.hasOwnProperty,N=Object.prototype.propertyIsEnumerable,z=(e,t,s)=>t in e?C(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;class F{constructor(e){this.defaultMatch=e}match({password:e}){const t=e.split("").reverse().join("");return this.defaultMatch({password:t}).map((t=>{return s=((e,t)=>{for(var s in t||(t={}))R.call(t,s)&&z(e,s,t[s]);if(L)for(var s of L(t))N.call(t,s)&&z(e,s,t[s]);return e})({},t),n={token:t.token.split("").reverse().join(""),reversed:!0,i:e.length-1-t.j,j:e.length-1-t.i},D(s,E(n));var s,n}))}}class q{constructor({substr:e,limit:t,trieRoot:s}){this.buffer=[],this.finalPasswords=[],this.substr=e,this.limit=t,this.trieRoot=s}getAllPossibleSubsAtIndex(e){const t=[];let s=this.trieRoot;for(let n=e;n=this.limit)return;if(s===this.substr.length)return void(e===t&&this.finalPasswords.push({password:this.buffer.join(""),changes:r}));const i=[...this.getAllPossibleSubsAtIndex(s)];let l=!1;for(let c=s+i.length-1;c>=s;c-=1){const h=i[c-s];if(h.isTerminal()){if(a===h.parents.join("")&&o>=3)continue;l=!0;const s=h.subs;for(const i of s){this.buffer.push(i);const s=r.concat({i:n,letter:i,substitution:h.parents.join("")});if(this.helper({onlyFullSub:e,isFullSub:t,index:c+1,subIndex:n+i.length,changes:s,lastSubLetter:h.parents.join(""),consecutiveSubCount:a===h.parents.join("")?o+1:1}),this.buffer.pop(),this.finalPasswords.length>=this.limit)return}}}if(!e||!l){const i=this.substr.charAt(s);this.buffer.push(i),this.helper({onlyFullSub:e,isFullSub:t&&!l,index:s+1,subIndex:n+1,changes:r,lastSubLetter:a,consecutiveSubCount:o}),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}}var W=Object.defineProperty,Y=Object.defineProperties,$=Object.getOwnPropertyDescriptors,G=Object.getOwnPropertySymbols,_=Object.prototype.hasOwnProperty,U=Object.prototype.propertyIsEnumerable,B=(e,t,s)=>t in e?W(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,H=(e,t)=>{for(var s in t||(t={}))_.call(t,s)&&B(e,s,t[s]);if(G)for(var s of G(t))U.call(t,s)&&B(e,s,t[s]);return e};class Z{constructor(e){this.defaultMatch=e}isAlreadyIncluded(e,t){return e.some((e=>Object.entries(e).every((([e,s])=>"subs"===e||s===t[e]))))}match({password:e}){const t=[],s=((e,t,s)=>new q({substr:e,limit:t,trieRoot:s}).getAll())(e,A.l33tMaxSubstitutions,A.trieNodeRoot);let n=!1,r=!0;return s.forEach((s=>{if(n)return;const a=this.defaultMatch({password:s.password,useLevenshtein:r});r=!1,a.forEach((r=>{n||(n=0===r.i&&r.j===e.length-1);const a=((e,t,s)=>{const n=e.changes.filter((e=>e.ie-t.letter.length+t.substitution.length),t),r=e.changes.filter((e=>e.i>=t&&e.i<=s)),a=r.reduce(((e,t)=>e-t.letter.length+t.substitution.length),s-t+n),o=[],i=[];return r.forEach((e=>{o.findIndex((t=>t.letter===e.letter&&t.substitution===e.substitution))<0&&(o.push({letter:e.letter,substitution:e.substitution}),i.push(`${e.substitution} -> ${e.letter}`))})),{i:n,j:a,subs:o,subDisplay:i.join(", ")}})(s,r.i,r.j),o=e.slice(a.i,+a.j+1||9e9),i=H((l=H({},r),Y(l,$({l33t:!0,token:o}))),a);var l;const c=this.isAlreadyIncluded(t,i);o.toLowerCase()===r.matchedWord||c||t.push(i)}))})),t.filter((e=>e.token.length>1))}}var V=Object.defineProperty,X=Object.getOwnPropertySymbols,K=Object.prototype.hasOwnProperty,J=Object.prototype.propertyIsEnumerable,Q=(e,t,s)=>t in e?V(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,ee=(e,t)=>{for(var s in t||(t={}))K.call(t,s)&&Q(e,s,t[s]);if(X)for(var s of X(t))J.call(t,s)&&Q(e,s,t[s]);return e};class te{constructor(){this.l33t=new Z(this.defaultMatch),this.reverse=new F(this.defaultMatch)}match({password:e}){const t=[...this.defaultMatch({password:e}),...this.reverse.match({password:e}),...this.l33t.match({password:e})];return r(t)}defaultMatch({password:e,useLevenshtein:t=!0}){const s=[],n=e.length,r=e.toLowerCase();return Object.keys(A.rankedDictionaries).forEach((a=>{const o=A.rankedDictionaries[a],i=A.rankedDictionariesMaxWordSize[a],l=Math.min(i,n);for(let i=0;i{const r=t[n];let a;for(r.lastIndex=0;a=r.exec(e);)if(a){const e=a[0];s.push({pattern:"regex",token:e,i:a.index,j:a.index+a[0].length-1,regexName:n,regexMatch:a})}})),r(s)}}var ne={nCk(e,t){let s=e;if(t>s)return 0;if(0===t)return 1;let n=1;for(let e=1;e<=t;e+=1)n*=s,n/=e,s-=1;return n},log10:e=>0===e?0:Math.log(e)/Math.log(10),log2:e=>Math.log(e)/Math.log(2),factorial(e){let t=1;for(let s=2;s<=e;s+=1)t*=s;return t}},re=Math.pow;var ae=e=>{const t=e.replace(f,"");if(t.match(d)||t.toLowerCase()===t)return 1;const s=[i,l,h],n=s.length;for(let e=0;e{const t=e.split(""),s=t.filter((e=>e.match(g))).length,n=t.filter((e=>e.match(p))).length;let r=0;const a=Math.min(s,n);for(let e=1;e<=a;e+=1)r+=ne.nCk(s+n,e);return r})(t)};const oe=(e,t)=>{let s=0,n=e.indexOf(t);for(;n>=0;)s+=1,n=e.indexOf(t,n+t.length);return s};var ie=({l33t:e,subs:t,token:s})=>{if(!e)return 1;let n=1;return t.forEach((e=>{const{subbedCount:t,unsubbedCount:r}=(({sub:e,token:t})=>{const s=t.toLowerCase();return{subbedCount:oe(s,e.substitution),unsubbedCount:oe(s,e.letter)}})({sub:e,token:s});if(0===t||0===r)n*=2;else{const e=Math.min(r,t);let s=0;for(let n=1;n<=e;n+=1)s+=ne.nCk(r+t,n);n*=s}})),n},le=Math.pow,ce=Math.pow,he=Math.pow;const ue=({token:e,graph:t,turns:s})=>{const n=Object.keys(A.graphs[t]).length,r=(e=>{let t=0;return Object.keys(e).forEach((s=>{const n=e[s];t+=n.filter((e=>!!e)).length})),t/=Object.entries(e).length,t})(A.graphs[t]);let a=0;const o=e.length;for(let e=2;e<=o;e+=1){const t=Math.min(s,e-1);for(let s=1;s<=t;s+=1)a+=ne.nCk(e-1,s-1)*n*he(r,s)}return a};var de=Object.defineProperty,pe=Object.defineProperties,ge=Object.getOwnPropertyDescriptors,fe=Object.getOwnPropertySymbols,be=Object.prototype.hasOwnProperty,me=Object.prototype.propertyIsEnumerable,ye=(e,t,s)=>t in e?de(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,we=(e,t)=>{for(var s in t||(t={}))be.call(t,s)&&ye(e,s,t[s]);if(fe)for(var s of fe(t))me.call(t,s)&&ye(e,s,t[s]);return e};const ke={bruteforce:({token:e})=>{let t,s=re(10,e.length);return s===Number.POSITIVE_INFINITY&&(s=Number.MAX_VALUE),t=1===e.length?11:51,Math.max(s,t)},date:({year:e,separator:t})=>{let s=365*Math.max(Math.abs(e-m),20);return t&&(s*=4),s},dictionary:({rank:e,reversed:t,l33t:s,subs:n,token:r,dictionaryName:a})=>{const o=e,i=ae(r),l=ie({l33t:s,subs:n,token:r}),c=t?2:1;let h;return h="diceware"===a?le(6,5)/2:o*i*l*c,{baseGuesses:o,uppercaseVariations:i,l33tVariations:l,calculation:h}},regex:({regexName:e,regexMatch:t,token:s})=>{const n={alphaLower:26,alphaUpper:26,alpha:52,alphanumeric:62,digits:10,symbols:33};return e in n?ce(n[e],s.length):"recentYear"===e?Math.max(Math.abs(parseInt(t[0],10)-m),20):0},repeat:({baseGuesses:e,repeatCount:t})=>e*t,sequence:({token:e,ascending:t})=>{const s=e.charAt(0);let n=0;return n=["a","A","z","Z","0","1","9"].includes(s)?4:s.match(/\d/)?10:26,t||(n*=2),n*e.length},spatial:({graph:e,token:t,shiftedCount:s,turns:n})=>{let r=ue({token:t,graph:e,turns:n});if(s){const e=t.length-s;if(0===s||0===e)r*=2;else{let t=0;for(let n=1;n<=Math.min(s,e);n+=1)t+=ne.nCk(s+e,n);r*=t}}return Math.round(r)},separator:()=>k};var xe=(e,t)=>{const s={};if("guesses"in e&&null!=e.guesses)return e;const n=((e,t)=>{let s=1;return e.token.lengthke[e]?ke[e](t):A.matchers[e]&&"scoring"in A.matchers[e]?A.matchers[e].scoring(t):0)(e.pattern,e);let a=0;"number"==typeof r?a=r:"dictionary"===e.pattern&&(a=r.calculation,s.baseGuesses=r.baseGuesses,s.uppercaseVariations=r.uppercaseVariations,s.l33tVariations=r.l33tVariations);const o=Math.max(a,n);return i=we(we({},e),s),l={guesses:o,guessesLog10:ne.log10(o)},pe(i,ge(l));var i,l},ve=Math.pow;const Me={password:"",optimal:{},excludeAdditive:!1,separatorRegex:void 0,fillArray(e,t){const s=[];for(let n=0;n1&&(r*=this.optimal.pi[n.i-1][t-1]);let a=ne.factorial(t)*r;this.excludeAdditive||(a+=ve(1e4,t-1));let o=!1;Object.keys(this.optimal.g[s]).forEach((e=>{const n=this.optimal.g[s][e];parseInt(e,10)<=t&&n<=a&&(o=!0)})),o||(this.optimal.g[s][t]=a,this.optimal.m[s][t]=n,this.optimal.pi[s][t]=r)},bruteforceUpdate(e){let t=this.makeBruteforceMatch(0,e);this.update(t,1);for(let s=1;s<=e;s+=1){t=this.makeBruteforceMatch(s,e);const n=this.optimal.m[s-1];Object.keys(n).forEach((e=>{"bruteforce"!==n[e].pattern&&this.update(t,parseInt(e,10)+1)}))}},unwind(e){const t=[];let s=e-1,n=0,r=1/0;const a=this.optimal.g[s];for(a&&Object.keys(a).forEach((e=>{const t=a[e];t=0;){const e=this.optimal.m[s][n];t.unshift(e),s=e.i-1,n-=1}return t}};var je={mostGuessableMatchSequence(e,t,s=!1){Me.password=e,Me.excludeAdditive=s;const n=e.length;let r=Me.fillArray(n,"array");t.forEach((e=>{r[e.j].push(e)})),r=r.map((e=>e.sort(((e,t)=>e.i-t.i)))),Me.optimal={m:Me.fillArray(n,"object"),pi:Me.fillArray(n,"object"),g:Me.fillArray(n,"object")};for(let e=0;e{e.i>0?Object.keys(Me.optimal.m[e.i-1]).forEach((t=>{Me.update(e,parseInt(t,10)+1)})):Me.update(e,1)})),Me.bruteforceUpdate(e);const a=Me.unwind(n),o=a.length,i=this.getGuesses(e,o);return{password:e,guesses:i,guessesLog10:ne.log10(i),sequence:a}},getGuesses(e,t){const s=e.length;let n=0;return n=0===e.length?1:Me.optimal.g[s-1][t],n}},Se=Object.defineProperty,Oe=Object.defineProperties,Ie=Object.getOwnPropertyDescriptors,Pe=Object.getOwnPropertySymbols,Te=Object.prototype.hasOwnProperty,Ae=Object.prototype.propertyIsEnumerable,Ce=(e,t,s)=>t in e?Se(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,De=(e,t)=>{for(var s in t||(t={}))Te.call(t,s)&&Ce(e,s,t[s]);if(Pe)for(var s of Pe(t))Ae.call(t,s)&&Ce(e,s,t[s]);return e},Ee=(e,t)=>Oe(e,Ie(t));class Le{match({password:e,omniMatch:t}){const s=[];let n=0;for(;ne instanceof Promise))?Promise.all(s):s}normalizeMatch(e,t,s,n){const r={pattern:"repeat",i:s.index,j:t,token:s[0],baseToken:e,baseGuesses:0,repeatCount:s[0].length/e.length};return n instanceof Promise?n.then((e=>Ee(De({},r),{baseGuesses:e}))):Ee(De({},r),{baseGuesses:n})}getGreedyMatch(e,t){const s=/(.+)\1+/g;return s.lastIndex=t,s.exec(e)}getLazyMatch(e,t){const s=/(.+?)\1+/g;return s.lastIndex=t,s.exec(e)}setMatchToken(e,t){const s=/^(.+?)\1+$/;let n,r="";if(t&&e[0].length>t[0].length){n=e;const t=s.exec(n[0]);t&&(r=t[1])}else n=t,n&&(r=n[1]);return{match:n,baseToken:r}}getBaseGuesses(e,t){const s=t.match(e);if(s instanceof Promise)return s.then((t=>je.mostGuessableMatchSequence(e,t).guesses));return je.mostGuessableMatchSequence(e,s).guesses}}class Re{constructor(){this.MAX_DELTA=5}match({password:e}){const t=[];if(1===e.length)return[];let s=0,n=null;const r=e.length;for(let a=1;a1||1===Math.abs(s)){const a=Math.abs(s);if(a>0&&a<=this.MAX_DELTA){const a=n.slice(e,+t+1||9e9),{sequenceName:o,sequenceSpace:i}=this.getSequence(a);return r.push({pattern:"sequence",i:e,j:t,token:n.slice(e,+t+1||9e9),sequenceName:o,sequenceSpace:i,ascending:s>0})}}return null}getSequence(e){let t="unicode",s=26;return u.test(e)?(t="lower",s=26):c.test(e)?(t="upper",s=26):b.test(e)&&(t="digits",s=10),{sequenceName:t,sequenceSpace:s}}}class Ne{constructor(){this.SHIFTED_RX=/[~!@#$%^&*()_+QWERTYUIOP{}|ASDFGHJKL:"ZXCVBNM<>?]/}match({password:e}){const t=[];return Object.keys(A.graphs).forEach((s=>{const r=A.graphs[s];n(t,this.helper(e,r,s))})),r(t)}checkIfShifted(e,t,s){return!e.includes("keypad")&&this.SHIFTED_RX.test(t.charAt(s))?1:0}helper(e,t,s){let n;const r=[];let a=0;const o=e.length;for(;a2&&r.push({pattern:"spatial",i:a,j:i-1,token:e.slice(a,i),graph:s,turns:c,shiftedCount:n}),a=i;break}i+=1}}return r}}const ze=new RegExp(`[${w.join("")}]`);class Fe{static getMostUsedSeparatorChar(e){const t=[...e.split("").filter((e=>ze.test(e))).reduce(((e,t)=>{const s=e.get(t);return s?e.set(t,s+1):e.set(t,1),e}),new Map).entries()].sort((([e,t],[s,n])=>n-t));if(!t.length)return;const s=t[0];return s[1]<2?void 0:s[0]}static getSeparatorRegex(e){return new RegExp(`([^${e}\n])(${e})(?!${e})`,"g")}match({password:e}){const t=[];if(0===e.length)return t;const s=Fe.getMostUsedSeparatorChar(e);if(void 0===s)return t;const n=Fe.getSeparatorRegex(s);for(const r of e.matchAll(n)){if(void 0===r.index)continue;const e=r.index+1;t.push({pattern:"separator",token:s,i:e,j:e})}return t}}class qe{constructor(){this.matchers={date:x,dictionary:te,regex:se,repeat:Le,sequence:Re,spatial:Ne,separator:Fe}}match(e){const t=[],s=[];return[...Object.keys(this.matchers),...Object.keys(A.matchers)].forEach((r=>{if(!this.matchers[r]&&!A.matchers[r])return;const a=(new(this.matchers[r]?this.matchers[r]:A.matchers[r].Matching)).match({password:e,omniMatch:this});a instanceof Promise?(a.then((e=>{n(t,e)})),s.push(a)):n(t,a)})),s.length>0?new Promise(((e,n)=>{Promise.all(s).then((()=>{e(r(t))})).catch((e=>{n(e)}))})):r(t)}}const We=2678400,Ye=32140800,$e={second:1,minute:60,hour:3600,day:86400,month:We,year:Ye,century:100*Ye};class Ge{translate(e,t){let s=e;void 0!==t&&1!==t&&(s+="s");const{timeEstimation:n}=A.translations;return n[s].replace("{base}",`${t}`)}estimateAttackTimes(e){const t={onlineThrottling100PerHour:e/(100/3600),onlineNoThrottling10PerSecond:e/10,offlineSlowHashing1e4PerSecond:e/1e4,offlineFastHashing1e10PerSecond:e/1e10},s={onlineThrottling100PerHour:"",onlineNoThrottling10PerSecond:"",offlineSlowHashing1e4PerSecond:"",offlineFastHashing1e10PerSecond:""};return Object.keys(t).forEach((e=>{const n=t[e];s[e]=this.displayTime(n)})),{crackTimesSeconds:t,crackTimesDisplay:s,score:this.guessesToScore(e)}}guessesToScore(e){return e<1005?0:e<1000005?1:e<100000005?2:e<10000000005?3:4}displayTime(e){let t,s="centuries";const n=Object.keys($e),r=n.findIndex((t=>e<$e[t]));return r>-1&&(s=n[r-1],0!==r?t=Math.round(e/$e[s]):s="ltSecond"),this.translate(s,t)}}var _e=()=>null,Ue=()=>({warning:A.translations.warnings.dates,suggestions:[A.translations.suggestions.dates]});const Be=(e,t)=>{let s=null;const n=e.dictionaryName,r="lastnames"===n||n.toLowerCase().includes("firstnames");return"passwords"===n?s=((e,t)=>{let s=null;return!t||e.l33t||e.reversed?e.guessesLog10<=4&&(s=A.translations.warnings.similarToCommon):s=e.rank<=10?A.translations.warnings.topTen:e.rank<=100?A.translations.warnings.topHundred:A.translations.warnings.common,s})(e,t):n.includes("wikipedia")?s=((e,t)=>{let s=null;return t&&(s=A.translations.warnings.wordByItself),s})(0,t):r?s=((e,t)=>t?A.translations.warnings.namesByThemselves:A.translations.warnings.commonNames)(0,t):"userInputs"===n&&(s=A.translations.warnings.userInputs),s};var He=(e,t)=>{const s=Be(e,t),n=[],r=e.token;return r.match(i)?n.push(A.translations.suggestions.capitalization):r.match(h)&&r.toLowerCase()!==r&&n.push(A.translations.suggestions.allUppercase),e.reversed&&e.token.length>=4&&n.push(A.translations.suggestions.reverseWords),e.l33t&&n.push(A.translations.suggestions.l33t),{warning:s,suggestions:n}},Ze=e=>"recentYear"===e.regexName?{warning:A.translations.warnings.recentYears,suggestions:[A.translations.suggestions.recentYears,A.translations.suggestions.associatedYears]}:{warning:null,suggestions:[]},Ve=e=>{let t=A.translations.warnings.extendedRepeat;return 1===e.baseToken.length&&(t=A.translations.warnings.simpleRepeat),{warning:t,suggestions:[A.translations.suggestions.repeated]}},Xe=()=>({warning:A.translations.warnings.sequences,suggestions:[A.translations.suggestions.sequences]}),Ke=e=>{let t=A.translations.warnings.keyPattern;return 1===e.turns&&(t=A.translations.warnings.straightRow),{warning:t,suggestions:[A.translations.suggestions.longerKeyboardPattern]}},Je=()=>null;const Qe={warning:null,suggestions:[]};class et{constructor(){this.matchers={bruteforce:_e,date:Ue,dictionary:He,regex:Ze,repeat:Ve,sequence:Xe,spatial:Ke,separator:Je},this.defaultFeedback={warning:null,suggestions:[]},this.setDefaultSuggestions()}setDefaultSuggestions(){this.defaultFeedback.suggestions.push(A.translations.suggestions.useWords,A.translations.suggestions.noNeed)}getFeedback(e,t){if(0===t.length)return this.defaultFeedback;if(e>2)return Qe;const s=A.translations.suggestions.anotherWord,n=this.getLongestMatch(t);let r=this.getMatchFeedback(n,1===t.length);return null!=r?r.suggestions.unshift(s):r={warning:null,suggestions:[s]},r}getLongestMatch(e){let t=e[0];return e.slice(1).forEach((e=>{e.token.length>t.token.length&&(t=e)})),t}getMatchFeedback(e,t){return this.matchers[e.pattern]?this.matchers[e.pattern](e,t):A.matchers[e.pattern]&&"feedback"in A.matchers[e.pattern]?A.matchers[e.pattern].feedback(e,t):Qe}}var tt=(e,t,s)=>{let n;return function(...r){const a=this,o=s&&!n;if(void 0!==n&&clearTimeout(n),n=setTimeout((()=>{n=void 0,s||e.apply(a,r)}),t),o)return e.apply(a,r)}},st=Object.defineProperty,nt=Object.defineProperties,rt=Object.getOwnPropertyDescriptors,at=Object.getOwnPropertySymbols,ot=Object.prototype.hasOwnProperty,it=Object.prototype.propertyIsEnumerable,lt=(e,t,s)=>t in e?st(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,ct=(e,t)=>{for(var s in t||(t={}))ot.call(t,s)&<(e,s,t[s]);if(at)for(var s of at(t))it.call(t,s)&<(e,s,t[s]);return e};const ht=()=>(new Date).getTime(),ut=(e,t,s)=>{const n=new et,r=new Ge,a=je.mostGuessableMatchSequence(t,e),o=ht()-s,i=r.estimateAttackTimes(a.guesses);return l=ct(ct({calcTime:o},a),i),c={feedback:n.getFeedback(i.score,a.sequence)},nt(l,rt(c));var l,c},dt=(e,t)=>{t&&A.extendUserInputsDictionary(t);return(new qe).match(e)},pt=(e,t)=>{const s=ht(),n=dt(e,t);if(n instanceof Promise)throw new Error("You are using a Promised matcher, please use `zxcvbnAsync` for it.");return ut(n,e,s)},gt=(e,t)=>{return s=void 0,n=null,r=function*(){const s=e.substring(0,A.maxLength),n=ht(),r=yield dt(s,t);return ut(r,s,n)},new Promise(((e,t)=>{var a=e=>{try{i(r.next(e))}catch(e){t(e)}},o=e=>{try{i(r.throw(e))}catch(e){t(e)}},i=t=>t.done?e(t.value):Promise.resolve(t.value).then(a,o);i((r=r.apply(s,n)).next())}));var s,n,r}}}]);