anyfile-cli 0.0.0-stage → 0.2.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 (355) hide show
  1. package/LICENSE +177 -0
  2. package/README.md +56 -2
  3. package/SKILL.md +101 -0
  4. package/chunks/browser-probe-5STDX455.mjs +17 -0
  5. package/chunks/browser-probe-F5RX44T3.mjs +24 -0
  6. package/chunks/chunk-2C34VMNV.mjs +108 -0
  7. package/chunks/chunk-3OZ56PUH.mjs +97 -0
  8. package/chunks/chunk-3YRWCQGV.mjs +38 -0
  9. package/chunks/chunk-53MJMIN4.mjs +23 -0
  10. package/chunks/chunk-5LOC7IST.mjs +372 -0
  11. package/chunks/chunk-5OI4NQH7.mjs +2232 -0
  12. package/chunks/chunk-5XTYLZF3.mjs +559 -0
  13. package/chunks/chunk-5ZHDYRGV.mjs +64 -0
  14. package/chunks/chunk-6CQL4K2K.mjs +21 -0
  15. package/chunks/chunk-6EVJJFOH.mjs +243 -0
  16. package/chunks/chunk-6NWSQGYE.mjs +68 -0
  17. package/chunks/chunk-7O5JLQE7.mjs +1 -0
  18. package/chunks/chunk-A6AQI6DF.mjs +321 -0
  19. package/chunks/chunk-AYF63UBE.mjs +79 -0
  20. package/chunks/chunk-B27PR6Q4.mjs +17 -0
  21. package/chunks/chunk-BP7LORL4.mjs +13 -0
  22. package/chunks/chunk-BVCRJLCD.mjs +109 -0
  23. package/chunks/chunk-CLSEE3VA.mjs +28 -0
  24. package/chunks/chunk-CO2ZAQIK.mjs +52 -0
  25. package/chunks/chunk-CQWM5GMU.mjs +167 -0
  26. package/chunks/chunk-CZFFYCMJ.mjs +136 -0
  27. package/chunks/chunk-D3CS6TIK.mjs +419 -0
  28. package/chunks/chunk-DJLFVMDJ.mjs +807 -0
  29. package/chunks/chunk-DJXVCKIO.mjs +30 -0
  30. package/chunks/chunk-EMXODK3K.mjs +94 -0
  31. package/chunks/chunk-EOJ7ZCDK.mjs +227 -0
  32. package/chunks/chunk-H4TBN22D.mjs +100 -0
  33. package/chunks/chunk-HUSX3ZU3.mjs +58 -0
  34. package/chunks/chunk-IC3G2XE2.mjs +436 -0
  35. package/chunks/chunk-IZGTVZHE.mjs +90 -0
  36. package/chunks/chunk-J4G7LUPA.mjs +117 -0
  37. package/chunks/chunk-JBAJW66L.mjs +4220 -0
  38. package/chunks/chunk-JKQUF2MM.mjs +438 -0
  39. package/chunks/chunk-KAMPC5TK.mjs +131 -0
  40. package/chunks/chunk-KSKEMJVC.mjs +145 -0
  41. package/chunks/chunk-LRHHRZLE.mjs +29 -0
  42. package/chunks/chunk-M37ZOAUG.mjs +93 -0
  43. package/chunks/chunk-MG7LUDXO.mjs +187 -0
  44. package/chunks/chunk-NGVHHTQD.mjs +125 -0
  45. package/chunks/chunk-NQ7J2NH6.mjs +50 -0
  46. package/chunks/chunk-NUMNHVSI.mjs +60 -0
  47. package/chunks/chunk-ORJ3DN65.mjs +58 -0
  48. package/chunks/chunk-QOUEBPPL.mjs +15 -0
  49. package/chunks/chunk-QR3Y3UKM.mjs +194 -0
  50. package/chunks/chunk-RFKYE7SE.mjs +50 -0
  51. package/chunks/chunk-SH57XOAV.mjs +33 -0
  52. package/chunks/chunk-TB5ISPA4.mjs +1 -0
  53. package/chunks/chunk-UGAU3V4V.mjs +206 -0
  54. package/chunks/chunk-UUN2DVDC.mjs +1893 -0
  55. package/chunks/chunk-WDN6NMVU.mjs +36 -0
  56. package/chunks/chunk-WWTLSPEG.mjs +3999 -0
  57. package/chunks/chunk-XDW56XVX.mjs +69 -0
  58. package/chunks/chunk-XRT7TAAY.mjs +27 -0
  59. package/chunks/chunk-XTW4HNIJ.mjs +418 -0
  60. package/chunks/chunk-YPLWNGCC.mjs +17 -0
  61. package/chunks/chunk-ZBR7RQQE.mjs +64 -0
  62. package/chunks/chunk-ZUHJIGHP.mjs +300 -0
  63. package/chunks/deflate-IINN6MRE.mjs +19 -0
  64. package/chunks/jpeg-N3DSYEAQ.mjs +964 -0
  65. package/chunks/jxl_oxide_wasm-3UN6G3YN.mjs +589 -0
  66. package/chunks/lerc-5LP7Q554.mjs +2086 -0
  67. package/chunks/lzw-Z2ZZBEWD.mjs +137 -0
  68. package/chunks/packbits-3S2JASDB.mjs +34 -0
  69. package/chunks/pdf.worker-PUGU2NS2.mjs +67416 -0
  70. package/chunks/probe-22WNVZ3I.mjs +17 -0
  71. package/chunks/probe-2P4CTFCY.mjs +14 -0
  72. package/chunks/probe-2QBNDPYK.mjs +18 -0
  73. package/chunks/probe-34TOVXUI.mjs +11 -0
  74. package/chunks/probe-3W2HOWBM.mjs +20 -0
  75. package/chunks/probe-42OBMD35.mjs +23 -0
  76. package/chunks/probe-43RVHUBG.mjs +17 -0
  77. package/chunks/probe-4O362IEX.mjs +18 -0
  78. package/chunks/probe-4WF34ZXS.mjs +11 -0
  79. package/chunks/probe-5ZITS3T5.mjs +40 -0
  80. package/chunks/probe-5ZS5DHFP.mjs +21 -0
  81. package/chunks/probe-62RFYKCP.mjs +14 -0
  82. package/chunks/probe-64JTFRH4.mjs +41 -0
  83. package/chunks/probe-6YJQJJ3R.mjs +518 -0
  84. package/chunks/probe-6YMOOV53.mjs +39 -0
  85. package/chunks/probe-BYBD2WAK.mjs +239 -0
  86. package/chunks/probe-CZZNJOHV.mjs +20 -0
  87. package/chunks/probe-DJMPK6HU.mjs +11 -0
  88. package/chunks/probe-FMWIF4LX.mjs +33 -0
  89. package/chunks/probe-FYPH6CYY.mjs +206 -0
  90. package/chunks/probe-G6PPXKBE.mjs +15 -0
  91. package/chunks/probe-GJ5OUOQ3.mjs +32 -0
  92. package/chunks/probe-H6J7TUY2.mjs +95 -0
  93. package/chunks/probe-IGZ47OE3.mjs +68 -0
  94. package/chunks/probe-IL5HO3OK.mjs +46 -0
  95. package/chunks/probe-INYCDZHO.mjs +27 -0
  96. package/chunks/probe-JFH545GO.mjs +11 -0
  97. package/chunks/probe-JZYDRITV.mjs +18 -0
  98. package/chunks/probe-K3WW5O5K.mjs +26 -0
  99. package/chunks/probe-KB4T466L.mjs +70 -0
  100. package/chunks/probe-KY7SIIXD.mjs +13 -0
  101. package/chunks/probe-L2P263WT.mjs +16 -0
  102. package/chunks/probe-LEP3RQPD.mjs +11 -0
  103. package/chunks/probe-M2QWULOI.mjs +119 -0
  104. package/chunks/probe-M7AYZBD3.mjs +35 -0
  105. package/chunks/probe-MEN3BMBB.mjs +22 -0
  106. package/chunks/probe-MNIGKDWT.mjs +163 -0
  107. package/chunks/probe-NFVFWB4M.mjs +56 -0
  108. package/chunks/probe-NJGSTL6R.mjs +161 -0
  109. package/chunks/probe-O73EHWT3.mjs +14 -0
  110. package/chunks/probe-OG2XYCG2.mjs +25 -0
  111. package/chunks/probe-OTKJKTNS.mjs +10 -0
  112. package/chunks/probe-OZKO3C2V.mjs +27 -0
  113. package/chunks/probe-PBL4KITG.mjs +12 -0
  114. package/chunks/probe-PEFZNH2T.mjs +21 -0
  115. package/chunks/probe-R4SSEXES.mjs +27 -0
  116. package/chunks/probe-RCAUVV27.mjs +29 -0
  117. package/chunks/probe-RPGBKGPI.mjs +20 -0
  118. package/chunks/probe-S2I46SEO.mjs +10 -0
  119. package/chunks/probe-SGDD4U4Q.mjs +165 -0
  120. package/chunks/probe-SPQO5LHI.mjs +9 -0
  121. package/chunks/probe-TBR6UGRZ.mjs +19 -0
  122. package/chunks/probe-TNKNILAW.mjs +21 -0
  123. package/chunks/probe-TVRJBPXH.mjs +48 -0
  124. package/chunks/probe-UESMTUQ5.mjs +33 -0
  125. package/chunks/probe-VDXFEZ5Q.mjs +16 -0
  126. package/chunks/probe-VX7JCDW6.mjs +39 -0
  127. package/chunks/probe-W7M55OPE.mjs +64 -0
  128. package/chunks/probe-XUBTIWGE.mjs +13 -0
  129. package/chunks/probe-ZF7KIRHO.mjs +36 -0
  130. package/chunks/raw-JJRPYAXO.mjs +16 -0
  131. package/chunks/tiff-metadata-7MWLNVW2.mjs +2990 -0
  132. package/chunks/webimage-D6XSCCTJ.mjs +56 -0
  133. package/chunks/zip-reader-YUGANW4Z.mjs +92 -0
  134. package/chunks/zstd-AH2S24PU.mjs +121 -0
  135. package/cli-main.mjs +278 -0
  136. package/cli.mjs +3 -0
  137. package/extractors/apple-plist.mjs +145 -0
  138. package/extractors/archive-metadata-viewer.mjs +1401 -0
  139. package/extractors/bittorrent-metadata.mjs +369 -0
  140. package/extractors/calendar-contacts.mjs +328 -0
  141. package/extractors/camera-raw.mjs +201 -0
  142. package/extractors/chm-reader.mjs +1842 -0
  143. package/extractors/comic-book-reader.mjs +307 -0
  144. package/extractors/design-source.mjs +1801 -0
  145. package/extractors/dev-array-viewer.mjs +825 -0
  146. package/extractors/dev-native-binary-viewer.mjs +1661 -0
  147. package/extractors/dev-source-map-viewer.mjs +416 -0
  148. package/extractors/dev-wasm-viewer.mjs +506 -0
  149. package/extractors/dicom.mjs +383 -0
  150. package/extractors/djvu-reader.mjs +337 -0
  151. package/extractors/duckdb-data.mjs +49174 -0
  152. package/extractors/epub-reader.mjs +222 -0
  153. package/extractors/excel-workbook.mjs +27057 -0
  154. package/extractors/fictionbook-reader.mjs +362 -0
  155. package/extractors/font-viewer.mjs +441 -0
  156. package/extractors/general-raster.mjs +444 -0
  157. package/extractors/hdr-image.mjs +1685 -0
  158. package/extractors/http-archive.mjs +306 -0
  159. package/extractors/ifc.mjs +341 -0
  160. package/extractors/iwork.mjs +640 -0
  161. package/extractors/microsoft-project.mjs +174 -0
  162. package/extractors/mind-map.mjs +607 -0
  163. package/extractors/ml-weights.mjs +649 -0
  164. package/extractors/modern-raster.mjs +620 -0
  165. package/extractors/ofd-reader.mjs +973 -0
  166. package/extractors/outlook-pst.mjs +997 -0
  167. package/extractors/pdfjs-pdf.mjs +32056 -0
  168. package/extractors/photoshop-document.mjs +17448 -0
  169. package/extractors/safe-svg.mjs +163 -0
  170. package/extractors/scientific-data.mjs +2041 -0
  171. package/extractors/sqlite-database.mjs +333 -0
  172. package/extractors/statistical-data.mjs +297 -0
  173. package/extractors/visio.mjs +141 -0
  174. package/extractors/x509-certificate.mjs +588 -0
  175. package/extractors/xps-reader.mjs +896 -0
  176. package/index.mjs +83 -0
  177. package/licenses/dicom-parser/1.8.21/LICENSE +21 -0
  178. package/licenses/libraw-wasm/1.6.0/COPYRIGHT.LibRaw +27 -0
  179. package/licenses/libraw-wasm/1.6.0/LICENSE.Emscripten +102 -0
  180. package/licenses/libraw-wasm/1.6.0/LICENSE.LibRaw-CDDL-1.0 +340 -0
  181. package/licenses/libraw-wasm/1.6.0/LICENSE.Little-CMS-MIT +22 -0
  182. package/licenses/libraw-wasm/1.6.0/LICENSE.libpng +134 -0
  183. package/licenses/libraw-wasm/1.6.0/LICENSE.libraw-wasm-ISC +15 -0
  184. package/licenses/libraw-wasm/1.6.0/LICENSE.zlib +22 -0
  185. package/licenses/libraw-wasm/1.6.0/NOTICE.IJG-libjpeg +49 -0
  186. package/licenses/libraw-wasm/1.6.0/SOURCE.md +25 -0
  187. package/licenses/libraw-wasm/1.6.0/THIRD_PARTY_NOTICES.md +14 -0
  188. package/licenses/mediabunny/1.55.3/MPL-2.0.txt +373 -0
  189. package/licenses/mediabunny/1.55.3/SOURCE.md +16 -0
  190. package/licenses/openskp/1.3.0/LICENSE +21 -0
  191. package/package.json +33 -3
  192. package/renderer-host/assets/ColladaComposer-TCm9fgZa.js +1 -0
  193. package/renderer-host/assets/ColladaParser-BHTzbhBz.js +3 -0
  194. package/renderer-host/assets/FBXLoader-D1vDnL3o.js +8 -0
  195. package/renderer-host/assets/agent-CKvDbj87.js +1 -0
  196. package/renderer-host/assets/amf-CLBaywBr.js +1 -0
  197. package/renderer-host/assets/animation-DnPo99To.js +1 -0
  198. package/renderer-host/assets/archive-client-CyhEmSF7.js +1 -0
  199. package/renderer-host/assets/archive.worker-CcLnJ9FC.js +1 -0
  200. package/renderer-host/assets/audio-visualizer-CiyGNhY2.js +1 -0
  201. package/renderer-host/assets/basedecoder-BuG7fe0q.js +1 -0
  202. package/renderer-host/assets/book-source-28BQcBKR.js +1 -0
  203. package/renderer-host/assets/book-worker-DrtzCzPo.js +1 -0
  204. package/renderer-host/assets/browser-C0pGRq_c.js +1 -0
  205. package/renderer-host/assets/client-Dp-p4unY.js +1 -0
  206. package/renderer-host/assets/container-inspection-DZoaDYQR.js +1 -0
  207. package/renderer-host/assets/data-table-OJQe3aN5.js +1 -0
  208. package/renderer-host/assets/decode-D5vB6JN8.js +1 -0
  209. package/renderer-host/assets/decode-tiff-BuYdKp6p.js +5 -0
  210. package/renderer-host/assets/decoder-worker-B0sdTVlF.js +1 -0
  211. package/renderer-host/assets/decoder-worker-CBiHE971.js +3 -0
  212. package/renderer-host/assets/decoder-worker-Cr5oP97p.js +5 -0
  213. package/renderer-host/assets/decoder-worker-DIdLFebY.js +11 -0
  214. package/renderer-host/assets/decoder-worker-DLeuEYxq.js +1 -0
  215. package/renderer-host/assets/decoder.worker-BXAaF0Qj.js +1 -0
  216. package/renderer-host/assets/decoder.worker-yaM6uups.js +1 -0
  217. package/renderer-host/assets/deflate-DPjr4M2G.js +1 -0
  218. package/renderer-host/assets/deflate-S3QmZI-f.js +1 -0
  219. package/renderer-host/assets/dual-track-playback-lNQyU1GR.js +1 -0
  220. package/renderer-host/assets/ext-searchbox-BIdon51Z.js +164 -0
  221. package/renderer-host/assets/ffmpeg-playback-QcT_NwlK.js +1 -0
  222. package/renderer-host/assets/gltf-Cqq-xStc.js +1 -0
  223. package/renderer-host/assets/hdf5.worker-BO3TrRup.js +1 -0
  224. package/renderer-host/assets/heif-worker-CC9DI3ZR.js +1 -0
  225. package/renderer-host/assets/id3-uzaDmDwy.js +1 -0
  226. package/renderer-host/assets/ifc.worker-KIbgAIsy.js +1 -0
  227. package/renderer-host/assets/image-load-B1fNI3iO.js +1 -0
  228. package/renderer-host/assets/index-BCxD9rBl.js +2 -0
  229. package/renderer-host/assets/jpeg-AGQ46WDa.js +1 -0
  230. package/renderer-host/assets/jpeg-Dm0yBuYB.js +1 -0
  231. package/renderer-host/assets/jszip.min-DCdQ6XWv.js +2 -0
  232. package/renderer-host/assets/jxl_oxide_wasm-BJKDqoXP.js +1 -0
  233. package/renderer-host/assets/jxl_oxide_wasm_bg-C5JqlrFv.wasm +0 -0
  234. package/renderer-host/assets/kernel.worker-B58X9XWu.js +1 -0
  235. package/renderer-host/assets/kernel.worker-BcQYKb39.js +8 -0
  236. package/renderer-host/assets/kernel.worker-BdWmPdqg.js +1 -0
  237. package/renderer-host/assets/kernel.worker-C7qxomuK.js +1 -0
  238. package/renderer-host/assets/kernel.worker-D88TbQnz.js +1 -0
  239. package/renderer-host/assets/laz-Lt10LsWd.js +1 -0
  240. package/renderer-host/assets/lerc-BxVqCKaH.js +3 -0
  241. package/renderer-host/assets/lerc-CRhfhhOS.js +1 -0
  242. package/renderer-host/assets/lzw-D2FslT4L.js +1 -0
  243. package/renderer-host/assets/lzw-DODNa9l5.js +1 -0
  244. package/renderer-host/assets/mediabunny-viewer-BnJM6Yo0.js +16 -0
  245. package/renderer-host/assets/model-D2YSoRt5.js +1 -0
  246. package/renderer-host/assets/obj-DbUZkDna.js +9 -0
  247. package/renderer-host/assets/off-CzR_R_Tf.js +1 -0
  248. package/renderer-host/assets/ogg-probe-C2TT74FL.js +1 -0
  249. package/renderer-host/assets/ogg-viewer-CT31JEhG.js +9 -0
  250. package/renderer-host/assets/packbits-DCimUQ1T.js +1 -0
  251. package/renderer-host/assets/paged-CX-N_Pzy.js +319 -0
  252. package/renderer-host/assets/pako.esm-0UYEm1Jg.js +2 -0
  253. package/renderer-host/assets/pako.esm-CtVA0R7W.js +1 -0
  254. package/renderer-host/assets/pdf.worker.min-CHFwMXne.mjs +29 -0
  255. package/renderer-host/assets/ply-C-xrhUaO.js +2 -0
  256. package/renderer-host/assets/points.worker-CA8v75dl.js +2 -0
  257. package/renderer-host/assets/probe-asf-CvcaYQaR.js +14 -0
  258. package/renderer-host/assets/range-reader-9PeAh1Hv.js +1 -0
  259. package/renderer-host/assets/raw-A-vJRPpa.js +1 -0
  260. package/renderer-host/assets/resource-cache-CHocY8K3.js +1 -0
  261. package/renderer-host/assets/resources-WcZvn3-C.js +1 -0
  262. package/renderer-host/assets/rolldown-runtime-Dd_uD5pT.js +1 -0
  263. package/renderer-host/assets/safe-content-B61Ktgzp.js +1 -0
  264. package/renderer-host/assets/sanitize-D56ODnaM.js +1 -0
  265. package/renderer-host/assets/scene-adapter-CmaaVwsM.js +1 -0
  266. package/renderer-host/assets/scene.worker-CJViWLYo.js +24 -0
  267. package/renderer-host/assets/scene.worker-D7koFZY8.js +2 -0
  268. package/renderer-host/assets/skp-adapter-ByI1iX8S.js +1 -0
  269. package/renderer-host/assets/skp.worker-D9ujTXFV.js +1 -0
  270. package/renderer-host/assets/src-0DTp6SF8.js +1 -0
  271. package/renderer-host/assets/src-0QHjkpy0.js +44 -0
  272. package/renderer-host/assets/src-2X3Gt6Lk.js +2 -0
  273. package/renderer-host/assets/src-2tfD0huT.js +16 -0
  274. package/renderer-host/assets/src-5ZJshveh.js +29 -0
  275. package/renderer-host/assets/src-9k3CCYnZ.js +1 -0
  276. package/renderer-host/assets/src-B0zJlB0C.js +27 -0
  277. package/renderer-host/assets/src-B4jorJ2U.js +100 -0
  278. package/renderer-host/assets/src-BB6xj1UK.js +18 -0
  279. package/renderer-host/assets/src-BEn15PBT.js +52 -0
  280. package/renderer-host/assets/src-BLndk63N.js +7 -0
  281. package/renderer-host/assets/src-BMrLVJyB.js +169 -0
  282. package/renderer-host/assets/src-BPG8SYXq.js +10 -0
  283. package/renderer-host/assets/src-BZrNtUNO.js +2 -0
  284. package/renderer-host/assets/src-B_o7QilB.js +58 -0
  285. package/renderer-host/assets/src-BgM1jpe4.js +5 -0
  286. package/renderer-host/assets/src-BgUXah8O.js +1 -0
  287. package/renderer-host/assets/src-Bl5Lv4-d.js +1 -0
  288. package/renderer-host/assets/src-Blx9jp9x.js +90 -0
  289. package/renderer-host/assets/src-Bu1cTJNz.js +64 -0
  290. package/renderer-host/assets/src-BuN3y1yE.js +24 -0
  291. package/renderer-host/assets/src-Bw-O8ujJ.js +2 -0
  292. package/renderer-host/assets/src-BwZAUudm.js +2 -0
  293. package/renderer-host/assets/src-BydeR01n.js +1 -0
  294. package/renderer-host/assets/src-C2LKqLBA.js +182 -0
  295. package/renderer-host/assets/src-C4t_UvT8.js +8 -0
  296. package/renderer-host/assets/src-C5k8Ydia.js +1 -0
  297. package/renderer-host/assets/src-C6w9FGSB.js +1 -0
  298. package/renderer-host/assets/src-C9Uz3C-q.js +432 -0
  299. package/renderer-host/assets/src-CAdKRH5C.js +37 -0
  300. package/renderer-host/assets/src-CBE5sqjl.js +7 -0
  301. package/renderer-host/assets/src-CBo2yHRk.js +21 -0
  302. package/renderer-host/assets/src-CGx0nUS5.js +24 -0
  303. package/renderer-host/assets/src-CHNgoDf9.js +10 -0
  304. package/renderer-host/assets/src-CIDWSV97.js +1 -0
  305. package/renderer-host/assets/src-CPUYqpHZ.js +9 -0
  306. package/renderer-host/assets/src-CVc67mQv.js +1 -0
  307. package/renderer-host/assets/src-CXRrmfb0.js +7 -0
  308. package/renderer-host/assets/src-C_1M1IDo.js +8 -0
  309. package/renderer-host/assets/src-C_HAB_bn.js +5 -0
  310. package/renderer-host/assets/src-CeGmxOTi.js +1 -0
  311. package/renderer-host/assets/src-CifsQr3m.js +222 -0
  312. package/renderer-host/assets/src-Ck1ekdEN.js +1 -0
  313. package/renderer-host/assets/src-ClIHDiJ4.js +27 -0
  314. package/renderer-host/assets/src-Cvb3aCDG.js +10 -0
  315. package/renderer-host/assets/src-Cyw_3X-L.js +989 -0
  316. package/renderer-host/assets/src-D3OyeoQs.js +1 -0
  317. package/renderer-host/assets/src-D4cv_-u0.js +1 -0
  318. package/renderer-host/assets/src-DPm7_lsi.js +24 -0
  319. package/renderer-host/assets/src-DZE9IoBl.js +88 -0
  320. package/renderer-host/assets/src-DmzigsPg.js +7 -0
  321. package/renderer-host/assets/src-DpEmkhrn.js +6 -0
  322. package/renderer-host/assets/src-DrYYfoQO.js +7 -0
  323. package/renderer-host/assets/src-DsVDi0pr.js +4126 -0
  324. package/renderer-host/assets/src-ORHZWeVF.js +2 -0
  325. package/renderer-host/assets/src-Q-oKL3Dw.js +10 -0
  326. package/renderer-host/assets/src-QXdjrTaw.js +4 -0
  327. package/renderer-host/assets/src-R4bKlaNn.js +387 -0
  328. package/renderer-host/assets/src-TbSq3WSr.js +115 -0
  329. package/renderer-host/assets/src-TuTvYAR6.js +11 -0
  330. package/renderer-host/assets/src-eVKtGm4Q.js +17 -0
  331. package/renderer-host/assets/src-efHN2oAJ.js +17 -0
  332. package/renderer-host/assets/src-hCrza_Lf.js +1 -0
  333. package/renderer-host/assets/src-j_mEQ9Os.js +9 -0
  334. package/renderer-host/assets/src-lYIAi6Hw.js +1 -0
  335. package/renderer-host/assets/src-n2gsf381.js +20 -0
  336. package/renderer-host/assets/src-p14e1hma.js +23 -0
  337. package/renderer-host/assets/src-rJN_jaC5.js +1 -0
  338. package/renderer-host/assets/src-vPHMg1Fp.js +1 -0
  339. package/renderer-host/assets/src-wrrVkfrK.js +1 -0
  340. package/renderer-host/assets/stl-adapter-D1eozFH9.js +1 -0
  341. package/renderer-host/assets/stl.worker-C-anHijM.js +1 -0
  342. package/renderer-host/assets/three-mf-CbcWWdM8.js +2 -0
  343. package/renderer-host/assets/webimage-zQMH-_zR.js +1 -0
  344. package/renderer-host/assets/webm-_wYh_V7u.js +1 -0
  345. package/renderer-host/assets/worker-QK2gViTu.js +1 -0
  346. package/renderer-host/assets/x6-dng-worker-CNf3zUP-.js +1 -0
  347. package/renderer-host/assets/xml.browser-CC8-XAyN.js +1 -0
  348. package/renderer-host/assets/zip-core-base-CDv8KjIR.js +1 -0
  349. package/renderer-host/assets/zip-core-custom-D3VVVj-J.js +1 -0
  350. package/renderer-host/assets/zip-source-C5dFTDt7.js +1 -0
  351. package/renderer-host/assets/zstd-CmwSLjHB.js +1 -0
  352. package/renderer-host/assets/zstd-i4Jwubnx.js +1 -0
  353. package/renderer-host/index.html +65 -0
  354. package/vendor-manifest.json +1433 -0
  355. package/worker.mjs +261 -0
