@poe-platform/safe-bash 0.1.811 → 0.1.813

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 (351) hide show
  1. package/dist/audio-ast/id3-source.d.ts +27 -0
  2. package/dist/audio-ast/index.d.ts +5 -0
  3. package/dist/audio-ast/index.js +1001 -596
  4. package/dist/audio-ast/mp3-source.d.ts +18 -0
  5. package/dist/audio-ast/ogg-source.d.ts +25 -0
  6. package/dist/audio-ast/ogg-stream-source.d.ts +22 -0
  7. package/dist/audio-ast/vorbis.d.ts +14 -0
  8. package/dist/image-ast/index.js +139 -9
  9. package/dist/mp4-ast/containers/adapters.d.ts +7 -0
  10. package/dist/office-xml/retained-xml-document.d.ts +8 -0
  11. package/dist/pdf-ast/ast.d.ts +2 -0
  12. package/dist/pdf-ast/content/dictionary-cursor.d.ts +15 -0
  13. package/dist/pdf-ast/content/range-operator-parser.d.ts +4 -0
  14. package/dist/pdf-ast/content/stored-dictionary.d.ts +10 -0
  15. package/dist/pdf-ast/cos/lexer.d.ts +8 -5
  16. package/dist/pdf-ast/cos/object-reader.d.ts +4 -3
  17. package/dist/pdf-ast/cos/range-parser.d.ts +4 -0
  18. package/dist/pdf-ast/cos/retained-objects.d.ts +1 -0
  19. package/dist/pdf-ast/cos/retained-writer.d.ts +1 -0
  20. package/dist/pdf-ast/cos/value-parser.d.ts +32 -2
  21. package/dist/pdf-ast/edit/retained-append-attachments.d.ts +13 -0
  22. package/dist/pdf-ast/edit/retained-bookmarks.d.ts +13 -0
  23. package/dist/pdf-ast/edit/retained-graph.d.ts +6 -0
  24. package/dist/pdf-ast/edit/retained-save.d.ts +2 -0
  25. package/dist/pdf-ast/edit/retained-stamps.d.ts +9 -0
  26. package/dist/pdf-ast/extract/retained-form-field-details.d.ts +20 -0
  27. package/dist/pdf-ast/extract/retained-form-fields.d.ts +17 -4
  28. package/dist/pdf-ast/fonts/resolve.d.ts +3 -1
  29. package/dist/pdf-ast/index.d.ts +4 -1
  30. package/dist/pdf-ast/index.js +2127 -975
  31. package/dist/pdf-ast/retained-document.d.ts +4 -0
  32. package/dist/safe-bash/audio-ast.browser.js +7 -1
  33. package/dist/safe-bash/chunks/{chunk-HHSOUC3Z.js → chunk-HPQE675Q.js} +1 -1
  34. package/dist/safe-bash/chunks/{chunk-BUYRKFW2.js → chunk-I6ECNJMR.js} +1 -1
  35. package/dist/safe-bash/chunks/{pdftk-WRYEP3CA.js → pdftk-Y2TX74LY.js} +2 -1
  36. package/dist/safe-bash/command-chunks/biff-4ALVARRF-7SRX6R6N.js +5192 -0
  37. package/dist/safe-bash/command-chunks/{chunk-EHSM5ZQS.js → chunk-2DGJOOXM.js} +8 -8
  38. package/dist/safe-bash/command-chunks/{chunk-Q6S57NOQ.js → chunk-2E2H7MBH.js} +7 -7
  39. package/dist/safe-bash/command-chunks/{chunk-MMBZTYXO.js → chunk-2PQRZDNR.js} +221 -0
  40. package/dist/safe-bash/command-chunks/{chunk-5OO2P27R.js → chunk-2V6FOLXV.js} +78 -25
  41. package/dist/safe-bash/command-chunks/{chunk-56NYSX65.js → chunk-2Z3WRRFT.js} +9 -9
  42. package/dist/safe-bash/command-chunks/chunk-3D24WDND.js +63 -0
  43. package/dist/safe-bash/command-chunks/{chunk-47NEG4UO.js → chunk-3JST2Q7G.js} +219 -43
  44. package/dist/safe-bash/command-chunks/{chunk-WGG6G2KG.js → chunk-3LJAXFH5.js} +7 -7
  45. package/dist/safe-bash/command-chunks/{chunk-AHA6IWAJ.js → chunk-3TYDSGAH.js} +6 -6
  46. package/dist/safe-bash/command-chunks/{chunk-YSMNXMAO.js → chunk-3Y4XZB24.js} +4 -4
  47. package/dist/safe-bash/command-chunks/{chunk-ZIIO6GRY.js → chunk-4PBNMKAT.js} +7 -7
  48. package/dist/safe-bash/command-chunks/{chunk-JFYWVQ4V.js → chunk-4Z6W5EOC.js} +8 -8
  49. package/dist/safe-bash/command-chunks/{chunk-GEM47B2P.js → chunk-57DDYKE5.js} +7 -7
  50. package/dist/safe-bash/command-chunks/{chunk-HARUYHH7.js → chunk-5HUICAWD.js} +1 -1
  51. package/dist/safe-bash/command-chunks/{chunk-4CKFNXRN.js → chunk-5IFRAI7Y.js} +1 -1
  52. package/dist/safe-bash/command-chunks/{chunk-RHYJVTJO.js → chunk-5KGEZ3RW.js} +2 -2
  53. package/dist/safe-bash/command-chunks/{chunk-A5FZBR7X.js → chunk-5MFDRSGG.js} +4 -4
  54. package/dist/safe-bash/command-chunks/{chunk-7GKKMNL6.js → chunk-5P6I2T63.js} +8 -8
  55. package/dist/safe-bash/command-chunks/{chunk-6M6TM5Z5.js → chunk-5VQVZPP3.js} +3 -3
  56. package/dist/safe-bash/command-chunks/{chunk-MIRL7HTF.js → chunk-6244HYJY.js} +1 -1
  57. package/dist/safe-bash/command-chunks/chunk-63EMPQ7Z.js +115 -0
  58. package/dist/safe-bash/command-chunks/{chunk-XRVKWGVQ.js → chunk-6CY5BHBS.js} +6 -6
  59. package/dist/safe-bash/command-chunks/{chunk-XVP6V5K3.js → chunk-6IWE7PTK.js} +6 -6
  60. package/dist/safe-bash/command-chunks/{chunk-6QBMND4A.js → chunk-6SRHWVEB.js} +1 -1
  61. package/dist/safe-bash/command-chunks/chunk-6ZHQB453.js +35 -0
  62. package/dist/safe-bash/command-chunks/chunk-73NYFNAS.js +173 -0
  63. package/dist/safe-bash/command-chunks/{chunk-VU3EQF7F.js → chunk-7NXTEWPR.js} +229 -75
  64. package/dist/safe-bash/command-chunks/{chunk-554Z6IKP.js → chunk-7PRL6RJ6.js} +2 -2
  65. package/dist/safe-bash/command-chunks/{chunk-SDTPO2VV.js → chunk-7PZHWMK6.js} +7 -7
  66. package/dist/safe-bash/command-chunks/{chunk-XZ2FWFNV.js → chunk-7QZ2HP2F.js} +6 -6
  67. package/dist/safe-bash/command-chunks/{chunk-OEJM666F.js → chunk-7UC2Q6Z6.js} +5 -5
  68. package/dist/safe-bash/command-chunks/{chunk-COKYZUBW.js → chunk-AJI55RS7.js} +1 -1
  69. package/dist/safe-bash/command-chunks/{chunk-2VCKUNDZ.js → chunk-B2C3UPJS.js} +27 -17
  70. package/dist/safe-bash/command-chunks/{chunk-WXRYDALR.js → chunk-BBAB7LC4.js} +4 -4
  71. package/dist/safe-bash/command-chunks/{chunk-QYMEASQ6.js → chunk-BEHUSUOY.js} +4 -4
  72. package/dist/safe-bash/command-chunks/{chunk-Z2JW6M2D.js → chunk-BK7ISUJL.js} +3 -3
  73. package/dist/safe-bash/command-chunks/{chunk-33YCKZZX.js → chunk-C5KLFZGT.js} +6 -6
  74. package/dist/safe-bash/command-chunks/{chunk-TVH4JORU.js → chunk-C5QDEB3I.js} +3 -3
  75. package/dist/safe-bash/command-chunks/{chunk-N4R2SHSS.js → chunk-CCZZVCHX.js} +2 -2
  76. package/dist/safe-bash/command-chunks/{chunk-2VLAXKTS.js → chunk-CTDC4LJT.js} +121 -85
  77. package/dist/safe-bash/command-chunks/{chunk-S6R3IB36.js → chunk-D55REQA3.js} +1 -1
  78. package/dist/safe-bash/command-chunks/{chunk-Y4EYCZFT.js → chunk-D6WJY6QO.js} +10 -10
  79. package/dist/safe-bash/command-chunks/{chunk-2CORNDGF.js → chunk-DBLHCJJU.js} +2 -2
  80. package/dist/safe-bash/command-chunks/{chunk-SPW4GW4Z.js → chunk-DFI7QF3M.js} +2 -2
  81. package/dist/safe-bash/command-chunks/{chunk-456PHA3L.js → chunk-DMCI6T6N.js} +1 -1
  82. package/dist/safe-bash/command-chunks/{chunk-TW73OXPR.js → chunk-EJTNVXWF.js} +6 -6
  83. package/dist/safe-bash/command-chunks/{chunk-QD7ZRDUN.js → chunk-ET2VPDUA.js} +1 -1
  84. package/dist/safe-bash/command-chunks/{chunk-5LI2DLNZ.js → chunk-EXOQGXEU.js} +26 -26
  85. package/dist/safe-bash/command-chunks/{chunk-CRV2Q3PB.js → chunk-EZ4NQIPL.js} +1 -1
  86. package/dist/safe-bash/command-chunks/chunk-FWKLBDMK.js +0 -0
  87. package/dist/safe-bash/command-chunks/{chunk-22MOB45U.js → chunk-FWPVQGYK.js} +6 -6
  88. package/dist/safe-bash/command-chunks/{chunk-QC5RMGSA.js → chunk-G3RUXKVY.js} +3 -3
  89. package/dist/safe-bash/command-chunks/{chunk-JYUJAF4L.js → chunk-G7NENPYV.js} +4 -0
  90. package/dist/safe-bash/command-chunks/{chunk-KCOJA7EM.js → chunk-GKILM4HZ.js} +7 -7
  91. package/dist/safe-bash/command-chunks/{chunk-HTVIYLVB.js → chunk-GNXTMSYN.js} +4 -4
  92. package/dist/safe-bash/command-chunks/{chunk-D2ASPM7R.js → chunk-GOBUDKZ3.js} +3 -3
  93. package/dist/safe-bash/command-chunks/{chunk-RNSKXOG3.js → chunk-GVWVRPG6.js} +6 -6
  94. package/dist/safe-bash/command-chunks/{chunk-ZHRGYR7B.js → chunk-HCKYUQ3L.js} +7 -7
  95. package/dist/safe-bash/command-chunks/{chunk-AGLK7OJR.js → chunk-HDSIIQBS.js} +1 -1
  96. package/dist/safe-bash/command-chunks/{chunk-DM2CPMB4.js → chunk-HKOMXGJS.js} +2 -2
  97. package/dist/safe-bash/command-chunks/{chunk-IT7TAC3F.js → chunk-HVW53ARH.js} +16 -16
  98. package/dist/safe-bash/command-chunks/{chunk-M7QE2MN7.js → chunk-I4GMCWAT.js} +6 -6
  99. package/dist/safe-bash/command-chunks/{chunk-5MB64DWR.js → chunk-IHSOOSNC.js} +9 -9
  100. package/dist/safe-bash/command-chunks/{chunk-LCZDBW55.js → chunk-JAHJWVGF.js} +5 -5
  101. package/dist/safe-bash/command-chunks/{chunk-MOZD7RUY.js → chunk-JORIVUPM.js} +27 -11
  102. package/dist/safe-bash/command-chunks/{chunk-PMAM4N33.js → chunk-JUJHYPYL.js} +9 -9
  103. package/dist/safe-bash/command-chunks/{chunk-ENT3IV2G.js → chunk-KBUBSMCQ.js} +12 -12
  104. package/dist/safe-bash/command-chunks/{chunk-ZXR6LXV5.js → chunk-KCE5D4Z4.js} +48 -4
  105. package/dist/safe-bash/command-chunks/{chunk-FIIAYCWS.js → chunk-KZ5ODST6.js} +2 -2
  106. package/dist/safe-bash/command-chunks/{chunk-PNGDJA6M.js → chunk-LD7BONZY.js} +2 -2
  107. package/dist/safe-bash/command-chunks/{chunk-KJ4XXZIL.js → chunk-M3Z5PU2M.js} +582 -59
  108. package/dist/safe-bash/command-chunks/{chunk-LXLLA4PM.js → chunk-MKX4JAZ6.js} +17 -17
  109. package/dist/safe-bash/command-chunks/{chunk-RQIQ75W5.js → chunk-MNHBQBF6.js} +5 -5
  110. package/dist/safe-bash/command-chunks/{chunk-A2CLZMQZ.js → chunk-MPKY37QR.js} +1 -1
  111. package/dist/safe-bash/command-chunks/{chunk-K5GB2YMN.js → chunk-MUUWBZIC.js} +10 -10
  112. package/dist/safe-bash/command-chunks/{chunk-JOCFI7TG.js → chunk-N32GSM3J.js} +1 -1
  113. package/dist/safe-bash/command-chunks/{chunk-EUT24Y5Z.js → chunk-NKTULXVD.js} +8 -8
  114. package/dist/safe-bash/command-chunks/{chunk-5HPU7D36.js → chunk-NMPED6L5.js} +4 -4
  115. package/dist/safe-bash/command-chunks/{chunk-QZZ73J2O.js → chunk-NPFHUS4X.js} +6 -6
  116. package/dist/safe-bash/command-chunks/{chunk-X7FA7ZD5.js → chunk-O675URF4.js} +8 -8
  117. package/dist/safe-bash/command-chunks/{chunk-R6EGGK5M.js → chunk-P7EL2FWW.js} +7 -7
  118. package/dist/safe-bash/command-chunks/{chunk-YS25EI54.js → chunk-PCCFLPUQ.js} +2 -2
  119. package/dist/safe-bash/command-chunks/{chunk-RRL3Y562.js → chunk-PI6MOMHA.js} +11 -11
  120. package/dist/safe-bash/command-chunks/{chunk-26VCZHLJ.js → chunk-PIOQBOEK.js} +1 -1
  121. package/dist/safe-bash/command-chunks/chunk-PK36TVXB.js +175 -0
  122. package/dist/safe-bash/command-chunks/{chunk-72C3TZ2U.js → chunk-PKLJRB7W.js} +264 -129
  123. package/dist/safe-bash/command-chunks/{chunk-6CCQI6XZ.js → chunk-PSCOXGCA.js} +12 -12
  124. package/dist/safe-bash/command-chunks/{chunk-XPD636C4.js → chunk-PVGZMLC6.js} +3 -3
  125. package/dist/safe-bash/command-chunks/{chunk-JQVHUSDD.js → chunk-PXWS3Q7L.js} +5 -5
  126. package/dist/safe-bash/command-chunks/{chunk-HDJVJTCK.js → chunk-QFF5KBOM.js} +9 -9
  127. package/dist/safe-bash/command-chunks/{chunk-MPUHH2KR.js → chunk-QM2HZJSJ.js} +3 -3
  128. package/dist/safe-bash/command-chunks/{chunk-UAXSE3XE.js → chunk-R2BMZAHG.js} +5 -5
  129. package/dist/safe-bash/command-chunks/{chunk-KB7DUBVL.js → chunk-RGOQKIG6.js} +5 -5
  130. package/dist/safe-bash/command-chunks/{chunk-D2KZ66W4.js → chunk-RLCQ7BN3.js} +187 -39
  131. package/dist/safe-bash/command-chunks/{chunk-B5LDP7AA.js → chunk-S2N2V5U4.js} +2 -2
  132. package/dist/safe-bash/command-chunks/{chunk-OA75SGN2.js → chunk-SGPCXAG7.js} +7 -7
  133. package/dist/safe-bash/command-chunks/{chunk-Z5QOVRVH.js → chunk-SU26FZLJ.js} +1 -1
  134. package/dist/safe-bash/command-chunks/{chunk-QUM3SYAJ.js → chunk-SYSX46IV.js} +3 -3
  135. package/dist/safe-bash/command-chunks/chunk-T3E5RV3U.js +737 -0
  136. package/dist/safe-bash/command-chunks/{chunk-YORJDX4V.js → chunk-T5ERNELL.js} +4 -4
  137. package/dist/safe-bash/command-chunks/{chunk-KL3OIBKB.js → chunk-T6C5QP7T.js} +6495 -6343
  138. package/dist/safe-bash/command-chunks/{chunk-ATTWQVR2.js → chunk-TKRLZIFI.js} +17 -17
  139. package/dist/safe-bash/command-chunks/{chunk-ZMHEGDU2.js → chunk-TODWFDYB.js} +2 -2
  140. package/dist/safe-bash/command-chunks/{chunk-YSY6R6AS.js → chunk-TQEB4DH4.js} +703 -102
  141. package/dist/safe-bash/command-chunks/{chunk-36XGIPOG.js → chunk-U5TWQFZY.js} +1 -1
  142. package/dist/safe-bash/command-chunks/{chunk-APEWTWCC.js → chunk-UAF4IX5H.js} +6 -6
  143. package/dist/safe-bash/command-chunks/{chunk-6VPQ3CDZ.js → chunk-V37D6AHO.js} +5 -5
  144. package/dist/safe-bash/command-chunks/{chunk-RID6VYS3.js → chunk-V6XBEYPC.js} +8 -8
  145. package/dist/safe-bash/command-chunks/{chunk-WJCN2IXI.js → chunk-VQOINPVF.js} +2 -2
  146. package/dist/safe-bash/command-chunks/{chunk-W5YSINXC.js → chunk-VVWXY6IA.js} +6 -6
  147. package/dist/safe-bash/command-chunks/{chunk-HKATEVAP.js → chunk-WPVBUVFK.js} +6 -6
  148. package/dist/safe-bash/command-chunks/{chunk-UYWSIIUX.js → chunk-X53AEG36.js} +7 -7
  149. package/dist/safe-bash/command-chunks/{chunk-L5MCW6CM.js → chunk-X64XGIXZ.js} +9 -155
  150. package/dist/safe-bash/command-chunks/{chunk-Q73EMLLZ.js → chunk-X6RHJ6YN.js} +84 -5
  151. package/dist/safe-bash/command-chunks/{chunk-7PVHO47B.js → chunk-XG6UWQV5.js} +6 -6
  152. package/dist/safe-bash/command-chunks/{chunk-NQDIT667.js → chunk-XIDGHIGB.js} +5 -5
  153. package/dist/safe-bash/command-chunks/{chunk-DPR5CYQV.js → chunk-XITDDJFT.js} +2 -0
  154. package/dist/safe-bash/command-chunks/{chunk-CV7M2QJU.js → chunk-XLYIVBAR.js} +7 -7
  155. package/dist/safe-bash/command-chunks/{chunk-WVMHRNXZ.js → chunk-YUXTK3XA.js} +3 -3
  156. package/dist/safe-bash/command-chunks/{chunk-SPLOIABU.js → chunk-YXD6VGVG.js} +3 -3
  157. package/dist/safe-bash/command-chunks/{chunk-2ZFLMWOX.js → chunk-Z5BIM5B7.js} +1 -1
  158. package/dist/safe-bash/command-chunks/chunk-ZYLGNIGA.js +156 -0
  159. package/dist/safe-bash/command-chunks/{command-engine-BEWABZ75.js → command-engine-X3OLN7N6.js} +206 -86
  160. package/dist/safe-bash/command-chunks/{engine-AXXFTGCL-QBQNBI6K.js → engine-XUCIFZ7V-LJFGZM6O.js} +1 -1
  161. package/dist/safe-bash/command-chunks/paradox-4FCZE53D-LQPGVMEL.js +365 -0
  162. package/dist/safe-bash/commands/pandoc/index.browser.js +1 -1
  163. package/dist/safe-bash/full-core.browser.js +2 -2
  164. package/dist/safe-bash/plugins/index.browser.js +2 -2
  165. package/dist/safe-bash-command-apply-patch/apply.js +4 -4
  166. package/dist/safe-bash-command-apply-patch/index.js +4 -4
  167. package/dist/safe-bash-command-apply-patch/matcher.js +2 -2
  168. package/dist/safe-bash-command-apply-patch/parser.js +2 -2
  169. package/dist/safe-bash-command-apply-patch/shared.d.ts +2 -0
  170. package/dist/safe-bash-command-apply-patch/shared.js +1 -1
  171. package/dist/safe-bash-command-diff/diff.js +1 -1
  172. package/dist/safe-bash-command-diff/index.js +1 -1
  173. package/dist/safe-bash-command-ffmpeg/index.js +1 -1
  174. package/dist/safe-bash-command-ffprobe/index.js +2 -2
  175. package/dist/safe-bash-command-ffprobe/media.d.ts +3 -1
  176. package/dist/safe-bash-command-ffprobe/media.js +2 -2
  177. package/dist/safe-bash-command-html-to-markdown/budget.js +2 -1
  178. package/dist/safe-bash-command-html-to-markdown/entities.js +4 -3
  179. package/dist/safe-bash-command-html-to-markdown/index.js +564 -110
  180. package/dist/safe-bash-command-html-to-markdown/input.js +6 -5
  181. package/dist/safe-bash-command-html-to-markdown/options.js +2 -1
  182. package/dist/safe-bash-command-html-to-markdown/parser.js +5 -4
  183. package/dist/safe-bash-command-html-to-markdown/render.js +6 -5
  184. package/dist/safe-bash-command-html-to-markdown/text.js +3 -2
  185. package/dist/safe-bash-command-htmlq/index.js +361 -37
  186. package/dist/safe-bash-command-htmlq/tree.d.ts +3 -2
  187. package/dist/safe-bash-command-pandoc/command.js +7 -7
  188. package/dist/safe-bash-command-pandoc/index.js +55 -55
  189. package/dist/safe-bash-command-patch/index.js +6 -6
  190. package/dist/safe-bash-command-patch/patch-envelope.js +53 -3
  191. package/dist/safe-bash-command-patch/patch-formats.d.ts +2 -2
  192. package/dist/safe-bash-command-patch/patch-formats.js +2 -2
  193. package/dist/safe-bash-command-patch/patch-gnu-reject.d.ts +2 -1
  194. package/dist/safe-bash-command-patch/patch-gnu-reject.js +4 -3
  195. package/dist/safe-bash-command-patch/patch-publication.js +2 -1
  196. package/dist/safe-bash-command-patch/patch.js +6 -6
  197. package/dist/safe-bash-command-patch/unified.d.ts +10 -2
  198. package/dist/safe-bash-command-patch/unified.js +1 -1
  199. package/dist/safe-bash-command-pdftk/index.d.ts +6 -2
  200. package/dist/safe-bash-command-pdftk/index.js +835 -243
  201. package/dist/safe-bash-command-pptx/command-engine.d.ts +15 -3
  202. package/dist/safe-bash-command-pptx/engine.d.ts +2 -2
  203. package/dist/safe-bash-command-pptx/engine.js +1 -1
  204. package/dist/safe-bash-command-pptx/index.js +9 -2
  205. package/dist/safe-bash-command-soffice/index.js +1 -1
  206. package/dist/safe-bash-command-ssconvert/index.js +2 -2
  207. package/dist/safe-bash-command-xmllint/index.js +22 -31
  208. package/dist/safe-bash-diff-engine/document.d.ts +2 -1
  209. package/dist/safe-bash-diff-engine/document.js +7 -4
  210. package/dist/safe-bash-presentation-engine/accessibility.js +31 -30
  211. package/dist/safe-bash-presentation-engine/animation-editing.js +16 -15
  212. package/dist/safe-bash-presentation-engine/animations.js +16 -15
  213. package/dist/safe-bash-presentation-engine/backgrounds.js +17 -16
  214. package/dist/safe-bash-presentation-engine/bytes.js +3 -3
  215. package/dist/safe-bash-presentation-engine/chart-editing.js +34 -33
  216. package/dist/safe-bash-presentation-engine/chart-object-operations.js +25 -24
  217. package/dist/safe-bash-presentation-engine/charts.js +31 -30
  218. package/dist/safe-bash-presentation-engine/command-placeholder.js +59 -55
  219. package/dist/safe-bash-presentation-engine/comments.js +17 -16
  220. package/dist/safe-bash-presentation-engine/connector-operations.js +32 -31
  221. package/dist/safe-bash-presentation-engine/connectors.js +29 -28
  222. package/dist/safe-bash-presentation-engine/content-types.js +4 -4
  223. package/dist/safe-bash-presentation-engine/creation.js +6 -6
  224. package/dist/safe-bash-presentation-engine/diff.js +32 -31
  225. package/dist/safe-bash-presentation-engine/drawing-enums.d.ts +10 -10
  226. package/dist/safe-bash-presentation-engine/drawing-format.js +20 -19
  227. package/dist/safe-bash-presentation-engine/drawing-operations.js +31 -30
  228. package/dist/safe-bash-presentation-engine/drawing-schema.js +21 -20
  229. package/dist/safe-bash-presentation-engine/equations.js +17 -16
  230. package/dist/safe-bash-presentation-engine/errors.js +2 -2
  231. package/dist/safe-bash-presentation-engine/fields.js +17 -16
  232. package/dist/safe-bash-presentation-engine/font-metrics.js +3 -3
  233. package/dist/safe-bash-presentation-engine/image-extraction.js +20 -19
  234. package/dist/safe-bash-presentation-engine/image-formatting.js +32 -31
  235. package/dist/safe-bash-presentation-engine/image-insertion.js +18 -17
  236. package/dist/safe-bash-presentation-engine/image-replacement.js +21 -20
  237. package/dist/safe-bash-presentation-engine/image-value.js +4 -4
  238. package/dist/safe-bash-presentation-engine/images.js +19 -18
  239. package/dist/safe-bash-presentation-engine/index.d.ts +6 -2
  240. package/dist/safe-bash-presentation-engine/index.js +112 -97
  241. package/dist/safe-bash-presentation-engine/layouts.js +16 -15
  242. package/dist/safe-bash-presentation-engine/length.js +3 -3
  243. package/dist/safe-bash-presentation-engine/links.js +16 -15
  244. package/dist/safe-bash-presentation-engine/masters.js +15 -14
  245. package/dist/safe-bash-presentation-engine/media-editing.js +24 -23
  246. package/dist/safe-bash-presentation-engine/media-extraction.js +17 -16
  247. package/dist/safe-bash-presentation-engine/media.js +16 -15
  248. package/dist/safe-bash-presentation-engine/memberships.js +15 -14
  249. package/dist/safe-bash-presentation-engine/notes.js +16 -15
  250. package/dist/safe-bash-presentation-engine/ole-enum.js +4 -4
  251. package/dist/safe-bash-presentation-engine/ole-insertion.js +20 -19
  252. package/dist/safe-bash-presentation-engine/opaque-objects.js +9 -9
  253. package/dist/safe-bash-presentation-engine/package-reader.js +5 -5
  254. package/dist/safe-bash-presentation-engine/package-tools.d.ts +3 -0
  255. package/dist/safe-bash-presentation-engine/package-tools.js +27 -17
  256. package/dist/safe-bash-presentation-engine/package-uri.js +3 -3
  257. package/dist/safe-bash-presentation-engine/package-writer.js +4 -4
  258. package/dist/safe-bash-presentation-engine/presentation-model.js +58 -54
  259. package/dist/safe-bash-presentation-engine/presentation-settings.js +14 -13
  260. package/dist/safe-bash-presentation-engine/properties.js +16 -15
  261. package/dist/safe-bash-presentation-engine/relationships.js +4 -4
  262. package/dist/safe-bash-presentation-engine/resource-limits.js +1 -1
  263. package/dist/safe-bash-presentation-engine/retained-archive-staging.d.ts +19 -0
  264. package/dist/safe-bash-presentation-engine/retained-extraction-output.d.ts +18 -0
  265. package/dist/safe-bash-presentation-engine/retained-inspection.js +14 -12
  266. package/dist/safe-bash-presentation-engine/retained-package-extraction.d.ts +22 -0
  267. package/dist/safe-bash-presentation-engine/retained-package-packing.d.ts +19 -0
  268. package/dist/safe-bash-presentation-engine/retained-package.d.ts +2 -0
  269. package/dist/safe-bash-presentation-engine/retained-package.js +6 -4
  270. package/dist/safe-bash-presentation-engine/retained-slide-publication.d.ts +24 -0
  271. package/dist/safe-bash-presentation-engine/retained-text.js +19 -17
  272. package/dist/safe-bash-presentation-engine/retained-xml-parts.d.ts +5 -1
  273. package/dist/safe-bash-presentation-engine/retained-xml-publication.d.ts +18 -0
  274. package/dist/safe-bash-presentation-engine/retained-xml-replacement.d.ts +13 -0
  275. package/dist/safe-bash-presentation-engine/sanitize.js +17 -16
  276. package/dist/safe-bash-presentation-engine/selectors.js +10 -10
  277. package/dist/safe-bash-presentation-engine/shape-groups.js +31 -30
  278. package/dist/safe-bash-presentation-engine/shape-operations.js +30 -29
  279. package/dist/safe-bash-presentation-engine/shape-path-operations.js +32 -31
  280. package/dist/safe-bash-presentation-engine/shape-paths.js +16 -15
  281. package/dist/safe-bash-presentation-engine/shape-presets.js +3 -3
  282. package/dist/safe-bash-presentation-engine/shape-selection.js +31 -30
  283. package/dist/safe-bash-presentation-engine/shape-transforms.js +18 -17
  284. package/dist/safe-bash-presentation-engine/shapes.d.ts +1 -1
  285. package/dist/safe-bash-presentation-engine/shapes.js +27 -26
  286. package/dist/safe-bash-presentation-engine/slide-copy.js +17 -16
  287. package/dist/safe-bash-presentation-engine/slide-import.js +18 -17
  288. package/dist/safe-bash-presentation-engine/slide-merge-split.js +20 -19
  289. package/dist/safe-bash-presentation-engine/slide-model.js +43 -42
  290. package/dist/safe-bash-presentation-engine/slide-removal.js +18 -17
  291. package/dist/safe-bash-presentation-engine/slide-transfer-budget.js +9 -9
  292. package/dist/safe-bash-presentation-engine/slides.d.ts +1 -0
  293. package/dist/safe-bash-presentation-engine/slides.js +23 -17
  294. package/dist/safe-bash-presentation-engine/table-operations.js +33 -32
  295. package/dist/safe-bash-presentation-engine/table-spans.js +32 -31
  296. package/dist/safe-bash-presentation-engine/tables.js +31 -30
  297. package/dist/safe-bash-presentation-engine/tags.js +16 -15
  298. package/dist/safe-bash-presentation-engine/template-bindings.js +33 -32
  299. package/dist/safe-bash-presentation-engine/template-repeat.js +40 -39
  300. package/dist/safe-bash-presentation-engine/text-fitting.js +27 -26
  301. package/dist/safe-bash-presentation-engine/text-frames.js +27 -26
  302. package/dist/safe-bash-presentation-engine/text-paragraphs.js +27 -26
  303. package/dist/safe-bash-presentation-engine/text-reading.js +11 -11
  304. package/dist/safe-bash-presentation-engine/text-replacement.js +17 -16
  305. package/dist/safe-bash-presentation-engine/text-runs.js +20 -19
  306. package/dist/safe-bash-presentation-engine/themes.js +16 -15
  307. package/dist/safe-bash-presentation-engine/transitions.js +16 -15
  308. package/dist/safe-bash-presentation-engine/validation.js +10 -9
  309. package/dist/safe-bash-presentation-engine/xml-parts.d.ts +2 -0
  310. package/dist/safe-bash-presentation-engine/xml-parts.js +23 -15
  311. package/dist/safe-bash-presentation-engine/xml-view.js +3 -3
  312. package/dist/safe-bash-presentation-engine/xml.js +3 -3
  313. package/dist/safe-bash-regex-engine/index.js +1 -1
  314. package/dist/safe-bash-regex-engine/python-glob.js +1 -1
  315. package/dist/safe-bash-regex-engine/text/regex.d.ts +19 -0
  316. package/dist/safe-bash-regex-engine/text/regex.js +1 -1
  317. package/dist/safe-bash-xml-engine/document.js +3 -3
  318. package/dist/safe-bash-xml-engine/evaluate.js +1 -1
  319. package/dist/safe-bash-xml-engine/index.d.ts +1 -0
  320. package/dist/safe-bash-xml-engine/index.js +8 -4
  321. package/dist/safe-bash-xml-engine/query.js +2 -2
  322. package/dist/safe-bash-xml-engine/recovery.d.ts +10 -0
  323. package/dist/safe-bash-xml-engine/stored-document.d.ts +1 -1
  324. package/dist/safe-bash-xml-engine/stored-document.js +1 -1
  325. package/dist/safe-bash-xml-engine/stored-evaluate.js +1 -1
  326. package/dist/spreadsheet-engine/formulas/functions/python-printf.js +56 -33
  327. package/dist/spreadsheet-format-xls/biff-encrypted-properties.d.ts +2 -2
  328. package/dist/spreadsheet-format-xls/biff-encrypted-properties.js +86 -24
  329. package/dist/spreadsheet-format-xls/biff-metadata.d.ts +1 -0
  330. package/dist/spreadsheet-format-xls/biff-metadata.js +2 -2
  331. package/dist/spreadsheet-format-xls/biff-properties-merge.d.ts +6 -2
  332. package/dist/spreadsheet-format-xls/biff-properties-merge.js +413 -296
  333. package/dist/spreadsheet-format-xls/biff-properties-write.js +40 -23
  334. package/dist/spreadsheet-format-xls/biff-properties.js +3 -68
  335. package/dist/spreadsheet-format-xls/biff-property-index.d.ts +23 -0
  336. package/dist/spreadsheet-format-xls/biff-property-index.js +93 -0
  337. package/dist/spreadsheet-format-xls/biff-property-name.d.ts +4 -0
  338. package/dist/spreadsheet-format-xls/biff-property-name.js +114 -0
  339. package/dist/spreadsheet-format-xls/biff-property-text.d.ts +6 -0
  340. package/dist/spreadsheet-format-xls/biff-property-text.js +68 -0
  341. package/dist/spreadsheet-format-xls/biff-property-transcode.d.ts +5 -0
  342. package/dist/spreadsheet-format-xls/biff-property-transcode.js +45 -0
  343. package/dist/spreadsheet-format-xls/biff-write-metadata.js +10 -1
  344. package/package.json +6 -3
  345. package/dist/safe-bash/command-chunks/biff-3EFLKBAH-NYWZOYQS.js +0 -4942
  346. package/dist/safe-bash/command-chunks/chunk-5Q22ZLNC.js +0 -127
  347. package/dist/safe-bash/command-chunks/chunk-JKLOBSMP.js +0 -56
  348. package/dist/safe-bash/command-chunks/chunk-JYTESTBS.js +0 -99
  349. package/dist/safe-bash/command-chunks/chunk-WH3TIOTS.js +0 -326
  350. package/dist/safe-bash/command-chunks/paradox-ZWWXYY4J-JYOSWSBL.js +0 -362
  351. package/dist/spreadsheet-format-xls/biff-properties-layout.js +0 -56
