@poe-platform/safe-bash 0.1.788 → 0.1.790
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/README.md +1 -1
- package/dist/image-ast/index.browser.js +147 -80
- package/dist/image-ast/index.js +147 -80
- package/dist/mp4-ast/mp4.d.ts +2 -0
- package/dist/pdf-ast/cos/parser.d.ts +1 -0
- package/dist/pdf-ast/cos/security.d.ts +2 -0
- package/dist/pdf-ast/cos/writer.d.ts +1 -0
- package/dist/pdf-ast/document.d.ts +3 -0
- package/dist/pdf-ast/edit/forms.d.ts +1 -0
- package/dist/pdf-ast/index.js +171 -82
- package/dist/safe-bash/chunks/{chunk-L5QQLNTO.js → chunk-22PI65AH.js} +2 -2
- package/dist/safe-bash/chunks/{chunk-Q3E6C3DX.js → chunk-2TAGYMPK.js} +49 -34
- package/dist/safe-bash/chunks/{chunk-Z3HX3ZBA.js → chunk-2W4HTMEK.js} +52 -48
- package/dist/safe-bash/chunks/{chunk-FFZXP6ZC.js → chunk-3M7L7XU2.js} +2 -2
- package/dist/safe-bash/chunks/{chunk-XNODZRVD.js → chunk-3QAO6UYS.js} +2 -2
- package/dist/safe-bash/chunks/{chunk-YPETOVQU.js → chunk-3VKFK3NF.js} +2 -2
- package/dist/safe-bash/chunks/chunk-5OST7NOX.js +42 -0
- package/dist/safe-bash/chunks/{chunk-KEBSX2AX.js → chunk-6HLURHVU.js} +2 -2
- package/dist/safe-bash/chunks/chunk-DYEUZE6Z.js +19 -0
- package/dist/safe-bash/chunks/{chunk-T2TGCHKE.js → chunk-FM3WBSZT.js} +2 -2
- package/dist/safe-bash/chunks/chunk-GAYRKQM6.js +22 -0
- package/dist/safe-bash/chunks/{chunk-Q45QCA4J.js → chunk-I3KSESCR.js} +0 -7
- package/dist/safe-bash/chunks/{chunk-OSKDIBQS.js → chunk-JLIMK5TD.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-2AYZCT5X.js → chunk-JQ2FAJJT.js} +27 -23
- package/dist/safe-bash/chunks/{chunk-QA3NVP43.js → chunk-JRE6Z3T7.js} +2 -2
- package/dist/safe-bash/chunks/{chunk-DC5EHLKS.js → chunk-NDIL6T7Y.js} +5 -5
- package/dist/safe-bash/chunks/{chunk-747G42FY.js → chunk-OPR4UAIT.js} +2 -2
- package/dist/safe-bash/chunks/chunk-OSMQCYSP.js +19 -0
- package/dist/safe-bash/chunks/chunk-OYB332PQ.js +17 -0
- package/dist/safe-bash/chunks/{chunk-ZMYVCRAF.js → chunk-QTIH2AFE.js} +77 -69
- package/dist/safe-bash/chunks/{chunk-PYTLIUST.js → chunk-SBESXWT2.js} +43 -44
- package/dist/safe-bash/chunks/{chunk-4FDQJUFW.js → chunk-SDEPGTOF.js} +1 -1
- package/dist/safe-bash/chunks/chunk-UZU5BIJI.js +32 -0
- package/dist/safe-bash/chunks/{chunk-BI6JV62X.js → chunk-VCCMROTL.js} +7 -10
- package/dist/safe-bash/chunks/chunk-W47GHRRF.js +13 -0
- package/dist/safe-bash/chunks/{chunk-NPMQWZUZ.js → chunk-WS7KZIUM.js} +2 -2
- package/dist/safe-bash/chunks/{chunk-3PZYHMGM.js → chunk-YYAERCWS.js} +7 -7
- package/dist/safe-bash/chunks/{chunk-5U7JECDB.js → chunk-ZPGVEUKF.js} +8 -7
- package/dist/safe-bash/chunks/{csvkit-K55OYAQC.js → csvkit-USUJG62I.js} +65 -11
- package/dist/safe-bash/chunks/{ffmpeg-BEFTQ6DZ.js → ffmpeg-KRGG5DLH.js} +21 -10
- package/dist/safe-bash/chunks/{gh-HQWOWLWE.js → gh-UCFDUZCX.js} +16 -8
- package/dist/safe-bash/chunks/{git-UFNPAOYZ.js → git-LPAF6KDG.js} +7 -9
- package/dist/safe-bash/chunks/{imagemagick-53BMHH6D.js → imagemagick-KGREKK4G.js} +38 -7
- package/dist/safe-bash/chunks/{implementation-QUTAAYMT.js → implementation-FXDRYS5A.js} +34 -8
- package/dist/safe-bash/chunks/{pdfimages-4OYI6FLG.js → pdfimages-UADCF4G4.js} +12 -8
- package/dist/safe-bash/chunks/{pdfinfo-I7U6TQPP.js → pdfinfo-O7UWPF4W.js} +38 -13
- package/dist/safe-bash/chunks/{pdftk-SUA6FMHI.js → pdftk-AERXIJTN.js} +13 -8
- package/dist/safe-bash/chunks/{pdftoppm-4C5DGEWX.js → pdftoppm-L466JQKI.js} +17 -10
- package/dist/safe-bash/chunks/{pdftotext-Y4WI225Y.js → pdftotext-SUSI4WXS.js} +19 -9
- package/dist/safe-bash/chunks/{qpdf-IORB4RV5.js → qpdf-YL24KVRH.js} +14 -8
- package/dist/safe-bash/chunks/{sips-WHAMJFEU.js → sips-QXEQZERX.js} +14 -7
- package/dist/safe-bash/chunks/{soffice-SYEK6WJS.js → soffice-TBITRML3.js} +16 -8
- package/dist/safe-bash/chunks/{wkhtmltopdf-ZIICWJLF.js → wkhtmltopdf-NJA2THRC.js} +27 -7
- package/dist/safe-bash/command-chunks/chunk-2C5BEBPY.js +1388 -0
- package/dist/safe-bash/command-chunks/{chunk-FXYWQ6S4.js → chunk-2EXV2ZLV.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-PFBJR2PY.js → chunk-2KRKKW5S.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-4DSJDVBM.js → chunk-32F3RBUW.js} +10 -749
- package/dist/safe-bash/command-chunks/{chunk-L3MLMXL4.js → chunk-3ZK5F23O.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-4QX6XCDD.js → chunk-4RNIZ3RT.js} +79 -0
- package/dist/safe-bash/command-chunks/{chunk-D7TADAYG.js → chunk-64LG3EVJ.js} +17 -0
- package/dist/safe-bash/command-chunks/{chunk-TOSM3T3A.js → chunk-6EASC5EC.js} +20 -9
- package/dist/safe-bash/command-chunks/{chunk-ZF3ZVGQC.js → chunk-7JRITHKW.js} +150 -80
- package/dist/safe-bash/command-chunks/{chunk-IJ3FXP4Q.js → chunk-A3ZX6SCY.js} +1 -1
- package/dist/safe-bash/{chunks/chunk-LD76P7AG.js → command-chunks/chunk-AKDMCNX4.js} +74 -39
- package/dist/safe-bash/command-chunks/{chunk-KSIGF4AG.js → chunk-BK4CMEE6.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-JUDOV5MJ.js → chunk-CBDVLMJB.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-XGMWWUHV.js → chunk-CZ5DAK4K.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-Z57TV6TC.js → chunk-EZ2DTOLI.js} +4 -2
- package/dist/safe-bash/command-chunks/{chunk-ADCGH6A7.js → chunk-FH3D75FC.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-WYJTWJZ5.js → chunk-G3G6W5ZE.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-3HDIDEUJ.js → chunk-GF54KE2M.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-H4LWTITX.js +169 -0
- package/dist/safe-bash/command-chunks/chunk-I2MQNBGR.js +145 -0
- package/dist/safe-bash/command-chunks/{chunk-Z7TYZG3A.js → chunk-IHHTTQX6.js} +5 -3
- package/dist/safe-bash/command-chunks/{chunk-5GRLAARV.js → chunk-IOXI5ZAJ.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-INDIFLBW.js → chunk-JTAGNROA.js} +4 -0
- package/dist/safe-bash/command-chunks/{chunk-Y5IHIAY3.js → chunk-MDPIOQUD.js} +12 -8
- package/dist/safe-bash/command-chunks/chunk-PGEYORBZ.js +25 -0
- package/dist/safe-bash/command-chunks/chunk-QI4MGIN6.js +6 -0
- package/dist/safe-bash/command-chunks/chunk-QM4UZF3C.js +753 -0
- package/dist/safe-bash/command-chunks/chunk-QTYZAWSB.js +91 -0
- package/dist/safe-bash/command-chunks/chunk-SNK7K3XW.js +90 -0
- package/dist/safe-bash/command-chunks/chunk-T5OLGM43.js +314 -0
- package/dist/safe-bash/command-chunks/chunk-TB7IFMUZ.js +802 -0
- package/dist/safe-bash/command-chunks/{chunk-YNT4ZJHW.js → chunk-TPPBPIWL.js} +3 -3
- package/dist/safe-bash/command-chunks/chunk-VMK4XVKO.js +82 -0
- package/dist/safe-bash/command-chunks/chunk-VNSJKXDU.js +130 -0
- package/dist/safe-bash/command-chunks/{chunk-2LP3VMPA.js → chunk-WFDW4XXD.js} +1 -17
- package/dist/safe-bash/command-chunks/chunk-WR37IS4O.js +318 -0
- package/dist/safe-bash/command-chunks/chunk-YFNTMH6Z.js +6 -0
- package/dist/safe-bash/commands/basic.js +148 -48
- package/dist/safe-bash/commands/bytes/compression/index.js +5 -6
- package/dist/safe-bash/commands/cmp.d.ts +2 -3
- package/dist/safe-bash/commands/cmp.js +2 -689
- package/dist/safe-bash/commands/csplit/index.browser.js +2 -2
- package/dist/safe-bash/commands/docx/index.browser.js +4 -47
- package/dist/safe-bash/commands/docx/index.d.ts +2 -24
- package/dist/safe-bash/commands/docx/index.js +2 -41
- package/dist/safe-bash/commands/docx/io.d.ts +1 -14
- package/dist/safe-bash/commands/docx/io.js +1 -15
- package/dist/safe-bash/commands/factor/index.browser.js +2 -2
- package/dist/safe-bash/commands/getopt/index.browser.js +2 -2
- package/dist/safe-bash/commands/hexdump/index.browser.js +2 -2
- package/dist/safe-bash/commands/iconv/index.browser.js +2 -2
- package/dist/safe-bash/commands/line-endings/index.browser.js +2 -2
- package/dist/safe-bash/commands/llm/command.d.ts +1 -4
- package/dist/safe-bash/commands/llm/command.js +1 -248
- package/dist/safe-bash/commands/llm/elevenlabs-stream.d.ts +1 -2
- package/dist/safe-bash/commands/llm/elevenlabs-stream.js +1 -117
- package/dist/safe-bash/commands/llm/elevenlabs.d.ts +1 -15
- package/dist/safe-bash/commands/llm/elevenlabs.js +1 -123
- package/dist/safe-bash/commands/llm/index.browser.js +20 -15
- package/dist/safe-bash/commands/llm/index.d.ts +1 -6
- package/dist/safe-bash/commands/llm/index.js +1 -4
- package/dist/safe-bash/commands/llm/mime.d.ts +1 -2
- package/dist/safe-bash/commands/llm/mime.js +1 -136
- package/dist/safe-bash/commands/llm/openai-http.d.ts +1 -8
- package/dist/safe-bash/commands/llm/openai-http.js +1 -143
- package/dist/safe-bash/commands/llm/openai-sse.d.ts +1 -3
- package/dist/safe-bash/commands/llm/openai-sse.js +1 -78
- package/dist/safe-bash/commands/llm/openai.d.ts +1 -14
- package/dist/safe-bash/commands/llm/openai.js +1 -288
- package/dist/safe-bash/commands/llm/providers/elevenlabs.d.ts +1 -1
- package/dist/safe-bash/commands/llm/providers/elevenlabs.js +1 -1
- package/dist/safe-bash/commands/llm/providers/index.browser.js +6 -6
- package/dist/safe-bash/commands/llm/providers/index.d.ts +1 -3
- package/dist/safe-bash/commands/llm/providers/index.js +1 -2
- package/dist/safe-bash/commands/llm/providers/openai.d.ts +1 -1
- package/dist/safe-bash/commands/llm/providers/openai.js +1 -1
- package/dist/safe-bash/commands/llm/providers/shared.d.ts +1 -23
- package/dist/safe-bash/commands/llm/providers/shared.js +1 -65
- package/dist/safe-bash/commands/llm/service.d.ts +1 -37
- package/dist/safe-bash/commands/llm/service.js +1 -151
- package/dist/safe-bash/commands/llm/types.d.ts +1 -52
- package/dist/safe-bash/commands/llm/types.js +1 -1
- package/dist/safe-bash/commands/mdq/index.browser.js +3 -3
- package/dist/safe-bash/commands/media/index.browser.js +1 -1
- package/dist/safe-bash/commands/network/index.browser.js +9 -9
- package/dist/safe-bash/commands/network/types.d.ts +2 -40
- package/dist/safe-bash/commands/node/index.browser.js +6 -8
- package/dist/safe-bash/commands/op/index.browser.js +3 -3
- package/dist/safe-bash/commands/op/index.js +12 -28
- package/dist/safe-bash/commands/pptx/index.d.ts +2 -28
- package/dist/safe-bash/commands/pptx/index.js +2 -152
- package/dist/safe-bash/commands/pr/index.browser.js +2 -2
- package/dist/safe-bash/commands/printf-float.d.ts +1 -0
- package/dist/safe-bash/commands/printf-float.js +48 -38
- package/dist/safe-bash/commands/printf-format.js +9 -6
- package/dist/safe-bash/commands/printf-quote.d.ts +3 -0
- package/dist/safe-bash/commands/printf-quote.js +62 -0
- package/dist/safe-bash/commands/printf-wide.d.ts +5 -0
- package/dist/safe-bash/commands/printf-wide.js +41 -0
- package/dist/safe-bash/commands/python/index.browser.js +8 -8
- package/dist/safe-bash/commands/python/worker.browser.js +2 -2
- package/dist/safe-bash/commands/truncate.d.ts +2 -3
- package/dist/safe-bash/commands/truncate.js +2 -686
- package/dist/safe-bash/commands/tsort/index.browser.js +2 -2
- package/dist/safe-bash/commands/xml/index.browser.js +2 -2
- package/dist/safe-bash/commands/yq/index.browser.js +3 -3
- package/dist/safe-bash/contracts/diagnostics.d.ts +2 -0
- package/dist/safe-bash/contracts/diagnostics.js +2 -0
- package/dist/safe-bash/contracts/runtime-control.d.ts +2 -0
- package/dist/safe-bash/contracts/runtime-control.js +2 -0
- package/dist/safe-bash/core.browser.d.ts +1 -1
- package/dist/safe-bash/core.browser.js +10645 -14065
- package/dist/safe-bash/core.d.ts +10 -1
- package/dist/safe-bash/core.js +0 -1
- package/dist/safe-bash/jobs.browser.js +5 -4
- package/dist/safe-bash/opt-in/commands/cmp/index.d.ts +6 -2
- package/dist/safe-bash/opt-in/commands/cmp/index.js +776 -79
- package/dist/safe-bash/opt-in/commands/cmp/options.d.ts +0 -12
- package/dist/safe-bash/opt-in/commands/cmp/options.js +0 -153
- package/dist/safe-bash/opt-in/commands/truncate/index.d.ts +8 -3
- package/dist/safe-bash/opt-in/commands/truncate/index.js +790 -272
- package/dist/safe-bash/opt-in/commands/truncate/sync.d.ts +1 -0
- package/dist/safe-bash/opt-in/commands/truncate/sync.js +60 -0
- package/dist/safe-bash/optional-host.browser.js +61 -80
- package/dist/safe-bash/optional-host.d.ts +3 -1
- package/dist/safe-bash/optional-host.js +3 -1
- package/dist/safe-bash/shell/runtime.js +44 -18
- package/dist/safe-bash/yq-browser/index.js +1 -1
- package/dist/safe-bash-checksum-engine/index.d.ts +1 -1
- package/dist/safe-bash-checksum-engine/index.js +14 -2
- package/dist/safe-bash-command-bzip2/index.js +2 -1
- package/dist/safe-bash-command-cmp/index.d.ts +10 -0
- package/dist/safe-bash-command-cmp/index.js +796 -0
- package/dist/safe-bash-command-cmp/options.d.ts +12 -0
- package/dist/safe-bash-command-cmp/options.js +42 -0
- package/dist/safe-bash-command-csvcut/index.js +11 -8
- package/dist/safe-bash-command-csvgrep/index.js +35 -7
- package/dist/safe-bash-command-csvkit/codecs/python.js +4 -3
- package/dist/safe-bash-command-csvkit/codecs/utf8.js +3 -2
- package/dist/safe-bash-command-csvkit/index.js +80 -324
- package/dist/safe-bash-command-csvkit/python-regex.d.ts +5 -0
- package/dist/safe-bash-command-csvkit/python-regex.js +14 -0
- package/dist/safe-bash-command-csvkit/runtime.d.ts +1 -0
- package/dist/safe-bash-command-csvkit/sync-support.js +4 -2
- package/dist/safe-bash-command-diff3/index.js +3 -0
- package/dist/safe-bash-command-docx/LICENSE +21 -0
- package/dist/safe-bash-command-docx/index.d.ts +30 -0
- package/dist/safe-bash-command-docx/index.js +67 -0
- package/dist/safe-bash-command-docx/io.d.ts +14 -0
- package/dist/safe-bash-command-docx/io.js +26 -0
- package/dist/safe-bash-command-envsubst/index.js +34 -3
- package/dist/safe-bash-command-exiftool/index.js +3 -0
- package/dist/safe-bash-command-ffmpeg/index.js +8073 -7940
- package/dist/safe-bash-command-fold/family.js +1 -1
- package/dist/safe-bash-command-fold/index.js +1 -1
- package/dist/safe-bash-command-git/git_rust.wasm +0 -0
- package/dist/safe-bash-command-git/wasm.generated.js +1 -1
- package/dist/safe-bash-command-htmlq/index.js +5 -0
- package/dist/safe-bash-command-imagemagick/index.d.ts +25 -21
- package/dist/safe-bash-command-imagemagick/index.js +671 -273
- package/dist/safe-bash-command-llm/LICENSE +21 -0
- package/dist/safe-bash-command-llm/command.d.ts +5 -0
- package/dist/safe-bash-command-llm/command.js +14 -0
- package/dist/safe-bash-command-llm/configuration.d.ts +18 -0
- package/dist/safe-bash-command-llm/elevenlabs-stream.d.ts +2 -0
- package/dist/safe-bash-command-llm/elevenlabs-stream.js +7 -0
- package/dist/safe-bash-command-llm/elevenlabs.d.ts +15 -0
- package/dist/safe-bash-command-llm/elevenlabs.js +10 -0
- package/dist/safe-bash-command-llm/index.d.ts +10 -0
- package/dist/safe-bash-command-llm/index.js +46 -0
- package/dist/safe-bash-command-llm/mime.d.ts +2 -0
- package/dist/safe-bash-command-llm/mime.js +9 -0
- package/dist/safe-bash-command-llm/model-options.d.ts +3 -0
- package/dist/safe-bash-command-llm/openai-http.d.ts +8 -0
- package/dist/safe-bash-command-llm/openai-http.js +17 -0
- package/dist/safe-bash-command-llm/openai-sse.d.ts +3 -0
- package/dist/safe-bash-command-llm/openai-sse.js +8 -0
- package/dist/safe-bash-command-llm/openai.d.ts +14 -0
- package/dist/safe-bash-command-llm/openai.js +12 -0
- package/dist/safe-bash-command-llm/providers/elevenlabs.d.ts +1 -0
- package/dist/safe-bash-command-llm/providers/elevenlabs.js +11 -0
- package/dist/safe-bash-command-llm/providers/index.d.ts +3 -0
- package/dist/safe-bash-command-llm/providers/index.js +24 -0
- package/dist/safe-bash-command-llm/providers/openai.d.ts +1 -0
- package/dist/safe-bash-command-llm/providers/openai.js +13 -0
- package/dist/safe-bash-command-llm/providers/shared.d.ts +23 -0
- package/dist/safe-bash-command-llm/providers/shared.js +13 -0
- package/dist/safe-bash-command-llm/schemas.d.ts +2 -0
- package/dist/safe-bash-command-llm/service.d.ts +42 -0
- package/dist/safe-bash-command-llm/service.js +9 -0
- package/dist/safe-bash-command-llm/templates.d.ts +27 -0
- package/dist/safe-bash-command-llm/types.d.ts +87 -0
- package/dist/safe-bash-command-llm/types.js +6 -0
- package/dist/safe-bash-command-mmdc/command.d.ts +4 -0
- package/dist/safe-bash-command-mmdc/index.d.ts +1 -1
- package/dist/safe-bash-command-mmdc/index.js +7134 -6699
- package/dist/safe-bash-command-mmdc/layout.d.ts +1 -0
- package/dist/safe-bash-command-mmdc/parser.d.ts +1 -0
- package/dist/safe-bash-command-mmdc/png.d.ts +3 -0
- package/dist/safe-bash-command-mmdc/raster.d.ts +1 -0
- package/dist/safe-bash-command-mmdc/svg.d.ts +1 -0
- package/dist/safe-bash-command-op/index.js +19 -14
- package/dist/safe-bash-command-pandoc/command.js +3 -3
- package/dist/safe-bash-command-pandoc/index.js +3 -3
- package/dist/safe-bash-command-pdfimages/index.d.ts +7 -1
- package/dist/safe-bash-command-pdfimages/index.js +210 -113
- package/dist/safe-bash-command-pdfinfo/index.d.ts +24 -20
- package/dist/safe-bash-command-pdfinfo/index.js +517 -241
- package/dist/safe-bash-command-pdftk/index.d.ts +7 -3
- package/dist/safe-bash-command-pdftk/index.js +261 -125
- package/dist/safe-bash-command-pdftoppm/index.d.ts +15 -7
- package/dist/safe-bash-command-pdftoppm/index.js +326 -189
- package/dist/safe-bash-command-pdftotext/index.d.ts +9 -5
- package/dist/safe-bash-command-pdftotext/index.js +237 -107
- package/dist/safe-bash-command-pptx/LICENSE +21 -0
- package/dist/safe-bash-command-pptx/index.d.ts +33 -0
- package/dist/safe-bash-command-pptx/index.js +168 -0
- package/dist/safe-bash-command-qpdf/index.d.ts +9 -3
- package/dist/safe-bash-command-qpdf/index.js +254 -130
- package/dist/safe-bash-command-sha512sum/index.js +12 -475
- package/dist/safe-bash-command-sips/index.d.ts +9 -5
- package/dist/safe-bash-command-sips/index.js +65 -46
- package/dist/safe-bash-command-soffice/index.d.ts +9 -3
- package/dist/safe-bash-command-soffice/index.js +66 -25
- package/dist/safe-bash-command-sqlite3/engine.d.ts +9 -0
- package/dist/safe-bash-command-sqlite3/index.d.ts +1 -0
- package/dist/safe-bash-command-sqlite3/index.js +851 -352
- package/dist/safe-bash-command-ssconvert/formats/xls.js +3 -3
- package/dist/safe-bash-command-ssconvert/index.js +147 -80
- package/dist/safe-bash-command-timeout/index.js +3 -3
- package/dist/safe-bash-command-truncate/index.d.ts +8 -3
- package/dist/safe-bash-command-truncate/index.js +790 -272
- package/dist/safe-bash-command-truncate/sync.d.ts +1 -0
- package/dist/safe-bash-command-truncate/sync.js +60 -0
- package/dist/safe-bash-command-wkhtmltopdf/index.js +239 -118
- package/dist/safe-bash-command-wkhtmltopdf/pdf-renderer.d.ts +1 -1
- package/dist/safe-bash-command-xxd/index.js +78 -20
- package/dist/safe-bash-command-xz/command.d.ts +4 -0
- package/dist/safe-bash-command-xz/index.d.ts +1 -1
- package/dist/safe-bash-command-xz/index.js +1 -1
- package/dist/safe-bash-compression-engine/bounded-codec.js +3 -3
- package/dist/safe-bash-compression-engine/codec-loader.js +2 -2
- package/dist/safe-bash-compression-engine/files.js +6 -6
- package/dist/safe-bash-compression-engine/index.js +5 -5
- package/dist/safe-bash-compression-engine/operand.js +6 -6
- package/dist/safe-bash-compression-engine/stream.js +5 -5
- package/dist/safe-bash-compression-engine/zstd-decode.js +4 -4
- package/dist/safe-bash-contracts/command.js +3 -3
- package/dist/safe-bash-contracts/default-executor.d.ts +5 -0
- package/dist/safe-bash-contracts/default-executor.js +37 -0
- package/dist/safe-bash-contracts/diagnostics.js +3 -3
- package/dist/safe-bash-contracts/escaping.js +9 -9
- package/dist/safe-bash-contracts/filesystem-descriptor.js +3 -3
- package/dist/safe-bash-contracts/filesystem-output.js +8 -8
- package/dist/safe-bash-contracts/http.d.ts +41 -0
- package/dist/safe-bash-contracts/http.js +6 -0
- package/dist/safe-bash-contracts/index.js +21 -19
- package/dist/safe-bash-contracts/io.d.ts +12 -0
- package/dist/safe-bash-contracts/io.js +4 -1
- package/dist/safe-bash-contracts/output.js +3 -2
- package/dist/safe-bash-contracts/runtime-control.js +2 -2
- package/dist/safe-bash-contracts/signals.js +1 -1
- package/dist/safe-bash-contracts/yield.d.ts +1 -0
- package/dist/safe-bash-contracts/yield.js +3 -1
- package/dist/safe-bash-csv-engine/index.d.ts +10 -1
- package/dist/safe-bash-csv-engine/index.js +78 -6
- package/dist/safe-bash-io-engine/commands/search/requirements.js +3 -3
- package/dist/safe-bash-io-engine/commands/text-programs/shared.js +3 -3
- package/dist/safe-bash-io-engine/gnu-information.d.ts +1 -1
- package/dist/safe-bash-io-engine/gnu-information.js +1 -1
- package/dist/safe-bash-io-engine/internal.d.ts +1 -1
- package/dist/safe-bash-io-engine/internal.js +2 -2
- package/dist/safe-bash-query-engine/index.js +5 -5
- package/dist/safe-bash-query-engine/interpreter.js +3 -3
- package/dist/safe-bash-query-engine/query-core.js +5 -5
- package/package.json +2 -2
- package/dist/safe-bash/chunks/chunk-2G2T5MEM.js +0 -14
- package/dist/safe-bash/chunks/chunk-FJZNUUOQ.js +0 -81
- package/dist/safe-bash/chunks/chunk-GJWUEOT6.js +0 -14
- package/dist/safe-bash/chunks/chunk-LAPF2XE6.js +0 -14
- package/dist/safe-bash/chunks/chunk-O6356Z27.js +0 -37
- package/dist/safe-bash/chunks/chunk-S2LSZFZ6.js +0 -758
- package/dist/safe-bash/chunks/chunk-T3VDYWKZ.js +0 -21
- package/dist/safe-bash/chunks/chunk-VYW4Q6KF.js +0 -12
- package/dist/safe-bash/chunks/chunk-WHURJBET.js +0 -409
- package/dist/safe-bash/opt-in/commands/cmp/compare.js +0 -95
- package/dist/safe-bash/opt-in/commands/cmp/io.js +0 -218
- package/dist/safe-bash/command-chunks/{chunk-RTOJNFFL.js → chunk-KNI4GRXF.js} +7 -7
- package/dist/safe-bash/command-chunks/{chunk-DEH3CMGL.js → chunk-QJ3ONEBI.js} +3 -3
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import {
|
|
2
|
+
init_buffer
|
|
3
|
+
} from "./chunk-HX3SHTCE.js";
|
|
4
|
+
|
|
5
|
+
// packages/safe-bash-command-llm/dist/numeric-option.js
|
|
6
|
+
init_buffer();
|
|
7
|
+
function decimalDigit(value) {
|
|
8
|
+
return value !== void 0 && value >= "0" && value <= "9";
|
|
9
|
+
}
|
|
10
|
+
function parseLlmNumericOption(input, type) {
|
|
11
|
+
if (typeof input === "number")
|
|
12
|
+
return type === "integer" && input === 0 ? 0 : input;
|
|
13
|
+
if (typeof input !== "string")
|
|
14
|
+
return void 0;
|
|
15
|
+
const text = input.trim();
|
|
16
|
+
if (!text)
|
|
17
|
+
return void 0;
|
|
18
|
+
if (type === "integer") {
|
|
19
|
+
let index2 = text[0] === "+" || text[0] === "-" ? 1 : 0;
|
|
20
|
+
let digits2 = 0;
|
|
21
|
+
while (index2 < text.length) {
|
|
22
|
+
if (decimalDigit(text[index2])) {
|
|
23
|
+
digits2++;
|
|
24
|
+
index2++;
|
|
25
|
+
} else if (text[index2] === "_" && decimalDigit(text[index2 - 1]) && decimalDigit(text[index2 + 1]))
|
|
26
|
+
index2++;
|
|
27
|
+
else
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
if (!digits2)
|
|
31
|
+
return void 0;
|
|
32
|
+
if (text[index2] === ".") {
|
|
33
|
+
const first = ++index2;
|
|
34
|
+
while (text[index2] === "0")
|
|
35
|
+
index2++;
|
|
36
|
+
if (first === index2)
|
|
37
|
+
return void 0;
|
|
38
|
+
}
|
|
39
|
+
if (index2 !== text.length)
|
|
40
|
+
return void 0;
|
|
41
|
+
const value = Number(text.replaceAll("_", ""));
|
|
42
|
+
return value === 0 ? 0 : value;
|
|
43
|
+
}
|
|
44
|
+
if (text.startsWith("_") || text.endsWith("_") || text.includes("__"))
|
|
45
|
+
return void 0;
|
|
46
|
+
const normalized = text.replaceAll("_", "");
|
|
47
|
+
let index = normalized[0] === "+" || normalized[0] === "-" ? 1 : 0;
|
|
48
|
+
const special = normalized.slice(index).toLowerCase();
|
|
49
|
+
if (special === "nan")
|
|
50
|
+
return NaN;
|
|
51
|
+
if (special === "inf" || special === "infinity")
|
|
52
|
+
return normalized[0] === "-" ? -Infinity : Infinity;
|
|
53
|
+
let digits = 0;
|
|
54
|
+
while (decimalDigit(normalized[index])) {
|
|
55
|
+
digits++;
|
|
56
|
+
index++;
|
|
57
|
+
}
|
|
58
|
+
if (normalized[index] === ".") {
|
|
59
|
+
index++;
|
|
60
|
+
while (decimalDigit(normalized[index])) {
|
|
61
|
+
digits++;
|
|
62
|
+
index++;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
if (!digits)
|
|
66
|
+
return void 0;
|
|
67
|
+
if (normalized[index] === "e" || normalized[index] === "E") {
|
|
68
|
+
index++;
|
|
69
|
+
if (normalized[index] === "+" || normalized[index] === "-")
|
|
70
|
+
index++;
|
|
71
|
+
const first = index;
|
|
72
|
+
while (decimalDigit(normalized[index]))
|
|
73
|
+
index++;
|
|
74
|
+
if (first === index)
|
|
75
|
+
return void 0;
|
|
76
|
+
}
|
|
77
|
+
return index === normalized.length ? Number(normalized) : void 0;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export {
|
|
81
|
+
parseLlmNumericOption
|
|
82
|
+
};
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import {
|
|
2
|
+
init_buffer
|
|
3
|
+
} from "./chunk-HX3SHTCE.js";
|
|
4
|
+
|
|
5
|
+
// packages/safe-bash-command-llm/dist/elevenlabs-stream.js
|
|
6
|
+
init_buffer();
|
|
7
|
+
async function abortable(operation, signal) {
|
|
8
|
+
signal.throwIfAborted();
|
|
9
|
+
let onAbort;
|
|
10
|
+
const aborted = new Promise((_resolve, reject) => {
|
|
11
|
+
onAbort = () => reject(signal.reason);
|
|
12
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
13
|
+
});
|
|
14
|
+
try {
|
|
15
|
+
return await Promise.race([Promise.resolve().then(() => {
|
|
16
|
+
signal.throwIfAborted();
|
|
17
|
+
return operation();
|
|
18
|
+
}), aborted]);
|
|
19
|
+
} finally {
|
|
20
|
+
signal.removeEventListener("abort", onAbort);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
async function* streamElevenLabs(transport, request, limit = Infinity) {
|
|
24
|
+
const { signal } = request;
|
|
25
|
+
signal.throwIfAborted();
|
|
26
|
+
let iterator;
|
|
27
|
+
let finished = false;
|
|
28
|
+
let failed = false;
|
|
29
|
+
let closed = false;
|
|
30
|
+
let size = 0;
|
|
31
|
+
const cleanups = /* @__PURE__ */ new Map();
|
|
32
|
+
const runCleanup = (entry) => {
|
|
33
|
+
return entry.pending ??= Promise.resolve().then(entry.run);
|
|
34
|
+
};
|
|
35
|
+
const register = (cleanup, receiver) => {
|
|
36
|
+
if (cleanups.has(cleanup))
|
|
37
|
+
return;
|
|
38
|
+
const entry = { run: () => cleanup.call(receiver) };
|
|
39
|
+
cleanups.set(cleanup, entry);
|
|
40
|
+
if (closed)
|
|
41
|
+
void runCleanup(entry).catch(() => {
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
const dispose = async () => {
|
|
45
|
+
closed = true;
|
|
46
|
+
let seen = 0;
|
|
47
|
+
const failures = [];
|
|
48
|
+
while (seen < cleanups.size) {
|
|
49
|
+
const entries = [...cleanups.values()].slice(seen);
|
|
50
|
+
seen = cleanups.size;
|
|
51
|
+
const results = await Promise.allSettled(entries.map(runCleanup));
|
|
52
|
+
for (const result of results)
|
|
53
|
+
if (result.status === "rejected")
|
|
54
|
+
failures.push(result.reason);
|
|
55
|
+
}
|
|
56
|
+
if (failures.length)
|
|
57
|
+
throw failures[0];
|
|
58
|
+
};
|
|
59
|
+
const close = async () => {
|
|
60
|
+
const failures = [];
|
|
61
|
+
try {
|
|
62
|
+
await dispose();
|
|
63
|
+
} catch (error) {
|
|
64
|
+
failures.push(error);
|
|
65
|
+
}
|
|
66
|
+
if (!finished && iterator?.return) {
|
|
67
|
+
const closing = Promise.resolve().then(() => iterator.return());
|
|
68
|
+
if (signal.aborted)
|
|
69
|
+
void closing.catch(() => {
|
|
70
|
+
});
|
|
71
|
+
else {
|
|
72
|
+
try {
|
|
73
|
+
await closing;
|
|
74
|
+
} catch (error) {
|
|
75
|
+
failures.push(error);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (!failed) {
|
|
80
|
+
signal.throwIfAborted();
|
|
81
|
+
if (failures.length)
|
|
82
|
+
throw failures[0];
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
const onAbort = () => {
|
|
86
|
+
void dispose().catch(() => {
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
90
|
+
try {
|
|
91
|
+
const acquired = await abortable(async () => {
|
|
92
|
+
signal.throwIfAborted();
|
|
93
|
+
const response = await transport({ ...request, registerCleanup: register });
|
|
94
|
+
register(response.dispose, response);
|
|
95
|
+
if (signal.aborted) {
|
|
96
|
+
await dispose();
|
|
97
|
+
signal.throwIfAborted();
|
|
98
|
+
}
|
|
99
|
+
return response;
|
|
100
|
+
}, signal);
|
|
101
|
+
signal.throwIfAborted();
|
|
102
|
+
if (acquired.status < 200 || acquired.status >= 300)
|
|
103
|
+
throw new Error(`ElevenLabs HTTP ${acquired.status}: ${acquired.statusText}`);
|
|
104
|
+
iterator = acquired.body[Symbol.asyncIterator]();
|
|
105
|
+
while (true) {
|
|
106
|
+
const next = await abortable(() => iterator.next(), signal);
|
|
107
|
+
signal.throwIfAborted();
|
|
108
|
+
if (next.done) {
|
|
109
|
+
finished = true;
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
if (!(next.value instanceof Uint8Array))
|
|
113
|
+
throw new TypeError("ElevenLabs audio stream must yield Uint8Array chunks");
|
|
114
|
+
size += next.value.byteLength;
|
|
115
|
+
if (size > limit)
|
|
116
|
+
throw new RangeError("Provider response byte limit exceeded");
|
|
117
|
+
yield Uint8Array.from(next.value);
|
|
118
|
+
}
|
|
119
|
+
} catch (error) {
|
|
120
|
+
failed = true;
|
|
121
|
+
throw error;
|
|
122
|
+
} finally {
|
|
123
|
+
signal.removeEventListener("abort", onAbort);
|
|
124
|
+
await close();
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export {
|
|
129
|
+
streamElevenLabs
|
|
130
|
+
};
|
|
@@ -33,26 +33,10 @@ var CsvkitCleanupError = class extends AggregateError {
|
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
-
// packages/safe-bash-command-csvkit/dist/diagnostics/exception.js
|
|
37
|
-
init_buffer();
|
|
38
|
-
var PythonException = class extends CsvkitDiagnostic {
|
|
39
|
-
exceptionClass;
|
|
40
|
-
detail;
|
|
41
|
-
traceback;
|
|
42
|
-
constructor(exceptionClass, detail, traceback) {
|
|
43
|
-
super(detail);
|
|
44
|
-
this.exceptionClass = exceptionClass;
|
|
45
|
-
this.detail = detail;
|
|
46
|
-
this.traceback = traceback;
|
|
47
|
-
this.name = exceptionClass;
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
|
|
51
36
|
export {
|
|
52
37
|
CsvkitDiagnostic,
|
|
53
38
|
CsvkitBlocked,
|
|
54
39
|
CsvkitOutputBudgetError,
|
|
55
40
|
CsvkitWorkBudgetError,
|
|
56
|
-
CsvkitCleanupError
|
|
57
|
-
PythonException
|
|
41
|
+
CsvkitCleanupError
|
|
58
42
|
};
|
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
import {
|
|
2
|
+
decimalZeroes
|
|
3
|
+
} from "./chunk-QM4UZF3C.js";
|
|
4
|
+
import {
|
|
5
|
+
CsvkitBlocked
|
|
6
|
+
} from "./chunk-WFDW4XXD.js";
|
|
7
|
+
import {
|
|
8
|
+
init_buffer
|
|
9
|
+
} from "./chunk-HX3SHTCE.js";
|
|
10
|
+
|
|
11
|
+
// packages/safe-bash-command-csvkit/dist/python-regex.js
|
|
12
|
+
init_buffer();
|
|
13
|
+
function pythonWhitespace(char) {
|
|
14
|
+
const code = char.codePointAt(0);
|
|
15
|
+
return code >= 9 && code <= 13 || code >= 28 && code <= 32 || code === 133 || code === 160 || code === 5760 || code >= 8192 && code <= 8202 || code === 8232 || code === 8233 || code === 8239 || code === 8287 || code === 12288;
|
|
16
|
+
}
|
|
17
|
+
function fixedWidth(node) {
|
|
18
|
+
if (node.kind === "char")
|
|
19
|
+
return 1;
|
|
20
|
+
if (node.kind === "anchor" || node.kind === "assertion")
|
|
21
|
+
return 0;
|
|
22
|
+
if (node.kind === "repeat") {
|
|
23
|
+
const width = fixedWidth(node.node);
|
|
24
|
+
return width === 0 ? 0 : width !== void 0 && node.min === node.max ? width * node.min : void 0;
|
|
25
|
+
}
|
|
26
|
+
const widths = node.nodes.map(fixedWidth);
|
|
27
|
+
if (widths.some((width) => width === void 0))
|
|
28
|
+
return void 0;
|
|
29
|
+
if (node.kind === "alternative")
|
|
30
|
+
return widths.every((width) => width === widths[0]) ? widths[0] : void 0;
|
|
31
|
+
return widths.reduce((sum, width) => sum + width, 0);
|
|
32
|
+
}
|
|
33
|
+
function compilePythonSearch(pattern, step, maxWork, retain) {
|
|
34
|
+
retain(64 + pattern.length * 8);
|
|
35
|
+
const chars = Array.from(pattern);
|
|
36
|
+
let index = 0;
|
|
37
|
+
let insensitive = false;
|
|
38
|
+
let dotall = false;
|
|
39
|
+
let multiline = false;
|
|
40
|
+
let ascii = false;
|
|
41
|
+
let unicode = false;
|
|
42
|
+
const unsupported = () => {
|
|
43
|
+
throw new CsvkitBlocked("Python regex syntax or diagnostic outside qualified subset");
|
|
44
|
+
};
|
|
45
|
+
while (chars[index] === "(" && chars[index + 1] === "?") {
|
|
46
|
+
let end = index + 2;
|
|
47
|
+
while (chars[end] && "aimsu".includes(chars[end])) {
|
|
48
|
+
step();
|
|
49
|
+
end++;
|
|
50
|
+
}
|
|
51
|
+
if (end > index + 2 && chars[end] === ")") {
|
|
52
|
+
const flags = chars.slice(index + 2, end);
|
|
53
|
+
insensitive ||= flags.includes("i");
|
|
54
|
+
dotall ||= flags.includes("s");
|
|
55
|
+
multiline ||= flags.includes("m");
|
|
56
|
+
ascii ||= flags.includes("a");
|
|
57
|
+
unicode ||= flags.includes("u");
|
|
58
|
+
if (ascii && unicode)
|
|
59
|
+
unsupported();
|
|
60
|
+
index = end + 1;
|
|
61
|
+
} else
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
const digit = (char) => ascii ? char >= "0" && char <= "9" : decimalZeroes.some((zero) => char.codePointAt(0) >= zero && char.codePointAt(0) < zero + 10);
|
|
65
|
+
const word = (char) => {
|
|
66
|
+
if (!ascii && char.codePointAt(0) > 127)
|
|
67
|
+
return unsupported();
|
|
68
|
+
return char === "_" || /^[a-zA-Z0-9]$/.test(char);
|
|
69
|
+
};
|
|
70
|
+
const space = (char) => ascii ? " \n\r\f\v".includes(char) : pythonWhitespace(char);
|
|
71
|
+
const literal = (value) => ({ kind: "char", test: (char) => {
|
|
72
|
+
if (insensitive && (value.codePointAt(0) > 127 || char.codePointAt(0) > 127))
|
|
73
|
+
unsupported();
|
|
74
|
+
return insensitive ? char.toLowerCase() === value.toLowerCase() : char === value;
|
|
75
|
+
} });
|
|
76
|
+
function escape(inClass = false) {
|
|
77
|
+
const value = chars[index++];
|
|
78
|
+
if (!value)
|
|
79
|
+
return unsupported();
|
|
80
|
+
if (value === "x" || value === "u" || value === "U") {
|
|
81
|
+
const length = value === "x" ? 2 : value === "u" ? 4 : 8;
|
|
82
|
+
let hex = "";
|
|
83
|
+
for (let count = 0; count < length; count++) {
|
|
84
|
+
step();
|
|
85
|
+
const digit2 = chars[index++];
|
|
86
|
+
if (!digit2 || !"0123456789abcdefABCDEF".includes(digit2))
|
|
87
|
+
return unsupported();
|
|
88
|
+
hex += digit2;
|
|
89
|
+
}
|
|
90
|
+
const code = Number.parseInt(hex, 16);
|
|
91
|
+
if (code > 1114111)
|
|
92
|
+
return unsupported();
|
|
93
|
+
return literal(String.fromCodePoint(code));
|
|
94
|
+
}
|
|
95
|
+
const predicate = { d: digit, s: space, w: word }[value.toLowerCase()];
|
|
96
|
+
if (predicate)
|
|
97
|
+
return { kind: "char", test: (char) => value === value.toLowerCase() ? predicate(char) : !predicate(char) };
|
|
98
|
+
if (!inClass && (value === "A" || value === "Z" || value === "z"))
|
|
99
|
+
return { kind: "anchor", test: (text, position) => value === "A" ? position === 0 : position === text.length };
|
|
100
|
+
if (!inClass && (value === "b" || value === "B"))
|
|
101
|
+
return { kind: "anchor", test: (text, position) => {
|
|
102
|
+
if (value === "B" && text.length === 0)
|
|
103
|
+
return true;
|
|
104
|
+
const boundary = (position > 0 && word(text[position - 1])) !== (position < text.length && word(text[position]));
|
|
105
|
+
return value === "b" ? boundary : !boundary;
|
|
106
|
+
} };
|
|
107
|
+
const control = { n: "\n", r: "\r", t: " ", f: "\f", v: "\v", a: "\x07", b: "\b" }[value];
|
|
108
|
+
if (control !== void 0)
|
|
109
|
+
return literal(control);
|
|
110
|
+
if (/^[a-zA-Z0-9]$/.test(value))
|
|
111
|
+
return unsupported();
|
|
112
|
+
return literal(value);
|
|
113
|
+
}
|
|
114
|
+
function atom() {
|
|
115
|
+
step();
|
|
116
|
+
const value = chars[index++];
|
|
117
|
+
if (!value)
|
|
118
|
+
return unsupported();
|
|
119
|
+
if (value === "\\")
|
|
120
|
+
return escape();
|
|
121
|
+
if (value === ".")
|
|
122
|
+
return { kind: "char", test: (char) => dotall || char !== "\n" };
|
|
123
|
+
if (value === "^")
|
|
124
|
+
return { kind: "anchor", test: (text, position) => position === 0 || multiline && text[position - 1] === "\n" };
|
|
125
|
+
if (value === "$")
|
|
126
|
+
return { kind: "anchor", test: (text, position) => position === text.length || text[position] === "\n" && (multiline || position === text.length - 1) };
|
|
127
|
+
if (value === "(") {
|
|
128
|
+
let assertion;
|
|
129
|
+
if (chars[index] === "?") {
|
|
130
|
+
const modifier = chars[index + 1];
|
|
131
|
+
if (modifier === ":")
|
|
132
|
+
index += 2;
|
|
133
|
+
else if (modifier === "=" || modifier === "!") {
|
|
134
|
+
assertion = { negative: modifier === "!", behind: false };
|
|
135
|
+
index += 2;
|
|
136
|
+
} else if (modifier === "<" && (chars[index + 2] === "=" || chars[index + 2] === "!")) {
|
|
137
|
+
assertion = { negative: chars[index + 2] === "!", behind: true };
|
|
138
|
+
index += 3;
|
|
139
|
+
} else
|
|
140
|
+
return unsupported();
|
|
141
|
+
}
|
|
142
|
+
const node = expression();
|
|
143
|
+
if (chars[index++] !== ")")
|
|
144
|
+
return unsupported();
|
|
145
|
+
if (assertion) {
|
|
146
|
+
const behind = assertion.behind ? fixedWidth(node) : void 0;
|
|
147
|
+
if (assertion.behind && behind === void 0)
|
|
148
|
+
return unsupported();
|
|
149
|
+
return { kind: "assertion", node, negative: assertion.negative, behind };
|
|
150
|
+
}
|
|
151
|
+
return node;
|
|
152
|
+
}
|
|
153
|
+
if (value === "[") {
|
|
154
|
+
if (chars[index] === "[")
|
|
155
|
+
return unsupported();
|
|
156
|
+
const negate = chars[index] === "^";
|
|
157
|
+
if (negate)
|
|
158
|
+
index++;
|
|
159
|
+
const tests = [];
|
|
160
|
+
while (index < chars.length && (chars[index] !== "]" || tests.length === 0)) {
|
|
161
|
+
const first = chars[index++];
|
|
162
|
+
if (first && "&|~".includes(first) && chars[index] === first)
|
|
163
|
+
return unsupported();
|
|
164
|
+
if (first === "-" && tests.length > 0 && chars[index] === "-")
|
|
165
|
+
return unsupported();
|
|
166
|
+
if (first === "\\") {
|
|
167
|
+
const escaped = escape(true);
|
|
168
|
+
if (escaped.kind !== "char")
|
|
169
|
+
return unsupported();
|
|
170
|
+
if (chars[index] === "-" && chars[index + 1] !== "]")
|
|
171
|
+
return unsupported();
|
|
172
|
+
tests.push(escaped.test);
|
|
173
|
+
} else if (chars[index] === "-" && chars[index + 1] !== "]" && chars[index + 1] !== void 0) {
|
|
174
|
+
index++;
|
|
175
|
+
const last = chars[index++];
|
|
176
|
+
if (!first || !last || last === "\\" || first.codePointAt(0) > last.codePointAt(0) || insensitive)
|
|
177
|
+
return unsupported();
|
|
178
|
+
tests.push((char) => char.codePointAt(0) >= first.codePointAt(0) && char.codePointAt(0) <= last.codePointAt(0));
|
|
179
|
+
} else {
|
|
180
|
+
const item = literal(first);
|
|
181
|
+
if (item.kind !== "char")
|
|
182
|
+
return unsupported();
|
|
183
|
+
tests.push(item.test);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
if (chars[index++] !== "]")
|
|
187
|
+
return unsupported();
|
|
188
|
+
return { kind: "char", test: (char) => tests.some((test) => test(char)) !== negate };
|
|
189
|
+
}
|
|
190
|
+
if ("*+?{} )".includes(value) && value !== " ")
|
|
191
|
+
return unsupported();
|
|
192
|
+
return literal(value);
|
|
193
|
+
}
|
|
194
|
+
function expression() {
|
|
195
|
+
const alternatives = [];
|
|
196
|
+
do {
|
|
197
|
+
const nodes = [];
|
|
198
|
+
while (index < chars.length && chars[index] !== "|" && chars[index] !== ")") {
|
|
199
|
+
let node = atom();
|
|
200
|
+
const quantifier = chars[index];
|
|
201
|
+
if (quantifier && "*+?{".includes(quantifier)) {
|
|
202
|
+
if (node.kind === "anchor")
|
|
203
|
+
return unsupported();
|
|
204
|
+
index++;
|
|
205
|
+
let min = quantifier === "+" ? 1 : 0;
|
|
206
|
+
let max = quantifier === "?" ? 1 : Infinity;
|
|
207
|
+
if (quantifier === "{") {
|
|
208
|
+
let digits = "";
|
|
209
|
+
while (chars[index] && "0123456789".includes(chars[index])) {
|
|
210
|
+
step();
|
|
211
|
+
digits += chars[index++];
|
|
212
|
+
}
|
|
213
|
+
if (!digits && chars[index] !== ",")
|
|
214
|
+
return unsupported();
|
|
215
|
+
min = digits ? Number(digits) : 0;
|
|
216
|
+
max = min;
|
|
217
|
+
if (chars[index] === ",") {
|
|
218
|
+
index++;
|
|
219
|
+
digits = "";
|
|
220
|
+
while (chars[index] && "0123456789".includes(chars[index])) {
|
|
221
|
+
step();
|
|
222
|
+
digits += chars[index++];
|
|
223
|
+
}
|
|
224
|
+
max = digits ? Number(digits) : Infinity;
|
|
225
|
+
}
|
|
226
|
+
if (chars[index++] !== "}" || min > max || !Number.isSafeInteger(min) || min >= 4294967295 || max !== Infinity && (!Number.isSafeInteger(max) || max >= 4294967295))
|
|
227
|
+
return unsupported();
|
|
228
|
+
}
|
|
229
|
+
node = { kind: "repeat", node, min, max };
|
|
230
|
+
if (chars[index] === "?")
|
|
231
|
+
index++;
|
|
232
|
+
if (chars[index] === "+")
|
|
233
|
+
return unsupported();
|
|
234
|
+
}
|
|
235
|
+
nodes.push(node);
|
|
236
|
+
}
|
|
237
|
+
alternatives.push({ kind: "sequence", nodes });
|
|
238
|
+
if (chars[index] !== "|")
|
|
239
|
+
break;
|
|
240
|
+
index++;
|
|
241
|
+
} while (index <= chars.length);
|
|
242
|
+
return { kind: "alternative", nodes: alternatives };
|
|
243
|
+
}
|
|
244
|
+
const root = expression();
|
|
245
|
+
if (index !== chars.length)
|
|
246
|
+
unsupported();
|
|
247
|
+
let work = 0;
|
|
248
|
+
const tick = () => {
|
|
249
|
+
step();
|
|
250
|
+
if (++work > maxWork)
|
|
251
|
+
throw new CsvkitBlocked("Python regex work budget exceeded");
|
|
252
|
+
};
|
|
253
|
+
function* evaluate(node, text, position) {
|
|
254
|
+
tick();
|
|
255
|
+
if (node.kind === "char") {
|
|
256
|
+
if (position < text.length && node.test(text[position]))
|
|
257
|
+
yield position + 1;
|
|
258
|
+
} else if (node.kind === "anchor") {
|
|
259
|
+
if (node.test(text, position))
|
|
260
|
+
yield position;
|
|
261
|
+
} else if (node.kind === "assertion") {
|
|
262
|
+
const start = node.behind === void 0 ? position : position - node.behind;
|
|
263
|
+
let matched = false;
|
|
264
|
+
if (start >= 0)
|
|
265
|
+
for (const end of evaluate(node.node, text, start)) {
|
|
266
|
+
if (node.behind === void 0 || end === position) {
|
|
267
|
+
matched = true;
|
|
268
|
+
break;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
if (matched !== node.negative)
|
|
272
|
+
yield position;
|
|
273
|
+
} else if (node.kind === "alternative") {
|
|
274
|
+
for (const child of node.nodes)
|
|
275
|
+
yield* evaluate(child, text, position);
|
|
276
|
+
} else if (node.kind === "sequence") {
|
|
277
|
+
const nodes = node.nodes;
|
|
278
|
+
function* sequence(index2, offset) {
|
|
279
|
+
tick();
|
|
280
|
+
if (index2 === nodes.length)
|
|
281
|
+
yield offset;
|
|
282
|
+
else
|
|
283
|
+
for (const next of evaluate(nodes[index2], text, offset))
|
|
284
|
+
yield* sequence(index2 + 1, next);
|
|
285
|
+
}
|
|
286
|
+
yield* sequence(0, position);
|
|
287
|
+
} else {
|
|
288
|
+
let positions = /* @__PURE__ */ new Set([position]);
|
|
289
|
+
for (let count = 0; count <= node.max && positions.size; count++) {
|
|
290
|
+
tick();
|
|
291
|
+
if (count >= node.min)
|
|
292
|
+
yield* positions;
|
|
293
|
+
const next = /* @__PURE__ */ new Set();
|
|
294
|
+
for (const offset of positions)
|
|
295
|
+
for (const end of evaluate(node.node, text, offset)) {
|
|
296
|
+
if (end !== offset || count < node.min)
|
|
297
|
+
next.add(end);
|
|
298
|
+
}
|
|
299
|
+
positions = next;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
return (text) => {
|
|
304
|
+
retain(64 + text.length * 8);
|
|
305
|
+
const input = Array.from(text);
|
|
306
|
+
for (let start = 0; start <= input.length; start++)
|
|
307
|
+
for (const ignored of evaluate(root, input, start)) {
|
|
308
|
+
void ignored;
|
|
309
|
+
return true;
|
|
310
|
+
}
|
|
311
|
+
return false;
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
export {
|
|
316
|
+
pythonWhitespace,
|
|
317
|
+
compilePythonSearch
|
|
318
|
+
};
|