yomitan-core 0.1.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.
Files changed (207) hide show
  1. package/README.md +485 -0
  2. package/dist/anki-connect-BQyCGW3O.cjs +513 -0
  3. package/dist/anki-connect-BQyCGW3O.cjs.map +1 -0
  4. package/dist/anki-connect-CPPuhyiQ.js +6 -0
  5. package/dist/anki-connect-DbrQHphS.js +495 -0
  6. package/dist/anki-connect-DbrQHphS.js.map +1 -0
  7. package/dist/anki-connect-DcheJrp-.cjs +6 -0
  8. package/dist/anki.cjs +1758 -0
  9. package/dist/anki.cjs.map +1 -0
  10. package/dist/anki.d.cts +751 -0
  11. package/dist/anki.d.cts.map +1 -0
  12. package/dist/anki.d.ts +751 -0
  13. package/dist/anki.d.ts.map +1 -0
  14. package/dist/anki.js +1751 -0
  15. package/dist/anki.js.map +1 -0
  16. package/dist/audio-D9DvYyB7.d.cts +48 -0
  17. package/dist/audio-D9DvYyB7.d.cts.map +1 -0
  18. package/dist/audio-DQulUkDM.d.ts +48 -0
  19. package/dist/audio-DQulUkDM.d.ts.map +1 -0
  20. package/dist/audio-url-generator-BXvQaqUi.cjs +4 -0
  21. package/dist/audio-url-generator-Dy2hb2Mm.cjs +414 -0
  22. package/dist/audio-url-generator-Dy2hb2Mm.cjs.map +1 -0
  23. package/dist/audio-url-generator-Qi0rfzHz.js +4 -0
  24. package/dist/audio-url-generator-pFQAB5Nb.js +390 -0
  25. package/dist/audio-url-generator-pFQAB5Nb.js.map +1 -0
  26. package/dist/audio.cjs +7 -0
  27. package/dist/audio.d.cts +86 -0
  28. package/dist/audio.d.cts.map +1 -0
  29. package/dist/audio.d.ts +86 -0
  30. package/dist/audio.d.ts.map +1 -0
  31. package/dist/audio.js +4 -0
  32. package/dist/batch-processor-BR-gB3H3.js +84 -0
  33. package/dist/batch-processor-BR-gB3H3.js.map +1 -0
  34. package/dist/batch-processor-CSF1acTw.cjs +3 -0
  35. package/dist/batch-processor-DFqM_L-_.cjs +91 -0
  36. package/dist/batch-processor-DFqM_L-_.cjs.map +1 -0
  37. package/dist/batch-processor-Quo9jUyf.js +3 -0
  38. package/dist/chunk-BCwAaXi7.cjs +31 -0
  39. package/dist/cjk-util-Dp0ZU0sh.cjs +167 -0
  40. package/dist/cjk-util-Dp0ZU0sh.cjs.map +1 -0
  41. package/dist/cjk-util-DubXBGDG.js +94 -0
  42. package/dist/cjk-util-DubXBGDG.js.map +1 -0
  43. package/dist/core-BUpclilG.d.cts +102 -0
  44. package/dist/core-BUpclilG.d.cts.map +1 -0
  45. package/dist/core-DFUj5GtA.d.ts +102 -0
  46. package/dist/core-DFUj5GtA.d.ts.map +1 -0
  47. package/dist/database.cjs +7 -0
  48. package/dist/database.d.cts +4 -0
  49. package/dist/database.d.ts +4 -0
  50. package/dist/database.js +5 -0
  51. package/dist/dictionary-D7l-qFt1.d.cts +316 -0
  52. package/dist/dictionary-D7l-qFt1.d.cts.map +1 -0
  53. package/dist/dictionary-_vzfBLWi.d.ts +316 -0
  54. package/dist/dictionary-_vzfBLWi.d.ts.map +1 -0
  55. package/dist/dictionary-data-util-CHnRdYZ9.cjs +378 -0
  56. package/dist/dictionary-data-util-CHnRdYZ9.cjs.map +1 -0
  57. package/dist/dictionary-data-util-CfOLfEDE.js +323 -0
  58. package/dist/dictionary-data-util-CfOLfEDE.js.map +1 -0
  59. package/dist/dictionary-database-BDC2f9zc.d.ts +58 -0
  60. package/dist/dictionary-database-BDC2f9zc.d.ts.map +1 -0
  61. package/dist/dictionary-database-CU4TsvCC.js +393 -0
  62. package/dist/dictionary-database-CU4TsvCC.js.map +1 -0
  63. package/dist/dictionary-database-DsOi04Sg.d.cts +58 -0
  64. package/dist/dictionary-database-DsOi04Sg.d.cts.map +1 -0
  65. package/dist/dictionary-database-lvFvftnO.cjs +412 -0
  66. package/dist/dictionary-database-lvFvftnO.cjs.map +1 -0
  67. package/dist/dictionary-importer-BkQQSBhm.d.ts +237 -0
  68. package/dist/dictionary-importer-BkQQSBhm.d.ts.map +1 -0
  69. package/dist/dictionary-importer-Cen1z6co.js +1821 -0
  70. package/dist/dictionary-importer-Cen1z6co.js.map +1 -0
  71. package/dist/dictionary-importer-DYmmWmcX.cjs +8 -0
  72. package/dist/dictionary-importer-Da3AuTZw.d.cts +237 -0
  73. package/dist/dictionary-importer-Da3AuTZw.d.cts.map +1 -0
  74. package/dist/dictionary-importer-Dhn75iZ4.cjs +1834 -0
  75. package/dist/dictionary-importer-Dhn75iZ4.cjs.map +1 -0
  76. package/dist/dictionary-importer-xWkel0h-.js +8 -0
  77. package/dist/dictionary-update-checker-BNE4pGTx.js +4 -0
  78. package/dist/dictionary-update-checker-Byjvifd2.cjs +75 -0
  79. package/dist/dictionary-update-checker-Byjvifd2.cjs.map +1 -0
  80. package/dist/dictionary-update-checker-YdpalZ41.cjs +4 -0
  81. package/dist/dictionary-update-checker-kKukiovj.js +69 -0
  82. package/dist/dictionary-update-checker-kKukiovj.js.map +1 -0
  83. package/dist/display-generator-BGVWiI0t.js +746 -0
  84. package/dist/display-generator-BGVWiI0t.js.map +1 -0
  85. package/dist/display-generator-BMQmG5Ov.cjs +9 -0
  86. package/dist/display-generator-BxZ7mBjP.js +9 -0
  87. package/dist/display-generator-DyP-HNzP.cjs +758 -0
  88. package/dist/display-generator-DyP-HNzP.cjs.map +1 -0
  89. package/dist/errors-BSezaJwm.cjs +35 -0
  90. package/dist/errors-BSezaJwm.cjs.map +1 -0
  91. package/dist/errors-DuuDSO5N.js +22 -0
  92. package/dist/errors-DuuDSO5N.js.map +1 -0
  93. package/dist/frequency-ranking-BXjfhhUQ.js +3 -0
  94. package/dist/frequency-ranking-Cx1kkIrw.cjs +3 -0
  95. package/dist/frequency-ranking-DEJMTMdg.js +159 -0
  96. package/dist/frequency-ranking-DEJMTMdg.js.map +1 -0
  97. package/dist/frequency-ranking-DVYxTXN-.cjs +166 -0
  98. package/dist/frequency-ranking-DVYxTXN-.cjs.map +1 -0
  99. package/dist/furigana-5HK97CY8.js +4 -0
  100. package/dist/furigana-9bBI9-qe.d.ts +47 -0
  101. package/dist/furigana-9bBI9-qe.d.ts.map +1 -0
  102. package/dist/furigana-B3-0y231.js +471 -0
  103. package/dist/furigana-B3-0y231.js.map +1 -0
  104. package/dist/furigana-CjOhzvZt.d.cts +47 -0
  105. package/dist/furigana-CjOhzvZt.d.cts.map +1 -0
  106. package/dist/furigana-DpZLcues.cjs +609 -0
  107. package/dist/furigana-DpZLcues.cjs.map +1 -0
  108. package/dist/furigana-h3v2ub4-.cjs +4 -0
  109. package/dist/import.cjs +12 -0
  110. package/dist/import.d.cts +107 -0
  111. package/dist/import.d.cts.map +1 -0
  112. package/dist/import.d.ts +107 -0
  113. package/dist/import.d.ts.map +1 -0
  114. package/dist/import.js +9 -0
  115. package/dist/index.cjs +275 -0
  116. package/dist/index.cjs.map +1 -0
  117. package/dist/index.d.cts +211 -0
  118. package/dist/index.d.cts.map +1 -0
  119. package/dist/index.d.ts +211 -0
  120. package/dist/index.d.ts.map +1 -0
  121. package/dist/index.js +238 -0
  122. package/dist/index.js.map +1 -0
  123. package/dist/json-DGd-cunA.js +17 -0
  124. package/dist/json-DGd-cunA.js.map +1 -0
  125. package/dist/json-DKWp-B7Y.cjs +30 -0
  126. package/dist/json-DKWp-B7Y.cjs.map +1 -0
  127. package/dist/language-KN_u-nTR.d.ts +104 -0
  128. package/dist/language-KN_u-nTR.d.ts.map +1 -0
  129. package/dist/language-xAbQxgXc.d.cts +104 -0
  130. package/dist/language-xAbQxgXc.d.cts.map +1 -0
  131. package/dist/language.cjs +15626 -0
  132. package/dist/language.cjs.map +1 -0
  133. package/dist/language.d.cts +959 -0
  134. package/dist/language.d.cts.map +1 -0
  135. package/dist/language.d.ts +959 -0
  136. package/dist/language.d.ts.map +1 -0
  137. package/dist/language.js +15522 -0
  138. package/dist/language.js.map +1 -0
  139. package/dist/log-D8KtR3aP.cjs +67 -0
  140. package/dist/log-D8KtR3aP.cjs.map +1 -0
  141. package/dist/log-hgSll-dS.js +60 -0
  142. package/dist/log-hgSll-dS.js.map +1 -0
  143. package/dist/lookup.cjs +13 -0
  144. package/dist/lookup.d.cts +161 -0
  145. package/dist/lookup.d.cts.map +1 -0
  146. package/dist/lookup.d.ts +161 -0
  147. package/dist/lookup.d.ts.map +1 -0
  148. package/dist/lookup.js +10 -0
  149. package/dist/media-loader-BABA_E4W.js +3 -0
  150. package/dist/media-loader-Ce9cuANS.cjs +21 -0
  151. package/dist/media-loader-Ce9cuANS.cjs.map +1 -0
  152. package/dist/media-loader-qRti-Q6h.js +14 -0
  153. package/dist/media-loader-qRti-Q6h.js.map +1 -0
  154. package/dist/media-loader-xlUGaJrx.cjs +3 -0
  155. package/dist/multi-language-transformer-AlxOM6b3.js +637 -0
  156. package/dist/multi-language-transformer-AlxOM6b3.js.map +1 -0
  157. package/dist/multi-language-transformer-MdbQBBOt.cjs +685 -0
  158. package/dist/multi-language-transformer-MdbQBBOt.cjs.map +1 -0
  159. package/dist/multi-language-transformer-SEhcJXEB.d.ts +63 -0
  160. package/dist/multi-language-transformer-SEhcJXEB.d.ts.map +1 -0
  161. package/dist/multi-language-transformer-Ul9mbRce.d.cts +63 -0
  162. package/dist/multi-language-transformer-Ul9mbRce.d.cts.map +1 -0
  163. package/dist/pronunciation-generator-BtBc4q_V.js +397 -0
  164. package/dist/pronunciation-generator-BtBc4q_V.js.map +1 -0
  165. package/dist/pronunciation-generator-CBYdXYou.js +4 -0
  166. package/dist/pronunciation-generator-CFbZlf5J.cjs +445 -0
  167. package/dist/pronunciation-generator-CFbZlf5J.cjs.map +1 -0
  168. package/dist/pronunciation-generator-DOz9hEuk.cjs +4 -0
  169. package/dist/render.cjs +2796 -0
  170. package/dist/render.cjs.map +1 -0
  171. package/dist/render.d.cts +424 -0
  172. package/dist/render.d.cts.map +1 -0
  173. package/dist/render.d.ts +424 -0
  174. package/dist/render.d.ts.map +1 -0
  175. package/dist/render.js +2777 -0
  176. package/dist/render.js.map +1 -0
  177. package/dist/sentence-parser-BPAJNzqW.js +126 -0
  178. package/dist/sentence-parser-BPAJNzqW.js.map +1 -0
  179. package/dist/sentence-parser-BVIOI64h.cjs +132 -0
  180. package/dist/sentence-parser-BVIOI64h.cjs.map +1 -0
  181. package/dist/sentence-parser-BoHO3cHn.js +5 -0
  182. package/dist/sentence-parser-DQVLSW0z.cjs +5 -0
  183. package/dist/structured-content-generator-BtOApkTW.cjs +4 -0
  184. package/dist/structured-content-generator-Bx62RYa8.js +4 -0
  185. package/dist/structured-content-generator-CLnybumI.js +276 -0
  186. package/dist/structured-content-generator-CLnybumI.js.map +1 -0
  187. package/dist/structured-content-generator-DrwkB0-k.cjs +282 -0
  188. package/dist/structured-content-generator-DrwkB0-k.cjs.map +1 -0
  189. package/dist/text-utilities-B7PIythe.js +8 -0
  190. package/dist/text-utilities-B7PIythe.js.map +1 -0
  191. package/dist/text-utilities-Del2Ivkg.cjs +15 -0
  192. package/dist/text-utilities-Del2Ivkg.cjs.map +1 -0
  193. package/dist/translator-CRPlPzqi.cjs +1545 -0
  194. package/dist/translator-CRPlPzqi.cjs.map +1 -0
  195. package/dist/translator-CWgG5drA.js +1539 -0
  196. package/dist/translator-CWgG5drA.js.map +1 -0
  197. package/dist/translator-CaGtJvnQ.cjs +6 -0
  198. package/dist/translator-Cc6OGxrW.d.ts +180 -0
  199. package/dist/translator-Cc6OGxrW.d.ts.map +1 -0
  200. package/dist/translator-CcA-s-W4.d.cts +180 -0
  201. package/dist/translator-CcA-s-W4.d.cts.map +1 -0
  202. package/dist/translator-CuJOTK6l.js +6 -0
  203. package/dist/utilities-C-lbZaJE.cjs +52 -0
  204. package/dist/utilities-C-lbZaJE.cjs.map +1 -0
  205. package/dist/utilities-bi3EF-q5.js +33 -0
  206. package/dist/utilities-bi3EF-q5.js.map +1 -0
  207. package/package.json +102 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pronunciation-generator-BtBc4q_V.js","names":["codePoint: number","moraIndex: number","pitchAccentValue: number | string","text: string","isVerbOrAdjective: boolean","pitchString: string","downsteps: number[]","morae: string[]","i: number","character: string","doc: Document","morae: string[]","pitchPositions: number | string","nasalPositions: number[]","devoicePositions: number[]","characterNodes: HTMLSpanElement[]","pathPoints: string[]","downstepPositions: number | string","mora: string[]","circles: Element[]","paths: Element[]","container: Element","svgns: string","x: number","y: number","className: string","radius: string","numberOfMora: number","pitchValue: number | string","o: boolean","node","mora: string","svg: SVGSVGElement","type: string","stepWidth: number"],"sources":["../src/render/japanese-util.ts","../src/render/pronunciation-generator.ts"],"sourcesContent":["/*\n * Copyright (C) 2024-2025 Yomitan Authors\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <https://www.gnu.org/licenses/>.\n */\n\n/**\n * Japanese language utility functions used by the display rendering layer.\n * These are ported from the Yomitan extension's japanese.js module.\n */\n\nimport { CJK_IDEOGRAPH_RANGES, isCodePointInRanges } from '../language/cjk-util.js';\n\nexport type PitchCategory = 'heiban' | 'atamadaka' | 'nakadaka' | 'odaka' | 'kifuku';\n\nexport type DiacriticType = 'dakuten' | 'handakuten';\n\nconst SMALL_KANA_SET = new Set('ぁぃぅぇぉゃゅょゎァィゥェォャュョヮ');\n\nconst kana =\n 'うゔ-かが-きぎ-くぐ-けげ-こご-さざ-しじ-すず-せぜ-そぞ-ただ-ちぢ-つづ-てで-とど-はばぱひびぴふぶぷへべぺほぼぽワヷ-ヰヸ-ウヴ-ヱヹ-ヲヺ-カガ-キギ-クグ-ケゲ-コゴ-サザ-シジ-スズ-セゼ-ソゾ-タダ-チヂ-ツヅ-テデ-トド-ハバパヒビピフブプヘベペホボポ';\nconst DIACRITIC_MAPPING = new Map<string, { character: string; type: DiacriticType }>();\nfor (let i = 0, ii = kana.length; i < ii; i += 3) {\n const character = kana[i];\n const dakuten = kana[i + 1];\n const handakuten = kana[i + 2];\n DIACRITIC_MAPPING.set(dakuten, { character, type: 'dakuten' });\n if (handakuten !== '-') {\n DIACRITIC_MAPPING.set(handakuten, { character, type: 'handakuten' });\n }\n}\n\n/**\n * Checks if a code point represents a CJK kanji character.\n */\nexport function isCodePointKanji(codePoint: number): boolean {\n return isCodePointInRanges(codePoint, CJK_IDEOGRAPH_RANGES);\n}\n\n/**\n * Determines whether a mora at a given index has high pitch.\n * @param moraIndex - The 0-based mora index to check.\n * @param pitchAccentValue - The pitch accent pattern (number = downstep position, string = HL pattern).\n * @returns True if the mora at the given index has high pitch.\n */\nexport function isMoraPitchHigh(moraIndex: number, pitchAccentValue: number | string): boolean {\n if (typeof pitchAccentValue === 'string') {\n return pitchAccentValue[moraIndex] === 'H';\n }\n switch (pitchAccentValue) {\n case 0:\n return moraIndex > 0;\n case 1:\n return moraIndex < 1;\n default:\n return moraIndex > 0 && moraIndex < pitchAccentValue;\n }\n}\n\n/**\n * Determines the pitch accent category for a word.\n * @param text - The reading text.\n * @param pitchAccentValue - The pitch accent pattern.\n * @param isVerbOrAdjective - Whether the word is a verb or adjective (not a noun).\n * @returns The pitch category, or null if it cannot be determined.\n */\nexport function getPitchCategory(\n text: string,\n pitchAccentValue: number | string,\n isVerbOrAdjective: boolean,\n): PitchCategory | null {\n const pitchAccentDownstepPosition =\n typeof pitchAccentValue === 'string' ? getDownstepPositions(pitchAccentValue)[0] : pitchAccentValue;\n if (pitchAccentDownstepPosition === 0) {\n return 'heiban';\n }\n if (isVerbOrAdjective) {\n return pitchAccentDownstepPosition > 0 ? 'kifuku' : null;\n }\n if (pitchAccentDownstepPosition === 1) {\n return 'atamadaka';\n }\n if (pitchAccentDownstepPosition > 1) {\n return pitchAccentDownstepPosition >= getKanaMoraCount(text) ? 'odaka' : 'nakadaka';\n }\n return null;\n}\n\n/**\n * Extracts downstep positions from an HL pitch string pattern.\n * @param pitchString - A string of 'H' and 'L' characters representing pitch.\n * @returns Array of downstep positions (1-indexed mora positions where pitch drops).\n */\nexport function getDownstepPositions(pitchString: string): number[] {\n const downsteps: number[] = [];\n const moraCount = pitchString.length;\n for (let i = 0; i < moraCount; i++) {\n if (i > 0 && pitchString[i - 1] === 'H' && pitchString[i] === 'L') {\n downsteps.push(i);\n }\n }\n if (downsteps.length === 0) {\n downsteps.push(pitchString.startsWith('L') ? 0 : -1);\n }\n return downsteps;\n}\n\n/**\n * Splits a kana text into an array of morae, combining small kana with their preceding character.\n * @param text - The kana text to split.\n * @returns Array of mora strings.\n */\nexport function getKanaMorae(text: string): string[] {\n const morae: string[] = [];\n let i: number;\n for (const c of text) {\n if (SMALL_KANA_SET.has(c) && (i = morae.length) > 0) {\n morae[i - 1] += c;\n } else {\n morae.push(c);\n }\n }\n return morae;\n}\n\n/**\n * Counts the number of morae in a kana text.\n * @param text - The kana text to count morae in.\n * @returns The number of morae.\n */\nexport function getKanaMoraCount(text: string): number {\n let moraCount = 0;\n for (const c of text) {\n if (!(SMALL_KANA_SET.has(c) && moraCount > 0)) {\n ++moraCount;\n }\n }\n return moraCount;\n}\n\n/**\n * Gets diacritic information for a kana character.\n * If the character is a dakuten or handakuten variant, returns the base character and type.\n * @param character - The kana character to check.\n * @returns An object with the base character and diacritic type, or null if not a diacritic variant.\n */\nexport function getKanaDiacriticInfo(character: string): { character: string; type: DiacriticType } | null {\n const info = DIACRITIC_MAPPING.get(character);\n return typeof info !== 'undefined' ? { character: info.character, type: info.type } : null;\n}\n","/*\n * Copyright (C) 2023-2025 Yomitan Authors\n * Copyright (C) 2021-2022 Yomichan Authors\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport { getDownstepPositions, getKanaDiacriticInfo, isMoraPitchHigh } from './japanese-util.js';\n\n/**\n * Generates DOM elements for pronunciation visualizations including\n * pitch accent text, graphs, and downstep position notation.\n */\nexport class PronunciationGenerator {\n private _document: Document;\n\n /**\n * Creates a new PronunciationGenerator.\n * @param doc - The Document object to use for creating DOM elements.\n */\n constructor(doc: Document) {\n this._document = doc;\n }\n\n /**\n * Creates a span element containing styled mora elements for pronunciation text.\n * @param morae - Array of mora strings.\n * @param pitchPositions - The pitch accent downstep position (number or HL string pattern).\n * @param nasalPositions - Array of 1-indexed mora positions that are nasalized.\n * @param devoicePositions - Array of 1-indexed mora positions that are devoiced.\n * @returns A span element with class `pronunciation-text`.\n */\n createPronunciationText(\n morae: string[],\n pitchPositions: number | string,\n nasalPositions: number[],\n devoicePositions: number[],\n ): HTMLSpanElement {\n const nasalPositionsSet = nasalPositions.length > 0 ? new Set(nasalPositions) : null;\n const devoicePositionsSet = devoicePositions.length > 0 ? new Set(devoicePositions) : null;\n const container = this._document.createElement('span');\n container.className = 'pronunciation-text';\n for (let i = 0, ii = morae.length; i < ii; ++i) {\n const i1 = i + 1;\n const mora = morae[i];\n const highPitch = isMoraPitchHigh(i, pitchPositions);\n const highPitchNext = isMoraPitchHigh(i1, pitchPositions);\n const nasal = nasalPositionsSet?.has(i1);\n const devoice = devoicePositionsSet?.has(i1);\n\n const n1 = this._document.createElement('span');\n n1.className = 'pronunciation-mora';\n n1.dataset.position = `${i}`;\n n1.dataset.pitch = highPitch ? 'high' : 'low';\n n1.dataset.pitchNext = highPitchNext ? 'high' : 'low';\n\n const characterNodes: HTMLSpanElement[] = [];\n for (const character of mora) {\n const n2 = this._document.createElement('span');\n n2.className = 'pronunciation-character';\n n2.textContent = character;\n n1.appendChild(n2);\n characterNodes.push(n2);\n }\n\n if (devoice) {\n n1.dataset.devoice = 'true';\n const n3 = this._document.createElement('span');\n n3.className = 'pronunciation-devoice-indicator';\n n1.appendChild(n3);\n }\n if (nasal && characterNodes.length > 0) {\n n1.dataset.nasal = 'true';\n\n const group = this._document.createElement('span');\n group.className = 'pronunciation-character-group';\n\n const n2 = characterNodes[0];\n const character = n2.textContent as string;\n\n const characterInfo = getKanaDiacriticInfo(character);\n if (characterInfo !== null) {\n n1.dataset.originalText = mora;\n n2.dataset.originalText = character;\n n2.textContent = characterInfo.character;\n }\n\n let n3 = this._document.createElement('span');\n n3.className = 'pronunciation-nasal-diacritic';\n n3.textContent = '\\u309a'; // Combining handakuten\n group.appendChild(n3);\n\n n3 = this._document.createElement('span');\n n3.className = 'pronunciation-nasal-indicator';\n group.appendChild(n3);\n\n (n2.parentNode as ParentNode).replaceChild(group, n2);\n group.insertBefore(n2, group.firstChild);\n }\n\n const line = this._document.createElement('span');\n line.className = 'pronunciation-mora-line';\n n1.appendChild(line);\n\n container.appendChild(n1);\n }\n return container;\n }\n\n /**\n * Creates an SVG element representing the pitch accent graph.\n * @param morae - Array of mora strings.\n * @param pitchPositions - The pitch accent downstep position (number or HL string pattern).\n * @returns An SVG element with class `pronunciation-graph`.\n */\n createPronunciationGraph(morae: string[], pitchPositions: number | string): SVGSVGElement {\n const ii = morae.length;\n\n const svgns = 'http://www.w3.org/2000/svg';\n const svg = this._document.createElementNS(svgns, 'svg') as SVGSVGElement;\n svg.setAttribute('xmlns', svgns);\n svg.setAttribute('class', 'pronunciation-graph');\n svg.setAttribute('focusable', 'false');\n svg.setAttribute('viewBox', `0 0 ${50 * (ii + 1)} 100`);\n\n if (ii <= 0) {\n return svg;\n }\n\n const path1 = this._document.createElementNS(svgns, 'path');\n svg.appendChild(path1);\n\n const path2 = this._document.createElementNS(svgns, 'path');\n svg.appendChild(path2);\n\n const pathPoints: string[] = [];\n for (let i = 0; i < ii; ++i) {\n const highPitch = isMoraPitchHigh(i, pitchPositions);\n const highPitchNext = isMoraPitchHigh(i + 1, pitchPositions);\n const x = i * 50 + 25;\n const y = highPitch ? 25 : 75;\n if (highPitch && !highPitchNext) {\n this._addGraphDotDownstep(svg, svgns, x, y);\n } else {\n this._addGraphDot(svg, svgns, x, y);\n }\n pathPoints.push(`${x} ${y}`);\n }\n\n path1.setAttribute('class', 'pronunciation-graph-line');\n path1.setAttribute('d', `M${pathPoints.join(' L')}`);\n\n pathPoints.splice(0, ii - 1);\n {\n const highPitch = isMoraPitchHigh(ii, pitchPositions);\n const x = ii * 50 + 25;\n const y = highPitch ? 25 : 75;\n this._addGraphTriangle(svg, svgns, x, y);\n pathPoints.push(`${x} ${y}`);\n }\n\n path2.setAttribute('class', 'pronunciation-graph-line-tail');\n path2.setAttribute('d', `M${pathPoints.join(' L')}`);\n\n return svg;\n }\n\n /**\n * Creates a span element showing the downstep position in bracket notation.\n * @param downstepPositions - The downstep position (number or HL string pattern).\n * @returns A span element with class `pronunciation-downstep-notation`.\n */\n createPronunciationDownstepPosition(downstepPositions: number | string): HTMLSpanElement {\n const downsteps =\n typeof downstepPositions === 'string' ? getDownstepPositions(downstepPositions) : downstepPositions;\n const downstepPositionString = `${downsteps}`;\n\n const n1 = this._document.createElement('span');\n n1.className = 'pronunciation-downstep-notation';\n n1.dataset.downstepPosition = downstepPositionString;\n\n let n2 = this._document.createElement('span');\n n2.className = 'pronunciation-downstep-notation-prefix';\n n2.textContent = '[';\n n1.appendChild(n2);\n\n n2 = this._document.createElement('span');\n n2.className = 'pronunciation-downstep-notation-number';\n n2.textContent = downstepPositionString;\n n1.appendChild(n2);\n\n n2 = this._document.createElement('span');\n n2.className = 'pronunciation-downstep-notation-suffix';\n n2.textContent = ']';\n n1.appendChild(n2);\n\n return n1;\n }\n\n /**\n * Creates a Jidoujisho-style pronunciation graph SVG.\n * @param mora - Array of mora strings.\n * @param pitchPositions - The pitch accent downstep position (number or HL string pattern).\n * @returns An SVG element.\n */\n createPronunciationGraphJJ(mora: string[], pitchPositions: number | string): SVGSVGElement {\n const patt = this._pitchValueToPattJJ(mora.length, pitchPositions);\n\n const positions = Math.max(mora.length, patt.length);\n const stepWidth = 35;\n const marginLr = 16;\n const svgWidth = Math.max(0, (positions - 1) * stepWidth + marginLr * 2);\n\n const svgns = 'http://www.w3.org/2000/svg';\n const svg = this._document.createElementNS(svgns, 'svg') as SVGSVGElement;\n svg.setAttribute('xmlns', svgns);\n svg.setAttribute('width', `${svgWidth * (3 / 5)}px`);\n svg.setAttribute('height', '45px');\n svg.setAttribute('viewBox', `0 0 ${svgWidth} 75`);\n\n if (mora.length <= 0) {\n return svg;\n }\n\n for (let i = 0; i < mora.length; i++) {\n const xCenter = marginLr + i * stepWidth;\n this._textJJ(xCenter - 11, mora[i], svgns, svg);\n }\n\n let pathType = '';\n\n const circles: Element[] = [];\n const paths: Element[] = [];\n\n let prevCenter = [-1, -1];\n for (let i = 0; i < patt.length; i++) {\n const xCenter = marginLr + i * stepWidth;\n const accent = patt[i];\n let yCenter = 0;\n if (accent === 'H') {\n yCenter = 5;\n } else if (accent === 'L') {\n yCenter = 30;\n }\n circles.push(this._circleJJ(xCenter, yCenter, i >= mora.length, svgns));\n\n if (i > 0) {\n if (prevCenter[1] === yCenter) {\n pathType = 's';\n } else if (prevCenter[1] < yCenter) {\n pathType = 'd';\n } else if (prevCenter[1] > yCenter) {\n pathType = 'u';\n }\n paths.push(this._pathJJ(prevCenter[0], prevCenter[1], pathType, stepWidth, svgns));\n }\n prevCenter = [xCenter, yCenter];\n }\n\n for (const path of paths) {\n svg.appendChild(path);\n }\n\n for (const circle of circles) {\n svg.appendChild(circle);\n }\n\n return svg;\n }\n\n // Private\n\n private _addGraphDot(container: Element, svgns: string, x: number, y: number): void {\n container.appendChild(this._createGraphCircle(svgns, 'pronunciation-graph-dot', x, y, '15'));\n }\n\n private _addGraphDotDownstep(container: Element, svgns: string, x: number, y: number): void {\n container.appendChild(this._createGraphCircle(svgns, 'pronunciation-graph-dot-downstep1', x, y, '15'));\n container.appendChild(this._createGraphCircle(svgns, 'pronunciation-graph-dot-downstep2', x, y, '5'));\n }\n\n private _addGraphTriangle(container: Element, svgns: string, x: number, y: number): void {\n const node = this._document.createElementNS(svgns, 'path');\n node.setAttribute('class', 'pronunciation-graph-triangle');\n node.setAttribute('d', 'M0 13 L15 -13 L-15 -13 Z');\n node.setAttribute('transform', `translate(${x},${y})`);\n container.appendChild(node);\n }\n\n private _createGraphCircle(svgns: string, className: string, x: number, y: number, radius: string): Element {\n const node = this._document.createElementNS(svgns, 'circle');\n node.setAttribute('class', className);\n node.setAttribute('cx', `${x}`);\n node.setAttribute('cy', `${y}`);\n node.setAttribute('r', radius);\n return node;\n }\n\n private _pitchValueToPattJJ(numberOfMora: number, pitchValue: number | string): string {\n if (typeof pitchValue === 'string') {\n return pitchValue + pitchValue[pitchValue.length - 1];\n }\n if (numberOfMora >= 1) {\n if (pitchValue === 0) {\n return `L${'H'.repeat(numberOfMora)}`;\n }\n if (pitchValue === 1) {\n return `H${'L'.repeat(numberOfMora)}`;\n }\n if (pitchValue >= 2) {\n const stepdown = pitchValue - 2;\n return `LH${'H'.repeat(stepdown)}${'L'.repeat(numberOfMora - pitchValue + 1)}`;\n }\n }\n return '';\n }\n\n private _circleJJ(x: number, y: number, o: boolean, svgns: string): Element {\n if (o) {\n const node = this._document.createElementNS(svgns, 'circle');\n node.setAttribute('r', '4');\n node.setAttribute('cx', `${x + 4}`);\n node.setAttribute('cy', `${y}`);\n node.setAttribute('stroke', 'currentColor');\n node.setAttribute('stroke-width', '2');\n node.setAttribute('fill', 'none');\n return node;\n }\n const node = this._document.createElementNS(svgns, 'circle');\n node.setAttribute('r', '5');\n node.setAttribute('cx', `${x}`);\n node.setAttribute('cy', `${y}`);\n node.setAttribute('style', 'opacity:1;fill:currentColor;');\n return node;\n }\n\n private _textJJ(x: number, mora: string, svgns: string, svg: SVGSVGElement): void {\n if (mora.length === 1) {\n const path = this._document.createElementNS(svgns, 'text');\n path.setAttribute('x', `${x}`);\n path.setAttribute('y', '67.5');\n path.setAttribute('style', 'font-size:20px;font-family:sans-serif;fill:currentColor;');\n path.textContent = mora;\n svg.appendChild(path);\n } else {\n const path1 = this._document.createElementNS(svgns, 'text');\n path1.setAttribute('x', `${x - 5}`);\n path1.setAttribute('y', '67.5');\n path1.setAttribute('style', 'font-size:20px;font-family:sans-serif;fill:currentColor;');\n path1.textContent = mora[0];\n svg.appendChild(path1);\n\n const path2 = this._document.createElementNS(svgns, 'text');\n path2.setAttribute('x', `${x + 12}`);\n path2.setAttribute('y', '67.5');\n path2.setAttribute('style', 'font-size:14px;font-family:sans-serif;fill:currentColor;');\n path2.textContent = mora[1];\n svg.appendChild(path2);\n }\n }\n\n private _pathJJ(x: number, y: number, type: string, stepWidth: number, svgns: string): Element {\n let delta = '';\n switch (type) {\n case 's':\n delta = `${stepWidth},0`;\n break;\n case 'u':\n delta = `${stepWidth},-25`;\n break;\n case 'd':\n delta = `${stepWidth},25`;\n break;\n }\n\n const path = this._document.createElementNS(svgns, 'path');\n path.setAttribute('d', `m ${x},${y} ${delta}`);\n path.setAttribute('style', 'fill:none;stroke:currentColor;stroke-width:1.5;');\n\n return path;\n }\n}\n"],"mappings":";;;AA4BA,MAAM,iBAAiB,IAAI,IAAI;AAE/B,MAAM,OACF;AACJ,MAAM,oBAAoB,IAAI;AAC9B,KAAK,IAAI,IAAI,GAAG,KAAK,KAAK,QAAQ,IAAI,IAAI,KAAK,GAAG;CAC9C,MAAM,YAAY,KAAK;CACvB,MAAM,UAAU,KAAK,IAAI;CACzB,MAAM,aAAa,KAAK,IAAI;AAC5B,mBAAkB,IAAI,SAAS;EAAE;EAAW,MAAM;CAAW,EAAC;AAC9D,KAAI,eAAe,IACf,mBAAkB,IAAI,YAAY;EAAE;EAAW,MAAM;CAAc,EAAC;AAE3E;;;;AAKD,SAAgB,iBAAiBA,WAA4B;AACzD,QAAO,oBAAoB,WAAW,qBAAqB;AAC9D;;;;;;;AAQD,SAAgB,gBA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AAC/B,SAAM,aAAa,SAAS,2DAA2D;AACvF,SAAM,cAAc,KAAK;AACzB,OAAI,YAAY,MAAM;GAEtB,MAAM,QAAQ,KAAK,UAAU,gBAAgB,OAAO,OAAO;AAC3D,SAAM,aAAa,MAAM,EAAE,IAAI,GAAG,EAAE;AACpC,SAAM,aAAa,KAAK,OAAO;AAC/B,SAAM,aAAa,SAAS,2DAA2D;AACvF,SAAM,cAAc,KAAK;AACzB,OAAI,YAAY,MAAM;EACzB;CACJ;CAED,AAAQ,QAAQT,GAAWC,GAAWS,MAAcC,WAAmBZ,OAAwB;EAC3F,IAAI,QAAQ;AACZ,UAAQ,MAAR;GACI,KAAK;AACD,aAAS,EAAE,UAAU;AACrB;GACJ,KAAK;AACD,aAAS,EAAE,UAAU;AACrB;GACJ,KAAK;AACD,aAAS,EAAE,UAAU;AACrB;EACP;EAED,MAAM,OAAO,KAAK,UAAU,gBAAgB,OAAO,OAAO;AAC1D,OAAK,aAAa,MAAM,IAAI,EAAE,GAAG,EAAE,GAAG,MAAM,EAAE;AAC9C,OAAK,aAAa,SAAS,kDAAkD;AAE7E,SAAO;CACV;AACJ"}
@@ -0,0 +1,4 @@
1
+ import "./cjk-util-DubXBGDG.js";
2
+ import { PronunciationGenerator } from "./pronunciation-generator-BtBc4q_V.js";
3
+
4
+ export { PronunciationGenerator };
@@ -0,0 +1,445 @@
1
+ "use strict";
2
+ const require_cjk_util = require('./cjk-util-Dp0ZU0sh.cjs');
3
+
4
+ //#region src/render/japanese-util.ts
5
+ const SMALL_KANA_SET = new Set("ぁぃぅぇぉゃゅょゎァィゥェォャュョヮ");
6
+ const kana = "うゔ-かが-きぎ-くぐ-けげ-こご-さざ-しじ-すず-せぜ-そぞ-ただ-ちぢ-つづ-てで-とど-はばぱひびぴふぶぷへべぺほぼぽワヷ-ヰヸ-ウヴ-ヱヹ-ヲヺ-カガ-キギ-クグ-ケゲ-コゴ-サザ-シジ-スズ-セゼ-ソゾ-タダ-チヂ-ツヅ-テデ-トド-ハバパヒビピフブプヘベペホボポ";
7
+ const DIACRITIC_MAPPING = new Map();
8
+ for (let i = 0, ii = kana.length; i < ii; i += 3) {
9
+ const character = kana[i];
10
+ const dakuten = kana[i + 1];
11
+ const handakuten = kana[i + 2];
12
+ DIACRITIC_MAPPING.set(dakuten, {
13
+ character,
14
+ type: "dakuten"
15
+ });
16
+ if (handakuten !== "-") DIACRITIC_MAPPING.set(handakuten, {
17
+ character,
18
+ type: "handakuten"
19
+ });
20
+ }
21
+ /**
22
+ * Checks if a code point represents a CJK kanji character.
23
+ */
24
+ function isCodePointKanji(codePoint) {
25
+ return require_cjk_util.isCodePointInRanges(codePoint, require_cjk_util.CJK_IDEOGRAPH_RANGES);
26
+ }
27
+ /**
28
+ * Determines whether a mora at a given index has high pitch.
29
+ * @param moraIndex - The 0-based mora index to check.
30
+ * @param pitchAccentValue - The pitch accent pattern (number = downstep position, string = HL pattern).
31
+ * @returns True if the mora at the given index has high pitch.
32
+ */
33
+ function isMoraPitchHigh(moraIndex, pitchAccentValue) {
34
+ if (typeof pitchAccentValue === "string") return pitchAccentValue[moraIndex] === "H";
35
+ switch (pitchAccentValue) {
36
+ case 0: return moraIndex > 0;
37
+ case 1: return moraIndex < 1;
38
+ default: return moraIndex > 0 && moraIndex < pitchAccentValue;
39
+ }
40
+ }
41
+ /**
42
+ * Determines the pitch accent category for a word.
43
+ * @param text - The reading text.
44
+ * @param pitchAccentValue - The pitch accent pattern.
45
+ * @param isVerbOrAdjective - Whether the word is a verb or adjective (not a noun).
46
+ * @returns The pitch category, or null if it cannot be determined.
47
+ */
48
+ function getPitchCategory(text, pitchAccentValue, isVerbOrAdjective) {
49
+ const pitchAccentDownstepPosition = typeof pitchAccentValue === "string" ? getDownstepPositions(pitchAccentValue)[0] : pitchAccentValue;
50
+ if (pitchAccentDownstepPosition === 0) return "heiban";
51
+ if (isVerbOrAdjective) return pitchAccentDownstepPosition > 0 ? "kifuku" : null;
52
+ if (pitchAccentDownstepPosition === 1) return "atamadaka";
53
+ if (pitchAccentDownstepPosition > 1) return pitchAccentDownstepPosition >= getKanaMoraCount(text) ? "odaka" : "nakadaka";
54
+ return null;
55
+ }
56
+ /**
57
+ * Extracts downstep positions from an HL pitch string pattern.
58
+ * @param pitchString - A string of 'H' and 'L' characters representing pitch.
59
+ * @returns Array of downstep positions (1-indexed mora positions where pitch drops).
60
+ */
61
+ function getDownstepPositions(pitchString) {
62
+ const downsteps = [];
63
+ const moraCount = pitchString.length;
64
+ for (let i = 0; i < moraCount; i++) if (i > 0 && pitchString[i - 1] === "H" && pitchString[i] === "L") downsteps.push(i);
65
+ if (downsteps.length === 0) downsteps.push(pitchString.startsWith("L") ? 0 : -1);
66
+ return downsteps;
67
+ }
68
+ /**
69
+ * Splits a kana text into an array of morae, combining small kana with their preceding character.
70
+ * @param text - The kana text to split.
71
+ * @returns Array of mora strings.
72
+ */
73
+ function getKanaMorae(text) {
74
+ const morae = [];
75
+ let i;
76
+ for (const c of text) if (SMALL_KANA_SET.has(c) && (i = morae.length) > 0) morae[i - 1] += c;
77
+ else morae.push(c);
78
+ return morae;
79
+ }
80
+ /**
81
+ * Counts the number of morae in a kana text.
82
+ * @param text - The kana text to count morae in.
83
+ * @returns The number of morae.
84
+ */
85
+ function getKanaMoraCount(text) {
86
+ let moraCount = 0;
87
+ for (const c of text) if (!(SMALL_KANA_SET.has(c) && moraCount > 0)) ++moraCount;
88
+ return moraCount;
89
+ }
90
+ /**
91
+ * Gets diacritic information for a kana character.
92
+ * If the character is a dakuten or handakuten variant, returns the base character and type.
93
+ * @param character - The kana character to check.
94
+ * @returns An object with the base character and diacritic type, or null if not a diacritic variant.
95
+ */
96
+ function getKanaDiacriticInfo(character) {
97
+ const info = DIACRITIC_MAPPING.get(character);
98
+ return typeof info !== "undefined" ? {
99
+ character: info.character,
100
+ type: info.type
101
+ } : null;
102
+ }
103
+
104
+ //#endregion
105
+ //#region src/render/pronunciation-generator.ts
106
+ /**
107
+ * Generates DOM elements for pronunciation visualizations including
108
+ * pitch accent text, graphs, and downstep position notation.
109
+ */
110
+ var PronunciationGenerator = class {
111
+ _document;
112
+ /**
113
+ * Creates a new PronunciationGenerator.
114
+ * @param doc - The Document object to use for creating DOM elements.
115
+ */
116
+ constructor(doc) {
117
+ this._document = doc;
118
+ }
119
+ /**
120
+ * Creates a span element containing styled mora elements for pronunciation text.
121
+ * @param morae - Array of mora strings.
122
+ * @param pitchPositions - The pitch accent downstep position (number or HL string pattern).
123
+ * @param nasalPositions - Array of 1-indexed mora positions that are nasalized.
124
+ * @param devoicePositions - Array of 1-indexed mora positions that are devoiced.
125
+ * @returns A span element with class `pronunciation-text`.
126
+ */
127
+ createPronunciationText(morae, pitchPositions, nasalPositions, devoicePositions) {
128
+ const nasalPositionsSet = nasalPositions.length > 0 ? new Set(nasalPositions) : null;
129
+ const devoicePositionsSet = devoicePositions.length > 0 ? new Set(devoicePositions) : null;
130
+ const container = this._document.createElement("span");
131
+ container.className = "pronunciation-text";
132
+ for (let i = 0, ii = morae.length; i < ii; ++i) {
133
+ const i1 = i + 1;
134
+ const mora = morae[i];
135
+ const highPitch = isMoraPitchHigh(i, pitchPositions);
136
+ const highPitchNext = isMoraPitchHigh(i1, pitchPositions);
137
+ const nasal = nasalPositionsSet?.has(i1);
138
+ const devoice = devoicePositionsSet?.has(i1);
139
+ const n1 = this._document.createElement("span");
140
+ n1.className = "pronunciation-mora";
141
+ n1.dataset.position = `${i}`;
142
+ n1.dataset.pitch = highPitch ? "high" : "low";
143
+ n1.dataset.pitchNext = highPitchNext ? "high" : "low";
144
+ const characterNodes = [];
145
+ for (const character of mora) {
146
+ const n2 = this._document.createElement("span");
147
+ n2.className = "pronunciation-character";
148
+ n2.textContent = character;
149
+ n1.appendChild(n2);
150
+ characterNodes.push(n2);
151
+ }
152
+ if (devoice) {
153
+ n1.dataset.devoice = "true";
154
+ const n3 = this._document.createElement("span");
155
+ n3.className = "pronunciation-devoice-indicator";
156
+ n1.appendChild(n3);
157
+ }
158
+ if (nasal && characterNodes.length > 0) {
159
+ n1.dataset.nasal = "true";
160
+ const group = this._document.createElement("span");
161
+ group.className = "pronunciation-character-group";
162
+ const n2 = characterNodes[0];
163
+ const character = n2.textContent;
164
+ const characterInfo = getKanaDiacriticInfo(character);
165
+ if (characterInfo !== null) {
166
+ n1.dataset.originalText = mora;
167
+ n2.dataset.originalText = character;
168
+ n2.textContent = characterInfo.character;
169
+ }
170
+ let n3 = this._document.createElement("span");
171
+ n3.className = "pronunciation-nasal-diacritic";
172
+ n3.textContent = "゚";
173
+ group.appendChild(n3);
174
+ n3 = this._document.createElement("span");
175
+ n3.className = "pronunciation-nasal-indicator";
176
+ group.appendChild(n3);
177
+ n2.parentNode.replaceChild(group, n2);
178
+ group.insertBefore(n2, group.firstChild);
179
+ }
180
+ const line = this._document.createElement("span");
181
+ line.className = "pronunciation-mora-line";
182
+ n1.appendChild(line);
183
+ container.appendChild(n1);
184
+ }
185
+ return container;
186
+ }
187
+ /**
188
+ * Creates an SVG element representing the pitch accent graph.
189
+ * @param morae - Array of mora strings.
190
+ * @param pitchPositions - The pitch accent downstep position (number or HL string pattern).
191
+ * @returns An SVG element with class `pronunciation-graph`.
192
+ */
193
+ createPronunciationGraph(morae, pitchPositions) {
194
+ const ii = morae.length;
195
+ const svgns = "http://www.w3.org/2000/svg";
196
+ const svg = this._document.createElementNS(svgns, "svg");
197
+ svg.setAttribute("xmlns", svgns);
198
+ svg.setAttribute("class", "pronunciation-graph");
199
+ svg.setAttribute("focusable", "false");
200
+ svg.setAttribute("viewBox", `0 0 ${50 * (ii + 1)} 100`);
201
+ if (ii <= 0) return svg;
202
+ const path1 = this._document.createElementNS(svgns, "path");
203
+ svg.appendChild(path1);
204
+ const path2 = this._document.createElementNS(svgns, "path");
205
+ svg.appendChild(path2);
206
+ const pathPoints = [];
207
+ for (let i = 0; i < ii; ++i) {
208
+ const highPitch = isMoraPitchHigh(i, pitchPositions);
209
+ const highPitchNext = isMoraPitchHigh(i + 1, pitchPositions);
210
+ const x = i * 50 + 25;
211
+ const y = highPitch ? 25 : 75;
212
+ if (highPitch && !highPitchNext) this._addGraphDotDownstep(svg, svgns, x, y);
213
+ else this._addGraphDot(svg, svgns, x, y);
214
+ pathPoints.push(`${x} ${y}`);
215
+ }
216
+ path1.setAttribute("class", "pronunciation-graph-line");
217
+ path1.setAttribute("d", `M${pathPoints.join(" L")}`);
218
+ pathPoints.splice(0, ii - 1);
219
+ {
220
+ const highPitch = isMoraPitchHigh(ii, pitchPositions);
221
+ const x = ii * 50 + 25;
222
+ const y = highPitch ? 25 : 75;
223
+ this._addGraphTriangle(svg, svgns, x, y);
224
+ pathPoints.push(`${x} ${y}`);
225
+ }
226
+ path2.setAttribute("class", "pronunciation-graph-line-tail");
227
+ path2.setAttribute("d", `M${pathPoints.join(" L")}`);
228
+ return svg;
229
+ }
230
+ /**
231
+ * Creates a span element showing the downstep position in bracket notation.
232
+ * @param downstepPositions - The downstep position (number or HL string pattern).
233
+ * @returns A span element with class `pronunciation-downstep-notation`.
234
+ */
235
+ createPronunciationDownstepPosition(downstepPositions) {
236
+ const downsteps = typeof downstepPositions === "string" ? getDownstepPositions(downstepPositions) : downstepPositions;
237
+ const downstepPositionString = `${downsteps}`;
238
+ const n1 = this._document.createElement("span");
239
+ n1.className = "pronunciation-downstep-notation";
240
+ n1.dataset.downstepPosition = downstepPositionString;
241
+ let n2 = this._document.createElement("span");
242
+ n2.className = "pronunciation-downstep-notation-prefix";
243
+ n2.textContent = "[";
244
+ n1.appendChild(n2);
245
+ n2 = this._document.createElement("span");
246
+ n2.className = "pronunciation-downstep-notation-number";
247
+ n2.textContent = downstepPositionString;
248
+ n1.appendChild(n2);
249
+ n2 = this._document.createElement("span");
250
+ n2.className = "pronunciation-downstep-notation-suffix";
251
+ n2.textContent = "]";
252
+ n1.appendChild(n2);
253
+ return n1;
254
+ }
255
+ /**
256
+ * Creates a Jidoujisho-style pronunciation graph SVG.
257
+ * @param mora - Array of mora strings.
258
+ * @param pitchPositions - The pitch accent downstep position (number or HL string pattern).
259
+ * @returns An SVG element.
260
+ */
261
+ createPronunciationGraphJJ(mora, pitchPositions) {
262
+ const patt = this._pitchValueToPattJJ(mora.length, pitchPositions);
263
+ const positions = Math.max(mora.length, patt.length);
264
+ const stepWidth = 35;
265
+ const marginLr = 16;
266
+ const svgWidth = Math.max(0, (positions - 1) * stepWidth + marginLr * 2);
267
+ const svgns = "http://www.w3.org/2000/svg";
268
+ const svg = this._document.createElementNS(svgns, "svg");
269
+ svg.setAttribute("xmlns", svgns);
270
+ svg.setAttribute("width", `${svgWidth * (3 / 5)}px`);
271
+ svg.setAttribute("height", "45px");
272
+ svg.setAttribute("viewBox", `0 0 ${svgWidth} 75`);
273
+ if (mora.length <= 0) return svg;
274
+ for (let i = 0; i < mora.length; i++) {
275
+ const xCenter = marginLr + i * stepWidth;
276
+ this._textJJ(xCenter - 11, mora[i], svgns, svg);
277
+ }
278
+ let pathType = "";
279
+ const circles = [];
280
+ const paths = [];
281
+ let prevCenter = [-1, -1];
282
+ for (let i = 0; i < patt.length; i++) {
283
+ const xCenter = marginLr + i * stepWidth;
284
+ const accent = patt[i];
285
+ let yCenter = 0;
286
+ if (accent === "H") yCenter = 5;
287
+ else if (accent === "L") yCenter = 30;
288
+ circles.push(this._circleJJ(xCenter, yCenter, i >= mora.length, svgns));
289
+ if (i > 0) {
290
+ if (prevCenter[1] === yCenter) pathType = "s";
291
+ else if (prevCenter[1] < yCenter) pathType = "d";
292
+ else if (prevCenter[1] > yCenter) pathType = "u";
293
+ paths.push(this._pathJJ(prevCenter[0], prevCenter[1], pathType, stepWidth, svgns));
294
+ }
295
+ prevCenter = [xCenter, yCenter];
296
+ }
297
+ for (const path of paths) svg.appendChild(path);
298
+ for (const circle of circles) svg.appendChild(circle);
299
+ return svg;
300
+ }
301
+ _addGraphDot(container, svgns, x, y) {
302
+ container.appendChild(this._createGraphCircle(svgns, "pronunciation-graph-dot", x, y, "15"));
303
+ }
304
+ _addGraphDotDownstep(container, svgns, x, y) {
305
+ container.appendChild(this._createGraphCircle(svgns, "pronunciation-graph-dot-downstep1", x, y, "15"));
306
+ container.appendChild(this._createGraphCircle(svgns, "pronunciation-graph-dot-downstep2", x, y, "5"));
307
+ }
308
+ _addGraphTriangle(container, svgns, x, y) {
309
+ const node = this._document.createElementNS(svgns, "path");
310
+ node.setAttribute("class", "pronunciation-graph-triangle");
311
+ node.setAttribute("d", "M0 13 L15 -13 L-15 -13 Z");
312
+ node.setAttribute("transform", `translate(${x},${y})`);
313
+ container.appendChild(node);
314
+ }
315
+ _createGraphCircle(svgns, className, x, y, radius) {
316
+ const node = this._document.createElementNS(svgns, "circle");
317
+ node.setAttribute("class", className);
318
+ node.setAttribute("cx", `${x}`);
319
+ node.setAttribute("cy", `${y}`);
320
+ node.setAttribute("r", radius);
321
+ return node;
322
+ }
323
+ _pitchValueToPattJJ(numberOfMora, pitchValue) {
324
+ if (typeof pitchValue === "string") return pitchValue + pitchValue[pitchValue.length - 1];
325
+ if (numberOfMora >= 1) {
326
+ if (pitchValue === 0) return `L${"H".repeat(numberOfMora)}`;
327
+ if (pitchValue === 1) return `H${"L".repeat(numberOfMora)}`;
328
+ if (pitchValue >= 2) {
329
+ const stepdown = pitchValue - 2;
330
+ return `LH${"H".repeat(stepdown)}${"L".repeat(numberOfMora - pitchValue + 1)}`;
331
+ }
332
+ }
333
+ return "";
334
+ }
335
+ _circleJJ(x, y, o, svgns) {
336
+ if (o) {
337
+ const node$1 = this._document.createElementNS(svgns, "circle");
338
+ node$1.setAttribute("r", "4");
339
+ node$1.setAttribute("cx", `${x + 4}`);
340
+ node$1.setAttribute("cy", `${y}`);
341
+ node$1.setAttribute("stroke", "currentColor");
342
+ node$1.setAttribute("stroke-width", "2");
343
+ node$1.setAttribute("fill", "none");
344
+ return node$1;
345
+ }
346
+ const node = this._document.createElementNS(svgns, "circle");
347
+ node.setAttribute("r", "5");
348
+ node.setAttribute("cx", `${x}`);
349
+ node.setAttribute("cy", `${y}`);
350
+ node.setAttribute("style", "opacity:1;fill:currentColor;");
351
+ return node;
352
+ }
353
+ _textJJ(x, mora, svgns, svg) {
354
+ if (mora.length === 1) {
355
+ const path = this._document.createElementNS(svgns, "text");
356
+ path.setAttribute("x", `${x}`);
357
+ path.setAttribute("y", "67.5");
358
+ path.setAttribute("style", "font-size:20px;font-family:sans-serif;fill:currentColor;");
359
+ path.textContent = mora;
360
+ svg.appendChild(path);
361
+ } else {
362
+ const path1 = this._document.createElementNS(svgns, "text");
363
+ path1.setAttribute("x", `${x - 5}`);
364
+ path1.setAttribute("y", "67.5");
365
+ path1.setAttribute("style", "font-size:20px;font-family:sans-serif;fill:currentColor;");
366
+ path1.textContent = mora[0];
367
+ svg.appendChild(path1);
368
+ const path2 = this._document.createElementNS(svgns, "text");
369
+ path2.setAttribute("x", `${x + 12}`);
370
+ path2.setAttribute("y", "67.5");
371
+ path2.setAttribute("style", "font-size:14px;font-family:sans-serif;fill:currentColor;");
372
+ path2.textContent = mora[1];
373
+ svg.appendChild(path2);
374
+ }
375
+ }
376
+ _pathJJ(x, y, type, stepWidth, svgns) {
377
+ let delta = "";
378
+ switch (type) {
379
+ case "s":
380
+ delta = `${stepWidth},0`;
381
+ break;
382
+ case "u":
383
+ delta = `${stepWidth},-25`;
384
+ break;
385
+ case "d":
386
+ delta = `${stepWidth},25`;
387
+ break;
388
+ }
389
+ const path = this._document.createElementNS(svgns, "path");
390
+ path.setAttribute("d", `m ${x},${y} ${delta}`);
391
+ path.setAttribute("style", "fill:none;stroke:currentColor;stroke-width:1.5;");
392
+ return path;
393
+ }
394
+ };
395
+
396
+ //#endregion
397
+ Object.defineProperty(exports, 'PronunciationGenerator', {
398
+ enumerable: true,
399
+ get: function () {
400
+ return PronunciationGenerator;
401
+ }
402
+ });
403
+ Object.defineProperty(exports, 'getDownstepPositions', {
404
+ enumerable: true,
405
+ get: function () {
406
+ return getDownstepPositions;
407
+ }
408
+ });
409
+ Object.defineProperty(exports, 'getKanaDiacriticInfo', {
410
+ enumerable: true,
411
+ get: function () {
412
+ return getKanaDiacriticInfo;
413
+ }
414
+ });
415
+ Object.defineProperty(exports, 'getKanaMoraCount', {
416
+ enumerable: true,
417
+ get: function () {
418
+ return getKanaMoraCount;
419
+ }
420
+ });
421
+ Object.defineProperty(exports, 'getKanaMorae', {
422
+ enumerable: true,
423
+ get: function () {
424
+ return getKanaMorae;
425
+ }
426
+ });
427
+ Object.defineProperty(exports, 'getPitchCategory', {
428
+ enumerable: true,
429
+ get: function () {
430
+ return getPitchCategory;
431
+ }
432
+ });
433
+ Object.defineProperty(exports, 'isCodePointKanji', {
434
+ enumerable: true,
435
+ get: function () {
436
+ return isCodePointKanji;
437
+ }
438
+ });
439
+ Object.defineProperty(exports, 'isMoraPitchHigh', {
440
+ enumerable: true,
441
+ get: function () {
442
+ return isMoraPitchHigh;
443
+ }
444
+ });
445
+ //# sourceMappingURL=pronunciation-generator-CFbZlf5J.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pronunciation-generator-CFbZlf5J.cjs","names":["codePoint: number","CJK_IDEOGRAPH_RANGES","moraIndex: number","pitchAccentValue: number | string","text: string","isVerbOrAdjective: boolean","pitchString: string","downsteps: number[]","morae: string[]","i: number","character: string","doc: Document","morae: string[]","pitchPositions: number | string","nasalPositions: number[]","devoicePositions: number[]","characterNodes: HTMLSpanElement[]","pathPoints: string[]","downstepPositions: number | string","mora: string[]","circles: Element[]","paths: Element[]","container: Element","svgns: string","x: number","y: number","className: string","radius: string","numberOfMora: number","pitchValue: number | string","o: boolean","node","mora: string","svg: SVGSVGElement","type: string","stepWidth: number"],"sources":["../src/render/japanese-util.ts","../src/render/pronunciation-generator.ts"],"sourcesContent":["/*\n * Copyright (C) 2024-2025 Yomitan Authors\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <https://www.gnu.org/licenses/>.\n */\n\n/**\n * Japanese language utility functions used by the display rendering layer.\n * These are ported from the Yomitan extension's japanese.js module.\n */\n\nimport { CJK_IDEOGRAPH_RANGES, isCodePointInRanges } from '../language/cjk-util.js';\n\nexport type PitchCategory = 'heiban' | 'atamadaka' | 'nakadaka' | 'odaka' | 'kifuku';\n\nexport type DiacriticType = 'dakuten' | 'handakuten';\n\nconst SMALL_KANA_SET = new Set('ぁぃぅぇぉゃゅょゎァィゥェォャュョヮ');\n\nconst kana =\n 'うゔ-かが-きぎ-くぐ-けげ-こご-さざ-しじ-すず-せぜ-そぞ-ただ-ちぢ-つづ-てで-とど-はばぱひびぴふぶぷへべぺほぼぽワヷ-ヰヸ-ウヴ-ヱヹ-ヲヺ-カガ-キギ-クグ-ケゲ-コゴ-サザ-シジ-スズ-セゼ-ソゾ-タダ-チヂ-ツヅ-テデ-トド-ハバパヒビピフブプヘベペホボポ';\nconst DIACRITIC_MAPPING = new Map<string, { character: string; type: DiacriticType }>();\nfor (let i = 0, ii = kana.length; i < ii; i += 3) {\n const character = kana[i];\n const dakuten = kana[i + 1];\n const handakuten = kana[i + 2];\n DIACRITIC_MAPPING.set(dakuten, { character, type: 'dakuten' });\n if (handakuten !== '-') {\n DIACRITIC_MAPPING.set(handakuten, { character, type: 'handakuten' });\n }\n}\n\n/**\n * Checks if a code point represents a CJK kanji character.\n */\nexport function isCodePointKanji(codePoint: number): boolean {\n return isCodePointInRanges(codePoint, CJK_IDEOGRAPH_RANGES);\n}\n\n/**\n * Determines whether a mora at a given index has high pitch.\n * @param moraIndex - The 0-based mora index to check.\n * @param pitchAccentValue - The pitch accent pattern (number = downstep position, string = HL pattern).\n * @returns True if the mora at the given index has high pitch.\n */\nexport function isMoraPitchHigh(moraIndex: number, pitchAccentValue: number | string): boolean {\n if (typeof pitchAccentValue === 'string') {\n return pitchAccentValue[moraIndex] === 'H';\n }\n switch (pitchAccentValue) {\n case 0:\n return moraIndex > 0;\n case 1:\n return moraIndex < 1;\n default:\n return moraIndex > 0 && moraIndex < pitchAccentValue;\n }\n}\n\n/**\n * Determines the pitch accent category for a word.\n * @param text - The reading text.\n * @param pitchAccentValue - The pitch accent pattern.\n * @param isVerbOrAdjective - Whether the word is a verb or adjective (not a noun).\n * @returns The pitch category, or null if it cannot be determined.\n */\nexport function getPitchCategory(\n text: string,\n pitchAccentValue: number | string,\n isVerbOrAdjective: boolean,\n): PitchCategory | null {\n const pitchAccentDownstepPosition =\n typeof pitchAccentValue === 'string' ? getDownstepPositions(pitchAccentValue)[0] : pitchAccentValue;\n if (pitchAccentDownstepPosition === 0) {\n return 'heiban';\n }\n if (isVerbOrAdjective) {\n return pitchAccentDownstepPosition > 0 ? 'kifuku' : null;\n }\n if (pitchAccentDownstepPosition === 1) {\n return 'atamadaka';\n }\n if (pitchAccentDownstepPosition > 1) {\n return pitchAccentDownstepPosition >= getKanaMoraCount(text) ? 'odaka' : 'nakadaka';\n }\n return null;\n}\n\n/**\n * Extracts downstep positions from an HL pitch string pattern.\n * @param pitchString - A string of 'H' and 'L' characters representing pitch.\n * @returns Array of downstep positions (1-indexed mora positions where pitch drops).\n */\nexport function getDownstepPositions(pitchString: string): number[] {\n const downsteps: number[] = [];\n const moraCount = pitchString.length;\n for (let i = 0; i < moraCount; i++) {\n if (i > 0 && pitchString[i - 1] === 'H' && pitchString[i] === 'L') {\n downsteps.push(i);\n }\n }\n if (downsteps.length === 0) {\n downsteps.push(pitchString.startsWith('L') ? 0 : -1);\n }\n return downsteps;\n}\n\n/**\n * Splits a kana text into an array of morae, combining small kana with their preceding character.\n * @param text - The kana text to split.\n * @returns Array of mora strings.\n */\nexport function getKanaMorae(text: string): string[] {\n const morae: string[] = [];\n let i: number;\n for (const c of text) {\n if (SMALL_KANA_SET.has(c) && (i = morae.length) > 0) {\n morae[i - 1] += c;\n } else {\n morae.push(c);\n }\n }\n return morae;\n}\n\n/**\n * Counts the number of morae in a kana text.\n * @param text - The kana text to count morae in.\n * @returns The number of morae.\n */\nexport function getKanaMoraCount(text: string): number {\n let moraCount = 0;\n for (const c of text) {\n if (!(SMALL_KANA_SET.has(c) && moraCount > 0)) {\n ++moraCount;\n }\n }\n return moraCount;\n}\n\n/**\n * Gets diacritic information for a kana character.\n * If the character is a dakuten or handakuten variant, returns the base character and type.\n * @param character - The kana character to check.\n * @returns An object with the base character and diacritic type, or null if not a diacritic variant.\n */\nexport function getKanaDiacriticInfo(character: string): { character: string; type: DiacriticType } | null {\n const info = DIACRITIC_MAPPING.get(character);\n return typeof info !== 'undefined' ? { character: info.character, type: info.type } : null;\n}\n","/*\n * Copyright (C) 2023-2025 Yomitan Authors\n * Copyright (C) 2021-2022 Yomichan Authors\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <https://www.gnu.org/licenses/>.\n */\n\nimport { getDownstepPositions, getKanaDiacriticInfo, isMoraPitchHigh } from './japanese-util.js';\n\n/**\n * Generates DOM elements for pronunciation visualizations including\n * pitch accent text, graphs, and downstep position notation.\n */\nexport class PronunciationGenerator {\n private _document: Document;\n\n /**\n * Creates a new PronunciationGenerator.\n * @param doc - The Document object to use for creating DOM elements.\n */\n constructor(doc: Document) {\n this._document = doc;\n }\n\n /**\n * Creates a span element containing styled mora elements for pronunciation text.\n * @param morae - Array of mora strings.\n * @param pitchPositions - The pitch accent downstep position (number or HL string pattern).\n * @param nasalPositions - Array of 1-indexed mora positions that are nasalized.\n * @param devoicePositions - Array of 1-indexed mora positions that are devoiced.\n * @returns A span element with class `pronunciation-text`.\n */\n createPronunciationText(\n morae: string[],\n pitchPositions: number | string,\n nasalPositions: number[],\n devoicePositions: number[],\n ): HTMLSpanElement {\n const nasalPositionsSet = nasalPositions.length > 0 ? new Set(nasalPositions) : null;\n const devoicePositionsSet = devoicePositions.length > 0 ? new Set(devoicePositions) : null;\n const container = this._document.createElement('span');\n container.className = 'pronunciation-text';\n for (let i = 0, ii = morae.length; i < ii; ++i) {\n const i1 = i + 1;\n const mora = morae[i];\n const highPitch = isMoraPitchHigh(i, pitchPositions);\n const highPitchNext = isMoraPitchHigh(i1, pitchPositions);\n const nasal = nasalPositionsSet?.has(i1);\n const devoice = devoicePositionsSet?.has(i1);\n\n const n1 = this._document.createElement('span');\n n1.className = 'pronunciation-mora';\n n1.dataset.position = `${i}`;\n n1.dataset.pitch = highPitch ? 'high' : 'low';\n n1.dataset.pitchNext = highPitchNext ? 'high' : 'low';\n\n const characterNodes: HTMLSpanElement[] = [];\n for (const character of mora) {\n const n2 = this._document.createElement('span');\n n2.className = 'pronunciation-character';\n n2.textContent = character;\n n1.appendChild(n2);\n characterNodes.push(n2);\n }\n\n if (devoice) {\n n1.dataset.devoice = 'true';\n const n3 = this._document.createElement('span');\n n3.className = 'pronunciation-devoice-indicator';\n n1.appendChild(n3);\n }\n if (nasal && characterNodes.length > 0) {\n n1.dataset.nasal = 'true';\n\n const group = this._document.createElement('span');\n group.className = 'pronunciation-character-group';\n\n const n2 = characterNodes[0];\n const character = n2.textContent as string;\n\n const characterInfo = getKanaDiacriticInfo(character);\n if (characterInfo !== null) {\n n1.dataset.originalText = mora;\n n2.dataset.originalText = character;\n n2.textContent = characterInfo.character;\n }\n\n let n3 = this._document.createElement('span');\n n3.className = 'pronunciation-nasal-diacritic';\n n3.textContent = '\\u309a'; // Combining handakuten\n group.appendChild(n3);\n\n n3 = this._document.createElement('span');\n n3.className = 'pronunciation-nasal-indicator';\n group.appendChild(n3);\n\n (n2.parentNode as ParentNode).replaceChild(group, n2);\n group.insertBefore(n2, group.firstChild);\n }\n\n const line = this._document.createElement('span');\n line.className = 'pronunciation-mora-line';\n n1.appendChild(line);\n\n container.appendChild(n1);\n }\n return container;\n }\n\n /**\n * Creates an SVG element representing the pitch accent graph.\n * @param morae - Array of mora strings.\n * @param pitchPositions - The pitch accent downstep position (number or HL string pattern).\n * @returns An SVG element with class `pronunciation-graph`.\n */\n createPronunciationGraph(morae: string[], pitchPositions: number | string): SVGSVGElement {\n const ii = morae.length;\n\n const svgns = 'http://www.w3.org/2000/svg';\n const svg = this._document.createElementNS(svgns, 'svg') as SVGSVGElement;\n svg.setAttribute('xmlns', svgns);\n svg.setAttribute('class', 'pronunciation-graph');\n svg.setAttribute('focusable', 'false');\n svg.setAttribute('viewBox', `0 0 ${50 * (ii + 1)} 100`);\n\n if (ii <= 0) {\n return svg;\n }\n\n const path1 = this._document.createElementNS(svgns, 'path');\n svg.appendChild(path1);\n\n const path2 = this._document.createElementNS(svgns, 'path');\n svg.appendChild(path2);\n\n const pathPoints: string[] = [];\n for (let i = 0; i < ii; ++i) {\n const highPitch = isMoraPitchHigh(i, pitchPositions);\n const highPitchNext = isMoraPitchHigh(i + 1, pitchPositions);\n const x = i * 50 + 25;\n const y = highPitch ? 25 : 75;\n if (highPitch && !highPitchNext) {\n this._addGraphDotDownstep(svg, svgns, x, y);\n } else {\n this._addGraphDot(svg, svgns, x, y);\n }\n pathPoints.push(`${x} ${y}`);\n }\n\n path1.setAttribute('class', 'pronunciation-graph-line');\n path1.setAttribute('d', `M${pathPoints.join(' L')}`);\n\n pathPoints.splice(0, ii - 1);\n {\n const highPitch = isMoraPitchHigh(ii, pitchPositions);\n const x = ii * 50 + 25;\n const y = highPitch ? 25 : 75;\n this._addGraphTriangle(svg, svgns, x, y);\n pathPoints.push(`${x} ${y}`);\n }\n\n path2.setAttribute('class', 'pronunciation-graph-line-tail');\n path2.setAttribute('d', `M${pathPoints.join(' L')}`);\n\n return svg;\n }\n\n /**\n * Creates a span element showing the downstep position in bracket notation.\n * @param downstepPositions - The downstep position (number or HL string pattern).\n * @returns A span element with class `pronunciation-downstep-notation`.\n */\n createPronunciationDownstepPosition(downstepPositions: number | string): HTMLSpanElement {\n const downsteps =\n typeof downstepPositions === 'string' ? getDownstepPositions(downstepPositions) : downstepPositions;\n const downstepPositionString = `${downsteps}`;\n\n const n1 = this._document.createElement('span');\n n1.className = 'pronunciation-downstep-notation';\n n1.dataset.downstepPosition = downstepPositionString;\n\n let n2 = this._document.createElement('span');\n n2.className = 'pronunciation-downstep-notation-prefix';\n n2.textContent = '[';\n n1.appendChild(n2);\n\n n2 = this._document.createElement('span');\n n2.className = 'pronunciation-downstep-notation-number';\n n2.textContent = downstepPositionString;\n n1.appendChild(n2);\n\n n2 = this._document.createElement('span');\n n2.className = 'pronunciation-downstep-notation-suffix';\n n2.textContent = ']';\n n1.appendChild(n2);\n\n return n1;\n }\n\n /**\n * Creates a Jidoujisho-style pronunciation graph SVG.\n * @param mora - Array of mora strings.\n * @param pitchPositions - The pitch accent downstep position (number or HL string pattern).\n * @returns An SVG element.\n */\n createPronunciationGraphJJ(mora: string[], pitchPositions: number | string): SVGSVGElement {\n const patt = this._pitchValueToPattJJ(mora.length, pitchPositions);\n\n const positions = Math.max(mora.length, patt.length);\n const stepWidth = 35;\n const marginLr = 16;\n const svgWidth = Math.max(0, (positions - 1) * stepWidth + marginLr * 2);\n\n const svgns = 'http://www.w3.org/2000/svg';\n const svg = this._document.createElementNS(svgns, 'svg') as SVGSVGElement;\n svg.setAttribute('xmlns', svgns);\n svg.setAttribute('width', `${svgWidth * (3 / 5)}px`);\n svg.setAttribute('height', '45px');\n svg.setAttribute('viewBox', `0 0 ${svgWidth} 75`);\n\n if (mora.length <= 0) {\n return svg;\n }\n\n for (let i = 0; i < mora.length; i++) {\n const xCenter = marginLr + i * stepWidth;\n this._textJJ(xCenter - 11, mora[i], svgns, svg);\n }\n\n let pathType = '';\n\n const circles: Element[] = [];\n const paths: Element[] = [];\n\n let prevCenter = [-1, -1];\n for (let i = 0; i < patt.length; i++) {\n const xCenter = marginLr + i * stepWidth;\n const accent = patt[i];\n let yCenter = 0;\n if (accent === 'H') {\n yCenter = 5;\n } else if (accent === 'L') {\n yCenter = 30;\n }\n circles.push(this._circleJJ(xCenter, yCenter, i >= mora.length, svgns));\n\n if (i > 0) {\n if (prevCenter[1] === yCenter) {\n pathType = 's';\n } else if (prevCenter[1] < yCenter) {\n pathType = 'd';\n } else if (prevCenter[1] > yCenter) {\n pathType = 'u';\n }\n paths.push(this._pathJJ(prevCenter[0], prevCenter[1], pathType, stepWidth, svgns));\n }\n prevCenter = [xCenter, yCenter];\n }\n\n for (const path of paths) {\n svg.appendChild(path);\n }\n\n for (const circle of circles) {\n svg.appendChild(circle);\n }\n\n return svg;\n }\n\n // Private\n\n private _addGraphDot(container: Element, svgns: string, x: number, y: number): void {\n container.appendChild(this._createGraphCircle(svgns, 'pronunciation-graph-dot', x, y, '15'));\n }\n\n private _addGraphDotDownstep(container: Element, svgns: string, x: number, y: number): void {\n container.appendChild(this._createGraphCircle(svgns, 'pronunciation-graph-dot-downstep1', x, y, '15'));\n container.appendChild(this._createGraphCircle(svgns, 'pronunciation-graph-dot-downstep2', x, y, '5'));\n }\n\n private _addGraphTriangle(container: Element, svgns: string, x: number, y: number): void {\n const node = this._document.createElementNS(svgns, 'path');\n node.setAttribute('class', 'pronunciation-graph-triangle');\n node.setAttribute('d', 'M0 13 L15 -13 L-15 -13 Z');\n node.setAttribute('transform', `translate(${x},${y})`);\n container.appendChild(node);\n }\n\n private _createGraphCircle(svgns: string, className: string, x: number, y: number, radius: string): Element {\n const node = this._document.createElementNS(svgns, 'circle');\n node.setAttribute('class', className);\n node.setAttribute('cx', `${x}`);\n node.setAttribute('cy', `${y}`);\n node.setAttribute('r', radius);\n return node;\n }\n\n private _pitchValueToPattJJ(numberOfMora: number, pitchValue: number | string): string {\n if (typeof pitchValue === 'string') {\n return pitchValue + pitchValue[pitchValue.length - 1];\n }\n if (numberOfMora >= 1) {\n if (pitchValue === 0) {\n return `L${'H'.repeat(numberOfMora)}`;\n }\n if (pitchValue === 1) {\n return `H${'L'.repeat(numberOfMora)}`;\n }\n if (pitchValue >= 2) {\n const stepdown = pitchValue - 2;\n return `LH${'H'.repeat(stepdown)}${'L'.repeat(numberOfMora - pitchValue + 1)}`;\n }\n }\n return '';\n }\n\n private _circleJJ(x: number, y: number, o: boolean, svgns: string): Element {\n if (o) {\n const node = this._document.createElementNS(svgns, 'circle');\n node.setAttribute('r', '4');\n node.setAttribute('cx', `${x + 4}`);\n node.setAttribute('cy', `${y}`);\n node.setAttribute('stroke', 'currentColor');\n node.setAttribute('stroke-width', '2');\n node.setAttribute('fill', 'none');\n return node;\n }\n const node = this._document.createElementNS(svgns, 'circle');\n node.setAttribute('r', '5');\n node.setAttribute('cx', `${x}`);\n node.setAttribute('cy', `${y}`);\n node.setAttribute('style', 'opacity:1;fill:currentColor;');\n return node;\n }\n\n private _textJJ(x: number, mora: string, svgns: string, svg: SVGSVGElement): void {\n if (mora.length === 1) {\n const path = this._document.createElementNS(svgns, 'text');\n path.setAttribute('x', `${x}`);\n path.setAttribute('y', '67.5');\n path.setAttribute('style', 'font-size:20px;font-family:sans-serif;fill:currentColor;');\n path.textContent = mora;\n svg.appendChild(path);\n } else {\n const path1 = this._document.createElementNS(svgns, 'text');\n path1.setAttribute('x', `${x - 5}`);\n path1.setAttribute('y', '67.5');\n path1.setAttribute('style', 'font-size:20px;font-family:sans-serif;fill:currentColor;');\n path1.textContent = mora[0];\n svg.appendChild(path1);\n\n const path2 = this._document.createElementNS(svgns, 'text');\n path2.setAttribute('x', `${x + 12}`);\n path2.setAttribute('y', '67.5');\n path2.setAttribute('style', 'font-size:14px;font-family:sans-serif;fill:currentColor;');\n path2.textContent = mora[1];\n svg.appendChild(path2);\n }\n }\n\n private _pathJJ(x: number, y: number, type: string, stepWidth: number, svgns: string): Element {\n let delta = '';\n switch (type) {\n case 's':\n delta = `${stepWidth},0`;\n break;\n case 'u':\n delta = `${stepWidth},-25`;\n break;\n case 'd':\n delta = `${stepWidth},25`;\n break;\n }\n\n const path = this._document.createElementNS(svgns, 'path');\n path.setAttribute('d', `m ${x},${y} ${delta}`);\n path.setAttribute('style', 'fill:none;stroke:currentColor;stroke-width:1.5;');\n\n return path;\n }\n}\n"],"mappings":";;;;AA4BA,MAAM,iBAAiB,IAAI,IAAI;AAE/B,MAAM,OACF;AACJ,MAAM,oBAAoB,IAAI;AAC9B,KAAK,IAAI,IAAI,GAAG,KAAK,KAAK,QAAQ,IAAI,IAAI,KAAK,GAAG;CAC9C,MAAM,YAAY,KAAK;CACvB,MAAM,UAAU,KAAK,IAAI;CACzB,MAAM,aAAa,KAAK,IAAI;AAC5B,mBAAkB,IAAI,SAAS;EAAE;EAAW,MAAM;CAAW,EAAC;AAC9D,KAAI,eAAe,IACf,mBAAkB,IAAI,YAAY;EAAE;EAAW,MAAM;CAAc,EAAC;AAE3E;;;;AAKD,SAAgB,iBAAiBA,WAA4B;AACzD,QAAO,qCAAoB,WAAWC,sCAAqB;AAC9D;;;;;;;AAQD,SAAgB,gBAAgBC,WAAmBC,kBAA4C;AAC3F,YAAW,qBAAqB,SAC5B,QAAO,iBAAiB,eAAe;AAE3C,SAAQ,kBAAR;EACI,KAAK,EACD,QAAO,YAAY;EACvB,KAAK,EACD,QAAO,YAAY;EACvB,QACI,QAAO,YAAY,KAAK,YAAY;CAC3C;AACJ;;;;;;;;AASD,SAAgB,iBACZC,MACAD,kBACAE,mBACoB;CACpB,MAAM,qCACK,qBAAqB,WAAW,qBAAqB,iBAAiB,CAAC,KAAK;AACvF,KAAI,gCAAgC,EAChC,QAAO;AAEX,KAAI,kBACA,QAAO,8BAA8B,IAAI,WAAW;AAExD,KAAI,gCAAgC,EAChC,QAAO;AAEX,KAAI,8BAA8B,EAC9B,QAAO,+BAA+B,iBAAiB,KAAK,GAAG,UAAU;AAE7E,QAAO;AACV;;;;;;AAOD,SAAgB,qBAAqB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;EAED,MAAM,OAAO,KAAK,UAAU,gBAAgB,OAAO,OAAO;AAC1D,OAAK,aAAa,MAAM,IAAI,EAAE,GAAG,EAAE,GAAG,MAAM,EAAE;AAC9C,OAAK,aAAa,SAAS,kDAAkD;AAE7E,SAAO;CACV;AACJ"}
@@ -0,0 +1,4 @@
1
+ require('./cjk-util-Dp0ZU0sh.cjs');
2
+ const require_pronunciation_generator = require('./pronunciation-generator-CFbZlf5J.cjs');
3
+
4
+ exports.PronunciationGenerator = require_pronunciation_generator.PronunciationGenerator