anyfile-cli 0.0.0-stage → 0.2.1

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 (354) hide show
  1. package/LICENSE +177 -0
  2. package/README.md +55 -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-5XTYLZF3.mjs +559 -0
  12. package/chunks/chunk-5ZHDYRGV.mjs +64 -0
  13. package/chunks/chunk-6CQL4K2K.mjs +21 -0
  14. package/chunks/chunk-6EVJJFOH.mjs +243 -0
  15. package/chunks/chunk-6NWSQGYE.mjs +68 -0
  16. package/chunks/chunk-7O5JLQE7.mjs +1 -0
  17. package/chunks/chunk-A6AQI6DF.mjs +321 -0
  18. package/chunks/chunk-AYF63UBE.mjs +79 -0
  19. package/chunks/chunk-B27PR6Q4.mjs +17 -0
  20. package/chunks/chunk-BP7LORL4.mjs +13 -0
  21. package/chunks/chunk-BVCRJLCD.mjs +109 -0
  22. package/chunks/chunk-CLSEE3VA.mjs +28 -0
  23. package/chunks/chunk-CO2ZAQIK.mjs +52 -0
  24. package/chunks/chunk-CQWM5GMU.mjs +167 -0
  25. package/chunks/chunk-CZFFYCMJ.mjs +136 -0
  26. package/chunks/chunk-D3CS6TIK.mjs +419 -0
  27. package/chunks/chunk-DJLFVMDJ.mjs +807 -0
  28. package/chunks/chunk-DJXVCKIO.mjs +30 -0
  29. package/chunks/chunk-EMXODK3K.mjs +94 -0
  30. package/chunks/chunk-EOJ7ZCDK.mjs +227 -0
  31. package/chunks/chunk-H4TBN22D.mjs +100 -0
  32. package/chunks/chunk-HI7TURZM.mjs +2256 -0
  33. package/chunks/chunk-HUSX3ZU3.mjs +58 -0
  34. package/chunks/chunk-IC3G2XE2.mjs +436 -0
  35. package/chunks/chunk-IGEGIF35.mjs +2034 -0
  36. package/chunks/chunk-IZGTVZHE.mjs +90 -0
  37. package/chunks/chunk-J4G7LUPA.mjs +117 -0
  38. package/chunks/chunk-JBAJW66L.mjs +4220 -0
  39. package/chunks/chunk-JKQUF2MM.mjs +438 -0
  40. package/chunks/chunk-KAMPC5TK.mjs +131 -0
  41. package/chunks/chunk-KSKEMJVC.mjs +145 -0
  42. package/chunks/chunk-LRHHRZLE.mjs +29 -0
  43. package/chunks/chunk-M37ZOAUG.mjs +93 -0
  44. package/chunks/chunk-MG7LUDXO.mjs +187 -0
  45. package/chunks/chunk-NGVHHTQD.mjs +125 -0
  46. package/chunks/chunk-NQ7J2NH6.mjs +50 -0
  47. package/chunks/chunk-NUMNHVSI.mjs +60 -0
  48. package/chunks/chunk-ORJ3DN65.mjs +58 -0
  49. package/chunks/chunk-QOUEBPPL.mjs +15 -0
  50. package/chunks/chunk-QR3Y3UKM.mjs +194 -0
  51. package/chunks/chunk-RFKYE7SE.mjs +50 -0
  52. package/chunks/chunk-SH57XOAV.mjs +33 -0
  53. package/chunks/chunk-TB5ISPA4.mjs +1 -0
  54. package/chunks/chunk-UGAU3V4V.mjs +206 -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 +297 -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 +34 -4
  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-BkE--DNX.js +1 -0
  197. package/renderer-host/assets/animation-Dt0WW2cB.js +1 -0
  198. package/renderer-host/assets/archive-client-CL5yOgwH.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-DUt14LJO.js +1 -0
  204. package/renderer-host/assets/browser-C0pGRq_c.js +1 -0
  205. package/renderer-host/assets/client-CU2ERPtk.js +1 -0
  206. package/renderer-host/assets/container-inspection-ekEPWWcy.js +1 -0
  207. package/renderer-host/assets/data-table-OJQe3aN5.js +1 -0
  208. package/renderer-host/assets/decode-hBroL8C1.js +1 -0
  209. package/renderer-host/assets/decode-tiff-CP1xdrF_.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-CxjGms-W.js +1 -0
  220. package/renderer-host/assets/ext-searchbox-BIdon51Z.js +164 -0
  221. package/renderer-host/assets/ffmpeg-playback-DzCJz9Ny.js +1 -0
  222. package/renderer-host/assets/gltf-PozNLKNg.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-SK3ULGWm.js +1 -0
  228. package/renderer-host/assets/index-DtiyOy_J.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-Cuor-Zm2.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-BniHVEWJ.js +16 -0
  245. package/renderer-host/assets/model-Drd3vqcF.js +1 -0
  246. package/renderer-host/assets/obj-B3p81LL2.js +9 -0
  247. package/renderer-host/assets/off-QQbiKPTX.js +1 -0
  248. package/renderer-host/assets/ogg-probe-C2TT74FL.js +1 -0
  249. package/renderer-host/assets/ogg-viewer-Dc8K-tas.js +9 -0
  250. package/renderer-host/assets/packbits-DCimUQ1T.js +1 -0
  251. package/renderer-host/assets/paged-C8AQD7sX.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-C3_RRA7n.js +2 -0
  256. package/renderer-host/assets/points.worker-CA8v75dl.js +2 -0
  257. package/renderer-host/assets/probe-asf-C_UpCBly.js +14 -0
  258. package/renderer-host/assets/range-reader-BMfLhWcp.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-6AmS6O5e.js +1 -0
  262. package/renderer-host/assets/rolldown-runtime-Dd_uD5pT.js +1 -0
  263. package/renderer-host/assets/safe-content-CWHf8jex.js +1 -0
  264. package/renderer-host/assets/sanitize-D56ODnaM.js +1 -0
  265. package/renderer-host/assets/scene-adapter-CaCLr1am.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-jl6q24fW.js +1 -0
  269. package/renderer-host/assets/skp.worker-D9ujTXFV.js +1 -0
  270. package/renderer-host/assets/src-1Won7FxU.js +88 -0
  271. package/renderer-host/assets/src-3RoHqOkA.js +7 -0
  272. package/renderer-host/assets/src-4zBOL6Jt.js +1 -0
  273. package/renderer-host/assets/src-6v8-hoR3.js +24 -0
  274. package/renderer-host/assets/src-8Jx9gbII.js +1 -0
  275. package/renderer-host/assets/src-B1WA0dRu.js +64 -0
  276. package/renderer-host/assets/src-B5ijbemo.js +9 -0
  277. package/renderer-host/assets/src-B8DH2GJe.js +17 -0
  278. package/renderer-host/assets/src-B9t_iEO3.js +58 -0
  279. package/renderer-host/assets/src-BCC58C0X.js +1 -0
  280. package/renderer-host/assets/src-BCwENs26.js +1 -0
  281. package/renderer-host/assets/src-BEirBh4c.js +27 -0
  282. package/renderer-host/assets/src-BHR6n7Fj.js +1 -0
  283. package/renderer-host/assets/src-BIlLq0QT.js +169 -0
  284. package/renderer-host/assets/src-BKlK1jcN.js +1 -0
  285. package/renderer-host/assets/src-BN0FUJhs.js +8 -0
  286. package/renderer-host/assets/src-BWElAdlq.js +52 -0
  287. package/renderer-host/assets/src-BXg11IjY.js +4 -0
  288. package/renderer-host/assets/src-BbBdnTjJ.js +2 -0
  289. package/renderer-host/assets/src-BbFZbZsL.js +2 -0
  290. package/renderer-host/assets/src-BdPbFRd-.js +24 -0
  291. package/renderer-host/assets/src-BpbGaBrT.js +182 -0
  292. package/renderer-host/assets/src-BwIl76_H.js +7 -0
  293. package/renderer-host/assets/src-C2e6QJIj.js +10 -0
  294. package/renderer-host/assets/src-C2gNidHF.js +989 -0
  295. package/renderer-host/assets/src-C9Uz3C-q.js +432 -0
  296. package/renderer-host/assets/src-CBUhG6W5.js +7 -0
  297. package/renderer-host/assets/src-CQDGi3Qa.js +10 -0
  298. package/renderer-host/assets/src-CRLCRg0N.js +21 -0
  299. package/renderer-host/assets/src-CS5rqxBy.js +10 -0
  300. package/renderer-host/assets/src-CWZdSJQw.js +7 -0
  301. package/renderer-host/assets/src-CXnpsVpU.js +27 -0
  302. package/renderer-host/assets/src-CnhXvqQY.js +8 -0
  303. package/renderer-host/assets/src-CpExg0ZA.js +9 -0
  304. package/renderer-host/assets/src-CrLmL3wU.js +5 -0
  305. package/renderer-host/assets/src-CrYEJ5uz.js +2 -0
  306. package/renderer-host/assets/src-D-iIkSqZ.js +222 -0
  307. package/renderer-host/assets/src-D6sH9uTT.js +23 -0
  308. package/renderer-host/assets/src-D8zHDJh_.js +10 -0
  309. package/renderer-host/assets/src-D9OFaPNV.js +1 -0
  310. package/renderer-host/assets/src-DCI_ff7c.js +1 -0
  311. package/renderer-host/assets/src-DCrbiTpH.js +18 -0
  312. package/renderer-host/assets/src-DK8DvtMd.js +115 -0
  313. package/renderer-host/assets/src-DWGlOVjt.js +17 -0
  314. package/renderer-host/assets/src-DbvEX_Ct.js +6 -0
  315. package/renderer-host/assets/src-Dezc2dj1.js +1 -0
  316. package/renderer-host/assets/src-Dh5VD1lL.js +11 -0
  317. package/renderer-host/assets/src-DlwABqw5.js +1 -0
  318. package/renderer-host/assets/src-DlxETlTh.js +44 -0
  319. package/renderer-host/assets/src-Dmd6BvBh.js +387 -0
  320. package/renderer-host/assets/src-DpgvaJNJ.js +24 -0
  321. package/renderer-host/assets/src-DpjRB2sv.js +1 -0
  322. package/renderer-host/assets/src-Dvn41FR7.js +90 -0
  323. package/renderer-host/assets/src-DwcPYp7X.js +1 -0
  324. package/renderer-host/assets/src-HUxhcDlO.js +2 -0
  325. package/renderer-host/assets/src-Jhqg3J8L.js +2 -0
  326. package/renderer-host/assets/src-MO5bLsLj.js +4126 -0
  327. package/renderer-host/assets/src-N8XBQaK4.js +20 -0
  328. package/renderer-host/assets/src-XZ_0U972.js +1 -0
  329. package/renderer-host/assets/src-Y6mXl4vh.js +29 -0
  330. package/renderer-host/assets/src-b9aXVJde.js +100 -0
  331. package/renderer-host/assets/src-d2U6neq8.js +37 -0
  332. package/renderer-host/assets/src-hCrza_Lf.js +1 -0
  333. package/renderer-host/assets/src-jUGjKzOV.js +1 -0
  334. package/renderer-host/assets/src-rJN_jaC5.js +1 -0
  335. package/renderer-host/assets/src-vOBd-1zk.js +5 -0
  336. package/renderer-host/assets/src-wrrVkfrK.js +1 -0
  337. package/renderer-host/assets/src-yCrAObB-.js +1 -0
  338. package/renderer-host/assets/src-zrBiCtay.js +7 -0
  339. package/renderer-host/assets/stl-adapter-CLkWHoOn.js +1 -0
  340. package/renderer-host/assets/stl.worker-C-anHijM.js +1 -0
  341. package/renderer-host/assets/three-mf-BSrcsdQD.js +2 -0
  342. package/renderer-host/assets/webimage-zQMH-_zR.js +1 -0
  343. package/renderer-host/assets/webm-14HHwfWy.js +1 -0
  344. package/renderer-host/assets/worker-QK2gViTu.js +1 -0
  345. package/renderer-host/assets/x6-dng-worker-CNf3zUP-.js +1 -0
  346. package/renderer-host/assets/xml.browser-CC8-XAyN.js +1 -0
  347. package/renderer-host/assets/zip-core-base-DD8akpjq.js +1 -0
  348. package/renderer-host/assets/zip-core-custom-CfPFs1lw.js +1 -0
  349. package/renderer-host/assets/zip-source-CLF3Hfcg.js +1 -0
  350. package/renderer-host/assets/zstd-CmwSLjHB.js +1 -0
  351. package/renderer-host/assets/zstd-i4Jwubnx.js +1 -0
  352. package/renderer-host/index.html +65 -0
  353. package/vendor-manifest.json +1433 -0
  354. package/worker.mjs +262 -0
