@eternalheart/react-file-preview 1.3.10 → 1.3.12

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 (284) hide show
  1. package/lib/RequestContext.d.ts +1 -1
  2. package/lib/RequestContext.d.ts.map +1 -1
  3. package/lib/chunks/RendererError-BH6fzLrN.mjs +15 -0
  4. package/lib/chunks/RendererError-BH6fzLrN.mjs.map +1 -0
  5. package/lib/chunks/avifLoader-BP3fgcMm-BnpxLhxp.mjs +56 -0
  6. package/lib/chunks/avifLoader-BP3fgcMm-BnpxLhxp.mjs.map +1 -0
  7. package/lib/chunks/heicLoader-CH_raQNn-1fBLaICM.mjs +37 -0
  8. package/lib/chunks/heicLoader-CH_raQNn-1fBLaICM.mjs.map +1 -0
  9. package/lib/chunks/index-BBvL23cc.mjs +105 -0
  10. package/lib/chunks/index-BBvL23cc.mjs.map +1 -0
  11. package/lib/chunks/index-BCbSb9Ob.mjs +2323 -0
  12. package/lib/chunks/index-BCbSb9Ob.mjs.map +1 -0
  13. package/lib/chunks/{index-DveR0rOk.mjs → index-BPsJtP6e.mjs} +41 -38
  14. package/lib/chunks/index-BPsJtP6e.mjs.map +1 -0
  15. package/lib/chunks/index-CA8OvqPT.mjs +55 -0
  16. package/lib/chunks/index-CA8OvqPT.mjs.map +1 -0
  17. package/lib/chunks/index-CJGtdAy7.mjs +114 -0
  18. package/lib/chunks/index-CJGtdAy7.mjs.map +1 -0
  19. package/lib/chunks/{index-tecGXW2S.mjs → index-CeQf1qNC.mjs} +85 -83
  20. package/lib/chunks/index-CeQf1qNC.mjs.map +1 -0
  21. package/lib/chunks/{index-DPpUj8Yy.mjs → index-Cxf4CLJZ.mjs} +99 -98
  22. package/lib/chunks/index-Cxf4CLJZ.mjs.map +1 -0
  23. package/lib/chunks/index-D2t64h6I.mjs +96 -0
  24. package/lib/chunks/index-D2t64h6I.mjs.map +1 -0
  25. package/lib/chunks/{index-C5YHI0Zs.mjs → index-DAo4n3Mq.mjs} +52 -51
  26. package/lib/chunks/index-DAo4n3Mq.mjs.map +1 -0
  27. package/lib/chunks/index-DCTwUpKS.mjs +13097 -0
  28. package/lib/chunks/index-DCTwUpKS.mjs.map +1 -0
  29. package/lib/chunks/index-DJZWizxK.mjs +136 -0
  30. package/lib/chunks/index-DJZWizxK.mjs.map +1 -0
  31. package/lib/chunks/{index-DN8BQIqo.mjs → index-DRCA7PhQ.mjs} +79 -78
  32. package/lib/chunks/index-DRCA7PhQ.mjs.map +1 -0
  33. package/lib/chunks/index-DdkkEzw3.mjs +12335 -0
  34. package/lib/chunks/index-DdkkEzw3.mjs.map +1 -0
  35. package/lib/chunks/{index-DSAXdrgU.mjs → index-DlptjfMf.mjs} +76 -75
  36. package/lib/chunks/index-DlptjfMf.mjs.map +1 -0
  37. package/lib/chunks/{index-CwmZQ-JO.mjs → index-DrgP7cc7.mjs} +67 -64
  38. package/lib/chunks/index-DrgP7cc7.mjs.map +1 -0
  39. package/lib/chunks/index-Dx8aLIDX.mjs +113 -0
  40. package/lib/chunks/index-Dx8aLIDX.mjs.map +1 -0
  41. package/lib/chunks/index-fhiaa9rv.mjs +222 -0
  42. package/lib/chunks/index-fhiaa9rv.mjs.map +1 -0
  43. package/lib/chunks/index-qEUWJYQ5.mjs +594 -0
  44. package/lib/chunks/index-qEUWJYQ5.mjs.map +1 -0
  45. package/lib/chunks/index-vaILKWGV.mjs +54 -0
  46. package/lib/chunks/index-vaILKWGV.mjs.map +1 -0
  47. package/lib/chunks/jp2Loader-Bn-qPMbD-Bn-qPMbD.mjs +122 -0
  48. package/lib/chunks/jp2Loader-Bn-qPMbD-Bn-qPMbD.mjs.map +1 -0
  49. package/lib/chunks/psdLoader-Doxw3mWm-DVOGFSlh.mjs +73 -0
  50. package/lib/chunks/psdLoader-Doxw3mWm-DVOGFSlh.mjs.map +1 -0
  51. package/lib/chunks/rawLoader-0mLvxCNp-CJmERiK7.mjs +82 -0
  52. package/lib/chunks/rawLoader-0mLvxCNp-CJmERiK7.mjs.map +1 -0
  53. package/lib/chunks/tiffLoader-CTFKVLqJ-B84NfwhR.mjs +60 -0
  54. package/lib/chunks/tiffLoader-CTFKVLqJ-B84NfwhR.mjs.map +1 -0
  55. package/lib/chunks/{useShikiHighlight-DHFYu0BU.mjs → useShikiHighlight-Cq02e63J.mjs} +2 -2
  56. package/lib/chunks/{useShikiHighlight-DHFYu0BU.mjs.map → useShikiHighlight-Cq02e63J.mjs.map} +1 -1
  57. package/lib/index.cjs +31 -22
  58. package/lib/index.cjs.map +1 -1
  59. package/lib/index.css +1 -1
  60. package/lib/index.mjs +8 -8
  61. package/lib/renderers/Audio/index.d.ts.map +1 -1
  62. package/lib/renderers/Csv/index.d.ts.map +1 -1
  63. package/lib/renderers/Docx/index.d.ts.map +1 -1
  64. package/lib/renderers/Epub/index.d.ts.map +1 -1
  65. package/lib/renderers/Font/index.d.ts.map +1 -1
  66. package/lib/renderers/Image/index.d.ts +2 -0
  67. package/lib/renderers/Image/index.d.ts.map +1 -1
  68. package/lib/renderers/Json/index.d.ts.map +1 -1
  69. package/lib/renderers/Markdown/index.d.ts.map +1 -1
  70. package/lib/renderers/Mobi/index.d.ts.map +1 -1
  71. package/lib/renderers/Msg/index.d.ts.map +1 -1
  72. package/lib/renderers/Pdf/index.d.ts.map +1 -1
  73. package/lib/renderers/Pptx/index.d.ts.map +1 -1
  74. package/lib/renderers/RendererError.d.ts +8 -0
  75. package/lib/renderers/RendererError.d.ts.map +1 -0
  76. package/lib/renderers/Subtitle/index.d.ts.map +1 -1
  77. package/lib/renderers/Text/index.d.ts.map +1 -1
  78. package/lib/renderers/Video/index.d.ts +1 -0
  79. package/lib/renderers/Video/index.d.ts.map +1 -1
  80. package/lib/renderers/Xlsx/index.d.ts.map +1 -1
  81. package/lib/renderers/Xml/index.d.ts.map +1 -1
  82. package/lib/renderers/Zip/index.d.ts.map +1 -1
  83. package/package.json +13 -5
  84. package/lib/chunks/index-B0JUZ5rS.mjs +0 -110
  85. package/lib/chunks/index-B0JUZ5rS.mjs.map +0 -1
  86. package/lib/chunks/index-BAYc4aBz.mjs +0 -129
  87. package/lib/chunks/index-BAYc4aBz.mjs.map +0 -1
  88. package/lib/chunks/index-BOQJNL71.mjs +0 -103
  89. package/lib/chunks/index-BOQJNL71.mjs.map +0 -1
  90. package/lib/chunks/index-BkU8rK-0.mjs +0 -51
  91. package/lib/chunks/index-BkU8rK-0.mjs.map +0 -1
  92. package/lib/chunks/index-BnDoXBnH.mjs +0 -257
  93. package/lib/chunks/index-BnDoXBnH.mjs.map +0 -1
  94. package/lib/chunks/index-C5YHI0Zs.mjs.map +0 -1
  95. package/lib/chunks/index-CGNWXFy3.mjs +0 -2081
  96. package/lib/chunks/index-CGNWXFy3.mjs.map +0 -1
  97. package/lib/chunks/index-CwmZQ-JO.mjs.map +0 -1
  98. package/lib/chunks/index-CzflrElZ.mjs +0 -52
  99. package/lib/chunks/index-CzflrElZ.mjs.map +0 -1
  100. package/lib/chunks/index-CztCCF7q.mjs +0 -116
  101. package/lib/chunks/index-CztCCF7q.mjs.map +0 -1
  102. package/lib/chunks/index-DKEcGewg.mjs +0 -96
  103. package/lib/chunks/index-DKEcGewg.mjs.map +0 -1
  104. package/lib/chunks/index-DN8BQIqo.mjs.map +0 -1
  105. package/lib/chunks/index-DPpUj8Yy.mjs.map +0 -1
  106. package/lib/chunks/index-DSAXdrgU.mjs.map +0 -1
  107. package/lib/chunks/index-DveR0rOk.mjs.map +0 -1
  108. package/lib/chunks/index-QfO-sASN.mjs +0 -152
  109. package/lib/chunks/index-QfO-sASN.mjs.map +0 -1
  110. package/lib/chunks/index-h9bO9wmq.mjs +0 -99
  111. package/lib/chunks/index-h9bO9wmq.mjs.map +0 -1
  112. package/lib/chunks/index-mvSVNKlQ.mjs +0 -228
  113. package/lib/chunks/index-mvSVNKlQ.mjs.map +0 -1
  114. package/lib/chunks/index-tecGXW2S.mjs.map +0 -1
  115. package/lib/pdfjs/cmaps/78-EUC-H.bcmap +0 -0
  116. package/lib/pdfjs/cmaps/78-EUC-V.bcmap +0 -0
  117. package/lib/pdfjs/cmaps/78-H.bcmap +0 -0
  118. package/lib/pdfjs/cmaps/78-RKSJ-H.bcmap +0 -0
  119. package/lib/pdfjs/cmaps/78-RKSJ-V.bcmap +0 -0
  120. package/lib/pdfjs/cmaps/78-V.bcmap +0 -0
  121. package/lib/pdfjs/cmaps/78ms-RKSJ-H.bcmap +0 -0
  122. package/lib/pdfjs/cmaps/78ms-RKSJ-V.bcmap +0 -0
  123. package/lib/pdfjs/cmaps/83pv-RKSJ-H.bcmap +0 -0
  124. package/lib/pdfjs/cmaps/90ms-RKSJ-H.bcmap +0 -0
  125. package/lib/pdfjs/cmaps/90ms-RKSJ-V.bcmap +0 -0
  126. package/lib/pdfjs/cmaps/90msp-RKSJ-H.bcmap +0 -0
  127. package/lib/pdfjs/cmaps/90msp-RKSJ-V.bcmap +0 -0
  128. package/lib/pdfjs/cmaps/90pv-RKSJ-H.bcmap +0 -0
  129. package/lib/pdfjs/cmaps/90pv-RKSJ-V.bcmap +0 -0
  130. package/lib/pdfjs/cmaps/Add-H.bcmap +0 -0
  131. package/lib/pdfjs/cmaps/Add-RKSJ-H.bcmap +0 -0
  132. package/lib/pdfjs/cmaps/Add-RKSJ-V.bcmap +0 -0
  133. package/lib/pdfjs/cmaps/Add-V.bcmap +0 -0
  134. package/lib/pdfjs/cmaps/Adobe-CNS1-0.bcmap +0 -0
  135. package/lib/pdfjs/cmaps/Adobe-CNS1-1.bcmap +0 -0
  136. package/lib/pdfjs/cmaps/Adobe-CNS1-2.bcmap +0 -0
  137. package/lib/pdfjs/cmaps/Adobe-CNS1-3.bcmap +0 -0
  138. package/lib/pdfjs/cmaps/Adobe-CNS1-4.bcmap +0 -0
  139. package/lib/pdfjs/cmaps/Adobe-CNS1-5.bcmap +0 -0
  140. package/lib/pdfjs/cmaps/Adobe-CNS1-6.bcmap +0 -0
  141. package/lib/pdfjs/cmaps/Adobe-CNS1-UCS2.bcmap +0 -0
  142. package/lib/pdfjs/cmaps/Adobe-GB1-0.bcmap +0 -0
  143. package/lib/pdfjs/cmaps/Adobe-GB1-1.bcmap +0 -0
  144. package/lib/pdfjs/cmaps/Adobe-GB1-2.bcmap +0 -0
  145. package/lib/pdfjs/cmaps/Adobe-GB1-3.bcmap +0 -0
  146. package/lib/pdfjs/cmaps/Adobe-GB1-4.bcmap +0 -0
  147. package/lib/pdfjs/cmaps/Adobe-GB1-5.bcmap +0 -0
  148. package/lib/pdfjs/cmaps/Adobe-GB1-UCS2.bcmap +0 -0
  149. package/lib/pdfjs/cmaps/Adobe-Japan1-0.bcmap +0 -0
  150. package/lib/pdfjs/cmaps/Adobe-Japan1-1.bcmap +0 -0
  151. package/lib/pdfjs/cmaps/Adobe-Japan1-2.bcmap +0 -0
  152. package/lib/pdfjs/cmaps/Adobe-Japan1-3.bcmap +0 -0
  153. package/lib/pdfjs/cmaps/Adobe-Japan1-4.bcmap +0 -0
  154. package/lib/pdfjs/cmaps/Adobe-Japan1-5.bcmap +0 -0
  155. package/lib/pdfjs/cmaps/Adobe-Japan1-6.bcmap +0 -0
  156. package/lib/pdfjs/cmaps/Adobe-Japan1-UCS2.bcmap +0 -0
  157. package/lib/pdfjs/cmaps/Adobe-Korea1-0.bcmap +0 -0
  158. package/lib/pdfjs/cmaps/Adobe-Korea1-1.bcmap +0 -0
  159. package/lib/pdfjs/cmaps/Adobe-Korea1-2.bcmap +0 -0
  160. package/lib/pdfjs/cmaps/Adobe-Korea1-UCS2.bcmap +0 -0
  161. package/lib/pdfjs/cmaps/B5-H.bcmap +0 -0
  162. package/lib/pdfjs/cmaps/B5-V.bcmap +0 -0
  163. package/lib/pdfjs/cmaps/B5pc-H.bcmap +0 -0
  164. package/lib/pdfjs/cmaps/B5pc-V.bcmap +0 -0
  165. package/lib/pdfjs/cmaps/CNS-EUC-H.bcmap +0 -0
  166. package/lib/pdfjs/cmaps/CNS-EUC-V.bcmap +0 -0
  167. package/lib/pdfjs/cmaps/CNS1-H.bcmap +0 -0
  168. package/lib/pdfjs/cmaps/CNS1-V.bcmap +0 -0
  169. package/lib/pdfjs/cmaps/CNS2-H.bcmap +0 -0
  170. package/lib/pdfjs/cmaps/CNS2-V.bcmap +0 -3
  171. package/lib/pdfjs/cmaps/ETHK-B5-H.bcmap +0 -0
  172. package/lib/pdfjs/cmaps/ETHK-B5-V.bcmap +0 -0
  173. package/lib/pdfjs/cmaps/ETen-B5-H.bcmap +0 -0
  174. package/lib/pdfjs/cmaps/ETen-B5-V.bcmap +0 -0
  175. package/lib/pdfjs/cmaps/ETenms-B5-H.bcmap +0 -3
  176. package/lib/pdfjs/cmaps/ETenms-B5-V.bcmap +0 -0
  177. package/lib/pdfjs/cmaps/EUC-H.bcmap +0 -0
  178. package/lib/pdfjs/cmaps/EUC-V.bcmap +0 -0
  179. package/lib/pdfjs/cmaps/Ext-H.bcmap +0 -0
  180. package/lib/pdfjs/cmaps/Ext-RKSJ-H.bcmap +0 -0
  181. package/lib/pdfjs/cmaps/Ext-RKSJ-V.bcmap +0 -0
  182. package/lib/pdfjs/cmaps/Ext-V.bcmap +0 -0
  183. package/lib/pdfjs/cmaps/GB-EUC-H.bcmap +0 -0
  184. package/lib/pdfjs/cmaps/GB-EUC-V.bcmap +0 -0
  185. package/lib/pdfjs/cmaps/GB-H.bcmap +0 -4
  186. package/lib/pdfjs/cmaps/GB-V.bcmap +0 -0
  187. package/lib/pdfjs/cmaps/GBK-EUC-H.bcmap +0 -0
  188. package/lib/pdfjs/cmaps/GBK-EUC-V.bcmap +0 -0
  189. package/lib/pdfjs/cmaps/GBK2K-H.bcmap +0 -0
  190. package/lib/pdfjs/cmaps/GBK2K-V.bcmap +0 -0
  191. package/lib/pdfjs/cmaps/GBKp-EUC-H.bcmap +0 -0
  192. package/lib/pdfjs/cmaps/GBKp-EUC-V.bcmap +0 -0
  193. package/lib/pdfjs/cmaps/GBT-EUC-H.bcmap +0 -0
  194. package/lib/pdfjs/cmaps/GBT-EUC-V.bcmap +0 -0
  195. package/lib/pdfjs/cmaps/GBT-H.bcmap +0 -0
  196. package/lib/pdfjs/cmaps/GBT-V.bcmap +0 -0
  197. package/lib/pdfjs/cmaps/GBTpc-EUC-H.bcmap +0 -0
  198. package/lib/pdfjs/cmaps/GBTpc-EUC-V.bcmap +0 -0
  199. package/lib/pdfjs/cmaps/GBpc-EUC-H.bcmap +0 -0
  200. package/lib/pdfjs/cmaps/GBpc-EUC-V.bcmap +0 -0
  201. package/lib/pdfjs/cmaps/H.bcmap +0 -0
  202. package/lib/pdfjs/cmaps/HKdla-B5-H.bcmap +0 -0
  203. package/lib/pdfjs/cmaps/HKdla-B5-V.bcmap +0 -0
  204. package/lib/pdfjs/cmaps/HKdlb-B5-H.bcmap +0 -0
  205. package/lib/pdfjs/cmaps/HKdlb-B5-V.bcmap +0 -0
  206. package/lib/pdfjs/cmaps/HKgccs-B5-H.bcmap +0 -0
  207. package/lib/pdfjs/cmaps/HKgccs-B5-V.bcmap +0 -0
  208. package/lib/pdfjs/cmaps/HKm314-B5-H.bcmap +0 -0
  209. package/lib/pdfjs/cmaps/HKm314-B5-V.bcmap +0 -0
  210. package/lib/pdfjs/cmaps/HKm471-B5-H.bcmap +0 -0
  211. package/lib/pdfjs/cmaps/HKm471-B5-V.bcmap +0 -0
  212. package/lib/pdfjs/cmaps/HKscs-B5-H.bcmap +0 -0
  213. package/lib/pdfjs/cmaps/HKscs-B5-V.bcmap +0 -0
  214. package/lib/pdfjs/cmaps/Hankaku.bcmap +0 -0
  215. package/lib/pdfjs/cmaps/Hiragana.bcmap +0 -0
  216. package/lib/pdfjs/cmaps/KSC-EUC-H.bcmap +0 -0
  217. package/lib/pdfjs/cmaps/KSC-EUC-V.bcmap +0 -0
  218. package/lib/pdfjs/cmaps/KSC-H.bcmap +0 -0
  219. package/lib/pdfjs/cmaps/KSC-Johab-H.bcmap +0 -0
  220. package/lib/pdfjs/cmaps/KSC-Johab-V.bcmap +0 -0
  221. package/lib/pdfjs/cmaps/KSC-V.bcmap +0 -0
  222. package/lib/pdfjs/cmaps/KSCms-UHC-H.bcmap +0 -0
  223. package/lib/pdfjs/cmaps/KSCms-UHC-HW-H.bcmap +0 -0
  224. package/lib/pdfjs/cmaps/KSCms-UHC-HW-V.bcmap +0 -0
  225. package/lib/pdfjs/cmaps/KSCms-UHC-V.bcmap +0 -0
  226. package/lib/pdfjs/cmaps/KSCpc-EUC-H.bcmap +0 -0
  227. package/lib/pdfjs/cmaps/KSCpc-EUC-V.bcmap +0 -0
  228. package/lib/pdfjs/cmaps/Katakana.bcmap +0 -0
  229. package/lib/pdfjs/cmaps/LICENSE +0 -36
  230. package/lib/pdfjs/cmaps/NWP-H.bcmap +0 -0
  231. package/lib/pdfjs/cmaps/NWP-V.bcmap +0 -0
  232. package/lib/pdfjs/cmaps/RKSJ-H.bcmap +0 -0
  233. package/lib/pdfjs/cmaps/RKSJ-V.bcmap +0 -0
  234. package/lib/pdfjs/cmaps/Roman.bcmap +0 -0
  235. package/lib/pdfjs/cmaps/UniCNS-UCS2-H.bcmap +0 -0
  236. package/lib/pdfjs/cmaps/UniCNS-UCS2-V.bcmap +0 -0
  237. package/lib/pdfjs/cmaps/UniCNS-UTF16-H.bcmap +0 -0
  238. package/lib/pdfjs/cmaps/UniCNS-UTF16-V.bcmap +0 -0
  239. package/lib/pdfjs/cmaps/UniCNS-UTF32-H.bcmap +0 -0
  240. package/lib/pdfjs/cmaps/UniCNS-UTF32-V.bcmap +0 -0
  241. package/lib/pdfjs/cmaps/UniCNS-UTF8-H.bcmap +0 -0
  242. package/lib/pdfjs/cmaps/UniCNS-UTF8-V.bcmap +0 -0
  243. package/lib/pdfjs/cmaps/UniGB-UCS2-H.bcmap +0 -0
  244. package/lib/pdfjs/cmaps/UniGB-UCS2-V.bcmap +0 -0
  245. package/lib/pdfjs/cmaps/UniGB-UTF16-H.bcmap +0 -0
  246. package/lib/pdfjs/cmaps/UniGB-UTF16-V.bcmap +0 -0
  247. package/lib/pdfjs/cmaps/UniGB-UTF32-H.bcmap +0 -0
  248. package/lib/pdfjs/cmaps/UniGB-UTF32-V.bcmap +0 -0
  249. package/lib/pdfjs/cmaps/UniGB-UTF8-H.bcmap +0 -0
  250. package/lib/pdfjs/cmaps/UniGB-UTF8-V.bcmap +0 -0
  251. package/lib/pdfjs/cmaps/UniJIS-UCS2-H.bcmap +0 -0
  252. package/lib/pdfjs/cmaps/UniJIS-UCS2-HW-H.bcmap +0 -0
  253. package/lib/pdfjs/cmaps/UniJIS-UCS2-HW-V.bcmap +0 -0
  254. package/lib/pdfjs/cmaps/UniJIS-UCS2-V.bcmap +0 -0
  255. package/lib/pdfjs/cmaps/UniJIS-UTF16-H.bcmap +0 -0
  256. package/lib/pdfjs/cmaps/UniJIS-UTF16-V.bcmap +0 -0
  257. package/lib/pdfjs/cmaps/UniJIS-UTF32-H.bcmap +0 -0
  258. package/lib/pdfjs/cmaps/UniJIS-UTF32-V.bcmap +0 -0
  259. package/lib/pdfjs/cmaps/UniJIS-UTF8-H.bcmap +0 -0
  260. package/lib/pdfjs/cmaps/UniJIS-UTF8-V.bcmap +0 -0
  261. package/lib/pdfjs/cmaps/UniJIS2004-UTF16-H.bcmap +0 -0
  262. package/lib/pdfjs/cmaps/UniJIS2004-UTF16-V.bcmap +0 -0
  263. package/lib/pdfjs/cmaps/UniJIS2004-UTF32-H.bcmap +0 -0
  264. package/lib/pdfjs/cmaps/UniJIS2004-UTF32-V.bcmap +0 -0
  265. package/lib/pdfjs/cmaps/UniJIS2004-UTF8-H.bcmap +0 -0
  266. package/lib/pdfjs/cmaps/UniJIS2004-UTF8-V.bcmap +0 -0
  267. package/lib/pdfjs/cmaps/UniJISPro-UCS2-HW-V.bcmap +0 -0
  268. package/lib/pdfjs/cmaps/UniJISPro-UCS2-V.bcmap +0 -0
  269. package/lib/pdfjs/cmaps/UniJISPro-UTF8-V.bcmap +0 -0
  270. package/lib/pdfjs/cmaps/UniJISX0213-UTF32-H.bcmap +0 -0
  271. package/lib/pdfjs/cmaps/UniJISX0213-UTF32-V.bcmap +0 -0
  272. package/lib/pdfjs/cmaps/UniJISX02132004-UTF32-H.bcmap +0 -0
  273. package/lib/pdfjs/cmaps/UniJISX02132004-UTF32-V.bcmap +0 -0
  274. package/lib/pdfjs/cmaps/UniKS-UCS2-H.bcmap +0 -0
  275. package/lib/pdfjs/cmaps/UniKS-UCS2-V.bcmap +0 -0
  276. package/lib/pdfjs/cmaps/UniKS-UTF16-H.bcmap +0 -0
  277. package/lib/pdfjs/cmaps/UniKS-UTF16-V.bcmap +0 -0
  278. package/lib/pdfjs/cmaps/UniKS-UTF32-H.bcmap +0 -0
  279. package/lib/pdfjs/cmaps/UniKS-UTF32-V.bcmap +0 -0
  280. package/lib/pdfjs/cmaps/UniKS-UTF8-H.bcmap +0 -0
  281. package/lib/pdfjs/cmaps/UniKS-UTF8-V.bcmap +0 -0
  282. package/lib/pdfjs/cmaps/V.bcmap +0 -0
  283. package/lib/pdfjs/cmaps/WP-Symbol.bcmap +0 -0
  284. package/lib/pdfjs/pdf.worker.min.mjs +0 -21