@@ -0,0 +1,607 @@
1
+ import { createRequire as __anyfileCreateRequire } from "node:module"; import { dirname as __anyfileDirname } from "node:path"; import { fileURLToPath as __anyfileFileURLToPath } from "node:url"; const require = __anyfileCreateRequire(import.meta.url); const __filename = __anyfileFileURLToPath(import.meta.url); const __dirname = __anyfileDirname(__filename);
2
+ import {
3
+ sanitizeSvg
4
+ } from "../chunks/chunk-3OZ56PUH.mjs";
5
+ import {
6
+ openBookZip
7
+ } from "../chunks/chunk-NGVHHTQD.mjs";
8
+ import {
9
+ readBookZipCatalog
10
+ } from "../chunks/chunk-ZBR7RQQE.mjs";
11
+ import "../chunks/chunk-KSKEMJVC.mjs";
12
+ import "../chunks/chunk-XDW56XVX.mjs";
13
+ import "../chunks/chunk-D3CS6TIK.mjs";
14
+ import "../chunks/chunk-WWTLSPEG.mjs";
15
+ import {
16
+ ProtectedBookError
17
+ } from "../chunks/chunk-BP7LORL4.mjs";
18
+ import {
19
+ parseXmlDocument
20
+ } from "../chunks/chunk-53MJMIN4.mjs";
21
+ import {
22
+ AgentError,
23
+ ViewerError,
24
+ abortError,
25
+ isViewerAbortError,
26
+ markdownDocumentHeader,
27
+ readPagedTextDocument
28
+ } from "../chunks/chunk-IC3G2XE2.mjs";
29
+ import "../chunks/chunk-ORJ3DN65.mjs";
30
+
31
+ // ../plugins/mind-map/src/assets.ts
32
+ var MAX_ASSET = 16 * 1024 ** 2;
33
+ var MAX_TOTAL = 64 * 1024 ** 2;
34
+ var mimeTypes = { png: "image/png", jpg: "image/jpeg", jpeg: "image/jpeg", gif: "image/gif", webp: "image/webp", svg: "image/svg+xml" };
35
+ async function loadAssets(sheets, signal, zip, workspace) {
36
+ const assets = /* @__PURE__ */ new Map(), attachmentText = /* @__PURE__ */ new Map();
37
+ const images = /* @__PURE__ */ new Set(), attachments = /* @__PURE__ */ new Map();
38
+ function visit(t) {
39
+ if (t.image) images.add(t.image);
40
+ for (const a of t.attachments) attachments.set(a.path, a.name);
41
+ t.children.forEach(visit);
42
+ }
43
+ sheets.forEach((s) => visit(s.root));
44
+ let total = 0;
45
+ for (const reference of /* @__PURE__ */ new Set([...images, ...attachments.keys()])) {
46
+ if (signal.aborted) throw new DOMException("Aborted", "AbortError");
47
+ const inline = /^data:(image\/(?:png|jpeg|gif|webp));base64,([A-Za-z0-9+/=]+)$/.exec(reference);
48
+ if (inline) {
49
+ if (inline[2].length > MAX_ASSET * 4 / 3 + 4) throw new ViewerError("resource-limit", "Mind map resource limit exceeded.");
50
+ const bytes2 = Uint8Array.from(atob(inline[2]), (c) => c.charCodeAt(0));
51
+ total += bytes2.byteLength;
52
+ if (total > MAX_TOTAL) throw new ViewerError("resource-limit", "Mind map resource limit exceeded.");
53
+ assets.set(reference, new Blob([bytes2], { type: inline[1] }));
54
+ continue;
55
+ }
56
+ if (!zip && reference.startsWith("/")) continue;
57
+ const path = reference.replace(/^xap:/, "").replace(/^\//, "");
58
+ if (!path || /[\\:]/.test(path) || path.split("/").some((p) => !p || p === "." || p === "..")) continue;
59
+ const extension = (attachments.get(reference) || path).split(".").pop()?.toLowerCase() || "";
60
+ let mime = mimeTypes[extension];
61
+ const isText = /^(txt|md|csv|json|xml|log)$/.test(extension);
62
+ if (!mime && !isText && !images.has(reference)) continue;
63
+ let bytes;
64
+ if (zip?.entries.has(path)) bytes = await zip.read(path, MAX_ASSET, signal);
65
+ else if (!zip && workspace) {
66
+ const file = await workspace.open(path, { signal });
67
+ if (!file) continue;
68
+ if (file.size > MAX_ASSET) throw new ViewerError("resource-limit", "Mind map resource limit exceeded.");
69
+ bytes = new Uint8Array(await file.arrayBuffer());
70
+ }
71
+ if (!bytes) continue;
72
+ total += bytes.byteLength;
73
+ if (total > MAX_TOTAL) throw new ViewerError("resource-limit", "Mind map resource limit exceeded.");
74
+ if (signal.aborted) throw new DOMException("Aborted", "AbortError");
75
+ if (!mime && images.has(reference)) {
76
+ if (bytes[0] === 137 && bytes[1] === 80 && bytes[2] === 78 && bytes[3] === 71) mime = "image/png";
77
+ else if (bytes[0] === 255 && bytes[1] === 216) mime = "image/jpeg";
78
+ else if (bytes[0] === 71 && bytes[1] === 73 && bytes[2] === 70) mime = "image/gif";
79
+ }
80
+ if (mime === "image/svg+xml") {
81
+ const clean = sanitizeSvg(bytes);
82
+ if (clean) assets.set(reference, new Blob([clean.source], { type: mime }));
83
+ } else if (mime) assets.set(reference, new Blob([bytes], { type: mime }));
84
+ else if (isText && bytes.length <= 1024 ** 2) attachmentText.set(reference, new TextDecoder().decode(bytes));
85
+ }
86
+ sheets.forEach((s) => {
87
+ s.assets = assets;
88
+ s.attachmentText = attachmentText;
89
+ });
90
+ }
91
+
92
+ // ../plugins/mind-map/src/model.ts
93
+ var finite = (value) => {
94
+ if (value === null || value === void 0 || value === "") return void 0;
95
+ const n = Number(value);
96
+ return Number.isFinite(n) && Math.abs(n) <= 1e6 ? n : void 0;
97
+ };
98
+ function color(value) {
99
+ return typeof value === "string" && /^#[\da-f]{3,8}$/i.test(value) ? value : void 0;
100
+ }
101
+
102
+ // ../plugins/mind-map/src/visual-data.ts
103
+ var obj = (v) => v && typeof v === "object" && !Array.isArray(v) ? v : {};
104
+ var str = (v) => typeof v === "string" ? v : "";
105
+ var arr = (v) => Array.isArray(v) ? v : [];
106
+ var direct = (e, name) => e ? Array.from(e.children).filter((c) => c.localName === name) : [];
107
+ var first = (e, name) => direct(e, name)[0];
108
+ var attr = (e, name) => e ? Array.from(e.attributes).find((a) => a.localName === name)?.value ?? "" : "";
109
+ var managerColor = (v) => /^[\da-f]{8}$/i.test(v) ? `#${v.slice(2)}${v.slice(0, 2)}` : void 0;
110
+ function range(value) {
111
+ const match = /^\((\d+),(\d+)\)$/.exec(value);
112
+ return match ? { start: Number(match[1]), end: Number(match[2]) } : void 0;
113
+ }
114
+ function jsonVisual(topic, data) {
115
+ topic.id = str(data.id) || topic.id;
116
+ topic.structure = str(data.structureClass);
117
+ topic.folded = data.branch === "folded";
118
+ const position = obj(data.position), x = finite(position.x), y = finite(position.y);
119
+ if (x !== void 0 && y !== void 0) topic.position = { x, y };
120
+ const p = obj(obj(data.style).properties);
121
+ topic.style = {
122
+ color: color(p["fo:color"]),
123
+ fill: color(p["svg:fill"]),
124
+ stroke: color(p["line-color"]),
125
+ fontSize: finite(str(p["fo:font-size"]).replace(/pt$/, "")),
126
+ bold: p["fo:font-weight"] === "bold",
127
+ italic: p["fo:font-style"] === "italic",
128
+ shape: str(p["shape-class"])
129
+ };
130
+ if (topic.link.startsWith("xap:")) topic.attachments.push({ name: topic.title || topic.link.split("/").pop(), path: topic.link });
131
+ const image = obj(data.image);
132
+ topic.image = str(image.src) || void 0;
133
+ topic.imageWidth = finite(image.width);
134
+ topic.imageHeight = finite(image.height);
135
+ topic.markers = arr(data.markers).map((m) => str(obj(m).markerId)).filter(Boolean);
136
+ topic.labels = arr(data.labels).map(str).filter(Boolean);
137
+ for (const [key, value] of Object.entries(obj(data.task))) if (typeof value === "string" || typeof value === "number") topic.metadata[key] = String(value);
138
+ for (const entry of arr(data.boundaries)) {
139
+ const b = obj(entry), r = range(str(b.range));
140
+ if (r) topic.boundaries.push({ ...r, title: str(b.title) });
141
+ }
142
+ for (const entry of arr(data.summaries)) {
143
+ const b = obj(entry), r = range(str(b.range));
144
+ if (r) topic.boundaries.push({ ...r, title: "", summaryId: str(b.topicId) });
145
+ }
146
+ }
147
+ function jsonRelationships(value) {
148
+ return arr(value).map((v) => {
149
+ const r = obj(v);
150
+ return { from: str(r.end1Id), to: str(r.end2Id), title: str(r.title) };
151
+ });
152
+ }
153
+ function xmlVisual(topic, element, format) {
154
+ topic.id = attr(element, format === "mm" ? "ID" : format === "mmap" ? "OId" : "id") || topic.id;
155
+ if (format === "mm") {
156
+ const font = first(element, "font"), edge = first(element, "edge");
157
+ topic.style = {
158
+ color: color(attr(element, "COLOR")),
159
+ fill: color(attr(element, "BACKGROUND_COLOR")),
160
+ stroke: color(attr(edge, "COLOR")),
161
+ fontSize: finite(attr(font, "SIZE")),
162
+ bold: attr(font, "BOLD") === "true",
163
+ italic: attr(font, "ITALIC") === "true",
164
+ shape: attr(element, "STYLE")
165
+ };
166
+ topic.direction = attr(element, "POSITION") === "left" ? "left" : attr(element, "POSITION") === "right" ? "right" : void 0;
167
+ topic.folded = attr(element, "FOLDED") === "true";
168
+ topic.markers = direct(element, "icon").map((e) => attr(e, "BUILTIN"));
169
+ topic.relationships = direct(element, "arrowlink").map((e) => ({ from: topic.id, to: attr(e, "DESTINATION"), title: attr(e, "MIDDLE_LABEL") }));
170
+ for (const e of direct(element, "attribute")) topic.metadata[attr(e, "NAME")] = attr(e, "VALUE");
171
+ const image = Array.from(element.querySelectorAll("richcontent img")).find((e) => e.closest("node") === element);
172
+ topic.image = attr(image, "src") || void 0;
173
+ topic.imageWidth = finite(attr(image, "width"));
174
+ topic.imageHeight = finite(attr(image, "height"));
175
+ } else if (format === "mmap") {
176
+ const font = first(first(element, "Text"), "Font"), c = first(element, "Color");
177
+ topic.style = {
178
+ color: managerColor(attr(font, "Color")),
179
+ fill: managerColor(attr(c, "FillColor")),
180
+ stroke: managerColor(attr(c, "LineColor")),
181
+ fontSize: finite(attr(font, "Size")),
182
+ bold: attr(font, "Bold") === "true",
183
+ italic: attr(font, "Italic") === "true",
184
+ shape: attr(first(element, "SubTopicShape") ?? first(element, "TopicShape"), "SubTopicShape")
185
+ };
186
+ topic.folded = attr(first(first(element, "TopicViewGroup"), "Collapsed"), "Collapsed") === "true";
187
+ const shape = first(element, "SubTopicsShape");
188
+ topic.structure = attr(shape, "SubTopicsGrowthDirection");
189
+ if (topic.structure.endsWith(":Right")) topic.structure = "logic.right";
190
+ if (topic.structure.endsWith(":Left")) topic.structure = "logic.left";
191
+ if (topic.structure.endsWith(":Left")) topic.direction = "left";
192
+ if (topic.structure.endsWith(":Right")) topic.direction = "right";
193
+ const position = first(element, "Position");
194
+ const x = finite(attr(position, "X")), y = finite(attr(position, "Y"));
195
+ if (x !== void 0 && y !== void 0) topic.position = { x: x * 3.78, y: y * 3.78 };
196
+ for (const group of direct(element, "Task")) for (const a of Array.from(group.attributes)) {
197
+ if (!["Dirty", "Gen", "OId"].includes(a.name)) topic.metadata[a.localName] = a.value;
198
+ }
199
+ for (const group of direct(element, "TaskGroup")) for (const e of Array.from(group.children)) for (const a of Array.from(e.attributes)) {
200
+ if (!["Dirty", "Gen", "OId"].includes(a.name)) topic.metadata[a.localName] = a.value;
201
+ }
202
+ const image = first(first(element, "OneImage"), "Image");
203
+ const imageData = first(image, "ImageData");
204
+ topic.image = attr(imageData, "ExternalBinaryLocation") || void 0;
205
+ if (!topic.image) {
206
+ const mime = { "urn:mindjet:PngImage": "image/png", "urn:mindjet:JpegImage": "image/jpeg", "urn:mindjet:GifImage": "image/gif" }[attr(imageData, "ImageType")];
207
+ const encoded = first(imageData, "Base64")?.textContent?.replace(/\s/g, "");
208
+ if (mime && encoded) topic.image = `data:${mime};base64,${encoded}`;
209
+ }
210
+ topic.imageWidth = finite(attr(first(image, "ImageSize"), "Width"));
211
+ topic.imageHeight = finite(attr(first(image, "ImageSize"), "Height"));
212
+ topic.attachments = direct(first(element, "AttachmentGroup"), "AttachmentData").map((e) => ({ name: attr(e, "FileName"), path: attr(e, "ExternalBinaryLocation") }));
213
+ topic.labels = direct(first(element, "TextLabels"), "TextLabel").map((e) => attr(e, "TextLabelName"));
214
+ } else {
215
+ if (topic.link.startsWith("xap:")) topic.attachments.push({ name: topic.title || topic.link.split("/").pop(), path: topic.link });
216
+ topic.structure = attr(element, "structure-class");
217
+ topic.folded = attr(element, "branch") === "folded";
218
+ const position = first(element, "position"), x = finite(attr(position, "x")), y = finite(attr(position, "y"));
219
+ if (x !== void 0 && y !== void 0) topic.position = { x, y };
220
+ const image = first(element, "img");
221
+ topic.image = image?.getAttributeNS("http://www.w3.org/1999/xlink", "src") || attr(image, "src") || void 0;
222
+ topic.imageWidth = finite(attr(image, "width"));
223
+ topic.imageHeight = finite(attr(image, "height"));
224
+ topic.markers = direct(first(element, "marker-refs"), "marker-ref").map((e) => attr(e, "marker-id"));
225
+ topic.labels = direct(first(element, "labels"), "label").map((e) => e.textContent ?? "");
226
+ for (const e of direct(first(element, "boundaries"), "boundary")) {
227
+ const r = range(attr(e, "range"));
228
+ if (r) topic.boundaries.push({ ...r, title: first(e, "title")?.textContent ?? "" });
229
+ }
230
+ for (const e of direct(first(element, "summaries"), "summary")) {
231
+ const r = range(attr(e, "range"));
232
+ if (r) topic.boundaries.push({ ...r, title: "", summaryId: attr(e, "topic-id") });
233
+ }
234
+ }
235
+ }
236
+ function xmlRelationships(sheet) {
237
+ return direct(first(sheet, "relationships"), "relationship").map((e) => ({ from: attr(e, "end1"), to: attr(e, "end2"), title: first(e, "title")?.textContent ?? "" }));
238
+ }
239
+ function kind(value) {
240
+ return ["detached", "summary", "callout"].includes(value) ? value : "attached";
241
+ }
242
+ function applyLegacyStyles(sheets, source) {
243
+ const doc = parseXmlDocument(source, "application/xml");
244
+ const styles = new Map(Array.from(doc.getElementsByTagNameNS("*", "style")).map((e) => [attr(e, "id"), first(e, "topic-properties")]));
245
+ function visit(t) {
246
+ const p = styles.get(t.metadata.styleId);
247
+ if (p) t.style = {
248
+ color: color(attr(p, "color")),
249
+ fill: color(attr(p, "fill")),
250
+ stroke: color(attr(p, "line-color")),
251
+ fontSize: finite(attr(p, "font-size").replace(/pt$/, "")),
252
+ bold: attr(p, "font-weight") === "bold",
253
+ italic: attr(p, "font-style") === "italic",
254
+ shape: attr(p, "shape-class")
255
+ };
256
+ delete t.metadata.styleId;
257
+ t.children.forEach(visit);
258
+ }
259
+ sheets.forEach((s) => visit(s.root));
260
+ }
261
+ function managerRelationships(root) {
262
+ return direct(first(root, "Relationships"), "Relationship").map((e) => {
263
+ const ends = direct(e, "ConnectionGroup").sort((a, b) => Number(attr(a, "Index")) - Number(attr(b, "Index")));
264
+ return { from: attr(first(ends[0], "Connection"), "OIdRef"), to: attr(first(ends[1], "Connection"), "OIdRef"), title: "" };
265
+ });
266
+ }
267
+ function managerDefaults(element, root, depth) {
268
+ const styles = first(root, "StyleGroup");
269
+ const levels = direct(styles, "RootSubTopicDefaultsGroup");
270
+ const defaults = depth === 0 ? first(styles, "RootTopicDefaultsGroup") : levels.find((e) => Number(attr(e, "Level")) === depth - 1) ?? levels.at(-1);
271
+ for (const name of ["Color", "SubTopicsShape", "SubTopicShape", "Text"]) {
272
+ const original = first(defaults, `Default${name}`);
273
+ if (!original) continue;
274
+ let target = first(element, name);
275
+ if (!target) {
276
+ target = element.ownerDocument.createElementNS(element.namespaceURI, name);
277
+ element.append(target);
278
+ }
279
+ if (name === "Text") {
280
+ const sourceFont = first(original, "Font");
281
+ if (!sourceFont) continue;
282
+ let font = first(target, "Font");
283
+ if (!font) {
284
+ font = sourceFont.cloneNode(true);
285
+ target.append(font);
286
+ } else for (const a of Array.from(sourceFont.attributes)) if (!font.hasAttribute(a.name)) font.setAttribute(a.name, a.value);
287
+ } else for (const a of Array.from(original.attributes)) if (!target.hasAttribute(a.name)) target.setAttribute(a.name, a.value);
288
+ }
289
+ }
290
+
291
+ // ../plugins/mind-map/src/parse.ts
292
+ var LIMITS = { file: 128 * 1024 ** 2, content: 16 * 1024 ** 2, nodes: 2e4, depth: 128, sheets: 128, text: 4 * 1024 ** 2 };
293
+ function checkAbort(signal) {
294
+ if (signal.aborted) throw new DOMException("Aborted", "AbortError");
295
+ }
296
+ var invalid = () => new ViewerError("invalid-file", "Invalid mind map.");
297
+ var limit = () => new ViewerError("resource-limit", "Mind map limit exceeded.");
298
+ var children = (element, name) => element ? Array.from(element.children).filter((child2) => child2.localName === name) : [];
299
+ var child = (element, name) => children(element, name)[0];
300
+ var text = (element) => element?.textContent?.trim() ?? "";
301
+ var record = (value) => {
302
+ if (!value || typeof value !== "object" || Array.isArray(value)) throw invalid();
303
+ return value;
304
+ };
305
+ var string = (value) => typeof value === "string" ? value : "";
306
+ function xml(source) {
307
+ if (/<!DOCTYPE|<!ENTITY/i.test(source)) throw invalid();
308
+ const doc = parseXmlDocument(source, "application/xml");
309
+ if (doc.getElementsByTagName("parsererror").length || !doc.documentElement) throw invalid();
310
+ return doc.documentElement;
311
+ }
312
+ function richText(element) {
313
+ if (!element) return "";
314
+ const output = [];
315
+ const stack = [element];
316
+ while (stack.length) {
317
+ const node = stack.pop();
318
+ if (node.nodeType === 3) output.push(node.textContent ?? "");
319
+ else if (node.nodeType === 1) {
320
+ const tag = node.localName.toLowerCase();
321
+ if (["script", "style", "iframe", "object"].includes(tag)) continue;
322
+ if (["p", "div", "br", "li"].includes(tag)) output.push("\n");
323
+ for (let i = node.childNodes.length - 1; i >= 0; i--) stack.push(node.childNodes[i]);
324
+ }
325
+ }
326
+ return output.join("").trim();
327
+ }
328
+ function parseContent(source, format, signal) {
329
+ checkAbort(signal);
330
+ if (source.length > LIMITS.content) throw limit();
331
+ let count = 0, textSize = 0;
332
+ function topic(title, notes, link, depth) {
333
+ checkAbort(signal);
334
+ textSize += title.length + notes.length + link.length;
335
+ if (++count > LIMITS.nodes || depth > LIMITS.depth || textSize > LIMITS.text) throw limit();
336
+ return { id: `topic-${count}`, title, notes, link, children: [], kind: "attached", style: {}, structure: "", folded: false, markers: [], labels: [], metadata: {}, boundaries: [], relationships: [], attachments: [] };
337
+ }
338
+ function jsonTopic(value, depth, theme = {}, topicKind = "attached") {
339
+ const data = record(value);
340
+ const notes = data.notes == null ? {} : record(data.notes);
341
+ const plain = notes.plain == null ? {} : record(notes.plain);
342
+ const result = topic(string(data.title), string(plain.content), string(data.href), depth);
343
+ const styleName = depth === 0 ? "centralTopic" : topicKind === "detached" ? "floatingTopic" : topicKind === "summary" ? "summaryTopic" : topicKind === "callout" ? "calloutTopic" : depth === 1 ? "mainTopic" : "subTopic";
344
+ const base = theme[styleName] ? record(theme[styleName]) : {};
345
+ const own = data.style ? record(data.style) : {};
346
+ jsonVisual(result, { ...data, style: { properties: { ...base.properties ? record(base.properties) : {}, ...own.properties ? record(own.properties) : {} } } });
347
+ if (data.children != null) {
348
+ const groups = record(data.children);
349
+ for (const key of ["attached", "detached", "summary", "callout"]) {
350
+ if (groups[key] == null) continue;
351
+ if (!Array.isArray(groups[key])) throw invalid();
352
+ for (const item of groups[key]) {
353
+ const node = jsonTopic(item, depth + 1, theme, key);
354
+ node.kind = kind(key);
355
+ result.children.push(node);
356
+ }
357
+ }
358
+ }
359
+ return result;
360
+ }
361
+ let managerRoot;
362
+ function xmlTopic(element, depth) {
363
+ let title, notes, link, nested;
364
+ if (format === "mm") {
365
+ const rich = children(element, "richcontent");
366
+ title = element.getAttribute("TEXT") ?? richText(rich.find((item) => item.getAttribute("TYPE") === "NODE")).split("\n").map((line) => line.trim()).filter(Boolean).join("\n");
367
+ notes = rich.filter((item) => ["NOTE", "DETAILS"].includes(item.getAttribute("TYPE") ?? "")).map(richText).join("\n");
368
+ link = element.getAttribute("LINK") ?? "";
369
+ nested = children(element, "node");
370
+ } else if (format === "mmap") {
371
+ title = child(element, "Text")?.getAttribute("PlainText") ?? "";
372
+ const note = child(child(element, "NotesGroup"), "NotesXhtmlData");
373
+ notes = richText(note);
374
+ if (note && !note.children.length && /^\s*</.test(notes)) notes = richText(xml(notes));
375
+ link = (child(element, "Hyperlink") ?? child(child(element, "HyperlinkGroup"), "Hyperlink") ?? child(child(element, "HyperlinkGroup"), "IndexedHyperlink"))?.getAttribute("Url") ?? "";
376
+ nested = [...children(child(element, "SubTopics"), "Topic"), ...children(child(element, "FloatingTopics"), "Topic")];
377
+ } else {
378
+ title = text(child(element, "title"));
379
+ const note = child(element, "notes");
380
+ notes = text(child(note, "plain")) || richText(child(note, "html"));
381
+ link = element.getAttributeNS("http://www.w3.org/1999/xlink", "href") ?? element.getAttribute("href") ?? "";
382
+ nested = children(child(element, "children"), "topics").flatMap((group) => children(group, "topic"));
383
+ }
384
+ const result = topic(title, notes, link, depth);
385
+ if (format === "mmap" && managerRoot) managerDefaults(element, managerRoot, depth);
386
+ xmlVisual(result, element, format);
387
+ if (format === "xmind-xml") result.metadata.styleId = element.getAttribute("style-id") ?? "";
388
+ for (const item of nested) {
389
+ const node = xmlTopic(item, depth + 1);
390
+ if (format === "xmind-xml") node.kind = kind(item.parentElement?.getAttribute("type") ?? "");
391
+ if (format === "mmap" && item.parentElement?.localName === "FloatingTopics") node.kind = "detached";
392
+ result.children.push(node);
393
+ }
394
+ return result;
395
+ }
396
+ let sheets;
397
+ if (format === "xmind-json") {
398
+ const data = JSON.parse(source);
399
+ if (!Array.isArray(data) || !data.length) throw invalid();
400
+ if (data.length > LIMITS.sheets) throw limit();
401
+ sheets = data.map((value) => {
402
+ const sheet = record(value);
403
+ return { title: string(sheet.title), root: jsonTopic(sheet.rootTopic, 0, sheet.theme ? record(sheet.theme) : {}), relationships: jsonRelationships(sheet.relationships) };
404
+ });
405
+ } else {
406
+ const root = xml(source);
407
+ if (format === "mm") {
408
+ if (root.localName !== "map" || children(root, "node").length !== 1) throw invalid();
409
+ const node = xmlTopic(child(root, "node"), 0);
410
+ sheets = [{ title: node.title, root: node }];
411
+ } else if (format === "mmap") {
412
+ const topics = children(child(root, "OneTopic"), "Topic");
413
+ if (root.localName !== "Map" || topics.length !== 1) throw invalid();
414
+ managerRoot = root;
415
+ const node = xmlTopic(topics[0], 0);
416
+ sheets = [{ title: node.title, root: node, relationships: managerRelationships(root) }];
417
+ } else {
418
+ if (root.localName !== "xmap-content") throw invalid();
419
+ const items = children(root, "sheet");
420
+ if (!items.length) throw invalid();
421
+ if (items.length > LIMITS.sheets) throw limit();
422
+ sheets = items.map((item) => {
423
+ if (children(item, "topic").length !== 1) throw invalid();
424
+ return { title: text(child(item, "title")), root: xmlTopic(child(item, "topic"), 0), relationships: xmlRelationships(item) };
425
+ });
426
+ }
427
+ }
428
+ checkAbort(signal);
429
+ return sheets;
430
+ }
431
+ async function readText(file, signal) {
432
+ const reader = file.slice(0, file.size).stream().getReader();
433
+ const cancel = () => {
434
+ void reader.cancel().catch(() => {
435
+ });
436
+ };
437
+ signal.addEventListener("abort", cancel, { once: true });
438
+ const decoder = new TextDecoder("utf-8", { fatal: true });
439
+ const parts = [];
440
+ let size = 0;
441
+ try {
442
+ while (true) {
443
+ checkAbort(signal);
444
+ const result = await reader.read();
445
+ checkAbort(signal);
446
+ if (result.done) break;
447
+ size += result.value.byteLength;
448
+ if (size > LIMITS.content) throw limit();
449
+ parts.push(decoder.decode(result.value, { stream: true }));
450
+ }
451
+ parts.push(decoder.decode());
452
+ return parts.join("");
453
+ } finally {
454
+ signal.removeEventListener("abort", cancel);
455
+ await reader.cancel().catch(() => {
456
+ });
457
+ reader.releaseLock();
458
+ }
459
+ }
460
+ async function readMindMap(file, signal, workspace, { assets = true } = {}) {
461
+ checkAbort(signal);
462
+ if (file.size > LIMITS.file) throw limit();
463
+ if (/\.mm$/i.test(file.name)) {
464
+ const sheets = parseContent(await readText(file, signal), "mm", signal);
465
+ if (assets) await loadAssets(sheets, signal, void 0, workspace);
466
+ return sheets;
467
+ }
468
+ if (!/\.(xmind|mmap)$/i.test(file.name)) throw invalid();
469
+ const zip = await openBookZip(file, signal);
470
+ try {
471
+ const isXmind = /\.xmind$/i.test(file.name);
472
+ const path = isXmind ? zip.entries.has("content.json") ? "content.json" : "content.xml" : "Document.xml";
473
+ if (!zip.entries.has(path)) throw invalid();
474
+ const bytes = await zip.read(path, LIMITS.content, signal);
475
+ const source = new TextDecoder("utf-8", { fatal: true }).decode(bytes);
476
+ const sheets = parseContent(source, isXmind ? path.endsWith("json") ? "xmind-json" : "xmind-xml" : "mmap", signal);
477
+ if (zip.entries.has("styles.xml")) {
478
+ const styles = new TextDecoder().decode(await zip.read("styles.xml", LIMITS.content, signal));
479
+ xml(styles);
480
+ applyLegacyStyles(sheets, styles);
481
+ }
482
+ if (assets) await loadAssets(sheets, signal, zip);
483
+ return sheets;
484
+ } finally {
485
+ await zip.dispose();
486
+ }
487
+ }
488
+
489
+ // ../plugins/mind-map/src/extract.ts
490
+ var PLUGIN_ID = "mind-map";
491
+ var KIND_LABELS = { detached: "floating", summary: "summary", callout: "callout" };
492
+ function mapError(error) {
493
+ if (error instanceof AgentError || isViewerAbortError(error)) throw error;
494
+ if (error instanceof ProtectedBookError) {
495
+ throw new AgentError("encrypted-file", "The mind map archive is encrypted.", { pluginId: PLUGIN_ID, cause: error });
496
+ }
497
+ if (error instanceof ViewerError && error.code === "resource-limit") {
498
+ throw new AgentError("resource-limit", "The mind map exceeds safety limits.", { pluginId: PLUGIN_ID, cause: error });
499
+ }
500
+ throw new AgentError("invalid-file", "The file is not a readable mind map.", { pluginId: PLUGIN_ID, cause: error });
501
+ }
502
+ async function formatName(file, signal) {
503
+ if (/\.mm$/i.test(file.name)) return "FreeMind / Freeplane";
504
+ if (/\.mmap$/i.test(file.name)) return "MindManager";
505
+ const { names } = await readBookZipCatalog(file, signal);
506
+ return names.has("content.json") ? "XMind" : "XMind (legacy XML)";
507
+ }
508
+ async function loadSheets(context) {
509
+ if (context.signal.aborted) throw abortError();
510
+ try {
511
+ const sheets = await readMindMap(context.file, context.signal, void 0, { assets: false });
512
+ return { format: await formatName(context.file, context.signal), sheets };
513
+ } catch (error) {
514
+ return mapError(error);
515
+ }
516
+ }
517
+ function countTopics(topic) {
518
+ let count = 0;
519
+ const stack = [topic];
520
+ while (stack.length) {
521
+ const next = stack.pop();
522
+ count += 1;
523
+ stack.push(...next.children);
524
+ }
525
+ return count;
526
+ }
527
+ var oneLine = (value) => value.replace(/\s+/g, " ").trim();
528
+ var sheetTitle = (sheet, index) => oneLine(sheet.title) || oneLine(sheet.root.title) || `Sheet ${index + 1}`;
529
+ function sheetOutline(sheet, index) {
530
+ const lines = [`## Sheet ${index + 1}: ${sheetTitle(sheet, index)}`, ""];
531
+ const titles = /* @__PURE__ */ new Map();
532
+ const stack = [{ topic: sheet.root, depth: 0 }];
533
+ while (stack.length) {
534
+ const { topic, depth } = stack.pop();
535
+ const title = oneLine(topic.title) || "(untitled)";
536
+ titles.set(topic.id, title);
537
+ const indent = " ".repeat(depth);
538
+ const extras = [
539
+ KIND_LABELS[topic.kind] ? `(${KIND_LABELS[topic.kind]})` : "",
540
+ topic.labels.length ? `[labels: ${topic.labels.join(", ")}]` : "",
541
+ topic.markers.length ? `[markers: ${topic.markers.join(", ")}]` : "",
542
+ topic.link ? `<${topic.link}>` : "",
543
+ topic.attachments.length ? `[attachments: ${topic.attachments.map((item) => item.name || item.path).join(", ")}]` : ""
544
+ ].filter(Boolean);
545
+ lines.push(`${indent}- ${[title, ...extras].join(" ")}`);
546
+ for (const note of topic.notes.split(/\r?\n/).map((line) => line.trim()).filter(Boolean)) {
547
+ lines.push(`${indent} > ${note}`);
548
+ }
549
+ for (let child2 = topic.children.length - 1; child2 >= 0; child2 -= 1) {
550
+ stack.push({ topic: topic.children[child2], depth: depth + 1 });
551
+ }
552
+ }
553
+ const relationships = [...sheet.relationships ?? []];
554
+ const visit = [sheet.root];
555
+ while (visit.length) {
556
+ const topic = visit.pop();
557
+ relationships.push(...topic.relationships);
558
+ visit.push(...topic.children);
559
+ }
560
+ if (relationships.length) {
561
+ lines.push("", "Relationships:");
562
+ for (const link of relationships) {
563
+ const label = oneLine(link.title);
564
+ lines.push(`- ${titles.get(link.from) ?? link.from} \u2192 ${titles.get(link.to) ?? link.to}${label ? `: ${label}` : ""}`);
565
+ }
566
+ }
567
+ return lines.join("\n");
568
+ }
569
+ var mindMapExtractor = {
570
+ async inspect(context) {
571
+ const { format, sheets } = await loadSheets(context);
572
+ const counts = sheets.map((sheet) => countTopics(sheet.root));
573
+ return {
574
+ metadata: {
575
+ format,
576
+ sizeBytes: context.source.size,
577
+ sheetCount: sheets.length,
578
+ topicCount: counts.reduce((sum, count) => sum + count, 0),
579
+ sheets: sheets.map((sheet, index) => ({
580
+ title: sheetTitle(sheet, index),
581
+ rootTopic: oneLine(sheet.root.title),
582
+ topics: counts[index]
583
+ }))
584
+ },
585
+ targets: sheets.map((sheet, index) => ({
586
+ id: `sheet:${index + 1}`,
587
+ title: sheetTitle(sheet, index),
588
+ kind: "sheet",
589
+ size: counts[index]
590
+ }))
591
+ };
592
+ },
593
+ async read(context, params) {
594
+ const { format, sheets } = await loadSheets(context);
595
+ return readPagedTextDocument({
596
+ pageCount: sheets.length,
597
+ targetPrefix: "sheet",
598
+ header: () => markdownDocumentHeader(context.file.name, { Format: format, Sheets: String(sheets.length) }),
599
+ page: async (index) => sheetOutline(sheets[index], index)
600
+ }, params, PLUGIN_ID);
601
+ }
602
+ };
603
+ var extract_default = mindMapExtractor;
604
+ export {
605
+ extract_default as default,
606
+ sheetOutline
607
+ };