polytypo 1.11.0 → 1.13.0
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.
- package/README.md +18 -0
- package/dist/{chunk-M2O7YEYA.js → chunk-6PEHEU6F.js} +2 -2
- package/dist/{chunk-U3BQVYLI.js → chunk-ANHMGSED.js} +8 -7
- package/dist/chunk-ANHMGSED.js.map +1 -0
- package/dist/chunk-CJIH6CFO.cjs +34 -0
- package/dist/chunk-CJIH6CFO.cjs.map +1 -0
- package/dist/{chunk-R7AVFEMZ.js → chunk-E2HHFHG2.js} +8 -7
- package/dist/chunk-E2HHFHG2.js.map +1 -0
- package/dist/{chunk-MYO6QNUZ.js → chunk-EL7R55TV.js} +2 -2
- package/dist/{chunk-UF734P5M.cjs → chunk-FDNDYPPY.cjs} +3 -3
- package/dist/{chunk-UF734P5M.cjs.map → chunk-FDNDYPPY.cjs.map} +1 -1
- package/dist/{chunk-OO5UBFQ3.js → chunk-MCQOMIWF.js} +2 -2
- package/dist/chunk-MDIDDG32.cjs +38 -0
- package/dist/chunk-MDIDDG32.cjs.map +1 -0
- package/dist/{chunk-HUSFFMHK.js → chunk-MF6PJO7O.js} +338 -9
- package/dist/chunk-MF6PJO7O.js.map +1 -0
- package/dist/chunk-OPHUDB2T.cjs +36 -0
- package/dist/chunk-OPHUDB2T.cjs.map +1 -0
- package/dist/{chunk-EB47BYQP.js → chunk-OWTDZ6UD.js} +10 -9
- package/dist/{chunk-EB47BYQP.js.map → chunk-OWTDZ6UD.js.map} +1 -1
- package/dist/{chunk-UHXG7EUL.js → chunk-R5VKBH3P.js} +9 -2
- package/dist/chunk-R5VKBH3P.js.map +1 -0
- package/dist/{chunk-XNXXVTRR.cjs → chunk-TUDHJRJN.cjs} +6 -6
- package/dist/{chunk-XNXXVTRR.cjs.map → chunk-TUDHJRJN.cjs.map} +1 -1
- package/dist/{chunk-GT3YI4HK.cjs → chunk-W52W6XGA.cjs} +4 -4
- package/dist/{chunk-GT3YI4HK.cjs.map → chunk-W52W6XGA.cjs.map} +1 -1
- package/dist/{chunk-M2XO2UOC.cjs → chunk-WQEB33J2.cjs} +332 -3
- package/dist/chunk-WQEB33J2.cjs.map +1 -0
- package/dist/{chunk-RGL2IVXT.cjs → chunk-WWKSWVMX.cjs} +22 -21
- package/dist/chunk-WWKSWVMX.cjs.map +1 -0
- package/dist/{errors-DeHxbXRn.d.ts → errors-DrNAlWLt.d.cts} +12 -1
- package/dist/{errors-DeHxbXRn.d.cts → errors-DrNAlWLt.d.ts} +12 -1
- package/dist/html.cjs +9 -10
- package/dist/html.cjs.map +1 -1
- package/dist/html.d.cts +3 -3
- package/dist/html.d.ts +3 -3
- package/dist/html.js +4 -5
- package/dist/html.js.map +1 -1
- package/dist/index.cjs +17 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +7 -8
- package/dist/index.js.map +1 -1
- package/dist/markdown.cjs +10 -11
- package/dist/markdown.cjs.map +1 -1
- package/dist/markdown.d.cts +3 -3
- package/dist/markdown.d.ts +3 -3
- package/dist/markdown.js +5 -6
- package/dist/markdown.js.map +1 -1
- package/dist/text.cjs +8 -8
- package/dist/text.cjs.map +1 -1
- package/dist/text.d.cts +2 -2
- package/dist/text.d.ts +2 -2
- package/dist/text.js +3 -3
- package/dist/text.js.map +1 -1
- package/dist/yaml.cjs +9 -10
- package/dist/yaml.cjs.map +1 -1
- package/dist/yaml.d.cts +3 -3
- package/dist/yaml.d.ts +3 -3
- package/dist/yaml.js +4 -5
- package/dist/yaml.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-4IMDK5WJ.cjs +0 -31
- package/dist/chunk-4IMDK5WJ.cjs.map +0 -1
- package/dist/chunk-6SL3VC37.cjs +0 -35
- package/dist/chunk-6SL3VC37.cjs.map +0 -1
- package/dist/chunk-7YM3XE7R.js +0 -218
- package/dist/chunk-7YM3XE7R.js.map +0 -1
- package/dist/chunk-E7PHHD77.cjs +0 -218
- package/dist/chunk-E7PHHD77.cjs.map +0 -1
- package/dist/chunk-HUSFFMHK.js.map +0 -1
- package/dist/chunk-M2XO2UOC.cjs.map +0 -1
- package/dist/chunk-R7AVFEMZ.js.map +0 -1
- package/dist/chunk-RGL2IVXT.cjs.map +0 -1
- package/dist/chunk-U3BQVYLI.js.map +0 -1
- package/dist/chunk-UHXG7EUL.js.map +0 -1
- package/dist/chunk-VRCQJFUG.cjs +0 -33
- package/dist/chunk-VRCQJFUG.cjs.map +0 -1
- /package/dist/{chunk-M2O7YEYA.js.map → chunk-6PEHEU6F.js.map} +0 -0
- /package/dist/{chunk-MYO6QNUZ.js.map → chunk-EL7R55TV.js.map} +0 -0
- /package/dist/{chunk-OO5UBFQ3.js.map → chunk-MCQOMIWF.js.map} +0 -0
|
@@ -44,6 +44,7 @@ function isValidCodePoint(value) {
|
|
|
44
44
|
|
|
45
45
|
// src/generated/locales.ts
|
|
46
46
|
var KNOWN_LOCALES = [
|
|
47
|
+
"bg",
|
|
47
48
|
"cs",
|
|
48
49
|
"de-CH",
|
|
49
50
|
"de-DE",
|
|
@@ -54,11 +55,14 @@ var KNOWN_LOCALES = [
|
|
|
54
55
|
"fi",
|
|
55
56
|
"fr",
|
|
56
57
|
"fr-CA",
|
|
58
|
+
"hr",
|
|
59
|
+
"hu",
|
|
57
60
|
"it",
|
|
58
61
|
"nl",
|
|
59
62
|
"pl",
|
|
60
63
|
"pt-BR",
|
|
61
64
|
"pt-PT",
|
|
65
|
+
"ro",
|
|
62
66
|
"ru",
|
|
63
67
|
"sk",
|
|
64
68
|
"sv",
|
|
@@ -71,6 +75,7 @@ var ALIASES = {
|
|
|
71
75
|
pt: "pt-PT"
|
|
72
76
|
};
|
|
73
77
|
var LOCALES = {
|
|
78
|
+
bg: { locale: "bg", name: "Bulgarian", quotes: { primary: { open: "\u201E", close: "\u201C", innerSpace: "none" }, secondary: { open: "\u201E", close: "\u201C", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: [] } }, dash: { parenthetical: "en-spaced", range: "en-spaced" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: [], beforeUnits: ["\u043A\u043C", "\u043A\u0433", "\u043B\u0432.", "\u0433."], beforeNumber: [], beforeWord: [], afterSymbols: [], initialBinding: "none" } },
|
|
74
79
|
cs: { locale: "cs", name: "Czech", quotes: { primary: { open: "\u201E", close: "\u201C", innerSpace: "none" }, secondary: { open: "\u201A", close: "\u2018", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: [] } }, dash: { parenthetical: "en-spaced", range: "en-tight" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: ["a", "i", "k", "o", "s", "u", "v", "z"], abbreviations: ["a. s.", "s. r. o."], beforeUnits: ["%", "\xB0C", "ha", "kg", "km", "cm", "mm", "m\xB2", "kWh", "km/h", "str.", "hod."], beforeNumber: [], beforeWord: ["tj.", "tzv.", "tzn."], afterSymbols: ["\xA7"], initialBinding: "single" } },
|
|
75
80
|
"de-CH": { locale: "de-CH", name: "German (Switzerland)", quotes: { primary: { open: "\xAB", close: "\xBB", innerSpace: "none" }, secondary: { open: "\u2039", close: "\u203A", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: [] } }, dash: { parenthetical: "en-spaced", range: "en-tight" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: ["z. B.", "d. h.", "u. a.", "u. U.", "m. a. W.", "m. w. H."], beforeUnits: ["%", "\u2030", "\xB0C", "km", "cm", "mm", "kg", "km/h", "kWh"], beforeNumber: ["Art.", "Abs.", "Ziff.", "Kap.", "S."], beforeWord: ["St."], afterSymbols: ["\xA7", "\xA7\xA7"], initialBinding: "chain" } },
|
|
76
81
|
"de-DE": { locale: "de-DE", name: "German (Germany)", quotes: { primary: { open: "\u201E", close: "\u201C", innerSpace: "none" }, secondary: { open: "\u201A", close: "\u2018", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: [] } }, dash: { parenthetical: "en-spaced", range: "en-tight" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: ["z. B.", "d. h.", "u. a.", "u. \xC4.", "z. T.", "i. d. R."], beforeUnits: ["%", "\u2030", "\u20AC", "\xB0C", "km", "cm", "mm", "kg", "km/h", "kWh"], beforeNumber: ["Nr.", "S."], beforeWord: ["St."], afterSymbols: ["\xA7", "\xA7\xA7"], initialBinding: "chain" } },
|
|
@@ -81,11 +86,14 @@ var LOCALES = {
|
|
|
81
86
|
fi: { locale: "fi", name: "Finnish", quotes: { primary: { open: "\u201D", close: "\u201D", innerSpace: "none" }, secondary: { open: "\u2019", close: "\u2019", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: [] } }, dash: { parenthetical: "en-spaced", range: "en-tight" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: ["fil. maist."], beforeUnits: ["%", "\u2030", "\xA7", "kg", "g", "mg", "km", "m", "cm", "mm", "l", "dl", "cl", "ml", "h", "min", "s", "ms", "\xB0C", "kW", "kWh"], beforeNumber: [], beforeWord: [], afterSymbols: ["\xA7"], initialBinding: "none" } },
|
|
82
87
|
fr: { locale: "fr", name: "French (France)", quotes: { primary: { open: "\xAB", close: "\xBB", innerSpace: "nbsp" }, secondary: { open: "\u201C", close: "\u201D", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: ["l", "j", "m", "t", "s", "c", "qu", "jusqu", "d", "n", "lorsqu", "puisqu", "quoiqu"], after: [] } }, dash: { parenthetical: "em-spaced", range: "none" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [":"], narrowBeforePunctuation: [";", "!", "?"], afterShortWords: [], abbreviations: ["p. ex."], beforeUnits: ["%", "\u2030", "\u20AC", "\xB0C", "km", "cm", "mm", "kg", "km/h", "kWh"], beforeNumber: ["art.", "fig.", "n\xB0", "N\xB0"], beforeWord: ["M.", "MM.", "Mme", "Mmes", "Mlle", "Mlles"], afterSymbols: ["\xA7"], initialBinding: "single" } },
|
|
83
88
|
"fr-CA": { locale: "fr-CA", name: "French (Canada)", quotes: { primary: { open: "\xAB", close: "\xBB", innerSpace: "nbsp" }, secondary: { open: "\u201C", close: "\u201D", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: ["l", "j", "m", "t", "s", "c", "qu", "jusqu", "d", "n", "lorsqu", "puisqu", "quoiqu"], after: [] } }, dash: { parenthetical: "em-spaced", range: "none" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [":"], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: ["p. ex."], beforeUnits: ["%", "\u2030", "\u20AC", "\xB0C", "km", "cm", "mm", "kg", "km/h", "kWh"], beforeNumber: ["art.", "fig.", "n\xB0", "N\xB0"], beforeWord: ["M.", "MM.", "Mme", "Mmes", "Mlle", "Mlles"], afterSymbols: ["\xA7"], initialBinding: "single" } },
|
|
89
|
+
hr: { locale: "hr", name: "Croatian", quotes: { primary: { open: "\u201E", close: "\u201D", innerSpace: "none" }, secondary: { open: "\u2018", close: "\u2019", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: [] } }, dash: { parenthetical: "en-spaced", range: "en-spaced" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: ["dipl. ing.", "d. o. o."], beforeUnits: ["%", "\u2030", "\u20AC", "\xB0C", "kg"], beforeNumber: ["str."], beforeWord: [], afterSymbols: ["\xA7"], initialBinding: "none" } },
|
|
90
|
+
hu: { locale: "hu", name: "Hungarian", quotes: { primary: { open: "\u201E", close: "\u201D", innerSpace: "none" }, secondary: { open: "\xBB", close: "\xAB", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: [] } }, dash: { parenthetical: "en-spaced", range: "en-tight" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: ["a. m.", "i. sz.", "Kr. e.", "Kr. u.", "s. k.", "i. e."], beforeUnits: ["km", "kg", "kWh", "km/h", "\xB0C"], beforeNumber: [], beforeWord: [], afterSymbols: [], initialBinding: "none" } },
|
|
84
91
|
it: { locale: "it", name: "Italian", quotes: { primary: { open: "\xAB", close: "\xBB", innerSpace: "none" }, secondary: { open: "\u201C", close: "\u201D", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: ["l", "un", "d"], after: [] } }, dash: { parenthetical: "em-spaced", range: "none" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: [], beforeUnits: ["%", "\u2030", "\u20AC", "\xB0C", "km", "cm", "mm", "kg", "km/h", "kWh"], beforeNumber: ["n.", "pag."], beforeWord: [], afterSymbols: [], initialBinding: "none" } },
|
|
85
92
|
nl: { locale: "nl", name: "Dutch", quotes: { primary: { open: "\u201C", close: "\u201D", innerSpace: "none" }, secondary: { open: "\u2018", close: "\u2019", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: ["s", "t", "ns", "k", "m", "em", "r", "et"] } }, dash: { parenthetical: "en-spaced", range: "none" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: ["prof. dr."], beforeUnits: ["%", "\u2030", "\xB0C", "km", "cm", "mm", "kg", "km/h", "kWh"], beforeNumber: [], beforeWord: [], afterSymbols: ["\u20AC", "$"], initialBinding: "none" } },
|
|
86
93
|
pl: { locale: "pl", name: "Polish", quotes: { primary: { open: "\u201E", close: "\u201D", innerSpace: "none" }, secondary: { open: "\xBB", close: "\xAB", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: [] } }, dash: { parenthetical: "en-spaced", range: "en-tight" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: ["a", "i", "o", "u", "w", "z"], abbreviations: ["lek. med.", "in\u017C. g\xF3rn.", "bp sufr."], beforeUnits: ["%", "\u2030", "\xB0C", "km", "cm", "mm", "kg", "km/h", "kWh"], beforeNumber: [], beforeWord: [], afterSymbols: ["\xA7"], initialBinding: "none" } },
|
|
87
94
|
"pt-BR": { locale: "pt-BR", name: "Portuguese (Brazil)", quotes: { primary: { open: "\u201C", close: "\u201D", innerSpace: "none" }, secondary: { open: "\u2018", close: "\u2019", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: ["d", "n", "pel", "m", "t", "lh", "sant"], after: [] } }, dash: { parenthetical: "en-spaced", range: "none" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: ["p. ex."], beforeUnits: ["%", "\u2030", "\xB0C", "km", "cm", "mm", "kg", "kW", "kWh", "Hz"], beforeNumber: ["p."], beforeWord: [], afterSymbols: [], initialBinding: "none" } },
|
|
88
95
|
"pt-PT": { locale: "pt-PT", name: "Portuguese (Portugal)", quotes: { primary: { open: "\xAB", close: "\xBB", innerSpace: "none" }, secondary: { open: "\u201C", close: "\u201D", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: ["d", "n", "pel", "m", "t", "lh", "sant"], after: [] } }, dash: { parenthetical: "em-spaced", range: "none" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: ["p. ex."], beforeUnits: ["%", "\u2030", "\xB0C", "km", "cm", "mm", "kg", "kW", "kWh", "Hz"], beforeNumber: ["p."], beforeWord: [], afterSymbols: [], initialBinding: "none" } },
|
|
96
|
+
ro: { locale: "ro", name: "Romanian", quotes: { primary: { open: "\u201E", close: "\u201D", innerSpace: "none" }, secondary: { open: "\xAB", close: "\xBB", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: [] } }, dash: { parenthetical: "en-spaced", range: "none" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: [], beforeUnits: ["km", "kg", "cm", "mm", "km/h", "\xB0C"], beforeNumber: ["art.", "nr."], beforeWord: [], afterSymbols: [], initialBinding: "single" } },
|
|
89
97
|
ru: { locale: "ru", name: "Russian", quotes: { primary: { open: "\xAB", close: "\xBB", innerSpace: "none" }, secondary: { open: "\u201E", close: "\u201C", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: [] } }, dash: { parenthetical: "em-spaced", range: "em-tight" }, ellipsis: { abbreviatedAfterTerminal: true }, hyphen: { prefixes: ["\u043A\u043E\u0435-", "\u043A\u043E\u0439-"], suffixes: ["-\u0442\u043E", "-\u043B\u0438\u0431\u043E", "-\u043D\u0438\u0431\u0443\u0434\u044C", "-\u0442\u0430\u043A\u0438", "-\u043A\u0430"], compounds: ["\u0438\u0437-\u0437\u0430", "\u0438\u0437-\u043F\u043E\u0434"] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: ["\u0430", "\u0432", "\u0438", "\u043A", "\u043E", "\u0441", "\u0443", "\u0432\u043E", "\u0434\u043E", "\u0437\u0430", "\u0438\u0437", "\u043A\u043E", "\u043D\u0430", "\u043E\u0431", "\u043E\u0442", "\u043F\u043E", "\u0441\u043E"], abbreviations: ["\u0438 \u0442. \u0434.", "\u0438 \u0442. \u043F.", "\u0442. \u0435.", "\u0438 \u0434\u0440."], beforeUnits: ["%", "\u2030", "\u20BD", "\xB0C", "\u043A\u043C", "\u0441\u043C", "\u043C\u043C", "\u043A\u0433", "\u0433.", "\u0433\u0433.", "\u0432.", "\u0432\u0432.", "\u0442\u044B\u0441.", "\u043C\u043B\u043D", "\u043C\u043B\u0440\u0434"], beforeNumber: [], beforeWord: ["\u0443\u043B.", "\u043F\u043B."], afterSymbols: ["\u2116", "\xA7"], initialBinding: "chain" } },
|
|
90
98
|
sk: { locale: "sk", name: "Slovak", quotes: { primary: { open: "\u201E", close: "\u201C", innerSpace: "none" }, secondary: { open: "\u201A", close: "\u2018", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: [] } }, dash: { parenthetical: "en-spaced", range: "en-spaced" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: ["t. j.", "a pod.", "a. s."], beforeUnits: ["%", "\u2030", "kg", "km", "km/s", "m/s", "min"], beforeNumber: ["\u010D.", "ods.", "s."], beforeWord: [], afterSymbols: ["\xA7"], initialBinding: "none" } },
|
|
91
99
|
sv: { locale: "sv", name: "Swedish", quotes: { primary: { open: "\u201D", close: "\u201D", innerSpace: "none" }, secondary: { open: "\u2019", close: "\u2019", innerSpace: "none" }, elisionIdioms: [], elisionClitics: { before: [], after: [] } }, dash: { parenthetical: "en-spaced", range: "en-tight" }, ellipsis: { abbreviatedAfterTerminal: false }, hyphen: { prefixes: [], suffixes: [], compounds: [] }, nbsp: { beforePunctuation: [], narrowBeforePunctuation: [], afterShortWords: [], abbreviations: [], beforeUnits: ["%", "\u2030", "kr", "\u20AC", "kg", "g", "mg", "km", "m", "cm", "mm", "l", "dl", "cl", "ml", "kW", "kWh", "min", "sek", "tim", "h", "\xB0C"], beforeNumber: [], beforeWord: [], afterSymbols: ["\xA7"], initialBinding: "none" } },
|
|
@@ -5770,11 +5778,18 @@ function applyEditsToOrigin(origin, edits) {
|
|
|
5770
5778
|
for (let i = cursor; i < origin.length; i += 1) out.push(origin[i]);
|
|
5771
5779
|
return out;
|
|
5772
5780
|
}
|
|
5781
|
+
function endOf(origin, edit, inputLength) {
|
|
5782
|
+
for (let i = edit.end - 1; i >= edit.start; i -= 1) {
|
|
5783
|
+
const value = origin[i];
|
|
5784
|
+
if (value !== NO_ORIGIN) return value + 1;
|
|
5785
|
+
}
|
|
5786
|
+
return originAt(origin, edit.end, inputLength);
|
|
5787
|
+
}
|
|
5773
5788
|
function recordChanges(cp, edits, origin, inputLength, ruleId) {
|
|
5774
5789
|
return edits.map((edit) => ({
|
|
5775
5790
|
ruleId,
|
|
5776
5791
|
start: originAt(origin, edit.start, inputLength),
|
|
5777
|
-
end:
|
|
5792
|
+
end: endOf(origin, edit, inputLength),
|
|
5778
5793
|
before: fromCodePoints(cp.slice(edit.start, edit.end)),
|
|
5779
5794
|
after: fromCodePoints(edit.replacement)
|
|
5780
5795
|
}));
|
|
@@ -5823,20 +5838,334 @@ function runRulesRecording(cp, planned, locale, mode, narrowTarget, origin, inpu
|
|
|
5823
5838
|
return changes;
|
|
5824
5839
|
}
|
|
5825
5840
|
|
|
5841
|
+
// src/modes/spans.ts
|
|
5842
|
+
var SPACE5 = 32;
|
|
5843
|
+
var LINE_TERMINATORS = /* @__PURE__ */ new Set([
|
|
5844
|
+
10,
|
|
5845
|
+
13,
|
|
5846
|
+
11,
|
|
5847
|
+
12,
|
|
5848
|
+
133,
|
|
5849
|
+
8232,
|
|
5850
|
+
8233
|
|
5851
|
+
]);
|
|
5852
|
+
function gapIsLineBoundary(source, from, to) {
|
|
5853
|
+
for (let i = from; i < to; i += 1) {
|
|
5854
|
+
if (LINE_TERMINATORS.has(source.charCodeAt(i))) return true;
|
|
5855
|
+
}
|
|
5856
|
+
return false;
|
|
5857
|
+
}
|
|
5858
|
+
function normalizeSpans(spans) {
|
|
5859
|
+
const sorted = spans.filter((s) => s.end > s.start).sort((a, b) => a.start - b.start);
|
|
5860
|
+
const out = [];
|
|
5861
|
+
for (const span of sorted) {
|
|
5862
|
+
const last = out[out.length - 1];
|
|
5863
|
+
if (last === void 0) {
|
|
5864
|
+
out.push(span);
|
|
5865
|
+
continue;
|
|
5866
|
+
}
|
|
5867
|
+
if (span.start < last.end) {
|
|
5868
|
+
throw new PolytypoError(
|
|
5869
|
+
"POLYTYPO_RULE_CONTRACT",
|
|
5870
|
+
`mode extractor produced overlapping spans (${last.start}, ${last.end}) and (${span.start}, ${span.end})`
|
|
5871
|
+
);
|
|
5872
|
+
}
|
|
5873
|
+
if (span.start === last.end) {
|
|
5874
|
+
out[out.length - 1] = { start: last.start, end: span.end };
|
|
5875
|
+
continue;
|
|
5876
|
+
}
|
|
5877
|
+
out.push(span);
|
|
5878
|
+
}
|
|
5879
|
+
return out;
|
|
5880
|
+
}
|
|
5881
|
+
function concatenateSpans(source, spans) {
|
|
5882
|
+
const cp = [];
|
|
5883
|
+
let previous;
|
|
5884
|
+
for (const span of spans) {
|
|
5885
|
+
if (previous !== void 0) {
|
|
5886
|
+
cp.push(gapIsLineBoundary(source, previous.end, span.start) ? LINE_MARKER : MARKER);
|
|
5887
|
+
}
|
|
5888
|
+
for (const value of toCodePoints(source.slice(span.start, span.end))) cp.push(value);
|
|
5889
|
+
previous = span;
|
|
5890
|
+
}
|
|
5891
|
+
return cp;
|
|
5892
|
+
}
|
|
5893
|
+
function spanRangesOf(cp) {
|
|
5894
|
+
const ranges = [];
|
|
5895
|
+
let first = 0;
|
|
5896
|
+
for (let i = 0; i < cp.length; i += 1) {
|
|
5897
|
+
if (isMarker(cp[i])) {
|
|
5898
|
+
ranges.push({ first, last: i - 1 });
|
|
5899
|
+
first = i + 1;
|
|
5900
|
+
}
|
|
5901
|
+
}
|
|
5902
|
+
ranges.push({ first, last: cp.length - 1 });
|
|
5903
|
+
return ranges;
|
|
5904
|
+
}
|
|
5905
|
+
function spanContaining(ranges, p) {
|
|
5906
|
+
for (const range of ranges) {
|
|
5907
|
+
if (p >= range.first && p <= range.last + 1) return range;
|
|
5908
|
+
}
|
|
5909
|
+
return void 0;
|
|
5910
|
+
}
|
|
5911
|
+
function filterBoundaryEdits(cp, edits, ranges) {
|
|
5912
|
+
const out = [];
|
|
5913
|
+
for (const edit of edits) {
|
|
5914
|
+
let containsMarker = false;
|
|
5915
|
+
for (let i = edit.start; i < edit.end; i += 1) {
|
|
5916
|
+
if (isMarker(cp[i])) {
|
|
5917
|
+
containsMarker = true;
|
|
5918
|
+
break;
|
|
5919
|
+
}
|
|
5920
|
+
}
|
|
5921
|
+
if (containsMarker) continue;
|
|
5922
|
+
const p = edit.start;
|
|
5923
|
+
const q = edit.end - 1;
|
|
5924
|
+
const d = edit.end - edit.start;
|
|
5925
|
+
const r = edit.replacement.length;
|
|
5926
|
+
const span = spanContaining(ranges, p);
|
|
5927
|
+
if (span !== void 0 && (p === span.first || q === span.last)) {
|
|
5928
|
+
if (r > d) continue;
|
|
5929
|
+
const first = edit.replacement[0];
|
|
5930
|
+
const last = edit.replacement[r - 1];
|
|
5931
|
+
if (r > 0 && p === span.first && first === SPACE5 && cp[p] !== SPACE5) continue;
|
|
5932
|
+
if (r > 0 && q === span.last && last === SPACE5 && cp[q] !== SPACE5) continue;
|
|
5933
|
+
}
|
|
5934
|
+
out.push(edit);
|
|
5935
|
+
}
|
|
5936
|
+
return out;
|
|
5937
|
+
}
|
|
5938
|
+
function splitOnMarker(cp, expected) {
|
|
5939
|
+
const pieces = [[]];
|
|
5940
|
+
for (const value of cp) {
|
|
5941
|
+
if (isMarker(value)) {
|
|
5942
|
+
pieces.push([]);
|
|
5943
|
+
continue;
|
|
5944
|
+
}
|
|
5945
|
+
pieces[pieces.length - 1].push(value);
|
|
5946
|
+
}
|
|
5947
|
+
if (pieces.length !== expected) {
|
|
5948
|
+
throw new PolytypoError(
|
|
5949
|
+
"POLYTYPO_RULE_CONTRACT",
|
|
5950
|
+
`boundary markers did not survive the pipeline: expected ${expected} spans, found ${pieces.length}`
|
|
5951
|
+
);
|
|
5952
|
+
}
|
|
5953
|
+
return pieces;
|
|
5954
|
+
}
|
|
5955
|
+
function originOfSpans(source, spans) {
|
|
5956
|
+
const codePointIndexOf = new Array(source.length + 1);
|
|
5957
|
+
let cpIndex = 0;
|
|
5958
|
+
for (let i = 0; i < source.length; ) {
|
|
5959
|
+
codePointIndexOf[i] = cpIndex;
|
|
5960
|
+
const code = source.codePointAt(i);
|
|
5961
|
+
const width = code > 65535 ? 2 : 1;
|
|
5962
|
+
if (width === 2) codePointIndexOf[i + 1] = cpIndex;
|
|
5963
|
+
i += width;
|
|
5964
|
+
cpIndex += 1;
|
|
5965
|
+
}
|
|
5966
|
+
codePointIndexOf[source.length] = cpIndex;
|
|
5967
|
+
const origin = [];
|
|
5968
|
+
let previous;
|
|
5969
|
+
for (const span of spans) {
|
|
5970
|
+
if (previous !== void 0) origin.push(NO_ORIGIN);
|
|
5971
|
+
const base = codePointIndexOf[span.start];
|
|
5972
|
+
const length = toCodePoints(source.slice(span.start, span.end)).length;
|
|
5973
|
+
for (let k = 0; k < length; k += 1) origin.push(base + k);
|
|
5974
|
+
previous = span;
|
|
5975
|
+
}
|
|
5976
|
+
return origin;
|
|
5977
|
+
}
|
|
5978
|
+
|
|
5979
|
+
// src/engine/span-runner.ts
|
|
5980
|
+
function runRulesOverSpans(cp, planned, locale, mode, narrowTarget) {
|
|
5981
|
+
let current = cp;
|
|
5982
|
+
for (const id of planned) {
|
|
5983
|
+
const rule = RULES[id];
|
|
5984
|
+
if (rule === void 0) continue;
|
|
5985
|
+
const edits = rule.apply({ cp: current, locale, mode, narrowTarget });
|
|
5986
|
+
current = applyEdits(current, filterBoundaryEdits(current, edits, spanRangesOf(current)), id);
|
|
5987
|
+
}
|
|
5988
|
+
return current;
|
|
5989
|
+
}
|
|
5990
|
+
function replacementsOfUnit(source, spans, planned, locale, mode, narrowTarget) {
|
|
5991
|
+
const normalized = normalizeSpans(spans);
|
|
5992
|
+
if (normalized.length === 0) return [];
|
|
5993
|
+
const transformed = runRulesOverSpans(
|
|
5994
|
+
concatenateSpans(source, normalized),
|
|
5995
|
+
planned,
|
|
5996
|
+
locale,
|
|
5997
|
+
mode,
|
|
5998
|
+
narrowTarget
|
|
5999
|
+
);
|
|
6000
|
+
const pieces = splitOnMarker(transformed, normalized.length);
|
|
6001
|
+
return normalized.map((span, i) => ({ span, text: fromCodePoints(pieces[i]) }));
|
|
6002
|
+
}
|
|
6003
|
+
function emit2(source, replacements) {
|
|
6004
|
+
let out = "";
|
|
6005
|
+
let cursor = 0;
|
|
6006
|
+
for (const { span, text } of replacements) {
|
|
6007
|
+
const original = source.slice(span.start, span.end);
|
|
6008
|
+
out += source.slice(cursor, span.start);
|
|
6009
|
+
out += text === original ? original : text;
|
|
6010
|
+
cursor = span.end;
|
|
6011
|
+
}
|
|
6012
|
+
return out + source.slice(cursor);
|
|
6013
|
+
}
|
|
6014
|
+
function runOverSpans(source, spans, planned, locale, mode, narrowTarget) {
|
|
6015
|
+
return emit2(source, replacementsOfUnit(source, spans, planned, locale, mode, narrowTarget));
|
|
6016
|
+
}
|
|
6017
|
+
function runOverUnits(source, units, planned, locale, mode, narrowTarget) {
|
|
6018
|
+
const replacements = units.flatMap((spans) => replacementsOfUnit(source, spans, planned, locale, mode, narrowTarget)).sort((a, b) => a.span.start - b.span.start);
|
|
6019
|
+
return emit2(source, replacements);
|
|
6020
|
+
}
|
|
6021
|
+
function analyzeOverUnits(source, units, planned, locale, mode, narrowTarget) {
|
|
6022
|
+
return units.flatMap((spans) => analyzeOverSpans(source, spans, planned, locale, mode, narrowTarget)).sort((a, b) => a.start - b.start);
|
|
6023
|
+
}
|
|
6024
|
+
function analyzeOverSpans(source, spans, planned, locale, mode, narrowTarget) {
|
|
6025
|
+
const normalized = normalizeSpans(spans);
|
|
6026
|
+
if (normalized.length === 0) return [];
|
|
6027
|
+
return runRulesRecording(
|
|
6028
|
+
concatenateSpans(source, normalized),
|
|
6029
|
+
planned,
|
|
6030
|
+
locale,
|
|
6031
|
+
mode,
|
|
6032
|
+
narrowTarget,
|
|
6033
|
+
originOfSpans(source, normalized),
|
|
6034
|
+
toCodePoints(source).length,
|
|
6035
|
+
(current, edits) => filterBoundaryEdits(current, edits, spanRangesOf(current))
|
|
6036
|
+
);
|
|
6037
|
+
}
|
|
6038
|
+
|
|
6039
|
+
// src/engine/protect.ts
|
|
6040
|
+
var LINE_TERMINATORS2 = /* @__PURE__ */ new Set([
|
|
6041
|
+
10,
|
|
6042
|
+
13,
|
|
6043
|
+
11,
|
|
6044
|
+
12,
|
|
6045
|
+
133,
|
|
6046
|
+
8232,
|
|
6047
|
+
8233
|
|
6048
|
+
]);
|
|
6049
|
+
function invalid(message) {
|
|
6050
|
+
throw new PolytypoError("POLYTYPO_INVALID_OPTION", message);
|
|
6051
|
+
}
|
|
6052
|
+
function resolveProtect(value, length) {
|
|
6053
|
+
if (value === void 0 || value === null) return [];
|
|
6054
|
+
if (!Array.isArray(value)) invalid("protect must be an array of { start, end } ranges.");
|
|
6055
|
+
const holes = [];
|
|
6056
|
+
let previousEnd = 0;
|
|
6057
|
+
for (const range of value) {
|
|
6058
|
+
if (typeof range !== "object" || range === null) invalid("protect entries must be objects.");
|
|
6059
|
+
const { start, end } = range;
|
|
6060
|
+
if (!Number.isInteger(start) || !Number.isInteger(end)) {
|
|
6061
|
+
invalid("protect start and end must be integers.");
|
|
6062
|
+
}
|
|
6063
|
+
const s = start;
|
|
6064
|
+
const e = end;
|
|
6065
|
+
if (s < 0 || e <= s) invalid(`protect range [${s}, ${e}) is empty or negative.`);
|
|
6066
|
+
if (s < previousEnd)
|
|
6067
|
+
invalid(`protect range [${s}, ${e}) overlaps or precedes the previous one.`);
|
|
6068
|
+
if (e > length)
|
|
6069
|
+
invalid(`protect range [${s}, ${e}) runs past the end of the input (${length}).`);
|
|
6070
|
+
const last = holes[holes.length - 1];
|
|
6071
|
+
if (last !== void 0 && last.end === s)
|
|
6072
|
+
holes[holes.length - 1] = { start: last.start, end: e };
|
|
6073
|
+
else holes.push({ start: s, end: e });
|
|
6074
|
+
previousEnd = e;
|
|
6075
|
+
}
|
|
6076
|
+
return holes;
|
|
6077
|
+
}
|
|
6078
|
+
function assertNoProtect(value, mode) {
|
|
6079
|
+
if (value === void 0 || value === null) return;
|
|
6080
|
+
if (Array.isArray(value) && value.length === 0) return;
|
|
6081
|
+
invalid(`protect is only available in text mode, not ${mode}.`);
|
|
6082
|
+
}
|
|
6083
|
+
function layout(cp, holes) {
|
|
6084
|
+
const array = [];
|
|
6085
|
+
const origin = [];
|
|
6086
|
+
let cursor = 0;
|
|
6087
|
+
for (const hole of holes) {
|
|
6088
|
+
for (let i = cursor; i < hole.start; i += 1) {
|
|
6089
|
+
array.push(cp[i]);
|
|
6090
|
+
origin.push(i);
|
|
6091
|
+
}
|
|
6092
|
+
let line = false;
|
|
6093
|
+
for (let i = hole.start; i < hole.end; i += 1) {
|
|
6094
|
+
if (LINE_TERMINATORS2.has(cp[i])) {
|
|
6095
|
+
line = true;
|
|
6096
|
+
break;
|
|
6097
|
+
}
|
|
6098
|
+
}
|
|
6099
|
+
array.push(line ? LINE_MARKER : MARKER);
|
|
6100
|
+
origin.push(NO_ORIGIN);
|
|
6101
|
+
cursor = hole.end;
|
|
6102
|
+
}
|
|
6103
|
+
for (let i = cursor; i < cp.length; i += 1) {
|
|
6104
|
+
array.push(cp[i]);
|
|
6105
|
+
origin.push(i);
|
|
6106
|
+
}
|
|
6107
|
+
return { array, origin };
|
|
6108
|
+
}
|
|
6109
|
+
function runProtectedMapped(input, holes, planned, locale, narrowTarget) {
|
|
6110
|
+
const cp = toCodePoints(input);
|
|
6111
|
+
const { array } = layout(cp, holes);
|
|
6112
|
+
const out = runRulesOverSpans(array, planned, locale, "text", narrowTarget);
|
|
6113
|
+
const result = [];
|
|
6114
|
+
const mapped = [];
|
|
6115
|
+
let hole = 0;
|
|
6116
|
+
for (const value of out) {
|
|
6117
|
+
if (isMarker(value)) {
|
|
6118
|
+
const h = holes[hole];
|
|
6119
|
+
const start = result.length;
|
|
6120
|
+
for (let i = h.start; i < h.end; i += 1) result.push(cp[i]);
|
|
6121
|
+
mapped.push({ start, end: result.length });
|
|
6122
|
+
hole += 1;
|
|
6123
|
+
continue;
|
|
6124
|
+
}
|
|
6125
|
+
result.push(value);
|
|
6126
|
+
}
|
|
6127
|
+
if (hole !== holes.length) {
|
|
6128
|
+
throw new PolytypoError(
|
|
6129
|
+
"POLYTYPO_RULE_CONTRACT",
|
|
6130
|
+
"boundary markers did not survive the pipeline."
|
|
6131
|
+
);
|
|
6132
|
+
}
|
|
6133
|
+
return { text: fromCodePoints(result), holes: mapped };
|
|
6134
|
+
}
|
|
6135
|
+
function runProtected(input, holes, planned, locale, narrowTarget) {
|
|
6136
|
+
return runProtectedMapped(input, holes, planned, locale, narrowTarget).text;
|
|
6137
|
+
}
|
|
6138
|
+
function analyzeProtected(input, holes, planned, locale, narrowTarget) {
|
|
6139
|
+
const cp = toCodePoints(input);
|
|
6140
|
+
const { array, origin } = layout(cp, holes);
|
|
6141
|
+
return runRulesRecording(
|
|
6142
|
+
array,
|
|
6143
|
+
planned,
|
|
6144
|
+
locale,
|
|
6145
|
+
"text",
|
|
6146
|
+
narrowTarget,
|
|
6147
|
+
origin,
|
|
6148
|
+
cp.length,
|
|
6149
|
+
(current, edits) => filterBoundaryEdits(current, edits, spanRangesOf(current))
|
|
6150
|
+
);
|
|
6151
|
+
}
|
|
6152
|
+
|
|
5826
6153
|
export {
|
|
5827
6154
|
PolytypoError,
|
|
5828
6155
|
toCodePoints,
|
|
5829
6156
|
fromCodePoints,
|
|
5830
6157
|
getLocaleData,
|
|
5831
6158
|
resolveNarrowTarget,
|
|
5832
|
-
MARKER,
|
|
5833
|
-
LINE_MARKER,
|
|
5834
|
-
isMarker,
|
|
5835
|
-
RULES,
|
|
5836
|
-
applyEdits,
|
|
5837
|
-
NO_ORIGIN,
|
|
5838
6159
|
planRules,
|
|
5839
6160
|
runRules,
|
|
5840
|
-
runRulesRecording
|
|
6161
|
+
runRulesRecording,
|
|
6162
|
+
runOverSpans,
|
|
6163
|
+
runOverUnits,
|
|
6164
|
+
analyzeOverUnits,
|
|
6165
|
+
analyzeOverSpans,
|
|
6166
|
+
resolveProtect,
|
|
6167
|
+
assertNoProtect,
|
|
6168
|
+
runProtected,
|
|
6169
|
+
analyzeProtected
|
|
5841
6170
|
};
|
|
5842
|
-
//# sourceMappingURL=chunk-
|
|
6171
|
+
//# sourceMappingURL=chunk-MF6PJO7O.js.map
|