@@ -1,24 +1,25 @@
1
- import { jsxs as T, jsx as i } from "react/jsx-runtime";
2
- import { forwardRef as dr, useRef as c, useState as h, useCallback as d, useImperativeHandle as mr, useEffect as X } from "react";
1
+ import { jsxs as N, jsx as c } from "react/jsx-runtime";
2
+ import { forwardRef as dr, useRef as i, useState as h, useCallback as d, useImperativeHandle as mr, useEffect as X } from "react";
3
3
  import br from "@likecoin/epub-ts";
4
4
  import { X as hr } from "lucide-react";
5
- import { u as wr, a as yr } from "./index-CGNWXFy3.mjs";
5
+ import { u as wr, a as yr } from "./index-BCbSb9Ob.mjs";
6
+ import { R as gr } from "./RendererError-BH6fzLrN.mjs";
6
7
  if (typeof document < "u" && !document.getElementById("rfp-epub-styles")) {
7
- const p = document.createElement("style");
8
- p.id = "rfp-epub-styles", p.textContent = `
8
+ const f = document.createElement("style");
9
+ f.id = "rfp-epub-styles", f.textContent = `
9
10
  .epub-container { overflow-y: auto !important; scrollbar-width: thin; }
10
11
  .epub-container::-webkit-scrollbar { width: 8px; }
11
12
  .epub-container::-webkit-scrollbar-track { background: transparent; }
12
13
  .epub-container::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 4px; }
