@protontech/autofill 0.0.22991789

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/README.md +1 -0
  2. package/cli.d.ts +2 -0
  3. package/cli.js +128 -0
  4. package/constants/heuristics.d.ts +15 -0
  5. package/constants/heuristics.js +21 -0
  6. package/constants/selectors.d.ts +18 -0
  7. package/constants/selectors.js +52 -0
  8. package/debug.d.ts +1 -0
  9. package/debug.js +17 -0
  10. package/dictionary/generate.d.ts +1 -0
  11. package/dictionary/generate.js +42 -0
  12. package/dictionary/generated/dictionary.d.ts +51 -0
  13. package/dictionary/generated/dictionary.js +51 -0
  14. package/dictionary/source/dictionary.d.ts +11 -0
  15. package/dictionary/source/dictionary.js +375 -0
  16. package/dictionary/source/patterns.d.ts +3 -0
  17. package/dictionary/source/patterns.js +3 -0
  18. package/features/abstract.field.d.ts +123 -0
  19. package/features/abstract.field.js +63 -0
  20. package/features/abstract.form.d.ts +98 -0
  21. package/features/abstract.form.js +281 -0
  22. package/features/field.email.d.ts +18 -0
  23. package/features/field.email.js +43 -0
  24. package/features/field.otp.d.ts +36 -0
  25. package/features/field.otp.js +116 -0
  26. package/features/field.password.d.ts +35 -0
  27. package/features/field.password.js +104 -0
  28. package/features/field.username-hidden.d.ts +15 -0
  29. package/features/field.username-hidden.js +40 -0
  30. package/features/field.username.d.ts +16 -0
  31. package/features/field.username.js +41 -0
  32. package/features/form.combined.d.ts +1 -0
  33. package/features/form.combined.js +6 -0
  34. package/index.d.ts +14 -0
  35. package/index.js +15 -0
  36. package/package.json +29 -0
  37. package/rulesets.d.ts +2 -0
  38. package/rulesets.js +10 -0
  39. package/trainees/field.email.d.ts +2 -0
  40. package/trainees/field.email.js +16 -0
  41. package/trainees/field.identity.d.ts +2 -0
  42. package/trainees/field.identity.js +9 -0
  43. package/trainees/field.otp.d.ts +2 -0
  44. package/trainees/field.otp.js +16 -0
  45. package/trainees/field.password.current.d.ts +2 -0
  46. package/trainees/field.password.current.js +16 -0
  47. package/trainees/field.password.new.d.ts +2 -0
  48. package/trainees/field.password.new.js +16 -0
  49. package/trainees/field.username-hidden.d.ts +2 -0
  50. package/trainees/field.username-hidden.js +22 -0
  51. package/trainees/field.username.d.ts +2 -0
  52. package/trainees/field.username.js +16 -0
  53. package/trainees/form.login.d.ts +2 -0
  54. package/trainees/form.login.js +16 -0
  55. package/trainees/form.noop.d.ts +1 -0
  56. package/trainees/form.noop.js +7 -0
  57. package/trainees/form.password-change.d.ts +2 -0
  58. package/trainees/form.password-change.js +16 -0
  59. package/trainees/form.recovery.d.ts +2 -0
  60. package/trainees/form.recovery.js +16 -0
  61. package/trainees/form.register.d.ts +2 -0
  62. package/trainees/form.register.js +16 -0
  63. package/trainees/index.d.ts +9 -0
  64. package/trainees/index.js +72 -0
  65. package/trainees/results/result.email.d.ts +2 -0
  66. package/trainees/results/result.email.js +17 -0
  67. package/trainees/results/result.login.d.ts +2 -0
  68. package/trainees/results/result.login.js +110 -0
  69. package/trainees/results/result.new-password.d.ts +2 -0
  70. package/trainees/results/result.new-password.js +36 -0
  71. package/trainees/results/result.otp.d.ts +2 -0
  72. package/trainees/results/result.otp.js +43 -0
  73. package/trainees/results/result.password-change.d.ts +2 -0
  74. package/trainees/results/result.password-change.js +110 -0
  75. package/trainees/results/result.password.d.ts +2 -0
  76. package/trainees/results/result.password.js +36 -0
  77. package/trainees/results/result.recovery.d.ts +2 -0
  78. package/trainees/results/result.recovery.js +110 -0
  79. package/trainees/results/result.register.d.ts +2 -0
  80. package/trainees/results/result.register.js +110 -0
  81. package/trainees/results/result.username-hidden.d.ts +2 -0
  82. package/trainees/results/result.username-hidden.js +15 -0
  83. package/trainees/results/result.username.d.ts +2 -0
  84. package/trainees/results/result.username.js +16 -0
  85. package/types/index.d.ts +38 -0
  86. package/types/index.js +20 -0
  87. package/utils/attributes.d.ts +9 -0
  88. package/utils/attributes.js +13 -0
  89. package/utils/clustering.d.ts +1 -0
  90. package/utils/clustering.js +81 -0
  91. package/utils/combinators.d.ts +6 -0
  92. package/utils/combinators.js +4 -0
  93. package/utils/dom.d.ts +25 -0
  94. package/utils/dom.js +104 -0
  95. package/utils/exclusion.d.ts +3 -0
  96. package/utils/exclusion.js +59 -0
  97. package/utils/extract.d.ts +13 -0
  98. package/utils/extract.js +59 -0
  99. package/utils/fathom.d.ts +38 -0
  100. package/utils/fathom.js +68 -0
  101. package/utils/field.d.ts +14 -0
  102. package/utils/field.js +50 -0
  103. package/utils/flags.d.ts +25 -0
  104. package/utils/flags.js +60 -0
  105. package/utils/form.d.ts +7 -0
  106. package/utils/form.js +25 -0
  107. package/utils/identity.d.ts +24 -0
  108. package/utils/identity.js +63 -0
  109. package/utils/memoize.d.ts +5 -0
  110. package/utils/memoize.js +12 -0
  111. package/utils/prepass.d.ts +2 -0
  112. package/utils/prepass.js +31 -0
  113. package/utils/re.d.ts +58 -0
  114. package/utils/re.js +64 -0
  115. package/utils/text.d.ts +3 -0
  116. package/utils/text.js +8 -0
  117. package/utils/visible.d.ts +13 -0
  118. package/utils/visible.js +143 -0
