@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,135 @@
1
+ import { MONO as e, SERIF as t } from "../fonts.js";
2
+ //#region src/lib/markdown/styles.ts
3
+ function n(e) {
4
+ return e > 0 ? {
5
+ fontFamily: t,
6
+ fontSize: "16.5px",
7
+ lineHeight: 1.7,
8
+ margin: "0 0 8px",
9
+ color: "var(--text)"
10
+ } : {
11
+ fontFamily: t,
12
+ fontSize: "17px",
13
+ lineHeight: 1.78,
14
+ margin: "0 0 16px",
15
+ color: "var(--text)"
16
+ };
17
+ }
18
+ function r(e, n) {
19
+ let r = {
20
+ fontFamily: t,
21
+ fontWeight: 600,
22
+ color: "var(--text-strong)"
23
+ };
24
+ switch (e) {
25
+ case 1: return {
26
+ ...r,
27
+ fontSize: "24px",
28
+ margin: `${n ? "4px" : "32px"} 0 15px`,
29
+ letterSpacing: "-0.02em",
30
+ lineHeight: 1.3
31
+ };
32
+ case 2: return {
33
+ ...r,
34
+ fontSize: "20px",
35
+ margin: `${n ? "4px" : "30px"} 0 13px`,
36
+ letterSpacing: "-0.01em",
37
+ lineHeight: 1.35
38
+ };
39
+ case 3: return {
40
+ ...r,
41
+ fontSize: "17px",
42
+ margin: "22px 0 9px",
43
+ lineHeight: 1.4
44
+ };
45
+ case 4: return {
46
+ ...r,
47
+ fontSize: "15.5px",
48
+ margin: "20px 0 8px",
49
+ lineHeight: 1.45
50
+ };
51
+ case 5: return {
52
+ ...r,
53
+ fontSize: "14px",
54
+ margin: "18px 0 6px",
55
+ lineHeight: 1.5
56
+ };
57
+ default: return {
58
+ ...r,
59
+ fontSize: "13px",
60
+ margin: "18px 0 6px",
61
+ letterSpacing: "0.01em",
62
+ color: "var(--muted)",
63
+ lineHeight: 1.5
64
+ };
65
+ }
66
+ }
67
+ function i(e, t) {
68
+ return {
69
+ margin: e > 0 ? "8px 0 10px" : "4px 0 18px",
70
+ paddingLeft: t ? "28px" : "24px"
71
+ };
72
+ }
73
+ function a(e) {
74
+ return {
75
+ fontFamily: t,
76
+ fontSize: e > 0 ? "16.5px" : "17px",
77
+ lineHeight: 1.72,
78
+ color: "var(--text)",
79
+ margin: "0 0 7px",
80
+ paddingLeft: "3px"
81
+ };
82
+ }
83
+ var o = {
84
+ fontFamily: e,
85
+ fontSize: "0.86em",
86
+ background: "var(--code-bg)",
87
+ border: "1px solid var(--code-border)",
88
+ borderRadius: "5px",
89
+ padding: "1.5px 5px",
90
+ color: "var(--accent)",
91
+ overflowWrap: "anywhere"
92
+ }, s = {
93
+ fontWeight: 600,
94
+ color: "var(--text-strong)"
95
+ }, c = { color: "var(--muted)" }, l = { fontStyle: "italic" }, u = {
96
+ color: "var(--accent)",
97
+ textDecoration: "underline",
98
+ textUnderlineOffset: "2px",
99
+ textDecorationThickness: "1px"
100
+ }, d = {
101
+ maxWidth: "100%",
102
+ height: "auto",
103
+ borderRadius: "8px",
104
+ margin: "6px 0",
105
+ border: "1px solid var(--border)"
106
+ }, f = {
107
+ border: "none",
108
+ borderTop: "1px solid var(--border)",
109
+ margin: "28px 0"
110
+ }, p = {
111
+ margin: "0 0 16px",
112
+ padding: "2px 0 2px 16px",
113
+ borderLeft: "3px solid var(--border-2)",
114
+ color: "var(--muted)"
115
+ };
116
+ function m(e) {
117
+ return {
118
+ display: "inline-block",
119
+ width: "15px",
120
+ height: "15px",
121
+ boxSizing: "border-box",
122
+ verticalAlign: "-2px",
123
+ marginRight: "8px",
124
+ borderRadius: "4px",
125
+ border: `1.5px solid ${e ? "var(--accent)" : "var(--border-2)"}`,
126
+ background: e ? "var(--accent)" : "transparent",
127
+ color: "#fff",
128
+ fontSize: "11px",
129
+ lineHeight: "12px",
130
+ textAlign: "center",
131
+ fontWeight: 700
132
+ };
133
+ }
134
+ //#endregion
135
+ export { p as blockquoteStyle, c as delStyle, l as emStyle, r as headingStyle, f as hrStyle, d as imgStyle, o as inlineCodeStyle, u as linkStyle, a as listItemStyle, i as listStyle, n as paragraphStyle, s as strongStyle, m as taskCheckboxStyle };
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Hand-rolled MHT / MHTML (web archive, RFC 2557) parser — the archive-specific layer on top of the shared
3
+ * MIME core (lib/mime.ts). An `.mht`/`.mhtml` is a `multipart/related` MIME container: a root HTML part plus
4
+ * the page's resources (images / CSS / fonts), each part referenced from the HTML by its original URL via a
5
+ * `Content-Location` header (vs. an email's `cid:` Content-ID).
6
+ *
7
+ * Two halves:
8
+ * - {@link parseMht} (pure, unit-testable): parse the container, pick the root HTML part, and index every
9
+ * other part by its absolute Content-Location (and Content-ID, for the rare `cid:` archive).
10
+ * - {@link rewriteHtml} (browser-only, uses DOMParser): rewrite the HTML's resource references to caller-
11
+ * supplied blob URLs, strip scripts, and inject a hardened CSP — so the archive renders offline inside a
12
+ * sandboxed iframe without running upstream script or phoning home. See MhtViewer.vue.
13
+ */
14
+ /** A single archived page resource (image / stylesheet / font / …). */
15
+ export interface MhtResource {
16
+ contentType: string;
17
+ /** Charset label from the part's Content-Type (for text resources like CSS); '' when none. */
18
+ charset: string;
19
+ bytes: Uint8Array;
20
+ }
21
+ /** Flattened, render-ready view of a parsed web archive. */
22
+ export interface ParsedMht {
23
+ /** `Subject:` header — the saved page's title (browsers write the document title here). */
24
+ title: string;
25
+ /** Original page URL (`Snapshot-Content-Location` or the root `Content-Location`), for display. */
26
+ sourceUrl: string;
27
+ /** Raw `Date:` header value (the viewer formats it for display). */
28
+ date: string;
29
+ /** Decoded root HTML (NOT yet resource-rewritten), or null when the archive has no HTML part. */
30
+ html: string | null;
31
+ /** Base URL for resolving the root HTML's resource references (the root part's Content-Location). */
32
+ rootBase: string;
33
+ /** Absolute Content-Location → resource. */
34
+ byLocation: Map<string, MhtResource>;
35
+ /** Content-ID (no angle brackets) → resource. */
36
+ byCid: Map<string, MhtResource>;
37
+ }
38
+ /** The hardened CSP injected into the archive before it's handed to the sandboxed iframe. */
39
+ export declare const MHT_CSP: string;
40
+ /** Parse raw `.mht`/`.mhtml` bytes into a flattened {@link ParsedMht}. */
41
+ export declare function parseMht(bytes: Uint8Array): ParsedMht;
42
+ /**
43
+ * Rewrite the parsed archive's root HTML so every captured resource reference points at a caller-supplied
44
+ * blob URL, strip scripts, and inject {@link MHT_CSP}. Returns a complete HTML document string for the
45
+ * sandboxed iframe. Browser-only (uses DOMParser — which neither runs scripts nor fetches subresources).
46
+ *
47
+ * `makeUrl(bytes, contentType)` is the caller's blob-URL factory (it tracks the URLs for later revocation).
48
+ * Resources we can't resolve are left with their original URL — the CSP then blocks the request, so they
49
+ * show as a broken image rather than leaking to the network.
50
+ */
51
+ export declare function rewriteHtml(parsed: ParsedMht, makeUrl: (bytes: Uint8Array, contentType: string) => string): string;
@@ -0,0 +1,122 @@
1
+ import { bytesToBinary as e, collectLeaves as t, decodeCharset as n, decodeWords as r, getHeader as i, parseEntity as a, parseHeaders as o, splitHeadersBody as s } from "./mime.js";
2
+ //#region src/lib/mht.ts
3
+ var c = "default-src 'none'; img-src blob: data:; media-src blob: data:; style-src blob: data: 'unsafe-inline'; font-src blob: data:; script-src 'none'; object-src 'none'; base-uri 'none'; form-action 'none'";
4
+ function l(e, t) {
5
+ try {
6
+ return new URL(e, t || void 0).href;
7
+ } catch {
8
+ return e;
9
+ }
10
+ }
11
+ function u(e) {
12
+ return e.trim().replace(/^<|>$/g, "");
13
+ }
14
+ function d(c) {
15
+ let d = e(c), f = a(d), p = o(s(d)[0]), m = [];
16
+ t(f, m);
17
+ let h = u(f.ctParams.start || ""), g;
18
+ h && (g = m.find((e) => e.contentId === h)), g ||= m.find((e) => e.contentType === "text/html");
19
+ let _ = /* @__PURE__ */ new Map(), v = /* @__PURE__ */ new Map();
20
+ for (let e of m) {
21
+ if (e === g) continue;
22
+ let t = {
23
+ contentType: e.contentType,
24
+ charset: e.charset,
25
+ bytes: e.bodyBytes ?? new Uint8Array()
26
+ };
27
+ if (e.contentLocation) {
28
+ _.set(e.contentLocation, t);
29
+ let n = l(e.contentLocation, e.contentLocation);
30
+ n !== e.contentLocation && _.set(n, t);
31
+ }
32
+ e.contentId && v.set(e.contentId, t);
33
+ }
34
+ let y = g?.contentLocation || i(p, "content-location") || "", b = g ? n(g.bodyBytes ?? new Uint8Array(), g.charset) : null;
35
+ return {
36
+ title: r(i(p, "subject")),
37
+ sourceUrl: i(p, "snapshot-content-location") || i(p, "content-location") || y,
38
+ date: i(p, "date"),
39
+ html: b,
40
+ rootBase: y,
41
+ byLocation: _,
42
+ byCid: v
43
+ };
44
+ }
45
+ var f = "http://www.w3.org/1999/xlink";
46
+ function p(e, t) {
47
+ let r = new DOMParser().parseFromString(e.html ?? "", "text/html"), i = /* @__PURE__ */ new Map(), a = (e) => {
48
+ let n = i.get(e);
49
+ return n || (n = t(e.bytes, e.contentType || "application/octet-stream"), i.set(e, n)), n;
50
+ }, o = (t, n) => {
51
+ if (!t) return;
52
+ if (/^cid:/i.test(t)) {
53
+ let n = u(t.slice(4));
54
+ return e.byCid.get(n) ?? e.byCid.get(decodeURIComponent(n));
55
+ }
56
+ if (/^(data|blob|javascript|about):/i.test(t)) return;
57
+ let r = l(t, n);
58
+ return e.byLocation.get(r) ?? e.byLocation.get(t);
59
+ }, s = (e, t) => {
60
+ let n = e.replace(/url\(\s*(['"]?)([^'")]+)\1\s*\)/gi, (e, n, r) => {
61
+ let i = o(r, t);
62
+ return i ? `url("${a(i)}")` : e;
63
+ });
64
+ return n = n.replace(/@import\s+(['"])([^'"]+)\1/gi, (e, n, r) => {
65
+ let i = o(r, t);
66
+ return i ? `@import "${a(i)}"` : e;
67
+ }), n;
68
+ }, d = (t, n) => {
69
+ let r = t.getAttribute(n);
70
+ if (!r) return;
71
+ let i = o(r, e.rootBase);
72
+ i && t.setAttribute(n, a(i));
73
+ };
74
+ r.querySelectorAll("script, base").forEach((e) => e.remove()), r.querySelectorAll("meta[http-equiv]").forEach((e) => {
75
+ (e.getAttribute("http-equiv") || "").toLowerCase() === "content-security-policy" && e.remove();
76
+ }), r.querySelectorAll("link[rel~=\"stylesheet\"][href]").forEach((r) => {
77
+ let i = r.getAttribute("href");
78
+ if (!i) return;
79
+ let a = o(i, e.rootBase);
80
+ if (!a) return;
81
+ let c = l(i, e.rootBase), u = s(n(a.bytes, a.charset), c);
82
+ r.setAttribute("href", t(new TextEncoder().encode(u), "text/css"));
83
+ });
84
+ for (let [e, t] of [
85
+ ["img", "src"],
86
+ ["input[type=\"image\"]", "src"],
87
+ ["source", "src"],
88
+ ["video", "src"],
89
+ ["video", "poster"],
90
+ ["audio", "src"],
91
+ ["track", "src"],
92
+ ["embed", "src"],
93
+ ["object", "data"]
94
+ ]) r.querySelectorAll(e).forEach((e) => d(e, t));
95
+ r.querySelectorAll("image").forEach((t) => {
96
+ d(t, "href");
97
+ let n = t.getAttributeNS(f, "href");
98
+ if (n) {
99
+ let r = o(n, e.rootBase);
100
+ r && t.setAttributeNS(f, "href", a(r));
101
+ }
102
+ }), r.querySelectorAll("img[srcset], source[srcset]").forEach((t) => {
103
+ let n = t.getAttribute("srcset");
104
+ if (!n) return;
105
+ let r = n.split(",").map((t) => {
106
+ let n = t.trim();
107
+ if (!n) return n;
108
+ let r = n.split(/\s+/), i = o(r[0], e.rootBase);
109
+ return i && (r[0] = a(i)), r.join(" ");
110
+ }).join(", ");
111
+ t.setAttribute("srcset", r);
112
+ }), r.querySelectorAll("[style]").forEach((t) => {
113
+ let n = t.getAttribute("style");
114
+ n && n.includes("url(") && t.setAttribute("style", s(n, e.rootBase));
115
+ }), r.querySelectorAll("style").forEach((t) => {
116
+ t.textContent = s(t.textContent ?? "", e.rootBase);
117
+ });
118
+ let p = r.createElement("meta");
119
+ return p.setAttribute("http-equiv", "Content-Security-Policy"), p.setAttribute("content", c), r.head.insertBefore(p, r.head.firstChild), "<!doctype html>\n" + r.documentElement.outerHTML;
120
+ }
121
+ //#endregion
122
+ export { d as parseMht, p as rewriteHtml };
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Hand-rolled, zero-dependency Standard MIDI File (.mid/.midi) parser for the side viewer's best-effort
3
+ * preview. The browser can't *play* MIDI (there's no built-in synthesizer and self-hosting a soundfont is out
4
+ * of scope), so the viewer instead VISUALIZES the music as a piano roll. This extracts what that needs: the
5
+ * note events (pitch / timing / track) plus header info and an approximate duration.
6
+ *
7
+ * Timing is approximate by design: it uses the first `set_tempo` it sees (or 120 BPM) for the whole file, so
8
+ * songs with tempo changes will be slightly off — fine for a visual overview. SMPTE-division files fall back
9
+ * to a nominal ticks-per-quarter. Note-ons with velocity 0 are treated as note-offs (the common shorthand).
10
+ */
11
+ export interface MidiNote {
12
+ track: number;
13
+ channel: number;
14
+ pitch: number;
15
+ startTick: number;
16
+ endTick: number;
17
+ velocity: number;
18
+ }
19
+ export interface ParsedMidi {
20
+ format: number;
21
+ trackCount: number;
22
+ division: number;
23
+ notes: MidiNote[];
24
+ totalTicks: number;
25
+ durationSec: number;
26
+ tempoBpm: number;
27
+ }
28
+ export declare function parseMidi(buf: ArrayBuffer): ParsedMidi;
@@ -0,0 +1,84 @@
1
+ //#region src/lib/midi.ts
2
+ function e(e) {
3
+ let t = new DataView(e), n = 0, r = () => t.getUint8(n++), i = () => {
4
+ let e = t.getUint16(n);
5
+ return n += 2, e;
6
+ }, a = () => {
7
+ let e = t.getUint32(n);
8
+ return n += 4, e;
9
+ }, o = () => String.fromCharCode(r(), r(), r(), r()), s = () => {
10
+ let e = 0;
11
+ for (let t = 0; t < 4; t++) {
12
+ let t = r();
13
+ if (e = e << 7 | t & 127, !(t & 128)) break;
14
+ }
15
+ return e;
16
+ };
17
+ if (e.byteLength < 14 || o() !== "MThd") throw Error("不是有效的 MIDI 文件");
18
+ let c = a(), l = i(), u = i(), d = i();
19
+ n = 8 + c;
20
+ let f = d & 32768 ? 480 : d || 480, p = [], m = 5e5, h = !1, g = 0;
21
+ for (let e = 0; e < u && n + 8 <= t.byteLength && o() === "MTrk"; e++) {
22
+ let i = a(), o = Math.min(n + i, t.byteLength), c = 0, l = 0, u = /* @__PURE__ */ new Map(), d = (t, n) => {
23
+ let r = t << 8 | n, i = u.get(r);
24
+ i && (p.push({
25
+ track: e,
26
+ channel: t,
27
+ pitch: n,
28
+ startTick: i.startTick,
29
+ endTick: c,
30
+ velocity: i.velocity
31
+ }), u.delete(r), c > g && (g = c));
32
+ };
33
+ for (; n < o;) {
34
+ c += s();
35
+ let e = r();
36
+ if (e & 128 ? l = e : n--, l === 255) {
37
+ let e = r(), t = s();
38
+ if (e === 81 && t === 3) {
39
+ let e = r() << 16 | r() << 8 | r();
40
+ h ||= (m = e, !0);
41
+ } else n += t;
42
+ } else if (l === 240 || l === 247) n += s();
43
+ else {
44
+ let e = l & 240, t = l & 15;
45
+ if (e === 144) {
46
+ let e = r(), n = r();
47
+ n > 0 ? u.set(t << 8 | e, {
48
+ startTick: c,
49
+ velocity: n
50
+ }) : d(t, e);
51
+ } else if (e === 128) {
52
+ let e = r();
53
+ r(), d(t, e);
54
+ } else if (e === 160 || e === 176 || e === 224) n += 2;
55
+ else if (e === 192 || e === 208) n += 1;
56
+ else break;
57
+ }
58
+ }
59
+ for (let [t, n] of u) {
60
+ let r = t & 255, i = t >> 8;
61
+ p.push({
62
+ track: e,
63
+ channel: i,
64
+ pitch: r,
65
+ startTick: n.startTick,
66
+ endTick: c,
67
+ velocity: n.velocity
68
+ });
69
+ }
70
+ c > g && (g = c), n = o;
71
+ }
72
+ let _ = m / 1e6 / f;
73
+ return {
74
+ format: l,
75
+ trackCount: u,
76
+ division: f,
77
+ notes: p,
78
+ totalTicks: g,
79
+ durationSec: g * _,
80
+ tempoBpm: Math.round(6e7 / m)
81
+ };
82
+ }
83
+ //#endregion
84
+ export { e as parseMidi };
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Hand-rolled MIME core (RFC 822 / 2045 / 2047 / 2231) shared by the side-viewer's MIME-container previews.
3
+ *
4
+ * Zero-dependency, in the spirit of the project's other parsers (lib/zip.ts, lib/binobj.ts). Both an `.eml`
5
+ * email (lib/eml.ts) and a `.mht`/`.mhtml` web archive (lib/mht.ts) are the SAME on the wire: RFC 822 headers
6
+ * + a body that may be a tree of multipart entities, each with its own Content-Type / Content-Transfer-
7
+ * Encoding / charset. This module owns that generic machinery — parse the container into an {@link Entity}
8
+ * tree, transfer-decode (base64 / quoted-printable) and charset-decode (TextDecoder) each leaf — and the two
9
+ * format-specific modules flatten the tree into their own render-ready shapes.
10
+ *
11
+ * Bytes vs. text: the transport is treated as a 1:1 binary string (each byte → one char in [0,255]) so we
12
+ * can split on boundaries / unfold headers with plain string ops while keeping leaf bytes exact. Per-part we
13
+ * then transfer-decode and charset-decode to recover real text / bytes. Real attachments / resources are
14
+ * virtually always base64/QP (7-bit safe), so the binary string round-trips losslessly even for non-UTF-8.
15
+ */
16
+ /** Pack bytes into a 1:1 binary string (each byte → one char in [0,255]); chunked to bound arg count. */
17
+ export declare function bytesToBinary(bytes: Uint8Array): string;
18
+ /** Inverse of {@link bytesToBinary}: a binary string back to its exact bytes. */
19
+ export declare function binaryToBytes(s: string): Uint8Array;
20
+ /** Decode base64 (tolerant of embedded whitespace/newlines) to bytes. */
21
+ export declare function base64ToBytes(b64: string): Uint8Array;
22
+ /** Decode bytes with a (possibly messy) charset label, falling back to UTF-8 then a raw binary string. */
23
+ export declare function decodeCharset(bytes: Uint8Array, charset: string): string;
24
+ /** Decode quoted-printable text (soft line-breaks dropped, `=XX` → byte) to a binary string. */
25
+ export declare function decodeQuotedPrintable(s: string): string;
26
+ /**
27
+ * Decode RFC 2047 encoded-words in a header value (`=?charset?B|Q?text?=`). Adjacent encoded words
28
+ * separated only by whitespace are concatenated with the whitespace removed (§6.2).
29
+ */
30
+ export declare function decodeWords(input: string): string;
31
+ export interface HeaderField {
32
+ name: string;
33
+ value: string;
34
+ }
35
+ /** Split a raw entity (binary string) into its header block and body at the first blank line. */
36
+ export declare function splitHeadersBody(raw: string): [string, string];
37
+ /** Parse a header block into ordered fields, unfolding continuation (leading-whitespace) lines. */
38
+ export declare function parseHeaders(block: string): HeaderField[];
39
+ /** First header value (case-insensitive), '' when absent. */
40
+ export declare function getHeader(headers: HeaderField[], name: string): string;
41
+ export interface ContentType {
42
+ type: string;
43
+ params: Record<string, string>;
44
+ }
45
+ /** Split a structured header value on `;`, ignoring separators inside quotes. */
46
+ export declare function splitParams(value: string): string[];
47
+ /** Parse a Content-Type / Content-Disposition value into its type token + lowercased params. */
48
+ export declare function parseTyped(value: string): ContentType;
49
+ /**
50
+ * Resolve a parameter (`filename` / `name`) across its RFC 2231 spellings: a plain quoted value (with
51
+ * RFC 2047 encoded-words decoded), a single extended `name*=`, or `name*0*`/`name*1*` continuations.
52
+ */
53
+ export declare function paramValue(params: Record<string, string>, base: string): string;
54
+ /** Transfer-decode a leaf body (binary string) per its Content-Transfer-Encoding into exact bytes. */
55
+ export declare function decodeBody(bodyBin: string, encoding: string): Uint8Array;
56
+ /**
57
+ * Split a multipart body (binary string) into its part substrings (headers + body each). Boundary
58
+ * delimiter lines are `--boundary` at a line start; the closing one is `--boundary--`. The CRLF preceding
59
+ * a delimiter belongs to the boundary, so it's excluded from the preceding part.
60
+ */
61
+ export declare function splitMultipart(bodyBin: string, boundary: string): string[];
62
+ /** One MIME entity: a leaf (with decoded {@link bodyBytes}) or a multipart node (with child {@link parts}). */
63
+ export interface Entity {
64
+ contentType: string;
65
+ charset: string;
66
+ encoding: string;
67
+ disposition: string;
68
+ filename: string;
69
+ /** Content-ID without the angle brackets, '' if none — the key a `cid:` ref resolves to (email inline). */
70
+ contentId: string;
71
+ /** Content-Location URI, '' if none — the key a web archive's resource references resolve to (MHT). */
72
+ contentLocation: string;
73
+ /** Raw Content-Type params (lowercased), e.g. `boundary` / `start` / `type` — for MHT root selection. */
74
+ ctParams: Record<string, string>;
75
+ isMultipart: boolean;
76
+ parts: Entity[];
77
+ bodyBytes: Uint8Array | null;
78
+ }
79
+ /** Recursively parse one MIME entity (binary string) into the {@link Entity} tree. */
80
+ export declare function parseEntity(rawBin: string, depth?: number): Entity;
81
+ /** Depth-first collect every leaf (non-multipart) entity. */
82
+ export declare function collectLeaves(ent: Entity, out: Entity[]): void;
@@ -0,0 +1,151 @@
1
+ //#region src/lib/mime.ts
2
+ var e = {
3
+ "us-ascii": "utf-8",
4
+ ascii: "utf-8",
5
+ "ansi_x3.4-1968": "utf-8",
6
+ "iso-ir-6": "utf-8",
7
+ ansi: "windows-1252",
8
+ cp1252: "windows-1252"
9
+ };
10
+ function t(e) {
11
+ let t = "", n = 32768;
12
+ for (let r = 0; r < e.length; r += n) t += String.fromCharCode(...e.subarray(r, r + n));
13
+ return t;
14
+ }
15
+ function n(e) {
16
+ let t = new Uint8Array(e.length);
17
+ for (let n = 0; n < e.length; n++) t[n] = e.charCodeAt(n) & 255;
18
+ return t;
19
+ }
20
+ function r(e) {
21
+ let t = e.replace(/[^A-Za-z0-9+/=]/g, "");
22
+ return n(atob(t));
23
+ }
24
+ function i(n, r) {
25
+ let i = (r || "utf-8").trim().toLowerCase().split("*")[0];
26
+ i = e[i] ?? i;
27
+ try {
28
+ return new TextDecoder(i, { fatal: !1 }).decode(n);
29
+ } catch {
30
+ try {
31
+ return new TextDecoder("utf-8", { fatal: !1 }).decode(n);
32
+ } catch {
33
+ return t(n);
34
+ }
35
+ }
36
+ }
37
+ function a(e) {
38
+ return e.replace(/=\r?\n/g, "").replace(/=([0-9A-Fa-f]{2})/g, (e, t) => String.fromCharCode(parseInt(t, 16)));
39
+ }
40
+ function o(e) {
41
+ return !e || !e.includes("=?") ? e : e.replace(/\?=\s+=\?/g, "?==?").replace(/=\?([^?]+)\?([BbQq])\?([^?]*)\?=/g, (e, t, a, o) => {
42
+ try {
43
+ let e;
44
+ return e = a.toUpperCase() === "B" ? r(o) : n(o.replace(/_/g, " ").replace(/=([0-9A-Fa-f]{2})/g, (e, t) => String.fromCharCode(parseInt(t, 16)))), i(e, t);
45
+ } catch {
46
+ return e;
47
+ }
48
+ });
49
+ }
50
+ function s(e) {
51
+ let t = e.match(/\r?\n\r?\n/);
52
+ return !t || t.index === void 0 ? [e, ""] : [e.slice(0, t.index), e.slice(t.index + t[0].length)];
53
+ }
54
+ function c(e) {
55
+ let t = [];
56
+ for (let n of e.split(/\r?\n/)) if (/^[ \t]/.test(n) && t.length) t[t.length - 1].value += " " + n.replace(/^[ \t]+/, "");
57
+ else {
58
+ let e = n.indexOf(":");
59
+ e > 0 && t.push({
60
+ name: n.slice(0, e).trim(),
61
+ value: n.slice(e + 1).trim()
62
+ });
63
+ }
64
+ return t;
65
+ }
66
+ function l(e, t) {
67
+ let n = t.toLowerCase();
68
+ return e.find((e) => e.name.toLowerCase() === n)?.value ?? "";
69
+ }
70
+ function u(e) {
71
+ let t = [], n = "", r = !1;
72
+ for (let i of e) i === "\"" ? (r = !r, n += i) : i === ";" && !r ? (t.push(n), n = "") : n += i;
73
+ return n.trim() && t.push(n), t;
74
+ }
75
+ function d(e) {
76
+ let t = u(e), n = (t.shift() ?? "").trim().toLowerCase(), r = {};
77
+ for (let e of t) {
78
+ let t = e.indexOf("=");
79
+ if (t < 0) continue;
80
+ let n = e.slice(0, t).trim().toLowerCase(), i = e.slice(t + 1).trim();
81
+ i.startsWith("\"") && i.endsWith("\"") && (i = i.slice(1, -1)), r[n] = i;
82
+ }
83
+ return {
84
+ type: n,
85
+ params: r
86
+ };
87
+ }
88
+ function f(e, t) {
89
+ let n = [];
90
+ for (let t = 0; t < e.length; t++) e[t] === "%" && t + 2 < e.length ? (n.push(parseInt(e.slice(t + 1, t + 3), 16)), t += 2) : n.push(e.charCodeAt(t) & 255);
91
+ return i(Uint8Array.from(n), t || "utf-8");
92
+ }
93
+ function p(e) {
94
+ let t = e.match(/^([^']*)'[^']*'(.*)$/);
95
+ return t ? f(t[2], t[1]) : f(e, "");
96
+ }
97
+ function m(e, t) {
98
+ if (e[t + "*"] !== void 0) return p(e[t + "*"]);
99
+ if (e[t] !== void 0) return o(e[t]);
100
+ if (e[`${t}*0`] !== void 0 || e[`${t}*0*`] !== void 0) {
101
+ let n = "", r = "";
102
+ for (let i = 0;; i++) {
103
+ let a = e[`${t}*${i}*`], o = e[`${t}*${i}`];
104
+ if (a !== void 0) if (i === 0) {
105
+ let e = a.match(/^([^']*)'[^']*'(.*)$/);
106
+ e ? (r = e[1], n += f(e[2], r)) : n += f(a, r);
107
+ } else n += f(a, r);
108
+ else if (o !== void 0) n += o;
109
+ else break;
110
+ }
111
+ return n;
112
+ }
113
+ return "";
114
+ }
115
+ function h(e, t) {
116
+ let i = (t || "").trim().toLowerCase();
117
+ return i === "base64" ? r(e) : n(i === "quoted-printable" ? a(e) : e);
118
+ }
119
+ function g(e, t) {
120
+ let n = t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), r = RegExp(`(?:^|\\r\\n|\\n)--${n}(--)?[ \\t]*(?:\\r\\n|\\n|$)`, "g"), i = [], a, o = -1;
121
+ for (; (a = r.exec(e)) !== null && (o >= 0 && i.push(e.slice(o, a.index)), a[1] !== "--");) o = r.lastIndex;
122
+ return i;
123
+ }
124
+ function _(e, t = 0) {
125
+ let [n, r] = s(e), i = c(n), a = d(l(i, "content-type") || "text/plain"), o = a.type || "text/plain", u = d(l(i, "content-disposition")), f = l(i, "content-id").trim();
126
+ f.startsWith("<") && f.endsWith(">") && (f = f.slice(1, -1));
127
+ let p = {
128
+ contentType: o,
129
+ charset: a.params.charset || "",
130
+ encoding: l(i, "content-transfer-encoding"),
131
+ disposition: u.type || "",
132
+ filename: m(u.params, "filename") || m(a.params, "name") || "",
133
+ contentId: f,
134
+ contentLocation: l(i, "content-location").trim(),
135
+ ctParams: a.params,
136
+ isMultipart: !1,
137
+ parts: [],
138
+ bodyBytes: null
139
+ };
140
+ if (o.startsWith("multipart/") && a.params.boundary && t < 20) {
141
+ p.isMultipart = !0;
142
+ for (let e of g(r, a.params.boundary)) p.parts.push(_(e, t + 1));
143
+ } else p.bodyBytes = h(r, p.encoding);
144
+ return p;
145
+ }
146
+ function v(e, t) {
147
+ if (e.isMultipart) for (let n of e.parts) v(n, t);
148
+ else t.push(e);
149
+ }
150
+ //#endregion
151
+ export { t as bytesToBinary, v as collectLeaves, i as decodeCharset, o as decodeWords, l as getHeader, _ as parseEntity, c as parseHeaders, s as splitHeadersBody };