@l1yp/file-viewer 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 (373) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +134 -0
  3. package/dist/FileViewer.js +7 -0
  4. package/dist/FileViewer.vue.d.ts +37 -0
  5. package/dist/FileViewer.vue_vue_type_script_setup_true_lang.js +103 -0
  6. package/dist/_virtual/_plugin-vue_export-helper.js +8 -0
  7. package/dist/components/AppxViewer.js +7 -0
  8. package/dist/components/AppxViewer.vue.d.ts +18 -0
  9. package/dist/components/AppxViewer.vue_vue_type_script_setup_true_lang.js +174 -0
  10. package/dist/components/ArchiveBrowser.js +7 -0
  11. package/dist/components/ArchiveBrowser.vue.d.ts +18 -0
  12. package/dist/components/ArchiveBrowser.vue_vue_type_script_setup_true_lang.js +279 -0
  13. package/dist/components/AudioViewer.js +7 -0
  14. package/dist/components/AudioViewer.vue.d.ts +21 -0
  15. package/dist/components/AudioViewer.vue_vue_type_script_setup_true_lang.js +201 -0
  16. package/dist/components/BinObjBrowser.js +7 -0
  17. package/dist/components/BinObjBrowser.vue.d.ts +19 -0
  18. package/dist/components/BinObjBrowser.vue_vue_type_script_setup_true_lang.js +141 -0
  19. package/dist/components/CertViewer.js +7 -0
  20. package/dist/components/CertViewer.vue.d.ts +17 -0
  21. package/dist/components/CertViewer.vue_vue_type_script_setup_true_lang.js +251 -0
  22. package/dist/components/ClassViewer.js +7 -0
  23. package/dist/components/ClassViewer.vue.d.ts +15 -0
  24. package/dist/components/ClassViewer.vue_vue_type_script_setup_true_lang.js +164 -0
  25. package/dist/components/CodeBlock.js +7 -0
  26. package/dist/components/CodeBlock.vue.d.ts +17 -0
  27. package/dist/components/CodeBlock.vue_vue_type_script_setup_true_lang.js +79 -0
  28. package/dist/components/CodeView.js +7 -0
  29. package/dist/components/CodeView.vue.d.ts +21 -0
  30. package/dist/components/CodeView.vue_vue_type_script_setup_true_lang.js +180 -0
  31. package/dist/components/CsvViewer.js +7 -0
  32. package/dist/components/CsvViewer.vue.d.ts +26 -0
  33. package/dist/components/CsvViewer.vue_vue_type_script_setup_true_lang.js +187 -0
  34. package/dist/components/DicomViewer.js +7 -0
  35. package/dist/components/DicomViewer.vue.d.ts +30 -0
  36. package/dist/components/DicomViewer.vue_vue_type_script_setup_true_lang.js +362 -0
  37. package/dist/components/DocxViewer.js +7 -0
  38. package/dist/components/DocxViewer.vue.d.ts +19 -0
  39. package/dist/components/DocxViewer.vue_vue_type_script_setup_true_lang.js +59 -0
  40. package/dist/components/DrawioViewer.js +7 -0
  41. package/dist/components/DrawioViewer.vue.d.ts +16 -0
  42. package/dist/components/DrawioViewer.vue_vue_type_script_setup_true_lang.js +38 -0
  43. package/dist/components/DxfViewer.js +7 -0
  44. package/dist/components/DxfViewer.vue.d.ts +14 -0
  45. package/dist/components/DxfViewer.vue_vue_type_script_setup_true_lang.js +239 -0
  46. package/dist/components/EbookViewer.js +7 -0
  47. package/dist/components/EbookViewer.vue.d.ts +22 -0
  48. package/dist/components/EbookViewer.vue_vue_type_script_setup_true_lang.js +170 -0
  49. package/dist/components/EmlViewer.js +7 -0
  50. package/dist/components/EmlViewer.vue.d.ts +21 -0
  51. package/dist/components/EmlViewer.vue_vue_type_script_setup_true_lang.js +193 -0
  52. package/dist/components/EplViewer.js +7 -0
  53. package/dist/components/EplViewer.vue.d.ts +19 -0
  54. package/dist/components/EplViewer.vue_vue_type_script_setup_true_lang.js +201 -0
  55. package/dist/components/FileViewerBody.js +7 -0
  56. package/dist/components/FileViewerBody.vue.d.ts +47 -0
  57. package/dist/components/FileViewerBody.vue_vue_type_script_setup_true_lang.js +599 -0
  58. package/dist/components/FileViewerPanel.js +7 -0
  59. package/dist/components/FileViewerPanel.vue.d.ts +3 -0
  60. package/dist/components/FileViewerPanel.vue_vue_type_script_setup_true_lang.js +207 -0
  61. package/dist/components/FontViewer.js +7 -0
  62. package/dist/components/FontViewer.vue.d.ts +17 -0
  63. package/dist/components/FontViewer.vue_vue_type_script_setup_true_lang.js +120 -0
  64. package/dist/components/FrontmatterCard.js +7 -0
  65. package/dist/components/FrontmatterCard.vue.d.ts +11 -0
  66. package/dist/components/FrontmatterCard.vue_vue_type_script_setup_true_lang.js +30 -0
  67. package/dist/components/GeoViewer.js +7 -0
  68. package/dist/components/GeoViewer.vue.d.ts +17 -0
  69. package/dist/components/GeoViewer.vue_vue_type_script_setup_true_lang.js +255 -0
  70. package/dist/components/HarViewer.js +7 -0
  71. package/dist/components/HarViewer.vue.d.ts +20 -0
  72. package/dist/components/HarViewer.vue_vue_type_script_setup_true_lang.js +322 -0
  73. package/dist/components/HexViewer.js +7 -0
  74. package/dist/components/HexViewer.vue.d.ts +22 -0
  75. package/dist/components/HexViewer.vue_vue_type_script_setup_true_lang.js +121 -0
  76. package/dist/components/HprofViewer.js +7 -0
  77. package/dist/components/HprofViewer.vue.d.ts +27 -0
  78. package/dist/components/HprofViewer.vue_vue_type_script_setup_true_lang.js +561 -0
  79. package/dist/components/ImageLightbox.js +7 -0
  80. package/dist/components/ImageLightbox.vue.d.ts +3 -0
  81. package/dist/components/ImageLightbox.vue_vue_type_script_setup_true_lang.js +86 -0
  82. package/dist/components/InlineText.d.ts +29 -0
  83. package/dist/components/InlineText.js +21 -0
  84. package/dist/components/JksViewer.js +7 -0
  85. package/dist/components/JksViewer.vue.d.ts +22 -0
  86. package/dist/components/JksViewer.vue_vue_type_script_setup_true_lang.js +353 -0
  87. package/dist/components/JsonlViewer.js +7 -0
  88. package/dist/components/JsonlViewer.vue.d.ts +15 -0
  89. package/dist/components/JsonlViewer.vue_vue_type_script_setup_true_lang.js +103 -0
  90. package/dist/components/LogViewer.js +7 -0
  91. package/dist/components/LogViewer.vue.d.ts +29 -0
  92. package/dist/components/LogViewer.vue_vue_type_script_setup_true_lang.js +670 -0
  93. package/dist/components/LrcViewer.js +7 -0
  94. package/dist/components/LrcViewer.vue.d.ts +17 -0
  95. package/dist/components/LrcViewer.vue_vue_type_script_setup_true_lang.js +106 -0
  96. package/dist/components/MarkdownTable.js +7 -0
  97. package/dist/components/MarkdownTable.vue.d.ts +19 -0
  98. package/dist/components/MarkdownTable.vue_vue_type_script_setup_true_lang.js +71 -0
  99. package/dist/components/MarkdownText.d.ts +30 -0
  100. package/dist/components/MarkdownText.js +21 -0
  101. package/dist/components/MhtViewer.js +7 -0
  102. package/dist/components/MhtViewer.vue.d.ts +22 -0
  103. package/dist/components/MhtViewer.vue_vue_type_script_setup_true_lang.js +112 -0
  104. package/dist/components/MindMapView.js +7 -0
  105. package/dist/components/MindMapView.vue.d.ts +23 -0
  106. package/dist/components/MindMapView.vue_vue_type_script_setup_true_lang.js +337 -0
  107. package/dist/components/MissingDependency.js +7 -0
  108. package/dist/components/MissingDependency.vue.d.ts +17 -0
  109. package/dist/components/MissingDependency.vue_vue_type_script_setup_true_lang.js +37 -0
  110. package/dist/components/ModelViewer.js +7 -0
  111. package/dist/components/ModelViewer.vue.d.ts +18 -0
  112. package/dist/components/ModelViewer.vue_vue_type_script_setup_true_lang.js +157 -0
  113. package/dist/components/MsiViewer.js +7 -0
  114. package/dist/components/MsiViewer.vue.d.ts +19 -0
  115. package/dist/components/MsiViewer.vue_vue_type_script_setup_true_lang.js +136 -0
  116. package/dist/components/NotebookViewer.js +7 -0
  117. package/dist/components/NotebookViewer.vue.d.ts +20 -0
  118. package/dist/components/NotebookViewer.vue_vue_type_script_setup_true_lang.js +125 -0
  119. package/dist/components/PdfViewer.js +7 -0
  120. package/dist/components/PdfViewer.vue.d.ts +19 -0
  121. package/dist/components/PdfViewer.vue_vue_type_script_setup_true_lang.js +114 -0
  122. package/dist/components/PptxViewer.js +7 -0
  123. package/dist/components/PptxViewer.vue.d.ts +20 -0
  124. package/dist/components/PptxViewer.vue_vue_type_script_setup_true_lang.js +73 -0
  125. package/dist/components/PsdViewer.js +7 -0
  126. package/dist/components/PsdViewer.vue.d.ts +15 -0
  127. package/dist/components/PsdViewer.vue_vue_type_script_setup_true_lang.js +218 -0
  128. package/dist/components/QmcAudioViewer.js +7 -0
  129. package/dist/components/QmcAudioViewer.vue.d.ts +18 -0
  130. package/dist/components/QmcAudioViewer.vue_vue_type_script_setup_true_lang.js +92 -0
  131. package/dist/components/RasterViewer.js +7 -0
  132. package/dist/components/RasterViewer.vue.d.ts +21 -0
  133. package/dist/components/RasterViewer.vue_vue_type_script_setup_true_lang.js +161 -0
  134. package/dist/components/RtfViewer.js +7 -0
  135. package/dist/components/RtfViewer.vue.d.ts +21 -0
  136. package/dist/components/RtfViewer.vue_vue_type_script_setup_true_lang.js +66 -0
  137. package/dist/components/SevenZipBrowser.js +7 -0
  138. package/dist/components/SevenZipBrowser.vue.d.ts +13 -0
  139. package/dist/components/SevenZipBrowser.vue_vue_type_script_setup_true_lang.js +366 -0
  140. package/dist/components/SqliteViewer.js +7 -0
  141. package/dist/components/SqliteViewer.vue.d.ts +18 -0
  142. package/dist/components/SqliteViewer.vue_vue_type_script_setup_true_lang.js +186 -0
  143. package/dist/components/SubtitleViewer.js +7 -0
  144. package/dist/components/SubtitleViewer.vue.d.ts +15 -0
  145. package/dist/components/SubtitleViewer.vue_vue_type_script_setup_true_lang.js +48 -0
  146. package/dist/components/XlsxChart.js +7 -0
  147. package/dist/components/XlsxChart.vue.d.ts +14 -0
  148. package/dist/components/XlsxChart.vue_vue_type_script_setup_true_lang.js +240 -0
  149. package/dist/components/XlsxViewer.js +7 -0
  150. package/dist/components/XlsxViewer.vue.d.ts +22 -0
  151. package/dist/components/XlsxViewer.vue_vue_type_script_setup_true_lang.js +814 -0
  152. package/dist/components/XmindViewer.js +7 -0
  153. package/dist/components/XmindViewer.vue.d.ts +13 -0
  154. package/dist/components/XmindViewer.vue_vue_type_script_setup_true_lang.js +48 -0
  155. package/dist/components/ZipBrowser.js +7 -0
  156. package/dist/components/ZipBrowser.vue.d.ts +14 -0
  157. package/dist/components/ZipBrowser.vue_vue_type_script_setup_true_lang.js +326 -0
  158. package/dist/components/ZoomImage.js +7 -0
  159. package/dist/components/ZoomImage.vue.d.ts +29 -0
  160. package/dist/components/ZoomImage.vue_vue_type_script_setup_true_lang.js +147 -0
  161. package/dist/components/epl/EplCodeBlock.js +7 -0
  162. package/dist/components/epl/EplCodeBlock.vue.d.ts +15 -0
  163. package/dist/components/epl/EplCodeBlock.vue_vue_type_script_setup_true_lang.js +72 -0
  164. package/dist/components/epl/EplDoc.js +7 -0
  165. package/dist/components/epl/EplDoc.vue.d.ts +19 -0
  166. package/dist/components/epl/EplDoc.vue_vue_type_script_setup_true_lang.js +327 -0
  167. package/dist/components/epl/EplMethod.js +7 -0
  168. package/dist/components/epl/EplMethod.vue.d.ts +14 -0
  169. package/dist/components/epl/EplMethod.vue_vue_type_script_setup_true_lang.js +100 -0
  170. package/dist/components/epl/EplResource.js +7 -0
  171. package/dist/components/epl/EplResource.vue.d.ts +15 -0
  172. package/dist/components/epl/EplResource.vue_vue_type_script_setup_true_lang.js +204 -0
  173. package/dist/components/epl/EplTree.js +7 -0
  174. package/dist/components/epl/EplTree.vue.d.ts +27 -0
  175. package/dist/components/epl/EplTree.vue_vue_type_script_setup_true_lang.js +123 -0
  176. package/dist/components/epl/EplVarTable.js +7 -0
  177. package/dist/components/epl/EplVarTable.vue.d.ts +21 -0
  178. package/dist/components/epl/EplVarTable.vue_vue_type_script_setup_true_lang.js +60 -0
  179. package/dist/components/epl/docTypes.d.ts +12 -0
  180. package/dist/components/epl/numbering.d.ts +21 -0
  181. package/dist/components/epl/numbering.js +14 -0
  182. package/dist/components/icons/Icon.js +7 -0
  183. package/dist/components/icons/Icon.vue.d.ts +14 -0
  184. package/dist/components/icons/Icon.vue_vue_type_script_setup_true_lang.js +33 -0
  185. package/dist/components/icons/iconPaths.d.ts +60 -0
  186. package/dist/components/icons/iconPaths.js +54 -0
  187. package/dist/components/optionalViewer.d.ts +14 -0
  188. package/dist/components/optionalViewer.js +37 -0
  189. package/dist/components/ui/ClampBlock.d.ts +82 -0
  190. package/dist/components/ui/ClampBlock.js +63 -0
  191. package/dist/composables/useFileViewer.d.ts +428 -0
  192. package/dist/composables/useFileViewer.js +27 -0
  193. package/dist/composables/useLightbox.d.ts +33 -0
  194. package/dist/composables/useLightbox.js +17 -0
  195. package/dist/composables/useLogRules.d.ts +47 -0
  196. package/dist/composables/useLogRules.js +74 -0
  197. package/dist/index.d.ts +44 -0
  198. package/dist/index.js +30 -0
  199. package/dist/lib/aes.d.ts +25 -0
  200. package/dist/lib/aes.js +99 -0
  201. package/dist/lib/appx.d.ts +66 -0
  202. package/dist/lib/appx.js +112 -0
  203. package/dist/lib/archive.d.ts +29 -0
  204. package/dist/lib/asn1.d.ts +47 -0
  205. package/dist/lib/asn1.js +122 -0
  206. package/dist/lib/binobj.d.ts +69 -0
  207. package/dist/lib/binobj.js +430 -0
  208. package/dist/lib/brotli.d.ts +14 -0
  209. package/dist/lib/brotli.js +16 -0
  210. package/dist/lib/bzip2.d.ts +14 -0
  211. package/dist/lib/bzip2.js +161 -0
  212. package/dist/lib/classfile.d.ts +72 -0
  213. package/dist/lib/classfile.js +210 -0
  214. package/dist/lib/codePreview.d.ts +22 -0
  215. package/dist/lib/codePreview.js +27 -0
  216. package/dist/lib/codefold.d.ts +14 -0
  217. package/dist/lib/codefold.js +30 -0
  218. package/dist/lib/codeformat.d.ts +21 -0
  219. package/dist/lib/codeformat.js +130 -0
  220. package/dist/lib/csv.d.ts +19 -0
  221. package/dist/lib/csv.js +74 -0
  222. package/dist/lib/des.d.ts +17 -0
  223. package/dist/lib/des.js +928 -0
  224. package/dist/lib/diagram.d.ts +5 -0
  225. package/dist/lib/diagram.js +479 -0
  226. package/dist/lib/dicom.d.ts +69 -0
  227. package/dist/lib/dicom.js +442 -0
  228. package/dist/lib/dicomCodecs.d.ts +28 -0
  229. package/dist/lib/dicomCodecs.js +156 -0
  230. package/dist/lib/dicomRender.d.ts +46 -0
  231. package/dist/lib/dicomRender.js +114 -0
  232. package/dist/lib/dxf.d.ts +86 -0
  233. package/dist/lib/dxf.js +399 -0
  234. package/dist/lib/eml.d.ts +40 -0
  235. package/dist/lib/eml.js +46 -0
  236. package/dist/lib/encoding.d.ts +28 -0
  237. package/dist/lib/encoding.js +44 -0
  238. package/dist/lib/epl/code/ast.d.ts +150 -0
  239. package/dist/lib/epl/code/codeDataParser.d.ts +3 -0
  240. package/dist/lib/epl/code/codeDataParser.js +330 -0
  241. package/dist/lib/epl/code/codeLines.d.ts +20 -0
  242. package/dist/lib/epl/code/codeLines.js +191 -0
  243. package/dist/lib/epl/code/structures.d.ts +86 -0
  244. package/dist/lib/epl/code/textCode.d.ts +29 -0
  245. package/dist/lib/epl/code/textCode.js +150 -0
  246. package/dist/lib/epl/code/variable.d.ts +25 -0
  247. package/dist/lib/epl/eplDocument.d.ts +21 -0
  248. package/dist/lib/epl/eplDocument.js +36 -0
  249. package/dist/lib/epl/imageList.d.ts +28 -0
  250. package/dist/lib/epl/imageList.js +66 -0
  251. package/dist/lib/epl/index.d.ts +53 -0
  252. package/dist/lib/epl/index.js +45 -0
  253. package/dist/lib/epl/io/binaryReader.d.ts +56 -0
  254. package/dist/lib/epl/io/binaryReader.js +119 -0
  255. package/dist/lib/epl/io/encoding.d.ts +16 -0
  256. package/dist/lib/epl/io/encoding.js +27 -0
  257. package/dist/lib/epl/model/eplSystemId.d.ts +64 -0
  258. package/dist/lib/epl/model/eplSystemId.js +16 -0
  259. package/dist/lib/epl/model/section.d.ts +46 -0
  260. package/dist/lib/epl/names/eplLibData.js +39 -0
  261. package/dist/lib/epl/names/idToNameMap.d.ts +33 -0
  262. package/dist/lib/epl/names/idToNameMap.js +130 -0
  263. package/dist/lib/epl/names/libNameProvider.d.ts +15 -0
  264. package/dist/lib/epl/names/libNameProvider.js +18 -0
  265. package/dist/lib/epl/program.d.ts +120 -0
  266. package/dist/lib/epl/program.js +134 -0
  267. package/dist/lib/epl/projectFileReader.d.ts +23 -0
  268. package/dist/lib/epl/projectFileReader.js +65 -0
  269. package/dist/lib/epl/sections/code.d.ts +20 -0
  270. package/dist/lib/epl/sections/esystemInfo.d.ts +14 -0
  271. package/dist/lib/epl/sections/losable.d.ts +11 -0
  272. package/dist/lib/epl/sections/projectConfig.d.ts +23 -0
  273. package/dist/lib/epl/sections/resource.d.ts +57 -0
  274. package/dist/lib/fb2.d.ts +14 -0
  275. package/dist/lib/fb2.js +62 -0
  276. package/dist/lib/fileType.d.ts +315 -0
  277. package/dist/lib/fileType.js +800 -0
  278. package/dist/lib/fonts.d.ts +8 -0
  279. package/dist/lib/fonts.js +4 -0
  280. package/dist/lib/format.d.ts +16 -0
  281. package/dist/lib/format.js +38 -0
  282. package/dist/lib/frontmatter.d.ts +13 -0
  283. package/dist/lib/frontmatter.js +23 -0
  284. package/dist/lib/geo.d.ts +30 -0
  285. package/dist/lib/geo.js +235 -0
  286. package/dist/lib/har.d.ts +171 -0
  287. package/dist/lib/har.js +397 -0
  288. package/dist/lib/highlight.d.ts +18 -0
  289. package/dist/lib/highlight.js +34 -0
  290. package/dist/lib/highlightLangs.d.ts +15 -0
  291. package/dist/lib/highlightLangs.js +93 -0
  292. package/dist/lib/hprof.d.ts +211 -0
  293. package/dist/lib/hprof.js +709 -0
  294. package/dist/lib/ipynb.d.ts +48 -0
  295. package/dist/lib/ipynb.js +130 -0
  296. package/dist/lib/jks.d.ts +86 -0
  297. package/dist/lib/jks.js +167 -0
  298. package/dist/lib/jsonl.d.ts +29 -0
  299. package/dist/lib/jsonl.js +24 -0
  300. package/dist/lib/lrc.d.ts +32 -0
  301. package/dist/lib/lrc.js +84 -0
  302. package/dist/lib/lzma.d.ts +70 -0
  303. package/dist/lib/lzma.js +204 -0
  304. package/dist/lib/markdown/blocks.d.ts +9 -0
  305. package/dist/lib/markdown/blocks.js +221 -0
  306. package/dist/lib/markdown/index.d.ts +3 -0
  307. package/dist/lib/markdown/inline.d.ts +33 -0
  308. package/dist/lib/markdown/inline.js +84 -0
  309. package/dist/lib/markdown/math.d.ts +5 -0
  310. package/dist/lib/markdown/math.js +25 -0
  311. package/dist/lib/markdown/segmentize.d.ts +11 -0
  312. package/dist/lib/markdown/segmentize.js +28 -0
  313. package/dist/lib/markdown/styles.d.ts +26 -0
  314. package/dist/lib/markdown/styles.js +135 -0
  315. package/dist/lib/mht.d.ts +51 -0
  316. package/dist/lib/mht.js +122 -0
  317. package/dist/lib/midi.d.ts +28 -0
  318. package/dist/lib/midi.js +84 -0
  319. package/dist/lib/mime.d.ts +82 -0
  320. package/dist/lib/mime.js +151 -0
  321. package/dist/lib/mindmap.d.ts +51 -0
  322. package/dist/lib/mindmap.js +113 -0
  323. package/dist/lib/mobi.d.ts +15 -0
  324. package/dist/lib/mobi.js +68 -0
  325. package/dist/lib/msi.d.ts +50 -0
  326. package/dist/lib/msi.js +332 -0
  327. package/dist/lib/optionalDep.d.ts +26 -0
  328. package/dist/lib/optionalDep.js +20 -0
  329. package/dist/lib/pkcs12.d.ts +56 -0
  330. package/dist/lib/pkcs12.js +356 -0
  331. package/dist/lib/qmc.d.ts +50 -0
  332. package/dist/lib/qmc.js +213 -0
  333. package/dist/lib/rar.d.ts +16 -0
  334. package/dist/lib/rar.js +40 -0
  335. package/dist/lib/rawPreview.d.ts +12 -0
  336. package/dist/lib/rawPreview.js +54 -0
  337. package/dist/lib/rc2.d.ts +12 -0
  338. package/dist/lib/rc2.js +298 -0
  339. package/dist/lib/resolveInput.d.ts +22 -0
  340. package/dist/lib/resolveInput.js +55 -0
  341. package/dist/lib/rtf.d.ts +53 -0
  342. package/dist/lib/rtf.js +413 -0
  343. package/dist/lib/sevenZip.d.ts +82 -0
  344. package/dist/lib/sevenZip.js +395 -0
  345. package/dist/lib/sha1.d.ts +24 -0
  346. package/dist/lib/sha1.js +53 -0
  347. package/dist/lib/sha256.d.ts +21 -0
  348. package/dist/lib/sha256.js +119 -0
  349. package/dist/lib/speechAudio.d.ts +36 -0
  350. package/dist/lib/speechAudio.js +85 -0
  351. package/dist/lib/sqlite.d.ts +38 -0
  352. package/dist/lib/sqlite.js +104 -0
  353. package/dist/lib/subtitle.d.ts +26 -0
  354. package/dist/lib/subtitle.js +99 -0
  355. package/dist/lib/tarball.d.ts +20 -0
  356. package/dist/lib/tarball.js +248 -0
  357. package/dist/lib/viewerFormats.d.ts +35 -0
  358. package/dist/lib/viewerFormats.js +83 -0
  359. package/dist/lib/viewerKind.d.ts +36 -0
  360. package/dist/lib/viewerKind.js +233 -0
  361. package/dist/lib/x509.d.ts +68 -0
  362. package/dist/lib/x509.js +267 -0
  363. package/dist/lib/xlsx.d.ts +55 -0
  364. package/dist/lib/xlsx.js +321 -0
  365. package/dist/lib/xlsxCharts.d.ts +34 -0
  366. package/dist/lib/xlsxCharts.js +152 -0
  367. package/dist/lib/xmind.d.ts +6 -0
  368. package/dist/lib/xmind.js +124 -0
  369. package/dist/lib/zip.d.ts +56 -0
  370. package/dist/lib/zip.js +169 -0
  371. package/dist/style.css +2 -0
  372. package/dist/types.d.ts +42 -0
  373. package/package.json +128 -0
