2018-10-03 20:01:35 -04:00
|
|
|
'use strict';
|
|
|
|
var __extends = (this && this.__extends) || (function () {
|
|
|
|
var extendStatics = Object.setPrototypeOf ||
|
|
|
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
|
|
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
|
|
return function (d, b) {
|
|
|
|
extendStatics(d, b);
|
|
|
|
function __() { this.constructor = d; }
|
|
|
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
|
|
};
|
|
|
|
})();
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
|
var wordlist_1 = require("../utils/wordlist");
|
|
|
|
var utf8_1 = require("../utils/utf8");
|
2018-11-09 14:42:29 -05:00
|
|
|
var errors_1 = require("../errors");
|
2018-10-03 20:01:35 -04:00
|
|
|
var words = "AbaisserAbandonAbdiquerAbeilleAbolirAborderAboutirAboyerAbrasifAbreuverAbriterAbrogerAbruptAbsenceAbsoluAbsurdeAbusifAbyssalAcade/mieAcajouAcarienAccablerAccepterAcclamerAccoladeAccrocheAccuserAcerbeAchatAcheterAcidulerAcierAcompteAcque/rirAcronymeActeurActifActuelAdepteAde/quatAdhe/sifAdjectifAdjugerAdmettreAdmirerAdopterAdorerAdoucirAdresseAdroitAdulteAdverbeAe/rerAe/ronefAffaireAffecterAfficheAffreuxAffublerAgacerAgencerAgileAgiterAgraferAgre/ableAgrumeAiderAiguilleAilierAimableAisanceAjouterAjusterAlarmerAlchimieAlerteAlge-breAlgueAlie/nerAlimentAlle/gerAlliageAllouerAllumerAlourdirAlpagaAltesseAlve/oleAmateurAmbiguAmbreAme/nagerAmertumeAmidonAmiralAmorcerAmourAmovibleAmphibieAmpleurAmusantAnalyseAnaphoreAnarchieAnatomieAncienAne/antirAngleAngoisseAnguleuxAnimalAnnexerAnnonceAnnuelAnodinAnomalieAnonymeAnormalAntenneAntidoteAnxieuxApaiserApe/ritifAplanirApologieAppareilAppelerApporterAppuyerAquariumAqueducArbitreArbusteArdeurArdoiseArgentArlequinArmatureArmementArmoireArmureArpenterArracherArriverArroserArsenicArte/rielArticleAspectAsphalteAspirerAssautAsservirAssietteAssocierAssurerAsticotAstreAstuceAtelierAtomeAtriumAtroceAttaqueAttentifAttirerAttraperAubaineAubergeAudaceAudibleAugurerAuroreAutomneAutrucheAvalerAvancerAvariceAvenirAverseAveugleAviateurAvideAvionAviserAvoineAvouerAvrilAxialAxiomeBadgeBafouerBagageBaguetteBaignadeBalancerBalconBaleineBalisageBambinBancaireBandageBanlieueBannie-reBanquierBarbierBarilBaronBarqueBarrageBassinBastionBatailleBateauBatterieBaudrierBavarderBeletteBe/lierBeloteBe/ne/ficeBerceauBergerBerlineBermudaBesaceBesogneBe/tailBeurreBiberonBicycleBiduleBijouBilanBilingueBillardBinaireBiologieBiopsieBiotypeBiscuitBisonBistouriBitumeBizarreBlafardBlagueBlanchirBlessantBlinderBlondBloquerBlousonBobardBobineBoireBoiserBolideBonbonBondirBonheurBonifierBonusBordureBorneBotteBoucleBoueuxBougieBoulonBouquinBourseBoussoleBoutiqueBoxeurBrancheBrasierBraveBrebisBre-cheBreuvageBricolerBrigadeBrillantBriocheBriqueBrochureBroderBronzerBrousseBroyeurBrumeBrusqueBrutalBruyantBuffleBuissonBulletinBureauBurinBustierButinerButoirBuvableBuvetteCabanonCabineCachetteCadeauCadreCafe/ineCaillouCaissonCalculerCalepinCalibreCalmerCalomnieCalvaireCamaradeCame/raCamionCampagneCanalCanetonCanonCantineCanularCapableCaporalCapriceCapsuleCapterCapucheCarabineCarboneCaresserCaribouCarnageCarotteCarreauCartonCascadeCasierCasqueCassureCauserCautionCavalierCaverneCaviarCe/dilleCeintureCe/lesteCelluleCendrierCensurerCentralCercleCe/re/bralCeriseCernerCerveauCesserChagrinChaiseChaleurChambreChanceChapitreCharbonChasseurChatonChaussonChavirerChemiseChenilleChe/quierChercherChevalChienChiffreChignonChime-reChiotChlorureChocolatChoisirChoseChouetteChromeChuteCigareCigogneCimenterCine/maCintrerCirculerCirerCirqueCiterneCitoyenCitronCivilClaironClameurClaquerClasseClavierClientClignerClimatClivageClocheClonageCloporteCobaltCobraCocasseCocotierCoderCodifierCoffreCognerCohe/sionCoifferCoincerCole-reColibriCollineColmaterColonelCombatCome/dieCommandeCompactConcertConduireConfierCongelerConnoterConsonneContactConvexeCopainCopieCorailCorbeauCordageCornicheCorpusCorrectCorte-geCosmiqueCostumeCotonCoudeCoupureCourageCouteauCouvrirCoyoteCrabeCrainteCravateCrayonCre/atureCre/diterCre/meuxCreuserCrevetteCriblerCrierCristalCrite-reCroireCroquerCrotaleCrucialCruelCrypterCubiqueCueillirCuille-reCuisineCuivreCulminerCultiverCumulerCupideCuratifCurseurCyanureCycleCylindreCyniqueDaignerDamierDangerDanseurDauphinDe/battreDe/biterDe/borderDe/briderDe/butantDe/calerDe/cembreDe/chirerDe/ciderDe/clarerDe/corerDe/crireDe/cuplerDe/daleDe/ductifDe/esseDe/fensifDe/filerDe/frayerDe/gagerDe/givrerDe/glutirDe/graferDe/jeunerDe/liceDe/logerDemanderDemeurerDe/molirDe/nicherDe/nouerDentelleDe/nuderDe/partDe/penserDe/phaserDe/placerDe/poserDe/rangerDe/roberDe/sastreDescenteDe/sertDe/signerDe/sobe/irDessinerDestrierDe/tacherDe/testerDe/tourerDe/tresseDevancerDevenirDevinerDevoirDiableDialogueDiamantDicterDiffe/rerDige/rerDigitalDigneDiluerDimancheDiminuerDioxydeDirectifDirigerDiscuterDisposerDissiperDistanceDivertirDiviserDocileDocteurDogmeDoigtDo
|
|
|
|
var wordlist = null;
|
|
|
|
var lookup = {};
|
|
|
|
function dropDiacritic(word) {
|
2018-11-09 14:42:29 -05:00
|
|
|
errors_1.checkNormalize();
|
2018-10-03 22:52:55 -04:00
|
|
|
return utf8_1.toUtf8String(Array.prototype.filter.call(utf8_1.toUtf8Bytes(word.normalize('NFD').toLowerCase()), function (c) {
|
|
|
|
return ((c >= 65 && c <= 90) || (c >= 97 && c <= 123));
|
|
|
|
}));
|
2018-10-03 20:01:35 -04:00
|
|
|
}
|
|
|
|
function expand(word) {
|
|
|
|
var output = [];
|
2018-10-03 22:52:55 -04:00
|
|
|
Array.prototype.forEach.call(utf8_1.toUtf8Bytes(word), function (c) {
|
2018-10-03 20:01:35 -04:00
|
|
|
// Acute accent
|
|
|
|
if (c === 47) {
|
|
|
|
output.push(204);
|
|
|
|
output.push(129);
|
|
|
|
// Grave accent
|
|
|
|
}
|
|
|
|
else if (c === 45) {
|
|
|
|
output.push(204);
|
|
|
|
output.push(128);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
output.push(c);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return utf8_1.toUtf8String(output);
|
|
|
|
}
|
|
|
|
function loadWords(lang) {
|
|
|
|
if (wordlist != null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
wordlist = words.replace(/([A-Z])/g, ' $1').toLowerCase().substring(1).split(' ').map(function (w) { return expand(w); });
|
|
|
|
wordlist.forEach(function (word, index) {
|
|
|
|
lookup[dropDiacritic(word)] = index;
|
|
|
|
});
|
|
|
|
if (wordlist_1.check(lang) !== '0x51deb7ae009149dc61a6bd18a918eb7ac78d2775726c68e598b92d002519b045') {
|
|
|
|
wordlist = null;
|
|
|
|
throw new Error('BIP39 Wordlist for fr (French) FAILED');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var LangFr = /** @class */ (function (_super) {
|
|
|
|
__extends(LangFr, _super);
|
|
|
|
function LangFr() {
|
|
|
|
return _super.call(this, 'fr') || this;
|
|
|
|
}
|
|
|
|
LangFr.prototype.getWord = function (index) {
|
|
|
|
loadWords(this);
|
|
|
|
return wordlist[index];
|
|
|
|
};
|
|
|
|
LangFr.prototype.getWordIndex = function (word) {
|
|
|
|
loadWords(this);
|
|
|
|
var index = lookup[dropDiacritic(word)];
|
|
|
|
if (typeof (index) !== 'number') {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
return index;
|
|
|
|
};
|
|
|
|
return LangFr;
|
|
|
|
}(wordlist_1.Wordlist));
|
|
|
|
var langFr = new LangFr();
|
|
|
|
exports.langFr = langFr;
|
|
|
|
wordlist_1.register(langFr);
|