13
14
  .epub-container::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.3); }
14
15
  .epub-view > iframe { background: white; }
15
- `, document.head.appendChild(p);
16
+ `, document.head.appendChild(f);
16
17
  }
17
- const xr = 794, Er = dr(
18
- ({ url: p, onChapterChange: _, onFullWidthChange: D }, ir) => {
19
- const G = wr(), cr = yr(), w = c(null), j = c(null), a = c(null), f = c(_), E = c(D);
20
- f.current = _, E.current = D;
21
- const y = c(0), H = c(null), M = c(!1), [ar, I] = h(!0), [L, U] = h(null), [V, fr] = h(!1), [B, J] = h([]), [A, x] = h(!1), [K, O] = h(""), Q = c([]);
18
+ const xr = 794, Hr = dr(
19
+ ({ url: f, onChapterChange: _, onFullWidthChange: D }, ir) => {
20
+ const G = wr(), ar = yr(), w = i(null), I = i(null), a = i(null), l = i(_), E = i(D);
21
+ l.current = _, E.current = D;
22
+ const y = i(0), R = i(null), M = i(!1), [cr, j] = h(!0), [H, U] = h(null), [V, fr] = h(!1), [B, J] = h([]), [L, g] = h(!1), [K, O] = h(""), Q = i([]);
22
23
  Q.current = B, M.current = V;
23
24
  const Y = d(() => {
24
25
  var r;
@@ -26,41 +27,41 @@ const xr = 794, Er = dr(
26
27
  }, []), Z = d(() => {
27
28
  var r;
28
29
  (r = a.current) == null || r.next();
29
- }, []), m = c(null), R = c(0), P = c((r) => {
30
- var s, l;
30
+ }, []), m = i(null), A = i(0), P = i((r) => {
31
+ var s, u;
31
32
  const e = m.current;
32
33
  if (!e) return;
33
34
  const t = e;
34
35
  if (t.scrollTop + t.clientHeight >= t.scrollHeight - 200)
35
36
  try {
36
37
  const n = (s = a.current) == null ? void 0 : s.manager;
37
- (l = n == null ? void 0 : n.check) == null || l.call(n, 500, 500);
38
+ (u = n == null ? void 0 : n.check) == null || u.call(n, 500, 500);
38
39
  } catch {
39
40
  }
40
41
  }), S = d(() => {
41
- m.current && (m.current.removeEventListener("scroll", P.current), m.current = null), cancelAnimationFrame(R.current);
42
+ m.current && (m.current.removeEventListener("scroll", P.current), m.current = null), cancelAnimationFrame(A.current);
42
43
  const r = () => {
43
44
  var t;
44
45
  const e = ((t = w.current) == null ? void 0 : t.querySelector(".epub-container")) ?? null;
45
46
  if (!e) {
46
- R.current = requestAnimationFrame(r);
47
+ A.current = requestAnimationFrame(r);
47
48
  return;
48
49
  }
49
50
  m.current = e, e.addEventListener("scroll", P.current, { passive: !0 });
50
51
  };
51
- R.current = requestAnimationFrame(r);
52
+ A.current = requestAnimationFrame(r);
52
53
  }, []), C = d(() => {
53
54
  var e;
54
55
  const r = !M.current;
55
56
  fr(r), (e = E.current) == null || e.call(E, r), setTimeout(() => {
56
- const t = w.current, u = a.current;
57
- !t || !u || (u.resize(t.offsetWidth, t.offsetHeight), H.current && u.display(H.current), S());
57
+ const t = w.current, p = a.current;
58
+ !t || !p || (p.resize(t.offsetWidth, t.offsetHeight), R.current && p.display(R.current), S());
58
59
  }, 350);
59
60
  }, [S]), rr = d(() => {
60
- x((r) => !r);
61
+ g((r) => !r);
61
62
  }, []), lr = d((r) => {
62
63
  var e;
63
- O(r), (e = a.current) == null || e.display(r), x(!1);
64
+ O(r), (e = a.current) == null || e.display(r), g(!1);
64
65
  }, []);
65
66
  mr(ir, () => ({
66
67
  prevPage: Y,
@@ -69,25 +70,25 @@ const xr = 794, Er = dr(
69
70
  toggleToc: rr
70
71
  }), [Y, Z, C, rr]), X(() => {
71
72
  const r = w.current;
72
- if (!r) return;
73
- I(!0), U(null), J([]), x(!1), r.innerHTML = "", H.current = null, y.current = 0;
73
+ if (!r || !f) return;
74
+ j(!0), U(null), J([]), g(!1), r.innerHTML = "", R.current = null, y.current = 0;
74
75
  let e = !1;
75
76
  const t = window.setTimeout(() => {
76
- e || u();
77
- }, 0), u = async () => {
77
+ e || p();
78
+ }, 0), p = async () => {
78
79
  var s;
79
80
  try {
80
- let l = p;
81
- p.startsWith("blob:") && (l = await (await cr(p)).arrayBuffer());
82
- const n = br(l);
83
- j.current = n;
84
- const g = n.renderTo(r, {
81
+ let u = f;
82
+ f.startsWith("blob:") && (u = await (await ar(f)).arrayBuffer());
83
+ const n = br(u);
84
+ I.current = n;
85
+ const x = n.renderTo(r, {
85
86
  manager: "continuous",
86
87
  flow: "scrolled",
87
88
  width: "100%",
88
89
  height: "100%"
89
90
  });
90
- a.current = g, g.themes.register("default", {
91
+ a.current = x, x.themes.register("default", {
91
92
  body: {
92
93
  background: "#ffffff !important",
93
94
  color: "#1a1a1a !important",
@@ -106,22 +107,22 @@ const xr = 794, Er = dr(
106
107
  h3: { margin: "1em 0 0.6em !important" },
107
108
  img: { "max-width": "100% !important", height: "auto !important" },
108
109
  a: { color: "#2563eb !important", "text-decoration": "none !important" }
109
- }), g.themes.select("default"), await n.ready, n.locations.generate(1024).then(() => {
110
- var v, k, N;
110
+ }), x.themes.select("default"), await n.ready, n.locations.generate(1024).then(() => {
111
+ var v, k, T;
111
112
  if (e) return;
112
113
  y.current = n.locations.length();
113
114
  const b = (v = a.current) == null ? void 0 : v.currentLocation(), o = ((k = b == null ? void 0 : b.start) == null ? void 0 : k.location) ?? 0;
114
- (N = f.current) == null || N.call(f, o + 1, y.current);
115
+ (T = l.current) == null || T.call(l, o + 1, y.current);
115
116
  }).catch(() => {
116
117
  });
117
118
  const z = await n.loaded.navigation;
118
- if (!e && Array.isArray(z == null ? void 0 : z.toc) && J(z.toc), await g.display(), e) return;
119
- I(!1), (s = f.current) == null || s.call(f, 1, y.current || 1), g.on("relocated", (b) => {
120
- var N, tr, nr, or;
119
+ if (!e && Array.isArray(z == null ? void 0 : z.toc) && J(z.toc), await x.display(), e) return;
120
+ j(!1), (s = l.current) == null || s.call(l, 1, y.current || 1), x.on("relocated", (b) => {
121
+ var T, tr, nr, or;
121
122
  const o = b;
122
- if ((N = o == null ? void 0 : o.start) != null && N.cfi && (H.current = o.start.cfi), (tr = o == null ? void 0 : o.start) != null && tr.href) {
123
- const $ = o.start.href, q = [], sr = (ur) => {
124
- for (const W of ur) {
123
+ if ((T = o == null ? void 0 : o.start) != null && T.cfi && (R.current = o.start.cfi), (tr = o == null ? void 0 : o.start) != null && tr.href) {
124
+ const $ = o.start.href, q = [], sr = (pr) => {
125
+ for (const W of pr) {
125
126
  const F = W.href.split("#")[0];
126
127
  F && ($ === F || $.endsWith("/" + F) || $.endsWith(F)) && q.push(W.href), W.subitems && sr(W.subitems);
127
128
  }
@@ -129,26 +130,26 @@ const xr = 794, Er = dr(
129
130
  sr(Q.current), q.length === 1 && O(q[0]);
130
131
  }
131
132
  const v = (nr = o == null ? void 0 : o.start) == null ? void 0 : nr.location, k = y.current;
132
- typeof v == "number" && k > 0 && ((or = f.current) == null || or.call(f, v + 1, k));
133
+ typeof v == "number" && k > 0 && ((or = l.current) == null || or.call(l, v + 1, k));
133
134
  });
134
- } catch (l) {
135
- console.error("EPUB 加载错误:", l), e || (U(G("epub.load_failed")), I(!1));
135
+ } catch (u) {
136
+ console.error("EPUB 加载错误:", u), e || (U(G("epub.load_failed")), j(!1));
136
137
  }
137
138
  };
138
139
  return () => {
139
- var s, l, n;
140
+ var s, u, n;
140
141
  e = !0, window.clearTimeout(t);
141
142
  try {
142
- (l = (s = a.current) == null ? void 0 : s.destroy) == null || l.call(s);
143
+ (u = (s = a.current) == null ? void 0 : s.destroy) == null || u.call(s);
143
144
  } catch {
144
145
  }
145
146
  try {
146
- (n = j.current) == null || n.destroy();
147
+ (n = I.current) == null || n.destroy();
147
148
  } catch {
148
149
  }
149
- a.current = null, j.current = null;
150
+ a.current = null, I.current = null;
150
151
  };
151
- }, [p]), X(() => {
152
+ }, [f]), X(() => {
152
153
  const r = () => {
153
154
  const e = w.current;
154
155
  !e || !a.current || a.current.resize(e.offsetWidth, e.offsetHeight);
@@ -156,12 +157,12 @@ const xr = 794, Er = dr(
156
157
  return window.addEventListener("resize", r), () => window.removeEventListener("resize", r);
157
158
  }, []), X(() => (S(), () => {
158
159
  var r;
159
- cancelAnimationFrame(R.current), (r = m.current) == null || r.removeEventListener("scroll", P.current);
160
- }), [p, S]);
161
- const pr = d((r) => r === K, [K]), er = (r, e = 0) => /* @__PURE__ */ i("ul", { style: { marginLeft: e > 0 ? 16 : 0 }, children: r.map((t, u) => {
162
- const s = pr(t.href);
163
- return /* @__PURE__ */ T("li", { children: [
164
- /* @__PURE__ */ i(
160
+ cancelAnimationFrame(A.current), (r = m.current) == null || r.removeEventListener("scroll", P.current);
161
+ }), [f, S]);
162
+ const ur = d((r) => r === K, [K]), er = (r, e = 0) => /* @__PURE__ */ c("ul", { style: { marginLeft: e > 0 ? 16 : 0 }, children: r.map((t, p) => {
163
+ const s = ur(t.href);
164
+ return /* @__PURE__ */ N("li", { children: [
165
+ /* @__PURE__ */ c(
165
166
  "button",
166
167
  {
167
168
  onClick: () => lr(t.href),
@@ -171,53 +172,53 @@ const xr = 794, Er = dr(
171
172
  }
172
173
  ),
173
174
  t.subitems && t.subitems.length > 0 && er(t.subitems, e + 1)
174
- ] }, `${t.href}-${u}`);
175
+ ] }, `${t.href}-${p}`);
175
176
  }) });
176
- return /* @__PURE__ */ T("div", { className: "rfp-relative rfp-w-full rfp-h-full rfp-flex rfp-justify-center rfp-bg-[#f5f5f0] rfp-overflow-hidden", children: [
177
- L && /* @__PURE__ */ i("div", { className: "rfp-absolute rfp-inset-0 rfp-flex rfp-items-center rfp-justify-center rfp-text-fg-secondary rfp-text-center", children: /* @__PURE__ */ i("p", { className: "rfp-text-lg", children: L }) }),
178
- ar && !L && /* @__PURE__ */ i("div", { className: "rfp-absolute rfp-inset-0 rfp-flex rfp-items-center rfp-justify-center rfp-z-10", children: /* @__PURE__ */ i("div", { className: "rfp-w-12 rfp-h-12 rfp-border-4 rfp-border-line-strong rfp-border-t-spinner-head rfp-rounded-full rfp-animate-spin" }) }),
179
- B.length > 0 && /* @__PURE__ */ T(
177
+ return /* @__PURE__ */ N("div", { className: "rfp-relative rfp-w-full rfp-h-full rfp-flex rfp-justify-center rfp-bg-surface-1 rfp-overflow-hidden", children: [
178
+ H && /* @__PURE__ */ c(gr, { message: H }),
179
+ cr && !H && /* @__PURE__ */ c("div", { className: "rfp-absolute rfp-inset-0 rfp-flex rfp-items-center rfp-justify-center rfp-z-10", children: /* @__PURE__ */ c("div", { className: "rfp-w-12 rfp-h-12 rfp-border-4 rfp-border-line-strong rfp-border-t-spinner-head rfp-rounded-full rfp-animate-spin" }) }),
180
+ B.length > 0 && /* @__PURE__ */ N(
180
181
  "div",
181
182
  {
182
183
  className: "rfp-absolute rfp-inset-0 rfp-z-20 rfp-flex rfp-transition-opacity rfp-duration-300",
183
184
  style: {
184
- opacity: A ? 1 : 0,
185
- pointerEvents: A ? "auto" : "none"
185
+ opacity: L ? 1 : 0,
186
+ pointerEvents: L ? "auto" : "none"
186
187
  },
187
188
  children: [
188
- /* @__PURE__ */ T(
189
+ /* @__PURE__ */ N(
189
190
  "div",
190
191
  {
191
192
  className: "rfp-w-72 rfp-max-w-[80%] rfp-h-full rfp-bg-surface-overlay rfp-backdrop-blur-xl rfp-border-r rfp-border-line-weak rfp-flex rfp-flex-col rfp-shadow-2xl rfp-transition-transform rfp-duration-300",
192
- style: { transform: A ? "translateX(0)" : "translateX(-100%)" },
193
+ style: { transform: L ? "translateX(0)" : "translateX(-100%)" },
193
194
  children: [
194
- /* @__PURE__ */ T("div", { className: "rfp-flex rfp-items-center rfp-justify-between rfp-px-4 rfp-py-3 rfp-border-b rfp-border-line-weak rfp-flex-shrink-0", children: [
195
- /* @__PURE__ */ i("span", { className: "rfp-text-fg-primary rfp-font-medium rfp-text-sm", children: G("toolbar.toc") }),
196
- /* @__PURE__ */ i(
195
+ /* @__PURE__ */ N("div", { className: "rfp-flex rfp-items-center rfp-justify-between rfp-px-4 rfp-py-3 rfp-border-b rfp-border-line-weak rfp-flex-shrink-0", children: [
196
+ /* @__PURE__ */ c("span", { className: "rfp-text-fg-primary rfp-font-medium rfp-text-sm", children: G("toolbar.toc") }),
197
+ /* @__PURE__ */ c(
197
198
  "button",
198
199
  {
199
- onClick: () => x(!1),
200
+ onClick: () => g(!1),
200
201
  className: "rfp-text-fg-tertiary hover:rfp-text-fg-primary rfp-transition-colors",
201
- children: /* @__PURE__ */ i(hr, { className: "rfp-w-4 rfp-h-4" })
202
+ children: /* @__PURE__ */ c(hr, { className: "rfp-w-4 rfp-h-4" })
202
203
  }
203
204
  )
204
205
  ] }),
205
- /* @__PURE__ */ i("div", { className: "rfp-flex-1 rfp-overflow-y-auto rfp-py-4 rfp-px-1", children: er(B) })
206
+ /* @__PURE__ */ c("div", { className: "rfp-flex-1 rfp-overflow-y-auto rfp-py-4 rfp-px-1", children: er(B) })
206
207
  ]
207
208
  }
208
209
  ),
209
- /* @__PURE__ */ i(
210
+ /* @__PURE__ */ c(
210
211
  "div",
211
212
  {
212
213
  className: "rfp-flex-1 rfp-transition-opacity rfp-duration-300",
213
- style: { background: A ? "rgba(0,0,0,0.3)" : "transparent" },
214
- onClick: () => x(!1)
214
+ style: { background: L ? "rgba(0,0,0,0.3)" : "transparent" },
215
+ onClick: () => g(!1)
215
216
  }
216
217
  )
217
218
  ]
218
219
  }
219
220
  ),
220
- !L && /* @__PURE__ */ i(
221
+ !H && /* @__PURE__ */ c(
221
222
  "div",
222
223
  {
223
224
  ref: w,
@@ -234,6 +235,6 @@ const xr = 794, Er = dr(
234
235
  }
235
236
  );
236
237
  export {
237
- Er as EpubRenderer
238
+ Hr as EpubRenderer
238
239
  };
239
- //# sourceMappingURL=index-DSAXdrgU.mjs.map
240
+ //# sourceMappingURL=index-DlptjfMf.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-DlptjfMf.mjs","sources":["../../src/renderers/Epub/index.tsx"],"sourcesContent":["import { useEffect, useRef, useState, useCallback, useImperativeHandle, forwardRef } from 'react';\nimport ePub from '@likecoin/epub-ts';\nimport { X } from 'lucide-react';\nimport { useTranslator } from '../../i18n/LocaleContext';\nimport { useFetcher } from '../../RequestContext';\nimport { RendererError } from '../RendererError';\n\n// 全局注入 epubjs 容器样式(只注入一次)\nif (typeof document !== 'undefined' && !document.getElementById('rfp-epub-styles')) {\n const styleEl = document.createElement('style');\n styleEl.id = 'rfp-epub-styles';\n styleEl.textContent = `\n .epub-container { overflow-y: auto !important; scrollbar-width: thin; }\n .epub-container::-webkit-scrollbar { width: 8px; }\n .epub-container::-webkit-scrollbar-track { background: transparent; }\n .epub-container::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 4px; }\n .epub-container::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.3); }\n .epub-view > iframe { background: white; }\n `;\n document.head.appendChild(styleEl);\n}\n\nexport interface TocItem {\n label: string;\n href: string;\n subitems?: TocItem[];\n}\n\nexport interface EpubRendererHandle {\n prevPage: () => void;\n nextPage: () => void;\n toggleFullWidth: () => void;\n toggleToc: () => void;\n}\n\ninterface EpubRendererProps {\n url: string;\n onChapterChange?: (current: number, total: number) => void;\n onFullWidthChange?: (isFullWidth: boolean) => void;\n}\n\ninterface RenditionLike {\n display: (target?: string) => Promise<unknown>;\n next: () => Promise<unknown>;\n prev: () => Promise<unknown>;\n on: (event: string, cb: (...args: unknown[]) => void) => void;\n resize: (width: number, height: number) => void;\n currentLocation: () => unknown;\n destroy?: () => void;\n themes: {\n register: (name: string, styles: Record<string, unknown>) => void;\n select: (name: string) => void;\n };\n}\n\ninterface BookLike {\n ready: Promise<unknown>;\n loaded: { navigation: Promise<unknown> };\n locations: {\n generate: (chars: number) => Promise<string[]>;\n length: () => number;\n locationFromCfi: (cfi: string) => number;\n };\n renderTo: (el: HTMLElement, opts: Record<string, unknown>) => RenditionLike;\n destroy: () => void;\n}\n\nconst A4_WIDTH = 794;\n\nexport const EpubRenderer = forwardRef<EpubRendererHandle, EpubRendererProps>(\n ({ url, onChapterChange, onFullWidthChange }, ref) => {\n const t = useTranslator();\n const fetcher = useFetcher();\n const viewerRef = useRef<HTMLDivElement>(null);\n const bookRef = useRef<BookLike | null>(null);\n const renditionRef = useRef<RenditionLike | null>(null);\n const onChapterChangeRef = useRef(onChapterChange);\n const onFullWidthChangeRef = useRef(onFullWidthChange);\n onChapterChangeRef.current = onChapterChange;\n onFullWidthChangeRef.current = onFullWidthChange;\n\n const totalLocationsRef = useRef(0);\n const lastCfiRef = useRef<string | null>(null);\n const isFullWidthRef = useRef(false);\n\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<string | null>(null);\n const [isFullWidth, setIsFullWidth] = useState(false);\n const [toc, setToc] = useState<TocItem[]>([]);\n const [showToc, setShowToc] = useState(false);\n const [activeTocHref, setActiveTocHref] = useState<string>('');\n const tocRef = useRef<TocItem[]>([]);\n tocRef.current = toc;\n\n isFullWidthRef.current = isFullWidth;\n\n const handlePrev = useCallback(() => {\n renditionRef.current?.prev();\n }, []);\n\n const handleNext = useCallback(() => {\n renditionRef.current?.next();\n }, []);\n\n // 滚动监听:接近底部时强制触发 check 加载后续 section\n const scrollContainerRef = useRef<Element | null>(null);\n const scrollRafRef = useRef(0);\n\n const onScrollRef = useRef((_e?: Event) => {\n const container = scrollContainerRef.current;\n if (!container) return;\n const el = container as HTMLElement;\n const nearBottom = el.scrollTop + el.clientHeight >= el.scrollHeight - 200;\n if (nearBottom) {\n try {\n const mgr = (renditionRef.current as unknown as { manager?: { check?: (t?: number, e?: number) => Promise<unknown> } })?.manager;\n mgr?.check?.(500, 500);\n } catch { /* ignore */ }\n }\n });\n\n const reattachScrollListener = useCallback(() => {\n // 清理旧监听\n if (scrollContainerRef.current) {\n scrollContainerRef.current.removeEventListener('scroll', onScrollRef.current);\n scrollContainerRef.current = null;\n }\n cancelAnimationFrame(scrollRafRef.current);\n\n const tryAttach = () => {\n const container = viewerRef.current?.querySelector('.epub-container') ?? null;\n if (!container) {\n scrollRafRef.current = requestAnimationFrame(tryAttach);\n return;\n }\n scrollContainerRef.current = container;\n container.addEventListener('scroll', onScrollRef.current, { passive: true });\n };\n scrollRafRef.current = requestAnimationFrame(tryAttach);\n }, []);\n\n const toggleFullWidth = useCallback(() => {\n const newVal = !isFullWidthRef.current;\n setIsFullWidth(newVal);\n onFullWidthChangeRef.current?.(newVal);\n // 等 CSS transition 完成后再 resize 并恢复位置\n setTimeout(() => {\n const viewer = viewerRef.current;\n const rendition = renditionRef.current;\n if (!viewer || !rendition) return;\n rendition.resize(viewer.offsetWidth, viewer.offsetHeight);\n // 重排后恢复阅读位置\n if (lastCfiRef.current) {\n rendition.display(lastCfiRef.current);\n }\n // resize/display 可能重建 .epub-container,需要重新绑定滚动监听\n reattachScrollListener();\n }, 350);\n }, [reattachScrollListener]);\n\n const toggleToc = useCallback(() => {\n setShowToc(prev => !prev);\n }, []);\n\n const handleTocClick = useCallback((href: string) => {\n setActiveTocHref(href);\n renditionRef.current?.display(href);\n setShowToc(false);\n }, []);\n\n useImperativeHandle(ref, () => ({\n prevPage: handlePrev,\n nextPage: handleNext,\n toggleFullWidth,\n toggleToc,\n }), [handlePrev, handleNext, toggleFullWidth, toggleToc]);\n\n useEffect(() => {\n const viewer = viewerRef.current;\n // 只有 URL 有效时才加载(避免空字符串或已 revoke 的 blob URL)\n if (!viewer || !url) return;\n\n setLoading(true);\n setError(null);\n setToc([]);\n setShowToc(false);\n viewer.innerHTML = '';\n lastCfiRef.current = null;\n totalLocationsRef.current = 0;\n\n let cancelled = false;\n // StrictMode 下 effect 会立即 mount→unmount→mount\n // 用 microtask 延迟初始化,让第一次的 cleanup 先执行,避免 epubjs 内部状态被污染\n const loadTimer = window.setTimeout(() => {\n if (cancelled) return;\n load();\n }, 0);\n\n const load = async () => {\n try {\n let bookInput: string | ArrayBuffer = url;\n if (url.startsWith('blob:')) {\n const resp = await fetcher(url);\n bookInput = await resp.arrayBuffer();\n }\n\n const book = ePub(bookInput) as unknown as BookLike;\n bookRef.current = book;\n\n const rendition = book.renderTo(viewer, {\n manager: 'continuous',\n flow: 'scrolled',\n width: '100%',\n height: '100%',\n });\n renditionRef.current = rendition;\n\n rendition.themes.register('default', {\n body: {\n background: '#ffffff !important',\n color: '#1a1a1a !important',\n 'font-family': '\"Noto Serif SC\", \"Source Han Serif SC\", Georgia, \"Times New Roman\", serif !important',\n 'font-size': '16px !important',\n 'line-height': '2 !important',\n padding: '40px 60px !important',\n 'max-width': '100% !important',\n 'box-sizing': 'border-box !important',\n 'word-break': 'break-word !important',\n 'overflow-wrap': 'break-word !important',\n },\n p: { 'text-indent': '2em !important', margin: '0.8em 0 !important' },\n h1: { 'text-align': 'center !important', margin: '1.5em 0 1em !important' },\n h2: { margin: '1.2em 0 0.8em !important' },\n h3: { margin: '1em 0 0.6em !important' },\n img: { 'max-width': '100% !important', height: 'auto !important' },\n a: { color: '#2563eb !important', 'text-decoration': 'none !important' },\n });\n rendition.themes.select('default');\n\n await book.ready;\n\n // 异步生成 locations 索引(用于实时页数)\n book.locations.generate(1024).then(() => {\n if (cancelled) return;\n totalLocationsRef.current = book.locations.length();\n // 触发一次更新让父组件拿到 total\n const loc = renditionRef.current?.currentLocation() as { start?: { location?: number; cfi?: string } } | undefined;\n const cur = loc?.start?.location ?? 0;\n onChapterChangeRef.current?.(cur + 1, totalLocationsRef.current);\n }).catch(() => { /* ignore */ });\n\n // 获取目录\n const nav = await book.loaded.navigation as { toc?: TocItem[] };\n if (!cancelled && Array.isArray(nav?.toc)) {\n setToc(nav.toc);\n }\n\n await rendition.display();\n\n if (cancelled) return;\n\n setLoading(false);\n onChapterChangeRef.current?.(1, totalLocationsRef.current || 1);\n\n rendition.on('relocated', (location: unknown) => {\n const loc = location as { start?: { cfi?: string; location?: number; href?: string } };\n if (loc?.start?.cfi) {\n lastCfiRef.current = loc.start.cfi;\n }\n if (loc?.start?.href) {\n // 根据 spine href 查找匹配的 TOC 项\n const spineHref = loc.start.href;\n const matches: string[] = [];\n const collect = (items: TocItem[]) => {\n for (const item of items) {\n const base = item.href.split('#')[0];\n if (base && (spineHref === base || spineHref.endsWith('/' + base) || spineHref.endsWith(base))) {\n matches.push(item.href);\n }\n if (item.subitems) collect(item.subitems);\n }\n };\n collect(tocRef.current);\n if (matches.length === 1) {\n // 唯一匹配,直接设置\n setActiveTocHref(matches[0]);\n }\n // 多个匹配(同一文件不同 anchor)时保持当前选中(由点击设置)\n }\n const cur = loc?.start?.location;\n const total = totalLocationsRef.current;\n if (typeof cur === 'number' && total > 0) {\n onChapterChangeRef.current?.(cur + 1, total);\n }\n });\n\n } catch (err) {\n console.error('EPUB 加载错误:', err);\n if (!cancelled) {\n setError(t('epub.load_failed'));\n setLoading(false);\n }\n }\n };\n\n return () => {\n cancelled = true;\n window.clearTimeout(loadTimer);\n try { renditionRef.current?.destroy?.(); } catch { /* ignore */ }\n try { bookRef.current?.destroy(); } catch { /* ignore */ }\n renditionRef.current = null;\n bookRef.current = null;\n };\n }, [url]);\n\n useEffect(() => {\n const onResize = () => {\n const viewer = viewerRef.current;\n if (!viewer || !renditionRef.current) return;\n renditionRef.current.resize(viewer.offsetWidth, viewer.offsetHeight);\n };\n window.addEventListener('resize', onResize);\n return () => window.removeEventListener('resize', onResize);\n }, []);\n\n useEffect(() => {\n reattachScrollListener();\n return () => {\n cancelAnimationFrame(scrollRafRef.current);\n scrollContainerRef.current?.removeEventListener('scroll', onScrollRef.current);\n };\n }, [url, reattachScrollListener]);\n\n const isActive = useCallback((href: string) => {\n return href === activeTocHref;\n }, [activeTocHref]);\n\n const renderTocItems = (items: TocItem[], depth = 0) => (\n <ul style={{ marginLeft: depth > 0 ? 16 : 0 }}>\n {items.map((item, i) => {\n const active = isActive(item.href);\n return (\n <li key={`${item.href}-${i}`}>\n <button\n onClick={() => handleTocClick(item.href)}\n className={`rfp-w-full rfp-text-left rfp-py-2 rfp-px-3 rfp-text-sm rfp-rounded rfp-transition-all rfp-truncate ${active\n ? 'rfp-text-fg-primary rfp-bg-surface-3 rfp-font-medium'\n : 'rfp-text-fg-secondary hover:rfp-text-fg-primary hover:rfp-bg-surface-2'\n }`}\n title={item.label}\n >\n {item.label.trim()}\n </button>\n {item.subitems && item.subitems.length > 0 && renderTocItems(item.subitems, depth + 1)}\n </li>\n );\n })}\n </ul>\n );\n\n return (\n <div className=\"rfp-relative rfp-w-full rfp-h-full rfp-flex rfp-justify-center rfp-bg-surface-1 rfp-overflow-hidden\">\n {error && <RendererError message={error} />}\n\n {loading && !error && (\n <div className=\"rfp-absolute rfp-inset-0 rfp-flex rfp-items-center rfp-justify-center rfp-z-10\">\n <div className=\"rfp-w-12 rfp-h-12 rfp-border-4 rfp-border-line-strong rfp-border-t-spinner-head rfp-rounded-full rfp-animate-spin\" />\n </div>\n )}\n\n {/* 目录侧栏 - 滑入动画 */}\n {toc.length > 0 && (\n <div\n className=\"rfp-absolute rfp-inset-0 rfp-z-20 rfp-flex rfp-transition-opacity rfp-duration-300\"\n style={{\n opacity: showToc ? 1 : 0,\n pointerEvents: showToc ? 'auto' : 'none',\n }}\n >\n <div\n className=\"rfp-w-72 rfp-max-w-[80%] rfp-h-full rfp-bg-surface-overlay rfp-backdrop-blur-xl rfp-border-r rfp-border-line-weak rfp-flex rfp-flex-col rfp-shadow-2xl rfp-transition-transform rfp-duration-300\"\n style={{ transform: showToc ? 'translateX(0)' : 'translateX(-100%)' }}\n >\n <div className=\"rfp-flex rfp-items-center rfp-justify-between rfp-px-4 rfp-py-3 rfp-border-b rfp-border-line-weak rfp-flex-shrink-0\">\n <span className=\"rfp-text-fg-primary rfp-font-medium rfp-text-sm\">{t('toolbar.toc')}</span>\n <button\n onClick={() => setShowToc(false)}\n className=\"rfp-text-fg-tertiary hover:rfp-text-fg-primary rfp-transition-colors\"\n >\n <X className=\"rfp-w-4 rfp-h-4\" />\n </button>\n </div>\n <div className=\"rfp-flex-1 rfp-overflow-y-auto rfp-py-4 rfp-px-1\">\n {renderTocItems(toc)}\n </div>\n </div>\n <div\n className=\"rfp-flex-1 rfp-transition-opacity rfp-duration-300\"\n style={{ background: showToc ? 'rgba(0,0,0,0.3)' : 'transparent' }}\n onClick={() => setShowToc(false)}\n />\n </div>\n )}\n\n {!error && (\n <div\n ref={viewerRef}\n className=\"rfp-h-full rfp-bg-surface-toolbar rfp-shadow-lg\"\n style={{\n width: isFullWidth ? '100%' : `${A4_WIDTH}px`,\n maxWidth: '100%',\n transition: 'width 0.3s ease',\n overflow: 'hidden',\n }}\n />\n )}\n </div>\n );\n }\n);\n"],"names":["styleEl","A4_WIDTH","EpubRenderer","forwardRef","url","onChapterChange","onFullWidthChange","ref","t","useTranslator","fetcher","useFetcher","viewerRef","useRef","bookRef","renditionRef","onChapterChangeRef","onFullWidthChangeRef","totalLocationsRef","lastCfiRef","isFullWidthRef","loading","setLoading","useState","error","setError","isFullWidth","setIsFullWidth","toc","setToc","showToc","setShowToc","activeTocHref","setActiveTocHref","tocRef","handlePrev","useCallback","_a","handleNext","scrollContainerRef","scrollRafRef","onScrollRef","_e","container","el","mgr","_b","reattachScrollListener","tryAttach","toggleFullWidth","newVal","viewer","rendition","toggleToc","prev","handleTocClick","href","useImperativeHandle","useEffect","cancelled","loadTimer","load","bookInput","book","ePub","loc","cur","_c","nav","location","spineHref","matches","collect","items","item","base","total","_d","err","onResize","isActive","renderTocItems","depth","jsx","i","active","jsxs","RendererError","X"],"mappings":";;;;;;AAQA,IAAI,OAAO,WAAa,OAAe,CAAC,SAAS,eAAe,iBAAiB,GAAG;AAClF,QAAMA,IAAU,SAAS,cAAc,OAAO;AAC9C,EAAAA,EAAQ,KAAK,mBACbA,EAAQ,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAQtB,SAAS,KAAK,YAAYA,CAAO;AACnC;AA+CA,MAAMC,KAAW,KAEJC,KAAeC;AAAA,EAC1B,CAAC,EAAE,KAAAC,GAAK,iBAAAC,GAAiB,mBAAAC,EAAA,GAAqBC,OAAQ;AACpD,UAAMC,IAAIC,GAAA,GACJC,KAAUC,GAAA,GACVC,IAAYC,EAAuB,IAAI,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AGzB,EAAQ;AAAA,YACzC,UAAU;AAAA,YACV,YAAY;AAAA,YACZ,UAAU;AAAA,UAAA;AAAA,QACZ;AAAA,MAAA;AAAA,IACF,GAEJ;AAAA,EAEJ;AACF;"}
@@ -1,59 +1,59 @@
1
- import { jsx as r, jsxs as d } from "react/jsx-runtime";
2
- import { useState as l, useEffect as _, useCallback as z } from "react";
3
- import H from "react-markdown";
4
- import M from "remark-gfm";
5
- import j from "remark-math";
6
- import T from "rehype-katex";
7
- import F from "rehype-raw";
8
- import { Check as y, Copy as N } from "lucide-react";
9
- import { u as c, a as B, F as E } from "./index-CGNWXFy3.mjs";
10
- import { u as w } from "./useShikiHighlight-DHFYu0BU.mjs";
11
- import "katex/dist/katex.min.css";
12
- const v = (t) => {
13
- const [p, f] = l(!1), a = z(async () => {
1
+ import { jsx as r, jsxs as m } from "react/jsx-runtime";
2
+ import { useState as l, useEffect as _, useCallback as E } from "react";
3
+ import z from "react-markdown";
4
+ import H from "remark-gfm";
5
+ import M from "remark-math";
6
+ import I from "rehype-katex";
7
+ import R from "rehype-raw";
8
+ import { Check as y, Copy as w } from "lucide-react";
9
+ import { u, a as T, E as j } from "./index-BCbSb9Ob.mjs";
10
+ import { u as N } from "./useShikiHighlight-Cq02e63J.mjs";
11
+ import { R as B } from "./RendererError-BH6fzLrN.mjs";
12
+ const k = (t) => {
13
+ const [f, p] = l(!1), a = E(async () => {
14
14
  try {
15
15
  await navigator.clipboard.writeText(t);
16
16
  } catch {
17
- const s = document.createElement("textarea");
18
- s.value = t, document.body.appendChild(s), s.select(), document.execCommand("copy"), document.body.removeChild(s);
17
+ const n = document.createElement("textarea");
18
+ n.value = t, document.body.appendChild(n), n.select(), document.execCommand("copy"), document.body.removeChild(n);
19
19
  }
20
- f(!0), setTimeout(() => f(!1), 2e3);
20
+ p(!0), setTimeout(() => p(!1), 2e3);
21
21
  }, [t]);
22
- return { copied: p, handleCopy: a };
23
- }, I = ({ text: t }) => {
24
- const p = c(), { copied: f, handleCopy: a } = v(t);
22
+ return { copied: f, handleCopy: a };
23
+ }, L = ({ text: t }) => {
24
+ const f = u(), { copied: p, handleCopy: a } = k(t);
25
25
  return /* @__PURE__ */ r(
26
26
  "button",
27
27
  {
28
28
  onClick: a,
29
29
  className: "rfp-p-1 rfp-rounded rfp-text-fg-muted hover:rfp-text-fg-secondary rfp-transition-colors rfp-flex rfp-items-center rfp-gap-1",
30
- title: p(f ? "markdown.copied" : "markdown.copy_code"),
31
- children: f ? /* @__PURE__ */ r(y, { size: 13 }) : /* @__PURE__ */ r(N, { size: 13 })
30
+ title: f(p ? "markdown.copied" : "markdown.copy_code"),
31
+ children: p ? /* @__PURE__ */ r(y, { size: 13 }) : /* @__PURE__ */ r(w, { size: 13 })
32
32
  }
33
33
  );
34
- }, L = ({ text: t }) => {
35
- const p = c(), { copied: f, handleCopy: a } = v(t);
34
+ }, q = ({ text: t }) => {
35
+ const f = u(), { copied: p, handleCopy: a } = k(t);
36
36
  return /* @__PURE__ */ r(
37
37
  "button",
38
38
  {
39
39
  onClick: a,
40
40
  className: "rfp-absolute rfp-top-2 rfp-right-2 rfp-p-1.5 rfp-rounded-md rfp-bg-surface-2 hover:rfp-bg-surface-3 rfp-text-fg-tertiary hover:rfp-text-fg-secondary rfp-transition-colors rfp-opacity-0 group-hover:rfp-opacity-100 rfp-border rfp-border-line",
41
- title: p(f ? "markdown.copied" : "markdown.copy_code"),
42
- children: f ? /* @__PURE__ */ r(y, { size: 14 }) : /* @__PURE__ */ r(N, { size: 14 })
41
+ title: f(p ? "markdown.copied" : "markdown.copy_code"),
42
+ children: p ? /* @__PURE__ */ r(y, { size: 14 }) : /* @__PURE__ */ r(w, { size: 14 })
43
43
  }
44
44
  );
45
- }, R = ({ code: t, lang: p }) => {
46
- const { html: f } = w(t, p);
47
- return /* @__PURE__ */ d("div", { className: "rfp-relative rfp-group rfp-my-4", children: [
48
- /* @__PURE__ */ d("div", { className: "rfp-flex rfp-items-center rfp-justify-between rfp-px-4 rfp-py-1.5 rfp-bg-surface-1 rfp-border rfp-border-line-weak rfp-rounded-t-md rfp-border-b-0", children: [
49
- /* @__PURE__ */ r("span", { className: "rfp-text-xs rfp-text-fg-secondary rfp-font-mono rfp-select-none", children: p }),
50
- /* @__PURE__ */ r(I, { text: t })
45
+ }, A = ({ code: t, lang: f }) => {
46
+ const { html: p } = N(t, f);
47
+ return /* @__PURE__ */ m("div", { className: "rfp-relative rfp-group rfp-my-4", children: [
48
+ /* @__PURE__ */ m("div", { className: "rfp-flex rfp-items-center rfp-justify-between rfp-px-4 rfp-py-1.5 rfp-bg-surface-1 rfp-border rfp-border-line-weak rfp-rounded-t-md rfp-border-b-0", children: [
49
+ /* @__PURE__ */ r("span", { className: "rfp-text-xs rfp-text-fg-secondary rfp-font-mono rfp-select-none", children: f }),
50
+ /* @__PURE__ */ r(L, { text: t })
51
51
  ] }),
52
- f ? /* @__PURE__ */ r(
52
+ p ? /* @__PURE__ */ r(
53
53
  "div",
54
54
  {
55
55
  className: "rfp-shiki-wrapper rfp-rounded-b-md rfp-border rfp-border-line-weak rfp-border-t-0 rfp-overflow-x-auto",
56
- dangerouslySetInnerHTML: { __html: f }
56
+ dangerouslySetInnerHTML: { __html: p }
57
57
  }
58
58
  ) : /* @__PURE__ */ r(
59
59
  "pre",
@@ -64,46 +64,49 @@ const v = (t) => {
64
64
  }
65
65
  )
66
66
  ] });
67
- }, V = ({ url: t, viewMode: p = "preview" }) => {
68
- const f = c(), a = B(), [s, k] = l(""), [C, m] = l(!0), [u, h] = l(null), { html: x } = w(
69
- p === "source" ? s : "",
67
+ }, X = ({ url: t, viewMode: f = "preview" }) => {
68
+ const p = u(), a = T(), [n, v] = l(""), [C, b] = l(!0), [h, g] = l(null), { html: x } = N(
69
+ f === "source" ? n : "",
70
70
  "markdown"
71
71
  );
72
72
  return _(() => {
73
- (async () => {
73
+ const e = new AbortController();
74
+ return (async () => {
74
75
  try {
75
- m(!0), h(null);
76
- const o = await E(t, { fetcher: a });
77
- k(o);
76
+ b(!0), g(null);
77
+ const o = await j(t, { fetcher: a, signal: e.signal });
78
+ v(o);
78
79
  } catch (o) {
79
- h(f("markdown.load_failed")), console.error(o);
80
+ if (o.name === "AbortError") return;
81
+ g(p("markdown.load_failed")), console.error(o);
80
82
  } finally {
81
- m(!1);
83
+ b(!1);
82
84
  }
83
- })();
84
- }, [t, a, f]), C ? /* @__PURE__ */ r("div", { className: "rfp-flex rfp-items-center rfp-justify-center rfp-w-full rfp-h-full", children: /* @__PURE__ */ r("div", { className: "rfp-w-12 rfp-h-12 rfp-border-4 rfp-border-line-strong rfp-border-t-spinner-head rfp-rounded-full rfp-animate-spin" }) }) : u ? /* @__PURE__ */ r("div", { className: "rfp-flex rfp-items-center rfp-justify-center rfp-w-full rfp-h-full", children: /* @__PURE__ */ r("div", { className: "rfp-text-fg-secondary rfp-text-center", children: /* @__PURE__ */ r("p", { className: "rfp-text-lg", children: u }) }) }) : p === "source" ? /* @__PURE__ */ r("div", { className: "rfp-w-full rfp-h-full rfp-overflow-auto rfp-bg-code-bg", children: x ? /* @__PURE__ */ r(
85
+ })(), () => e.abort();
86
+ }, [t, a, p]), C ? /* @__PURE__ */ r("div", { className: "rfp-flex rfp-items-center rfp-justify-center rfp-w-full rfp-h-full", children: /* @__PURE__ */ r("div", { className: "rfp-w-12 rfp-h-12 rfp-border-4 rfp-border-line-strong rfp-border-t-spinner-head rfp-rounded-full rfp-animate-spin" }) }) : h ? /* @__PURE__ */ r(B, { message: h }) : f === "source" ? /* @__PURE__ */ r("div", { className: "rfp-w-full rfp-h-full rfp-overflow-auto rfp-bg-code-bg", children: x ? /* @__PURE__ */ r(
85
87
  "div",
86
88
  {
87
89
  className: "rfp-shiki-wrapper with-line-numbers",
88
90
  dangerouslySetInnerHTML: { __html: x }
89
91
  }
90
- ) : /* @__PURE__ */ r("pre", { className: "rfp-p-6 rfp-text-fg-primary rfp-font-mono rfp-text-sm rfp-whitespace-pre-wrap rfp-break-words", children: s }) }) : /* @__PURE__ */ r("div", { className: "rfp-w-full rfp-h-full rfp-overflow-auto rfp-p-6 md:rfp-p-10", children: /* @__PURE__ */ r("div", { className: "rfp-max-w-full md:rfp-max-w-4xl rfp-mx-auto", children: /* @__PURE__ */ r(
91
- H,
92
+ ) : /* @__PURE__ */ r("pre", { className: "rfp-p-6 rfp-text-fg-primary rfp-font-mono rfp-text-sm rfp-whitespace-pre-wrap rfp-break-words", children: n }) }) : /* @__PURE__ */ r("div", { className: "rfp-w-full rfp-h-full rfp-overflow-auto rfp-p-6 md:rfp-p-10", children: /* @__PURE__ */ r("div", { className: "rfp-max-w-full md:rfp-max-w-4xl rfp-mx-auto", children: /* @__PURE__ */ r(
93
+ z,
92
94
  {
93
- remarkPlugins: [M, j],
94
- rehypePlugins: [F, T],
95
+ remarkPlugins: [H, M],
96
+ rehypePlugins: [R, I],
95
97
  components: {
96
- code({ node: e, inline: o, className: n, children: i, ...S }) {
97
- const b = /language-(\w+)/.exec(n || ""), g = String(i).replace(/\n$/, "");
98
- return !o && b ? /* @__PURE__ */ r(R, { code: g, lang: b[1] }) : o ? /* @__PURE__ */ r(
98
+ code({ node: e, inline: s, className: o, children: i, ...S }) {
99
+ const d = /language-(\w+)/.exec(o || ""), c = String(i).replace(/\n$/, "");
100
+ return s ?? (!d && !c.includes(`
101
+ `)) ? /* @__PURE__ */ r(
99
102
  "code",
100
103
  {
101
104
  className: "rfp-bg-surface-2 rfp-px-1.5 rfp-py-0.5 rfp-rounded rfp-text-sm rfp-font-mono rfp-text-fg-primary rfp-border rfp-border-line-weak",
102
105
  ...S,
103
106
  children: i
104
107
  }
105
- ) : /* @__PURE__ */ d("div", { className: "rfp-relative rfp-group rfp-my-4", children: [
106
- /* @__PURE__ */ r(L, { text: g }),
108
+ ) : d ? /* @__PURE__ */ r(A, { code: c, lang: d[1] }) : /* @__PURE__ */ m("div", { className: "rfp-relative rfp-group rfp-my-4", children: [
109
+ /* @__PURE__ */ r(q, { text: c }),
107
110
  /* @__PURE__ */ r(
108
111
  "pre",
109
112
  {
@@ -119,14 +122,14 @@ const v = (t) => {
119
122
  h3: ({ children: e }) => /* @__PURE__ */ r("h3", { className: "rfp-text-xl rfp-font-semibold rfp-mb-2 rfp-mt-6 rfp-text-fg-primary", children: e }),
120
123
  h4: ({ children: e }) => /* @__PURE__ */ r("h4", { className: "rfp-text-lg rfp-font-semibold rfp-mb-2 rfp-mt-4 rfp-text-fg-primary", children: e }),
121
124
  p: ({ children: e }) => /* @__PURE__ */ r("p", { className: "rfp-text-fg-secondary rfp-mb-4 rfp-leading-7 rfp-text-base", children: e }),
122
- a: ({ href: e, children: o }) => /* @__PURE__ */ r(
125
+ a: ({ href: e, children: s }) => /* @__PURE__ */ r(
123
126
  "a",
124
127
  {
125
128
  href: e,
126
129
  className: "rfp-text-indigo-400 hover:rfp-text-indigo-300 rfp-underline rfp-decoration-indigo-600 hover:rfp-decoration-indigo-400",
127
130
  target: "_blank",
128
131
  rel: "noopener noreferrer",
129
- children: o
132
+ children: s
130
133
  }
131
134
  ),
132
135
  ul: ({ children: e }) => /* @__PURE__ */ r("ul", { className: "rfp-list-disc rfp-pl-6 rfp-mb-4 rfp-text-fg-secondary rfp-space-y-1", children: e }),
@@ -140,33 +143,33 @@ const v = (t) => {
140
143
  th: ({ children: e }) => /* @__PURE__ */ r("th", { className: "rfp-px-4 rfp-py-3 rfp-text-left rfp-text-xs rfp-font-semibold rfp-text-fg-tertiary rfp-uppercase rfp-tracking-wider", children: e }),
141
144
  td: ({ children: e }) => /* @__PURE__ */ r("td", { className: "rfp-px-4 rfp-py-3 rfp-text-sm rfp-text-fg-secondary", children: e }),
142
145
  hr: () => /* @__PURE__ */ r("hr", { className: "rfp-border-line rfp-my-6" }),
143
- img: ({ src: e, alt: o }) => /* @__PURE__ */ r(
146
+ img: ({ src: e, alt: s }) => /* @__PURE__ */ r(
144
147
  "img",
145
148
  {
146
149
  src: e,
147
- alt: o,
150
+ alt: s,
148
151
  className: "rfp-rounded-md rfp-max-w-full rfp-h-auto rfp-my-4 rfp-mx-auto rfp-block rfp-shadow-sm"
149
152
  }
150
153
  ),
151
- input: ({ type: e, checked: o, ...n }) => e === "checkbox" ? /* @__PURE__ */ r(
154
+ input: ({ type: e, checked: s, ...o }) => e === "checkbox" ? /* @__PURE__ */ r(
152
155
  "input",
153
156
  {
154
157
  type: "checkbox",
155
- checked: o,
158
+ checked: s,
156
159
  readOnly: !0,
157
160
  className: "rfp-mr-2 rfp-rounded rfp-border-line",
158
- ...n
161
+ ...o
159
162
  }
160
- ) : /* @__PURE__ */ r("input", { type: e, ...n }),
163
+ ) : /* @__PURE__ */ r("input", { type: e, ...o }),
161
164
  strong: ({ children: e }) => /* @__PURE__ */ r("strong", { className: "rfp-font-semibold rfp-text-fg-primary", children: e }),
162
165
  em: ({ children: e }) => /* @__PURE__ */ r("em", { className: "rfp-italic", children: e }),
163
166
  del: ({ children: e }) => /* @__PURE__ */ r("del", { className: "rfp-text-fg-muted rfp-line-through", children: e })
164
167
  },
165
- children: s
168
+ children: n
166
169
  }
167
170
  ) }) });
168
171
  };
169
172
  export {
170
- V as MarkdownRenderer
173
+ X as MarkdownRenderer
171
174
  };
172
- //# sourceMappingURL=index-CwmZQ-JO.mjs.map
175
+ //# sourceMappingURL=index-DrgP7cc7.mjs.map