@@ -0,0 +1,239 @@
1
+ import { parseDxf as e } from "../lib/dxf.js";
2
+ import { Fragment as t, computed as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, defineComponent as o, normalizeClass as s, normalizeStyle as c, openBlock as l, reactive as u, ref as d, renderList as f, toDisplayString as p, vShow as m, watch as h, withDirectives as g, withModifiers as _ } from "vue";
3
+ //#region src/components/DxfViewer.vue?vue&type=script&setup=true&lang.ts
4
+ var ee = { class: "dxf" }, v = {
5
+ key: 0,
6
+ class: "dxf__msg"
7
+ }, y = {
8
+ key: 1,
9
+ class: "dxf__msg dxf__msg--error"
10
+ }, b = { class: "dxf__bar" }, x = { class: "dxf__dim" }, S = { class: "dxf__stage" }, C = ["viewBox"], te = { transform: "matrix(1 0 0 -1 0 0)" }, ne = [
11
+ "x1",
12
+ "y1",
13
+ "x2",
14
+ "y2",
15
+ "stroke"
16
+ ], re = ["points", "stroke"], ie = ["points", "stroke"], w = [
17
+ "cx",
18
+ "cy",
19
+ "r",
20
+ "stroke"
21
+ ], T = ["d", "stroke"], E = [
22
+ "points",
23
+ "fill",
24
+ "stroke"
25
+ ], D = [
26
+ "cx",
27
+ "cy",
28
+ "r",
29
+ "fill"
30
+ ], O = ["transform"], k = [
31
+ "font-size",
32
+ "fill",
33
+ "text-anchor"
34
+ ], A = ["dy"], j = {
35
+ key: 0,
36
+ class: "dxf__layers"
37
+ }, M = ["onClick"], N = { class: "dxf__lname" }, P = { class: "dxf__eye" }, F = /*@__PURE__*/ o({
38
+ __name: "DxfViewer",
39
+ props: {
40
+ url: {},
41
+ name: {},
42
+ size: {}
43
+ },
44
+ setup(o) {
45
+ let F = o, I = d("loading"), L = d(""), R = d(null), z = u(/* @__PURE__ */ new Set());
46
+ async function B() {
47
+ if (F.url) {
48
+ I.value = "loading", L.value = "", R.value = null, z.clear();
49
+ try {
50
+ let t = await fetch(F.url);
51
+ if (!t.ok) throw Error(`HTTP ${t.status}`);
52
+ let n = await t.arrayBuffer();
53
+ if (new TextDecoder("latin1").decode(new Uint8Array(n.slice(0, 22))).startsWith("AutoCAD Binary DXF")) throw Error("暂不支持二进制 DXF(请用 ASCII DXF)");
54
+ let r = e(new TextDecoder("utf-8").decode(n));
55
+ if (!r.prims.length || !r.bounds) throw Error("未解析到可绘制的图元");
56
+ R.value = r, I.value = "ready", U();
57
+ } catch (e) {
58
+ L.value = e instanceof Error ? e.message : String(e), I.value = "error";
59
+ }
60
+ }
61
+ }
62
+ let V = n(() => {
63
+ let e = /* @__PURE__ */ new Map();
64
+ for (let t of R.value?.prims ?? []) {
65
+ let n = e.get(t.layer);
66
+ n ? n.push(t) : e.set(t.layer, [t]);
67
+ }
68
+ return e;
69
+ }), H = d({
70
+ x: 0,
71
+ y: 0,
72
+ w: 1,
73
+ h: 1
74
+ });
75
+ function U() {
76
+ let e = R.value?.bounds;
77
+ if (!e) return;
78
+ let t = e.maxX - e.minX, n = e.maxY - e.minY;
79
+ t > 0 || (t = 1), n > 0 || (n = 1);
80
+ let r = Math.max(t, n) * .05;
81
+ H.value = {
82
+ x: e.minX - r,
83
+ y: -e.maxY - r,
84
+ w: t + 2 * r,
85
+ h: n + 2 * r
86
+ };
87
+ }
88
+ let W = n(() => `${H.value.x} ${H.value.y} ${H.value.w} ${H.value.h}`);
89
+ function G(e) {
90
+ let t = e.deltaY > 0 ? 1.15 : 1 / 1.15, n = H.value.x + H.value.w / 2, r = H.value.y + H.value.h / 2, i = H.value.w * t, a = H.value.h * t;
91
+ H.value = {
92
+ x: n - i / 2,
93
+ y: r - a / 2,
94
+ w: i,
95
+ h: a
96
+ };
97
+ }
98
+ let K = !1, q = 0, J = 0, Y = null;
99
+ function ae(e) {
100
+ K = !0, q = e.clientX, J = e.clientY, Y = e.currentTarget, Y.setPointerCapture(e.pointerId);
101
+ }
102
+ function oe(e) {
103
+ if (!K || !Y) return;
104
+ let t = Y.getBoundingClientRect(), n = (e.clientX - q) * H.value.w / t.width, r = (e.clientY - J) * H.value.h / t.height;
105
+ H.value = {
106
+ ...H.value,
107
+ x: H.value.x - n,
108
+ y: H.value.y - r
109
+ }, q = e.clientX, J = e.clientY;
110
+ }
111
+ function X(e) {
112
+ K = !1;
113
+ try {
114
+ Y?.releasePointerCapture(e.pointerId);
115
+ } catch {}
116
+ }
117
+ function se(e) {
118
+ z.has(e) ? z.delete(e) : z.add(e);
119
+ }
120
+ let Z = (e) => Math.round(e * 1e3) / 1e3;
121
+ function Q(e) {
122
+ return e.map((e) => `${Z(e[0])},${Z(e[1])}`).join(" ");
123
+ }
124
+ function ce(e, t, n, r, i) {
125
+ let a = i - r;
126
+ for (; a <= 0;) a += 360;
127
+ for (; a > 360;) a -= 360;
128
+ let o = Math.max(2, Math.min(180, Math.ceil(a / 360 * 96))), s = "";
129
+ for (let i = 0; i <= o; i++) {
130
+ let c = (r + a * i / o) * Math.PI / 180;
131
+ s += `${i ? "L" : "M"} ${Z(e + n * Math.cos(c))} ${Z(t + n * Math.sin(c))} `;
132
+ }
133
+ return s;
134
+ }
135
+ let le = n(() => Math.max(H.value.w, H.value.h) * .004), $ = n(() => {
136
+ let e = R.value;
137
+ return e ? `${Object.values(e.counts).reduce((e, t) => e + t, 0)} 实体 · ${e.layers.length} 图层` : "";
138
+ });
139
+ return h(() => F.url, B, { immediate: !0 }), (e, n) => (l(), i("div", ee, [I.value === "loading" ? (l(), i("p", v, "正在解析 DXF…")) : I.value === "error" ? (l(), i("div", y, [a("p", null, "解析失败:" + p(L.value), 1), a("button", {
140
+ type: "button",
141
+ class: "dxf__btn",
142
+ onClick: B
143
+ }, "重试")])) : R.value ? (l(), i(t, { key: 2 }, [
144
+ a("div", b, [
145
+ n[0] ||= a("span", { class: "dxf__badge" }, "DXF", -1),
146
+ a("span", x, p($.value), 1),
147
+ n[1] ||= a("span", { class: "dxf__spacer" }, null, -1),
148
+ a("button", {
149
+ type: "button",
150
+ class: "dxf__reset",
151
+ onClick: U
152
+ }, "重置视图")
153
+ ]),
154
+ a("div", S, [(l(), i("svg", {
155
+ class: "dxf__svg",
156
+ viewBox: W.value,
157
+ preserveAspectRatio: "xMidYMid meet",
158
+ onWheel: _(G, ["prevent"]),
159
+ onPointerdown: ae,
160
+ onPointermove: oe,
161
+ onPointerup: X,
162
+ onPointercancel: X
163
+ }, [a("g", te, [(l(!0), i(t, null, f(V.value, ([e, n]) => g((l(), i("g", { key: e }, [(l(!0), i(t, null, f(n, (e, n) => (l(), i(t, { key: n }, [e.kind === "line" ? (l(), i("line", {
164
+ key: 0,
165
+ x1: Z(e.x1),
166
+ y1: Z(e.y1),
167
+ x2: Z(e.x2),
168
+ y2: Z(e.y2),
169
+ stroke: e.color,
170
+ "vector-effect": "non-scaling-stroke"
171
+ }, null, 8, ne)) : e.kind === "polyline" && e.closed ? (l(), i("polygon", {
172
+ key: 1,
173
+ points: Q(e.pts),
174
+ fill: "none",
175
+ stroke: e.color,
176
+ "vector-effect": "non-scaling-stroke"
177
+ }, null, 8, re)) : e.kind === "polyline" ? (l(), i("polyline", {
178
+ key: 2,
179
+ points: Q(e.pts),
180
+ fill: "none",
181
+ stroke: e.color,
182
+ "vector-effect": "non-scaling-stroke"
183
+ }, null, 8, ie)) : e.kind === "circle" ? (l(), i("circle", {
184
+ key: 3,
185
+ cx: Z(e.cx),
186
+ cy: Z(e.cy),
187
+ r: Z(e.r),
188
+ fill: "none",
189
+ stroke: e.color,
190
+ "vector-effect": "non-scaling-stroke"
191
+ }, null, 8, w)) : e.kind === "arc" ? (l(), i("path", {
192
+ key: 4,
193
+ d: ce(e.cx, e.cy, e.r, e.a0, e.a1),
194
+ fill: "none",
195
+ stroke: e.color,
196
+ "vector-effect": "non-scaling-stroke"
197
+ }, null, 8, T)) : e.kind === "polygon" ? (l(), i("polygon", {
198
+ key: 5,
199
+ points: Q(e.pts),
200
+ fill: e.color,
201
+ "fill-opacity": "0.5",
202
+ stroke: e.color,
203
+ "vector-effect": "non-scaling-stroke"
204
+ }, null, 8, E)) : e.kind === "point" ? (l(), i("circle", {
205
+ key: 6,
206
+ cx: Z(e.x),
207
+ cy: Z(e.y),
208
+ r: le.value,
209
+ fill: e.color
210
+ }, null, 8, D)) : e.kind === "text" ? (l(), i("g", {
211
+ key: 7,
212
+ transform: `translate(${Z(e.x)},${Z(e.y)}) scale(1,-1) rotate(${Z(-e.rot)})`
213
+ }, [a("text", {
214
+ class: "dxf__text",
215
+ "font-size": Z(e.h),
216
+ fill: e.color,
217
+ "text-anchor": e.align === "c" ? "middle" : e.align === "r" ? "end" : "start"
218
+ }, [(l(!0), i(t, null, f(e.text.split("\n"), (t, n) => (l(), i("tspan", {
219
+ key: n,
220
+ x: "0",
221
+ dy: n === 0 ? 0 : e.h * 1.25
222
+ }, p(t), 9, A))), 128))], 8, k)], 8, O)) : r("", !0)], 64))), 128))])), [[m, !z.has(e)]])), 128))])], 40, C))]),
223
+ R.value.layers.length ? (l(), i("ul", j, [(l(!0), i(t, null, f(R.value.layers, (e) => (l(), i("li", { key: e.name }, [a("button", {
224
+ type: "button",
225
+ class: s(["dxf__layer", { "dxf__layer--off": z.has(e.name) }]),
226
+ onClick: (t) => se(e.name)
227
+ }, [
228
+ a("span", {
229
+ class: "dxf__swatch",
230
+ style: c({ background: e.color })
231
+ }, null, 4),
232
+ a("span", N, p(e.name), 1),
233
+ a("span", P, p(z.has(e.name) ? "隐藏" : "显示"), 1)
234
+ ], 10, M)]))), 128))])) : r("", !0)
235
+ ], 64)) : r("", !0)]));
236
+ }
237
+ });
238
+ //#endregion
239
+ export { F as default };
@@ -0,0 +1,7 @@
1
+ import e from "../_virtual/_plugin-vue_export-helper.js";
2
+ import t from "./EbookViewer.vue_vue_type_script_setup_true_lang.js";
3
+ /* empty css */
4
+ //#region src/components/EbookViewer.vue
5
+ var n = /*#__PURE__*/ e(t, [["__scopeId", "data-v-925b8896"]]);
6
+ //#endregion
7
+ export { n as default };
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Side-viewer e-book reader. By kind:
3
+ * - epub: rendered with epub.js (dynamically imported so its weight only ships for EPUBs) — paginated, with
4
+ * prev/next and a chapter (TOC) jump. Scripts in the book are DISABLED (`allowScriptedContent: false`).
5
+ * - fb2: parsed in-browser (see lib/fb2.ts) into a sandboxed HTML document.
6
+ * - mobi/azw3: BEST EFFORT — extracted in-browser (see lib/mobi.ts: PalmDOC text records) into a sandboxed
7
+ * HTML document; HUFF/CDIC or DRM'd books surface a clear "download to read" message.
8
+ * - djvu: not previewable in-browser (would need a heavy WASM decoder) — shows a download hint.
9
+ *
10
+ * All book HTML (fb2/mobi) renders in a fully sandboxed, script-disabled iframe (CSP injected in the doc),
11
+ * same hardening as the other HTML previews. The epub host stays mounted across loading so epub.js can render
12
+ * into it; status messages sit on top as an overlay.
13
+ */
14
+ type __VLS_Props = {
15
+ url?: string;
16
+ name: string;
17
+ size?: number;
18
+ kind: 'epub' | 'fb2' | 'mobi' | 'djvu';
19
+ };
20
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
21
+ declare const _default: typeof __VLS_export;
22
+ export default _default;
@@ -0,0 +1,170 @@
1
+ import e from "./MissingDependency.js";
2
+ import { formatBytes as t } from "../lib/format.js";
3
+ import n from "./icons/Icon.js";
4
+ import { isMissingModule as r } from "../lib/optionalDep.js";
5
+ import { parseFb2 as i } from "../lib/fb2.js";
6
+ import { parseMobi as a } from "../lib/mobi.js";
7
+ import { Fragment as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createVNode as u, defineComponent as d, onBeforeUnmount as f, onMounted as p, openBlock as m, ref as h, renderList as g, toDisplayString as _, unref as v, vModelSelect as y, watch as b, withDirectives as x } from "vue";
8
+ //#region src/components/EbookViewer.vue?vue&type=script&setup=true&lang.ts
9
+ var S = { class: "ebk" }, C = {
10
+ key: 0,
11
+ class: "ebk__nav"
12
+ }, w = ["value"], T = ["srcdoc"], E = {
13
+ key: 2,
14
+ class: "ebk__msg ebk__unsupported"
15
+ }, D = {
16
+ key: 3,
17
+ class: "ebk__overlay"
18
+ }, O = {
19
+ key: 4,
20
+ class: "ebk__overlay"
21
+ }, k = { class: "ebk__msg ebk__gate" }, A = {
22
+ key: 5,
23
+ class: "ebk__overlay"
24
+ }, j = {
25
+ key: 6,
26
+ class: "ebk__overlay"
27
+ }, M = { class: "ebk__msg ebk__msg--error" }, N = 96 * 1024 * 1024, P = "<meta http-equiv=\"Content-Security-Policy\" content=\"script-src 'none'; object-src 'none'; base-uri 'none'; form-action 'none'\">", F = "body{margin:0;padding:24px 28px 80px;max-width:46rem;margin-inline:auto;font:16px/1.7 Georgia,'Source Serif 4',serif;color:#1a1a1a;background:#fff}img{max-width:100%;height:auto}p{margin:0 0 .9em}", I = /*@__PURE__*/ d({
28
+ __name: "EbookViewer",
29
+ props: {
30
+ url: {},
31
+ name: {},
32
+ size: {},
33
+ kind: {}
34
+ },
35
+ setup(d) {
36
+ let I = d, L = h("loading"), R = h(""), z = h(null), B = h(null), V = h(""), H = h([]), U = h(""), W = null, G = null;
37
+ function K(e) {
38
+ let t = e.match(/<body[^>]*>([\s\S]*)<\/body>/i);
39
+ return `<!doctype html><html><head><meta charset="utf-8">${P}<style>${F}</style></head><body>${t ? t[1] : e}</body></html>`;
40
+ }
41
+ function q(e) {
42
+ let t = new TextDecoder("latin1").decode(new Uint8Array(e, 0, Math.min(200, e.byteLength))).match(/encoding=["']([\w-]+)["']/i), n = (t ? t[1] : "utf-8").toLowerCase();
43
+ try {
44
+ return new TextDecoder(n).decode(e);
45
+ } catch {
46
+ return new TextDecoder("utf-8").decode(e);
47
+ }
48
+ }
49
+ function J() {
50
+ try {
51
+ G?.destroy(), W?.destroy();
52
+ } catch {}
53
+ G = null, W = null, H.value = [], U.value = "";
54
+ }
55
+ async function Y(e) {
56
+ if (J(), !B.value) throw Error("容器未就绪");
57
+ let t = (await import("epubjs")).default;
58
+ W = t(e), G = W.renderTo(B.value, {
59
+ width: "100%",
60
+ height: "100%",
61
+ flow: "paginated",
62
+ spread: "none",
63
+ allowScriptedContent: !1
64
+ }), await G.display();
65
+ try {
66
+ let e = await W.loaded.navigation, t = [], n = (e, r) => {
67
+ for (let i of e) t.push({
68
+ label: `${" ".repeat(r)}${(i.label || "").trim()}`,
69
+ href: i.href
70
+ }), i.subitems?.length && n(i.subitems, r + 1);
71
+ };
72
+ n(e.toc ?? [], 0), H.value = t;
73
+ } catch {}
74
+ }
75
+ async function X() {
76
+ if (I.kind === "djvu") {
77
+ L.value = "ready";
78
+ return;
79
+ }
80
+ if (I.url) {
81
+ L.value = "loading", R.value = "", z.value = null, V.value = "";
82
+ try {
83
+ let e = await fetch(I.url);
84
+ if (!e.ok) throw Error(`HTTP ${e.status}`);
85
+ let t = await e.arrayBuffer();
86
+ I.kind === "epub" ? await Y(t) : I.kind === "fb2" ? V.value = i(q(t)).html : V.value = K(a(t).html), L.value = "ready";
87
+ } catch (e) {
88
+ I.kind === "epub" && r(e) ? z.value = ["epubjs"] : R.value = e instanceof Error ? e.message : String(e), L.value = "error";
89
+ }
90
+ }
91
+ }
92
+ function Z() {
93
+ if (I.size && I.size > N) {
94
+ L.value = "gate";
95
+ return;
96
+ }
97
+ X();
98
+ }
99
+ function Q() {
100
+ G?.prev();
101
+ }
102
+ function $() {
103
+ G?.next();
104
+ }
105
+ function ee() {
106
+ U.value && G?.display(U.value);
107
+ }
108
+ return p(() => {
109
+ b(() => [I.url, I.kind], Z, { immediate: !0 });
110
+ }), f(J), (r, i) => (m(), c("div", S, [I.kind === "epub" ? (m(), c(o, { key: 0 }, [l("div", {
111
+ ref_key: "host",
112
+ ref: B,
113
+ class: "ebk__host"
114
+ }, null, 512), L.value === "ready" ? (m(), c("div", C, [
115
+ l("button", {
116
+ type: "button",
117
+ class: "ebk__navbtn",
118
+ title: "上一页",
119
+ onClick: Q
120
+ }, [u(n, {
121
+ name: "chevronLeft",
122
+ size: 15
123
+ })]),
124
+ H.value.length ? x((m(), c("select", {
125
+ key: 0,
126
+ "onUpdate:modelValue": i[0] ||= (e) => U.value = e,
127
+ class: "ebk__toc",
128
+ onChange: ee
129
+ }, [i[1] ||= l("option", { value: "" }, "目录…", -1), (m(!0), c(o, null, g(H.value, (e, t) => (m(), c("option", {
130
+ key: t,
131
+ value: e.href
132
+ }, _(e.label), 9, w))), 128))], 544)), [[y, U.value]]) : s("", !0),
133
+ l("button", {
134
+ type: "button",
135
+ class: "ebk__navbtn",
136
+ title: "下一页",
137
+ onClick: $
138
+ }, [u(n, {
139
+ name: "chevronRight",
140
+ size: 15
141
+ })])
142
+ ])) : s("", !0)], 64)) : (I.kind === "fb2" || I.kind === "mobi") && L.value === "ready" ? (m(), c("iframe", {
143
+ key: 1,
144
+ class: "ebk__frame",
145
+ srcdoc: V.value,
146
+ title: "电子书预览",
147
+ sandbox: "",
148
+ referrerpolicy: "no-referrer"
149
+ }, null, 8, T)) : I.kind === "djvu" && L.value === "ready" ? (m(), c("div", E, [...i[2] ||= [l("p", null, "DjVu 格式暂不支持浏览器内预览。", -1), l("p", { class: "ebk__hint" }, "请下载后用本地 DjVu 阅读器打开。", -1)]])) : s("", !0), L.value === "loading" ? (m(), c("div", D, [...i[3] ||= [l("p", { class: "ebk__msg" }, "正在加载电子书…", -1)]])) : L.value === "gate" ? (m(), c("div", O, [l("div", k, [l("p", null, "该电子书较大(" + _(v(t)(I.size)) + "),将在浏览器内解析。是否继续?", 1), l("button", {
150
+ type: "button",
151
+ class: "ebk__btn",
152
+ onClick: X
153
+ }, "解析并预览")])])) : z.value ? (m(), c("div", A, [u(e, {
154
+ pkg: z.value,
155
+ label: "EPUB",
156
+ "download-url": I.url,
157
+ "download-name": I.name
158
+ }, null, 8, [
159
+ "pkg",
160
+ "download-url",
161
+ "download-name"
162
+ ])])) : L.value === "error" ? (m(), c("div", j, [l("div", M, [l("p", null, "无法预览:" + _(R.value), 1), l("button", {
163
+ type: "button",
164
+ class: "ebk__btn",
165
+ onClick: X
166
+ }, "重试")])])) : s("", !0)]));
167
+ }
168
+ });
169
+ //#endregion
170
+ export { I as default };
@@ -0,0 +1,7 @@
1
+ import e from "../_virtual/_plugin-vue_export-helper.js";
2
+ import t from "./EmlViewer.vue_vue_type_script_setup_true_lang.js";
3
+ /* empty css */
4
+ //#region src/components/EmlViewer.vue
5
+ var n = /*#__PURE__*/ e(t, [["__scopeId", "data-v-5a9d243d"]]);
6
+ //#endregion
7
+ export { n as default };
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Side-viewer email (`.eml`) renderer. Fetches the message bytes from the download URL and parses the MIME
3
+ * tree entirely in-browser (see lib/eml.ts) — header card, the best body (HTML preferred, plain fallback),
4
+ * and the attachments. Mirrors the other byte-fetching viewers (DICOM/DOCX/PDF): a real download URL in,
5
+ * a self-owned fetch + render.
6
+ *
7
+ * Safety: an HTML body is hostile markup, so it renders the SAME way the panel's HTML preview does — in a
8
+ * fully sandboxed iframe (opaque origin, no `allow-scripts`) whose markup carries an injected
9
+ * `script-src 'none'` CSP, so NO upstream script runs. Inline `cid:` images are resolved to data URLs
10
+ * (which load fine in the opaque-origin frame, unlike parent-origin blob URLs). A plain-text body is HTML-
11
+ * escaped before display, so it can never inject markup.
12
+ */
13
+ type __VLS_Props = {
14
+ /** Download URL of the .eml bytes. */
15
+ url?: string;
16
+ name: string;
17
+ size?: number;
18
+ };
19
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
20
+ declare const _default: typeof __VLS_export;
21
+ export default _default;
@@ -0,0 +1,193 @@
1
+ import { formatBytes as e } from "../lib/format.js";
2
+ import t from "./icons/Icon.js";
3
+ import { parseEml as n } from "../lib/eml.js";
4
+ import { Fragment as r, computed as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createTextVNode as c, createVNode as l, defineComponent as u, normalizeClass as d, onBeforeUnmount as f, openBlock as p, ref as m, renderList as h, toDisplayString as g, unref as _, watch as v } from "vue";
5
+ //#region src/components/EmlViewer.vue?vue&type=script&setup=true&lang.ts
6
+ var y = { class: "eml" }, b = {
7
+ key: 0,
8
+ class: "eml__msg"
9
+ }, x = {
10
+ key: 1,
11
+ class: "eml__msg eml__gate"
12
+ }, S = {
13
+ key: 2,
14
+ class: "eml__msg eml__msg--error"
15
+ }, C = { class: "eml__head" }, w = { class: "eml__subject" }, T = { class: "eml__fields" }, E = {
16
+ key: 0,
17
+ class: "eml__field"
18
+ }, ee = {
19
+ key: 1,
20
+ class: "eml__field"
21
+ }, te = {
22
+ key: 2,
23
+ class: "eml__field"
24
+ }, ne = {
25
+ key: 3,
26
+ class: "eml__field"
27
+ }, re = {
28
+ key: 0,
29
+ class: "eml__atts"
30
+ }, D = { class: "eml__atts-label" }, O = [
31
+ "href",
32
+ "download",
33
+ "title"
34
+ ], k = { class: "eml__att-name" }, A = {
35
+ key: 0,
36
+ class: "eml__att-size"
37
+ }, j = {
38
+ key: 1,
39
+ class: "eml__toggle",
40
+ role: "group",
41
+ "aria-label": "正文格式"
42
+ }, M = {
43
+ key: 0,
44
+ class: "eml__html"
45
+ }, N = ["src"], P = ["innerHTML"], F = {
46
+ key: 2,
47
+ class: "eml__msg"
48
+ }, I = 12 * 1024 * 1024, L = "<meta http-equiv=\"Content-Security-Policy\" content=\"script-src 'none'; object-src 'none'; base-uri 'none'; form-action 'none'\">", R = /*@__PURE__*/ u({
49
+ __name: "EmlViewer",
50
+ props: {
51
+ url: {},
52
+ name: {},
53
+ size: {}
54
+ },
55
+ setup(u) {
56
+ let R = u, z = m("loading"), B = m(""), V = m(null), H = m("html"), U = m([]), W = m(""), G = [];
57
+ function K() {
58
+ for (let e of G) URL.revokeObjectURL(e);
59
+ G = [], W.value = "", U.value = [];
60
+ }
61
+ function q(e) {
62
+ let t = e.match(/<head[^>]*>/i);
63
+ if (t) {
64
+ let n = (t.index ?? 0) + t[0].length;
65
+ return e.slice(0, n) + L + e.slice(n);
66
+ }
67
+ return `<!doctype html><html><head><meta charset="utf-8">${L}</head><body>${e}</body></html>`;
68
+ }
69
+ function J(e) {
70
+ let t = "", n = 32768;
71
+ for (let r = 0; r < e.length; r += n) t += String.fromCharCode(...e.subarray(r, r + n));
72
+ return btoa(t);
73
+ }
74
+ function Y(e, t) {
75
+ return t.inlineById.size ? e.replace(/cid:([^"')\s>]+)/gi, (e, n) => {
76
+ let r = t.inlineById.get(n) ?? t.inlineById.get(decodeURIComponent(n));
77
+ return r ? `data:${r.contentType || "application/octet-stream"};base64,${J(r.bytes)}` : e;
78
+ }) : e;
79
+ }
80
+ function ie(e) {
81
+ return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
82
+ }
83
+ let ae = i(() => {
84
+ let e = V.value?.textBody;
85
+ return e ? ie(e).replace(/(https?:\/\/[^\s<]+)/g, (e) => `<a href="${e}" target="_blank" rel="noopener noreferrer nofollow">${e}</a>`) : "";
86
+ }), X = i(() => !!V.value?.htmlBody && V.value.htmlBody.trim().length > 0), Z = i(() => !!V.value?.textBody && V.value.textBody.trim().length > 0);
87
+ i(() => X.value || Z.value);
88
+ let oe = i(() => H.value === "html" && X.value), Q = i(() => {
89
+ let e = V.value?.date;
90
+ if (!e) return "";
91
+ let t = Date.parse(e);
92
+ if (Number.isNaN(t)) return e;
93
+ try {
94
+ return new Date(t).toLocaleString("zh-CN", {
95
+ dateStyle: "medium",
96
+ timeStyle: "short"
97
+ });
98
+ } catch {
99
+ return e;
100
+ }
101
+ });
102
+ async function $() {
103
+ if (R.url) {
104
+ z.value = "loading", B.value = "", K();
105
+ try {
106
+ let e = await fetch(R.url);
107
+ if (!e.ok) throw Error(`HTTP ${e.status}`);
108
+ let t = await e.arrayBuffer(), r = n(new Uint8Array(t));
109
+ for (let e of r.attachments) {
110
+ if (e.isInline) continue;
111
+ let t = new Blob([e.bytes], { type: e.contentType || "application/octet-stream" }), n = URL.createObjectURL(t);
112
+ G.push(n), U.value.push({
113
+ filename: e.filename,
114
+ contentType: e.contentType,
115
+ size: e.size,
116
+ url: n
117
+ });
118
+ }
119
+ if (r.htmlBody !== null) {
120
+ let e = q(Y(r.htmlBody, r)), t = URL.createObjectURL(new Blob([e], { type: "text/html" }));
121
+ G.push(t), W.value = t;
122
+ }
123
+ V.value = r, H.value = r.htmlBody && r.htmlBody.trim() ? "html" : "text", z.value = "ready";
124
+ } catch (e) {
125
+ B.value = e instanceof Error ? e.message : String(e), z.value = "error";
126
+ }
127
+ }
128
+ }
129
+ function se() {
130
+ if (R.size && R.size > I) {
131
+ z.value = "gate";
132
+ return;
133
+ }
134
+ $();
135
+ }
136
+ return v(() => R.url, se, { immediate: !0 }), f(K), (n, i) => (p(), o("div", y, [z.value === "loading" ? (p(), o("p", b, "正在解析邮件…")) : z.value === "gate" ? (p(), o("div", x, [s("p", null, "该邮件较大(" + g(_(e)(R.size)) + "),将在浏览器内解析。是否继续?", 1), s("button", {
137
+ type: "button",
138
+ class: "eml__btn",
139
+ onClick: $
140
+ }, "解析并预览")])) : z.value === "error" ? (p(), o("div", S, [s("p", null, "解析失败:" + g(B.value), 1), s("button", {
141
+ type: "button",
142
+ class: "eml__btn",
143
+ onClick: $
144
+ }, "重试")])) : z.value === "ready" && V.value ? (p(), o(r, { key: 3 }, [s("div", C, [
145
+ s("div", w, g(V.value.subject || "(无主题)"), 1),
146
+ s("dl", T, [
147
+ V.value.from ? (p(), o("div", E, [i[2] ||= s("dt", null, "发件人", -1), s("dd", null, g(V.value.from), 1)])) : a("", !0),
148
+ V.value.to ? (p(), o("div", ee, [i[3] ||= s("dt", null, "收件人", -1), s("dd", null, g(V.value.to), 1)])) : a("", !0),
149
+ V.value.cc ? (p(), o("div", te, [i[4] ||= s("dt", null, "抄送", -1), s("dd", null, g(V.value.cc), 1)])) : a("", !0),
150
+ Q.value ? (p(), o("div", ne, [i[5] ||= s("dt", null, "日期", -1), s("dd", null, g(Q.value), 1)])) : a("", !0)
151
+ ]),
152
+ U.value.length ? (p(), o("div", re, [s("span", D, [l(t, {
153
+ name: "fileOutline",
154
+ size: 13
155
+ }), c("附件 " + g(U.value.length), 1)]), (p(!0), o(r, null, h(U.value, (n, r) => (p(), o("a", {
156
+ key: r,
157
+ class: "eml__att",
158
+ href: n.url,
159
+ download: n.filename,
160
+ title: `下载 ${n.filename}`
161
+ }, [
162
+ s("span", k, g(n.filename), 1),
163
+ n.size ? (p(), o("span", A, g(_(e)(n.size)), 1)) : a("", !0),
164
+ l(t, {
165
+ name: "download",
166
+ size: 13
167
+ })
168
+ ], 8, O))), 128))])) : a("", !0),
169
+ X.value && Z.value ? (p(), o("div", j, [s("button", {
170
+ type: "button",
171
+ class: d(["eml__tab", { "eml__tab--on": H.value === "html" }]),
172
+ onClick: i[0] ||= (e) => H.value = "html"
173
+ }, " HTML ", 2), s("button", {
174
+ type: "button",
175
+ class: d(["eml__tab", { "eml__tab--on": H.value === "text" }]),
176
+ onClick: i[1] ||= (e) => H.value = "text"
177
+ }, " 纯文本 ", 2)])) : a("", !0)
178
+ ]), oe.value ? (p(), o("div", M, [s("iframe", {
179
+ class: "eml__frame",
180
+ src: W.value,
181
+ title: "邮件正文",
182
+ sandbox: "",
183
+ loading: "lazy",
184
+ referrerpolicy: "no-referrer"
185
+ }, null, 8, N)])) : Z.value ? (p(), o("div", {
186
+ key: 1,
187
+ class: "eml__text",
188
+ innerHTML: ae.value
189
+ }, null, 8, P)) : (p(), o("p", F, "(此邮件没有可显示的正文)"))], 64)) : a("", !0)]));
190
+ }
191
+ });
192
+ //#endregion
193
+ export { R as default };
@@ -0,0 +1,7 @@
1
+ import e from "../_virtual/_plugin-vue_export-helper.js";
2
+ import t from "./EplViewer.vue_vue_type_script_setup_true_lang.js";
3
+ /* empty css */
4
+ //#region src/components/EplViewer.vue
5
+ var n = /*#__PURE__*/ e(t, [["__scopeId", "data-v-6b3500dc"]]);
6
+ //#endregion
7
+ export { n as default };