const { zxcvbn, zxcvbnOptions } = require('@zxcvbn-ts/core');
const { dictionary: commonDictionary, adjacencyGraphs } = require('@zxcvbn-ts/language-common');
const { dictionary: enDictionary, translations } = require('@zxcvbn-ts/language-en');

zxcvbnOptions.setOptions({
    dictionary: {
        ...commonDictionary,
        ...enDictionary,
    },
    graphs: adjacencyGraphs,
    translations,
});

// Called from Go via goja
globalThis.zxcvbnScore = function (password) {
    return zxcvbn(password).score;
};