package/README.md ADDED
@@ -0,0 +1 @@
1
+ Model weights used by the Proton fork of Fathom.
package/cli.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env ts-node-script
2
+ export {};
package/cli.js ADDED
@@ -0,0 +1,128 @@
1
+ #!/usr/bin/env ts-node-script
2
+ import { exec } from "child_process";
3
+ import { Command } from "commander";
4
+ import fs from "fs/promises";
5
+ import path from "path";
6
+ import prettier from "prettier";
7
+ import { FORM_FEATURES } from "./features/abstract.form";
8
+ import { EMAIL_FIELD_FEATURES } from "./features/field.email";
9
+ import { OTP_FIELD_FEATURES } from "./features/field.otp";
10
+ import { PW_FIELD_FEATURES } from "./features/field.password";
11
+ import { USERNAME_FIELD_FEATURES } from "./features/field.username";
12
+ import { HIDDEN_USER_FIELD_FEATURES } from "./features/field.username-hidden";
13
+ const program = new Command();
14
+ const FEATURE_MAP = {
15
+ login: FORM_FEATURES,
16
+ register: FORM_FEATURES,
17
+ "password-change": FORM_FEATURES,
18
+ recovery: FORM_FEATURES,
19
+ username: USERNAME_FIELD_FEATURES,
20
+ "username-hidden": HIDDEN_USER_FIELD_FEATURES,
21
+ email: EMAIL_FIELD_FEATURES,
22
+ password: PW_FIELD_FEATURES,
23
+ "new-password": PW_FIELD_FEATURES,
24
+ otp: OTP_FIELD_FEATURES,
25
+ };
26
+ program.version("0.0.1").description("CLI utilities for ProtonPass fathom");
27
+ program
28
+ .command("get-vector [id]")
29
+ .description("Gets a human readable vector for a specific dataset entry")
30
+ .requiredOption("--trainee <trainee>")
31
+ .action(async (id, options) => {
32
+ try {
33
+ const file = await fs.readFile(`./dist/vectors/training_${options.trainee}.json`, "utf8");
34
+ const training = JSON.parse(file).pages;
35
+ const entry = training.find(({ filename }) => filename.startsWith(id));
36
+ if (entry === undefined) {
37
+ console.log("No entry found");
38
+ }
39
+ const featureSet = FEATURE_MAP[options.trainee];
40
+ if (featureSet === undefined)
41
+ throw new Error(`unknown feature set for trainee ${options.trainee}`);
42
+ entry === null || entry === void 0 ? void 0 : entry.nodes.forEach(({ features, markup, isTarget }) => {
43
+ console.log(`${markup} ${isTarget ? "✅" : "❌"}`);
44
+ features.forEach((value, i) => {
45
+ var _a;
46
+ console.log(`↳ ${(_a = featureSet === null || featureSet === void 0 ? void 0 : featureSet[i]) !== null && _a !== void 0 ? _a : "unknown"} = ${value}`);
47
+ });
48
+ console.log("\n");
49
+ });
50
+ }
51
+ catch (e) {
52
+ console.warn("Could not read file - try training your trainee first", e);
53
+ }
54
+ });
55
+ const buildCommand = (trainee) => `yarn train -- ${trainee} --delay 12 --iterations 5000 --learning-rate 0.5 --tabs 20`;
56
+ const extractResults = (stdout) => {
57
+ const jsonRegex = /{[\s\S]+}/;
58
+ const jsonMatch = stdout.match(jsonRegex);
59
+ if (!(jsonMatch === null || jsonMatch === void 0 ? void 0 : jsonMatch[0]))
60
+ throw new Error("Could not parse weights");
61
+ return JSON.parse(jsonMatch[0]);
62
+ };
63
+ const extractCutoff = (stdout) => {
64
+ const cutoffRegex = /Optimal cutoff: (\d+(\.\d+)?)/;
65
+ const cutoffMatch = stdout.match(cutoffRegex);
66
+ if (!cutoffMatch)
67
+ throw new Error("Could not parse cutoff");
68
+ return parseFloat(cutoffMatch[1]);
69
+ };
70
+ const extractSummary = (stdout) => {
71
+ const dataRegex = /Training precision:(?:.|\n)+?(?=Training per-tag results)/s;
72
+ const ansiColorRegex = /\x1b\[[0-9;]*m/g;
73
+ const dataMatch = stdout.match(dataRegex);
74
+ if (!(dataMatch === null || dataMatch === void 0 ? void 0 : dataMatch[0]))
75
+ throw new Error("Could not parse results");
76
+ return dataMatch[0].replace(ansiColorRegex, "");
77
+ };
78
+ const train = async (trainee) => {
79
+ const basePath = path.resolve(__dirname, "trainees/results");
80
+ const id = trainee.toUpperCase();
81
+ console.info(`\n[${id}]: Start training`);
82
+ console.time(`[${id}]`);
83
+ return new Promise((resolve) => {
84
+ exec(buildCommand(trainee), async (error, stdout) => {
85
+ console.timeEnd(`[${id}]`);
86
+ if (error) {
87
+ console.error(`[${id}]: Error during training: ${error.message}`);
88
+ resolve();
89
+ }
90
+ const results = extractResults(stdout);
91
+ results.cutoff = extractCutoff(stdout);
92
+ const summary = extractSummary(stdout);
93
+ console.log(summary);
94
+ let output = `// ${trainee.toUpperCase()} (trained on ${new Date().toDateString()})\n`;
95
+ output += summary
96
+ .split("\n")
97
+ .filter(Boolean)
98
+ .map((line) => `// ${line}`)
99
+ .join("\n");
100
+ output += `\n\nimport { TrainingResults } from "src/types";\n\n`;
101
+ output += `export const results: TrainingResults = ${JSON.stringify(results)};`;
102
+ await fs.writeFile(path.resolve(basePath, `result.${trainee}.ts`), await prettier.format(output, {
103
+ tabWidth: 2,
104
+ useTabs: false,
105
+ printWidth: 160,
106
+ parser: "babel-ts",
107
+ }));
108
+ resolve();
109
+ });
110
+ });
111
+ };
112
+ program.command("train [trainee]").description("trains a specific trainee").action(train);
113
+ program
114
+ .command("train-all")
115
+ .description("Sequentially trains all models and updates scores between each run")
116
+ .option("--type <type>")
117
+ .action(async (options) => {
118
+ const type = options === null || options === void 0 ? void 0 : options.type;
119
+ const formTrainees = !type || type === "form" ? ["login", "register", "password-change", "recovery"] : [];
120
+ const fieldTrainees = !type || type === "field" ? ["username", "username-hidden", "email", "password", "new-password", "otp"] : [];
121
+ for (const form of formTrainees) {
122
+ await train(form);
123
+ }
124
+ for (const field of fieldTrainees) {
125
+ await train(field);
126
+ }
127
+ });
128
+ program.parse(process.argv);
@@ -0,0 +1,15 @@
1
+ export declare const MAX_FORM_FIELD_WALK_UP = 3;
2
+ export declare const MAX_FORM_HEADING_WALK_UP = 3;
3
+ export declare const MAX_HEADING_HORIZONTAL_DIST = 75;
4
+ export declare const MAX_HEADING_VERTICAL_DIST = 150;
5
+ export declare const MAX_CLUSTER_SPLIT_DISTANCE = 400;
6
+ export declare const MAX_VISIBILITY_WALK_UP = 1;
7
+ export declare const MIN_AREA_SUBMIT_BTN = 3500;
8
+ export declare const MIN_FIELD_HEIGHT = 15;
9
+ export declare const MIN_FIELD_WIDTH = 30;
10
+ export declare const MAX_INPUTS_PER_FORM = 40;
11
+ export declare const MAX_FIELDS_PER_FORM = 60;
12
+ export declare const MAX_HIDDEN_FIELD_VALUE_LENGTH = 320;
13
+ export declare const HIDDEN_FIELD_IGNORE_VALUES: string[];
14
+ export declare const OTP_PATTERNS: [number, string][];
15
+ export declare const VALID_INPUT_TYPES: string[];
@@ -0,0 +1,21 @@
1
+ export const MAX_FORM_FIELD_WALK_UP = 3;
2
+ export const MAX_FORM_HEADING_WALK_UP = 3;
3
+ export const MAX_HEADING_HORIZONTAL_DIST = 75;
4
+ export const MAX_HEADING_VERTICAL_DIST = 150;
5
+ export const MAX_CLUSTER_SPLIT_DISTANCE = 400;
6
+ export const MAX_VISIBILITY_WALK_UP = 1;
7
+ export const MIN_AREA_SUBMIT_BTN = 3500;
8
+ export const MIN_FIELD_HEIGHT = 15;
9
+ export const MIN_FIELD_WIDTH = 30;
10
+ export const MAX_INPUTS_PER_FORM = 40;
11
+ export const MAX_FIELDS_PER_FORM = 60;
12
+ export const MAX_HIDDEN_FIELD_VALUE_LENGTH = 320;
13
+ export const HIDDEN_FIELD_IGNORE_VALUES = ["0", "1", "true", "false"];
14
+ export const OTP_PATTERNS = [
15
+ [1, "d*"],
16
+ [6, "d{6}"],
17
+ [1, "[0-9]*"],
18
+ [6, "[0-9]{6}"],
19
+ [5, "([0-9a-fA-F]{5}-?[0-9a-fA-F]{5})"],
20
+ ];
21
+ export const VALID_INPUT_TYPES = ["text", "email", "number", "tel", "password", "hidden", "search"];
@@ -0,0 +1,18 @@
1
+ export declare const FORM_CLUSTER_ATTR = "data-protonpass-form";
2
+ export declare const kFieldSelector = "input, select, textarea";
3
+ export declare const kEmailSelector = "input[name=\"email\"], input[id=\"email\"]";
4
+ export declare const kPasswordSelector = "input[type=\"password\"], input[type=\"text\"][id=\"password\"]";
5
+ export declare const kCaptchaSelector = "[class*=\"captcha\"], [id*=\"captcha\"], [name*=\"captcha\"]";
6
+ export declare const kSocialSelector = "[class*=social], [aria-label*=with]";
7
+ export declare const kEditorSelector = "div[class*=\"editor\" i], div[id*=\"editor\" i], div[class*=\"composer\" i], div[id*=\"composer\" i]";
8
+ export declare const kDomGroupSelector = "[role=\"dialog\"], [role=\"tabpanel\"], [role=\"group\"], [role=\"form\"], [id*=\"modal\"], [class*=\"modal\"], header, section, nav, footer, aside";
9
+ export declare const kUsernameSelector: string;
10
+ export declare const kHiddenUsernameSelector: string;
11
+ export declare const kHeadingSelector: string;
12
+ export declare const kButtonSubmitSelector: string;
13
+ export declare const kLayoutSelector = "div, section, aside, main, nav";
14
+ export declare const kAnchorLinkSelector = "a, span[role=\"button\"]";
15
+ export declare const formCandidateSelector = "form, [data-protonpass-form]";
16
+ export declare const inputCandidateSelector = "input:not([type=\"hidden\"]):not([type=\"submit\"]):not([type=\"button\"]):not([type=\"image\"]):not([type=\"checkbox\"])";
17
+ export declare const buttonSelector: string;
18
+ export declare const otpSelector = "[type=\"tel\"], [type=\"number\"], [type=\"text\"], input:not([type])";
@@ -0,0 +1,52 @@
1
+ export const FORM_CLUSTER_ATTR = "data-protonpass-form";
2
+ export const kFieldSelector = "input, select, textarea";
3
+ export const kEmailSelector = 'input[name="email"], input[id="email"]';
4
+ export const kPasswordSelector = 'input[type="password"], input[type="text"][id="password"]';
5
+ export const kCaptchaSelector = `[class*="captcha"], [id*="captcha"], [name*="captcha"]`;
6
+ export const kSocialSelector = `[class*=social], [aria-label*=with]`;
7
+ export const kEditorSelector = 'div[class*="editor" i], div[id*="editor" i], div[class*="composer" i], div[id*="composer" i]';
8
+ export const kDomGroupSelector = `[role="dialog"], [role="tabpanel"], [role="group"], [role="form"], [id*="modal"], [class*="modal"], header, section, nav, footer, aside`;
9
+ export const kUsernameSelector = [
10
+ 'input[type="login"]',
11
+ 'input[type="username"]',
12
+ 'input[type="search"][name="loginName"]',
13
+ 'input[type="password"][name="userID"]',
14
+ 'input[type="password"][name="USERNAME"]',
15
+ 'input[name="account"]',
16
+ 'input[name="quickconnect-id"]',
17
+ ].join(",");
18
+ export const kHiddenUsernameSelector = [
19
+ '[name*="user" i]',
20
+ '[id*="user" i]',
21
+ '[name*="login" i]',
22
+ '[id*="login" i]',
23
+ '[name*="email" i]',
24
+ '[id*="email" i]',
25
+ '[name*="identifier" i]',
26
+ '[id*="identifier" i]',
27
+ ].join(",");
28
+ export const kHeadingSelector = [
29
+ ...[1, 2, 3, 4, 5].flatMap((level) => [`h${level}, [aria-level="${level}"]`]),
30
+ '[role="heading"]',
31
+ '[class*="title"]',
32
+ '[class*="header"]',
33
+ '[name="title"]',
34
+ 'div[style*="font-size: 2"]',
35
+ 'div[style*="font-size: 3"]',
36
+ ].join(",");
37
+ export const kButtonSubmitSelector = [
38
+ 'input[type="submit"]',
39
+ 'button[id*="password" i]',
40
+ 'button[type="submit"]',
41
+ 'button[type="button"]',
42
+ 'button[name="submit"]',
43
+ 'a[role="submit"]',
44
+ 'div[role="button"]',
45
+ 'div[role="submit"]',
46
+ ].join(",");
47
+ export const kLayoutSelector = `div, section, aside, main, nav`;
48
+ export const kAnchorLinkSelector = `a, span[role="button"]`;
49
+ export const formCandidateSelector = `form, [${FORM_CLUSTER_ATTR}]`;
50
+ export const inputCandidateSelector = 'input:not([type="hidden"]):not([type="submit"]):not([type="button"]):not([type="image"]):not([type="checkbox"])';
51
+ export const buttonSelector = `button:not([type]), a[role="button"], ${kButtonSubmitSelector}`;
52
+ export const otpSelector = '[type="tel"], [type="number"], [type="text"], input:not([type])';
package/debug.d.ts ADDED
@@ -0,0 +1 @@
1
+ export {};
package/debug.js ADDED
@@ -0,0 +1,17 @@
1
+ import * as visibilityUtils from "./utils/visible";
2
+ import * as clusteringUtils from "./utils/clustering";
3
+ import * as formUtils from "./utils/form";
4
+ import * as fieldRules from "./utils/field";
5
+ import * as trainees from "./trainees";
6
+ import * as exclusions from "./utils/exclusion";
7
+ import * as prepass from "./utils/prepass";
8
+ window.PROTON_PASS_FATHOM_DEBUG = {
9
+ createMockFnode: (element) => ({ element }),
10
+ ...clusteringUtils,
11
+ ...visibilityUtils,
12
+ ...formUtils,
13
+ ...fieldRules,
14
+ ...trainees,
15
+ ...exclusions,
16
+ ...prepass,
17
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,42 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+ import regexgen from "regexgen";
4
+ import { sanitizeString } from "../utils/text";
5
+ import dictionary from "./source/dictionary";
6
+ const generateRegexes = () => {
7
+ let output = "";
8
+ output += "/* Regular expressions auto-generated using `source/dictionary.ts`\n";
9
+ output += " * Simplified & optimised using `regexgen` for performance. \n";
10
+ output += " * `TYPE_RE`: i18n regexp for text matches\n";
11
+ output += " * `TYPE_ATTR_RE`: regexp for node attributes\n";
12
+ output += " * `TYPE_ATTR_END`: attr ending constraint regexp */\n\n";
13
+ Object.entries(dictionary).forEach(([name, definition]) => {
14
+ var _a, _b, _c, _d, _e, _f;
15
+ const words = Object.values(definition.i18n).flat().map(sanitizeString);
16
+ const attrs = ((_b = (_a = definition === null || definition === void 0 ? void 0 : definition.attr) === null || _a === void 0 ? void 0 : _a.values) !== null && _b !== void 0 ? _b : []).map(sanitizeString);
17
+ const attrsExact = ((_d = (_c = definition === null || definition === void 0 ? void 0 : definition.attr) === null || _c === void 0 ? void 0 : _c.exact) !== null && _d !== void 0 ? _d : []).map(sanitizeString);
18
+ if (words.length > 0) {
19
+ output += `export const ${name}_RE = ${regexgen(words, "")}i;\n`;
20
+ }
21
+ if (attrs.length > 0 || attrsExact.length > 0) {
22
+ const regAttrs = attrs.length > 0 ? regexgen(attrs, "").source : null;
23
+ const regExact = attrsExact.length > 0 ? `\\b(${regexgen(attrsExact, "").source})\\b` : null;
24
+ if (regAttrs && !regExact)
25
+ output += `export const ${name}_ATTR_RE = /${regAttrs}/i;\n`;
26
+ else if (!regAttrs && regExact)
27
+ output += `export const ${name}_ATTR_RE = /${regExact}/i;\n`;
28
+ else if (regAttrs && regExact)
29
+ output += `export const ${name}_ATTR_RE = /${regAttrs}|${regExact}/i;\n`;
30
+ }
31
+ if ((_e = definition.attr) === null || _e === void 0 ? void 0 : _e.startsWith) {
32
+ const startWithRe = regexgen(definition.attr.startsWith.map(sanitizeString), "");
33
+ output += `export const ${name}_ATTR_START_RE = /^(?:${startWithRe.source}).*\\b/i;\n`;
34
+ }
35
+ if ((_f = definition.attr) === null || _f === void 0 ? void 0 : _f.endsWith) {
36
+ const endWordsRe = regexgen(definition.attr.endsWith.map(sanitizeString), "");
37
+ output += `export const ${name}_ATTR_END_RE= /\\b.*(?:${endWordsRe.source})$/i;\n`;
38
+ }
39
+ });
40
+ fs.writeFileSync(path.resolve(__dirname, "./generated/dictionary.ts"), output);
41
+ };
42
+ generateRegexes();
@@ -0,0 +1,51 @@
1
+ export declare const LOGIN_RE: RegExp;
2
+ export declare const REGISTER_RE: RegExp;
3
+ export declare const RECOVERY_RE: RegExp;
4
+ export declare const MULTI_STEP_RE: RegExp;
5
+ export declare const TROUBLE_RE: RegExp;
6
+ export declare const PASSWORD_RE: RegExp;
7
+ export declare const PASSWORD_ATTR_RE: RegExp;
8
+ export declare const PASSWORD_OUTLIER_RE: RegExp;
9
+ export declare const USERNAME_RE: RegExp;
10
+ export declare const USERNAME_ATTR_RE: RegExp;
11
+ export declare const USERNAME_OUTLIER_RE: RegExp;
12
+ export declare const EMAIL_RE: RegExp;
13
+ export declare const EMAIL_ATTR_RE: RegExp;
14
+ export declare const TEL_RE: RegExp;
15
+ export declare const CAPTCHA_ATTR_RE: RegExp;
16
+ export declare const SUBMIT_ACTION_RE: RegExp;
17
+ export declare const CREATE_ACTION_RE: RegExp;
18
+ export declare const CREATE_ACTION_ATTR_END_RE: RegExp;
19
+ export declare const RESET_ACTION_RE: RegExp;
20
+ export declare const CONFIRM_ACTION_RE: RegExp;
21
+ export declare const CONFIRM_ACTION_ATTR_END_RE: RegExp;
22
+ export declare const STEP_ACTION_RE: RegExp;
23
+ export declare const REMEMBER_ACTION_RE: RegExp;
24
+ export declare const SEARCH_ACTION_RE: RegExp;
25
+ export declare const CURRENT_VALUE_RE: RegExp;
26
+ export declare const CURRENT_VALUE_ATTR_RE: RegExp;
27
+ export declare const HIDDEN_ATTR_RE: RegExp;
28
+ export declare const OAUTH_ATTR_RE: RegExp;
29
+ export declare const TOS_RE: RegExp;
30
+ export declare const MFA_ACTION_RE: RegExp;
31
+ export declare const MFA_RE: RegExp;
32
+ export declare const MFA_ATTR_RE: RegExp;
33
+ export declare const OTP_ATTR_RE: RegExp;
34
+ export declare const OTP_OUTLIER_RE: RegExp;
35
+ export declare const OTP_OUTLIER_ATTR_RE: RegExp;
36
+ export declare const NEWSLETTER_RE: RegExp;
37
+ export declare const NEWSLETTER_ATTR_RE: RegExp;
38
+ export declare const IDENTITY_FULLNAME_ATTR_RE: RegExp;
39
+ export declare const IDENTITY_FIRSTNAME_ATTR_RE: RegExp;
40
+ export declare const IDENTITY_MIDDLENAME_ATTR_RE: RegExp;
41
+ export declare const IDENTITY_LASTNAME_ATTR_RE: RegExp;
42
+ export declare const IDENTITY_TELEPHONE_ATTR_RE: RegExp;
43
+ export declare const IDENTITY_TELEPHONE_PREFIX_ATTR_RE: RegExp;
44
+ export declare const IDENTITY_ADDRESS_ATTR_RE: RegExp;
45
+ export declare const IDENTITY_ADDRESS_LINES_ATTR_END_RE: RegExp;
46
+ export declare const IDENTITY_STATE_ATTR_RE: RegExp;
47
+ export declare const IDENTITY_CITY_ATTR_RE: RegExp;
48
+ export declare const IDENTITY_ZIPCODE_ATTR_RE: RegExp;
49
+ export declare const IDENTITY_ORGANIZATION_ATTR_RE: RegExp;
50
+ export declare const IDENTITY_COUNTRY_ATTR_RE: RegExp;
51
+ export declare const IDENTITY_COUNTRY_CODE_ATTR_RE: RegExp;
@@ -0,0 +1,51 @@
1
+ export const LOGIN_RE = /(?:(?:n(?:ouvelleses|uevase|ewses)s|iniciarses|connex)io|anmeldedate|sign[io])n|in(?:iciarsessao|troduce)|a(?:uthenticate|nmeld(?:ung|en)|ccedi)|authentifier|s(?:econnect|identifi)er|novasessao|(?:introduci|conecta|accede|entr[ae])r|prihlasit|connect|login/i;
2
+ export const REGISTER_RE = /kontoerstellen|cr(?:ea(?:reaccount|teaccount|rcuenta|account)|iarconta)|(?:nouveaucompt|creeruncompt|s?inscrir|unirs)e|re(?:gist(?:r(?:ieren|a(?:rse|ti)|ar)|er)|joindre)|nuevacuenta|getstarted|neueskonto|newaccount|novaconta|(?:com(?:mence|eca)|(?:empez|junt)a)r|signup|join/i;
3
+ export const RECOVERY_RE = /(?:wiederherstell|zurucksetz)en|re(?:(?:initialis|stablec)er|(?:defini|staur[ae])r|c(?:uper[ae]|ove)r|set)|problem|(?:troubl|restor|aid)e|a[jy]uda|h(?:ilfe|elp)/i;
4
+ export const MULTI_STEP_RE = /p(?:rogres(?:s(?:ion|o)|o)|aso)|fortschritt|progress|s(?:chritt|t(?:age|ep))|etap[ae]|phase/i;
5
+ export const TROUBLE_RE = /schwierigkeit|(?:difficult|troubl|oubli|hilf)e|i(?:nciden(?:cia|t)|ssue)|vergessen|esquecido|olvidado|needhelp|questao|problem|forgot|ayuda/i;
6
+ export const PASSWORD_RE = /p(?:hrasesecrete|ass(?:(?:phras|cod)e|wor[dt]))|(?:c(?:havesecret|lavesecret|ontrasen)|deseguranc)a|(?:(?:zugangs|secret)cod|clesecret)e|codesecret|motdepasse|geheimnis|secret|heslo|senha|key/i;
7
+ export const PASSWORD_ATTR_RE = /p(?:ass|wd?)|fmt|mdp/i;
8
+ export const PASSWORD_OUTLIER_RE = /socialsecurity|nationalid|userid/i;
9
+ export const USERNAME_RE = /(?:identifi(?:cado|e)|benutze)r|identi(?:fiant|ty)|u(?:tilisateur|s(?:ername|uario?))|(?:screen|nick)name|nutzername|(?:anmeld|handl)e|pseudo/i;
10
+ export const USERNAME_ATTR_RE = /identifyemail|(?:custom|us)erid|loginname|a(?:cc(?:ountid|t)|ppleid)|loginid/i;
11
+ export const USERNAME_OUTLIER_RE = /(?:nom(?:defamill|br)|tit[lr])e|(?:primeiro|sobre)nome|(?:company|middle|nach|vor)name|firstname|apellido|lastname|prenom/i;
12
+ export const EMAIL_RE = /co(?:urriel|rrei?o)|email/i;
13
+ export const EMAIL_ATTR_RE = /usermail/i;
14
+ export const TEL_RE = /numerodetel|phonenumber|cellnumber|cellphone|tele(?:phone|fon[eo]?)|celular|mo(?:bile|vil)|mobil/i;
15
+ export const CAPTCHA_ATTR_RE = /(?:solvemedi|(?:key|fun|re|h)?captch)a/i;
16
+ export const SUBMIT_ACTION_RE = /(?:valide|envia)r|s(?:enden|ubmit)|go/i;
17
+ export const CREATE_ACTION_RE = /erstellen|n(?:o(?:uveau|vo)|uevo|e[uw])|cr(?:e(?:a[rt]e|er)|iar)|crear|set/i;
18
+ export const CREATE_ACTION_ATTR_END_RE = /\b.*(?:fst|1)$/i;
19
+ export const RESET_ACTION_RE = /(?:a(?:ktualisiere|nder)|zurucksetze)n|(?:re(?:initialise|stablece|defini)|mettreajou)r|a(?:ctualiz|tualiz|lter)ar|c(?:ambiar|hange)|update|reset/i;
20
+ export const CONFIRM_ACTION_RE = /digitarnovamente|v(?:olveraescribi|erifi(?:ca|e))r|saisiranouveau|(?:erneuteingeb|wiederhol|bestatig)en|verif(?:izieren|y)|re(?:pe(?:t[ei]r|at)|type)|confirm|again/i;
21
+ export const CONFIRM_ACTION_ATTR_END_RE = /\b.*(?:snd|bis|2)$/i;
22
+ export const STEP_ACTION_RE = /(?:f(?:ertigstell|ortfahr)|abschlie)en|getstarted|siguiente|(?:preceden|suivan|accep)t|(?:finaliza|termin[ae]|anterio|weite)r|co(?:mplet(?:ar|e)|ntinu(?:ar|e))|pro(?:c(?:hain|eed)|ximo)|finish|zuruck|back|next/i;
23
+ export const REMEMBER_ACTION_RE = /angemeldetbleiben|lembrardemim|micherinnern|sesouvenirde|re(?:cordarme|member|ster)|manterme|mantener|stay|keep/i;
24
+ export const SEARCH_ACTION_RE = /recherche|buscar|s(?:earch|uche)|query/i;
25
+ export const CURRENT_VALUE_RE = /(?:be(?:stehend|for)|vorherig|aktuell)e|exist(?:ente|ing)|pre(?:cedent|vious)|a(?:n(?:t(?:erior|igo)|cien)|ctu[ae]l|tual)|existant|dernier|current|(?:ultim|viej)o|(?:letz|al)te|last|old/i;
26
+ export const CURRENT_VALUE_ATTR_RE = /prev|curr/i;
27
+ export const HIDDEN_ATTR_RE = /s(?:creenreade)?ronly|(?:move)?offscreen|(?:displaynon|a11yhid)e|\b((?:is)?hidden)\b/i;
28
+ export const OAUTH_ATTR_RE = /facebook|twitch|google|apple/i;
29
+ export const TOS_RE = /(?:datenschutzrichtlini|politicadeprivacidad|confidentialit|a(?:cknowledg|gre))e|nutzungsbedingungen|(?:consentimi?ent|ac(?:ue|o)rd)o|(?:einwillig|zustimm)ung|consentement|condi(?:cione|tion)s|term(?:osdeuso|inos|sof)|(?:privacida|understan)d|guideline|consent|p(?:riva|oli)cy|accord/i;
30
+ export const MFA_ACTION_RE = /enter(?:auth)?code|confirm|verify/i;
31
+ export const MFA_RE = /(?:authentifizierung|doisfatore|doispasso)s|(?:auth(?:entication)?cod|securitycod|doubleetap)e|(?:authentication|generator)app|(?:(?:authentifica|doublefac)teu|(?:(?:authentifika|doblefac|zweifak|twofac)t|aut(?:henticat|enticad))o)r|verifica(?:c(?:ion|ao)|tion)|multifa(?:ct(?:eu|o)|k?to)r|zweischritte|generadora|doblepaso|2(?:s(?:chritte|tep)|(?:etap[ae]|paso)s|fa)|twostep/i;
32
+ export const MFA_ATTR_RE = /phoneverification|(?:approvals|login)code|challenge|t(?:wo(?:fa(?:ctor)?|step)|facode)|2fa|\b([mt]fa)\b/i;
33
+ export const OTP_ATTR_RE = /totp(?:pin)?|o(?:netime|t[cp])|1time/i;
34
+ export const OTP_OUTLIER_RE = /n(?:(?:ue|o)vocodigo|ouveaucode|e(?:usenden|(?:uer|w)code))|re(?:enviar|send)|envoyer|senden|enviar|send/i;
35
+ export const OTP_OUTLIER_ATTR_RE = /(?:phone(?:verification)?|email|tel)pin|email|sms/i;
36
+ export const NEWSLETTER_RE = /newsletter|b(?:ul|o)letin|mailing/i;
37
+ export const NEWSLETTER_ATTR_RE = /subscription|mailinglist|newsletter|emailform/i;
38
+ export const IDENTITY_FULLNAME_ATTR_RE = /addresscontact|contactperson|addressname|yourname|fullname|\b(name)\b/i;
39
+ export const IDENTITY_FIRSTNAME_ATTR_RE = /givenname|firstn(?:ame)?|\b(fname)\b/i;
40
+ export const IDENTITY_MIDDLENAME_ATTR_RE = /additionalname|middlen(?:ame)?|\b(mname)\b/i;
41
+ export const IDENTITY_LASTNAME_ATTR_RE = /familyn(?:ame)?|lastn(?:ame)?|surname|\b([ls]name)\b/i;
42
+ export const IDENTITY_TELEPHONE_ATTR_RE = /(?:national|contact)number|tel(?:nation|loc)al|(?:tele)?phone|mobile|\b(tel)\b/i;
43
+ export const IDENTITY_TELEPHONE_PREFIX_ATTR_RE = /co(?:untry|de)|prefix/i;
44
+ export const IDENTITY_ADDRESS_ATTR_RE = /(?:preferred|street)address|address(?:line(?:one|[1s])|1)|mailingaddr|bill(?:ing)?addr|\b(mailaddr|addr(?:ess)?|street|line1)\b/i;
45
+ export const IDENTITY_ADDRESS_LINES_ATTR_END_RE = /\b.*(?:line(?:t(?:hree|wo)|[23]))$/i;
46
+ export const IDENTITY_STATE_ATTR_RE = /address(?:(?:provinc|stat)e|level1)|stateprovince|\b(province|county|region|state)\b/i;
47
+ export const IDENTITY_CITY_ATTR_RE = /address(?:level2|town|city)|personalcity|\b((?:local|c)ity|town)\b/i;
48
+ export const IDENTITY_ZIPCODE_ATTR_RE = /(?:address(?:postal|zip)|post)code|address(?:postal|zip)|postalcode|zipcode|\b(zip)\b/i;
49
+ export const IDENTITY_ORGANIZATION_ATTR_RE = /organization(?:name)?|companyname|\b(organization)\b/i;
50
+ export const IDENTITY_COUNTRY_ATTR_RE = /addresscountry(?:name)?|countryname|\b(country)\b/i;
51
+ export const IDENTITY_COUNTRY_CODE_ATTR_RE = /countrycode/i;
@@ -0,0 +1,11 @@
1
+ type DictionaryEntry = {
2
+ i18n: Record<string, string[]>;
3
+ attr?: {
4
+ values?: string[];
5
+ exact?: string[];
6
+ endsWith?: string[];
7
+ startsWith?: string[];
8
+ };
9
+ };
10
+ declare const dictionary: Record<string, DictionaryEntry>;
11
+ export default dictionary;