@poe-platform/safe-bash 0.1.810 → 0.1.811
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.
- package/dist/audio-ast/flac-source.d.ts +13 -0
- package/dist/audio-ast/index.d.ts +1 -0
- package/dist/audio-ast/index.js +248 -179
- package/dist/json-ast/backed-json-parser.d.ts +12 -1
- package/dist/json-ast/index.d.ts +1 -1
- package/dist/office-xml/index.d.ts +1 -0
- package/dist/office-xml/retained-xml-edits.d.ts +22 -0
- package/dist/pdf-ast/cos/qpdf-json-document.d.ts +2 -1
- package/dist/pdf-ast/index.js +151 -56
- package/dist/pdf-ast/retained-document.d.ts +2 -0
- package/dist/safe-bash/audio-ast.browser.js +2 -1
- package/dist/safe-bash/chunks/{chunk-65TFMAZU.js → chunk-BUYRKFW2.js} +8 -35
- package/dist/safe-bash/chunks/{chunk-ZA5FQ34E.js → chunk-TPG55BAQ.js} +0 -2
- package/dist/safe-bash/command-chunks/{biff-ORSHM4YX-QYPGRDAZ.js → biff-3EFLKBAH-NYWZOYQS.js} +2141 -2136
- package/dist/safe-bash/command-chunks/{chunk-HEHGHIE2.js → chunk-22MOB45U.js} +6 -6
- package/dist/safe-bash/command-chunks/{chunk-6DEWZMOL.js → chunk-2CORNDGF.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-6UHGIWFX.js → chunk-2ZFLMWOX.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-HONWGFDA.js → chunk-33YCKZZX.js} +6 -6
- package/dist/safe-bash/command-chunks/{chunk-AXWPJRY6.js → chunk-36XGIPOG.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-32ADKP5E.js → chunk-456PHA3L.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-UJXP3T6R.js → chunk-4CKFNXRN.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-5L6GHFRW.js → chunk-554Z6IKP.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-ORZRWT62.js → chunk-56NYSX65.js} +9 -9
- package/dist/safe-bash/command-chunks/{chunk-53JP3S6H.js → chunk-5HPU7D36.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-YTFWPJ3F.js → chunk-5LI2DLNZ.js} +26 -26
- package/dist/safe-bash/command-chunks/{chunk-CHR2OD2U.js → chunk-5MB64DWR.js} +9 -9
- package/dist/safe-bash/command-chunks/{chunk-3ZWBBS6U.js → chunk-5OO2P27R.js} +340 -34
- package/dist/safe-bash/command-chunks/{chunk-IC5GJI7E.js → chunk-5Q22ZLNC.js} +6 -6
- package/dist/safe-bash/command-chunks/{chunk-YO3V5RLY.js → chunk-6CCQI6XZ.js} +12 -12
- package/dist/safe-bash/command-chunks/{chunk-EO2IVGV7.js → chunk-6M6TM5Z5.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-Z54Z3KRN.js → chunk-6QBMND4A.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-INX4JMQ6.js → chunk-6VPQ3CDZ.js} +5 -5
- package/dist/safe-bash/command-chunks/{chunk-D5AYP2UM.js → chunk-72C3TZ2U.js} +25 -15
- package/dist/safe-bash/command-chunks/{chunk-VGXVN3BX.js → chunk-7GKKMNL6.js} +8 -8
- package/dist/safe-bash/command-chunks/{chunk-TZJC67W3.js → chunk-7PVHO47B.js} +6 -6
- package/dist/safe-bash/command-chunks/{chunk-CM3C7AXJ.js → chunk-A2CLZMQZ.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-ASR27KHW.js → chunk-A5FZBR7X.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-DMDHE5KC.js → chunk-AHA6IWAJ.js} +6 -6
- package/dist/safe-bash/command-chunks/{chunk-PTZ55XXN.js → chunk-APEWTWCC.js} +6 -6
- package/dist/safe-bash/command-chunks/{chunk-YUVH6CE4.js → chunk-ATTWQVR2.js} +17 -17
- package/dist/safe-bash/command-chunks/{chunk-JON5DB3Z.js → chunk-B5LDP7AA.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-CHJL6JMU.js → chunk-COKYZUBW.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-KCTV4NVX.js → chunk-CRV2Q3PB.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-V3WXPCKN.js → chunk-CV7M2QJU.js} +7 -7
- package/dist/safe-bash/command-chunks/{chunk-VPDSQPSN.js → chunk-DM2CPMB4.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-3DTDMEOP.js → chunk-EAGIJ4VW.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-JW6CMBF2.js → chunk-EHSM5ZQS.js} +8 -8
- package/dist/safe-bash/command-chunks/{chunk-WIOH7ZQN.js → chunk-ENT3IV2G.js} +12 -12
- package/dist/safe-bash/command-chunks/{chunk-5IE4LJGB.js → chunk-EUT24Y5Z.js} +8 -8
- package/dist/safe-bash/command-chunks/{chunk-COKZFXHG.js → chunk-FIIAYCWS.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-MWVFP2HY.js → chunk-GEM47B2P.js} +7 -7
- package/dist/safe-bash/command-chunks/{chunk-EHL6B34L.js → chunk-HDJVJTCK.js} +9 -9
- package/dist/safe-bash/command-chunks/{chunk-JMM3MNAY.js → chunk-HKATEVAP.js} +6 -6
- package/dist/safe-bash/command-chunks/{chunk-VWY3EAVQ.js → chunk-HTVIYLVB.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-Z4QJMDK3.js → chunk-IT7TAC3F.js} +16 -16
- package/dist/safe-bash/command-chunks/{chunk-EWS4KYJE.js → chunk-JFYWVQ4V.js} +8 -8
- package/dist/safe-bash/command-chunks/{chunk-ZCX63QWA.js → chunk-JOCFI7TG.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-F5WTH4O4.js → chunk-JQVHUSDD.js} +5 -5
- package/dist/safe-bash/command-chunks/{chunk-O4VJEGL6.js → chunk-K5GB2YMN.js} +10 -10
- package/dist/safe-bash/command-chunks/{chunk-27C3NT5V.js → chunk-KB7DUBVL.js} +5 -5
- package/dist/safe-bash/command-chunks/{chunk-4DZ32PI7.js → chunk-KCOJA7EM.js} +7 -7
- package/dist/safe-bash/command-chunks/{chunk-CAXJ4RLF.js → chunk-KJ4XXZIL.js} +12 -12
- package/dist/safe-bash/command-chunks/{chunk-BYZUOF6X.js → chunk-KL3OIBKB.js} +3742 -3726
- package/dist/safe-bash/command-chunks/{chunk-U6QHTC5J.js → chunk-L5MCW6CM.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-LVL3A7YE.js → chunk-LCZDBW55.js} +5 -5
- package/dist/safe-bash/command-chunks/{chunk-DJVRDUCA.js → chunk-LXLLA4PM.js} +17 -17
- package/dist/safe-bash/command-chunks/{chunk-K7AGAS3K.js → chunk-M7QE2MN7.js} +6 -6
- package/dist/safe-bash/command-chunks/{chunk-SWT6ILF2.js → chunk-MPUHH2KR.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-DC3OJLRB.js → chunk-NQDIT667.js} +5 -5
- package/dist/safe-bash/command-chunks/{chunk-LWZVDDJA.js → chunk-NUGQQDGE.js} +5 -1
- package/dist/safe-bash/command-chunks/{chunk-MFLQZLFR.js → chunk-OA75SGN2.js} +7 -7
- package/dist/safe-bash/command-chunks/{chunk-5LATYOF7.js → chunk-OEJM666F.js} +5 -5
- package/dist/safe-bash/command-chunks/{chunk-AF25YYIO.js → chunk-PMAM4N33.js} +9 -9
- package/dist/safe-bash/command-chunks/{chunk-KMMAJ6H6.js → chunk-PNGDJA6M.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-62BHPSKJ.js → chunk-Q6S57NOQ.js} +7 -7
- package/dist/safe-bash/command-chunks/{chunk-KJ3PEDI2.js → chunk-Q73EMLLZ.js} +146 -4
- package/dist/safe-bash/command-chunks/{chunk-FXKBM5KJ.js → chunk-QC5RMGSA.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-UQ6UIZMM.js → chunk-QD7ZRDUN.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-JHUYZZGV.js → chunk-QYMEASQ6.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-3GY5VDIX.js → chunk-QZZ73J2O.js} +6 -6
- package/dist/safe-bash/command-chunks/{chunk-S2CYIGWH.js → chunk-R6EGGK5M.js} +7 -7
- package/dist/safe-bash/command-chunks/{chunk-7AVN3OBH.js → chunk-RHYJVTJO.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-EWGDSO6U.js → chunk-RID6VYS3.js} +8 -8
- package/dist/safe-bash/command-chunks/{chunk-MMBRBANA.js → chunk-RNSKXOG3.js} +6 -6
- package/dist/safe-bash/command-chunks/{chunk-D3ZRZTY5.js → chunk-RQIQ75W5.js} +5 -5
- package/dist/safe-bash/command-chunks/{chunk-DWKQPLRT.js → chunk-RRL3Y562.js} +11 -11
- package/dist/safe-bash/command-chunks/{chunk-NXCMXD74.js → chunk-S6R3IB36.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-XUPKFHAQ.js → chunk-SDTPO2VV.js} +7 -7
- package/dist/safe-bash/command-chunks/{chunk-PIAGKRFW.js → chunk-SPLOIABU.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-WLTJDNSQ.js → chunk-TVH4JORU.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-6XVMWFHD.js → chunk-TW73OXPR.js} +6 -6
- package/dist/safe-bash/command-chunks/{chunk-SFO43CID.js → chunk-UAXSE3XE.js} +5 -5
- package/dist/safe-bash/command-chunks/{chunk-K35BSUHO.js → chunk-UYWSIIUX.js} +7 -7
- package/dist/safe-bash/command-chunks/{chunk-DCD32BEY.js → chunk-VU3EQF7F.js} +91 -53
- package/dist/safe-bash/command-chunks/{chunk-2E2YEDVB.js → chunk-W5YSINXC.js} +6 -6
- package/dist/safe-bash/command-chunks/{chunk-EYNT4OEJ.js → chunk-WGG6G2KG.js} +7 -7
- package/dist/safe-bash/command-chunks/{chunk-DVQBZXMQ.js → chunk-WJCN2IXI.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-XBZ4ZWGL.js → chunk-WVMHRNXZ.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-7GXUCQI4.js → chunk-WXRYDALR.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-S4IIOSRA.js → chunk-X7FA7ZD5.js} +8 -8
- package/dist/safe-bash/command-chunks/{chunk-SFCERNHU.js → chunk-XPD636C4.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-HYDWQLJ3.js → chunk-XRVKWGVQ.js} +6 -6
- package/dist/safe-bash/command-chunks/{chunk-3UJWHRK4.js → chunk-XVP6V5K3.js} +6 -6
- package/dist/safe-bash/command-chunks/{chunk-KTI3BULE.js → chunk-XZ2FWFNV.js} +6 -6
- package/dist/safe-bash/command-chunks/{chunk-QK3CHRGL.js → chunk-Y4EYCZFT.js} +10 -10
- package/dist/safe-bash/command-chunks/{chunk-GTWVMFBK.js → chunk-YORJDX4V.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-H6F5SN2N.js → chunk-YSMNXMAO.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-ZEPDT6I5.js → chunk-YSY6R6AS.js} +21 -25
- package/dist/safe-bash/command-chunks/{chunk-SE5SJ4JT.js → chunk-Z2JW6M2D.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-WC2OCF4H.js → chunk-ZHRGYR7B.js} +7 -7
- package/dist/safe-bash/command-chunks/{chunk-HQYFRQ5W.js → chunk-ZIIO6GRY.js} +7 -7
- package/dist/safe-bash/command-chunks/{chunk-NTRZMQZP.js → chunk-ZMHEGDU2.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-EYBXHGA6.js → chunk-ZXR6LXV5.js} +2 -2
- package/dist/safe-bash/command-chunks/{engine-MEPOXIXT-WZMRHACG.js → engine-AXXFTGCL-QBQNBI6K.js} +1 -1
- package/dist/safe-bash/command-chunks/pdf-XHHFTOT4-UJJYOYJ2.js +573 -0
- package/dist/safe-bash/commands/diff-patch/index.js +0 -3
- package/dist/safe-bash/commands/diff3/index.js +0 -2
- package/dist/safe-bash/full-core.browser.js +2 -2
- package/dist/safe-bash/plugins/index.browser.js +2 -2
- package/dist/safe-bash/plugins/index.js +3 -1
- package/dist/safe-bash/plugins/portable-commands.d.ts +1 -1
- package/dist/safe-bash/plugins/portable-commands.js +5 -3
- package/dist/safe-bash/registry-entry.browser.js +1 -1
- package/dist/safe-bash-command-diff/index.js +0 -2
- package/dist/safe-bash-command-diff3/index.js +830 -56
- package/dist/safe-bash-command-ffmpeg/index.js +1 -1
- package/dist/safe-bash-command-ffprobe/index.js +2 -2
- package/dist/safe-bash-command-ffprobe/media.js +2 -2
- package/dist/safe-bash-command-html-to-markdown/index.js +75 -21
- package/dist/safe-bash-command-pandoc/command.js +3 -3
- package/dist/safe-bash-command-pandoc/execution.d.ts +2 -2
- package/dist/safe-bash-command-pandoc/index.d.ts +1 -1
- package/dist/safe-bash-command-pandoc/index.js +14 -14
- package/dist/safe-bash-command-pandoc/lua-filters.js +2 -2
- package/dist/safe-bash-command-pandoc/types.d.ts +17 -2
- package/dist/safe-bash-command-patch/index.js +1 -1
- package/dist/safe-bash-command-patch/patch.js +1 -1
- package/dist/safe-bash-command-pdftk/index.js +616 -265
- package/dist/safe-bash-command-qpdf/index.js +115 -9
- package/dist/safe-bash-command-soffice/index.js +1 -1
- package/dist/safe-bash-command-ssconvert/index.js +2 -2
- package/dist/safe-bash-command-xq/index.js +45 -29
- package/dist/safe-bash-presentation-engine/accessibility.js +30 -30
- package/dist/safe-bash-presentation-engine/animation-editing.js +15 -15
- package/dist/safe-bash-presentation-engine/animations.js +15 -15
- package/dist/safe-bash-presentation-engine/backgrounds.js +16 -16
- package/dist/safe-bash-presentation-engine/bytes.js +3 -3
- package/dist/safe-bash-presentation-engine/chart-editing.js +33 -33
- package/dist/safe-bash-presentation-engine/chart-object-operations.js +24 -24
- package/dist/safe-bash-presentation-engine/charts.js +30 -30
- package/dist/safe-bash-presentation-engine/command-placeholder.js +55 -55
- package/dist/safe-bash-presentation-engine/comments.js +16 -16
- package/dist/safe-bash-presentation-engine/connector-operations.js +31 -31
- package/dist/safe-bash-presentation-engine/connectors.js +28 -28
- package/dist/safe-bash-presentation-engine/content-types.js +4 -4
- package/dist/safe-bash-presentation-engine/creation.js +6 -6
- package/dist/safe-bash-presentation-engine/diff.js +31 -31
- package/dist/safe-bash-presentation-engine/drawing-format.js +19 -19
- package/dist/safe-bash-presentation-engine/drawing-operations.js +30 -30
- package/dist/safe-bash-presentation-engine/drawing-schema.js +20 -20
- package/dist/safe-bash-presentation-engine/equations.js +16 -16
- package/dist/safe-bash-presentation-engine/errors.js +2 -2
- package/dist/safe-bash-presentation-engine/fields.js +16 -16
- package/dist/safe-bash-presentation-engine/font-metrics.js +3 -3
- package/dist/safe-bash-presentation-engine/image-extraction.js +19 -19
- package/dist/safe-bash-presentation-engine/image-formatting.js +31 -31
- package/dist/safe-bash-presentation-engine/image-insertion.js +17 -17
- package/dist/safe-bash-presentation-engine/image-replacement.js +20 -20
- package/dist/safe-bash-presentation-engine/image-value.js +4 -4
- package/dist/safe-bash-presentation-engine/images.js +18 -18
- package/dist/safe-bash-presentation-engine/index.d.ts +1 -1
- package/dist/safe-bash-presentation-engine/index.js +95 -93
- package/dist/safe-bash-presentation-engine/layouts.js +15 -15
- package/dist/safe-bash-presentation-engine/length.js +3 -3
- package/dist/safe-bash-presentation-engine/links.js +15 -15
- package/dist/safe-bash-presentation-engine/masters.js +14 -14
- package/dist/safe-bash-presentation-engine/media-editing.js +23 -23
- package/dist/safe-bash-presentation-engine/media-extraction.js +16 -16
- package/dist/safe-bash-presentation-engine/media.js +15 -15
- package/dist/safe-bash-presentation-engine/memberships.js +14 -14
- package/dist/safe-bash-presentation-engine/notes.js +15 -15
- package/dist/safe-bash-presentation-engine/ole-enum.js +4 -4
- package/dist/safe-bash-presentation-engine/ole-insertion.js +19 -19
- package/dist/safe-bash-presentation-engine/opaque-objects.js +9 -9
- package/dist/safe-bash-presentation-engine/package-reader.js +5 -5
- package/dist/safe-bash-presentation-engine/package-tools.js +15 -15
- package/dist/safe-bash-presentation-engine/package-uri.js +3 -3
- package/dist/safe-bash-presentation-engine/package-writer.js +4 -4
- package/dist/safe-bash-presentation-engine/presentation-model.js +54 -54
- package/dist/safe-bash-presentation-engine/presentation-settings.js +13 -13
- package/dist/safe-bash-presentation-engine/properties.js +15 -15
- package/dist/safe-bash-presentation-engine/relationships.js +4 -4
- package/dist/safe-bash-presentation-engine/resource-limits.js +1 -1
- package/dist/safe-bash-presentation-engine/retained-inspection.js +12 -12
- package/dist/safe-bash-presentation-engine/retained-package.js +4 -4
- package/dist/safe-bash-presentation-engine/retained-slide-settings.d.ts +15 -0
- package/dist/safe-bash-presentation-engine/retained-text.js +17 -17
- package/dist/safe-bash-presentation-engine/sanitize.js +16 -16
- package/dist/safe-bash-presentation-engine/selectors.js +10 -10
- package/dist/safe-bash-presentation-engine/shape-groups.js +30 -30
- package/dist/safe-bash-presentation-engine/shape-operations.js +29 -29
- package/dist/safe-bash-presentation-engine/shape-path-operations.js +31 -31
- package/dist/safe-bash-presentation-engine/shape-paths.js +15 -15
- package/dist/safe-bash-presentation-engine/shape-presets.js +3 -3
- package/dist/safe-bash-presentation-engine/shape-selection.js +30 -30
- package/dist/safe-bash-presentation-engine/shape-transforms.js +17 -17
- package/dist/safe-bash-presentation-engine/shapes.js +26 -26
- package/dist/safe-bash-presentation-engine/slide-copy.js +16 -16
- package/dist/safe-bash-presentation-engine/slide-import.js +17 -17
- package/dist/safe-bash-presentation-engine/slide-merge-split.js +19 -19
- package/dist/safe-bash-presentation-engine/slide-model.js +42 -42
- package/dist/safe-bash-presentation-engine/slide-removal.js +17 -17
- package/dist/safe-bash-presentation-engine/slide-transfer-budget.js +9 -9
- package/dist/safe-bash-presentation-engine/slides.d.ts +2 -0
- package/dist/safe-bash-presentation-engine/slides.js +21 -16
- package/dist/safe-bash-presentation-engine/table-operations.js +32 -32
- package/dist/safe-bash-presentation-engine/table-spans.js +31 -31
- package/dist/safe-bash-presentation-engine/tables.js +30 -30
- package/dist/safe-bash-presentation-engine/tags.js +15 -15
- package/dist/safe-bash-presentation-engine/template-bindings.js +32 -32
- package/dist/safe-bash-presentation-engine/template-repeat.js +39 -39
- package/dist/safe-bash-presentation-engine/text-fitting.js +26 -26
- package/dist/safe-bash-presentation-engine/text-frames.js +26 -26
- package/dist/safe-bash-presentation-engine/text-paragraphs.js +26 -26
- package/dist/safe-bash-presentation-engine/text-reading.js +11 -11
- package/dist/safe-bash-presentation-engine/text-replacement.js +16 -16
- package/dist/safe-bash-presentation-engine/text-runs.js +19 -19
- package/dist/safe-bash-presentation-engine/themes.js +15 -15
- package/dist/safe-bash-presentation-engine/transitions.js +15 -15
- package/dist/safe-bash-presentation-engine/validation.js +9 -9
- package/dist/safe-bash-presentation-engine/xml-parts.js +15 -15
- package/dist/safe-bash-presentation-engine/xml-view.js +3 -3
- package/dist/safe-bash-presentation-engine/xml.js +3 -3
- package/dist/safe-bash-xml-engine/json.d.ts +1 -0
- package/dist/safe-bash-xml-engine/json.js +203 -0
- package/dist/safe-bash-xml-engine/stored-json.d.ts +5 -0
- package/dist/spreadsheet-engine/rendering/print/bidi-runs.d.ts +5 -0
- package/dist/spreadsheet-engine/rendering/print/bidi-runs.js +35 -0
- package/dist/spreadsheet-engine/rendering/print/control-bidi.d.ts +8 -0
- package/dist/spreadsheet-engine/rendering/print/control-bidi.js +80 -0
- package/dist/spreadsheet-format-xls/biff-encrypted-properties.d.ts +4 -4
- package/dist/spreadsheet-format-xls/biff-encrypted-properties.js +36 -23
- package/dist/spreadsheet-format-xls/biff-encryption.js +1 -1
- package/dist/spreadsheet-format-xls/biff-property-bytes.d.ts +4 -1
- package/dist/spreadsheet-format-xls/biff-property-bytes.js +1 -1
- package/dist/spreadsheet-format-xls/biff-range.js +1 -1
- package/package.json +5 -2
- package/dist/safe-bash/command-chunks/pdf-LOZAXXS6-ERI57IAV.js +0 -557
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { AudioProbeSource } from "./wav-source.js";
|
|
2
|
+
import type { AudioAst } from "./types.js";
|
|
3
|
+
/** UTF-8 comment bytes; block identity preserves replacement across comment blocks. */
|
|
4
|
+
export interface FlacCommentSpan {
|
|
5
|
+
readonly block: number;
|
|
6
|
+
readonly offset: number;
|
|
7
|
+
readonly length: number;
|
|
8
|
+
}
|
|
9
|
+
/** Strict FLAC validation without AST/picture/frame models. onComment avoids collecting tag strings. */
|
|
10
|
+
export declare function probeFlacSource(source: AudioProbeSource, options?: {
|
|
11
|
+
signal?: AbortSignal;
|
|
12
|
+
onComment?: (span: FlacCommentSpan) => Promise<void>;
|
|
13
|
+
}): Promise<Omit<AudioAst, "data" | "nodes" | "pictures">>;
|
package/dist/audio-ast/index.js
CHANGED
|
@@ -74,6 +74,249 @@ function duration(samples, sampleRate) {
|
|
|
74
74
|
return samples / sampleRate;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
+
// packages/audio-ast/src/vorbis.ts
|
|
78
|
+
var names = {
|
|
79
|
+
TITLE: "title",
|
|
80
|
+
ARTIST: "artist",
|
|
81
|
+
ALBUM: "album",
|
|
82
|
+
ALBUMARTIST: "albumArtist",
|
|
83
|
+
TRACKNUMBER: "track",
|
|
84
|
+
DISCNUMBER: "disc",
|
|
85
|
+
DATE: "date",
|
|
86
|
+
GENRE: "genre",
|
|
87
|
+
COMMENT: "comment",
|
|
88
|
+
DESCRIPTION: "comment",
|
|
89
|
+
ENCODER: "encoder",
|
|
90
|
+
COPYRIGHT: "copyright"
|
|
91
|
+
};
|
|
92
|
+
function parseComments(bytes) {
|
|
93
|
+
const r = new Reader(bytes), vendorSize = r.u32(0, true), vendor = new TextDecoder().decode(r.slice(4, vendorSize));
|
|
94
|
+
let offset = 4 + vendorSize;
|
|
95
|
+
const count = r.u32(offset, true);
|
|
96
|
+
offset += 4;
|
|
97
|
+
if (count > (bytes.length - offset) / 4) throw new Error("Invalid Vorbis comment count");
|
|
98
|
+
const tags = {}, comments = [];
|
|
99
|
+
for (let i = 0; i < count; i++) {
|
|
100
|
+
const size = r.u32(offset, true);
|
|
101
|
+
offset += 4;
|
|
102
|
+
const value = new TextDecoder().decode(r.slice(offset, size));
|
|
103
|
+
offset += size;
|
|
104
|
+
comments.push(value);
|
|
105
|
+
addVorbisComment(tags, value);
|
|
106
|
+
}
|
|
107
|
+
return { tags, vendor, comments, size: offset };
|
|
108
|
+
}
|
|
109
|
+
function encodeComments(tags, vendor = "poe-code/audio-ast") {
|
|
110
|
+
const encoder = new TextEncoder(), v = encoder.encode(vendor), comments = [];
|
|
111
|
+
for (const [name, value] of Object.entries(tags)) {
|
|
112
|
+
const key = Object.keys(names).find((key2) => names[key2] === name) ?? name.toUpperCase();
|
|
113
|
+
if (key.includes("=") || Array.from(key).some((c) => c.charCodeAt(0) < 32 || c.charCodeAt(0) > 125))
|
|
114
|
+
throw new Error("Invalid Vorbis comment key");
|
|
115
|
+
for (const part of value.split("\n")) {
|
|
116
|
+
const bytes = encoder.encode(`${key}=${part}`);
|
|
117
|
+
comments.push(join([uint32(bytes.length, true), bytes]));
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return join([uint32(v.length, true), v, uint32(comments.length, true), ...comments]);
|
|
121
|
+
}
|
|
122
|
+
function parsePicture(bytes) {
|
|
123
|
+
const r = new Reader(bytes), type = r.u32(0), mimeSize = r.u32(4), mime = r.text(8, mimeSize);
|
|
124
|
+
let offset = 8 + mimeSize;
|
|
125
|
+
const descriptionSize = r.u32(offset);
|
|
126
|
+
offset += 4;
|
|
127
|
+
const description = new TextDecoder().decode(r.slice(offset, descriptionSize));
|
|
128
|
+
offset += descriptionSize;
|
|
129
|
+
const width = r.u32(offset), height = r.u32(offset + 4), depth = r.u32(offset + 8), colors = r.u32(offset + 12), size = r.u32(offset + 16);
|
|
130
|
+
offset += 20;
|
|
131
|
+
const data = r.slice(offset, size);
|
|
132
|
+
if (offset + size !== bytes.length) throw new Error("Trailing FLAC picture bytes");
|
|
133
|
+
return { type, mime, description, width, height, depth, colors, data };
|
|
134
|
+
}
|
|
135
|
+
function encodePicture(p) {
|
|
136
|
+
const description = new TextEncoder().encode(p.description), mime = ascii(p.mime);
|
|
137
|
+
return join([
|
|
138
|
+
uint32(p.type),
|
|
139
|
+
uint32(mime.length),
|
|
140
|
+
mime,
|
|
141
|
+
uint32(description.length),
|
|
142
|
+
description,
|
|
143
|
+
uint32(p.width ?? 0),
|
|
144
|
+
uint32(p.height ?? 0),
|
|
145
|
+
uint32(p.depth ?? 0),
|
|
146
|
+
uint32(p.colors ?? 0),
|
|
147
|
+
uint32(p.data.length),
|
|
148
|
+
p.data
|
|
149
|
+
]);
|
|
150
|
+
}
|
|
151
|
+
function pictureBase64(picture) {
|
|
152
|
+
const bytes = encodePicture(picture);
|
|
153
|
+
let binary = "";
|
|
154
|
+
for (let i = 0; i < bytes.length; i += 8192)
|
|
155
|
+
binary += String.fromCharCode(...bytes.subarray(i, i + 8192));
|
|
156
|
+
return btoa(binary);
|
|
157
|
+
}
|
|
158
|
+
function addVorbisComment(tags, value) {
|
|
159
|
+
const split = value.indexOf("=");
|
|
160
|
+
if (split > 0) {
|
|
161
|
+
const key = value.slice(0, split).toUpperCase(), name = names[key] ?? key;
|
|
162
|
+
tags[name] = tags[name] ? `${tags[name]}
|
|
163
|
+
${value.slice(split + 1)}` : value.slice(split + 1);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// packages/audio-ast/src/flac.ts
|
|
168
|
+
function parseFlac(bytes) {
|
|
169
|
+
const r = new Reader(bytes), nodes = [], pictures = [];
|
|
170
|
+
const tags = {};
|
|
171
|
+
let offset = 4, last = false, stream;
|
|
172
|
+
while (!last) {
|
|
173
|
+
const header = r.u8(offset), type = header & 127, size = r.u24(offset + 1);
|
|
174
|
+
last = !!(header & 128);
|
|
175
|
+
const data = r.slice(offset + 4, size), node = {
|
|
176
|
+
type: [
|
|
177
|
+
"STREAMINFO",
|
|
178
|
+
"PADDING",
|
|
179
|
+
"APPLICATION",
|
|
180
|
+
"SEEKTABLE",
|
|
181
|
+
"VORBIS_COMMENT",
|
|
182
|
+
"CUESHEET",
|
|
183
|
+
"PICTURE"
|
|
184
|
+
][type] ?? `BLOCK_${type}`,
|
|
185
|
+
offset,
|
|
186
|
+
size: size + 4,
|
|
187
|
+
data
|
|
188
|
+
};
|
|
189
|
+
nodes.push(node);
|
|
190
|
+
const block = new Reader(data);
|
|
191
|
+
if (type === 0) {
|
|
192
|
+
if (stream || offset !== 4 || size !== 34)
|
|
193
|
+
throw new Error("FLAC requires first unique STREAMINFO");
|
|
194
|
+
stream = flacStream(block, bytes.length);
|
|
195
|
+
const { sampleRate, channels, bitsPerSample, samples } = stream;
|
|
196
|
+
node.fields = {
|
|
197
|
+
minBlockSize: block.u16(0),
|
|
198
|
+
maxBlockSize: block.u16(2),
|
|
199
|
+
minFrameSize: block.u24(4),
|
|
200
|
+
maxFrameSize: block.u24(7),
|
|
201
|
+
sampleRate,
|
|
202
|
+
channels,
|
|
203
|
+
bitsPerSample,
|
|
204
|
+
totalSamples: samples,
|
|
205
|
+
md5: Array.from(block.slice(18, 16), (b) => b.toString(16).padStart(2, "0")).join("")
|
|
206
|
+
};
|
|
207
|
+
} else if (type === 4) {
|
|
208
|
+
const parsed = parseComments(data);
|
|
209
|
+
if (parsed.size !== size) throw new Error("Trailing Vorbis comment bytes");
|
|
210
|
+
Object.assign(tags, parsed.tags);
|
|
211
|
+
node.fields = { vendor: parsed.vendor, comments: parsed.comments };
|
|
212
|
+
} else if (type === 6) pictures.push(parsePicture(data));
|
|
213
|
+
else if (type === 3) {
|
|
214
|
+
if (size % 18) throw new Error("Invalid FLAC seek table");
|
|
215
|
+
const points = [];
|
|
216
|
+
for (let pos = 0; pos < size; pos += 18)
|
|
217
|
+
points.push({
|
|
218
|
+
sample: block.u64(pos),
|
|
219
|
+
offset: block.u64(pos + 8),
|
|
220
|
+
samples: block.u16(pos + 16)
|
|
221
|
+
});
|
|
222
|
+
node.fields = { points };
|
|
223
|
+
} else if (type === 127) throw new Error("Invalid FLAC metadata block");
|
|
224
|
+
offset += 4 + size;
|
|
225
|
+
}
|
|
226
|
+
if (!stream) throw new Error("Missing FLAC STREAMINFO");
|
|
227
|
+
if (offset < bytes.length)
|
|
228
|
+
nodes.push({
|
|
229
|
+
type: "FRAMES",
|
|
230
|
+
offset,
|
|
231
|
+
size: bytes.length - offset,
|
|
232
|
+
data: r.slice(offset, bytes.length - offset)
|
|
233
|
+
});
|
|
234
|
+
return {
|
|
235
|
+
format: "flac",
|
|
236
|
+
data: bytes,
|
|
237
|
+
nodes,
|
|
238
|
+
tags,
|
|
239
|
+
pictures,
|
|
240
|
+
streams: [stream],
|
|
241
|
+
duration: stream.duration,
|
|
242
|
+
bitrate: stream.bitrate
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
function flacStream(block, byteLength) {
|
|
246
|
+
const packed = block.u64(10), sampleRate = Number(packed >> 44n), channels = Number(packed >> 41n & 7n) + 1, bitsPerSample = Number(packed >> 36n & 31n) + 1, samples = Number(packed & 0xfffffffffn), seconds2 = duration(samples, sampleRate);
|
|
247
|
+
return { codec: "flac", sampleRate, channels, bitsPerSample, samples, duration: seconds2, bitrate: seconds2 ? byteLength * 8 / seconds2 : 0 };
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// packages/audio-ast/src/flac-source.ts
|
|
251
|
+
async function probeFlacSource(source, options = {}) {
|
|
252
|
+
const check = (offset2, length, end = source.size) => {
|
|
253
|
+
options.signal?.throwIfAborted();
|
|
254
|
+
if (!Number.isSafeInteger(source.size) || !Number.isSafeInteger(offset2) || !Number.isSafeInteger(length) || offset2 < 0 || length < 0 || length > end - offset2)
|
|
255
|
+
throw new Error("Truncated or invalid audio structure");
|
|
256
|
+
};
|
|
257
|
+
const read = async (offset2, length, end = source.size) => {
|
|
258
|
+
check(offset2, length, end);
|
|
259
|
+
const bytes = await source.read(offset2, length);
|
|
260
|
+
options.signal?.throwIfAborted();
|
|
261
|
+
if (bytes.length !== length) throw new Error("Truncated or invalid audio structure");
|
|
262
|
+
return new Reader(bytes);
|
|
263
|
+
};
|
|
264
|
+
if ((await read(0, 4)).text(0, 4) !== "fLaC") throw new Error("Expected FLAC signature");
|
|
265
|
+
let offset = 4, last = false, stream;
|
|
266
|
+
const tags = {};
|
|
267
|
+
while (!last) {
|
|
268
|
+
const header = await read(offset, 4), type = header.u8(0) & 127, length = header.u24(1), start = offset + 4, end = start + length;
|
|
269
|
+
last = !!(header.u8(0) & 128);
|
|
270
|
+
check(start, length);
|
|
271
|
+
if (type === 0) {
|
|
272
|
+
if (stream || offset !== 4 || length !== 34) throw new Error("FLAC requires first unique STREAMINFO");
|
|
273
|
+
stream = flacStream(await read(start, 34, end), source.size);
|
|
274
|
+
} else if (type === 4) {
|
|
275
|
+
const vendorLength = (await read(start, 4, end)).u32(0, true);
|
|
276
|
+
check(start + 4, vendorLength, end);
|
|
277
|
+
let pos = start + 4 + vendorLength;
|
|
278
|
+
const count = (await read(pos, 4, end)).u32(0, true);
|
|
279
|
+
pos += 4;
|
|
280
|
+
if (count > (end - pos) / 4) throw new Error("Invalid Vorbis comment count");
|
|
281
|
+
const blockTags = {};
|
|
282
|
+
for (let i = 0; i < count; i++) {
|
|
283
|
+
const size = (await read(pos, 4, end)).u32(0, true);
|
|
284
|
+
pos += 4;
|
|
285
|
+
check(pos, size, end);
|
|
286
|
+
if (options.onComment) {
|
|
287
|
+
await options.onComment({ block: offset, offset: pos, length: size });
|
|
288
|
+
options.signal?.throwIfAborted();
|
|
289
|
+
} else {
|
|
290
|
+
const decoder = new TextDecoder();
|
|
291
|
+
let text2 = "";
|
|
292
|
+
for (let at = 0; at < size; at += 16384) text2 += decoder.decode((await read(pos + at, Math.min(16384, size - at), end)).bytes, { stream: true });
|
|
293
|
+
addVorbisComment(blockTags, text2 + decoder.decode());
|
|
294
|
+
}
|
|
295
|
+
pos += size;
|
|
296
|
+
}
|
|
297
|
+
if (pos !== end) throw new Error("Trailing Vorbis comment bytes");
|
|
298
|
+
Object.assign(tags, blockTags);
|
|
299
|
+
} else if (type === 6) {
|
|
300
|
+
const prefix = await read(start, 8, end), mimeLength = prefix.u32(4);
|
|
301
|
+
check(start + 8, mimeLength, end);
|
|
302
|
+
let pos = start + 8 + mimeLength;
|
|
303
|
+
const descriptionLength = (await read(pos, 4, end)).u32(0);
|
|
304
|
+
pos += 4;
|
|
305
|
+
check(pos, descriptionLength, end);
|
|
306
|
+
pos += descriptionLength;
|
|
307
|
+
const size = (await read(pos, 20, end)).u32(16);
|
|
308
|
+
pos += 20;
|
|
309
|
+
check(pos, size, end);
|
|
310
|
+
if (pos + size !== end) throw new Error("Trailing FLAC picture bytes");
|
|
311
|
+
} else if (type === 3 && length % 18) throw new Error("Invalid FLAC seek table");
|
|
312
|
+
else if (type === 127) throw new Error("Invalid FLAC metadata block");
|
|
313
|
+
offset = end;
|
|
314
|
+
}
|
|
315
|
+
if (!stream) throw new Error("Missing FLAC STREAMINFO");
|
|
316
|
+
options.signal?.throwIfAborted();
|
|
317
|
+
return { format: "flac", streams: [stream], tags, duration: stream.duration, bitrate: stream.bitrate };
|
|
318
|
+
}
|
|
319
|
+
|
|
77
320
|
// packages/audio-ast/src/wav.ts
|
|
78
321
|
var infoNames = {
|
|
79
322
|
INAM: "title",
|
|
@@ -543,7 +786,7 @@ function transformAudio(pcm, effects) {
|
|
|
543
786
|
}
|
|
544
787
|
|
|
545
788
|
// packages/audio-ast/src/id3.ts
|
|
546
|
-
var
|
|
789
|
+
var names2 = {
|
|
547
790
|
TIT2: "title",
|
|
548
791
|
TPE1: "artist",
|
|
549
792
|
TPE2: "albumArtist",
|
|
@@ -636,7 +879,7 @@ function parseId3(bytes) {
|
|
|
636
879
|
if (version === 4 && frameFlags & 1) prefix += 4;
|
|
637
880
|
data = data.subarray(prefix);
|
|
638
881
|
if (id.startsWith("T") && id !== "TXXX" && id !== "TXX")
|
|
639
|
-
tags[
|
|
882
|
+
tags[names2[id] ?? id] = text(data.subarray(1), data[0]);
|
|
640
883
|
else if (id === "COMM" || id === "COM") {
|
|
641
884
|
const encoding = data[0], end = terminated(data, 4, encoding), width = encoding === 1 || encoding === 2 ? 2 : 1;
|
|
642
885
|
tags.comment = text(data.subarray(end + width), encoding);
|
|
@@ -676,13 +919,13 @@ function encodeId3(tags, retained = [], pictures = []) {
|
|
|
676
919
|
if (flags & (node.fields?.version === 3 ? 192 : 12)) {
|
|
677
920
|
throw new Error(`Cannot safely rewrite transformed ID3 frame ${node.type}`);
|
|
678
921
|
}
|
|
679
|
-
if (node.type === "APIC" || node.type === "PIC" ||
|
|
922
|
+
if (node.type === "APIC" || node.type === "PIC" || names2[node.type] || node.type.startsWith("T") && node.type !== "TXXX" && node.type !== "TXX" || node.type === "COMM" || node.type === "COM")
|
|
680
923
|
continue;
|
|
681
924
|
if (node.type.length === 4 && !node.fields?.flags) frame(node.type, node.data);
|
|
682
925
|
else throw new Error(`Cannot safely rewrite ID3 frame ${node.type}`);
|
|
683
926
|
}
|
|
684
927
|
for (const [name, value] of Object.entries(tags)) {
|
|
685
|
-
const id = Object.keys(
|
|
928
|
+
const id = Object.keys(names2).find((key) => key.length === 4 && names2[key] === name) ?? name;
|
|
686
929
|
if (name === "comment")
|
|
687
930
|
frame(
|
|
688
931
|
"COMM",
|
|
@@ -865,181 +1108,6 @@ function parseMp3(bytes) {
|
|
|
865
1108
|
};
|
|
866
1109
|
}
|
|
867
1110
|
|
|
868
|
-
// packages/audio-ast/src/vorbis.ts
|
|
869
|
-
var names2 = {
|
|
870
|
-
TITLE: "title",
|
|
871
|
-
ARTIST: "artist",
|
|
872
|
-
ALBUM: "album",
|
|
873
|
-
ALBUMARTIST: "albumArtist",
|
|
874
|
-
TRACKNUMBER: "track",
|
|
875
|
-
DISCNUMBER: "disc",
|
|
876
|
-
DATE: "date",
|
|
877
|
-
GENRE: "genre",
|
|
878
|
-
COMMENT: "comment",
|
|
879
|
-
DESCRIPTION: "comment",
|
|
880
|
-
ENCODER: "encoder",
|
|
881
|
-
COPYRIGHT: "copyright"
|
|
882
|
-
};
|
|
883
|
-
function parseComments(bytes) {
|
|
884
|
-
const r = new Reader(bytes), vendorSize = r.u32(0, true), vendor = new TextDecoder().decode(r.slice(4, vendorSize));
|
|
885
|
-
let offset = 4 + vendorSize;
|
|
886
|
-
const count = r.u32(offset, true);
|
|
887
|
-
offset += 4;
|
|
888
|
-
if (count > (bytes.length - offset) / 4) throw new Error("Invalid Vorbis comment count");
|
|
889
|
-
const tags = {}, comments = [];
|
|
890
|
-
for (let i = 0; i < count; i++) {
|
|
891
|
-
const size = r.u32(offset, true);
|
|
892
|
-
offset += 4;
|
|
893
|
-
const value = new TextDecoder().decode(r.slice(offset, size));
|
|
894
|
-
offset += size;
|
|
895
|
-
comments.push(value);
|
|
896
|
-
const split = value.indexOf("=");
|
|
897
|
-
if (split > 0) {
|
|
898
|
-
const key = value.slice(0, split).toUpperCase(), name = names2[key] ?? key;
|
|
899
|
-
tags[name] = tags[name] ? `${tags[name]}
|
|
900
|
-
${value.slice(split + 1)}` : value.slice(split + 1);
|
|
901
|
-
}
|
|
902
|
-
}
|
|
903
|
-
return { tags, vendor, comments, size: offset };
|
|
904
|
-
}
|
|
905
|
-
function encodeComments(tags, vendor = "poe-code/audio-ast") {
|
|
906
|
-
const encoder = new TextEncoder(), v = encoder.encode(vendor), comments = [];
|
|
907
|
-
for (const [name, value] of Object.entries(tags)) {
|
|
908
|
-
const key = Object.keys(names2).find((key2) => names2[key2] === name) ?? name.toUpperCase();
|
|
909
|
-
if (key.includes("=") || Array.from(key).some((c) => c.charCodeAt(0) < 32 || c.charCodeAt(0) > 125))
|
|
910
|
-
throw new Error("Invalid Vorbis comment key");
|
|
911
|
-
for (const part of value.split("\n")) {
|
|
912
|
-
const bytes = encoder.encode(`${key}=${part}`);
|
|
913
|
-
comments.push(join([uint32(bytes.length, true), bytes]));
|
|
914
|
-
}
|
|
915
|
-
}
|
|
916
|
-
return join([uint32(v.length, true), v, uint32(comments.length, true), ...comments]);
|
|
917
|
-
}
|
|
918
|
-
function parsePicture(bytes) {
|
|
919
|
-
const r = new Reader(bytes), type = r.u32(0), mimeSize = r.u32(4), mime = r.text(8, mimeSize);
|
|
920
|
-
let offset = 8 + mimeSize;
|
|
921
|
-
const descriptionSize = r.u32(offset);
|
|
922
|
-
offset += 4;
|
|
923
|
-
const description = new TextDecoder().decode(r.slice(offset, descriptionSize));
|
|
924
|
-
offset += descriptionSize;
|
|
925
|
-
const width = r.u32(offset), height = r.u32(offset + 4), depth = r.u32(offset + 8), colors = r.u32(offset + 12), size = r.u32(offset + 16);
|
|
926
|
-
offset += 20;
|
|
927
|
-
const data = r.slice(offset, size);
|
|
928
|
-
if (offset + size !== bytes.length) throw new Error("Trailing FLAC picture bytes");
|
|
929
|
-
return { type, mime, description, width, height, depth, colors, data };
|
|
930
|
-
}
|
|
931
|
-
function encodePicture(p) {
|
|
932
|
-
const description = new TextEncoder().encode(p.description), mime = ascii(p.mime);
|
|
933
|
-
return join([
|
|
934
|
-
uint32(p.type),
|
|
935
|
-
uint32(mime.length),
|
|
936
|
-
mime,
|
|
937
|
-
uint32(description.length),
|
|
938
|
-
description,
|
|
939
|
-
uint32(p.width ?? 0),
|
|
940
|
-
uint32(p.height ?? 0),
|
|
941
|
-
uint32(p.depth ?? 0),
|
|
942
|
-
uint32(p.colors ?? 0),
|
|
943
|
-
uint32(p.data.length),
|
|
944
|
-
p.data
|
|
945
|
-
]);
|
|
946
|
-
}
|
|
947
|
-
function pictureBase64(picture) {
|
|
948
|
-
const bytes = encodePicture(picture);
|
|
949
|
-
let binary = "";
|
|
950
|
-
for (let i = 0; i < bytes.length; i += 8192)
|
|
951
|
-
binary += String.fromCharCode(...bytes.subarray(i, i + 8192));
|
|
952
|
-
return btoa(binary);
|
|
953
|
-
}
|
|
954
|
-
|
|
955
|
-
// packages/audio-ast/src/flac.ts
|
|
956
|
-
function parseFlac(bytes) {
|
|
957
|
-
const r = new Reader(bytes), nodes = [], pictures = [];
|
|
958
|
-
const tags = {};
|
|
959
|
-
let offset = 4, last = false, stream;
|
|
960
|
-
while (!last) {
|
|
961
|
-
const header = r.u8(offset), type = header & 127, size = r.u24(offset + 1);
|
|
962
|
-
last = !!(header & 128);
|
|
963
|
-
const data = r.slice(offset + 4, size), node = {
|
|
964
|
-
type: [
|
|
965
|
-
"STREAMINFO",
|
|
966
|
-
"PADDING",
|
|
967
|
-
"APPLICATION",
|
|
968
|
-
"SEEKTABLE",
|
|
969
|
-
"VORBIS_COMMENT",
|
|
970
|
-
"CUESHEET",
|
|
971
|
-
"PICTURE"
|
|
972
|
-
][type] ?? `BLOCK_${type}`,
|
|
973
|
-
offset,
|
|
974
|
-
size: size + 4,
|
|
975
|
-
data
|
|
976
|
-
};
|
|
977
|
-
nodes.push(node);
|
|
978
|
-
const block = new Reader(data);
|
|
979
|
-
if (type === 0) {
|
|
980
|
-
if (stream || offset !== 4 || size !== 34)
|
|
981
|
-
throw new Error("FLAC requires first unique STREAMINFO");
|
|
982
|
-
const packed = block.u64(10), sampleRate = Number(packed >> 44n), channels = Number(packed >> 41n & 7n) + 1, bitsPerSample = Number(packed >> 36n & 31n) + 1, samples = Number(packed & 0xfffffffffn);
|
|
983
|
-
const seconds2 = duration(samples, sampleRate);
|
|
984
|
-
stream = {
|
|
985
|
-
codec: "flac",
|
|
986
|
-
sampleRate,
|
|
987
|
-
channels,
|
|
988
|
-
bitsPerSample,
|
|
989
|
-
samples,
|
|
990
|
-
duration: seconds2,
|
|
991
|
-
bitrate: seconds2 ? bytes.length * 8 / seconds2 : 0
|
|
992
|
-
};
|
|
993
|
-
node.fields = {
|
|
994
|
-
minBlockSize: block.u16(0),
|
|
995
|
-
maxBlockSize: block.u16(2),
|
|
996
|
-
minFrameSize: block.u24(4),
|
|
997
|
-
maxFrameSize: block.u24(7),
|
|
998
|
-
sampleRate,
|
|
999
|
-
channels,
|
|
1000
|
-
bitsPerSample,
|
|
1001
|
-
totalSamples: samples,
|
|
1002
|
-
md5: Array.from(block.slice(18, 16), (b) => b.toString(16).padStart(2, "0")).join("")
|
|
1003
|
-
};
|
|
1004
|
-
} else if (type === 4) {
|
|
1005
|
-
const parsed = parseComments(data);
|
|
1006
|
-
if (parsed.size !== size) throw new Error("Trailing Vorbis comment bytes");
|
|
1007
|
-
Object.assign(tags, parsed.tags);
|
|
1008
|
-
node.fields = { vendor: parsed.vendor, comments: parsed.comments };
|
|
1009
|
-
} else if (type === 6) pictures.push(parsePicture(data));
|
|
1010
|
-
else if (type === 3) {
|
|
1011
|
-
if (size % 18) throw new Error("Invalid FLAC seek table");
|
|
1012
|
-
const points = [];
|
|
1013
|
-
for (let pos = 0; pos < size; pos += 18)
|
|
1014
|
-
points.push({
|
|
1015
|
-
sample: block.u64(pos),
|
|
1016
|
-
offset: block.u64(pos + 8),
|
|
1017
|
-
samples: block.u16(pos + 16)
|
|
1018
|
-
});
|
|
1019
|
-
node.fields = { points };
|
|
1020
|
-
} else if (type === 127) throw new Error("Invalid FLAC metadata block");
|
|
1021
|
-
offset += 4 + size;
|
|
1022
|
-
}
|
|
1023
|
-
if (!stream) throw new Error("Missing FLAC STREAMINFO");
|
|
1024
|
-
if (offset < bytes.length)
|
|
1025
|
-
nodes.push({
|
|
1026
|
-
type: "FRAMES",
|
|
1027
|
-
offset,
|
|
1028
|
-
size: bytes.length - offset,
|
|
1029
|
-
data: r.slice(offset, bytes.length - offset)
|
|
1030
|
-
});
|
|
1031
|
-
return {
|
|
1032
|
-
format: "flac",
|
|
1033
|
-
data: bytes,
|
|
1034
|
-
nodes,
|
|
1035
|
-
tags,
|
|
1036
|
-
pictures,
|
|
1037
|
-
streams: [stream],
|
|
1038
|
-
duration: stream.duration,
|
|
1039
|
-
bitrate: stream.bitrate
|
|
1040
|
-
};
|
|
1041
|
-
}
|
|
1042
|
-
|
|
1043
1111
|
// packages/audio-ast/src/ogg.ts
|
|
1044
1112
|
function oggCrc(bytes) {
|
|
1045
1113
|
let crc = 0;
|
|
@@ -1629,6 +1697,7 @@ export {
|
|
|
1629
1697
|
pad,
|
|
1630
1698
|
parseAudio,
|
|
1631
1699
|
probeAudio,
|
|
1700
|
+
probeFlacSource,
|
|
1632
1701
|
probeWavSource,
|
|
1633
1702
|
remix,
|
|
1634
1703
|
resample,
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import type { PagedStorage } from "@poe-platform/safe-fs/storage";
|
|
2
2
|
import type { BackedJson } from "./backed-json.js";
|
|
3
|
+
type Mode = "value" | "arrayFirst" | "keyFirst" | "key" | "colon" | "separator" | "done";
|
|
4
|
+
type NumberState = "start" | "minus" | "zero" | "int" | "dot" | "frac" | "exp" | "expSign" | "expDigits";
|
|
5
|
+
export interface JsonSyntaxContext {
|
|
6
|
+
readonly mode: Mode;
|
|
7
|
+
readonly token: "string" | "number" | "keyword" | undefined;
|
|
8
|
+
readonly number: NumberState;
|
|
9
|
+
readonly escape: boolean;
|
|
10
|
+
readonly hex: number;
|
|
11
|
+
readonly container: "array" | "object" | undefined;
|
|
12
|
+
}
|
|
3
13
|
/** JSON syntax and duplicate-key validation over streamed UTF-16 fragments.
|
|
4
14
|
* Numeric spellings stay on tape; format-specific range/rounding validation is
|
|
5
15
|
* separate. Both nesting state and the key index live in caller storage. */
|
|
6
|
-
export declare function parseBackedJson(chunks: AsyncIterable<string>, tree: BackedJson, index: PagedStorage, cooperate: (units?: number) => Promise<void>,
|
|
16
|
+
export declare function parseBackedJson(chunks: AsyncIterable<string>, tree: BackedJson, index: PagedStorage, cooperate: (units?: number) => Promise<void>, onError: (offset: number, message: string, tokenOffset?: number, context?: JsonSyntaxContext) => never, validateNumber?: (node: number, offset: number) => Promise<void>, allowDuplicateKeys?: boolean, checkDepth?: (depth: number, container?: boolean) => void, node?: (kind: "object" | "array" | "key" | "scalar", complete?: boolean) => void, reference?: () => void, retained?: (bytes: number) => void): Promise<void>;
|
|
17
|
+
export {};
|
package/dist/json-ast/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { BackedJson } from "./backed-json.js";
|
|
2
|
-
export { parseBackedJson } from "./backed-json-parser.js";
|
|
2
|
+
export { parseBackedJson, type JsonSyntaxContext } from "./backed-json-parser.js";
|
|
3
3
|
export { JsonNumberError, readJsonNumber } from "./json-number.js";
|
|
4
4
|
export { indexJsonObjects } from "./object-order.js";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ByteSource } from "../office-package/index.js";
|
|
2
|
+
import { type RetainedXmlContext } from './office-resources.js';
|
|
3
|
+
import { type RetainedXml, type XmlRange } from './retained-xml.js';
|
|
4
|
+
export interface RetainedXmlEdit {
|
|
5
|
+
/** Original decoded UTF-8 coordinates. Edits must be ordered and disjoint;
|
|
6
|
+
* consecutive zero-length insertions at the same coordinate preserve order. */
|
|
7
|
+
readonly range: XmlRange;
|
|
8
|
+
/** Borrowed UTF-8 replacement, consumed before the next edit is requested. */
|
|
9
|
+
readonly replacement: ByteSource;
|
|
10
|
+
}
|
|
11
|
+
export interface StagedXmlMutation {
|
|
12
|
+
readonly byteLength: number;
|
|
13
|
+
bytes(): ByteSource;
|
|
14
|
+
write(sink: {
|
|
15
|
+
write(bytes: Uint8Array): Promise<void>;
|
|
16
|
+
}): Promise<void>;
|
|
17
|
+
close(): Promise<void>;
|
|
18
|
+
}
|
|
19
|
+
/** Admit source and result, then expose an owned staged mutation. The edit
|
|
20
|
+
* factory may traverse the immutable lexical view; that view expires before
|
|
21
|
+
* return. Neither a whole XML part nor the edit collection is retained in RAM. */
|
|
22
|
+
export declare function stageRetainedXmlEdits(source: ByteSource, edits: (original: RetainedXml) => AsyncIterable<RetainedXmlEdit>, settings: RetainedXmlContext): Promise<StagedXmlMutation>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type JsonSyntaxContext } from "../../json-ast/index.js";
|
|
1
2
|
import { type PdfCosRef } from "../ast.js";
|
|
2
3
|
import { PdfFileSource } from "../source.js";
|
|
3
4
|
import type { PdfRetainedDocument } from "../retained-document.js";
|
|
@@ -6,7 +7,7 @@ export interface ApplyQpdfJsonOptions {
|
|
|
6
7
|
/** The caller retains ownership of datafile handles. */
|
|
7
8
|
readonly dataFile?: (path: string) => Promise<PdfFileSource | undefined>;
|
|
8
9
|
readonly maxInputBytes?: number;
|
|
9
|
-
readonly syntaxError?: (offset: number, message: string, tokenOffset?: number) => never;
|
|
10
|
+
readonly syntaxError?: (offset: number, message: string, tokenOffset?: number, context?: JsonSyntaxContext) => never;
|
|
10
11
|
}
|
|
11
12
|
/** A mutable JSON-import document backed only by the caller filesystem. Apply
|
|
12
13
|
* updates sequentially and publish chunks only after all updates succeed.
|