@@ -6,100 +6,361 @@ import {
6
6
  allMediaAsts,
7
7
  createMediaAstRegistry,
8
8
  encodeUtf8,
9
- parseStreamingManifest
10
- } from "./chunk-VU3EQF7F.js";
9
+ parseStreamingManifest,
10
+ probeOggFlacSource,
11
+ probeOggStreamMetadata
12
+ } from "./chunk-7NXTEWPR.js";
11
13
 
12
- // packages/safe-bash-command-ffprobe/src/wav-tags.ts
14
+ // packages/safe-bash-command-ffprobe/src/ogg-probe.ts
15
+ import { probeOggStreamSource } from "../../audio-ast/index.js";
16
+
17
+ // packages/safe-bash-command-ffprobe/src/ogg-index.ts
18
+ import { scanOggPages } from "../../audio-ast/index.js";
13
19
  import { IntegerTable, PagedStorage } from "@poe-platform/safe-fs/storage";
14
20
  import { yieldTurn } from "../../safe-bash-contracts/yield.js";
15
- var WavTags = class {
21
+ var OggIndex = class {
16
22
  constructor(source, context) {
17
23
  this.source = source;
18
24
  this.context = context;
19
25
  this.storage = new PagedStorage(context, 4);
26
+ this.serials = new IntegerTable(this.storage, 128);
27
+ this.close = async () => {
28
+ this.closed = true;
29
+ await this.storage.close();
30
+ };
31
+ }
32
+ source;
33
+ context;
34
+ storage;
35
+ serials;
36
+ first = 0;
37
+ last = 0;
38
+ firstPage = 0;
39
+ lastPage = 0;
40
+ started = false;
41
+ ready = false;
42
+ closed = false;
43
+ close;
44
+ check() {
45
+ this.context.signal.throwIfAborted();
46
+ if (this.closed) throw new Error("Ogg index is closed");
47
+ }
48
+ async scan() {
49
+ this.check();
50
+ if (this.started) throw new Error("Ogg index already scanned");
51
+ this.started = true;
52
+ let active = 0, seen = 0, group = 0;
53
+ for await (const page of scanOggPages(this.source, { signal: this.context.signal, checkpoint: async () => {
54
+ this.check();
55
+ await yieldTurn(this.context.signal);
56
+ this.check();
57
+ } })) {
58
+ const key = BigInt(page.serial), existing = await this.serials.get(key);
59
+ const position = existing === void 0 ? this.storage.allocate(128) : Number(existing);
60
+ const bytes = existing === void 0 ? new Uint8Array(128) : await this.storage.read(position, 128);
61
+ const row = new DataView(bytes.buffer, bytes.byteOffset, bytes.length);
62
+ if (existing === void 0) {
63
+ if (!(page.flags & 2) || page.sequence !== 0) throw new Error("Missing Ogg beginning-of-stream");
64
+ row.setUint32(8, 4294967295, true);
65
+ row.setUint32(96, page.serial, true);
66
+ await this.serials.set(key, BigInt(position));
67
+ if (!active) group++;
68
+ row.setFloat64(120, group, true);
69
+ if (this.lastPage) {
70
+ const link = new Uint8Array(8);
71
+ new DataView(link.buffer).setFloat64(0, position, true);
72
+ await this.storage.write(this.lastPage + 104, link);
73
+ } else this.firstPage = position;
74
+ this.lastPage = position;
75
+ active++;
76
+ seen++;
77
+ }
78
+ if (bytes[12] || page.sequence !== row.getUint32(8, true) + 1 >>> 0 || !!(page.flags & 1) !== !!bytes[13])
79
+ throw new Error("Invalid Ogg sequence/continuation");
80
+ row.setUint32(8, page.sequence, true);
81
+ if (page.granule !== 0xffffffffffffffffn) row.setBigUint64(112, page.granule, true);
82
+ row.setFloat64(32, row.getFloat64(32, true) + page.size, true);
83
+ let packet = row.getFloat64(16, true), pending = row.getFloat64(24, true);
84
+ let sourceOffset = page.payloadOffset, spanSize = 0, completed = false;
85
+ for (let i = 0; i < page.lacing.length; i++) {
86
+ const lace = page.lacing[i];
87
+ spanSize += lace;
88
+ if (lace === 255 && i !== page.lacing.length - 1) continue;
89
+ if (packet < 2 && spanSize) {
90
+ const span = this.storage.allocate(32), data = new Uint8Array(32), record = new DataView(data.buffer);
91
+ record.setFloat64(8, pending, true);
92
+ record.setFloat64(16, sourceOffset, true);
93
+ record.setFloat64(24, spanSize, true);
94
+ await this.storage.write(span, data);
95
+ const field = 48 + packet * 24, tail = row.getFloat64(field + 8, true);
96
+ if (tail) {
97
+ const link = new Uint8Array(8);
98
+ new DataView(link.buffer).setFloat64(0, span, true);
99
+ await this.storage.write(tail, link);
100
+ } else row.setFloat64(field, span, true);
101
+ row.setFloat64(field + 8, span, true);
102
+ row.setFloat64(field + 16, pending + spanSize, true);
103
+ }
104
+ sourceOffset += spanSize;
105
+ pending += spanSize;
106
+ spanSize = 0;
107
+ bytes[13] = lace === 255 ? 1 : 0;
108
+ if (lace < 255) {
109
+ if (packet === 0) {
110
+ if (this.last) {
111
+ const link = new Uint8Array(8);
112
+ new DataView(link.buffer).setFloat64(0, position, true);
113
+ await this.storage.write(this.last, link);
114
+ } else this.first = position;
115
+ this.last = position;
116
+ }
117
+ packet++;
118
+ pending = 0;
119
+ completed = true;
120
+ }
121
+ }
122
+ if (completed && page.granule !== 0xffffffffffffffffn) row.setBigUint64(40, page.granule, true);
123
+ if (page.flags & 4) {
124
+ if (bytes[13]) throw new Error("Incomplete final Ogg packet");
125
+ bytes[12] = 1;
126
+ active--;
127
+ }
128
+ row.setFloat64(16, packet, true);
129
+ row.setFloat64(24, pending, true);
130
+ await this.storage.write(position, bytes);
131
+ }
132
+ if (!seen || active) throw new Error("Incomplete Ogg stream");
133
+ this.ready = true;
134
+ }
135
+ packet(first, size) {
136
+ const { storage, source, context } = this, check = this.check.bind(this);
137
+ let cached;
138
+ return { size, async read(offset, length) {
139
+ check();
140
+ if (!Number.isSafeInteger(offset) || !Number.isSafeInteger(length) || offset < 0 || length < 0 || offset > size)
141
+ throw new RangeError("Invalid Ogg packet range");
142
+ const output = new Uint8Array(Math.min(length, size - offset, 16384));
143
+ let used = 0, steps = 0, position = cached && offset >= cached.start ? cached.position : first;
144
+ while (used < output.length) {
145
+ if (++steps % 256 === 0) {
146
+ await yieldTurn(context.signal);
147
+ check();
148
+ }
149
+ if (!position) throw new Error("Truncated Ogg packet index");
150
+ if (!cached || position !== cached.position) {
151
+ const bytes = await storage.read(position, 32), row = new DataView(bytes.buffer, bytes.byteOffset, bytes.length);
152
+ cached = { position, next: row.getFloat64(0, true), start: row.getFloat64(8, true), offset: row.getFloat64(16, true), length: row.getFloat64(24, true) };
153
+ }
154
+ if (offset >= cached.start + cached.length) {
155
+ position = cached.next;
156
+ continue;
157
+ }
158
+ if (offset < cached.start) throw new Error("Invalid Ogg packet index");
159
+ const take = Math.min(output.length - used, cached.start + cached.length - offset);
160
+ const chunk = await source.read(cached.offset + offset - cached.start, take);
161
+ check();
162
+ if (!chunk.length || chunk.length > take) throw new Error("Truncated Ogg packet source");
163
+ output.set(chunk, used);
164
+ used += chunk.length;
165
+ offset += chunk.length;
166
+ }
167
+ return output;
168
+ } };
169
+ }
170
+ async *streams(pageOrder = false) {
171
+ this.check();
172
+ if (!this.ready) throw new Error("Ogg index is not validated");
173
+ let steps = 0;
174
+ for (let position = pageOrder ? this.firstPage : this.first; position; ) {
175
+ if (++steps % 256 === 0) {
176
+ await yieldTurn(this.context.signal);
177
+ this.check();
178
+ }
179
+ const bytes = await this.storage.read(position, 128), row = new DataView(bytes.buffer, bytes.byteOffset, bytes.length);
180
+ const packets = row.getFloat64(16, true);
181
+ yield {
182
+ group: row.getFloat64(120, true),
183
+ pageGranule: row.getBigUint64(112, true),
184
+ serial: row.getUint32(96, true),
185
+ size: row.getFloat64(32, true),
186
+ granule: row.getBigUint64(40, true),
187
+ packets,
188
+ head: packets ? this.packet(row.getFloat64(48, true), row.getFloat64(64, true)) : void 0,
189
+ comments: packets > 1 ? this.packet(row.getFloat64(72, true), row.getFloat64(88, true)) : void 0
190
+ };
191
+ position = row.getFloat64(pageOrder ? 104 : 0, true);
192
+ }
193
+ }
194
+ };
195
+
196
+ // packages/safe-bash-command-ffprobe/src/flac-tags.ts
197
+ import { IntegerTable as IntegerTable2, PagedStorage as PagedStorage2 } from "@poe-platform/safe-fs/storage";
198
+ import { normalizeVorbisCommentKey } from "../../audio-ast/index.js";
199
+ import { yieldTurn as yieldTurn2 } from "../../safe-bash-contracts/yield.js";
200
+ var FlacTags = class {
201
+ constructor(source, context, options = {}) {
202
+ this.source = source;
203
+ this.context = context;
204
+ this.options = options;
205
+ this.storage = new PagedStorage2(context, 4);
20
206
  this.close = this.storage.close.bind(this.storage);
21
- this.keys = new IntegerTable(this.storage, 128);
22
- this.numeric = new IntegerTable(this.storage, 128);
207
+ this.keys = new IntegerTable2(this.storage, 128);
208
+ this.numeric = new IntegerTable2(this.storage, 128);
23
209
  }
24
210
  source;
25
211
  context;
212
+ options;
26
213
  storage;
27
214
  keys;
28
215
  numeric;
29
216
  head = 0;
30
217
  tail = 0;
218
+ work = 0;
31
219
  count = 0;
32
220
  close;
33
- async *decoded(offset, length) {
34
- const decoder = new TextDecoder();
221
+ async read(offset, length) {
222
+ this.context.signal.throwIfAborted();
223
+ const bytes = await this.source.read(offset, length);
224
+ this.context.signal.throwIfAborted();
225
+ if (bytes.length !== length) throw new Error("Truncated FLAC comment");
226
+ return bytes;
227
+ }
228
+ async *decoded(offset, length, ignoreBOM, stored = false) {
229
+ const decoder = new TextDecoder("utf-8", { ignoreBOM });
35
230
  let steps = 0;
36
231
  for (let at = 0; at < length; at += 16384) {
37
- this.context.signal.throwIfAborted();
38
- const bytes = await this.source.read(offset + at, Math.min(16384, length - at));
39
- this.context.signal.throwIfAborted();
40
- if (bytes.length !== Math.min(16384, length - at)) throw new Error("Truncated WAV tag");
41
- yield decoder.decode(bytes, { stream: true });
42
- if (++steps % 256 === 0) await yieldTurn(this.context.signal);
232
+ yield decoder.decode(await (stored ? this.storage.read(offset + at, Math.min(16384, length - at)) : this.read(offset + at, Math.min(16384, length - at))), { stream: true });
233
+ if (++steps % 256 === 0) await yieldTurn2(this.context.signal);
43
234
  }
44
235
  yield decoder.decode();
45
236
  }
237
+ async record(position) {
238
+ const bytes = await this.storage.read(position, 64), view = new DataView(bytes.buffer, bytes.byteOffset, bytes.length);
239
+ return Array.from({ length: 8 }, (_, i) => view.getFloat64(i * 8, true));
240
+ }
241
+ async write(position, values) {
242
+ const bytes = new Uint8Array(values.length * 8), view = new DataView(bytes.buffer);
243
+ values.forEach((value, i) => view.setFloat64(i * 8, value, true));
244
+ await this.storage.write(position, bytes);
245
+ }
246
+ async equal(a, b, units) {
247
+ for (let at = 0; at < units * 2; at += 16384) {
248
+ const size = Math.min(16384, units * 2 - at), left = await this.storage.read(a + at, size), right = await this.storage.read(b + at, size);
249
+ if (!left.every((value, i) => value === right[i])) return false;
250
+ }
251
+ return true;
252
+ }
253
+ async *keyText(position, units) {
254
+ let pending = "";
255
+ for (let at = 0; at < units; at += 8192) {
256
+ const bytes = await this.storage.read(position + at * 2, Math.min(8192, units - at) * 2), view = new DataView(bytes.buffer, bytes.byteOffset, bytes.length);
257
+ let text = pending;
258
+ pending = "";
259
+ for (let i = 0; i < bytes.length; i += 2) text += String.fromCharCode(view.getUint16(i, true));
260
+ const last = text.charCodeAt(text.length - 1);
261
+ if (last >= 55296 && last <= 56319) {
262
+ pending = text.slice(-1);
263
+ text = text.slice(0, -1);
264
+ }
265
+ if (text) yield text;
266
+ }
267
+ if (pending) yield pending;
268
+ }
46
269
  async add(span) {
47
- let units = 0, kept = 0;
48
- for await (const text of this.decoded(span.offset, span.length)) {
49
- const zero = text.indexOf("\0"), part = zero < 0 ? text : text.slice(0, zero);
50
- for (const unit of part) {
51
- units += unit.length;
52
- if (unit.trimEnd()) kept = units;
270
+ if (++this.work % 256 === 0) await yieldTurn2(this.context.signal);
271
+ let split = -1;
272
+ for (let at = 0; at < span.length; at += 16384) {
273
+ const bytes = await this.read(span.offset + at, Math.min(16384, span.length - at)), found = bytes.indexOf(61);
274
+ if (found >= 0) {
275
+ split = at + found;
276
+ break;
53
277
  }
54
- if (zero >= 0) break;
278
+ if ((at / 16384 + 1) % 256 === 0) await yieldTurn2(this.context.signal);
55
279
  }
56
- let key = 0n;
57
- for (let i = 0; i < span.key.length; i++) key = key << (span.key.length > 4 ? 7n : 16n) | BigInt(span.key.charCodeAt(i));
58
- if (span.key.length > 4) key |= 1n << 63n;
59
- const existing = await this.keys.get(key);
60
- const position = existing === void 0 ? this.storage.allocate(56) : Number(existing);
61
- const bytes = existing === void 0 ? new Uint8Array(56) : await this.storage.read(position, 56);
62
- const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.length);
63
- view.setFloat64(8, span.offset, true);
64
- view.setFloat64(16, span.length, true);
65
- view.setFloat64(24, kept, true);
66
- view.setUint16(32, span.key.length, true);
67
- for (let i = 0; i < span.key.length; i++) view.setUint16(34 + i * 2, span.key.charCodeAt(i), true);
68
- await this.storage.write(position, bytes);
69
- if (existing !== void 0) return;
70
- await this.keys.set(key, BigInt(position));
280
+ if (split <= 0) return;
281
+ let keyPosition = this.storage.allocate(0), units = 0, hash = 2166136261, short = "";
282
+ const appendKey = async (text) => {
283
+ for (let at = 0; at < text.length; at += 8192) {
284
+ const part = text.slice(at, at + 8192), bytes = new Uint8Array(part.length * 2), view = new DataView(bytes.buffer);
285
+ for (let i = 0; i < part.length; i++) {
286
+ const code = part.charCodeAt(i);
287
+ view.setUint16(i * 2, code, true);
288
+ hash = Math.imul(hash ^ code, 16777619) >>> 0;
289
+ }
290
+ await this.storage.append(bytes);
291
+ units += part.length;
292
+ if (short.length <= 20) short += part.slice(0, 21 - short.length);
293
+ }
294
+ };
295
+ for await (const part of this.decoded(span.offset, split, false)) await appendKey(this.options.raw ? part : part.toUpperCase());
296
+ if (!units) return;
297
+ if (this.options.raw && short === "__proto__" && units === 9) return;
298
+ if (!this.options.raw && units <= 12) {
299
+ const normalized = normalizeVorbisCommentKey(short);
300
+ if (normalized !== short) {
301
+ keyPosition = this.storage.allocate(0);
302
+ units = 0;
303
+ hash = 2166136261;
304
+ short = "";
305
+ await appendKey(normalized);
306
+ }
307
+ }
308
+ const first = await this.keys.get(BigInt(hash));
309
+ let existing = 0, row;
310
+ for (let position2 = Number(first ?? 0n); position2; ) {
311
+ const candidate = await this.record(position2);
312
+ if (candidate[3] === units && await this.equal(candidate[2], keyPosition, units)) {
313
+ existing = position2;
314
+ row = candidate;
315
+ break;
316
+ }
317
+ position2 = candidate[1];
318
+ }
319
+ const position = existing || this.storage.allocate(64);
320
+ row ??= [0, Number(first ?? 0n), keyPosition, units, span.block, 0, 0, 0];
321
+ if (this.options.raw && !existing && units <= 20 && Object.hasOwn(Object.prototype, short)) {
322
+ const literal = new TextEncoder().encode(String(Reflect.get(Object.prototype, short))), offset2 = await this.storage.append(literal), value2 = this.storage.allocate(32);
323
+ await this.write(value2, [0, offset2, literal.length, 2]);
324
+ row[5] = value2;
325
+ row[6] = value2;
326
+ row[7] = literal.length ? 1 : 0;
327
+ }
328
+ const append = row[4] === span.block && !!row[7], value = this.storage.allocate(32), offset = span.offset + split + 1, length = span.length - split - 1;
329
+ await this.write(value, [0, offset, length, append ? 1 : 0]);
330
+ if (append) await this.write(row[6], [value]);
331
+ else row[5] = value;
332
+ row[4] = span.block;
333
+ row[6] = value;
334
+ row[7] = append || length > 0 ? 1 : 0;
335
+ await this.write(position, row);
336
+ if (existing) return;
337
+ await this.keys.set(BigInt(hash), BigInt(position));
71
338
  this.count++;
72
- const numeric = Number(span.key);
73
- if (Number.isInteger(numeric) && numeric >= 0 && numeric < 4294967295 && String(numeric) === span.key) await this.numeric.set(BigInt(numeric), BigInt(position));
339
+ const numeric = units <= 10 ? Number(short) : NaN;
340
+ if (Number.isInteger(numeric) && numeric >= 0 && numeric < 4294967295 && String(numeric) === short) await this.numeric.set(BigInt(numeric), BigInt(position));
74
341
  else {
75
- if (this.tail) {
76
- const link = new Uint8Array(8);
77
- new DataView(link.buffer).setFloat64(0, position, true);
78
- await this.storage.write(this.tail, link);
79
- } else this.head = position;
342
+ if (this.tail) await this.write(this.tail, [position]);
343
+ else this.head = position;
80
344
  this.tail = position;
81
345
  }
82
346
  }
83
- async record(position) {
84
- const bytes = await this.storage.read(position, 56), view = new DataView(bytes.buffer, bytes.byteOffset, bytes.length);
85
- let key = "";
86
- for (let i = 0; i < view.getUint16(32, true); i++) key += String.fromCharCode(view.getUint16(34 + i * 2, true));
87
- const offset = view.getFloat64(8, true), length = view.getFloat64(16, true), kept = view.getFloat64(24, true), decoded = this.decoded.bind(this);
88
- return { key, next: view.getFloat64(0, true), async *text() {
89
- let remaining = kept;
90
- if (!remaining) return;
91
- for await (const part of decoded(offset, length)) {
92
- const take = Math.min(remaining, part.length);
93
- if (take) yield part.slice(0, take);
94
- remaining -= take;
95
- if (!remaining) return;
96
- }
97
- } };
347
+ async *valueText(value) {
348
+ while (value) {
349
+ const bytes = await this.storage.read(value, 32), view = new DataView(bytes.buffer, bytes.byteOffset, bytes.length);
350
+ const kind = view.getFloat64(24, true);
351
+ if (kind === 1) yield this.options.raw ? ";" : "\n";
352
+ yield* this.decoded(view.getFloat64(8, true), view.getFloat64(16, true), true, kind === 2);
353
+ value = view.getFloat64(0, true);
354
+ }
355
+ }
356
+ async entry(position) {
357
+ const row = await this.record(position);
358
+ return { next: row[0], key: () => this.keyText(row[2], row[3]), text: () => this.valueText(row[5]) };
98
359
  }
99
360
  async *entries() {
100
- for await (const [, position] of this.numeric.entries()) yield await this.record(Number(position));
361
+ for await (const [, position] of this.numeric.entries()) yield await this.entry(Number(position));
101
362
  for (let position = this.head; position; ) {
102
- const entry = await this.record(position);
363
+ const entry = await this.entry(position);
103
364
  position = entry.next;
104
365
  yield entry;
105
366
  }
@@ -286,9 +547,277 @@ function formatAudioProbe(audio, size, parsed) {
286
547
  return lines.length ? lines.join("\n") + "\n" : "";
287
548
  }
288
549
 
550
+ // packages/safe-bash-command-ffprobe/src/ogg-probe.ts
551
+ async function validatePictures(text) {
552
+ let quartet = "", line = false, ended = false, count = 0, word = 0, stage = 0, mark = 8;
553
+ const decode = () => {
554
+ const decoded = atob(quartet);
555
+ ended ||= quartet.includes("=");
556
+ quartet = "";
557
+ for (let i = 0; i < decoded.length; i++) {
558
+ count++;
559
+ word = (word << 8 | decoded.charCodeAt(i)) >>> 0;
560
+ if (stage === 3 && count > mark) throw new Error("Trailing FLAC picture bytes");
561
+ if (count === mark && stage < 3) {
562
+ mark += word + (stage === 0 ? 4 : stage === 1 ? 20 : 0);
563
+ stage++;
564
+ }
565
+ }
566
+ };
567
+ const finish = () => {
568
+ if (line) {
569
+ if (quartet) decode();
570
+ if (stage !== 3 || count !== mark) throw new Error("Truncated or invalid audio structure");
571
+ }
572
+ quartet = "";
573
+ line = false;
574
+ ended = false;
575
+ count = 0;
576
+ word = 0;
577
+ stage = 0;
578
+ mark = 8;
579
+ };
580
+ for await (const part of text) for (const char of part) {
581
+ if (char === "\n") {
582
+ finish();
583
+ continue;
584
+ }
585
+ line = true;
586
+ if (char === " " || char === " " || char === "\r" || char === "\f") continue;
587
+ if (ended) throw new Error("Invalid character");
588
+ quartet += char;
589
+ if (quartet.length >= 4) decode();
590
+ }
591
+ finish();
592
+ }
593
+ async function probeStoredOgg(source, context, retain) {
594
+ const index = new OggIndex(source, context);
595
+ retain(index.close);
596
+ await index.scan();
597
+ let count = 0, group = 0, groupDuration = 0, duration = 0, adjustment = 0;
598
+ let first, pictures, failed = true;
599
+ try {
600
+ const physical = index.streams(true);
601
+ for await (const stream of index.streams()) {
602
+ const page = (await physical.next()).value;
603
+ if (!stream.head || !page) throw new Error("Ogg input contains no audio stream");
604
+ let current, currentFailed = true;
605
+ try {
606
+ const audio = await probeOggStreamSource({ head: stream.head, comments: stream.comments, granule: stream.granule, size: stream.size }, {
607
+ signal: context.signal,
608
+ onComment: async (span) => {
609
+ const prefix = new TextDecoder().decode(await stream.comments.read(span.offset, Math.min(128, span.length))), equals = prefix.indexOf("=");
610
+ context.signal.throwIfAborted();
611
+ if (equals > 0 && prefix.slice(0, equals).toUpperCase() === "METADATA_BLOCK_PICTURE") {
612
+ current ??= new FlacTags(stream.comments, context);
613
+ await current.add({ ...span, block: 0 });
614
+ }
615
+ }
616
+ });
617
+ first ??= audio;
618
+ count++;
619
+ if (stream.group !== group) {
620
+ duration += groupDuration;
621
+ groupDuration = 0;
622
+ group = stream.group;
623
+ }
624
+ groupDuration = Math.max(groupDuration, audio.duration);
625
+ if (audio.codec === "opus") adjustment = Math.max(adjustment, Number(page.pageGranule) / audio.sampleRate - audio.duration);
626
+ if (current) {
627
+ const previous = pictures;
628
+ pictures = current;
629
+ current = void 0;
630
+ await previous?.close();
631
+ }
632
+ currentFailed = false;
633
+ } finally {
634
+ if (current) {
635
+ if (currentFailed) {
636
+ try {
637
+ await current.close();
638
+ } catch {
639
+ }
640
+ } else await current.close();
641
+ }
642
+ }
643
+ }
644
+ if (!first || !(await physical.next()).done) throw new Error("Ogg input contains no audio stream");
645
+ for await (const entry of pictures?.entries() ?? []) await validatePictures(entry.text());
646
+ failed = false;
647
+ } finally {
648
+ if (pictures) {
649
+ if (failed) {
650
+ try {
651
+ await pictures.close();
652
+ } catch {
653
+ }
654
+ } else await pictures.close();
655
+ }
656
+ }
657
+ duration += groupDuration + adjustment;
658
+ const firstStream = first;
659
+ return { first: firstStream, rows: async function* (args) {
660
+ const parsed = parseArguments(args), streamSections = new Map([...parsed.sections].filter(([key]) => key === "stream" || key === "stream_tags"));
661
+ if (streamSections.size) {
662
+ let number = 0;
663
+ const physical = index.streams(true);
664
+ for await (const stream of index.streams()) {
665
+ const page = (await physical.next()).value;
666
+ if (parsed.selector && number !== 0) {
667
+ number++;
668
+ continue;
669
+ }
670
+ const tags = new FlacTags(stream.comments, context, { raw: true });
671
+ let failed2 = true;
672
+ try {
673
+ const audio = await probeOggStreamSource({ head: stream.head, comments: stream.comments, granule: stream.granule, size: stream.size }, {
674
+ signal: context.signal,
675
+ onComment: (span) => tags.add({ ...span, block: 0 })
676
+ });
677
+ for (const entry of audioProbeRows({
678
+ format: "ogg",
679
+ tags: {},
680
+ duration: audio.duration,
681
+ bitrate: audio.bitrate,
682
+ streams: [{ ...audio, tags: tags.count ? { "": "" } : {} }],
683
+ nodes: [{ type: "OggS", offset: 0, size: 0, data: new Uint8Array(0), fields: { serial: page.serial, granule: page.pageGranule } }]
684
+ }, source.size, { ...parsed, sections: streamSections })) {
685
+ if ("index" in entry.row) entry.row.index = number;
686
+ yield { ...entry, tags };
687
+ }
688
+ failed2 = false;
689
+ } finally {
690
+ if (failed2) {
691
+ try {
692
+ await tags.close();
693
+ } catch {
694
+ }
695
+ } else await tags.close();
696
+ }
697
+ number++;
698
+ }
699
+ }
700
+ const formatSections = new Map([...parsed.sections].filter(([key]) => key === "format" || key === "format_tags"));
701
+ for (const entry of audioProbeRows({ format: "ogg", streams: [firstStream], tags: {}, nodes: [], duration, bitrate: duration ? source.size * 8 / duration : 0 }, source.size, { ...parsed, sections: formatSections })) {
702
+ if ("nb_streams" in entry.row) entry.row.nb_streams = count;
703
+ yield entry;
704
+ }
705
+ } };
706
+ }
707
+
708
+ // packages/safe-bash-command-ffprobe/src/media.ts
709
+ import { yieldTurn as yieldTurn6 } from "../../safe-bash-contracts/yield.js";
710
+
711
+ // packages/safe-bash-command-ffprobe/src/source-tags.ts
712
+ import { IntegerTable as IntegerTable3, PagedStorage as PagedStorage3 } from "@poe-platform/safe-fs/storage";
713
+ import { readId3Text } from "../../audio-ast/index.js";
714
+ import { yieldTurn as yieldTurn3 } from "../../safe-bash-contracts/yield.js";
715
+ var SourceAudioTags = class {
716
+ constructor(source, context) {
717
+ this.source = source;
718
+ this.context = context;
719
+ this.storage = new PagedStorage3(context, 4);
720
+ this.close = this.storage.close.bind(this.storage);
721
+ this.keys = new IntegerTable3(this.storage, 128);
722
+ this.numeric = new IntegerTable3(this.storage, 128);
723
+ }
724
+ source;
725
+ context;
726
+ storage;
727
+ keys;
728
+ numeric;
729
+ head = 0;
730
+ tail = 0;
731
+ count = 0;
732
+ close;
733
+ async *decoded(offset, length, encoding = 255, unsynchronized = false) {
734
+ if (encoding < 4) {
735
+ yield* readId3Text(this.source, { key: "", offset, length, encoding, unsynchronized }, { signal: this.context.signal, checkpoint: () => yieldTurn3(this.context.signal) });
736
+ return;
737
+ }
738
+ const decoder = new TextDecoder();
739
+ let steps = 0;
740
+ for (let at = 0; at < length; at += 16384) {
741
+ this.context.signal.throwIfAborted();
742
+ const bytes = await (encoding === 254 ? this.storage : this.source).read(offset + at, Math.min(16384, length - at));
743
+ this.context.signal.throwIfAborted();
744
+ if (bytes.length !== Math.min(16384, length - at)) throw new Error("Truncated audio tag");
745
+ yield decoder.decode(bytes, { stream: true });
746
+ if (++steps % 256 === 0) await yieldTurn3(this.context.signal);
747
+ }
748
+ yield decoder.decode();
749
+ }
750
+ async add(tag) {
751
+ const literal = "value" in tag ? new TextEncoder().encode(tag.value) : void 0;
752
+ const span = "value" in tag ? { key: tag.key, offset: await this.storage.append(literal), length: literal.length } : tag;
753
+ const encoding = literal ? 254 : "encoding" in tag ? tag.encoding : 255;
754
+ const unsynchronized = "unsynchronized" in tag && tag.unsynchronized;
755
+ let units = 0, kept = 0;
756
+ for await (const text of this.decoded(span.offset, span.length, encoding, unsynchronized)) {
757
+ const zero = text.indexOf("\0"), part = zero < 0 ? text : text.slice(0, zero);
758
+ for (const unit of part) {
759
+ units += unit.length;
760
+ if (unit.trimEnd()) kept = units;
761
+ }
762
+ if (zero >= 0) break;
763
+ }
764
+ let key = 0n;
765
+ for (let i = 0; i < span.key.length; i++) key = key << (span.key.length > 4 ? 5n : 16n) | BigInt(span.key.length > 4 ? span.key.charCodeAt(i) & 31 : span.key.charCodeAt(i));
766
+ if (span.key.length > 4) key |= 1n << 63n;
767
+ const existing = await this.keys.get(key);
768
+ const position = existing === void 0 ? this.storage.allocate(64) : Number(existing);
769
+ const bytes = existing === void 0 ? new Uint8Array(64) : await this.storage.read(position, 64);
770
+ const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.length);
771
+ view.setFloat64(8, span.offset, true);
772
+ view.setFloat64(16, span.length, true);
773
+ view.setFloat64(24, kept, true);
774
+ view.setUint16(32, span.key.length, true);
775
+ for (let i = 0; i < span.key.length; i++) view.setUint16(34 + i * 2, span.key.charCodeAt(i), true);
776
+ bytes[56] = encoding;
777
+ bytes[57] = unsynchronized ? 1 : 0;
778
+ await this.storage.write(position, bytes);
779
+ if (existing !== void 0) return;
780
+ await this.keys.set(key, BigInt(position));
781
+ this.count++;
782
+ const numeric = Number(span.key);
783
+ if (Number.isInteger(numeric) && numeric >= 0 && numeric < 4294967295 && String(numeric) === span.key) await this.numeric.set(BigInt(numeric), BigInt(position));
784
+ else {
785
+ if (this.tail) {
786
+ const link = new Uint8Array(8);
787
+ new DataView(link.buffer).setFloat64(0, position, true);
788
+ await this.storage.write(this.tail, link);
789
+ } else this.head = position;
790
+ this.tail = position;
791
+ }
792
+ }
793
+ async record(position) {
794
+ const bytes = await this.storage.read(position, 64), view = new DataView(bytes.buffer, bytes.byteOffset, bytes.length);
795
+ let key = "";
796
+ for (let i = 0; i < view.getUint16(32, true); i++) key += String.fromCharCode(view.getUint16(34 + i * 2, true));
797
+ const offset = view.getFloat64(8, true), length = view.getFloat64(16, true), kept = view.getFloat64(24, true), decoded = this.decoded.bind(this), encoding = bytes[56], unsynchronized = !!bytes[57];
798
+ return { key, next: view.getFloat64(0, true), async *text() {
799
+ let remaining = kept;
800
+ if (!remaining) return;
801
+ for await (const part of decoded(offset, length, encoding, unsynchronized)) {
802
+ const take = Math.min(remaining, part.length);
803
+ if (take) yield part.slice(0, take);
804
+ remaining -= take;
805
+ if (!remaining) return;
806
+ }
807
+ } };
808
+ }
809
+ async *entries() {
810
+ for await (const [, position] of this.numeric.entries()) yield await this.record(Number(position));
811
+ for (let position = this.head; position; ) {
812
+ const entry = await this.record(position);
813
+ position = entry.next;
814
+ yield entry;
815
+ }
816
+ }
817
+ };
818
+
289
819
  // packages/safe-bash-command-ffprobe/src/tag-format.ts
290
- async function* parts(value, prefix = "") {
291
- if (prefix) yield prefix;
820
+ async function* parts(value) {
292
821
  if (typeof value === "function") yield* value();
293
822
  else yield String(value);
294
823
  }
@@ -343,11 +872,34 @@ async function needsQuotes(input, separator) {
343
872
  return false;
344
873
  }
345
874
  async function* formatTaggedAudio(audio, size, args, tags) {
346
- const parsed = parseArguments(args), { sections, format, settings } = parsed;
347
- const rows = audioProbeRows({ ...audio, nodes: [] }, size, parsed, tags.count > 0);
875
+ const parsed = parseArguments(args), rows = audioProbeRows({ ...audio, nodes: audio.nodes ?? [] }, size, parsed, tags.count > 0);
876
+ yield* formatTaggedRows((async function* () {
877
+ for (const row of rows) yield { ...row, tags };
878
+ })(), args);
879
+ }
880
+ async function* formatTaggedRows(rows, args) {
881
+ const { sections, format, settings } = parseArguments(args);
882
+ let tags;
348
883
  async function* tagFields(section) {
349
884
  const selected = sections.get(section + "_tags");
350
- for await (const entry of tags.entries()) if (selected === void 0 || selected.includes(entry.key)) yield { key: entry.key, value: entry.text };
885
+ for await (const entry of tags?.entries() ?? []) {
886
+ let included = selected === void 0;
887
+ for (const wanted of selected ?? []) {
888
+ let at = 0, matches = true;
889
+ for await (const part of parts(entry.key)) {
890
+ if (wanted.slice(at, at + part.length) !== part) {
891
+ matches = false;
892
+ break;
893
+ }
894
+ at += part.length;
895
+ }
896
+ if (matches && at === wanted.length) {
897
+ included = true;
898
+ break;
899
+ }
900
+ }
901
+ if (included) yield { key: entry.key, value: entry.text };
902
+ }
351
903
  }
352
904
  async function* jsonRow(row, section, indent) {
353
905
  yield "{";
@@ -359,8 +911,10 @@ async function* formatTaggedAudio(audio, size, args, tags) {
359
911
  yield "{";
360
912
  let firstTag = true;
361
913
  for await (const field of tagFields(section)) {
362
- yield (firstTag ? "\n" : ",\n") + " ".repeat(indent + 8) + JSON.stringify(field.key) + ": ";
914
+ yield (firstTag ? "\n" : ",\n") + " ".repeat(indent + 8);
363
915
  firstTag = false;
916
+ yield* jsonString(parts(field.key));
917
+ yield ": ";
364
918
  yield* jsonString(parts(field.value));
365
919
  }
366
920
  yield (firstTag ? "" : "\n" + " ".repeat(indent + 4)) + "}";
@@ -371,23 +925,29 @@ async function* formatTaggedAudio(audio, size, args, tags) {
371
925
  }
372
926
  if (format === "json") {
373
927
  yield "{";
374
- let first = true;
375
- if (sections.has("stream") || sections.has("stream_tags")) {
928
+ let first = true, streamOpen = sections.has("stream") || sections.has("stream_tags"), firstStream = true;
929
+ if (streamOpen) {
376
930
  yield '\n "streams": [';
377
931
  first = false;
378
- let firstStream = true;
379
- for (const { section, row } of rows) if (section === "stream") {
932
+ }
933
+ for await (const entry of rows) {
934
+ const { section, row } = entry;
935
+ tags = entry.tags;
936
+ if (section === "stream") {
380
937
  yield (firstStream ? "\n" : ",\n") + " ";
381
938
  firstStream = false;
382
939
  yield* jsonRow(row, section, 8);
940
+ } else if (section === "format") {
941
+ if (streamOpen) {
942
+ yield (firstStream ? "" : "\n ") + "]";
943
+ streamOpen = false;
944
+ }
945
+ yield (first ? "\n" : ",\n") + ' "format": ';
946
+ first = false;
947
+ yield* jsonRow(row, section, 4);
383
948
  }
384
- yield (firstStream ? "" : "\n ") + "]";
385
- }
386
- for (const { section, row } of rows) if (section === "format") {
387
- yield (first ? "\n" : ",\n") + ' "format": ';
388
- first = false;
389
- yield* jsonRow(row, section, 4);
390
949
  }
950
+ if (streamOpen) yield (firstStream ? "" : "\n ") + "]";
391
951
  yield (first ? "" : "\n") + "}\n";
392
952
  return;
393
953
  }
@@ -396,11 +956,13 @@ async function* formatTaggedAudio(audio, size, args, tags) {
396
956
  return value === void 0 ? fallback : value === "1";
397
957
  };
398
958
  let streamIndex = 0;
399
- for (const { section, row } of rows) {
959
+ for await (const entry of rows) {
960
+ const { section, row } = entry;
961
+ tags = entry.tags;
400
962
  async function* fields() {
401
963
  for (const [key, value] of Object.entries(row)) {
402
964
  if (typeof value === "object") {
403
- for await (const tag of tagFields(section)) yield { key: "tag:" + tag.key, value: tag.value };
965
+ for await (const tag of tagFields(section)) yield { key: tag.key, value: tag.value, tag: true };
404
966
  } else yield { key, value };
405
967
  }
406
968
  }
@@ -414,19 +976,28 @@ async function* formatTaggedAudio(audio, size, args, tags) {
414
976
  for await (const field of fields()) {
415
977
  if (!first) yield separator;
416
978
  first = false;
417
- const prefix = enabled("nokey", "nk", format === "csv") ? "" : field.key + "=";
979
+ async function* value() {
980
+ if (!enabled("nokey", "nk", format === "csv")) {
981
+ if (field.tag) yield "tag:";
982
+ yield* parts(field.key);
983
+ yield "=";
984
+ }
985
+ yield* parts(field.value);
986
+ }
418
987
  if (format === "csv") {
419
- const quote = await needsQuotes(parts(field.value, prefix), separator);
988
+ const quote = await needsQuotes(value(), separator);
420
989
  if (quote) yield '"';
421
- yield* quote ? replace(parts(field.value, prefix), '"', '""') : parts(field.value, prefix);
990
+ yield* quote ? replace(value(), '"', '""') : value();
422
991
  if (quote) yield '"';
423
- } else yield* replace(replace(replace(replace(parts(field.value, prefix), "\\", "\\\\"), "\n", "\\n"), "\r", "\\r"), separator, "\\" + separator);
992
+ } else yield* replace(replace(replace(replace(value(), "\\", "\\\\"), "\n", "\\n"), "\r", "\\r"), separator, "\\" + separator);
424
993
  }
425
994
  yield "\n";
426
995
  } else if (format === "flat") {
427
996
  const prefix = section === "stream" ? `streams.stream.${streamIndex++}` : "format";
428
997
  for await (const field of fields()) {
429
- yield prefix + "." + (field.key.startsWith("tag:") ? "tags." + field.key.slice(4) : field.key) + "=";
998
+ yield prefix + "." + (field.tag ? "tags." : "");
999
+ yield* parts(field.key);
1000
+ yield "=";
430
1001
  if (typeof field.value === "number") yield String(field.value);
431
1002
  else yield* jsonString(parts(field.value));
432
1003
  yield "\n";
@@ -434,7 +1005,11 @@ async function* formatTaggedAudio(audio, size, args, tags) {
434
1005
  } else {
435
1006
  if (!enabled("noprint_wrappers", "nw", false)) yield "[" + section.toUpperCase() + "]\n";
436
1007
  for await (const field of fields()) {
437
- if (!enabled("nokey", "nk", false)) yield (field.key.startsWith("tag:") ? "TAG:" + field.key.slice(4) : field.key) + "=";
1008
+ if (!enabled("nokey", "nk", false)) {
1009
+ if (field.tag) yield "TAG:";
1010
+ yield* parts(field.key);
1011
+ yield "=";
1012
+ }
438
1013
  yield* parts(field.value);
439
1014
  yield "\n";
440
1015
  }
@@ -444,9 +1019,9 @@ async function* formatTaggedAudio(audio, size, args, tags) {
444
1019
  }
445
1020
 
446
1021
  // packages/safe-bash-command-ffprobe/src/probe-output.ts
447
- import { PagedStorage as PagedStorage2 } from "@poe-platform/safe-fs/storage";
1022
+ import { PagedStorage as PagedStorage4 } from "@poe-platform/safe-fs/storage";
448
1023
  import { writeBytes } from "../../safe-bash-contracts/io.js";
449
- import { yieldTurn as yieldTurn2 } from "../../safe-bash-contracts/yield.js";
1024
+ import { yieldTurn as yieldTurn4 } from "../../safe-bash-contracts/yield.js";
450
1025
  async function* encodeParts(parts2, signal) {
451
1026
  const encoder = new TextEncoder();
452
1027
  let high = "", steps = 0;
@@ -462,13 +1037,13 @@ async function* encodeParts(parts2, signal) {
462
1037
  text = text.slice(0, -1);
463
1038
  }
464
1039
  if (text) yield encoder.encode(text);
465
- if (++steps % 256 === 0) await yieldTurn2(signal);
1040
+ if (++steps % 256 === 0) await yieldTurn4(signal);
466
1041
  }
467
1042
  }
468
1043
  if (high) yield encoder.encode(high);
469
1044
  }
470
1045
  async function writeProbeOutput(context, parts2, check, beforePublish) {
471
- const storage = new PagedStorage2(context, 4), start = storage.allocate(0);
1046
+ const storage = new PagedStorage4(context, 4), start = storage.allocate(0);
472
1047
  let size = 0, failed = true;
473
1048
  try {
474
1049
  for await (const bytes of encodeParts(parts2, context.signal)) {
@@ -494,10 +1069,10 @@ async function writeProbeOutput(context, parts2, check, beforePublish) {
494
1069
  }
495
1070
 
496
1071
  // packages/safe-bash-command-ffprobe/src/stream-input.ts
497
- import { PagedStorage as PagedStorage3 } from "@poe-platform/safe-fs/storage";
1072
+ import { PagedStorage as PagedStorage5 } from "@poe-platform/safe-fs/storage";
498
1073
  import { readBytes } from "../../safe-bash-contracts/io.js";
499
1074
  import { readFileStream } from "../../safe-bash-contracts/filesystem.js";
500
- import { yieldTurn as yieldTurn3 } from "../../safe-bash-contracts/yield.js";
1075
+ import { yieldTurn as yieldTurn5 } from "../../safe-bash-contracts/yield.js";
501
1076
  async function openProbeStream(context, path) {
502
1077
  context.signal.throwIfAborted();
503
1078
  if (path === void 0) return readBytes(context.stdin, context.signal);
@@ -569,7 +1144,7 @@ async function sniffMediaStream(source, signal, account) {
569
1144
  return { prefix: prefix.subarray(0, size), stream: replay() };
570
1145
  }
571
1146
  async function withStagedProbeSource(context, input, probe2, retain) {
572
- const storage = new PagedStorage3(context, 4);
1147
+ const storage = new PagedStorage5(context, 4);
573
1148
  retain?.(storage.close.bind(storage));
574
1149
  let start;
575
1150
  let size = 0, steps = 0, failed = true;
@@ -579,7 +1154,7 @@ async function withStagedProbeSource(context, input, probe2, retain) {
579
1154
  size += chunk.length;
580
1155
  start ??= storage.allocate(0);
581
1156
  await storage.append(chunk);
582
- if (++steps % 256 === 0) await yieldTurn3(context.signal);
1157
+ if (++steps % 256 === 0) await yieldTurn5(context.signal);
583
1158
  }
584
1159
  context.signal.throwIfAborted();
585
1160
  start ??= storage.allocate(0);
@@ -601,7 +1176,7 @@ async function withStagedProbeSource(context, input, probe2, retain) {
601
1176
  }
602
1177
 
603
1178
  // packages/safe-bash-command-ffprobe/src/media.ts
604
- import { probeWavSource } from "../../audio-ast/index.js";
1179
+ import { probeWavSource, probeFlacSource, probeMp3Source } from "../../audio-ast/index.js";
605
1180
  import { commandRuntimeIdentity, getCommandArguments } from "../../safe-bash-contracts/command.js";
606
1181
  import { readBytes as readBytes2, writeBytes as writeBytes2 } from "../../safe-bash-contracts/io.js";
607
1182
  function isStdin(path) {
@@ -779,7 +1354,7 @@ function* formatFfprobeResultChunks(probe2, opts, audioInput) {
779
1354
  if (audioInput && !opts.showPackets && !opts.showFrames && !opts.showChapters && !opts.showPrograms && !opts.countFrames && !opts.countPackets && probe2.streams.length > 0 && probe2.streams.every((stream) => stream.codec_type === "audio")) {
780
1355
  let formatted;
781
1356
  try {
782
- formatted = "bytes" in audioInput ? probe(audioInput.bytes, audioInput.args) : formatAudioProbe({ ...audioInput.audio, nodes: [] }, audioInput.size, parseArguments(audioInput.args));
1357
+ formatted = "bytes" in audioInput ? probe(audioInput.bytes, audioInput.args) : formatAudioProbe({ ...audioInput.audio, nodes: audioInput.audio.nodes ?? [] }, audioInput.size, parseArguments(audioInput.args));
783
1358
  } catch {
784
1359
  }
785
1360
  if (formatted !== void 0) {
@@ -1125,19 +1700,44 @@ async function probeSourceMetadata(context, plugins, input, filename, budget, re
1125
1700
  plugin = plugins.find((candidate) => candidate.detect(header, filename));
1126
1701
  }
1127
1702
  if (!plugin) return void 0;
1703
+ if (plugin.formatName === "ogg" && !plugin.probeMetadata) {
1704
+ const probeOptions = { ...records, filename, signal: context.signal, budget, limits: budget.limits, checkpoint: () => yieldTurn6(context.signal) };
1705
+ const flac = await probeOggFlacSource(source, probeOptions);
1706
+ if (flac) return flac;
1707
+ const ogg = await probeStoredOgg(source, context, retain);
1708
+ return onAudio ? { oggRows: ogg.rows } : probeOggStreamMetadata(ogg.first, source.size, probeOptions);
1709
+ }
1128
1710
  const result = await plugin.probeMetadata(source, { ...records, filename, signal: context.signal, budget, limits: budget.limits });
1129
1711
  if (onAudio) {
1130
- const tags = new WavTags(source, context);
1712
+ const tags = plugin.formatName === "flac" ? new FlacTags(source, context) : new SourceAudioTags(source, context);
1131
1713
  retain(tags.close);
1714
+ let checkpoints = 0;
1132
1715
  try {
1133
- onAudio(await probeWavSource(source, { signal: context.signal, onTag: async (span) => {
1716
+ const audio = tags instanceof FlacTags ? await probeFlacSource(source, { signal: context.signal, onComment: async (span) => {
1717
+ try {
1718
+ await tags.add(span);
1719
+ } catch (error) {
1720
+ sourceFailed = true;
1721
+ throw error;
1722
+ }
1723
+ } }) : plugin.formatName === "mp3" ? await probeMp3Source(source, { signal: context.signal, checkpoint: async () => {
1724
+ if (++checkpoints % 256 === 0) await yieldTurn6(context.signal);
1725
+ }, onTag: async (span) => {
1726
+ try {
1727
+ await tags.add(span);
1728
+ } catch (error) {
1729
+ sourceFailed = true;
1730
+ throw error;
1731
+ }
1732
+ } }) : await probeWavSource(source, { signal: context.signal, onTag: async (span) => {
1134
1733
  try {
1135
1734
  await tags.add(span);
1136
1735
  } catch (error) {
1137
1736
  sourceFailed = true;
1138
1737
  throw error;
1139
1738
  }
1140
- } }), input.size, tags);
1739
+ } });
1740
+ onAudio(audio, input.size, tags);
1141
1741
  } catch (error) {
1142
1742
  context.signal.throwIfAborted();
1143
1743
  if (sourceFailed) throw error;
@@ -1282,9 +1882,9 @@ function createFfprobeCommand(options = {}) {
1282
1882
  automaticAudio = false;
1283
1883
  }
1284
1884
  }
1285
- const automaticPlugins = !options.asts && !explicitFormat ? astPlugins.filter((plugin) => plugin.canDemux && plugin.probeMetadata && (!automaticAudio || plugin === registry.findByFormatName("wav"))) : [];
1885
+ const automaticPlugins = !options.asts && !explicitFormat ? astPlugins.filter((plugin) => plugin.canDemux && (plugin.probeMetadata || plugin === registry.findByFormatName("ogg")) && (!automaticAudio || ["wav", "flac", "mp3", "ogg"].some((format) => plugin === registry.findByFormatName(format)))) : [];
1286
1886
  const explicitPlugin = explicitFormat ? registry.findByFormatName(explicitFormat) : void 0;
1287
- const retainedPlugins = explicitPlugin ? explicitPlugin.canDemux && explicitPlugin.probeMetadata ? [explicitPlugin] : [] : automaticPlugins;
1887
+ const retainedPlugins = explicitPlugin ? explicitPlugin.canDemux && (explicitPlugin.probeMetadata || !options.asts && explicitPlugin === registry.findByFormatName("ogg")) ? [explicitPlugin] : [] : automaticPlugins;
1288
1888
  let probeResult = retainedPlugins.length && !isStdin(inputTarget) ? await probeRetainedMetadata(context, retainedPlugins, resolvePath(context.cwd, inputTarget), inputTarget, budget, { showPackets, showFrames }, automaticAudio ? (audio, size, tags) => {
1289
1889
  audioInput = { audio, size, args };
1290
1890
  storedTags = tags;
@@ -1292,14 +1892,15 @@ function createFfprobeCommand(options = {}) {
1292
1892
  if (!probeResult && explicitPlugin)
1293
1893
  probeResult = await probeStreamMetadata(context, explicitPlugin, inputTarget, budget, { showPackets, showFrames });
1294
1894
  let replay;
1295
- if (!probeResult && automaticPlugins.length) {
1895
+ const streamPlugins = explicitPlugin ? retainedPlugins : automaticPlugins;
1896
+ if (!probeResult && streamPlugins.length) {
1296
1897
  const source = await openProbeStream(context, isStdin(inputTarget) ? void 0 : resolvePath(context.cwd, inputTarget));
1297
1898
  if (source) {
1298
1899
  const sniffed = await sniffMediaStream(source, context.signal, (total) => {
1299
1900
  context.inputBudget?.check(total);
1300
1901
  budget.checkInputBytes(total);
1301
1902
  });
1302
- const automaticPlugin = automaticPlugins.find((plugin) => plugin.detect(sniffed.prefix, inputTarget));
1903
+ const automaticPlugin = explicitPlugin ?? streamPlugins.find((plugin) => plugin.detect(sniffed.prefix, inputTarget));
1303
1904
  if (automaticPlugin) {
1304
1905
  if (!automaticAudio && automaticPlugin.probeMetadataStream) {
1305
1906
  probeResult = await automaticPlugin.probeMetadataStream(sniffed.stream, {
@@ -1342,7 +1943,7 @@ function createFfprobeCommand(options = {}) {
1342
1943
  });
1343
1944
  if (!options.asts && !explicitFormat) audioInput = { bytes, args };
1344
1945
  }
1345
- const formatted = storedTags && audioInput && "audio" in audioInput ? formatTaggedAudio(audioInput.audio, audioInput.size, audioInput.args, storedTags) : formatFfprobeResultChunks(probeResult, {
1946
+ const formatted = "oggRows" in probeResult ? formatTaggedRows(probeResult.oggRows(args), args) : storedTags && audioInput && "audio" in audioInput ? formatTaggedAudio(audioInput.audio, audioInput.size, audioInput.args, storedTags) : formatFfprobeResultChunks(probeResult, {
1346
1947
  printFormat,
1347
1948
  showFormat,
1348
1949
  showStreams,