@@ -0,0 +1,825 @@
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
+ readFileRange
4
+ } from "../chunks/chunk-H4TBN22D.mjs";
5
+ import {
6
+ AgentError,
7
+ HARD_READ_MAX_BYTES,
8
+ ViewerError,
9
+ abortError,
10
+ isViewerAbortError,
11
+ parsePositionCursor,
12
+ renderMarkdownTablePage,
13
+ truncateUtf8
14
+ } from "../chunks/chunk-IC3G2XE2.mjs";
15
+ import "../chunks/chunk-ORJ3DN65.mjs";
16
+
17
+ // ../plugins/dev-array/src/dtype.ts
18
+ function invalid(message) {
19
+ throw new ViewerError("invalid-file", `NPY dtype ${message}\u3002`);
20
+ }
21
+ function product(shape2) {
22
+ let value = 1;
23
+ for (const dimension of shape2) {
24
+ if (!Number.isSafeInteger(dimension) || dimension < 0) invalid("\u5B50\u6570\u7EC4 shape \u65E0\u6548");
25
+ value *= dimension;
26
+ if (!Number.isSafeInteger(value)) invalid("\u5B50\u6570\u7EC4\u8FC7\u5927");
27
+ }
28
+ return value;
29
+ }
30
+ function scalar(source) {
31
+ const match = source.match(/^([<>=|]?)([?biufcSUVOMm])([0-9]*)$/);
32
+ if (!match) invalid(`\u201C${source}\u201D\u4E0D\u53D7\u652F\u6301`);
33
+ const byteOrder = match[1] || "=";
34
+ const kind = match[2] === "?" ? "b" : match[2];
35
+ const declaredSize = Number(match[3] || (kind === "b" ? 1 : 0));
36
+ const itemSize = kind === "U" ? declaredSize * 4 : declaredSize;
37
+ if (!Number.isSafeInteger(itemSize) || itemSize <= 0 || itemSize > 1024 * 1024) invalid("\u5143\u7D20\u5927\u5C0F\u65E0\u6548");
38
+ const sizes = {
39
+ b: [1],
40
+ i: [1, 2, 4, 8],
41
+ u: [1, 2, 4, 8],
42
+ f: [2, 4, 8],
43
+ c: [8, 16],
44
+ S: "any",
45
+ U: "any",
46
+ V: "any",
47
+ O: "any",
48
+ M: [8],
49
+ m: [8]
50
+ };
51
+ const allowed = sizes[kind];
52
+ if (allowed !== "any" && !allowed?.includes(itemSize)) invalid(`\u201C${source}\u201D\u7684\u5143\u7D20\u5927\u5C0F\u65E0\u6548`);
53
+ return { type: "scalar", byteOrder, kind, itemSize, source, object: kind === "O" };
54
+ }
55
+ function shapeValue(value) {
56
+ if (!Array.isArray(value) || value.some((item) => typeof item !== "number")) invalid("\u5B50\u6570\u7EC4 shape \u65E0\u6548");
57
+ return value;
58
+ }
59
+ function fieldDType(value) {
60
+ if (typeof value === "string") return { dtype: scalar(value), shape: [] };
61
+ if (Array.isArray(value) && value.length === 2 && (typeof value[0] === "string" || Array.isArray(value[0])) && Array.isArray(value[1])) {
62
+ return { dtype: parseDType(value[0]), shape: shapeValue(value[1]) };
63
+ }
64
+ return { dtype: parseDType(value), shape: [] };
65
+ }
66
+ function structured(value) {
67
+ const fields = [];
68
+ let offset = 0;
69
+ for (const item of value) {
70
+ if (!Array.isArray(item) || item.length < 2 || item.length > 3 || typeof item[0] !== "string") {
71
+ invalid("\u7ED3\u6784\u5316\u5B57\u6BB5\u63CF\u8FF0\u65E0\u6548");
72
+ }
73
+ const parsed = fieldDType(item[1]);
74
+ const shape2 = item.length === 3 ? shapeValue(item[2]) : parsed.shape;
75
+ const itemSize = parsed.dtype.itemSize * product(shape2);
76
+ if (!Number.isSafeInteger(itemSize) || !Number.isSafeInteger(offset + itemSize)) invalid("\u7ED3\u6784\u5316 dtype \u8FC7\u5927");
77
+ fields.push({ name: item[0], dtype: parsed.dtype, offset, shape: shape2, itemSize });
78
+ offset += itemSize;
79
+ }
80
+ if (fields.length === 0 || offset <= 0 || offset > 1024 * 1024) invalid("\u7ED3\u6784\u5316\u5143\u7D20\u5927\u5C0F\u65E0\u6548");
81
+ return {
82
+ type: "structured",
83
+ fields,
84
+ itemSize: offset,
85
+ source: JSON.stringify(value),
86
+ object: fields.some((field) => field.dtype.object)
87
+ };
88
+ }
89
+ function parseDType(value) {
90
+ if (typeof value === "string") return scalar(value);
91
+ if (Array.isArray(value)) return structured(value);
92
+ return invalid("\u63CF\u8FF0\u5FC5\u987B\u662F\u5B57\u7B26\u4E32\u6216\u5B57\u6BB5\u5217\u8868");
93
+ }
94
+ function float16(value) {
95
+ const sign = value & 32768 ? -1 : 1;
96
+ const exponent = value >>> 10 & 31;
97
+ const fraction = value & 1023;
98
+ if (exponent === 0) return sign * 2 ** -14 * (fraction / 1024);
99
+ if (exponent === 31) return fraction ? Number.NaN : sign * Number.POSITIVE_INFINITY;
100
+ return sign * 2 ** (exponent - 15) * (1 + fraction / 1024);
101
+ }
102
+ function littleEndian(dtype) {
103
+ return dtype.byteOrder !== ">";
104
+ }
105
+ function formatNumber(value) {
106
+ if (typeof value === "bigint") return value.toString();
107
+ if (Number.isNaN(value)) return "NaN";
108
+ if (!Number.isFinite(value)) return value > 0 ? "Infinity" : "-Infinity";
109
+ return String(value);
110
+ }
111
+ function decodeScalar(bytes, offset, dtype) {
112
+ const view2 = new DataView(bytes.buffer, bytes.byteOffset + offset, dtype.itemSize);
113
+ const little = littleEndian(dtype);
114
+ if (dtype.kind === "b") return view2.getUint8(0) ? "true" : "false";
115
+ if (dtype.kind === "i") {
116
+ const value = dtype.itemSize === 1 ? view2.getInt8(0) : dtype.itemSize === 2 ? view2.getInt16(0, little) : dtype.itemSize === 4 ? view2.getInt32(0, little) : view2.getBigInt64(0, little);
117
+ return formatNumber(value);
118
+ }
119
+ if (dtype.kind === "u") {
120
+ const value = dtype.itemSize === 1 ? view2.getUint8(0) : dtype.itemSize === 2 ? view2.getUint16(0, little) : dtype.itemSize === 4 ? view2.getUint32(0, little) : view2.getBigUint64(0, little);
121
+ return formatNumber(value);
122
+ }
123
+ if (dtype.kind === "f") {
124
+ const value = dtype.itemSize === 2 ? float16(view2.getUint16(0, little)) : dtype.itemSize === 4 ? view2.getFloat32(0, little) : view2.getFloat64(0, little);
125
+ return formatNumber(value);
126
+ }
127
+ if (dtype.kind === "c") {
128
+ const component = dtype.itemSize / 2;
129
+ const read = (position) => component === 4 ? view2.getFloat32(position, little) : view2.getFloat64(position, little);
130
+ const real = read(0);
131
+ const imaginary = read(component);
132
+ return `${formatNumber(real)}${imaginary < 0 ? "" : "+"}${formatNumber(imaginary)}j`;
133
+ }
134
+ if (dtype.kind === "S") {
135
+ const zero = bytes.subarray(offset, offset + dtype.itemSize).indexOf(0);
136
+ const value = bytes.subarray(offset, offset + (zero < 0 ? dtype.itemSize : zero));
137
+ return new TextDecoder("latin1").decode(value);
138
+ }
139
+ if (dtype.kind === "U") {
140
+ const chunks = [];
141
+ const points = [];
142
+ for (let index = 0; index < dtype.itemSize; index += 4) {
143
+ const point = view2.getUint32(index, little);
144
+ if (point) points.push(point <= 1114111 ? point : 65533);
145
+ if (points.length === 4096) chunks.push(String.fromCodePoint(...points.splice(0)));
146
+ }
147
+ if (points.length) chunks.push(String.fromCodePoint(...points));
148
+ return chunks.join("");
149
+ }
150
+ if (dtype.kind === "M" || dtype.kind === "m") return formatNumber(view2.getBigInt64(0, little));
151
+ return Array.from(bytes.subarray(offset, offset + dtype.itemSize), (byte) => byte.toString(16).padStart(2, "0")).join("");
152
+ }
153
+
154
+ // ../plugins/dev-array/src/python-literal.ts
155
+ var Parser = class {
156
+ constructor(input) {
157
+ this.input = input;
158
+ this.offset = 0;
159
+ }
160
+ parse() {
161
+ const value = this.value();
162
+ this.space();
163
+ if (this.offset !== this.input.length) this.fail("\u5934\u90E8\u5305\u542B\u591A\u4F59\u5185\u5BB9");
164
+ return value;
165
+ }
166
+ value() {
167
+ this.space();
168
+ const current = this.input[this.offset];
169
+ if (current === "'" || current === '"') return this.string();
170
+ if (current === "{") return this.dictionary();
171
+ if (current === "[") return this.sequence("]");
172
+ if (current === "(") return this.sequence(")");
173
+ const token = this.input.slice(this.offset).match(/^[+-]?[0-9]+/)?.[0];
174
+ if (token) {
175
+ this.offset += token.length;
176
+ const value = Number(token);
177
+ if (!Number.isSafeInteger(value)) this.fail("\u6574\u6570\u8D85\u51FA\u5B89\u5168\u8303\u56F4");
178
+ return value;
179
+ }
180
+ for (const [name, value] of [["True", true], ["False", false], ["None", null]]) {
181
+ if (this.input.startsWith(name, this.offset)) {
182
+ this.offset += name.length;
183
+ return value;
184
+ }
185
+ }
186
+ return this.fail("\u5934\u90E8\u5305\u542B\u4E0D\u652F\u6301\u7684 Python literal");
187
+ }
188
+ dictionary() {
189
+ const result = {};
190
+ this.offset += 1;
191
+ this.space();
192
+ while (this.input[this.offset] !== "}") {
193
+ if (this.offset >= this.input.length) this.fail("\u5B57\u5178\u672A\u95ED\u5408");
194
+ const key = this.string();
195
+ this.space();
196
+ if (this.input[this.offset++] !== ":") this.fail("\u5B57\u5178\u7F3A\u5C11\u5192\u53F7");
197
+ result[key] = this.value();
198
+ this.space();
199
+ if (this.input[this.offset] === ",") {
200
+ this.offset += 1;
201
+ this.space();
202
+ } else if (this.input[this.offset] !== "}") this.fail("\u5B57\u5178\u6761\u76EE\u7F3A\u5C11\u9017\u53F7");
203
+ }
204
+ this.offset += 1;
205
+ return result;
206
+ }
207
+ sequence(close) {
208
+ const result = [];
209
+ this.offset += 1;
210
+ this.space();
211
+ while (this.input[this.offset] !== close) {
212
+ if (this.offset >= this.input.length) this.fail("\u5E8F\u5217\u672A\u95ED\u5408");
213
+ result.push(this.value());
214
+ this.space();
215
+ if (this.input[this.offset] === ",") {
216
+ this.offset += 1;
217
+ this.space();
218
+ } else if (this.input[this.offset] !== close) this.fail("\u5E8F\u5217\u6761\u76EE\u7F3A\u5C11\u9017\u53F7");
219
+ }
220
+ this.offset += 1;
221
+ return result;
222
+ }
223
+ string() {
224
+ const quote = this.input[this.offset++];
225
+ let value = "";
226
+ while (this.offset < this.input.length) {
227
+ const character = this.input[this.offset++];
228
+ if (character === quote) return value;
229
+ if (character !== "\\") {
230
+ value += character;
231
+ continue;
232
+ }
233
+ const escaped = this.input[this.offset++];
234
+ if (escaped === "x") {
235
+ const hex = this.input.slice(this.offset, this.offset + 2);
236
+ if (!/^[0-9a-f]{2}$/i.test(hex)) this.fail("\u5B57\u7B26\u4E32\u5341\u516D\u8FDB\u5236\u8F6C\u4E49\u65E0\u6548");
237
+ value += String.fromCharCode(Number.parseInt(hex, 16));
238
+ this.offset += 2;
239
+ } else {
240
+ value += { n: "\n", r: "\r", t: " " }[escaped] ?? escaped;
241
+ }
242
+ }
243
+ return this.fail("\u5B57\u7B26\u4E32\u672A\u95ED\u5408");
244
+ }
245
+ space() {
246
+ while (/\s/.test(this.input[this.offset] ?? "")) this.offset += 1;
247
+ }
248
+ fail(message) {
249
+ throw new ViewerError("invalid-file", `NPY ${message}\u3002`);
250
+ }
251
+ };
252
+ function parsePythonLiteral(input) {
253
+ return new Parser(input.trim()).parse();
254
+ }
255
+
256
+ // ../plugins/dev-array/src/npy.ts
257
+ var MAGIC = Uint8Array.of(147, 78, 85, 77, 80, 89);
258
+ var MAX_HEADER_BYTES = 1024 * 1024;
259
+ var MAX_DIMENSIONS = 32;
260
+ var MAX_PAGE_BYTES = 1024 * 1024;
261
+ function invalid2(message) {
262
+ throw new ViewerError("invalid-file", `NPY ${message}\u3002`);
263
+ }
264
+ function sameMagic(bytes) {
265
+ return MAGIC.every((byte, index) => bytes[index] === byte);
266
+ }
267
+ function dictionary(value) {
268
+ if (!value || Array.isArray(value) || typeof value !== "object") return invalid2("\u5934\u90E8\u4E0D\u662F\u5B57\u5178");
269
+ return value;
270
+ }
271
+ function shape(value) {
272
+ if (!Array.isArray(value) || value.length > MAX_DIMENSIONS || value.some((dimension) => typeof dimension !== "number" || !Number.isSafeInteger(dimension) || dimension < 0)) {
273
+ return invalid2("shape \u65E0\u6548");
274
+ }
275
+ return value;
276
+ }
277
+ function elementCount(dimensions) {
278
+ let count = 1;
279
+ for (const dimension of dimensions) {
280
+ count *= dimension;
281
+ if (!Number.isSafeInteger(count)) invalid2("\u5143\u7D20\u6570\u91CF\u8D85\u51FA\u5B89\u5168\u8303\u56F4");
282
+ }
283
+ return count;
284
+ }
285
+ async function readNpyDescriptor(source) {
286
+ if (source.size < 10) invalid2("\u6587\u4EF6\u5934\u5DF2\u622A\u65AD");
287
+ const prefix = await source.read(0, Math.min(12, source.size));
288
+ if (!sameMagic(prefix)) invalid2("magic \u65E0\u6548");
289
+ const major = prefix[6];
290
+ const minor = prefix[7];
291
+ if (major < 1 || major > 3 || minor !== 0) invalid2(`\u7248\u672C ${major}.${minor} \u4E0D\u53D7\u652F\u6301`);
292
+ const preambleLength = major === 1 ? 10 : 12;
293
+ if (prefix.length < preambleLength) invalid2("\u6587\u4EF6\u5934\u5DF2\u622A\u65AD");
294
+ const view2 = new DataView(prefix.buffer, prefix.byteOffset, prefix.byteLength);
295
+ const headerLength = major === 1 ? view2.getUint16(8, true) : view2.getUint32(8, true);
296
+ if (headerLength <= 0 || headerLength > MAX_HEADER_BYTES) {
297
+ throw new ViewerError("resource-limit", "NPY \u5934\u90E8\u8D85\u8FC7 1 MiB \u5B89\u5168\u4E0A\u9650\u3002");
298
+ }
299
+ const dataOffset = preambleLength + headerLength;
300
+ if (!Number.isSafeInteger(dataOffset) || dataOffset > source.size) invalid2("\u5934\u90E8\u8303\u56F4\u8D85\u51FA\u6587\u4EF6\u672B\u5C3E");
301
+ const headerBytes = await source.read(preambleLength, headerLength);
302
+ const encoding = major === 3 ? "utf-8" : "latin1";
303
+ const headerText = new TextDecoder(encoding, { fatal: true }).decode(headerBytes).trim();
304
+ const parsed = dictionary(parsePythonLiteral(headerText));
305
+ if (!("descr" in parsed) || !("shape" in parsed) || typeof parsed.fortran_order !== "boolean") {
306
+ invalid2("\u7F3A\u5C11 descr\u3001shape \u6216 fortran_order");
307
+ }
308
+ const dtype = parseDType(parsed.descr);
309
+ const dimensions = shape(parsed.shape);
310
+ const count = elementCount(dimensions);
311
+ if (!dtype.object) {
312
+ const dataBytes = count * dtype.itemSize;
313
+ if (!Number.isSafeInteger(dataBytes) || dataOffset + dataBytes > source.size) invalid2("\u6570\u7EC4\u6570\u636E\u5DF2\u622A\u65AD");
314
+ }
315
+ return {
316
+ version: `${major}.${minor}`,
317
+ dtype,
318
+ shape: dimensions,
319
+ fortranOrder: parsed.fortran_order,
320
+ elementCount: count,
321
+ dataOffset,
322
+ sourceSize: source.size
323
+ };
324
+ }
325
+
326
+ // ../plugins/dev-array/src/source.ts
327
+ var FileByteSource = class {
328
+ constructor(file, signal) {
329
+ this.file = file;
330
+ this.signal = signal;
331
+ this.size = file.size;
332
+ }
333
+ async read(start, length) {
334
+ try {
335
+ return await readFileRange(this.file, this.signal, start, length);
336
+ } catch (error) {
337
+ if (error instanceof DOMException && error.name === "AbortError") throw error;
338
+ throw new ViewerError("invalid-file", "\u6570\u7EC4\u6570\u636E\u8303\u56F4\u8D85\u51FA\u6587\u4EF6\u672B\u5C3E\u3002");
339
+ }
340
+ }
341
+ };
342
+
343
+ // ../plugins/dev-array/src/npz.ts
344
+ var EOCD_SIGNATURE = 101010256;
345
+ var CENTRAL_SIGNATURE = 33639248;
346
+ var LOCAL_SIGNATURE = 67324752;
347
+ var MAX_COMMENT_BYTES = 65535;
348
+ var MAX_DIRECTORY_BYTES = 32 * 1024 * 1024;
349
+ var MAX_ENTRIES = 1e4;
350
+ var MAX_PATH_BYTES = 16 * 1024;
351
+ var MAX_TOTAL_PATH_BYTES = 32 * 1024 * 1024;
352
+ var MAX_ARRAY_BYTES = 2 * 1024 * 1024 * 1024;
353
+ var MAX_COMPRESSION_RATIO = 1e3;
354
+ var MAX_DECOMPRESSED_CACHE_BYTES = 2 * 1024 * 1024;
355
+ function invalid3(message) {
356
+ throw new ViewerError("invalid-file", `NPZ ${message}\u3002`);
357
+ }
358
+ function view(bytes) {
359
+ return new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
360
+ }
361
+ async function readNpzEntries(file, signal) {
362
+ const source = new FileByteSource(file, signal);
363
+ if (file.size < 22) invalid3("ZIP \u5C3E\u8BB0\u5F55\u5DF2\u622A\u65AD");
364
+ const tailLength = Math.min(file.size, 22 + MAX_COMMENT_BYTES);
365
+ const tailStart = file.size - tailLength;
366
+ const tail = await source.read(tailStart, tailLength);
367
+ let eocd = -1;
368
+ for (let offset2 = tail.length - 22; offset2 >= 0; offset2 -= 1) {
369
+ if (view(tail).getUint32(offset2, true) === EOCD_SIGNATURE && offset2 + 22 + view(tail).getUint16(offset2 + 20, true) === tail.length) {
370
+ eocd = offset2;
371
+ break;
372
+ }
373
+ }
374
+ if (eocd < 0) invalid3("\u627E\u4E0D\u5230 ZIP \u4E2D\u592E\u76EE\u5F55\u5C3E\u8BB0\u5F55");
375
+ const tailView = view(tail);
376
+ const entryCount = tailView.getUint16(eocd + 10, true);
377
+ const directoryLength = tailView.getUint32(eocd + 12, true);
378
+ const directoryOffset = tailView.getUint32(eocd + 16, true);
379
+ if (entryCount === 65535 || directoryLength === 4294967295 || directoryOffset === 4294967295) {
380
+ throw new ViewerError("resource-limit", "NPZ \u6682\u4E0D\u652F\u6301 ZIP64 \u76EE\u5F55\u3002");
381
+ }
382
+ if (entryCount > MAX_ENTRIES) throw new ViewerError("resource-limit", "NPZ \u6761\u76EE\u8D85\u8FC7 1 \u4E07\u6761\u4E0A\u9650\u3002");
383
+ if (directoryLength > MAX_DIRECTORY_BYTES) throw new ViewerError("resource-limit", "NPZ \u4E2D\u592E\u76EE\u5F55\u8D85\u8FC7 32 MiB \u4E0A\u9650\u3002");
384
+ if (!Number.isSafeInteger(directoryOffset + directoryLength) || directoryOffset + directoryLength > tailStart + eocd) {
385
+ invalid3("\u4E2D\u592E\u76EE\u5F55\u8303\u56F4\u65E0\u6548");
386
+ }
387
+ const directory = await source.read(directoryOffset, directoryLength);
388
+ const entries = [];
389
+ let totalPathBytes = 0;
390
+ let offset = 0;
391
+ for (let index = 0; index < entryCount; index += 1) {
392
+ if (offset + 46 > directory.length || view(directory).getUint32(offset, true) !== CENTRAL_SIGNATURE) {
393
+ invalid3("\u4E2D\u592E\u76EE\u5F55\u6761\u76EE\u5DF2\u635F\u574F\u6216\u622A\u65AD");
394
+ }
395
+ const data = view(directory);
396
+ const flags = data.getUint16(offset + 8, true);
397
+ const compressionMethod = data.getUint16(offset + 10, true);
398
+ const crc32 = data.getUint32(offset + 16, true);
399
+ const compressedSize = data.getUint32(offset + 20, true);
400
+ const uncompressedSize = data.getUint32(offset + 24, true);
401
+ const nameLength = data.getUint16(offset + 28, true);
402
+ const extraLength = data.getUint16(offset + 30, true);
403
+ const commentLength = data.getUint16(offset + 32, true);
404
+ const localHeaderOffset = data.getUint32(offset + 42, true);
405
+ const next = offset + 46 + nameLength + extraLength + commentLength;
406
+ if (!nameLength || nameLength > MAX_PATH_BYTES || next > directory.length) invalid3("\u6761\u76EE\u8DEF\u5F84\u6216\u8BB0\u5F55\u8303\u56F4\u65E0\u6548");
407
+ const nameBytes = directory.subarray(offset + 46, offset + 46 + nameLength);
408
+ totalPathBytes += nameLength;
409
+ if (totalPathBytes > MAX_TOTAL_PATH_BYTES) throw new ViewerError("resource-limit", "NPZ \u8DEF\u5F84\u6587\u672C\u7D2F\u8BA1\u8D85\u8FC7 32 MiB \u4E0A\u9650\u3002");
410
+ let name;
411
+ try {
412
+ name = new TextDecoder(flags & 2048 ? "utf-8" : "latin1", { fatal: true }).decode(nameBytes);
413
+ } catch {
414
+ invalid3("\u6761\u76EE\u8DEF\u5F84\u7F16\u7801\u65E0\u6548");
415
+ }
416
+ if (name.toLowerCase().endsWith(".npy") && !name.endsWith("/")) {
417
+ entries.push({ name, compressedSize, uncompressedSize, compressionMethod, flags, localHeaderOffset, crc32 });
418
+ }
419
+ offset = next;
420
+ }
421
+ if (offset !== directory.length) invalid3("\u4E2D\u592E\u76EE\u5F55\u957F\u5EA6\u4E0E\u6761\u76EE\u4E0D\u4E00\u81F4");
422
+ return entries;
423
+ }
424
+ var CompressedEntrySource = class {
425
+ constructor(file, start, compressedSize, uncompressedSize, signal) {
426
+ this.file = file;
427
+ this.start = start;
428
+ this.compressedSize = compressedSize;
429
+ this.signal = signal;
430
+ this.produced = 0;
431
+ this.cacheStart = 0;
432
+ this.cache = new Uint8Array();
433
+ this.size = uncompressedSize;
434
+ }
435
+ async read(start, length) {
436
+ const end = start + length;
437
+ if (!Number.isSafeInteger(start) || !Number.isSafeInteger(length) || start < 0 || length < 0 || !Number.isSafeInteger(end) || end > this.size) invalid3("\u6570\u7EC4\u6761\u76EE\u8BFB\u53D6\u8303\u56F4\u65E0\u6548");
438
+ if (length === 0) return new Uint8Array();
439
+ if (this.signal.aborted) throw abortError();
440
+ if (typeof DecompressionStream === "undefined") {
441
+ throw new ViewerError("unsupported-environment", "\u5F53\u524D\u6D4F\u89C8\u5668\u4E0D\u652F\u6301 NPZ DEFLATE \u6D41\u5F0F\u89E3\u538B\u3002");
442
+ }
443
+ if (start < this.cacheStart) await this.restart();
444
+ const cachedEnd = this.cacheStart + this.cache.length;
445
+ if (start >= this.cacheStart && end <= cachedEnd) {
446
+ return this.cache.slice(start - this.cacheStart, end - this.cacheStart);
447
+ }
448
+ if (!this.reader) this.openReader();
449
+ const abort = () => {
450
+ void this.reader?.cancel().catch(() => void 0);
451
+ };
452
+ this.signal.addEventListener("abort", abort, { once: true });
453
+ try {
454
+ while (this.produced < end) {
455
+ if (this.signal.aborted) throw abortError();
456
+ const chunk = await this.reader.read();
457
+ if (chunk.done) invalid3("DEFLATE \u6761\u76EE\u5DF2\u622A\u65AD");
458
+ this.produced += chunk.value.byteLength;
459
+ if (this.produced > this.size) invalid3("DEFLATE \u8F93\u51FA\u8D85\u8FC7\u6761\u76EE\u58F0\u660E\u5927\u5C0F");
460
+ const combined = new Uint8Array(this.cache.length + chunk.value.length);
461
+ combined.set(this.cache);
462
+ combined.set(chunk.value, this.cache.length);
463
+ this.cache = combined;
464
+ const trimBefore = Math.min(start, this.produced - MAX_DECOMPRESSED_CACHE_BYTES);
465
+ if (trimBefore > this.cacheStart) {
466
+ this.cache = this.cache.slice(trimBefore - this.cacheStart);
467
+ this.cacheStart = trimBefore;
468
+ }
469
+ }
470
+ return this.cache.slice(start - this.cacheStart, end - this.cacheStart);
471
+ } catch (error) {
472
+ if (this.signal.aborted) throw abortError();
473
+ if (error instanceof ViewerError) throw error;
474
+ throw new ViewerError("invalid-file", "NPZ DEFLATE \u6761\u76EE\u5DF2\u635F\u574F\u3002", { cause: error });
475
+ } finally {
476
+ this.signal.removeEventListener("abort", abort);
477
+ }
478
+ }
479
+ async dispose() {
480
+ await this.restart();
481
+ }
482
+ openReader() {
483
+ const stream = this.file.slice(this.start, this.start + this.compressedSize).stream().pipeThrough(new DecompressionStream("deflate-raw"));
484
+ this.reader = stream.getReader();
485
+ this.produced = 0;
486
+ this.cacheStart = 0;
487
+ this.cache = new Uint8Array();
488
+ }
489
+ async restart() {
490
+ await this.reader?.cancel().catch(() => void 0);
491
+ this.reader = void 0;
492
+ this.produced = 0;
493
+ this.cacheStart = 0;
494
+ this.cache = new Uint8Array();
495
+ }
496
+ };
497
+ async function openNpzEntry(file, entry, signal) {
498
+ if (entry.flags & 1) invalid3("\u6570\u7EC4\u6761\u76EE\u5DF2\u52A0\u5BC6");
499
+ if (entry.compressionMethod !== 0 && entry.compressionMethod !== 8) invalid3(`\u538B\u7F29\u65B9\u6CD5 ${entry.compressionMethod} \u4E0D\u53D7\u652F\u6301`);
500
+ if (entry.uncompressedSize > MAX_ARRAY_BYTES) throw new ViewerError("resource-limit", "NPZ \u6570\u7EC4\u6761\u76EE\u8D85\u8FC7 2 GiB \u4E0A\u9650\u3002");
501
+ if (entry.uncompressedSize > Math.max(1024 * 1024, entry.compressedSize * MAX_COMPRESSION_RATIO)) {
502
+ throw new ViewerError("resource-limit", "NPZ \u6570\u7EC4\u6761\u76EE\u7684\u538B\u7F29\u6BD4\u8D85\u8FC7 1000:1 \u5B89\u5168\u4E0A\u9650\u3002");
503
+ }
504
+ const source = new FileByteSource(file, signal);
505
+ const header = await source.read(entry.localHeaderOffset, 30);
506
+ const data = view(header);
507
+ if (data.getUint32(0, true) !== LOCAL_SIGNATURE) invalid3("\u672C\u5730\u6587\u4EF6\u5934\u7B7E\u540D\u65E0\u6548");
508
+ const nameLength = data.getUint16(26, true);
509
+ const extraLength = data.getUint16(28, true);
510
+ const dataOffset = entry.localHeaderOffset + 30 + nameLength + extraLength;
511
+ if (!Number.isSafeInteger(dataOffset + entry.compressedSize) || dataOffset + entry.compressedSize > file.size) {
512
+ invalid3("\u6570\u7EC4\u6761\u76EE\u6570\u636E\u8303\u56F4\u8D85\u51FA\u6587\u4EF6\u672B\u5C3E");
513
+ }
514
+ if (entry.compressionMethod === 0) {
515
+ const fileSource = new FileByteSource(file, signal);
516
+ return {
517
+ size: entry.uncompressedSize,
518
+ read(start, length) {
519
+ if (!Number.isSafeInteger(start) || !Number.isSafeInteger(length) || start < 0 || length < 0 || !Number.isSafeInteger(start + length) || start + length > entry.uncompressedSize) {
520
+ invalid3("\u6570\u7EC4\u6761\u76EE\u8BFB\u53D6\u8303\u56F4\u65E0\u6548");
521
+ }
522
+ return fileSource.read(dataOffset + start, length);
523
+ }
524
+ };
525
+ }
526
+ return new CompressedEntrySource(file, dataOffset, entry.compressedSize, entry.uncompressedSize, signal);
527
+ }
528
+
529
+ // ../plugins/dev-array/src/extract.ts
530
+ var PLUGIN_ID = "dev-array-viewer";
531
+ var MAX_TARGETS = 500;
532
+ var MAX_INSPECT_NPZ_DESCRIPTORS = 32;
533
+ var MAX_STATS_ELEMENTS = 4096;
534
+ var MAX_SLICE_ROWS = 512;
535
+ var MAX_SLICE_BYTES = 1024 * 1024;
536
+ var NPY_MAGIC = [147, 78, 85, 77, 80, 89];
537
+ function mapError(error) {
538
+ if (error instanceof AgentError) throw error;
539
+ if (isViewerAbortError(error)) throw error;
540
+ if (error instanceof ViewerError) {
541
+ const code = error.code === "resource-limit" ? "resource-limit" : "invalid-file";
542
+ throw new AgentError(code, error.message, { pluginId: PLUGIN_ID, cause: error });
543
+ }
544
+ throw new AgentError(
545
+ "invalid-file",
546
+ error instanceof Error ? error.message : "Failed to parse NumPy array.",
547
+ { pluginId: PLUGIN_ID, cause: error }
548
+ );
549
+ }
550
+ async function detectContainer(context) {
551
+ if (context.file.size === 0) {
552
+ throw new AgentError("invalid-file", "Empty file is not a valid NumPy array.", { pluginId: PLUGIN_ID });
553
+ }
554
+ const head = await context.source.read(0, Math.min(6, context.source.size), context.signal);
555
+ if (head.byteLength >= 6 && NPY_MAGIC.every((byte, index) => head[index] === byte)) return "npy";
556
+ if (head.byteLength >= 2 && head[0] === 80 && head[1] === 75) return "npz";
557
+ const lower = context.file.name.toLowerCase();
558
+ if (lower.endsWith(".npy")) return "npy";
559
+ if (lower.endsWith(".npz")) return "npz";
560
+ throw new AgentError("invalid-file", "File is not a valid NPY or NPZ archive.", { pluginId: PLUGIN_ID });
561
+ }
562
+ function numericSampleValue(bytes, offset, dtype) {
563
+ if (dtype.kind !== "i" && dtype.kind !== "u" && dtype.kind !== "f") return null;
564
+ const text = decodeScalar(bytes, offset, dtype);
565
+ const value = Number(text);
566
+ return Number.isNaN(value) ? Number.NaN : value;
567
+ }
568
+ async function computeNumericStats(source, descriptor) {
569
+ const { dtype } = descriptor;
570
+ if (dtype.type !== "scalar" || dtype.kind !== "i" && dtype.kind !== "u" && dtype.kind !== "f") return null;
571
+ if (descriptor.elementCount === 0) return { sampleCount: 0 };
572
+ const sampleCount = Math.min(
573
+ descriptor.elementCount,
574
+ MAX_STATS_ELEMENTS,
575
+ Math.max(1, Math.floor(MAX_SLICE_BYTES / dtype.itemSize))
576
+ );
577
+ const bytes = await source.read(descriptor.dataOffset, sampleCount * dtype.itemSize);
578
+ let min = Number.POSITIVE_INFINITY;
579
+ let max = Number.NEGATIVE_INFINITY;
580
+ let sum = 0;
581
+ let finiteCount = 0;
582
+ let nanCount = 0;
583
+ for (let i = 0; i < sampleCount; i += 1) {
584
+ const val = numericSampleValue(bytes, i * dtype.itemSize, dtype);
585
+ if (val === null) return null;
586
+ if (Number.isNaN(val)) {
587
+ nanCount += 1;
588
+ } else if (Number.isFinite(val)) {
589
+ if (val < min) min = val;
590
+ if (val > max) max = val;
591
+ sum += val;
592
+ finiteCount += 1;
593
+ }
594
+ }
595
+ return {
596
+ sampleCount,
597
+ sampledAll: sampleCount === descriptor.elementCount,
598
+ finiteCount,
599
+ nanCount,
600
+ min: finiteCount > 0 ? min : null,
601
+ max: finiteCount > 0 ? max : null,
602
+ mean: finiteCount > 0 ? sum / finiteCount : null
603
+ };
604
+ }
605
+ function coordinates(index, dimensions, fortran) {
606
+ if (dimensions.length === 0) return "()";
607
+ const result = new Array(dimensions.length);
608
+ let remaining = index;
609
+ if (fortran) {
610
+ for (let axis = 0; axis < dimensions.length; axis += 1) {
611
+ result[axis] = remaining % dimensions[axis];
612
+ remaining = Math.floor(remaining / dimensions[axis]);
613
+ }
614
+ } else {
615
+ for (let axis = dimensions.length - 1; axis >= 0; axis -= 1) {
616
+ result[axis] = remaining % dimensions[axis];
617
+ remaining = Math.floor(remaining / dimensions[axis]);
618
+ }
619
+ }
620
+ return `(${result.join(", ")})`;
621
+ }
622
+ function decodeField(bytes, offset, field) {
623
+ const count = field.shape.reduce((value, dimension) => value * dimension, 1);
624
+ if (field.dtype.type === "structured") return "[nested structure]";
625
+ if (count === 1) return decodeScalar(bytes, offset, field.dtype);
626
+ const values = [];
627
+ for (let index = 0; index < count; index += 1) {
628
+ values.push(decodeScalar(bytes, offset + index * field.dtype.itemSize, field.dtype));
629
+ }
630
+ return `[${values.join(", ")}]`;
631
+ }
632
+ function descriptorSummary(descriptor) {
633
+ return {
634
+ version: descriptor.version,
635
+ dtype: descriptor.dtype.source,
636
+ shape: [...descriptor.shape],
637
+ fortranOrder: descriptor.fortranOrder,
638
+ elementCount: descriptor.elementCount,
639
+ itemSize: descriptor.dtype.itemSize,
640
+ objectArray: descriptor.dtype.object
641
+ };
642
+ }
643
+ function resolveNpzEntry(entries, target) {
644
+ if (entries.length === 0) {
645
+ throw new AgentError("invalid-file", "NPZ archive contains no .npy entries.", { pluginId: PLUGIN_ID });
646
+ }
647
+ if (target === void 0) return entries[0];
648
+ if (!target.startsWith("array:")) {
649
+ throw new AgentError("target-not-found", `Unknown array target: "${target}".`, { pluginId: PLUGIN_ID });
650
+ }
651
+ const rest = target.slice("array:".length);
652
+ const direct = entries.find((entry) => entry.name === rest);
653
+ if (direct) return direct;
654
+ try {
655
+ const decoded = decodeURIComponent(rest);
656
+ const matched = entries.find((entry) => entry.name === decoded);
657
+ if (matched) return matched;
658
+ } catch {
659
+ throw new AgentError("target-not-found", `Malformed array target: "${target}".`, { pluginId: PLUGIN_ID });
660
+ }
661
+ if (/^\d+$/.test(rest)) {
662
+ const index = Number(rest);
663
+ if (index >= 0 && index < entries.length) return entries[index];
664
+ }
665
+ throw new AgentError("target-not-found", `Array entry not found: "${target}".`, { pluginId: PLUGIN_ID });
666
+ }
667
+ async function readDescriptorSlice(source, descriptor, params, maxBytes) {
668
+ const start = parsePositionCursor(params.cursor, "row:", PLUGIN_ID);
669
+ const needle = params.filter?.trim().toLowerCase();
670
+ const filterApplied = needle ? true : void 0;
671
+ if (descriptor.dtype.object) {
672
+ if (start > 0) {
673
+ throw new AgentError("target-not-found", `Cursor row ${start} is out of range.`, { pluginId: PLUGIN_ID });
674
+ }
675
+ const text = `Python object array (dtype \`${descriptor.dtype.source}\`, shape \`[${descriptor.shape.join(", ")}]\`, ${descriptor.elementCount} elements) is not deserialized for safety.`;
676
+ const out = truncateUtf8(text, maxBytes);
677
+ return {
678
+ content: out.text,
679
+ contentType: "markdown",
680
+ truncated: out.truncated,
681
+ ...filterApplied !== void 0 ? { filterApplied } : {}
682
+ };
683
+ }
684
+ if (start > descriptor.elementCount) {
685
+ throw new AgentError("target-not-found", `Cursor row ${start} is out of range.`, { pluginId: PLUGIN_ID });
686
+ }
687
+ if (descriptor.elementCount === 0) {
688
+ const out = truncateUtf8(`Empty array (dtype \`${descriptor.dtype.source}\`, shape \`[${descriptor.shape.join(", ")}]\`).`, maxBytes);
689
+ return {
690
+ content: out.text,
691
+ contentType: "markdown",
692
+ truncated: out.truncated,
693
+ ...filterApplied !== void 0 ? { filterApplied } : {}
694
+ };
695
+ }
696
+ const maxRowsByBytes = Math.max(1, Math.floor(MAX_SLICE_BYTES / descriptor.dtype.itemSize));
697
+ const windowSize = Math.min(descriptor.elementCount - start, MAX_SLICE_ROWS, maxRowsByBytes);
698
+ const bytes = windowSize > 0 ? await source.read(descriptor.dataOffset + start * descriptor.dtype.itemSize, windowSize * descriptor.dtype.itemSize) : new Uint8Array();
699
+ const dtype = descriptor.dtype;
700
+ const columns = dtype.type === "structured" ? ["Index", ...dtype.fields.map((field) => field.name)] : ["Index", "Value"];
701
+ function* rowGenerator() {
702
+ for (let i = 0; i < windowSize; i += 1) {
703
+ const offset = i * dtype.itemSize;
704
+ const row = [coordinates(start + i, descriptor.shape, descriptor.fortranOrder)];
705
+ if (dtype.type === "structured") {
706
+ for (const field of dtype.fields) row.push(decodeField(bytes, offset + field.offset, field));
707
+ } else {
708
+ row.push(decodeScalar(bytes, offset, dtype));
709
+ }
710
+ if (needle && !row.some((cell) => cell.toLowerCase().includes(needle))) {
711
+ yield null;
712
+ } else {
713
+ yield row;
714
+ }
715
+ }
716
+ }
717
+ const result = renderMarkdownTablePage({
718
+ columns,
719
+ rows: rowGenerator(),
720
+ start,
721
+ maxBytes,
722
+ cursorPrefix: "row:",
723
+ hasMoreAfter: () => start + windowSize < descriptor.elementCount
724
+ });
725
+ return {
726
+ ...result,
727
+ ...filterApplied !== void 0 ? { filterApplied } : {}
728
+ };
729
+ }
730
+ var devArrayExtractor = {
731
+ async inspect(context) {
732
+ if (context.signal.aborted) throw abortError();
733
+ try {
734
+ const container = await detectContainer(context);
735
+ if (container === "npy") {
736
+ const source = new FileByteSource(context.file, context.signal);
737
+ const descriptor = await readNpyDescriptor(source);
738
+ const stats = await computeNumericStats(source, descriptor);
739
+ return {
740
+ metadata: {
741
+ container: "npy",
742
+ sizeBytes: context.source.size,
743
+ ...descriptorSummary(descriptor),
744
+ ...stats ? { stats } : {}
745
+ },
746
+ targets: [
747
+ {
748
+ id: "array:0",
749
+ title: context.source.name,
750
+ kind: "array",
751
+ size: descriptor.elementCount
752
+ }
753
+ ]
754
+ };
755
+ }
756
+ const entries = await readNpzEntries(context.file, context.signal);
757
+ if (entries.length === 0) {
758
+ throw new AgentError("invalid-file", "NPZ archive contains no .npy entries.", { pluginId: PLUGIN_ID });
759
+ }
760
+ const previews = {};
761
+ const inspectCount = Math.min(entries.length, MAX_INSPECT_NPZ_DESCRIPTORS);
762
+ for (let i = 0; i < inspectCount; i += 1) {
763
+ if (context.signal.aborted) throw abortError();
764
+ const entry = entries[i];
765
+ const entrySource = await openNpzEntry(context.file, entry, context.signal);
766
+ try {
767
+ const desc = await readNpyDescriptor(entrySource);
768
+ previews[entry.name] = descriptorSummary(desc);
769
+ } finally {
770
+ await entrySource.dispose?.();
771
+ }
772
+ }
773
+ const targetsTruncated = entries.length > MAX_TARGETS;
774
+ const targets = entries.slice(0, MAX_TARGETS).map((entry) => ({
775
+ id: `array:${encodeURIComponent(entry.name)}`,
776
+ title: entry.name,
777
+ kind: "array",
778
+ size: entry.uncompressedSize
779
+ }));
780
+ return {
781
+ metadata: {
782
+ container: "npz",
783
+ sizeBytes: context.source.size,
784
+ arrayCount: entries.length,
785
+ arrays: previews
786
+ },
787
+ targets,
788
+ ...targetsTruncated ? { targetsTruncated: true } : {}
789
+ };
790
+ } catch (error) {
791
+ mapError(error);
792
+ }
793
+ },
794
+ async read(context, params) {
795
+ if (context.signal.aborted) throw abortError();
796
+ const maxBytes = Math.min(params.maxBytes, HARD_READ_MAX_BYTES);
797
+ try {
798
+ const container = await detectContainer(context);
799
+ if (container === "npy") {
800
+ const target = params.target ?? "array:0";
801
+ if (target !== "array:0") {
802
+ throw new AgentError("target-not-found", `Array target not found: "${target}".`, { pluginId: PLUGIN_ID });
803
+ }
804
+ const source = new FileByteSource(context.file, context.signal);
805
+ const descriptor = await readNpyDescriptor(source);
806
+ return await readDescriptorSlice(source, descriptor, params, maxBytes);
807
+ }
808
+ const entries = await readNpzEntries(context.file, context.signal);
809
+ const entry = resolveNpzEntry(entries, params.target);
810
+ const entrySource = await openNpzEntry(context.file, entry, context.signal);
811
+ try {
812
+ const descriptor = await readNpyDescriptor(entrySource);
813
+ return await readDescriptorSlice(entrySource, descriptor, params, maxBytes);
814
+ } finally {
815
+ await entrySource.dispose?.();
816
+ }
817
+ } catch (error) {
818
+ mapError(error);
819
+ }
820
+ }
821
+ };
822
+ var extract_default = devArrayExtractor;
823
+ export {
824
+ extract_default as default
825
+ };