UNPKG

@clerk/shared

Version:

Internal package utils used by the Clerk SDKs

1 lines 1.47 kB
{"version":3,"file":"loadZxcvbn.mjs","names":[],"sources":["../../../../src/internal/clerk-js/passwords/loadZxcvbn.ts"],"sourcesContent":["import type { ModuleManager } from '@/moduleManager';\nimport type { ZxcvbnResult } from '@/types';\n\nexport type zxcvbnFN = (password: string, userInputs?: (string | number)[]) => ZxcvbnResult;\n\nexport const createLoadZxcvbn = (moduleManager: ModuleManager) => {\n const loadZxcvbn = () => {\n return Promise.all([\n moduleManager.import('@zxcvbn-ts/core'),\n moduleManager.import('@zxcvbn-ts/language-common'),\n ]).then(([coreModule, languageCommonModule]) => {\n if (!coreModule || !languageCommonModule) {\n throw new Error('Failed to load zxcvbn modules');\n }\n const { zxcvbnOptions, zxcvbn } = coreModule;\n const { dictionary, adjacencyGraphs } = languageCommonModule;\n zxcvbnOptions.setOptions({\n dictionary: {\n ...dictionary,\n },\n graphs: adjacencyGraphs,\n });\n return zxcvbn;\n });\n };\n\n return { loadZxcvbn };\n};\n"],"mappings":";AAKA,MAAa,oBAAoB,kBAAiC;CAChE,MAAM,mBAAmB;EACvB,OAAO,QAAQ,IAAI,CACjB,cAAc,OAAO,iBAAiB,GACtC,cAAc,OAAO,4BAA4B,CACnD,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,0BAA0B;GAC9C,IAAI,CAAC,cAAc,CAAC,sBAClB,MAAM,IAAI,MAAM,+BAA+B;GAEjD,MAAM,EAAE,eAAe,WAAW;GAClC,MAAM,EAAE,YAAY,oBAAoB;GACxC,cAAc,WAAW;IACvB,YAAY,EACV,GAAG,WACL;IACA,QAAQ;GACV,CAAC;GACD,OAAO;EACT,CAAC;CACH;CAEA,OAAO,EAAE,WAAW;AACtB"}