@inkeep/open-knowledge 0.11.0-beta.5 → 0.11.0-beta.6
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/alias-JE7RI5QX-oTDRHt3W.mjs +1 -0
- package/dist/assets/skills/discovery/SKILL.md +1 -1
- package/dist/assets/skills/project/SKILL.md +1 -1
- package/dist/awk2-POPGKRAI-BZ_7e8H1.mjs +1 -0
- package/dist/base64-4YMZCVJ5-BhIrz6He.mjs +1 -0
- package/dist/basename-AA2KJYZQ-C5R0pcfV.mjs +1 -0
- package/dist/bash-IJWYRKFO-DywpGlyx.mjs +1 -0
- package/dist/{build-Dt6UA4sF.mjs → build-CJEQ0nGy.mjs} +1 -1
- package/dist/build-CZpdADQB.mjs +1 -0
- package/dist/cat-RDUMLXKC-BNwer8pK.mjs +1 -0
- package/dist/chmod-SYMGL4JA-BN-B1xmG.mjs +1 -0
- package/dist/{chunk-24IMIIXA-B6yIPkk2.mjs → chunk-24IMIIXA-C-Zyd2K_.mjs} +2 -2
- package/dist/{chunk-3THT3N7L-DztAF386.mjs → chunk-3THT3N7L-Ce6LrnIA.mjs} +1 -1
- package/dist/{chunk-44UOCSGV-CaFxJDHm.mjs → chunk-44UOCSGV-uErOrz7G.mjs} +1 -1
- package/dist/{chunk-5QMZ5MUS-CAp625aG.mjs → chunk-5QMZ5MUS-BfIuRNkK.mjs} +2 -2
- package/dist/{chunk-62RKD26F-CBIDfuTL.mjs → chunk-62RKD26F-CvuML91F.mjs} +2 -2
- package/dist/{chunk-A4JSPFCI-v5lUtffG.mjs → chunk-A4JSPFCI-k-tJSZgB.mjs} +2 -2
- package/dist/{chunk-A5O5YHGN-DvJz5Cpw.mjs → chunk-A5O5YHGN-C6ngIqYR.mjs} +2 -2
- package/dist/{chunk-BBXLRYSX-DHx5dxhT.mjs → chunk-BBXLRYSX-Oks1GMhO.mjs} +2 -2
- package/dist/{chunk-BRGMQKJV-CD9YvPOS.mjs → chunk-BRGMQKJV-CHO764qS.mjs} +2 -2
- package/dist/{chunk-CR5AFCPT-BWXo8X-o.mjs → chunk-CR5AFCPT-CH8ZGz3B.mjs} +2 -2
- package/dist/{chunk-CWQS3NFK-Co4ALolT.mjs → chunk-CWQS3NFK-BP3kiNgH.mjs} +1 -1
- package/dist/{chunk-D6CWQ5DW-Cik2LGX1.mjs → chunk-D6CWQ5DW-BgQGt8eQ.mjs} +2 -2
- package/dist/{chunk-DXB73IDG-DIKSLkPq.mjs → chunk-DXB73IDG-C2RuFAAY.mjs} +1 -1
- package/dist/{chunk-F55TLFGB-oTuag-aK.mjs → chunk-F55TLFGB-Bkfd8ak_.mjs} +2 -2
- package/dist/{chunk-FEIOJCZD-C25Und0M.mjs → chunk-FEIOJCZD-DmvuPNqm.mjs} +2 -2
- package/dist/{chunk-GFQRA5P5-DnjwTqP3.mjs → chunk-GFQRA5P5-ePq2jelx.mjs} +1 -1
- package/dist/{chunk-GOV5EKKI-i-yw_7Ty.mjs → chunk-GOV5EKKI-CyL1eJ32.mjs} +2 -2
- package/dist/{chunk-HWBSOZZR-Bw5kf-cE.mjs → chunk-HWBSOZZR-BeVrNfQw.mjs} +2 -2
- package/dist/{chunk-I57KEIP3-DwNGEmJW.mjs → chunk-I57KEIP3-5RFY25TO.mjs} +2 -2
- package/dist/{chunk-IPJHKYVM-C3IodQq7.mjs → chunk-IPJHKYVM-D6H6ZTtk.mjs} +1 -1
- package/dist/{chunk-J642UCRS-DuJ82Ao2.mjs → chunk-J642UCRS-D87gHOLP.mjs} +2 -2
- package/dist/{chunk-LPQPILI2-CfDX1Tyv.mjs → chunk-LPQPILI2-DyyhWSR7.mjs} +2 -2
- package/dist/{chunk-MDDMCKUK-BrBgeH_z.mjs → chunk-MDDMCKUK-poQ25EjI.mjs} +2 -2
- package/dist/{chunk-MIZPJHVH-D3ET6RI_.mjs → chunk-MIZPJHVH-BdoPqh_Y.mjs} +2 -2
- package/dist/{chunk-MLXIYONF-dOe6Iqcc.mjs → chunk-MLXIYONF-DwewZM3r.mjs} +2 -2
- package/dist/{chunk-NAERJDUW-CYdostkt.mjs → chunk-NAERJDUW-BFcmkHme.mjs} +2 -2
- package/dist/{chunk-NUYSJFDK-CU1FKadr.mjs → chunk-NUYSJFDK-DAvAseHr.mjs} +2 -2
- package/dist/{chunk-NYQYO467-DUxnOnNG.mjs → chunk-NYQYO467-_2947cgi.mjs} +2 -2
- package/dist/{chunk-OARHFVLG-CpUL83N9.mjs → chunk-OARHFVLG-vxL5zuWx.mjs} +2 -2
- package/dist/{chunk-OCLXQMOG-LAs82g00.mjs → chunk-OCLXQMOG-C7k2qEN6.mjs} +2 -2
- package/dist/{chunk-OCS6LSEM-y5pQiBQp.mjs → chunk-OCS6LSEM-Lh1p0H-V.mjs} +2 -2
- package/dist/{chunk-OJDRYQWQ-ikvLWpfV.mjs → chunk-OJDRYQWQ-DWhg7YHU.mjs} +1 -1
- package/dist/{chunk-OL3S66CO-DjFShiWt.mjs → chunk-OL3S66CO-B3hSNlNP.mjs} +2 -2
- package/dist/{chunk-PBXLG62G-CU755yEQ.mjs → chunk-PBXLG62G-MmAqjdXR.mjs} +2 -2
- package/dist/{chunk-R6VWJ2ZL-FwG_Za20.mjs → chunk-R6VWJ2ZL-D1Ufj9fh.mjs} +1 -1
- package/dist/{chunk-SYMJJMQ4-tl6Dz6VW.mjs → chunk-SYMJJMQ4-DLPoQaug.mjs} +2 -2
- package/dist/{chunk-T56QNPHK-Dzjonwlk.mjs → chunk-T56QNPHK-TppyesRp.mjs} +2 -2
- package/dist/{chunk-TLSUDHID-DYvzalvd.mjs → chunk-TLSUDHID-BeulIM_X.mjs} +2 -2
- package/dist/{chunk-TOMNU26N-DYqwg_75.mjs → chunk-TOMNU26N-DfLjxpHW.mjs} +2 -2
- package/dist/{chunk-UNYNJIFU-B6KF1Gqq.mjs → chunk-UNYNJIFU--HT-3lrq.mjs} +3 -3
- package/dist/{chunk-VLGZJRPG-ChVasMna.mjs → chunk-VLGZJRPG-DbWYxLfI.mjs} +2 -2
- package/dist/{chunk-XHM67O4N-53eJIPK0.mjs → chunk-XHM67O4N-BWGDFyz_.mjs} +1 -1
- package/dist/{chunk-XORM457F-BlSrSdGX.mjs → chunk-XORM457F-D-QrjagQ.mjs} +2 -2
- package/dist/{chunk-YCFVLTST-uJkMN44i.mjs → chunk-YCFVLTST-CFJxSbsH.mjs} +2 -2
- package/dist/{chunk-YFG2CMIF-DYVCRkoM.mjs → chunk-YFG2CMIF-DkT4NiqV.mjs} +2 -2
- package/dist/{chunk-YNYSPYQ5-DesxOVHh.mjs → chunk-YNYSPYQ5-iQGTFdx0.mjs} +1 -1
- package/dist/{chunk-YS3AZT3J-DqU1hDNV.mjs → chunk-YS3AZT3J-w6Dw8reo.mjs} +2 -2
- package/dist/{chunk-YTNYSM6T-ChSQxUVG.mjs → chunk-YTNYSM6T-Cz_dxkBy.mjs} +2 -2
- package/dist/{chunk-Z6LRHWXI-CEAGkbzj.mjs → chunk-Z6LRHWXI-BcgkPhhu.mjs} +2 -2
- package/dist/clear-5CZ5X4YR-B6kVcfOw.mjs +1 -0
- package/dist/cli.mjs +50 -50
- package/dist/column-WLPMMSTS-CEev_e2R.mjs +1 -0
- package/dist/comm-5SLSESQG-BXsiD7To.mjs +1 -0
- package/dist/constants-DSCKzAUk.mjs +2 -0
- package/dist/cp-XOYR4ABJ-Dy5aHk72.mjs +1 -0
- package/dist/{curl-47BFPSFW-CseKVLFy.mjs → curl-47BFPSFW-CdMFK7aW.mjs} +2 -2
- package/dist/cut-OPC3VAGB-GohHdbJ4.mjs +1 -0
- package/dist/date-DD7FVA2V-RM_vdvCh.mjs +1 -0
- package/dist/diff-HJF2MPDN-Ci7M3Pfx.mjs +1 -0
- package/dist/dirname-LEMTZZFS-C6aDcxLl.mjs +1 -0
- package/dist/dist-CHRfgQ3D.mjs +1 -0
- package/dist/{dist-CbmDydNM.mjs → dist-DFDll_q5.mjs} +14 -14
- package/dist/{dist-bundle-BK4P1EQn.mjs → dist-bundle-B3l-HkEL.mjs} +1 -1
- package/dist/dist-bundle-XlngXUNr.mjs +1 -0
- package/dist/du-WO2ENHXQ-Da1HuQkH.mjs +1 -0
- package/dist/echo-O45JWWI2-Cr9jHdYm.mjs +1 -0
- package/dist/env-5EPCWSXR-6RSqo9Bn.mjs +1 -0
- package/dist/{esm-s2X3YAg-.mjs → esm-k1YlZnpm.mjs} +1 -1
- package/dist/expand-DTNXU4LQ-D4dbwBrD.mjs +1 -0
- package/dist/expansion-ENLSRCXJ-Bv6RV19y.mjs +1 -0
- package/dist/expr-5T3UU5KE-D7ekHiOy.mjs +1 -0
- package/dist/file-ZIGAJ4YS-DzKHvjCj.mjs +1 -0
- package/dist/find-TPUOAIUQ-DuBwOGWI.mjs +1 -0
- package/dist/{flag-coverage-QT4N2Z44-C7XMLkDY.mjs → flag-coverage-QT4N2Z44-C38ybzz7.mjs} +2 -2
- package/dist/fold-LDSORVYE-BQyKAmCr.mjs +1 -0
- package/dist/{getMachineId-bsd-BCJXEJCn.mjs → getMachineId-bsd-CzP05Ffc.mjs} +2 -2
- package/dist/{getMachineId-bsd-GIcY1fmf.mjs → getMachineId-bsd-D0erQsHH.mjs} +2 -2
- package/dist/{getMachineId-bsd-D7C80Q-x.mjs → getMachineId-bsd-Dp2q7huT.mjs} +2 -2
- package/dist/{getMachineId-darwin-C9wsuHP1.mjs → getMachineId-darwin-C4PiguA-.mjs} +2 -2
- package/dist/{getMachineId-darwin-D9y6ky_l.mjs → getMachineId-darwin-COcA_c6l.mjs} +2 -2
- package/dist/{getMachineId-darwin-DG876t7S.mjs → getMachineId-darwin-CywdnyvB.mjs} +2 -2
- package/dist/{getMachineId-linux-Bt9mk0EE.mjs → getMachineId-linux-BRPjBsHg.mjs} +2 -2
- package/dist/{getMachineId-linux-D9atImpV.mjs → getMachineId-linux-CQZJR55S.mjs} +2 -2
- package/dist/{getMachineId-linux-BJESQahL.mjs → getMachineId-linux-DcN5tfI_.mjs} +2 -2
- package/dist/{getMachineId-unsupported-Dabs3aBp.mjs → getMachineId-unsupported-BokXsjFr.mjs} +2 -2
- package/dist/{getMachineId-unsupported-cApRznzG.mjs → getMachineId-unsupported-DZAxq-oW.mjs} +2 -2
- package/dist/{getMachineId-unsupported-DAbsbHrs.mjs → getMachineId-unsupported-GPbM_evk.mjs} +2 -2
- package/dist/{getMachineId-win-CU_iAQo9.mjs → getMachineId-win-B20yaCSB.mjs} +2 -2
- package/dist/{getMachineId-win-CH98qgwX.mjs → getMachineId-win-BXWDfxLS.mjs} +2 -2
- package/dist/{getMachineId-win-1MPHaim9.mjs → getMachineId-win-BfSvDvM7.mjs} +2 -2
- package/dist/gh-detect-C3kYac-p.mjs +3 -0
- package/dist/{git-handle-BSAUg1L_-Bn2h-fYS.mjs → git-handle-BSAUg1L_-B0dX3OSo.mjs} +1 -1
- package/dist/git-handle-CvT4CaVU-BqccGnFS.mjs +1 -0
- package/dist/grep-3AIAIJVR-DhLMPK9o.mjs +1 -0
- package/dist/gzip-AQXSGOVS-kzAFjO_Y.mjs +1 -0
- package/dist/head-HT2B6D2J-BR-dv_ar.mjs +1 -0
- package/dist/help-VVWX7SA5-jdvqGfQj.mjs +1 -0
- package/dist/history-J4QRNGRO-jb5B-tWQ.mjs +1 -0
- package/dist/hostname-BK6HG2DE-CVVAGatl.mjs +1 -0
- package/dist/html-to-markdown-TFCECAGV-B5yiu2Qr.mjs +1 -0
- package/dist/index.d.mts +12 -1
- package/dist/index.mjs +1 -1
- package/dist/{init-D0cXXivP.mjs → init-DOOSSLEH.mjs} +15 -15
- package/dist/init-s_zGdaxm.mjs +1 -0
- package/dist/join-GG2LDHE5-BLgXAHZ_.mjs +1 -0
- package/dist/jq-ODXZBPLY-JpgGenzN.mjs +1 -0
- package/dist/{js-exec-M6UR76J5-Cw-W_H_2.mjs → js-exec-M6UR76J5-Bo7dCQVP.mjs} +3 -3
- package/dist/{libesm-B_qVEpZ1.mjs → libesm-BXjuRhd9.mjs} +1 -1
- package/dist/ln-4TRFBYAT-C7xn5Rqr.mjs +1 -0
- package/dist/{loader-QFLkrOUB.mjs → loader-BrdaUVEQ.mjs} +3 -3
- package/dist/loader-DePwbagD.mjs +1 -0
- package/dist/ls-KSXFZCWH-BFVVAoBi.mjs +1 -0
- package/dist/md5sum-INMIK4DX-0GZIz1Ci.mjs +1 -0
- package/dist/mkdir-TDEMSB6C-DTyG__G-.mjs +1 -0
- package/dist/mv-Z6MORUFL-CmjBk72Q.mjs +1 -0
- package/dist/nl-U5YJDM32-5XaxKjVN.mjs +1 -0
- package/dist/od-VJEF2UR5-BYZOEzSd.mjs +1 -0
- package/dist/paste-7N6AFSDS-BnDgUhuq.mjs +1 -0
- package/dist/{preview-DgJXMZgy.mjs → preview-BHPfi0n1.mjs} +2 -2
- package/dist/preview-CQODygq-.mjs +1 -0
- package/dist/printf-CX64KX2P-0abCeF-D.mjs +1 -0
- package/dist/public/assets/{ActivityModeContent-ByjXLC2W.js → ActivityModeContent-A9JVnd1C.js} +1 -1
- package/dist/public/assets/{DocumentContext-DM8PfsNb.js → DocumentContext-CmBtR_Ex.js} +1 -1
- package/dist/public/assets/{GraphPanel-B97meAaK.js → GraphPanel-BvMeDFSM.js} +1 -1
- package/dist/public/assets/{SettingsDialogBody-BEa48NUG.js → SettingsDialogBody-Dhgc3_Ok.js} +1 -1
- package/dist/public/assets/{SourceEditor-DCkCl0to.js → SourceEditor-D0EQlBRn.js} +1 -1
- package/dist/public/assets/{config-validation-events-zxf_ql-m.js → config-validation-events-BnNnGv50.js} +1 -1
- package/dist/public/assets/{index-XWxDScvv.js → index-BXJoxA8K.js} +4 -4
- package/dist/public/assets/{keyboard-shortcuts-D8RsVvzM.js → keyboard-shortcuts-DGQUJa57.js} +1 -1
- package/dist/public/assets/{prop-types-CQKX85Fk.js → prop-types-z8aPJgr3.js} +1 -1
- package/dist/public/assets/{target-navigation-intent-DvFpqmds.js → target-navigation-intent-BAXnlSRH.js} +1 -1
- package/dist/public/assets/{typing-burst-detector-B8tciOfx.js → typing-burst-detector-DihrFfB5.js} +1 -1
- package/dist/public/index.html +7 -7
- package/dist/pwd-D4OZ7N27-AYS4A9o1.mjs +1 -0
- package/dist/{python3-AUFTPCU6-C02r6EXI.mjs → python3-AUFTPCU6-1PPUn2I7.mjs} +2 -2
- package/dist/readlink-MI4GCHJF-BvzND_DT.mjs +1 -0
- package/dist/{repair-launch-json-BoInpebU.mjs → repair-launch-json-C6PTJ9xk.mjs} +2 -2
- package/dist/{repair-mcp-configs-BJy6sdlf.mjs → repair-mcp-configs-1DLQ_aI_.mjs} +2 -2
- package/dist/{repair-skills-Bqzm-T9Y.mjs → repair-skills-CjT8z59t.mjs} +2 -2
- package/dist/repair-skills-DIfWiu1E.mjs +1 -0
- package/dist/rev-XOSYPP45-Bqdhxuez.mjs +1 -0
- package/dist/rg-FOQSCCX3-CrVzsut-.mjs +1 -0
- package/dist/rm-RTZG23RL-DVQCHLUL.mjs +1 -0
- package/dist/rmdir-XTQXT7RK-DrUUkxCF.mjs +1 -0
- package/dist/sed-VFTTATXJ-QHemmbCP.mjs +1 -0
- package/dist/seq-RN5ZUASB-BBSGpJq5.mjs +1 -0
- package/dist/{server-lock-BpjJj3OD-D5TE1u4a.mjs → server-lock-BpjJj3OD-vTp6kF0e.mjs} +3 -3
- package/dist/server-lock-CyhBidkz-C2yQNfyA.mjs +1 -0
- package/dist/sha1sum-VJPNLNU6-D6-7B21n.mjs +1 -0
- package/dist/sha256sum-PI32XWXY-BYVtIJOS.mjs +1 -0
- package/dist/sleep-VZFPZFWA-C-x_VGtG.mjs +1 -0
- package/dist/sort-DCNRDA7U-BTlvuG7X.mjs +1 -0
- package/dist/split-SITCSYCZ-BmGbaiMe.mjs +1 -0
- package/dist/sqlite3-56UMWEY3-Cjvsy5Oo.mjs +1 -0
- package/dist/{src-DTjUWcCr.mjs → src-DPAvJMN5.mjs} +3 -3
- package/dist/{start-D1IFzbQO.mjs → start-CQvloGGb.mjs} +2 -2
- package/dist/start-DMPvMQIA.mjs +1 -0
- package/dist/stat-BT5A227F-BjNsVAze.mjs +1 -0
- package/dist/strings-7PLOGTPD-B6_kjNM-.mjs +1 -0
- package/dist/tac-SJGXQ4T2-BEQ9sZmi.mjs +1 -0
- package/dist/tail-S5ULNTJU-DSe2aEO8.mjs +1 -0
- package/dist/tar-ANUBEFJY-HbwMpE1g.mjs +1 -0
- package/dist/tee-O7VXZDCO-BD6QXg_b.mjs +1 -0
- package/dist/time-DEUO3QV2-CRnH51wk.mjs +1 -0
- package/dist/timeout-VRKMCG72-D_oS0IDg.mjs +1 -0
- package/dist/touch-DX2IJOQ4-4yR1M9Nd.mjs +1 -0
- package/dist/tr-2HXZRDSW-Ca-NmLk7.mjs +1 -0
- package/dist/tree-LYXBS7DC-CR3kfmh6.mjs +1 -0
- package/dist/true-WHJNXCHG-x85l8vsW.mjs +1 -0
- package/dist/unexpand-RGTMIGZM-D-1EwjbB.mjs +1 -0
- package/dist/uniq-SUNANL47-DtBj3lmA.mjs +1 -0
- package/dist/wc-TQB3VNOX-Qw6WjSl1.mjs +1 -0
- package/dist/which-XZHEH76L-B-Xo178d.mjs +1 -0
- package/dist/whoami-DGKU3D2X-_Mgzu6ty.mjs +1 -0
- package/dist/{write-project-skill-DWag0kbx.mjs → write-project-skill-B4WKDHbQ.mjs} +2 -2
- package/dist/xan-BXDXYEIB-qijhj_cA.mjs +1 -0
- package/dist/xan-view-ECQUO7AJ-BfZejrY6.mjs +1 -0
- package/dist/xargs-I6EZUCYF-aS184J1w.mjs +1 -0
- package/dist/{yazl-DjRp4wSy.mjs → yazl-CB0sfSbo.mjs} +1 -1
- package/dist/yazl-Dqnhfxk7.mjs +1 -0
- package/dist/yq-MJMAR36V-Cgql6fKu.mjs +1 -0
- package/package.json +1 -1
- package/dist/alias-JE7RI5QX-DvXqsNuT.mjs +0 -1
- package/dist/awk2-POPGKRAI-DjdS5H9u.mjs +0 -1
- package/dist/base64-4YMZCVJ5-KM4zCU91.mjs +0 -1
- package/dist/basename-AA2KJYZQ-623KrTZh.mjs +0 -1
- package/dist/bash-IJWYRKFO-Czh-Vt61.mjs +0 -1
- package/dist/build-CcnIXJkq.mjs +0 -1
- package/dist/cat-RDUMLXKC-BcPFfXNy.mjs +0 -1
- package/dist/chmod-SYMGL4JA-DNQ-_FB-.mjs +0 -1
- package/dist/clear-5CZ5X4YR-DQDNPZFX.mjs +0 -1
- package/dist/column-WLPMMSTS-D7ZdQMYX.mjs +0 -1
- package/dist/comm-5SLSESQG-D314YMTX.mjs +0 -1
- package/dist/constants-J1DSCdR7.mjs +0 -2
- package/dist/cp-XOYR4ABJ-BoeqT96E.mjs +0 -1
- package/dist/cut-OPC3VAGB-BduNLBmG.mjs +0 -1
- package/dist/date-DD7FVA2V-CXtS-UgC.mjs +0 -1
- package/dist/diff-HJF2MPDN-BIBcfzYf.mjs +0 -1
- package/dist/dirname-LEMTZZFS-y-nYlas9.mjs +0 -1
- package/dist/dist-Cw31ASa3.mjs +0 -1
- package/dist/dist-bundle-CjV1Pdeo.mjs +0 -1
- package/dist/du-WO2ENHXQ-DxBFDhE9.mjs +0 -1
- package/dist/echo-O45JWWI2-D2qFOnG-.mjs +0 -1
- package/dist/env-5EPCWSXR-3enSMuUq.mjs +0 -1
- package/dist/expand-DTNXU4LQ-ByrWF7LC.mjs +0 -1
- package/dist/expansion-ENLSRCXJ-ZEK-CtLJ.mjs +0 -1
- package/dist/expr-5T3UU5KE-DslbMHGH.mjs +0 -1
- package/dist/file-ZIGAJ4YS-5ydJB32I.mjs +0 -1
- package/dist/find-TPUOAIUQ-B-6hQsZ1.mjs +0 -1
- package/dist/fold-LDSORVYE-BcrX-J9k.mjs +0 -1
- package/dist/gh-detect-Bmi9QX5t.mjs +0 -3
- package/dist/git-handle-CvT4CaVU-HAzuhDq0.mjs +0 -1
- package/dist/grep-3AIAIJVR-Gk5ggptS.mjs +0 -1
- package/dist/gzip-AQXSGOVS-DVhom50G.mjs +0 -1
- package/dist/head-HT2B6D2J-ahSJqSiq.mjs +0 -1
- package/dist/help-VVWX7SA5-DWuklTmV.mjs +0 -1
- package/dist/history-J4QRNGRO-DF-FzAzf.mjs +0 -1
- package/dist/hostname-BK6HG2DE-BduSSI6z.mjs +0 -1
- package/dist/html-to-markdown-TFCECAGV-Dyh1D0fg.mjs +0 -1
- package/dist/init-Dow55f75.mjs +0 -1
- package/dist/join-GG2LDHE5-DbbozPoG.mjs +0 -1
- package/dist/jq-ODXZBPLY-DDNFO29H.mjs +0 -1
- package/dist/ln-4TRFBYAT-D-c9GUlv.mjs +0 -1
- package/dist/loader-WnB8Qg4I.mjs +0 -1
- package/dist/ls-KSXFZCWH-Cpvwn_RB.mjs +0 -1
- package/dist/md5sum-INMIK4DX-ysJE_fRH.mjs +0 -1
- package/dist/mkdir-TDEMSB6C-Doj-uc1V.mjs +0 -1
- package/dist/mv-Z6MORUFL-CB3JJwR7.mjs +0 -1
- package/dist/nl-U5YJDM32-DNpHPr0D.mjs +0 -1
- package/dist/od-VJEF2UR5-CU4HUmLC.mjs +0 -1
- package/dist/paste-7N6AFSDS-CRLhW5JD.mjs +0 -1
- package/dist/preview-CYzly0cW.mjs +0 -1
- package/dist/printf-CX64KX2P-BRDA91sv.mjs +0 -1
- package/dist/pwd-D4OZ7N27-DOBMwDAQ.mjs +0 -1
- package/dist/readlink-MI4GCHJF-C7jxdmka.mjs +0 -1
- package/dist/repair-skills-DK8PFAiz.mjs +0 -1
- package/dist/rev-XOSYPP45-BrzxRIO9.mjs +0 -1
- package/dist/rg-FOQSCCX3-D0ctWk6O.mjs +0 -1
- package/dist/rm-RTZG23RL-DZt78fCD.mjs +0 -1
- package/dist/rmdir-XTQXT7RK-CJJKrOdm.mjs +0 -1
- package/dist/sed-VFTTATXJ-Cv8KiT35.mjs +0 -1
- package/dist/seq-RN5ZUASB-BD6p5vId.mjs +0 -1
- package/dist/server-lock-CyhBidkz-DkPM4zjN.mjs +0 -1
- package/dist/sha1sum-VJPNLNU6-DukJfnER.mjs +0 -1
- package/dist/sha256sum-PI32XWXY-QlLE_NGo.mjs +0 -1
- package/dist/sleep-VZFPZFWA-gwZmptDS.mjs +0 -1
- package/dist/sort-DCNRDA7U-Bnmzizlk.mjs +0 -1
- package/dist/split-SITCSYCZ-NsOC8k0n.mjs +0 -1
- package/dist/sqlite3-56UMWEY3-URg2-QXI.mjs +0 -1
- package/dist/start-XK80NBcm.mjs +0 -1
- package/dist/stat-BT5A227F-Di81wqB8.mjs +0 -1
- package/dist/strings-7PLOGTPD-DKTG3t3M.mjs +0 -1
- package/dist/tac-SJGXQ4T2-CMuGqDl5.mjs +0 -1
- package/dist/tail-S5ULNTJU-CxhswWhX.mjs +0 -1
- package/dist/tar-ANUBEFJY-BBFrIW8E.mjs +0 -1
- package/dist/tee-O7VXZDCO-DwJ0hUpW.mjs +0 -1
- package/dist/time-DEUO3QV2-W5vzutuD.mjs +0 -1
- package/dist/timeout-VRKMCG72-wW3XOtt7.mjs +0 -1
- package/dist/touch-DX2IJOQ4-C7eGjNGd.mjs +0 -1
- package/dist/tr-2HXZRDSW-DlafN6SW.mjs +0 -1
- package/dist/tree-LYXBS7DC-Ou8JkGQ1.mjs +0 -1
- package/dist/true-WHJNXCHG-B4B4ZHqp.mjs +0 -1
- package/dist/unexpand-RGTMIGZM-D6xZmTWp.mjs +0 -1
- package/dist/uniq-SUNANL47-Ce9L4IzE.mjs +0 -1
- package/dist/wc-TQB3VNOX-dwG38U4n.mjs +0 -1
- package/dist/which-XZHEH76L-Cw9SQliE.mjs +0 -1
- package/dist/whoami-DGKU3D2X-hzRI9gvz.mjs +0 -1
- package/dist/xan-BXDXYEIB-loWv9Mk3.mjs +0 -1
- package/dist/xan-view-ECQUO7AJ-8Lt55NoE.mjs +0 -1
- package/dist/xargs-I6EZUCYF-CG6axhMW.mjs +0 -1
- package/dist/yazl-CJayzk0b.mjs +0 -1
- package/dist/yq-MJMAR36V-CsEAtdgj.mjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./chunk-DXB73IDG-C2RuFAAY.mjs";import{r as e,t}from"./chunk-VOBGTVA6-BT7gUxqf.mjs";export{e as aliasCommand,t as unaliasCommand};
|
|
@@ -3,7 +3,7 @@ name: open-knowledge-discovery
|
|
|
3
3
|
description: "Read when the user asks what Open Knowledge is, wants to install it on a repository, wants to share an Open Knowledge project with collaborators, or asks how `ok init` / `ok install-skill` / OK Desktop set up a project. Do NOT load to perform Open Knowledge reads/writes — the runtime guidance for editing markdown inside an initialized OK project ships as a separate project-local skill at `.claude/skills/open-knowledge/` whenever `ok init` runs. If the user appears to be editing markdown inside a `.ok/` project and this is the only OK skill loaded, advise them to re-run `ok init` to install the project-local skill."
|
|
4
4
|
compatibility: "Any agent host — no MCP server required. Pure discovery + install guidance."
|
|
5
5
|
metadata:
|
|
6
|
-
version: "0.11.0-beta.
|
|
6
|
+
version: "0.11.0-beta.6"
|
|
7
7
|
author: "Inkeep"
|
|
8
8
|
repository: "https://github.com/inkeep/open-knowledge"
|
|
9
9
|
---
|
|
@@ -3,7 +3,7 @@ name: open-knowledge
|
|
|
3
3
|
description: "MUST invoke before reading or editing any `.md` / `.mdx` file, and before any `mcp__open-knowledge__*` tool call (`exec`, `search`, `write`, `edit`, and the rest). This skill is installed into the repository by `ok init`, so its presence alone means this is an Open Knowledge project — its runtime contract governs every markdown file here, with no need to probe for a `.ok/` directory. Authoritative agent-runtime contract; supersedes the overlapping MCP server `instructions` echo."
|
|
4
4
|
compatibility: "Claude Code, Claude Desktop, Claude Cowork, Claude.ai web. Requires Open Knowledge MCP server + code execution."
|
|
5
5
|
metadata:
|
|
6
|
-
version: "0.11.0-beta.
|
|
6
|
+
version: "0.11.0-beta.6"
|
|
7
7
|
author: "Inkeep"
|
|
8
8
|
repository: "https://github.com/inkeep/open-knowledge"
|
|
9
9
|
---
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./chunk-YNYSPYQ5-iQGTFdx0.mjs";import"./chunk-DXB73IDG-C2RuFAAY.mjs";import"./chunk-5QMZ5MUS-BfIuRNkK.mjs";import"./chunk-24IMIIXA-C-Zyd2K_.mjs";import{n as e}from"./chunk-OARHFVLG-vxL5zuWx.mjs";export{e as awkCommand2};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./chunk-DXB73IDG-C2RuFAAY.mjs";import{t as e}from"./chunk-QJ7O6ZN3-BH67tCjg.mjs";export{e as base64Command};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./chunk-DXB73IDG-C2RuFAAY.mjs";import{t as e}from"./chunk-ALLTKNUZ-BMiTDN50.mjs";export{e as basenameCommand};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./chunk-DXB73IDG-C2RuFAAY.mjs";import{i as e,t}from"./chunk-D6CWQ5DW-BgQGt8eQ.mjs";export{e as bashCommand,t as shCommand};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import*as e from"node:fs";import{join as t,normalize as n,resolve as r,sep as i}from"node:path";import{readdirSync as a,statSync as o}from"fs";import{join as s,resolve as c}from"path";import*as l from"node:querystring";const u={"3g2":`video/3gpp2`,"3gp":`video/3gpp`,"3gpp":`video/3gpp`,"3mf":`model/3mf`,aac:`audio/aac`,ac:`application/pkix-attr-cert`,adp:`audio/adpcm`,adts:`audio/aac`,ai:`application/postscript`,aml:`application/automationml-aml+xml`,amlx:`application/automationml-amlx+zip`,amr:`audio/amr`,apng:`image/apng`,appcache:`text/cache-manifest`,appinstaller:`application/appinstaller`,appx:`application/appx`,appxbundle:`application/appxbundle`,asc:`application/pgp-keys`,atom:`application/atom+xml`,atomcat:`application/atomcat+xml`,atomdeleted:`application/atomdeleted+xml`,atomsvc:`application/atomsvc+xml`,au:`audio/basic`,avci:`image/avci`,avcs:`image/avcs`,avif:`image/avif`,aw:`application/applixware`,bdoc:`application/bdoc`,bin:`application/octet-stream`,bmp:`image/bmp`,bpk:`application/octet-stream`,btf:`image/prs.btif`,btif:`image/prs.btif`,buffer:`application/octet-stream`,ccxml:`application/ccxml+xml`,cdfx:`application/cdfx+xml`,cdmia:`application/cdmi-capability`,cdmic:`application/cdmi-container`,cdmid:`application/cdmi-domain`,cdmio:`application/cdmi-object`,cdmiq:`application/cdmi-queue`,cer:`application/pkix-cert`,cgm:`image/cgm`,cjs:`application/node`,class:`application/java-vm`,coffee:`text/coffeescript`,conf:`text/plain`,cpl:`application/cpl+xml`,cpt:`application/mac-compactpro`,crl:`application/pkix-crl`,css:`text/css`,csv:`text/csv`,cu:`application/cu-seeme`,cwl:`application/cwl`,cww:`application/prs.cww`,davmount:`application/davmount+xml`,dbk:`application/docbook+xml`,deb:`application/octet-stream`,def:`text/plain`,deploy:`application/octet-stream`,dib:`image/bmp`,"disposition-notification":`message/disposition-notification`,dist:`application/octet-stream`,distz:`application/octet-stream`,dll:`application/octet-stream`,dmg:`application/octet-stream`,dms:`application/octet-stream`,doc:`application/msword`,dot:`application/msword`,dpx:`image/dpx`,drle:`image/dicom-rle`,dsc:`text/prs.lines.tag`,dssc:`application/dssc+der`,dtd:`application/xml-dtd`,dump:`application/octet-stream`,dwd:`application/atsc-dwd+xml`,ear:`application/java-archive`,ecma:`application/ecmascript`,elc:`application/octet-stream`,emf:`image/emf`,eml:`message/rfc822`,emma:`application/emma+xml`,emotionml:`application/emotionml+xml`,eps:`application/postscript`,epub:`application/epub+zip`,exe:`application/octet-stream`,exi:`application/exi`,exp:`application/express`,exr:`image/aces`,ez:`application/andrew-inset`,fdf:`application/fdf`,fdt:`application/fdt+xml`,fits:`image/fits`,g3:`image/g3fax`,gbr:`application/rpki-ghostbusters`,geojson:`application/geo+json`,gif:`image/gif`,glb:`model/gltf-binary`,gltf:`model/gltf+json`,gml:`application/gml+xml`,gpx:`application/gpx+xml`,gram:`application/srgs`,grxml:`application/srgs+xml`,gxf:`application/gxf`,gz:`application/gzip`,h261:`video/h261`,h263:`video/h263`,h264:`video/h264`,heic:`image/heic`,heics:`image/heic-sequence`,heif:`image/heif`,heifs:`image/heif-sequence`,hej2:`image/hej2k`,held:`application/atsc-held+xml`,hjson:`application/hjson`,hlp:`application/winhlp`,hqx:`application/mac-binhex40`,hsj2:`image/hsj2`,htm:`text/html`,html:`text/html`,ics:`text/calendar`,ief:`image/ief`,ifb:`text/calendar`,iges:`model/iges`,igs:`model/iges`,img:`application/octet-stream`,in:`text/plain`,ini:`text/plain`,ink:`application/inkml+xml`,inkml:`application/inkml+xml`,ipfix:`application/ipfix`,iso:`application/octet-stream`,its:`application/its+xml`,jade:`text/jade`,jar:`application/java-archive`,jhc:`image/jphc`,jls:`image/jls`,jp2:`image/jp2`,jpe:`image/jpeg`,jpeg:`image/jpeg`,jpf:`image/jpx`,jpg:`image/jpeg`,jpg2:`image/jp2`,jpgm:`image/jpm`,jpgv:`video/jpeg`,jph:`image/jph`,jpm:`image/jpm`,jpx:`image/jpx`,js:`text/javascript`,json:`application/json`,json5:`application/json5`,jsonld:`application/ld+json`,jsonml:`application/jsonml+json`,jsx:`text/jsx`,jt:`model/jt`,jxl:`image/jxl`,jxr:`image/jxr`,jxra:`image/jxra`,jxrs:`image/jxrs`,jxs:`image/jxs`,jxsc:`image/jxsc`,jxsi:`image/jxsi`,jxss:`image/jxss`,kar:`audio/midi`,ktx:`image/ktx`,ktx2:`image/ktx2`,less:`text/less`,lgr:`application/lgr+xml`,list:`text/plain`,litcoffee:`text/coffeescript`,log:`text/plain`,lostxml:`application/lost+xml`,lrf:`application/octet-stream`,m1v:`video/mpeg`,m21:`application/mp21`,m2a:`audio/mpeg`,m2t:`video/mp2t`,m2ts:`video/mp2t`,m2v:`video/mpeg`,m3a:`audio/mpeg`,m4a:`audio/mp4`,m4p:`application/mp4`,m4s:`video/iso.segment`,ma:`application/mathematica`,mads:`application/mads+xml`,maei:`application/mmt-aei+xml`,man:`text/troff`,manifest:`text/cache-manifest`,map:`application/json`,mar:`application/octet-stream`,markdown:`text/markdown`,mathml:`application/mathml+xml`,mb:`application/mathematica`,mbox:`application/mbox`,md:`text/markdown`,mdx:`text/mdx`,me:`text/troff`,mesh:`model/mesh`,meta4:`application/metalink4+xml`,metalink:`application/metalink+xml`,mets:`application/mets+xml`,mft:`application/rpki-manifest`,mid:`audio/midi`,midi:`audio/midi`,mime:`message/rfc822`,mj2:`video/mj2`,mjp2:`video/mj2`,mjs:`text/javascript`,mml:`text/mathml`,mods:`application/mods+xml`,mov:`video/quicktime`,mp2:`audio/mpeg`,mp21:`application/mp21`,mp2a:`audio/mpeg`,mp3:`audio/mpeg`,mp4:`video/mp4`,mp4a:`audio/mp4`,mp4s:`application/mp4`,mp4v:`video/mp4`,mpd:`application/dash+xml`,mpe:`video/mpeg`,mpeg:`video/mpeg`,mpf:`application/media-policy-dataset+xml`,mpg:`video/mpeg`,mpg4:`video/mp4`,mpga:`audio/mpeg`,mpp:`application/dash-patch+xml`,mrc:`application/marc`,mrcx:`application/marcxml+xml`,ms:`text/troff`,mscml:`application/mediaservercontrol+xml`,msh:`model/mesh`,msi:`application/octet-stream`,msix:`application/msix`,msixbundle:`application/msixbundle`,msm:`application/octet-stream`,msp:`application/octet-stream`,mtl:`model/mtl`,mts:`video/mp2t`,musd:`application/mmt-usd+xml`,mxf:`application/mxf`,mxmf:`audio/mobile-xmf`,mxml:`application/xv+xml`,n3:`text/n3`,nb:`application/mathematica`,nq:`application/n-quads`,nt:`application/n-triples`,obj:`model/obj`,oda:`application/oda`,oga:`audio/ogg`,ogg:`audio/ogg`,ogv:`video/ogg`,ogx:`application/ogg`,omdoc:`application/omdoc+xml`,onepkg:`application/onenote`,onetmp:`application/onenote`,onetoc:`application/onenote`,onetoc2:`application/onenote`,opf:`application/oebps-package+xml`,opus:`audio/ogg`,otf:`font/otf`,owl:`application/rdf+xml`,oxps:`application/oxps`,p10:`application/pkcs10`,p7c:`application/pkcs7-mime`,p7m:`application/pkcs7-mime`,p7s:`application/pkcs7-signature`,p8:`application/pkcs8`,pdf:`application/pdf`,pfr:`application/font-tdpfr`,pgp:`application/pgp-encrypted`,pkg:`application/octet-stream`,pki:`application/pkixcmp`,pkipath:`application/pkix-pkipath`,pls:`application/pls+xml`,png:`image/png`,prc:`model/prc`,prf:`application/pics-rules`,provx:`application/provenance+xml`,ps:`application/postscript`,pskcxml:`application/pskc+xml`,pti:`image/prs.pti`,qt:`video/quicktime`,raml:`application/raml+yaml`,rapd:`application/route-apd+xml`,rdf:`application/rdf+xml`,relo:`application/p2p-overlay+xml`,rif:`application/reginfo+xml`,rl:`application/resource-lists+xml`,rld:`application/resource-lists-diff+xml`,rmi:`audio/midi`,rnc:`application/relax-ng-compact-syntax`,rng:`application/xml`,roa:`application/rpki-roa`,roff:`text/troff`,rq:`application/sparql-query`,rs:`application/rls-services+xml`,rsat:`application/atsc-rsat+xml`,rsd:`application/rsd+xml`,rsheet:`application/urc-ressheet+xml`,rss:`application/rss+xml`,rtf:`text/rtf`,rtx:`text/richtext`,rusd:`application/route-usd+xml`,s3m:`audio/s3m`,sbml:`application/sbml+xml`,scq:`application/scvp-cv-request`,scs:`application/scvp-cv-response`,sdp:`application/sdp`,senmlx:`application/senml+xml`,sensmlx:`application/sensml+xml`,ser:`application/java-serialized-object`,setpay:`application/set-payment-initiation`,setreg:`application/set-registration-initiation`,sgi:`image/sgi`,sgm:`text/sgml`,sgml:`text/sgml`,shex:`text/shex`,shf:`application/shf+xml`,shtml:`text/html`,sieve:`application/sieve`,sig:`application/pgp-signature`,sil:`audio/silk`,silo:`model/mesh`,siv:`application/sieve`,slim:`text/slim`,slm:`text/slim`,sls:`application/route-s-tsid+xml`,smi:`application/smil+xml`,smil:`application/smil+xml`,snd:`audio/basic`,so:`application/octet-stream`,spdx:`text/spdx`,spp:`application/scvp-vp-response`,spq:`application/scvp-vp-request`,spx:`audio/ogg`,sql:`application/sql`,sru:`application/sru+xml`,srx:`application/sparql-results+xml`,ssdl:`application/ssdl+xml`,ssml:`application/ssml+xml`,stk:`application/hyperstudio`,stl:`model/stl`,stpx:`model/step+xml`,stpxz:`model/step-xml+zip`,stpz:`model/step+zip`,styl:`text/stylus`,stylus:`text/stylus`,svg:`image/svg+xml`,svgz:`image/svg+xml`,swidtag:`application/swid+xml`,t:`text/troff`,t38:`image/t38`,td:`application/urc-targetdesc+xml`,tei:`application/tei+xml`,teicorpus:`application/tei+xml`,text:`text/plain`,tfi:`application/thraud+xml`,tfx:`image/tiff-fx`,tif:`image/tiff`,tiff:`image/tiff`,toml:`application/toml`,tr:`text/troff`,trig:`application/trig`,ts:`video/mp2t`,tsd:`application/timestamped-data`,tsv:`text/tab-separated-values`,ttc:`font/collection`,ttf:`font/ttf`,ttl:`text/turtle`,ttml:`application/ttml+xml`,txt:`text/plain`,u3d:`model/u3d`,u8dsn:`message/global-delivery-status`,u8hdr:`message/global-headers`,u8mdn:`message/global-disposition-notification`,u8msg:`message/global`,ubj:`application/ubjson`,uri:`text/uri-list`,uris:`text/uri-list`,urls:`text/uri-list`,vcard:`text/vcard`,vrml:`model/vrml`,vtt:`text/vtt`,vxml:`application/voicexml+xml`,war:`application/java-archive`,wasm:`application/wasm`,wav:`audio/wav`,weba:`audio/webm`,webm:`video/webm`,webmanifest:`application/manifest+json`,webp:`image/webp`,wgsl:`text/wgsl`,wgt:`application/widget`,wif:`application/watcherinfo+xml`,wmf:`image/wmf`,woff:`font/woff`,woff2:`font/woff2`,wrl:`model/vrml`,wsdl:`application/wsdl+xml`,wspolicy:`application/wspolicy+xml`,x3d:`model/x3d+xml`,x3db:`model/x3d+fastinfoset`,x3dbz:`model/x3d+binary`,x3dv:`model/x3d-vrml`,x3dvz:`model/x3d+vrml`,x3dz:`model/x3d+xml`,xaml:`application/xaml+xml`,xav:`application/xcap-att+xml`,xca:`application/xcap-caps+xml`,xcs:`application/calendar+xml`,xdf:`application/xcap-diff+xml`,xdssc:`application/dssc+xml`,xel:`application/xcap-el+xml`,xenc:`application/xenc+xml`,xer:`application/patch-ops-error+xml`,xfdf:`application/xfdf`,xht:`application/xhtml+xml`,xhtml:`application/xhtml+xml`,xhvml:`application/xv+xml`,xlf:`application/xliff+xml`,xm:`audio/xm`,xml:`text/xml`,xns:`application/xcap-ns+xml`,xop:`application/xop+xml`,xpl:`application/xproc+xml`,xsd:`application/xml`,xsf:`application/prs.xsf+xml`,xsl:`application/xml`,xslt:`application/xml`,xspf:`application/xspf+xml`,xvm:`application/xv+xml`,xvml:`application/xv+xml`,yaml:`text/yaml`,yang:`application/yang`,yin:`application/yin+xml`,yml:`text/yaml`,zip:`application/zip`};function d(e){let t=(``+e).trim().toLowerCase(),n=t.lastIndexOf(`.`);return u[~n?t.substring(++n):t]}function f(e,t,n=``){e=c(`.`,e);let r=a(e),i=0,l,u;for(;i<r.length;i++)l=s(e,r[i]),u=o(l),u.isDirectory()?f(l,t,s(n,r[i])):t(s(n,r[i]),l,u)}function p(e){let t=e.url;if(t==null)return;let n=e._parsedUrl;if(n&&n.raw===t)return n;let r=t,i=``,a,o;if(t.length>1){let e=t.indexOf(`#`,1);e!==-1&&(o=t.substring(e),r=t.substring(0,e)),e=r.indexOf(`?`,1),e!==-1&&(i=r.substring(e),r=r.substring(0,e),i.length>1&&(a=l.parse(i.substring(1))))}return e._parsedUrl={pathname:r,search:i,query:a,hash:o,raw:t}}const m=()=>{};function h(e,t){for(let n=0;n<t.length;n++)if(t[n].test(e))return!0}function g(e,t){let n=0,r,i=e.length-1;e.charCodeAt(i)===47&&(e=e.substring(0,i));let a=[],o=`${e}/index`;for(;n<t.length;n++)r=t[n]?`.${t[n]}`:``,e&&a.push(e+r),a.push(o+r);return a}function _(e,t,n){let r=0,i,a=g(t,n);for(;r<a.length;r++)if(i=e[a[r]])return i}function v(r,i,a,o){let s=0,c=g(a,o),l,u,d,f;for(;s<c.length;s++)if(l=n(t(r,d=c[s])),l.startsWith(r)&&e.existsSync(l)){if(u=e.statSync(l),u.isDirectory())continue;return f=S(d,u,i),f[`Cache-Control`]=i?`no-cache`:`no-store`,{abs:l,stats:u,headers:f}}}function y(e,t){return t.statusCode=404,t.end()}function b(t,n,r,i,a){let o=200,s,c={};a={...a};for(let e in a)s=n.getHeader(e),s&&(a[e]=s);if((s=n.getHeader(`content-type`))&&(a[`Content-Type`]=s),t.headers.range){o=206;let[e,r]=t.headers.range.replace(`bytes=`,``).split(`-`),s=c.end=parseInt(r,10)||i.size-1,l=c.start=parseInt(e,10)||0;if(s>=i.size&&(s=i.size-1),l>=i.size)return n.setHeader(`Content-Range`,`bytes */${i.size}`),n.statusCode=416,n.end();a[`Content-Range`]=`bytes ${l}-${s}/${i.size}`,a[`Content-Length`]=s-l+1,a[`Accept-Ranges`]=`bytes`}n.writeHead(o,a),e.createReadStream(r,c).pipe(n)}const x={".br":`br`,".gz":`gzip`};function S(e,t,n){let r=x[e.slice(-3)],i=d(e.slice(0,r&&-3))||``;i===`text/html`&&(i+=`;charset=utf-8`);let a={"Content-Length":t.size,"Content-Type":i,"Last-Modified":t.mtime.toUTCString()};return r&&(a[`Content-Encoding`]=r),n&&(a.ETag=`W/"${t.size}-${t.mtime.getTime()}"`),a}function C(e,t={}){e=r(e||`.`);let n=t.onNoMatch||y,a=t.setHeaders||m,o=t.extensions||[`html`,`htm`],s=t.gzip&&o.map(e=>`${e}.gz`).concat(`gz`),c=t.brotli&&o.map(e=>`${e}.br`).concat(`br`),l={},u=`/`,d=!!t.etag,g=!!t.single;if(typeof t.single==`string`){let e=t.single.lastIndexOf(`.`);u+=~e?t.single.substring(0,e):t.single}let x=[];t.ignores!==!1&&(x.push(/[/]([A-Za-z\s\d~$._-]+\.\w+){1,}$/),t.dotfiles?x.push(/\/\.\w/):x.push(/\/\.well-known/),[].concat(t.ignores||[]).forEach(e=>{x.push(new RegExp(e,`i`))}));let C=t.maxAge!=null&&`public,max-age=${t.maxAge}`;C&&t.immutable?C+=`,immutable`:C&&t.maxAge===0&&(C+=`,must-revalidate`),t.dev||f(e,(e,n,r)=>{if(!/\.well-known[\\+\/]/.test(e)&&!t.dotfiles&&/(^\.|[\\+|\/+]\.)/.test(e))return;let i=S(e,r,d);C&&(i[`Cache-Control`]=C),l[`/`+e.normalize().replace(/\\+/g,`/`)]={abs:n,stats:r,headers:i}});let w=t.dev?v.bind(0,e+i,d):_.bind(0,l);return function(e,t,r){let i=[``],l=p(e).pathname,f=e.headers[`accept-encoding`]||``;if(s&&f.includes(`gzip`)&&i.unshift(...s),c&&/(br|brotli)/i.test(f)&&i.unshift(...c),i.push(...o),l.indexOf(`%`)!==-1)try{l=decodeURI(l)}catch{}let m=w(l,i)||g&&!h(l,x)&&w(u,i);if(!m)return r?r():n(e,t);if(d&&e.headers[`if-none-match`]===m.headers.ETag)return t.writeHead(304),t.end();(s||c)&&t.setHeader(`Vary`,`Accept-Encoding`),a(t,l,m.stats),b(e,t,m.abs,m.stats,m.headers)}}export{u as n,C as t};
|
|
2
|
-
//# sourceMappingURL=build-
|
|
2
|
+
//# sourceMappingURL=build-CJEQ0nGy.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./build-CJEQ0nGy.mjs";export{e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./chunk-DXB73IDG-C2RuFAAY.mjs";import{t as e}from"./chunk-TXBZCHCQ-l48TczF5.mjs";export{e as catCommand};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./chunk-DXB73IDG-C2RuFAAY.mjs";import{t as e}from"./chunk-4GTNDTRF-_OVmXcJ-.mjs";export{e as chmodCommand};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e,t}from"./chunk-5QMZ5MUS-
|
|
2
|
-
//# sourceMappingURL=chunk-24IMIIXA-
|
|
1
|
+
import{n as e,t}from"./chunk-5QMZ5MUS-BfIuRNkK.mjs";function n(n,r,i){if(!n||t.isInSandboxedContext())return;let a=`${r} ${i} attempted outside defense context`;throw new e(a,{timestamp:Date.now(),type:`missing_defense_context`,message:a,path:`DefenseInDepthBox.context`,stack:Error().stack,executionId:t.getCurrentExecutionId()})}async function r(e,t,r,i){n(e,t,`${r} (pre-await)`);let a=await i();return n(e,t,`${r} (post-await)`),a}function i(e,r,i,a){let o=((...t)=>(n(e,r,i),a(...t)));return e?t.bindCurrentContext(o):o}export{i as n,r,n as t};
|
|
2
|
+
//# sourceMappingURL=chunk-24IMIIXA-C-Zyd2K_.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
function e(e,t,n){if(!e)return e;let r=e.replace(/\n\s+at\s.*/g,``);return n&&(r=r.replace(/\bfile:\/\/\/?[^\s'",)}\]:]+/g,`<path>`)),r=r.replace(t?/(?:\/(?:Users|home|private|var|opt|Library|System|usr|etc|tmp|nix|snap|workspace|root|srv|mnt|app))\b[^\s'",)}\]:]*/g:/(?:\/(?:Users|home|private|var|opt|Library|System|usr|etc|tmp|nix|snap))\b[^\s'",)}\]:]*/g,`<path>`),r=r.replace(/node:internal\/[^\s'",)}\]:]+/g,`<internal>`),r=r.replace(/[A-Z]:\\[^\s'",)}\]:]+/g,`<path>`),n&&(r=r.replace(/\\\\[^\s\\]+\\[^\s'",)}\]:]+/g,`<path>`)),r}function t(t){return e(t,!1,!1)}function n(t){return e(t,!0,!0)}export{t as n,n as t};
|
|
2
|
-
//# sourceMappingURL=chunk-3THT3N7L-
|
|
2
|
+
//# sourceMappingURL=chunk-3THT3N7L-Ce6LrnIA.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
function e(e){return e instanceof Error?e.message:String(e)}export{e as t};
|
|
2
|
-
//# sourceMappingURL=chunk-44UOCSGV-
|
|
2
|
+
//# sourceMappingURL=chunk-44UOCSGV-uErOrz7G.mjs.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{t as e}from"./chunk-DXB73IDG-
|
|
1
|
+
import{t as e}from"./chunk-DXB73IDG-C2RuFAAY.mjs";function t(){let e=[{prop:`Function`,target:globalThis,violationType:`function_constructor`,strategy:`throw`,reason:`Function constructor allows arbitrary code execution`},{prop:`eval`,target:globalThis,violationType:`eval`,strategy:`throw`,reason:`eval() allows arbitrary code execution`},{prop:`setTimeout`,target:globalThis,violationType:`setTimeout`,strategy:`throw`,reason:`setTimeout with string argument allows code execution`},{prop:`setInterval`,target:globalThis,violationType:`setInterval`,strategy:`throw`,reason:`setInterval with string argument allows code execution`},{prop:`setImmediate`,target:globalThis,violationType:`setImmediate`,strategy:`throw`,reason:`setImmediate could be used to escape sandbox context`},{prop:`env`,target:process,violationType:`process_env`,strategy:`throw`,reason:`process.env could leak sensitive environment variables`,allowedKeys:new Set([`NODE_V8_COVERAGE`,`NODE_DEBUG`,`NODE_DEBUG_NATIVE`,`NODE_COMPILE_CACHE`,`WATCH_REPORT_DEPENDENCIES`,`FORCE_COLOR`,`DEBUG`,`UNDICI_NO_FG`,`JEST_WORKER_ID`,`__MINIMATCH_TESTING_PLATFORM__`,`LOG_TOKENS`,`LOG_STREAM`])},{prop:`binding`,target:process,violationType:`process_binding`,strategy:`throw`,reason:`process.binding provides access to native Node.js modules`},{prop:`_linkedBinding`,target:process,violationType:`process_binding`,strategy:`throw`,reason:`process._linkedBinding provides access to native Node.js modules`},{prop:`dlopen`,target:process,violationType:`process_dlopen`,strategy:`throw`,reason:`process.dlopen allows loading native addons`},{prop:`getBuiltinModule`,target:process,violationType:`process_get_builtin_module`,strategy:`throw`,reason:`process.getBuiltinModule allows loading native Node.js modules (fs, child_process, vm)`},{prop:`exit`,target:process,violationType:`process_exit`,strategy:`throw`,reason:`process.exit could terminate the interpreter`},{prop:`abort`,target:process,violationType:`process_exit`,strategy:`throw`,reason:`process.abort could crash the interpreter`},{prop:`kill`,target:process,violationType:`process_kill`,strategy:`throw`,reason:`process.kill could signal other processes`},{prop:`setuid`,target:process,violationType:`process_setuid`,strategy:`throw`,reason:`process.setuid could escalate privileges`},{prop:`setgid`,target:process,violationType:`process_setuid`,strategy:`throw`,reason:`process.setgid could escalate privileges`},{prop:`seteuid`,target:process,violationType:`process_setuid`,strategy:`throw`,reason:`process.seteuid could escalate effective user privileges`},{prop:`setegid`,target:process,violationType:`process_setuid`,strategy:`throw`,reason:`process.setegid could escalate effective group privileges`},{prop:`initgroups`,target:process,violationType:`process_setuid`,strategy:`throw`,reason:`process.initgroups could modify supplementary group IDs`},{prop:`setgroups`,target:process,violationType:`process_setuid`,strategy:`throw`,reason:`process.setgroups could modify supplementary group IDs`},{prop:`umask`,target:process,violationType:`process_umask`,strategy:`throw`,reason:`process.umask could modify file creation permissions`},{prop:`argv`,target:process,violationType:`process_argv`,strategy:`throw`,reason:`process.argv may contain secrets in CLI arguments`},{prop:`cwd`,target:process,violationType:`process_chdir`,strategy:`throw`,reason:`process.cwd could disclose real host working directory path`},{prop:`chdir`,target:process,violationType:`process_chdir`,strategy:`throw`,reason:`process.chdir could confuse the interpreter's CWD tracking`},{prop:`report`,target:process,violationType:`process_report`,strategy:`throw`,reason:`process.report could disclose full environment, host paths, and system info`},{prop:`loadEnvFile`,target:process,violationType:`process_env`,strategy:`throw`,reason:`process.loadEnvFile could load env files bypassing env proxy`},{prop:`setUncaughtExceptionCaptureCallback`,target:process,violationType:`process_exception_handler`,strategy:`throw`,reason:`setUncaughtExceptionCaptureCallback could intercept security errors`},{prop:`send`,target:process,violationType:`process_send`,strategy:`throw`,reason:`process.send could communicate with parent process in IPC contexts`},{prop:`channel`,target:process,violationType:`process_channel`,strategy:`throw`,reason:`process.channel could access IPC channel to parent process`},{prop:`cpuUsage`,target:process,violationType:`process_timing`,strategy:`throw`,reason:`process.cpuUsage could enable timing side-channel attacks`},{prop:`memoryUsage`,target:process,violationType:`process_timing`,strategy:`throw`,reason:`process.memoryUsage could enable timing side-channel attacks`},{prop:`hrtime`,target:process,violationType:`process_timing`,strategy:`throw`,reason:`process.hrtime could enable timing side-channel attacks`},{prop:`WeakRef`,target:globalThis,violationType:`weak_ref`,strategy:`throw`,reason:`WeakRef could be used to leak references outside sandbox`},{prop:`FinalizationRegistry`,target:globalThis,violationType:`finalization_registry`,strategy:`throw`,reason:`FinalizationRegistry could be used to leak references outside sandbox`},{prop:`Reflect`,target:globalThis,violationType:`reflect`,strategy:`freeze`,reason:`Reflect provides introspection capabilities`},{prop:`Proxy`,target:globalThis,violationType:`proxy`,strategy:`throw`,reason:`Proxy allows intercepting and modifying object behavior`},{prop:`WebAssembly`,target:globalThis,violationType:`webassembly`,strategy:`throw`,reason:`WebAssembly allows executing arbitrary compiled code`},{prop:`SharedArrayBuffer`,target:globalThis,violationType:`shared_array_buffer`,strategy:`throw`,reason:`SharedArrayBuffer could enable side-channel communication or timing attacks`},{prop:`Atomics`,target:globalThis,violationType:`atomics`,strategy:`throw`,reason:`Atomics could enable side-channel communication or timing attacks`},{prop:`performance`,target:globalThis,violationType:`performance_timing`,strategy:`throw`,reason:`performance.now() provides sub-millisecond timing for side-channel attacks`},{prop:`stdout`,target:process,violationType:`process_stdout`,strategy:`throw`,reason:`process.stdout could bypass interpreter output to write to host stdout`},{prop:`stderr`,target:process,violationType:`process_stderr`,strategy:`throw`,reason:`process.stderr could bypass interpreter output to write to host stderr`},{prop:`__defineGetter__`,target:Object.prototype,violationType:`prototype_mutation`,strategy:`throw`,reason:`__defineGetter__ allows prototype pollution via getter injection`},{prop:`__defineSetter__`,target:Object.prototype,violationType:`prototype_mutation`,strategy:`throw`,reason:`__defineSetter__ allows prototype pollution via setter injection`},{prop:`__lookupGetter__`,target:Object.prototype,violationType:`prototype_mutation`,strategy:`throw`,reason:`__lookupGetter__ enables introspection for prototype pollution attacks`},{prop:`__lookupSetter__`,target:Object.prototype,violationType:`prototype_mutation`,strategy:`throw`,reason:`__lookupSetter__ enables introspection for prototype pollution attacks`},{prop:`JSON`,target:globalThis,violationType:`json_mutation`,strategy:`freeze`,reason:`Freeze JSON to prevent mutation of parsing/serialization`},{prop:`Math`,target:globalThis,violationType:`math_mutation`,strategy:`freeze`,reason:`Freeze Math to prevent mutation of math utilities`}];try{let t=Object.getPrototypeOf(async()=>{}).constructor;t&&t!==Function&&e.push({prop:`constructor`,target:Object.getPrototypeOf(async()=>{}),violationType:`async_function_constructor`,strategy:`throw`,reason:`AsyncFunction constructor allows arbitrary async code execution`})}catch{}try{let t=Object.getPrototypeOf(function*(){}).constructor;t&&t!==Function&&e.push({prop:`constructor`,target:Object.getPrototypeOf(function*(){}),violationType:`generator_function_constructor`,strategy:`throw`,reason:`GeneratorFunction constructor allows arbitrary generator code execution`})}catch{}try{let t=Object.getPrototypeOf(async function*(){}).constructor;t&&t!==Function&&t!==Object.getPrototypeOf(async()=>{}).constructor&&e.push({prop:`constructor`,target:Object.getPrototypeOf(async function*(){}),violationType:`async_generator_function_constructor`,strategy:`throw`,reason:`AsyncGeneratorFunction constructor allows arbitrary async generator code execution`})}catch{}return e.filter(e=>{try{return e.target[e.prop]!==void 0}catch{return!1}})}var n=typeof __BROWSER__<`u`&&__BROWSER__;function r(){return typeof crypto<`u`&&crypto.randomUUID?crypto.randomUUID():`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e===`x`?t:t&3|8).toString(16)})}var i=null;if(!n)try{let{AsyncLocalStorage:t}=e(`node:async_hooks`);i=t}catch{}var a=`
|
|
2
2
|
|
|
3
3
|
This is a defense-in-depth measure and indicates a bug in just-bash. Please report this at security@vercel.com`,o=class extends Error{violation;constructor(e,t){super(e+a),this.violation=t,this.name=`SecurityViolationError`}},s=!n&&i?new i:null,c=1e3;function l(e,t,...n){return s.run(e,()=>t(...n))}var u={enabled:!0,auditMode:!1};function d(e){return e===void 0?{...u,enabled:!1}:typeof e==`boolean`?{...u,enabled:e}:{...u,...e}}var f=class i{static instance=null;static importHooksRegistered=!1;static trustedExecutionDepth=new Map;config;refCount=0;patchFailures=[];activeExecutionIds=new Set;contextCache=new Map;originalDescriptors=[];violations=[];activationTime=0;totalActiveTimeMs=0;constructor(e){this.config=e}static getInstance(e){let t=d(e);if(!i.instance)i.instance=new i(t);else{let e=i.instance.config;if(t.enabled!==e.enabled||t.auditMode!==e.auditMode)throw Error(`DefenseInDepthBox config conflict: requested {enabled: ${t.enabled}, auditMode: ${t.auditMode}} but singleton already has {enabled: ${e.enabled}, auditMode: ${e.auditMode}}. All Bash instances must use the same defense-in-depth security settings, or call DefenseInDepthBox.resetInstance() between incompatible configurations.`)}return i.instance}static resetInstance(){i.instance&&=(i.instance.forceDeactivate(),null),i.trustedExecutionDepth.clear()}static isInSandboxedContext(){return s?s?.getStore()?.sandboxActive===!0:!1}static getCurrentExecutionId(){if(s)return s?.getStore()?.executionId}static enterTrustedScope(e){let t=i.trustedExecutionDepth.get(e)??0;i.trustedExecutionDepth.set(e,t+1)}static leaveTrustedScope(e){let t=i.trustedExecutionDepth.get(e);if(t){if(t===1){i.trustedExecutionDepth.delete(e);return}i.trustedExecutionDepth.set(e,t-1)}}static isTrustedScopeActive(e){return e?(i.trustedExecutionDepth.get(e)??0)>0:!1}isExecutionIdActive(e){return this.activeExecutionIds.has(e)}getCachedContext(e){let t=this.contextCache.get(e);return t||(t={sandboxActive:!0,executionId:e},this.contextCache.set(e,t)),t}getPreferredActiveExecutionId(){if(this.activeExecutionIds.size!==0)for(let e of this.activeExecutionIds)return e}static bindCurrentContext(e){if(!s)return e;let t=i.instance,n=s.getStore(),r=n?.sandboxActive===!0?n.executionId:t?.getPreferredActiveExecutionId();if(!r)return e;let a=t?.getCachedContext(r)??{sandboxActive:!0,executionId:r};return((...t)=>{let n=i.instance;if(!(n&&!n.isExecutionIdActive(r)&&(n.recordViolation(`bound_callback_after_deactivate`,`bound callback`,`Bound callback blocked after originating execution was deactivated`),!n.config.auditMode)))return l(a,e,...t)})}isEnabled(){return this.config.enabled===!0&&s!==null&&!n}updateConfig(e){this.config={...this.config,...e}}activate(){if(n||!this.config.enabled||!s){let e=r(),t=!1;return{run:e=>t?Promise.reject(Error(`DefenseInDepthBox handle is deactivated and cannot run new work`)):e(),deactivate:()=>{t=!0},executionId:e}}this.refCount++,this.refCount===1&&(this.applyPatches(),this.activationTime=Date.now());let e=r(),t=!1;return{run:n=>t?Promise.reject(Error(`DefenseInDepthBox handle is deactivated and cannot run new work`)):(this.activeExecutionIds.add(e),s.run({sandboxActive:!0,executionId:e},n)),deactivate:()=>{t||(t=!0,this.activeExecutionIds.delete(e),this.contextCache.delete(e),this.refCount--,this.refCount===0&&(this.restorePatches(),this.totalActiveTimeMs+=Date.now()-this.activationTime),this.refCount<0&&(this.refCount=0))},executionId:e}}forceDeactivate(){this.refCount>0&&(this.restorePatches(),this.totalActiveTimeMs+=Date.now()-this.activationTime),this.activeExecutionIds.clear(),this.contextCache.clear(),this.refCount=0}isActive(){return this.refCount>0}getStats(){return{violationsBlocked:this.violations.length,violations:[...this.violations],activeTimeMs:this.totalActiveTimeMs+(this.refCount>0?Date.now()-this.activationTime:0),refCount:this.refCount}}getPatchFailures(){return[...this.patchFailures]}clearViolations(){this.violations=[]}getPathForTarget(e,t){return e===globalThis?`globalThis.${t}`:e===process?`process.${t}`:e===Error?`Error.${t}`:e===Function.prototype?`Function.prototype.${t}`:e===Object.prototype?`Object.prototype.${t}`:`<object>.${t}`}static runTrusted(e){if(!s)return e();let t=s.getStore();if(!t)return e();let{executionId:n}=t;return s.run({...t,trusted:!0},()=>{i.enterTrustedScope(n);try{let t=e();return typeof t==`object`&&t&&`finally`in t&&typeof t.finally==`function`?t.finally(()=>{i.leaveTrustedScope(n)}):(i.leaveTrustedScope(n),t)}catch(e){throw i.leaveTrustedScope(n),e}})}static async runTrustedAsync(e){if(!s)return e();let t=s.getStore();if(!t)return e();let{executionId:n}=t;return s.run({...t,trusted:!0},async()=>{i.enterTrustedScope(n);try{return await e()}finally{i.leaveTrustedScope(n)}})}shouldBlock(){if(n||this.config.auditMode||!s)return!1;let e=s?.getStore();return!(e?.sandboxActive!==!0||e.trusted||i.isTrustedScopeActive(e.executionId))}recordViolation(e,t,n){let r={timestamp:Date.now(),type:e,message:n,path:t,stack:Error().stack,executionId:s?.getStore()?.executionId};if(this.violations.length<c&&this.violations.push(r),this.config.onViolation)try{this.config.onViolation(r)}catch(e){console.debug(`[DefenseInDepthBox] onViolation callback threw:`,e instanceof Error?e.message:e)}return r}createBlockingProxy(e,t,n){let r=this;return new Proxy(e,{apply(e,i,a){if(r.shouldBlock()){let e=`${t} is blocked during script execution`;throw new o(e,r.recordViolation(n,t,e))}return r.config.auditMode&&s?.getStore()?.sandboxActive===!0&&r.recordViolation(n,t,`${t} called (audit mode)`),Reflect.apply(e,i,a)},construct(e,i,a){if(r.shouldBlock()){let e=`${t} constructor is blocked during script execution`;throw new o(e,r.recordViolation(n,t,e))}return r.config.auditMode&&s?.getStore()?.sandboxActive===!0&&r.recordViolation(n,t,`${t} constructor called (audit mode)`),Reflect.construct(e,i,a)}})}createBlockingObjectProxy(e,t,n,r){let i=this;return new Proxy(e,{get(e,a,c){if(i.shouldBlock()){if(r&&typeof a==`string`&&r.has(a))return Reflect.get(e,a,c);let s=`${t}.${String(a)}`,l=`${s} is blocked during script execution`;throw new o(l,i.recordViolation(n,s,l))}if(i.config.auditMode&&s?.getStore()?.sandboxActive===!0){let e=`${t}.${String(a)}`;i.recordViolation(n,e,`${e} accessed (audit mode)`)}return Reflect.get(e,a,c)},set(e,r,a,s){if(i.shouldBlock()){let e=`${t}.${String(r)}`,a=`${e} modification is blocked during script execution`;throw new o(a,i.recordViolation(n,e,a))}return Reflect.set(e,r,a,s)},ownKeys(e){if(i.shouldBlock()){let e=`${t} enumeration is blocked during script execution`;throw new o(e,i.recordViolation(n,t,e))}return Reflect.ownKeys(e)},getOwnPropertyDescriptor(e,r){if(i.shouldBlock()){let e=`${t}.${String(r)}`,a=`${e} descriptor access is blocked during script execution`;throw new o(a,i.recordViolation(n,e,a))}return Reflect.getOwnPropertyDescriptor(e,r)},has(e,r){if(i.shouldBlock()){let e=`${t}.${String(r)}`,a=`${e} existence check is blocked during script execution`;throw new o(a,i.recordViolation(n,e,a))}return Reflect.has(e,r)},deleteProperty(e,r){if(i.shouldBlock()){let e=`${t}.${String(r)}`,a=`${e} deletion is blocked during script execution`;throw new o(a,i.recordViolation(n,e,a))}return Reflect.deleteProperty(e,r)},setPrototypeOf(e,r){if(i.shouldBlock()){let e=`${t} setPrototypeOf is blocked during script execution`;throw new o(e,i.recordViolation(n,t,e))}return Reflect.setPrototypeOf(e,r)},defineProperty(e,r,a){if(i.shouldBlock()){let e=`${t}.${String(r)}`,a=`${e} defineProperty is blocked during script execution`;throw new o(a,i.recordViolation(n,e,a))}return Reflect.defineProperty(e,r,a)}})}applyPatches(){this.patchFailures=[];let e=t(),n=new Set([`process_send`,`process_channel`,`process_stdout`,`process_stderr`]);for(let t of e)n.has(t.violationType)||this.applyPatch(t);this.protectConstructorChain(),this.protectErrorPrepareStackTrace(),this.protectPromiseThen(),this.protectDynamicImport(),this.protectModuleLoad(),this.protectModuleResolveFilename(),this.protectProcessMainModule(),this.protectProcessExecPath(),this.lockWellKnownSymbols(),this.protectProxyRevocable();let r=[`Function.prototype.constructor`,`Module._load`],i=this.patchFailures.filter(e=>r.includes(e));if(i.length>0)throw this.restorePatches(),Error(`DefenseInDepthBox: critical patches failed: ${i.join(`, `)}`)}protectConstructorChain(){this.patchPrototypeConstructor(Function.prototype,`Function.prototype.constructor`,`function_constructor`);try{let e=Object.getPrototypeOf(async()=>{}).constructor;e&&e!==Function&&this.patchPrototypeConstructor(e.prototype,`AsyncFunction.prototype.constructor`,`async_function_constructor`)}catch(e){this.patchFailures.push(`AsyncFunction.prototype.constructor`),console.debug(`[DefenseInDepthBox] Could not patch AsyncFunction.prototype.constructor:`,e instanceof Error?e.message:e)}try{let e=Object.getPrototypeOf(function*(){}).constructor;e&&e!==Function&&this.patchPrototypeConstructor(e.prototype,`GeneratorFunction.prototype.constructor`,`generator_function_constructor`)}catch(e){this.patchFailures.push(`GeneratorFunction.prototype.constructor`),console.debug(`[DefenseInDepthBox] Could not patch GeneratorFunction.prototype.constructor:`,e instanceof Error?e.message:e)}try{let e=Object.getPrototypeOf(async function*(){}).constructor,t=Object.getPrototypeOf(async()=>{}).constructor;e&&e!==Function&&e!==t&&this.patchPrototypeConstructor(e.prototype,`AsyncGeneratorFunction.prototype.constructor`,`async_generator_function_constructor`)}catch(e){this.patchFailures.push(`AsyncGeneratorFunction.prototype.constructor`),console.debug(`[DefenseInDepthBox] Could not patch AsyncGeneratorFunction.prototype.constructor:`,e instanceof Error?e.message:e)}}protectErrorPrepareStackTrace(){let e=this;try{let t=Object.getOwnPropertyDescriptor(Error,`prepareStackTrace`);this.originalDescriptors.push({target:Error,prop:`prepareStackTrace`,descriptor:t});let n=t?.value;Object.defineProperty(Error,`prepareStackTrace`,{get(){return n},set(t){if(e.shouldBlock()){let t=`Error.prepareStackTrace modification is blocked during script execution`;throw new o(t,e.recordViolation(`error_prepare_stack_trace`,`Error.prepareStackTrace`,t))}e.config.auditMode&&s?.getStore()?.sandboxActive===!0&&e.recordViolation(`error_prepare_stack_trace`,`Error.prepareStackTrace`,`Error.prepareStackTrace set (audit mode)`),n=t},configurable:!0})}catch(e){this.patchFailures.push(`Error.prepareStackTrace`),console.debug(`[DefenseInDepthBox] Could not protect Error.prepareStackTrace:`,e instanceof Error?e.message:e)}}protectPromiseThen(){let e=this;try{let t=function(...e){return s.run(this.captured,()=>{if(!this.box.isExecutionIdActive(this.executionId)){if(this.box.recordViolation(`promise_then_after_deactivate`,`Promise.then`,`Promise.then callback is blocked after defense deactivation`),this.box.config.auditMode)return Reflect.apply(this.cb,void 0,e);if(this.kind===`fulfilled`)return e[0];throw e[0]}return Reflect.apply(this.cb,void 0,e)})},n=Object.getOwnPropertyDescriptor(Promise.prototype,`then`);this.originalDescriptors.push({target:Promise.prototype,prop:`then`,descriptor:n});let r=n?.value;if(typeof r!=`function`)return;Object.defineProperty(Promise.prototype,`then`,{value:function(n,i){if(!s)return Reflect.apply(r,this,[n,i]);let a=s.getStore(),o=a?.sandboxActive===!0&&a.trusted!==!0?a.executionId:void 0;if(!o)return Reflect.apply(r,this,[n,i]);let c=e.getCachedContext(o),l=(n,r)=>typeof n==`function`?t.bind({box:e,executionId:o,captured:c,cb:n,kind:r}):n;return Reflect.apply(r,this,[l(n,`fulfilled`),l(i,`rejected`)])},writable:!0,configurable:!0})}catch(e){this.patchFailures.push(`Promise.prototype.then`),console.debug(`[DefenseInDepthBox] Could not protect Promise.prototype.then:`,e instanceof Error?e.message:e)}}patchPrototypeConstructor(e,t,n){let r=this;try{let i=Object.getOwnPropertyDescriptor(e,`constructor`);this.originalDescriptors.push({target:e,prop:`constructor`,descriptor:i});let a=i?.value;Object.defineProperty(e,`constructor`,{get(){if(r.shouldBlock()){let e=`${t} access is blocked during script execution`;throw new o(e,r.recordViolation(n,t,e))}return r.config.auditMode&&s?.getStore()?.sandboxActive===!0&&r.recordViolation(n,t,`${t} accessed (audit mode)`),a},set(e){if(r.shouldBlock()){let e=`${t} modification is blocked during script execution`;throw new o(e,r.recordViolation(n,t,e))}Object.defineProperty(this,`constructor`,{value:e,writable:!0,configurable:!0})},configurable:!0})}catch(e){this.patchFailures.push(t),console.debug(`[DefenseInDepthBox] Could not patch ${t}:`,e instanceof Error?e.message:e)}}protectProcessMainModule(){if(typeof process>`u`)return;let e=this;try{let t=Object.getOwnPropertyDescriptor(process,`mainModule`);this.originalDescriptors.push({target:process,prop:`mainModule`,descriptor:t});let n=t?.value;n!==void 0&&Object.defineProperty(process,`mainModule`,{get(){if(e.shouldBlock()){let t=`process.mainModule access is blocked during script execution`;throw new o(t,e.recordViolation(`process_main_module`,`process.mainModule`,t))}return e.config.auditMode&&s?.getStore()?.sandboxActive===!0&&e.recordViolation(`process_main_module`,`process.mainModule`,`process.mainModule accessed (audit mode)`),n},set(t){if(e.shouldBlock()){let t=`process.mainModule modification is blocked during script execution`;throw new o(t,e.recordViolation(`process_main_module`,`process.mainModule`,t))}Object.defineProperty(process,`mainModule`,{value:t,writable:!0,configurable:!0})},configurable:!0})}catch(e){this.patchFailures.push(`process.mainModule`),console.debug(`[DefenseInDepthBox] Could not protect process.mainModule:`,e instanceof Error?e.message:e)}}protectProcessExecPath(){if(typeof process>`u`)return;let e=this;try{let t=Object.getOwnPropertyDescriptor(process,`execPath`);this.originalDescriptors.push({target:process,prop:`execPath`,descriptor:t});let n=t?.value??process.execPath;Object.defineProperty(process,`execPath`,{get(){if(e.shouldBlock()){let t=`process.execPath access is blocked during script execution`;throw new o(t,e.recordViolation(`process_exec_path`,`process.execPath`,t))}return e.config.auditMode&&s?.getStore()?.sandboxActive===!0&&e.recordViolation(`process_exec_path`,`process.execPath`,`process.execPath accessed (audit mode)`),n},set(t){if(e.shouldBlock()){let t=`process.execPath modification is blocked during script execution`;throw new o(t,e.recordViolation(`process_exec_path`,`process.execPath`,t))}Object.defineProperty(process,`execPath`,{value:t,writable:!0,configurable:!0})},configurable:!0})}catch(e){this.patchFailures.push(`process.execPath`),console.debug(`[DefenseInDepthBox] Could not protect process.execPath:`,e instanceof Error?e.message:e)}}lockWellKnownSymbols(){let e=(e,t)=>{try{let n=Object.getOwnPropertyDescriptor(e,t);if(n?.configurable){if(`value`in n){Object.defineProperty(e,t,{...n,configurable:!1,writable:!1});return}Object.defineProperty(e,t,{...n,configurable:!1})}}catch{}};for(let t of[Array,Map,Set,RegExp,Promise])e(t,Symbol.species);for(let t of[Array.prototype,String.prototype,Map.prototype,Set.prototype])e(t,Symbol.iterator);e(Symbol.prototype,Symbol.toPrimitive),e(Date.prototype,Symbol.toPrimitive);for(let t of[Symbol.match,Symbol.matchAll,Symbol.replace,Symbol.search,Symbol.split])e(RegExp.prototype,t);e(Function.prototype,Symbol.hasInstance),e(Array.prototype,Symbol.unscopables);for(let t of[Map.prototype,Set.prototype,Promise.prototype,ArrayBuffer.prototype])e(t,Symbol.toStringTag);try{let e=Object.getOwnPropertyDescriptor(Error,`stackTraceLimit`);this.originalDescriptors.push({target:Error,prop:`stackTraceLimit`,descriptor:e}),Object.defineProperty(Error,`stackTraceLimit`,{value:Error.stackTraceLimit,writable:!1,configurable:!0})}catch{}}protectProxyRevocable(){let e=this;try{let t=Proxy.revocable;if(typeof t!=`function`)return;let n=Object.getOwnPropertyDescriptor(Proxy,`revocable`);this.originalDescriptors.push({target:Proxy,prop:`revocable`,descriptor:n}),Object.defineProperty(Proxy,`revocable`,{value:function(n,r){if(e.shouldBlock()){let t=`Proxy.revocable is blocked during script execution`;throw new o(t,e.recordViolation(`proxy`,`Proxy.revocable`,t))}return e.config.auditMode&&s?.getStore()?.sandboxActive===!0&&e.recordViolation(`proxy`,`Proxy.revocable`,`Proxy.revocable called (audit mode)`),t(n,r)},writable:!1,configurable:!0})}catch(e){this.patchFailures.push(`Proxy.revocable`),console.debug(`[DefenseInDepthBox] Could not protect Proxy.revocable:`,e instanceof Error?e.message:e)}}protectDynamicImport(){if(!(n||i.importHooksRegistered))try{let t=this,n=e(`node:module`),r=new Set;for(let e of n.builtinModules??[]){let t=e.startsWith(`node:`)?e.slice(5):e;r.add(t);let n=t.indexOf(`/`);n>0&&r.add(t.slice(0,n))}let a=e=>{if(e.startsWith(`./`)||e.startsWith(`../`)||e.startsWith(`/`)||e.startsWith(`file:`)||e.startsWith(`data:`)||e.startsWith(`blob:`)||e.startsWith(`http:`)||e.startsWith(`https:`))return!1;let t=e.startsWith(`node:`)?e.slice(5):e;if(!t)return!1;if(typeof n.isBuiltin==`function`&&n.isBuiltin(t)||r.has(t))return!0;let i=t.indexOf(`/`);return i>0&&r.has(t.slice(0,i))},c=()=>{let e=s?.getStore();return t.config.auditMode===!0&&e?.sandboxActive===!0&&e.trusted!==!0&&!i.isTrustedScopeActive(e.executionId)};if(typeof n.registerHooks==`function`){n.registerHooks({resolve(e,n,r){if(e.startsWith(`data:`)||e.startsWith(`blob:`))throw Error(`dynamic import of ${e.startsWith(`data:`)?`data:`:`blob:`} URLs is blocked by defense-in-depth`);if(a(e)){let n=`import(${e})`,r=`dynamic import of Node.js builtin '${e}' is blocked during script execution`;if(t.shouldBlock())throw new o(r,t.recordViolation(`dynamic_import_builtin`,n,r));c()&&t.recordViolation(`dynamic_import_builtin`,n,`dynamic import of Node.js builtin '${e}' called (audit mode)`)}return r(e,n)}}),i.importHooksRegistered=!0;return}if(typeof n.register==`function`){let e=[`export async function resolve(specifier, context, nextResolve) {`,` if (specifier.startsWith("data:") || specifier.startsWith("blob:")) {`,` throw new Error("dynamic import of " + (specifier.startsWith("data:") ? "data:" : "blob:") + " URLs is blocked by defense-in-depth");`,` }`,` return nextResolve(specifier, context);`,`}`].join(`
|
|
4
4
|
`);n.register(`data:text/javascript,${encodeURIComponent(e)}`),i.importHooksRegistered=!0}}catch(e){console.debug(`[DefenseInDepthBox] Could not register import() hooks:`,e instanceof Error?e.message:e)}}protectModuleLoad(){if(!n)try{let t=null;if(typeof process<`u`){let e=process.mainModule;e&&typeof e==`object`&&(t=e.constructor)}if(!t&&typeof e<`u`&&typeof e.main<`u`&&(t=e.main.constructor),!t||typeof t._load!=`function`)return;let n=t._load,r=Object.getOwnPropertyDescriptor(t,`_load`);this.originalDescriptors.push({target:t,prop:`_load`,descriptor:r});let i=this.createBlockingProxy(n,`Module._load`,`module_load`);Object.defineProperty(t,`_load`,{value:i,writable:!0,configurable:!0})}catch(e){this.patchFailures.push(`Module._load`),console.debug(`[DefenseInDepthBox] Could not protect Module._load:`,e instanceof Error?e.message:e)}}protectModuleResolveFilename(){if(!n)try{let t=null;if(typeof process<`u`){let e=process.mainModule;e&&typeof e==`object`&&(t=e.constructor)}if(!t&&typeof e<`u`&&typeof e.main<`u`&&(t=e.main.constructor),!t||typeof t._resolveFilename!=`function`)return;let n=t._resolveFilename,r=Object.getOwnPropertyDescriptor(t,`_resolveFilename`);this.originalDescriptors.push({target:t,prop:`_resolveFilename`,descriptor:r});let i=this.createBlockingProxy(n,`Module._resolveFilename`,`module_resolve_filename`);Object.defineProperty(t,`_resolveFilename`,{value:i,writable:!0,configurable:!0})}catch(e){this.patchFailures.push(`Module._resolveFilename`),console.debug(`[DefenseInDepthBox] Could not protect Module._resolveFilename:`,e instanceof Error?e.message:e)}}applyPatch(e){let{target:t,prop:n,violationType:r,strategy:i}=e;try{let a=t[n];if(a===void 0)return;let o=Object.getOwnPropertyDescriptor(t,n);if(this.originalDescriptors.push({target:t,prop:n,descriptor:o}),i===`freeze`)typeof a==`object`&&a&&Object.freeze(a);else{let i=this.getPathForTarget(t,n),o=typeof a==`function`?this.createBlockingProxy(a,i,r):this.createBlockingObjectProxy(a,i,r,e.allowedKeys);Object.defineProperty(t,n,{value:o,writable:!0,configurable:!0})}}catch(e){let r=this.getPathForTarget(t,n);this.patchFailures.push(r),console.debug(`[DefenseInDepthBox] Could not patch ${r}:`,e instanceof Error?e.message:e)}}restorePatches(){for(let e=this.originalDescriptors.length-1;e>=0;e--){let{target:t,prop:n,descriptor:r}=this.originalDescriptors[e];try{r?Object.defineProperty(t,n,r):delete t[n]}catch(e){let r=this.getPathForTarget(t,n);console.debug(`[DefenseInDepthBox] Could not restore ${r}:`,e instanceof Error?e.message:e)}}this.originalDescriptors=[]}};export{o as n,f as t};
|
|
5
|
-
//# sourceMappingURL=chunk-5QMZ5MUS-
|
|
5
|
+
//# sourceMappingURL=chunk-5QMZ5MUS-BfIuRNkK.mjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e}from"./chunk-3THT3N7L-
|
|
1
|
+
import{n as e}from"./chunk-3THT3N7L-Ce6LrnIA.mjs";import{r as t,t as n}from"./chunk-74CEPOFO-D1bzz49u.mjs";import{t as r}from"./chunk-HWKDQ44K-CPSjqtR_.mjs";var i={name:`tr`,summary:`translate or delete characters`,usage:`tr [OPTION]... SET1 [SET2]`,options:[`-c, -C, --complement use the complement of SET1`,`-d, --delete delete characters in SET1`,`-s, --squeeze-repeats squeeze repeated characters`,` --help display this help and exit`],description:`SET syntax:
|
|
2
2
|
a-z character range
|
|
3
3
|
[:alnum:] all letters and digits
|
|
4
4
|
[:alpha:] all letters
|
|
@@ -18,4 +18,4 @@ import{n as e}from"./chunk-3THT3N7L-DztAF386.mjs";import{r as t,t as n}from"./ch
|
|
|
18
18
|
`,exitCode:1};if(!d&&!f&&p.length<2)return{stdout:``,stderr:`tr: missing operand after SET1
|
|
19
19
|
`,exitCode:1};let m,h;try{m=o(p[0]),h=p.length>1?o(p[1]):``}catch(t){return{stdout:``,stderr:`${e(t.message)}
|
|
20
20
|
`,exitCode:1}}let g=c.stdin,_=e=>{let t=m.includes(e);return u?!t:t},v=``;if(d)for(let e of g)_(e)||(v+=e);else if(f&&p.length===1){let e=``;for(let t of g)_(t)&&t===e||(v+=t,e=t)}else{if(u){let e=h.length>0?h[h.length-1]:``;for(let t of g)m.includes(t)?v+=t:v+=e}else{let e=new Map;for(let t=0;t<m.length;t++){let n=t<h.length?h[t]:h[h.length-1];e.set(m[t],n)}for(let t of g)v+=e.get(t)??t}if(f){let e=``,t=``;for(let n of v)h.includes(n)&&n===t||(e+=n,t=n);v=e}}return{stdout:v,stderr:``,exitCode:0}}},l={name:`tr`,flags:[{flag:`-c`,type:`boolean`},{flag:`-C`,type:`boolean`},{flag:`-d`,type:`boolean`},{flag:`-s`,type:`boolean`}],stdinType:`text`,needsArgs:!0};export{c as n,l as t};
|
|
21
|
-
//# sourceMappingURL=chunk-62RKD26F-
|
|
21
|
+
//# sourceMappingURL=chunk-62RKD26F-CvuML91F.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{t as e}from"./chunk-44UOCSGV-
|
|
1
|
+
import{t as e}from"./chunk-44UOCSGV-uErOrz7G.mjs";import{r as t,t as n}from"./chunk-74CEPOFO-D1bzz49u.mjs";import{t as r}from"./chunk-HWKDQ44K-CPSjqtR_.mjs";var i={name:`mv`,summary:`move (rename) files`,usage:`mv [OPTION]... SOURCE... DEST`,options:[`-f, --force do not prompt before overwriting`,`-n, --no-clobber do not overwrite an existing file`,`-v, --verbose explain what is being done`,` --help display this help and exit`]},a={force:{short:`f`,long:`force`,type:`boolean`},noClobber:{short:`n`,long:`no-clobber`,type:`boolean`},verbose:{short:`v`,long:`verbose`,type:`boolean`}},o={name:`mv`,async execute(o,s){if(n(o))return t(i);let c=r(`mv`,o,a);if(!c.ok)return c.error;c.result.flags.force;let l=c.result.flags.noClobber,u=c.result.flags.verbose,d=c.result.positional;if(d.length<2)return{stdout:``,stderr:`mv: missing destination file operand
|
|
2
2
|
`,exitCode:1};let f=d.pop()??``,p=d,m=s.fs.resolvePath(s.cwd,f),h=``,g=``,_=0,v=!1;try{v=(await s.fs.stat(m)).isDirectory}catch{}if(p.length>1&&!v)return{stdout:``,stderr:`mv: target '${f}' is not a directory
|
|
3
3
|
`,exitCode:1};for(let t of p)try{let e=s.fs.resolvePath(s.cwd,t),n=m;if(v){let e=t.split(`/`).pop()||t;n=m===`/`?`/${e}`:`${m}/${e}`}if(l)try{await s.fs.stat(n);continue}catch{}if(await s.fs.mv(e,n),u){let e=v?`${f}/${t.split(`/`).pop()||t}`:f;h+=`renamed '${t}' -> '${e}'
|
|
4
4
|
`}}catch(n){let r=e(n);r.includes(`ENOENT`)||r.includes(`no such file`)?g+=`mv: cannot stat '${t}': No such file or directory
|
|
5
5
|
`:g+=`mv: cannot move '${t}': ${r}
|
|
6
6
|
`,_=1}return{stdout:h,stderr:g,exitCode:_}}},s={name:`mv`,flags:[{flag:`-f`,type:`boolean`},{flag:`-n`,type:`boolean`},{flag:`-v`,type:`boolean`}],needsArgs:!0,minArgs:2};export{s as n,o as t};
|
|
7
|
-
//# sourceMappingURL=chunk-A4JSPFCI-
|
|
7
|
+
//# sourceMappingURL=chunk-A4JSPFCI-k-tJSZgB.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t as e}from"./chunk-5QMZ5MUS-
|
|
2
|
-
//# sourceMappingURL=chunk-A5O5YHGN-
|
|
1
|
+
import{t as e}from"./chunk-5QMZ5MUS-BfIuRNkK.mjs";var t=globalThis.setTimeout.bind(globalThis),n=globalThis.clearTimeout.bind(globalThis);globalThis.setInterval.bind(globalThis),globalThis.clearInterval.bind(globalThis);function r(t){return typeof t==`function`?e.bindCurrentContext(t):t}var i=((e,n,...i)=>t(r(e),n,...i)),a=n;export{a as n,i as t};
|
|
2
|
+
//# sourceMappingURL=chunk-A5O5YHGN-C6ngIqYR.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{t as e}from"./chunk-YNYSPYQ5-DesxOVHh.mjs";import{i as t}from"./chunk-GFQRA5P5-DnjwTqP3.mjs";import{r as n,t as r}from"./chunk-OJDRYQWQ-ikvLWpfV.mjs";import{t as i}from"./chunk-24IMIIXA-B6yIPkk2.mjs";import{a,c as o,i as s,n as c,o as l,r as u,t as d}from"./chunk-7TSDKFEO-a-GUGBTu.mjs";function f(e,t,n,i,s,c,u,d,f,p){switch(t){case`sort`:return Array.isArray(e)?[[...e].sort(u)]:[null];case`sort_by`:return!Array.isArray(e)||n.length===0?[null]:[[...e].sort((e,t)=>{let r=s(e,n[0],i)[0],a=s(t,n[0],i)[0];return u(r,a)})];case`bsearch`:if(!Array.isArray(e))throw Error(`${e===null?`null`:typeof e==`object`?`object`:typeof e} (${JSON.stringify(e)}) cannot be searched from`);return n.length===0?[null]:s(e,n[0],i).map(t=>{let n=0,r=e.length;for(;n<r;){let i=n+r>>>1;u(e[i],t)<0?n=i+1:r=i}return n<e.length&&u(e[n],t)===0?n:-n-1});case`unique_by`:{if(!Array.isArray(e)||n.length===0)return[null];let t=new Map;for(let r of e){let e=s(r,n[0],i)[0],a=JSON.stringify(e);t.has(a)||t.set(a,{item:r,key:e})}let r=[...t.values()];return r.sort((e,t)=>u(e.key,t.key)),[r.map(e=>e.item)]}case`group_by`:{if(!Array.isArray(e)||n.length===0)return[null];let t=new Map;for(let r of e){let e=JSON.stringify(s(r,n[0],i)[0]);t.has(e)||t.set(e,[]),t.get(e)?.push(r)}return[[...t.values()]]}case`max`:return Array.isArray(e)&&e.length>0?[e.reduce((e,t)=>u(e,t)>0?e:t)]:[null];case`max_by`:return!Array.isArray(e)||e.length===0||n.length===0?[null]:[e.reduce((e,t)=>{let r=s(e,n[0],i)[0],a=s(t,n[0],i)[0];return u(r,a)>0?e:t})];case`min`:return Array.isArray(e)&&e.length>0?[e.reduce((e,t)=>u(e,t)<0?e:t)]:[null];case`min_by`:return!Array.isArray(e)||e.length===0||n.length===0?[null]:[e.reduce((e,t)=>{let r=s(e,n[0],i)[0],a=s(t,n[0],i)[0];return u(r,a)<0?e:t})];case`add`:{let t=e=>{let t=e.filter(e=>e!==null);return t.length===0?null:t.every(e=>typeof e==`number`)?t.reduce((e,t)=>e+t,0):t.every(e=>typeof e==`string`)?t.join(``):t.every(e=>Array.isArray(e))?t.flat():t.every(e=>e&&typeof e==`object`&&!Array.isArray(e))?r(...t):null};return n.length>=1?[t(s(e,n[0],i))]:Array.isArray(e)?[t(e)]:[null]}case`any`:if(n.length>=2){try{let t=c(e,n[0],i);for(let e of t)if(s(e,n[1],i).some(d))return[!0]}catch(e){if(e instanceof p)throw e}return[!1]}return n.length===1?Array.isArray(e)?[e.some(e=>d(s(e,n[0],i)[0]))]:[!1]:Array.isArray(e)?[e.some(d)]:[!1];case`all`:if(n.length>=2){try{let t=c(e,n[0],i);for(let e of t)if(!s(e,n[1],i).some(d))return[!1]}catch(e){if(e instanceof p)throw e}return[!0]}return n.length===1?Array.isArray(e)?[e.every(e=>d(s(e,n[0],i)[0]))]:[!0]:Array.isArray(e)?[e.every(d)]:[!0];case`select`:return n.length===0||s(e,n[0],i).some(d)?[e]:[];case`map`:return n.length===0||!Array.isArray(e)?[null]:[e.flatMap(e=>s(e,n[0],i))];case`map_values`:if(n.length===0)return[null];if(Array.isArray(e))return[e.flatMap(e=>s(e,n[0],i))];if(e&&typeof e==`object`){let t=Object.create(null);for(let[r,o]of Object.entries(e)){if(!l(r))continue;let e=s(o,n[0],i);e.length>0&&a(t,r,e[0])}return[t]}return[null];case`has`:{if(n.length===0)return[!1];let t=s(e,n[0],i)[0];return Array.isArray(e)&&typeof t==`number`?[t>=0&&t<e.length]:e&&typeof e==`object`&&typeof t==`string`?[o(e,t)]:[!1]}case`in`:{if(n.length===0)return[!1];let t=s(e,n[0],i)[0];return Array.isArray(t)&&typeof e==`number`?[e>=0&&e<t.length]:t&&typeof t==`object`&&typeof e==`string`?[o(t,e)]:[!1]}case`contains`:return n.length===0?[!1]:[f(e,s(e,n[0],i)[0])];case`inside`:return n.length===0?[!1]:[f(s(e,n[0],i)[0],e)];default:return null}}function p(e,t,n,r,i,a,o,s){switch(t){case`first`:if(n.length>0)try{let t=a(e,n[0],r);return t.length>0?[t[0]]:[]}catch(e){if(e instanceof s)throw e;return[]}return Array.isArray(e)&&e.length>0?[e[0]]:[null];case`last`:if(n.length>0){let t=i(e,n[0],r);return t.length>0?[t[t.length-1]]:[]}return Array.isArray(e)&&e.length>0?[e[e.length-1]]:[null];case`nth`:{if(n.length<1)return[null];let t=i(e,n[0],r);if(n.length>1){for(let e of t)if(e<0)throw Error(`nth doesn't support negative indices`);let i;try{i=a(e,n[1],r)}catch(e){if(e instanceof s)throw e;i=[]}return t.flatMap(e=>{let t=e;return t<i.length?[i[t]]:[]})}return Array.isArray(e)?t.flatMap(t=>{let n=t;if(n<0)throw Error(`nth doesn't support negative indices`);return n<e.length?[e[n]]:[null]}):[null]}case`range`:{if(n.length===0)return[];let t=Math.max(r.limits.maxIterations*100,1e6),a=e=>e.length>=t,o=i(e,n[0],r);if(n.length===1){let e=[];for(let t of o){let n=t;for(let t=0;t<n;t++)if(e.push(t),a(e))return e}return e}let s=i(e,n[1],r);if(n.length===2){let e=[];for(let t of o)for(let n of s){let r=t,i=n;for(let t=r;t<i;t++)if(e.push(t),a(e))return e}return e}let c=i(e,n[2],r),l=[];for(let e of o)for(let t of s)for(let n of c){let r=e,i=t,o=n;if(o!==0){if(o>0){for(let e=r;e<i;e+=o)if(l.push(e),a(l))return l}else for(let e=r;e>i;e+=o)if(l.push(e),a(l))return l}}return l}case`limit`:return n.length<2?[]:i(e,n[0],r).flatMap(t=>{let i=t;if(i<0)throw Error(`limit doesn't support negative count`);if(i===0)return[];let o;try{o=a(e,n[1],r)}catch(e){if(e instanceof s)throw e;o=[]}return o.slice(0,i)});case`isempty`:if(n.length<1)return[!0];try{return[a(e,n[0],r).length===0]}catch(e){if(e instanceof s)throw e;return[!0]}case`isvalid`:if(n.length<1)return[!0];try{return[i(e,n[0],r).length>0]}catch(e){if(e instanceof s)throw e;return[!1]}case`skip`:return n.length<2?[]:i(e,n[0],r).flatMap(t=>{let a=t;if(a<0)throw Error(`skip doesn't support negative count`);return i(e,n[1],r).slice(a)});case`until`:{if(n.length<2)return[e];let t=e,a=r.limits.maxIterations;for(let e=0;e<a;e++){if(i(t,n[0],r).some(o))return[t];let e=i(t,n[1],r);if(e.length===0)return[t];t=e[0]}throw new s(`jq until: too many iterations (${a}), increase executionLimits.maxJqIterations`,`iterations`)}case`while`:{if(n.length<2)return[e];let t=[],a=e,c=r.limits.maxIterations;for(let e=0;e<c&&i(a,n[0],r).some(o);e++){t.push(a);let e=i(a,n[1],r);if(e.length===0)break;a=e[0]}if(t.length>=c)throw new s(`jq while: too many iterations (${c}), increase executionLimits.maxJqIterations`,`iterations`);return t}case`repeat`:{if(n.length===0)return[e];let t=[],a=e,o=r.limits.maxIterations;for(let e=0;e<o;e++){t.push(a);let e=i(a,n[0],r);if(e.length===0)break;a=e[0]}if(t.length>=o)throw new s(`jq repeat: too many iterations (${o}), increase executionLimits.maxJqIterations`,`iterations`);return t}default:return null}}function m(e,t,n,r,i){switch(t){case`now`:return[Date.now()/1e3];case`gmtime`:{if(typeof e!=`number`)return[null];let t=new Date(e*1e3),n=t.getUTCFullYear(),r=t.getUTCMonth(),i=t.getUTCDate(),a=t.getUTCHours(),o=t.getUTCMinutes(),s=t.getUTCSeconds(),c=t.getUTCDay(),l=Date.UTC(n,0,1);return[[n,r,i,a,o,s,c,Math.floor((t.getTime()-l)/(1440*60*1e3))]]}case`mktime`:{if(!Array.isArray(e))throw Error(`mktime requires parsed datetime inputs`);let[t,n,r,i=0,a=0,o=0]=e;if(typeof t!=`number`||typeof n!=`number`)throw Error(`mktime requires parsed datetime inputs`);return[Math.floor(Date.UTC(t,n,r??1,i??0,a??0,o??0)/1e3)]}case`strftime`:{if(n.length===0)return[null];let t=i(e,n[0],r)[0];if(typeof t!=`string`)throw Error(`strftime/1 requires a string format`);let a;if(typeof e==`number`)a=new Date(e*1e3);else if(Array.isArray(e)){let[t,n,r,i=0,o=0,s=0]=e;if(typeof t!=`number`||typeof n!=`number`)throw Error(`strftime/1 requires parsed datetime inputs`);a=new Date(Date.UTC(t,n,r??1,i??0,o??0,s??0))}else throw Error(`strftime/1 requires parsed datetime inputs`);let o=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],s=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],c=(e,t=2)=>String(e).padStart(t,`0`);return[t.replace(/%Y/g,String(a.getUTCFullYear())).replace(/%m/g,c(a.getUTCMonth()+1)).replace(/%d/g,c(a.getUTCDate())).replace(/%H/g,c(a.getUTCHours())).replace(/%M/g,c(a.getUTCMinutes())).replace(/%S/g,c(a.getUTCSeconds())).replace(/%A/g,o[a.getUTCDay()]).replace(/%B/g,s[a.getUTCMonth()]).replace(/%Z/g,`UTC`).replace(/%%/g,`%`)]}case`strptime`:{if(n.length===0)return[null];if(typeof e!=`string`)throw Error(`strptime/1 requires a string input`);let t=i(e,n[0],r)[0];if(typeof t!=`string`)throw Error(`strptime/1 requires a string format`);if(t===`%Y-%m-%dT%H:%M:%SZ`){let t=e.match(/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})Z$/);if(t){let[,e,n,r,i,a,o]=t.map(Number),s=new Date(Date.UTC(e,n-1,r,i,a,o)),c=s.getUTCDay(),l=Date.UTC(e,0,1),u=Math.floor((s.getTime()-l)/(1440*60*1e3));return[[e,n-1,r,i,a,o,c,u]]}}let a=new Date(e);if(!Number.isNaN(a.getTime())){let e=a.getUTCFullYear(),t=a.getUTCMonth(),n=a.getUTCDate(),r=a.getUTCHours(),i=a.getUTCMinutes(),o=a.getUTCSeconds(),s=a.getUTCDay(),c=Date.UTC(e,0,1);return[[e,t,n,r,i,o,s,Math.floor((a.getTime()-c)/(1440*60*1e3))]]}throw Error(`Cannot parse date: ${e}`)}case`fromdate`:{if(typeof e!=`string`)throw Error(`fromdate requires a string input`);let t=new Date(e);if(Number.isNaN(t.getTime()))throw Error(`date "${e}" does not match format "%Y-%m-%dT%H:%M:%SZ"`);return[Math.floor(t.getTime()/1e3)]}case`todate`:if(typeof e!=`number`)throw Error(`todate requires a number input`);return[new Date(e*1e3).toISOString().replace(/\.\d{3}Z$/,`Z`)];default:return null}}function h(e){return e!==!1&&e!==null}function g(e,t){return JSON.stringify(e)===JSON.stringify(t)}function _(e,t){return typeof e==`number`&&typeof t==`number`?e-t:typeof e==`string`&&typeof t==`string`?e.localeCompare(t):0}function v(e,t){let n=c(e);for(let e of Object.keys(t)){if(!l(e))continue;let r=o(n,e)?u(n[e]):null,i=u(t[e]);r&&i?a(n,e,v(r,i)):a(n,e,t[e])}return n}function y(e,t=3e3){let n=0,r=e;for(;n<t;)if(Array.isArray(r)){if(r.length===0)return n+1;r=r[0],n++}else if(typeof r==`object`&&r){let e=Object.keys(r);if(e.length===0)return n+1;r=r[e[0]],n++}else return n;return n}function b(e,t){let n=e=>e===null?0:typeof e==`boolean`?1:typeof e==`number`?2:typeof e==`string`?3:Array.isArray(e)?4:typeof e==`object`?5:6,r=n(e),i=n(t);if(r!==i)return r-i;if(typeof e==`number`&&typeof t==`number`)return e-t;if(typeof e==`string`&&typeof t==`string`)return e.localeCompare(t);if(typeof e==`boolean`&&typeof t==`boolean`)return(e?1:0)-(t?1:0);if(Array.isArray(e)&&Array.isArray(t)){for(let n=0;n<Math.min(e.length,t.length);n++){let r=b(e[n],t[n]);if(r!==0)return r}return e.length-t.length}let a=u(e),o=u(t);if(a&&o){let e=Object.keys(a).sort(),t=Object.keys(o).sort();for(let n=0;n<Math.min(e.length,t.length);n++){let r=e[n].localeCompare(t[n]);if(r!==0)return r}if(e.length!==t.length)return e.length-t.length;for(let t of e){let e=b(a[t],o[t]);if(e!==0)return e}}return 0}function x(e,t){if(g(e,t))return!0;if(typeof e==`string`&&typeof t==`string`)return e.includes(t);if(Array.isArray(e)&&Array.isArray(t))return t.every(t=>e.some(e=>x(e,t)));let n=u(e),r=u(t);return n&&r?Object.keys(r).every(e=>o(n,e)&&x(n[e],r[e])):!1}var S=2e3;function C(e,t,n){switch(t){case`@base64`:return typeof e==`string`?typeof Buffer<`u`?[Buffer.from(e,`utf-8`).toString(`base64`)]:[btoa(e)]:[null];case`@base64d`:return typeof e==`string`?typeof Buffer<`u`?[Buffer.from(e,`base64`).toString(`utf-8`)]:[atob(e)]:[null];case`@uri`:return typeof e==`string`?[encodeURIComponent(e).replace(/!/g,`%21`).replace(/'/g,`%27`).replace(/\(/g,`%28`).replace(/\)/g,`%29`).replace(/\*/g,`%2A`)]:[null];case`@urid`:return typeof e==`string`?[decodeURIComponent(e)]:[null];case`@csv`:return Array.isArray(e)?[e.map(e=>{if(e===null)return``;if(typeof e==`boolean`)return e?`true`:`false`;if(typeof e==`number`)return String(e);let t=String(e);return t.includes(`,`)||t.includes(`"`)||t.includes(`
|
|
1
|
+
import{t as e}from"./chunk-YNYSPYQ5-iQGTFdx0.mjs";import{i as t}from"./chunk-GFQRA5P5-ePq2jelx.mjs";import{r as n,t as r}from"./chunk-OJDRYQWQ-DWhg7YHU.mjs";import{t as i}from"./chunk-24IMIIXA-C-Zyd2K_.mjs";import{a,c as o,i as s,n as c,o as l,r as u,t as d}from"./chunk-7TSDKFEO-a-GUGBTu.mjs";function f(e,t,n,i,s,c,u,d,f,p){switch(t){case`sort`:return Array.isArray(e)?[[...e].sort(u)]:[null];case`sort_by`:return!Array.isArray(e)||n.length===0?[null]:[[...e].sort((e,t)=>{let r=s(e,n[0],i)[0],a=s(t,n[0],i)[0];return u(r,a)})];case`bsearch`:if(!Array.isArray(e))throw Error(`${e===null?`null`:typeof e==`object`?`object`:typeof e} (${JSON.stringify(e)}) cannot be searched from`);return n.length===0?[null]:s(e,n[0],i).map(t=>{let n=0,r=e.length;for(;n<r;){let i=n+r>>>1;u(e[i],t)<0?n=i+1:r=i}return n<e.length&&u(e[n],t)===0?n:-n-1});case`unique_by`:{if(!Array.isArray(e)||n.length===0)return[null];let t=new Map;for(let r of e){let e=s(r,n[0],i)[0],a=JSON.stringify(e);t.has(a)||t.set(a,{item:r,key:e})}let r=[...t.values()];return r.sort((e,t)=>u(e.key,t.key)),[r.map(e=>e.item)]}case`group_by`:{if(!Array.isArray(e)||n.length===0)return[null];let t=new Map;for(let r of e){let e=JSON.stringify(s(r,n[0],i)[0]);t.has(e)||t.set(e,[]),t.get(e)?.push(r)}return[[...t.values()]]}case`max`:return Array.isArray(e)&&e.length>0?[e.reduce((e,t)=>u(e,t)>0?e:t)]:[null];case`max_by`:return!Array.isArray(e)||e.length===0||n.length===0?[null]:[e.reduce((e,t)=>{let r=s(e,n[0],i)[0],a=s(t,n[0],i)[0];return u(r,a)>0?e:t})];case`min`:return Array.isArray(e)&&e.length>0?[e.reduce((e,t)=>u(e,t)<0?e:t)]:[null];case`min_by`:return!Array.isArray(e)||e.length===0||n.length===0?[null]:[e.reduce((e,t)=>{let r=s(e,n[0],i)[0],a=s(t,n[0],i)[0];return u(r,a)<0?e:t})];case`add`:{let t=e=>{let t=e.filter(e=>e!==null);return t.length===0?null:t.every(e=>typeof e==`number`)?t.reduce((e,t)=>e+t,0):t.every(e=>typeof e==`string`)?t.join(``):t.every(e=>Array.isArray(e))?t.flat():t.every(e=>e&&typeof e==`object`&&!Array.isArray(e))?r(...t):null};return n.length>=1?[t(s(e,n[0],i))]:Array.isArray(e)?[t(e)]:[null]}case`any`:if(n.length>=2){try{let t=c(e,n[0],i);for(let e of t)if(s(e,n[1],i).some(d))return[!0]}catch(e){if(e instanceof p)throw e}return[!1]}return n.length===1?Array.isArray(e)?[e.some(e=>d(s(e,n[0],i)[0]))]:[!1]:Array.isArray(e)?[e.some(d)]:[!1];case`all`:if(n.length>=2){try{let t=c(e,n[0],i);for(let e of t)if(!s(e,n[1],i).some(d))return[!1]}catch(e){if(e instanceof p)throw e}return[!0]}return n.length===1?Array.isArray(e)?[e.every(e=>d(s(e,n[0],i)[0]))]:[!0]:Array.isArray(e)?[e.every(d)]:[!0];case`select`:return n.length===0||s(e,n[0],i).some(d)?[e]:[];case`map`:return n.length===0||!Array.isArray(e)?[null]:[e.flatMap(e=>s(e,n[0],i))];case`map_values`:if(n.length===0)return[null];if(Array.isArray(e))return[e.flatMap(e=>s(e,n[0],i))];if(e&&typeof e==`object`){let t=Object.create(null);for(let[r,o]of Object.entries(e)){if(!l(r))continue;let e=s(o,n[0],i);e.length>0&&a(t,r,e[0])}return[t]}return[null];case`has`:{if(n.length===0)return[!1];let t=s(e,n[0],i)[0];return Array.isArray(e)&&typeof t==`number`?[t>=0&&t<e.length]:e&&typeof e==`object`&&typeof t==`string`?[o(e,t)]:[!1]}case`in`:{if(n.length===0)return[!1];let t=s(e,n[0],i)[0];return Array.isArray(t)&&typeof e==`number`?[e>=0&&e<t.length]:t&&typeof t==`object`&&typeof e==`string`?[o(t,e)]:[!1]}case`contains`:return n.length===0?[!1]:[f(e,s(e,n[0],i)[0])];case`inside`:return n.length===0?[!1]:[f(s(e,n[0],i)[0],e)];default:return null}}function p(e,t,n,r,i,a,o,s){switch(t){case`first`:if(n.length>0)try{let t=a(e,n[0],r);return t.length>0?[t[0]]:[]}catch(e){if(e instanceof s)throw e;return[]}return Array.isArray(e)&&e.length>0?[e[0]]:[null];case`last`:if(n.length>0){let t=i(e,n[0],r);return t.length>0?[t[t.length-1]]:[]}return Array.isArray(e)&&e.length>0?[e[e.length-1]]:[null];case`nth`:{if(n.length<1)return[null];let t=i(e,n[0],r);if(n.length>1){for(let e of t)if(e<0)throw Error(`nth doesn't support negative indices`);let i;try{i=a(e,n[1],r)}catch(e){if(e instanceof s)throw e;i=[]}return t.flatMap(e=>{let t=e;return t<i.length?[i[t]]:[]})}return Array.isArray(e)?t.flatMap(t=>{let n=t;if(n<0)throw Error(`nth doesn't support negative indices`);return n<e.length?[e[n]]:[null]}):[null]}case`range`:{if(n.length===0)return[];let t=Math.max(r.limits.maxIterations*100,1e6),a=e=>e.length>=t,o=i(e,n[0],r);if(n.length===1){let e=[];for(let t of o){let n=t;for(let t=0;t<n;t++)if(e.push(t),a(e))return e}return e}let s=i(e,n[1],r);if(n.length===2){let e=[];for(let t of o)for(let n of s){let r=t,i=n;for(let t=r;t<i;t++)if(e.push(t),a(e))return e}return e}let c=i(e,n[2],r),l=[];for(let e of o)for(let t of s)for(let n of c){let r=e,i=t,o=n;if(o!==0){if(o>0){for(let e=r;e<i;e+=o)if(l.push(e),a(l))return l}else for(let e=r;e>i;e+=o)if(l.push(e),a(l))return l}}return l}case`limit`:return n.length<2?[]:i(e,n[0],r).flatMap(t=>{let i=t;if(i<0)throw Error(`limit doesn't support negative count`);if(i===0)return[];let o;try{o=a(e,n[1],r)}catch(e){if(e instanceof s)throw e;o=[]}return o.slice(0,i)});case`isempty`:if(n.length<1)return[!0];try{return[a(e,n[0],r).length===0]}catch(e){if(e instanceof s)throw e;return[!0]}case`isvalid`:if(n.length<1)return[!0];try{return[i(e,n[0],r).length>0]}catch(e){if(e instanceof s)throw e;return[!1]}case`skip`:return n.length<2?[]:i(e,n[0],r).flatMap(t=>{let a=t;if(a<0)throw Error(`skip doesn't support negative count`);return i(e,n[1],r).slice(a)});case`until`:{if(n.length<2)return[e];let t=e,a=r.limits.maxIterations;for(let e=0;e<a;e++){if(i(t,n[0],r).some(o))return[t];let e=i(t,n[1],r);if(e.length===0)return[t];t=e[0]}throw new s(`jq until: too many iterations (${a}), increase executionLimits.maxJqIterations`,`iterations`)}case`while`:{if(n.length<2)return[e];let t=[],a=e,c=r.limits.maxIterations;for(let e=0;e<c&&i(a,n[0],r).some(o);e++){t.push(a);let e=i(a,n[1],r);if(e.length===0)break;a=e[0]}if(t.length>=c)throw new s(`jq while: too many iterations (${c}), increase executionLimits.maxJqIterations`,`iterations`);return t}case`repeat`:{if(n.length===0)return[e];let t=[],a=e,o=r.limits.maxIterations;for(let e=0;e<o;e++){t.push(a);let e=i(a,n[0],r);if(e.length===0)break;a=e[0]}if(t.length>=o)throw new s(`jq repeat: too many iterations (${o}), increase executionLimits.maxJqIterations`,`iterations`);return t}default:return null}}function m(e,t,n,r,i){switch(t){case`now`:return[Date.now()/1e3];case`gmtime`:{if(typeof e!=`number`)return[null];let t=new Date(e*1e3),n=t.getUTCFullYear(),r=t.getUTCMonth(),i=t.getUTCDate(),a=t.getUTCHours(),o=t.getUTCMinutes(),s=t.getUTCSeconds(),c=t.getUTCDay(),l=Date.UTC(n,0,1);return[[n,r,i,a,o,s,c,Math.floor((t.getTime()-l)/(1440*60*1e3))]]}case`mktime`:{if(!Array.isArray(e))throw Error(`mktime requires parsed datetime inputs`);let[t,n,r,i=0,a=0,o=0]=e;if(typeof t!=`number`||typeof n!=`number`)throw Error(`mktime requires parsed datetime inputs`);return[Math.floor(Date.UTC(t,n,r??1,i??0,a??0,o??0)/1e3)]}case`strftime`:{if(n.length===0)return[null];let t=i(e,n[0],r)[0];if(typeof t!=`string`)throw Error(`strftime/1 requires a string format`);let a;if(typeof e==`number`)a=new Date(e*1e3);else if(Array.isArray(e)){let[t,n,r,i=0,o=0,s=0]=e;if(typeof t!=`number`||typeof n!=`number`)throw Error(`strftime/1 requires parsed datetime inputs`);a=new Date(Date.UTC(t,n,r??1,i??0,o??0,s??0))}else throw Error(`strftime/1 requires parsed datetime inputs`);let o=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],s=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],c=(e,t=2)=>String(e).padStart(t,`0`);return[t.replace(/%Y/g,String(a.getUTCFullYear())).replace(/%m/g,c(a.getUTCMonth()+1)).replace(/%d/g,c(a.getUTCDate())).replace(/%H/g,c(a.getUTCHours())).replace(/%M/g,c(a.getUTCMinutes())).replace(/%S/g,c(a.getUTCSeconds())).replace(/%A/g,o[a.getUTCDay()]).replace(/%B/g,s[a.getUTCMonth()]).replace(/%Z/g,`UTC`).replace(/%%/g,`%`)]}case`strptime`:{if(n.length===0)return[null];if(typeof e!=`string`)throw Error(`strptime/1 requires a string input`);let t=i(e,n[0],r)[0];if(typeof t!=`string`)throw Error(`strptime/1 requires a string format`);if(t===`%Y-%m-%dT%H:%M:%SZ`){let t=e.match(/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})Z$/);if(t){let[,e,n,r,i,a,o]=t.map(Number),s=new Date(Date.UTC(e,n-1,r,i,a,o)),c=s.getUTCDay(),l=Date.UTC(e,0,1),u=Math.floor((s.getTime()-l)/(1440*60*1e3));return[[e,n-1,r,i,a,o,c,u]]}}let a=new Date(e);if(!Number.isNaN(a.getTime())){let e=a.getUTCFullYear(),t=a.getUTCMonth(),n=a.getUTCDate(),r=a.getUTCHours(),i=a.getUTCMinutes(),o=a.getUTCSeconds(),s=a.getUTCDay(),c=Date.UTC(e,0,1);return[[e,t,n,r,i,o,s,Math.floor((a.getTime()-c)/(1440*60*1e3))]]}throw Error(`Cannot parse date: ${e}`)}case`fromdate`:{if(typeof e!=`string`)throw Error(`fromdate requires a string input`);let t=new Date(e);if(Number.isNaN(t.getTime()))throw Error(`date "${e}" does not match format "%Y-%m-%dT%H:%M:%SZ"`);return[Math.floor(t.getTime()/1e3)]}case`todate`:if(typeof e!=`number`)throw Error(`todate requires a number input`);return[new Date(e*1e3).toISOString().replace(/\.\d{3}Z$/,`Z`)];default:return null}}function h(e){return e!==!1&&e!==null}function g(e,t){return JSON.stringify(e)===JSON.stringify(t)}function _(e,t){return typeof e==`number`&&typeof t==`number`?e-t:typeof e==`string`&&typeof t==`string`?e.localeCompare(t):0}function v(e,t){let n=c(e);for(let e of Object.keys(t)){if(!l(e))continue;let r=o(n,e)?u(n[e]):null,i=u(t[e]);r&&i?a(n,e,v(r,i)):a(n,e,t[e])}return n}function y(e,t=3e3){let n=0,r=e;for(;n<t;)if(Array.isArray(r)){if(r.length===0)return n+1;r=r[0],n++}else if(typeof r==`object`&&r){let e=Object.keys(r);if(e.length===0)return n+1;r=r[e[0]],n++}else return n;return n}function b(e,t){let n=e=>e===null?0:typeof e==`boolean`?1:typeof e==`number`?2:typeof e==`string`?3:Array.isArray(e)?4:typeof e==`object`?5:6,r=n(e),i=n(t);if(r!==i)return r-i;if(typeof e==`number`&&typeof t==`number`)return e-t;if(typeof e==`string`&&typeof t==`string`)return e.localeCompare(t);if(typeof e==`boolean`&&typeof t==`boolean`)return(e?1:0)-(t?1:0);if(Array.isArray(e)&&Array.isArray(t)){for(let n=0;n<Math.min(e.length,t.length);n++){let r=b(e[n],t[n]);if(r!==0)return r}return e.length-t.length}let a=u(e),o=u(t);if(a&&o){let e=Object.keys(a).sort(),t=Object.keys(o).sort();for(let n=0;n<Math.min(e.length,t.length);n++){let r=e[n].localeCompare(t[n]);if(r!==0)return r}if(e.length!==t.length)return e.length-t.length;for(let t of e){let e=b(a[t],o[t]);if(e!==0)return e}}return 0}function x(e,t){if(g(e,t))return!0;if(typeof e==`string`&&typeof t==`string`)return e.includes(t);if(Array.isArray(e)&&Array.isArray(t))return t.every(t=>e.some(e=>x(e,t)));let n=u(e),r=u(t);return n&&r?Object.keys(r).every(e=>o(n,e)&&x(n[e],r[e])):!1}var S=2e3;function C(e,t,n){switch(t){case`@base64`:return typeof e==`string`?typeof Buffer<`u`?[Buffer.from(e,`utf-8`).toString(`base64`)]:[btoa(e)]:[null];case`@base64d`:return typeof e==`string`?typeof Buffer<`u`?[Buffer.from(e,`base64`).toString(`utf-8`)]:[atob(e)]:[null];case`@uri`:return typeof e==`string`?[encodeURIComponent(e).replace(/!/g,`%21`).replace(/'/g,`%27`).replace(/\(/g,`%28`).replace(/\)/g,`%29`).replace(/\*/g,`%2A`)]:[null];case`@urid`:return typeof e==`string`?[decodeURIComponent(e)]:[null];case`@csv`:return Array.isArray(e)?[e.map(e=>{if(e===null)return``;if(typeof e==`boolean`)return e?`true`:`false`;if(typeof e==`number`)return String(e);let t=String(e);return t.includes(`,`)||t.includes(`"`)||t.includes(`
|
|
2
2
|
`)||t.includes(`\r`)?`"${t.replace(/"/g,`""`)}"`:t}).join(`,`)]:[null];case`@tsv`:return Array.isArray(e)?[e.map(e=>String(e??``).replace(/\t/g,`\\t`).replace(/\n/g,`\\n`)).join(` `)]:[null];case`@json`:{let t=n??S;return y(e,t+1)>t?[null]:[JSON.stringify(e)]}case`@html`:return typeof e==`string`?[e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/'/g,`'`).replace(/"/g,`"`)]:[null];case`@sh`:return typeof e==`string`?[`'${e.replace(/'/g,`'\\''`)}'`]:[null];case`@text`:return typeof e==`string`?[e]:e==null?[``]:[String(e)];default:return null}}function w(e,t,n,r,i,a){switch(t){case`index`:return n.length===0?[null]:i(e,n[0],r).map(t=>{if(typeof e==`string`&&typeof t==`string`){if(t===``&&e===``)return null;let n=e.indexOf(t);return n>=0?n:null}if(Array.isArray(e)){if(Array.isArray(t)){for(let n=0;n<=e.length-t.length;n++){let r=!0;for(let i=0;i<t.length;i++)if(!a(e[n+i],t[i])){r=!1;break}if(r)return n}return null}let n=e.findIndex(e=>a(e,t));return n>=0?n:null}return null});case`rindex`:return n.length===0?[null]:i(e,n[0],r).map(t=>{if(typeof e==`string`&&typeof t==`string`){let n=e.lastIndexOf(t);return n>=0?n:null}if(Array.isArray(e)){if(Array.isArray(t)){for(let n=e.length-t.length;n>=0;n--){let r=!0;for(let i=0;i<t.length;i++)if(!a(e[n+i],t[i])){r=!1;break}if(r)return n}return null}for(let n=e.length-1;n>=0;n--)if(a(e[n],t))return n;return null}return null});case`indices`:return n.length===0?[[]]:i(e,n[0],r).map(t=>{let n=[];if(typeof e==`string`&&typeof t==`string`){let r=e.indexOf(t);for(;r!==-1;)n.push(r),r=e.indexOf(t,r+1)}else if(Array.isArray(e))if(Array.isArray(t)){let r=t.length;if(r===0)for(let t=0;t<=e.length;t++)n.push(t);else for(let i=0;i<=e.length-r;i++){let o=!0;for(let n=0;n<r;n++)if(!a(e[i+n],t[n])){o=!1;break}o&&n.push(i)}}else for(let r=0;r<e.length;r++)a(e[r],t)&&n.push(r);return n});default:return null}}function T(e,t,n,r,i){switch(t){case`fabs`:case`abs`:return typeof e==`number`?[Math.abs(e)]:typeof e==`string`?[e]:[null];case`exp10`:return typeof e==`number`?[10**e]:[null];case`exp2`:return typeof e==`number`?[2**e]:[null];case`pow`:{if(n.length<2)return[null];let t=i(e,n[0],r),a=i(e,n[1],r),o=t[0],s=a[0];return typeof o!=`number`||typeof s!=`number`?[null]:[o**s]}case`atan2`:{if(n.length<2)return[null];let t=i(e,n[0],r),a=i(e,n[1],r),o=t[0],s=a[0];return typeof o!=`number`||typeof s!=`number`?[null]:[Math.atan2(o,s)]}case`hypot`:{if(typeof e!=`number`||n.length===0)return[null];let t=i(e,n[0],r)[0];return[Math.hypot(e,t)]}case`fma`:{if(typeof e!=`number`||n.length<2)return[null];let t=i(e,n[0],r)[0],a=i(e,n[1],r)[0];return[e*t+a]}case`copysign`:{if(typeof e!=`number`||n.length===0)return[null];let t=i(e,n[0],r)[0];return[Math.sign(t)*Math.abs(e)]}case`drem`:case`remainder`:{if(typeof e!=`number`||n.length===0)return[null];let t=i(e,n[0],r)[0];return[e-Math.round(e/t)*t]}case`fdim`:{if(typeof e!=`number`||n.length===0)return[null];let t=i(e,n[0],r)[0];return[Math.max(0,e-t)]}case`fmax`:{if(typeof e!=`number`||n.length===0)return[null];let t=i(e,n[0],r)[0];return[Math.max(e,t)]}case`fmin`:{if(typeof e!=`number`||n.length===0)return[null];let t=i(e,n[0],r)[0];return[Math.min(e,t)]}case`ldexp`:return typeof e!=`number`||n.length===0?[null]:[e*2**i(e,n[0],r)[0]];case`scalbn`:case`scalbln`:return typeof e!=`number`||n.length===0?[null]:[e*2**i(e,n[0],r)[0]];case`nearbyint`:return typeof e==`number`?[Math.round(e)]:[null];case`logb`:return typeof e==`number`?[Math.floor(Math.log2(Math.abs(e)))]:[null];case`significand`:return typeof e==`number`?[e/2**Math.floor(Math.log2(Math.abs(e)))]:[null];case`frexp`:if(typeof e==`number`){if(e===0)return[[0,0]];let t=Math.floor(Math.log2(Math.abs(e)))+1;return[[e/2**t,t]]}return[null];case`modf`:if(typeof e==`number`){let t=Math.trunc(e);return[[e-t,t]]}return[null];default:return null}}function E(e,t,n,r,i,o,s,c){switch(t){case`recurse`:{if(n.length===0){let t=[],n=e=>{if(t.push(e),Array.isArray(e))for(let t of e)n(t);else if(e&&typeof e==`object`)for(let t of Object.keys(e))n(e[t])};return n(e),t}let t=[],a=n.length>=2?n[1]:null,s=0,c=e=>{if(s++>1e4||a&&!i(e,a,r).some(o))return;t.push(e);let l=i(e,n[0],r);for(let e of l)e!=null&&c(e)};return c(e),t}case`recurse_down`:return c(e,`recurse`,n,r);case`walk`:{if(n.length===0)return[e];let t=new WeakSet,o=e=>{if(e&&typeof e==`object`){if(t.has(e))return e;t.add(e)}let s;if(Array.isArray(e))s=e.map(o);else if(e&&typeof e==`object`){let t=Object.create(null);for(let[n,r]of Object.entries(e))l(n)&&a(t,n,o(r));s=t}else s=e;return i(s,n[0],r)[0]};return[o(e)]}case`transpose`:{if(!Array.isArray(e))return[null];if(e.length===0)return[[]];let t=Math.max(...e.map(e=>Array.isArray(e)?e.length:0)),n=[];for(let r=0;r<t;r++)n.push(e.map(e=>Array.isArray(e)?e[r]:null));return[n]}case`combinations`:{if(n.length>0){let t=i(e,n[0],r)[0];if(!Array.isArray(e)||t<0)return[];if(t===0)return[[]];let a=[],o=(n,r)=>{if(r===t){a.push([...n]);return}for(let t of e)n.push(t),o(n,r+1),n.pop()};return o([],0),a}if(!Array.isArray(e))return[];if(e.length===0)return[[]];for(let t of e)if(!Array.isArray(t))return[];let t=[],a=(n,r)=>{if(n===e.length){t.push([...r]);return}let i=e[n];for(let e of i)r.push(e),a(n+1,r),r.pop()};return a(0,[]),t}case`parent`:{if(r.root===void 0||r.currentPath===void 0)return[];let t=r.currentPath;if(t.length===0)return[];let a=n.length>0?i(e,n[0],r)[0]:1;if(a>=0){if(a>t.length)return[];let e=t.slice(0,t.length-a);return[s(r.root,e)]}else{let n=-a-1;if(n>=t.length)return[e];let i=t.slice(0,n);return[s(r.root,i)]}}case`parents`:{if(r.root===void 0||r.currentPath===void 0)return[[]];let e=r.currentPath,t=[];for(let n=e.length-1;n>=0;n--)t.push(s(r.root,e.slice(0,n)));return[t]}case`root`:return r.root===void 0?[]:[r.root];default:return null}}var D=2e3;function O(e,t,n,r,i){switch(t){case`keys`:return Array.isArray(e)?[e.map((e,t)=>t)]:e&&typeof e==`object`?[Object.keys(e).sort()]:[null];case`keys_unsorted`:return Array.isArray(e)?[e.map((e,t)=>t)]:e&&typeof e==`object`?[Object.keys(e)]:[null];case`length`:return typeof e==`string`||Array.isArray(e)?[e.length]:e&&typeof e==`object`?[Object.keys(e).length]:e===null?[0]:typeof e==`number`?[Math.abs(e)]:[null];case`utf8bytelength`:{if(typeof e==`string`)return[new TextEncoder().encode(e).length];let t=e===null?`null`:Array.isArray(e)?`array`:typeof e,n=t===`array`||t===`object`?JSON.stringify(e):String(e);throw Error(`${t} (${n}) only strings have UTF-8 byte length`)}case`to_entries`:{let t=u(e);return t?[Object.entries(t).map(([e,t])=>({key:e,value:t}))]:[null]}case`from_entries`:if(Array.isArray(e)){let t=Object.create(null);for(let n of e){let e=u(n);if(e){let n=e.key??e.Key??e.name??e.Name??e.k,r=e.value??e.Value??e.v;if(n!==void 0){let e=String(n);l(e)&&a(t,e,r)}}}return[t]}return[null];case`with_entries`:{if(n.length===0)return[e];let t=u(e);if(t){let e=Object.entries(t).map(([e,t])=>({key:e,value:t})).flatMap(e=>i(e,n[0],r)),o=Object.create(null);for(let t of e){let e=u(t);if(e){let t=e.key??e.name??e.k,n=e.value??e.v;if(t!==void 0){let e=String(t);l(e)&&a(o,e,n)}}}return[o]}return[null]}case`reverse`:return Array.isArray(e)?[[...e].reverse()]:typeof e==`string`?[e.split(``).reverse().join(``)]:[null];case`flatten`:return Array.isArray(e)?(n.length>0?i(e,n[0],r):[1/0]).map(t=>{let n=t;if(n<0)throw Error(`flatten depth must not be negative`);return e.flat(n)}):[null];case`unique`:if(Array.isArray(e)){let t=new Set,n=[];for(let r of e){let e=JSON.stringify(r);t.has(e)||(t.add(e),n.push(r))}return[n]}return[null];case`tojson`:case`tojsonstream`:{let t=r.limits.maxDepth??D;return y(e,t+1)>t?[null]:[JSON.stringify(e)]}case`fromjson`:if(typeof e==`string`){let t=e.trim().toLowerCase();if(t===`nan`)return[NaN];if(t===`inf`||t===`infinity`)return[1/0];if(t===`-inf`||t===`-infinity`)return[-1/0];try{return[d(JSON.parse(e))]}catch{throw Error(`Invalid JSON: ${e}`)}}return[e];case`tostring`:return typeof e==`string`?[e]:[JSON.stringify(e)];case`tonumber`:if(typeof e==`number`)return[e];if(typeof e==`string`){let t=Number(e);if(Number.isNaN(t))throw Error(`${JSON.stringify(e)} cannot be parsed as a number`);return[t]}throw Error(`${typeof e} cannot be parsed as a number`);case`toboolean`:{if(typeof e==`boolean`)return[e];if(typeof e==`string`){if(e===`true`)return[!0];if(e===`false`)return[!1];throw Error(`string (${JSON.stringify(e)}) cannot be parsed as a boolean`)}let t=e===null?`null`:Array.isArray(e)?`array`:typeof e,n=t===`array`||t===`object`?JSON.stringify(e):String(e);throw Error(`${t} (${n}) cannot be parsed as a boolean`)}case`tostream`:{let t=[],n=(e,r)=>{if(typeof e!=`object`||!e)t.push([r,e]);else if(Array.isArray(e))if(e.length===0)t.push([r,[]]);else for(let t=0;t<e.length;t++)n(e[t],[...r,t]);else{let i=Object.keys(e);if(i.length===0)t.push([r,Object.create(null)]);else for(let t of i)n(e[t],[...r,t])}};return n(e,[]),t.push([[]]),t}case`fromstream`:{if(n.length===0)return[e];let t=i(e,n[0],r),o=null;for(let e of t){if(!Array.isArray(e)||e.length===1&&Array.isArray(e[0])&&e[0].length===0||e.length!==2)continue;let[t,n]=e;if(!Array.isArray(t))continue;if(t.length===0){o=n;continue}o===null&&(o=typeof t[0]==`number`?[]:Object.create(null));let r=o;for(let e=0;e<t.length-1;e++){let n=t[e],i=t[e+1];if(Array.isArray(r)&&typeof n==`number`){for(;r.length<=n;)r.push(null);r[n]===null&&(r[n]=typeof i==`number`?[]:Object.create(null)),r=r[n]}else{let e=u(r);if(e){let t=String(n);if(!l(t))continue;(e[t]===null||e[t]===void 0)&&a(e,t,typeof i==`number`?[]:Object.create(null)),r=e[t]}}}let i=t[t.length-1];if(Array.isArray(r)&&typeof i==`number`){for(;r.length<=i;)r.push(null);r[i]=n}else{let e=u(r);if(e){let t=String(i);l(t)&&a(e,t,n)}}}return[o]}case`truncate_stream`:{let t=typeof e==`number`?Math.floor(e):0;if(n.length===0)return[];let a=[],o=i(e,n[0],r);for(let e of o)if(Array.isArray(e)){if(e.length===1&&Array.isArray(e[0])){let n=e[0];n.length>t&&a.push([n.slice(t)]);continue}if(e.length===2&&Array.isArray(e[0])){let n=e[0],r=e[1];n.length>t&&a.push([n.slice(t),r])}}return a}default:return null}}function ee(e,t,n,r,i,a,o,s,c,l){switch(t){case`getpath`:{if(n.length===0)return[null];let t=i(e,n[0],r),a=[];for(let n of t){let t=n,r=e;for(let e of t){if(r==null){r=null;break}if(Array.isArray(r)&&typeof e==`number`)r=r[e];else if(typeof e==`string`){let t=u(r);if(!t||!Object.hasOwn(t,e)){r=null;break}r=t[e]}else{r=null;break}}a.push(r)}return a}case`setpath`:{if(n.length<2)return[null];let t=i(e,n[0],r)[0],a=i(e,n[1],r)[0];return[o(e,t,a)]}case`delpaths`:{if(n.length===0)return[e];let t=i(e,n[0],r)[0],a=e;for(let e of t.sort((e,t)=>t.length-e.length))a=s(a,e);return[a]}case`path`:{if(n.length===0)return[[]];let t=[];return l(e,n[0],r,[],t),t}case`del`:return n.length===0?[e]:[c(e,n[0],r)];case`pick`:{if(n.length===0)return[null];let t=[];for(let i of n)l(e,i,r,[],t);let i=null;for(let n of t){for(let e of n)if(typeof e==`number`&&e<0)throw Error(`Out of bounds negative array index`);let t=e;for(let e of n){if(t==null)break;if(Array.isArray(t)&&typeof e==`number`)t=t[e];else if(typeof e==`string`){let n=u(t);if(!n||!Object.hasOwn(n,e)){t=null;break}t=n[e]}else{t=null;break}}i=o(i,n,t)}return[i]}case`paths`:{let t=[],o=(e,n)=>{if(e&&typeof e==`object`)if(Array.isArray(e))for(let r=0;r<e.length;r++)t.push([...n,r]),o(e[r],[...n,r]);else for(let r of Object.keys(e))t.push([...n,r]),o(e[r],[...n,r])};return o(e,[]),n.length>0?t.filter(t=>{let o=e;for(let e of t)if(Array.isArray(o)&&typeof e==`number`)o=o[e];else if(typeof e==`string`){let t=u(o);if(!t||!Object.hasOwn(t,e))return!1;o=t[e]}else return!1;return i(o,n[0],r).some(a)}):t}case`leaf_paths`:{let t=[],n=(e,r)=>{if(typeof e!=`object`||!e)t.push(r);else if(Array.isArray(e))for(let t=0;t<e.length;t++)n(e[t],[...r,t]);else for(let t of Object.keys(e))n(e[t],[...r,t])};return n(e,[]),t}default:return null}}function k(e,t,n,r,i,s){switch(t){case`IN`:{if(n.length===0)return[!1];if(n.length===1){let t=i(e,n[0],r);for(let n of t)if(s(e,n))return[!0];return[!1]}let t=i(e,n[0],r),a=i(e,n[1],r),o=new Set(a.map(e=>JSON.stringify(e)));for(let e of t)if(o.has(JSON.stringify(e)))return[!0];return[!1]}case`INDEX`:{if(n.length===0)return[Object.create(null)];if(n.length===1){let t=i(e,n[0],r),o=Object.create(null);for(let e of t){let t=String(e);l(t)&&a(o,t,e)}return[o]}if(n.length===2){let t=i(e,n[0],r),o=Object.create(null);for(let e of t){let t=i(e,n[1],r);if(t.length>0){let n=String(t[0]);l(n)&&a(o,n,e)}}return[o]}let t=i(e,n[0],r),o=Object.create(null);for(let e of t){let t=i(e,n[1],r),s=i(e,n[2],r);if(t.length>0&&s.length>0){let e=String(t[0]);l(e)&&a(o,e,s[0])}}return[o]}case`JOIN`:{if(n.length<2)return[null];let t=u(i(e,n[0],r)[0]);if(!t||!Array.isArray(e))return[null];let a=[];for(let s of e){let e=i(s,n[1],r),c=e.length>0?String(e[0]):``,l=o(t,c)?t[c]:null;a.push([s,l])}return[a]}default:return null}}function A(t,n,r,i,a){switch(n){case`join`:{if(!Array.isArray(t))return[null];let e=r.length>0?a(t,r[0],i):[``];for(let e of t)if(Array.isArray(e)||typeof e==`object`&&e)throw Error(`cannot join: contains arrays or objects`);return e.map(e=>t.map(e=>e===null?``:typeof e==`string`?e:String(e)).join(String(e)))}case`split`:{if(typeof t!=`string`||r.length===0)return[null];let e=a(t,r[0],i),n=String(e[0]);return[t.split(n)]}case`splits`:{if(typeof t!=`string`||r.length===0)return[];let n=a(t,r[0],i),o=String(n[0]);try{let n=r.length>1?String(a(t,r[1],i)[0]):`g`;return e(o,n.includes(`g`)?n:`${n}g`).split(t)}catch{return[]}}case`scan`:{if(typeof t!=`string`||r.length===0)return[];let n=a(t,r[0],i),o=String(n[0]);try{let n=r.length>1?String(a(t,r[1],i)[0]):``;return[...e(o,n.includes(`g`)?n:`${n}g`).matchAll(t)].map(e=>e.length>1?e.slice(1):e[0])}catch{return[]}}case`test`:{if(typeof t!=`string`||r.length===0)return[!1];let n=a(t,r[0],i),o=String(n[0]);try{return[e(o,r.length>1?String(a(t,r[1],i)[0]):``).test(t)]}catch{return[!1]}}case`match`:{if(typeof t!=`string`||r.length===0)return[null];let n=a(t,r[0],i),o=String(n[0]);try{let n=e(o,`${r.length>1?String(a(t,r[1],i)[0]):``}d`).exec(t);if(!n)return[];let s=n.indices;return[{offset:n.index,length:n[0].length,string:n[0],captures:n.slice(1).map((e,t)=>({offset:s?.[t+1]?.[0]??null,length:e?.length??0,string:e??``,name:null}))}]}catch{return[null]}}case`capture`:{if(typeof t!=`string`||r.length===0)return[null];let n=a(t,r[0],i),o=String(n[0]);try{let n=e(o,r.length>1?String(a(t,r[1],i)[0]):``).match(t);return!n||!n.groups?[Object.create(null)]:[n.groups]}catch{return[null]}}case`sub`:{if(typeof t!=`string`||r.length<2)return[null];let n=a(t,r[0],i),o=a(t,r[1],i),s=String(n[0]),c=String(o[0]);try{return[e(s,r.length>2?String(a(t,r[2],i)[0]):``).replace(t,c)]}catch{return[t]}}case`gsub`:{if(typeof t!=`string`||r.length<2)return[null];let n=a(t,r[0],i),o=a(t,r[1],i),s=String(n[0]),c=String(o[0]);try{let n=r.length>2?String(a(t,r[2],i)[0]):`g`;return[e(s,n.includes(`g`)?n:`${n}g`).replace(t,c)]}catch{return[t]}}case`ascii_downcase`:return typeof t==`string`?[t.replace(/[A-Z]/g,e=>String.fromCharCode(e.charCodeAt(0)+32))]:[null];case`ascii_upcase`:return typeof t==`string`?[t.replace(/[a-z]/g,e=>String.fromCharCode(e.charCodeAt(0)-32))]:[null];case`ltrimstr`:{if(typeof t!=`string`||r.length===0)return[t];let e=a(t,r[0],i),n=String(e[0]);return[t.startsWith(n)?t.slice(n.length):t]}case`rtrimstr`:{if(typeof t!=`string`||r.length===0)return[t];let e=a(t,r[0],i),n=String(e[0]);return n===``?[t]:[t.endsWith(n)?t.slice(0,-n.length):t]}case`trimstr`:{if(typeof t!=`string`||r.length===0)return[t];let e=a(t,r[0],i),n=String(e[0]);if(n===``)return[t];let o=t;return o.startsWith(n)&&(o=o.slice(n.length)),o.endsWith(n)&&(o=o.slice(0,-n.length)),[o]}case`trim`:if(typeof t==`string`)return[t.trim()];throw Error(`trim input must be a string`);case`ltrim`:if(typeof t==`string`)return[t.trimStart()];throw Error(`trim input must be a string`);case`rtrim`:if(typeof t==`string`)return[t.trimEnd()];throw Error(`trim input must be a string`);case`startswith`:{if(typeof t!=`string`||r.length===0)return[!1];let e=a(t,r[0],i);return[t.startsWith(String(e[0]))]}case`endswith`:{if(typeof t!=`string`||r.length===0)return[!1];let e=a(t,r[0],i);return[t.endsWith(String(e[0]))]}case`ascii`:return typeof t==`string`&&t.length>0?[t.charCodeAt(0)]:[null];case`explode`:return typeof t==`string`?[Array.from(t).map(e=>e.codePointAt(0))]:[null];case`implode`:if(!Array.isArray(t))throw Error(`implode input must be an array`);return[t.map(e=>{if(typeof e==`string`)throw Error(`string (${JSON.stringify(e)}) can't be imploded, unicode codepoint needs to be numeric`);if(typeof e!=`number`||Number.isNaN(e))throw Error(`number (null) can't be imploded, unicode codepoint needs to be numeric`);let t=Math.trunc(e);return t<0||t>1114111||t>=55296&&t<=57343?String.fromCodePoint(65533):String.fromCodePoint(t)}).join(``)];default:return null}}function j(e,t){switch(t){case`type`:return e===null?[`null`]:Array.isArray(e)?[`array`]:typeof e==`boolean`?[`boolean`]:typeof e==`number`?[`number`]:typeof e==`string`?[`string`]:typeof e==`object`?[`object`]:[`null`];case`infinite`:return[1/0];case`nan`:return[NaN];case`isinfinite`:return[typeof e==`number`&&!Number.isFinite(e)];case`isnan`:return[typeof e==`number`&&Number.isNaN(e)];case`isnormal`:return[typeof e==`number`&&Number.isFinite(e)&&e!==0];case`isfinite`:return[typeof e==`number`&&Number.isFinite(e)];case`numbers`:return typeof e==`number`?[e]:[];case`strings`:return typeof e==`string`?[e]:[];case`booleans`:return typeof e==`boolean`?[e]:[];case`nulls`:return e===null?[e]:[];case`arrays`:return Array.isArray(e)?[e]:[];case`objects`:return e&&typeof e==`object`&&!Array.isArray(e)?[e]:[];case`iterables`:return Array.isArray(e)||e&&typeof e==`object`&&!Array.isArray(e)?[e]:[];case`scalars`:return!Array.isArray(e)&&!(e&&typeof e==`object`)?[e]:[];case`values`:return e===null?[]:[e];case`not`:return e===!1||e===null?[!0]:[!1];case`null`:return[null];case`true`:return[!0];case`false`:return[!1];case`empty`:return[];default:return null}}function M(e,t,n){if(t.length===0)return n;let[r,...i]=t;if(typeof r==`number`){if(e&&typeof e==`object`&&!Array.isArray(e))throw Error(`Cannot index object with number`);if(r>536870911)throw Error(`Array index too large`);if(r<0)throw Error(`Out of bounds negative array index`);let t=Array.isArray(e)?[...e]:[];for(;t.length<=r;)t.push(null);return t[r]=M(t[r],i,n),t}if(Array.isArray(e))throw Error(`Cannot index array with string`);if(!l(r))return e??Object.create(null);let o=u(e),s=o?c(o):Object.create(null);return a(s,r,M(Object.hasOwn(s,r)?s[r]:void 0,i,n)),s}function N(e,t){if(t.length===0)return null;if(t.length===1){let n=t[0];if(Array.isArray(e)&&typeof n==`number`){let t=[...e];return t.splice(n,1),t}if(e&&typeof e==`object`&&!Array.isArray(e)){let t=String(n);if(!l(t))return e;let r=c(e);return delete r[t],r}return e}let[n,...r]=t;if(Array.isArray(e)&&typeof n==`number`){let t=[...e];return t[n]=N(t[n],r),t}if(e&&typeof e==`object`&&!Array.isArray(e)){let t=String(n);if(!l(t))return e;let i=c(e);return Object.hasOwn(i,t)&&a(i,t,N(i[t],r)),i}return e}var P=class e extends Error{label;partialResults;constructor(e,t=[]){super(`break ${e}`),this.label=e,this.partialResults=t,this.name=`BreakError`}withPrependedResults(t){return new e(this.label,[...t,...this.partialResults])}},F=class extends Error{value;constructor(e){super(typeof e==`string`?e:JSON.stringify(e)),this.value=e,this.name=`JqError`}},I=1e4,L=2e3,te=new Map([[`floor`,Math.floor],[`ceil`,Math.ceil],[`round`,Math.round],[`sqrt`,Math.sqrt],[`log`,Math.log],[`log10`,Math.log10],[`log2`,Math.log2],[`exp`,Math.exp],[`sin`,Math.sin],[`cos`,Math.cos],[`tan`,Math.tan],[`asin`,Math.asin],[`acos`,Math.acos],[`atan`,Math.atan],[`sinh`,Math.sinh],[`cosh`,Math.cosh],[`tanh`,Math.tanh],[`asinh`,Math.asinh],[`acosh`,Math.acosh],[`atanh`,Math.atanh],[`cbrt`,Math.cbrt],[`expm1`,Math.expm1],[`log1p`,Math.log1p],[`trunc`,Math.trunc]]);function ne(e){return{vars:new Map,limits:{maxIterations:e?.limits?.maxIterations??I,maxDepth:e?.limits?.maxDepth??L},env:e?.env,coverage:e?.coverage,requireDefenseContext:e?.requireDefenseContext,defenseContextChecked:!1}}function R(e,t,n){let r=new Map(e.vars);return r.set(t,n),{vars:r,limits:e.limits,env:e.env,requireDefenseContext:e.requireDefenseContext,defenseContextChecked:e.defenseContextChecked,root:e.root,currentPath:e.currentPath,funcs:e.funcs,labels:e.labels,coverage:e.coverage}}function z(e,t,n){switch(t.type){case`var`:return R(e,t.name,n);case`array`:{if(!Array.isArray(n))return null;let r=e;for(let e=0;e<t.elements.length;e++){let i=t.elements[e],a=e<n.length?n[e]:null,o=z(r,i,a);if(o===null)return null;r=o}return r}case`object`:{let r=u(n);if(!r)return null;let i=e;for(let a of t.fields){let t;if(typeof a.key==`string`)t=a.key;else{let r=W(n,a.key,e);if(r.length===0)return null;t=String(r[0])}let s=o(r,t)?r[t]:null;a.keyVar&&(i=R(i,a.keyVar,s));let c=z(i,a.pattern,s);if(c===null)return null;i=c}return i}}}function B(e,t){let n=e;for(let e of t)if(n&&typeof n==`object`)if(Array.isArray(n))if(typeof e==`number`)n=n[e];else return;else{let t=u(n);if(t&&typeof e==`string`&&Object.hasOwn(t,e))n=t[e];else return}else return;return n}function V(e){if(e.type===`Identity`)return[];if(e.type===`Field`){let t=e.base?V(e.base):[];return t===null?null:[...t,e.name]}if(e.type===`Index`&&e.index.type===`Literal`){let t=e.base?V(e.base):[];if(t===null)return null;let n=e.index.value;return typeof n==`number`||typeof n==`string`?[...t,n]:null}if(e.type===`Pipe`){let t=V(e.left);return t===null?null:H(t,e.right)}if(e.type===`Call`){if(e.name===`parent`||e.name===`root`)return null;if(e.name===`first`&&e.args.length===0)return[0];if(e.name===`last`&&e.args.length===0)return[-1]}return null}function H(e,t){if(t.type===`Call`){if(t.name===`parent`){let n=1;if(t.args.length>0&&t.args[0].type===`Literal`){let e=t.args[0].value;typeof e==`number`&&(n=e)}if(n>=0)return e.slice(0,Math.max(0,e.length-n));{let t=-n-1;return e.slice(0,Math.min(t,e.length))}}if(t.name===`root`)return[]}if(t.type===`Field`){let n=V(t);if(n!==null)return[...e,...n]}if(t.type===`Index`&&t.index.type===`Literal`){let n=V(t);if(n!==null)return[...e,...n]}if(t.type===`Pipe`){let n=H(e,t.left);return n===null?null:H(n,t.right)}return t.type===`Identity`?e:null}function U(e,n,r){if(n.type===`Comma`){let i=[];try{i.push(...W(e,n.left,r))}catch(e){if(e instanceof t)throw e;if(i.length>0)return i;throw Error(`evaluation failed`)}try{i.push(...W(e,n.right,r))}catch(e){if(e instanceof t)throw e;return i}return i}return W(e,n,r)}function W(e,t,r){let o=r&&`vars`in r?r:ne(r);switch(o.defenseContextChecked||(i(o.requireDefenseContext,`query-engine`,`evaluation`),o={...o,defenseContextChecked:!0}),o.root===void 0&&(o={...o,root:e,currentPath:[]}),o.coverage?.hit(`jq:node:${t.type}`),t.type){case`Identity`:return[e];case`Field`:return(t.base?W(e,t.base,o):[e]).flatMap(e=>{let n=u(e);if(n){if(!Object.hasOwn(n,t.name))return[null];let e=n[t.name];return[e===void 0?null:e]}if(e===null)return[null];throw Error(`Cannot index ${Array.isArray(e)?`array`:typeof e} with string "${t.name}"`)});case`Index`:return(t.base?W(e,t.base,o):[e]).flatMap(e=>W(e,t.index,o).flatMap(t=>{if(typeof t==`number`&&Array.isArray(e)){if(Number.isNaN(t))return[null];let n=Math.trunc(t),r=n<0?e.length+n:n;return r>=0&&r<e.length?[e[r]]:[null]}if(typeof t==`string`){let n=u(e);return!n||!Object.hasOwn(n,t)?[null]:[n[t]]}return[null]}));case`Slice`:return(t.base?W(e,t.base,o):[e]).flatMap(n=>{if(n===null)return[null];if(!Array.isArray(n)&&typeof n!=`string`)throw Error(`Cannot slice ${typeof n} (${JSON.stringify(n)})`);let r=n.length,i=t.start?W(e,t.start,o):[0],a=t.end?W(e,t.end,o):[r];return i.flatMap(e=>a.map(t=>{let i=e,a=t,o=Number.isNaN(i)?0:Number.isInteger(i)?i:Math.floor(i),s=Number.isNaN(a)?r:Number.isInteger(a)?a:Math.ceil(a),c=G(o,r),l=G(s,r);return n.slice(c,l)}))});case`Iterate`:return(t.base?W(e,t.base,o):[e]).flatMap(e=>Array.isArray(e)?e:e&&typeof e==`object`?Object.values(e):[]);case`Pipe`:{let n=W(e,t.left,o),r=V(t.left),i=[];for(let e of n)try{if(r!==null){let n={...o,currentPath:[...o.currentPath??[],...r]};i.push(...W(e,t.right,n))}else i.push(...W(e,t.right,o))}catch(e){throw e instanceof P?e.withPrependedResults(i):e}return i}case`Comma`:{let n=W(e,t.left,o),r=W(e,t.right,o);return[...n,...r]}case`Literal`:return[t.value];case`Array`:return t.elements?[W(e,t.elements,o)]:[[]];case`Object`:{let n=[Object.create(null)];for(let r of t.entries){let t=typeof r.key==`string`?[r.key]:W(e,r.key,o),i=W(e,r.value,o),s=[];for(let e of n)for(let n of t){if(typeof n!=`string`)throw Error(`Cannot use ${n===null?`null`:Array.isArray(n)?`array`:typeof n} (${JSON.stringify(n)}) as object key`);if(!l(n)){for(let t of i)s.push(c(e));continue}for(let t of i){let r=c(e);a(r,n,t),s.push(r)}}n.length=0,n.push(...s)}return n}case`Paren`:return W(e,t.expr,o);case`BinaryOp`:return J(e,t.op,t.left,t.right,o);case`UnaryOp`:return W(e,t.operand,o).map(e=>{if(t.op===`-`){if(typeof e==`number`)return-e;if(typeof e==`string`)throw Error(`string (${(e=>e.length>5?`"${e.slice(0,3)}...`:JSON.stringify(e))(e)}) cannot be negated`);return null}return t.op===`not`?!h(e):null});case`Cond`:return W(e,t.cond,o).flatMap(n=>{if(h(n))return W(e,t.then,o);for(let n of t.elifs)if(W(e,n.cond,o).some(h))return W(e,n.then,o);return t.else?W(e,t.else,o):[e]});case`Try`:try{return W(e,t.body,o)}catch(e){return t.catch?W(e instanceof F?e.value:e instanceof Error?e.message:String(e),t.catch,o):[]}case`Call`:return Y(e,t.name,t.args,o);case`VarBind`:return W(e,t.value,o).flatMap(n=>{let r=null,i=[];t.pattern?i.push(t.pattern):t.name&&i.push({type:`var`,name:t.name}),t.alternatives&&i.push(...t.alternatives);for(let e of i)if(r=z(o,e,n),r!==null)break;return r===null?[]:W(e,t.body,r)});case`VarRef`:{if(t.name===`$ENV`)return[o.env?n(o.env):Object.create(null)];let e=o.vars.get(t.name);return e===void 0?[null]:[e]}case`Recurse`:{let t=[],n=new WeakSet,r=e=>{if(e&&typeof e==`object`){if(n.has(e))return;n.add(e)}if(t.push(e),Array.isArray(e))for(let t of e)r(t);else if(e&&typeof e==`object`)for(let t of Object.keys(e))r(e[t])};return r(e),t}case`Optional`:try{return W(e,t.expr,o)}catch{return[]}case`StringInterp`:return[t.parts.map(t=>typeof t==`string`?t:W(e,t,o).map(e=>typeof e==`string`?e:JSON.stringify(e)).join(``)).join(``)];case`UpdateOp`:return[K(e,t.path,t.op,t.value,o)];case`Reduce`:{let n=W(e,t.expr,o),r=W(e,t.init,o)[0],i=o.limits.maxDepth??L;for(let e of n){let n;if(t.pattern){if(n=z(o,t.pattern,e),n===null)continue}else n=R(o,t.varName,e);if(r=W(r,t.update,n)[0],y(r,i+1)>i)return[null]}return[r]}case`Foreach`:{let n=W(e,t.expr,o),r=W(e,t.init,o)[0],i=[];for(let e of n)try{let n;if(t.pattern){if(n=z(o,t.pattern,e),n===null)continue}else n=R(o,t.varName,e);if(r=W(r,t.update,n)[0],t.extract){let e=W(r,t.extract,n);i.push(...e)}else i.push(r)}catch(e){throw e instanceof P?e.withPrependedResults(i):e}return i}case`Label`:try{return W(e,t.body,{...o,labels:new Set([...o.labels??[],t.name])})}catch(e){if(e instanceof P&&e.label===t.name)return e.partialResults;throw e}case`Break`:throw new P(t.name);case`Def`:{let n=new Map(o.funcs??[]),r=`${t.name}/${t.params.length}`;n.set(r,{params:t.params,body:t.funcBody,closure:new Map(o.funcs??[])});let i={...o,funcs:n};return W(e,t.body,i)}default:throw Error(`Unknown AST node type: ${t.type}`)}}function G(e,t){return e<0?Math.max(0,t+e):Math.min(e,t)}function K(e,t,n,r,i){function o(e,t){switch(n){case`=`:return t;case`|=`:return W(e,r,i)[0]??null;case`+=`:return typeof e==`number`&&typeof t==`number`||typeof e==`string`&&typeof t==`string`?e+t:Array.isArray(e)&&Array.isArray(t)?[...e,...t]:e&&t&&typeof e==`object`&&typeof t==`object`?s(e,t):t;case`-=`:return typeof e==`number`&&typeof t==`number`?e-t:e;case`*=`:return typeof e==`number`&&typeof t==`number`?e*t:e;case`/=`:return typeof e==`number`&&typeof t==`number`?e/t:e;case`%=`:return typeof e==`number`&&typeof t==`number`?e%t:e;case`//=`:return e===null||e===!1?t:e;default:return t}}function u(t,n,r){switch(n.type){case`Identity`:return r(t);case`Field`:if(!l(n.name))return t;if(n.base)return u(t,n.base,e=>{if(e&&typeof e==`object`&&!Array.isArray(e)){let t=c(e),i=Object.hasOwn(t,n.name)?t[n.name]:void 0;return a(t,n.name,r(i)),t}return e});if(t&&typeof t==`object`&&!Array.isArray(t)){let e=c(t),i=Object.hasOwn(e,n.name)?e[n.name]:void 0;return a(e,n.name,r(i)),e}return t;case`Index`:{let o=W(e,n.index,i)[0];if(typeof o==`number`&&Number.isNaN(o))throw Error(`Cannot set array element at NaN index`);if(typeof o==`number`&&!Number.isInteger(o)&&(o=Math.trunc(o)),n.base)return u(t,n.base,e=>{if(typeof o==`number`&&Array.isArray(e)){let t=[...e],n=o<0?t.length+o:o;if(n>=0){for(;t.length<=n;)t.push(null);t[n]=r(t[n])}return t}if(typeof o==`string`&&e&&typeof e==`object`&&!Array.isArray(e)){if(!l(o))return e;let t=c(e),n=Object.hasOwn(t,o)?t[o]:void 0;return a(t,o,r(n)),t}return e});if(typeof o==`number`){if(o>536870911)throw Error(`Array index too large`);if(o<0&&(!t||!Array.isArray(t)))throw Error(`Out of bounds negative array index`);if(Array.isArray(t)){let e=[...t],n=o<0?e.length+o:o;if(n>=0){for(;e.length<=n;)e.push(null);e[n]=r(e[n])}return e}if(t==null){let e=[];for(;e.length<=o;)e.push(null);return e[o]=r(null),e}return t}if(typeof o==`string`&&t&&typeof t==`object`&&!Array.isArray(t)){if(!l(o))return t;let e=c(t),n=Object.hasOwn(e,o)?e[o]:void 0;return a(e,o,r(n)),e}return t}case`Iterate`:{let e=e=>{if(Array.isArray(e))return e.map(e=>r(e));if(e&&typeof e==`object`){let t=Object.create(null);for(let[n,i]of Object.entries(e))l(n)&&a(t,n,r(i));return t}return e};return n.base?u(t,n.base,e):e(t)}case`Pipe`:return u(u(t,n.left,e=>e),n.right,r);default:return r(t)}}return u(e,t,t=>n===`|=`?o(t,t):o(t,W(e,r,i)[0]??null))}function q(e,t,n){function r(t,i,o){switch(i.type){case`Identity`:return o;case`Field`:if(!l(i.name))return t;if(i.base){let e=W(t,i.base,n)[0],a=r(e,{type:`Field`,name:i.name},o);return r(t,i.base,a)}if(t&&typeof t==`object`&&!Array.isArray(t)){let e=c(t);return a(e,i.name,o),e}return t;case`Index`:{if(i.base){let e=W(t,i.base,n)[0],a=r(e,{type:`Index`,index:i.index},o);return r(t,i.base,a)}let s=W(e,i.index,n)[0];if(typeof s==`number`&&Array.isArray(t)){let e=[...t],n=s<0?e.length+s:s;return n>=0&&n<e.length&&(e[n]=o),e}if(typeof s==`string`&&t&&typeof t==`object`&&!Array.isArray(t)){if(!l(s))return t;let e=c(t);return a(e,s,o),e}return t}default:return t}}function i(t,o){switch(o.type){case`Identity`:return null;case`Field`:if(!l(o.name))return t;if(o.base){let e=W(t,o.base,n)[0];if(e==null)return t;let a=i(e,{type:`Field`,name:o.name});return r(t,o.base,a)}if(t&&typeof t==`object`&&!Array.isArray(t)){if(!l(o.name))return t;let e=c(t);return delete e[o.name],e}return t;case`Index`:{if(o.base){let e=W(t,o.base,n)[0];if(e==null)return t;let a=i(e,{type:`Index`,index:o.index});return r(t,o.base,a)}let a=W(e,o.index,n)[0];if(typeof a==`number`&&Array.isArray(t)){let e=[...t],n=a<0?e.length+a:a;return n>=0&&n<e.length&&e.splice(n,1),e}if(typeof a==`string`&&t&&typeof t==`object`&&!Array.isArray(t)){if(!l(a))return t;let e=c(t);return delete e[a],e}return t}case`Iterate`:return Array.isArray(t)?[]:t&&typeof t==`object`?Object.create(null):t;case`Pipe`:{let r=function(t,i,o){switch(i.type){case`Identity`:return o;case`Field`:if(!l(i.name))return t;if(t&&typeof t==`object`&&!Array.isArray(t)){let e=c(t);return a(e,i.name,o),e}return t;case`Index`:{let r=W(e,i.index,n)[0];if(typeof r==`number`&&Array.isArray(t)){let e=[...t],n=r<0?e.length+r:r;return n>=0&&n<e.length&&(e[n]=o),e}if(typeof r==`string`&&t&&typeof t==`object`&&!Array.isArray(t)){if(!l(r))return t;let e=c(t);return a(e,r,o),e}return t}case`Pipe`:{let e=W(t,i.left,n)[0],a=r(e,i.right,o);return r(t,i.left,a)}default:return t}},s=o.left,u=o.right,d=W(t,s,n)[0];return d==null?t:r(t,s,i(d,u))}default:return t}}return i(e,t)}function J(e,t,n,r,i){if(t===`and`)return W(e,n,i).flatMap(t=>h(t)?W(e,r,i).map(e=>h(e)):[!1]);if(t===`or`)return W(e,n,i).flatMap(t=>h(t)?[!0]:W(e,r,i).map(e=>h(e)));if(t===`//`){let t=W(e,n,i).filter(e=>e!=null&&e!==!1);return t.length>0?t:W(e,r,i)}let a=W(e,n,i),o=W(e,r,i);return a.flatMap(e=>o.map(n=>{switch(t){case`+`:return e===null?n:n===null?e:typeof e==`number`&&typeof n==`number`||typeof e==`string`&&typeof n==`string`?e+n:Array.isArray(e)&&Array.isArray(n)?[...e,...n]:e&&n&&typeof e==`object`&&typeof n==`object`&&!Array.isArray(e)&&!Array.isArray(n)?s(e,n):null;case`-`:if(typeof e==`number`&&typeof n==`number`)return e-n;if(Array.isArray(e)&&Array.isArray(n)){let t=new Set(n.map(e=>JSON.stringify(e)));return e.filter(e=>!t.has(JSON.stringify(e)))}if(typeof e==`string`&&typeof n==`string`){let t=e=>e.length>10?`"${e.slice(0,10)}...`:JSON.stringify(e);throw Error(`string (${t(e)}) and string (${t(n)}) cannot be subtracted`)}return null;case`*`:if(typeof e==`number`&&typeof n==`number`)return e*n;if(typeof e==`string`&&typeof n==`number`)return e.repeat(n);{let t=u(e),r=u(n);if(t&&r)return v(t,r)}return null;case`/`:if(typeof e==`number`&&typeof n==`number`){if(n===0)throw Error(`number (${e}) and number (${n}) cannot be divided because the divisor is zero`);return e/n}return typeof e==`string`&&typeof n==`string`?e.split(n):null;case`%`:if(typeof e==`number`&&typeof n==`number`){if(n===0)throw Error(`number (${e}) and number (${n}) cannot be divided (remainder) because the divisor is zero`);return!Number.isFinite(e)&&!Number.isNaN(e)?!Number.isFinite(n)&&!Number.isNaN(n)&&e<0&&n>0?-1:0:e%n}return null;case`==`:return g(e,n);case`!=`:return!g(e,n);case`<`:return _(e,n)<0;case`<=`:return _(e,n)<=0;case`>`:return _(e,n)>0;case`>=`:return _(e,n)>=0;default:return null}}))}function Y(e,r,i,a){let o=te.get(r);if(o)return typeof e==`number`?[o(e)]:[null];let s=T(e,r,i,a,W);if(s!==null)return s;let c=A(e,r,i,a,W);if(c!==null)return c;let l=m(e,r,i,a,W);if(l!==null)return l;let u=C(e,r,a.limits.maxDepth);if(u!==null)return u;let d=j(e,r);if(d!==null)return d;let _=O(e,r,i,a,W);if(_!==null)return _;let v=f(e,r,i,a,W,U,b,h,x,t);if(v!==null)return v;let y=ee(e,r,i,a,W,h,M,N,q,X);if(y!==null)return y;let S=w(e,r,i,a,W,g);if(S!==null)return S;let D=p(e,r,i,a,W,U,h,t);if(D!==null)return D;let P=E(e,r,i,a,W,h,B,Y);if(P!==null)return P;let I=k(e,r,i,a,W,g);if(I!==null)return I;switch(r){case`builtins`:return[`add/0.all/0.all/1.all/2.any/0.any/1.any/2.arrays/0.ascii/0.ascii_downcase/0.ascii_upcase/0.booleans/0.bsearch/1.builtins/0.combinations/0.combinations/1.contains/1.debug/0.del/1.delpaths/1.empty/0.env/0.error/0.error/1.explode/0.first/0.first/1.flatten/0.flatten/1.floor/0.from_entries/0.fromdate/0.fromjson/0.getpath/1.gmtime/0.group_by/1.gsub/2.gsub/3.has/1.implode/0.IN/1.IN/2.INDEX/1.INDEX/2.index/1.indices/1.infinite/0.inside/1.isempty/1.isnan/0.isnormal/0.isvalid/1.iterables/0.join/1.keys/0.keys_unsorted/0.last/0.last/1.length/0.limit/2.ltrimstr/1.map/1.map_values/1.match/1.match/2.max/0.max_by/1.min/0.min_by/1.mktime/0.modulemeta/1.nan/0.not/0.nth/1.nth/2.null/0.nulls/0.numbers/0.objects/0.path/1.paths/0.paths/1.pick/1.range/1.range/2.range/3.recurse/0.recurse/1.recurse_down/0.repeat/1.reverse/0.rindex/1.rtrimstr/1.scalars/0.scan/1.scan/2.select/1.setpath/2.skip/2.sort/0.sort_by/1.split/1.splits/1.splits/2.sqrt/0.startswith/1.strftime/1.strings/0.strptime/1.sub/2.sub/3.test/1.test/2.to_entries/0.toboolean/0.todate/0.tojson/0.tostream/0.fromstream/1.truncate_stream/1.tonumber/0.tostring/0.transpose/0.trim/0.ltrim/0.rtrim/0.type/0.unique/0.unique_by/1.until/2.utf8bytelength/0.values/0.walk/1.while/2.with_entries/1`.split(`.`)];case`error`:throw new F(i.length>0?W(e,i[0],a)[0]:e);case`env`:return[a.env?n(a.env):Object.create(null)];case`debug`:return[e];case`input_line_number`:return[1];default:{let t=`${r}/${i.length}`,n=a.funcs?.get(t);if(n){let r=n.closure??a.funcs??new Map,o=new Map(r);o.set(t,n);for(let t=0;t<n.params.length;t++){let r=n.params[t],s=i[t];if(s){let t=W(e,s,a),n;if(t.length===0)n={type:`Call`,name:`empty`,args:[]};else if(t.length===1)n={type:`Literal`,value:t[0]};else{n={type:`Literal`,value:t[t.length-1]};for(let e=t.length-2;e>=0;e--)n={type:`Comma`,left:{type:`Literal`,value:t[e]},right:n}}o.set(`${r}/0`,{params:[],body:n})}}let s={...a,funcs:o};return W(e,n.body,s)}throw Error(`Unknown function: ${r}`)}}}function X(e,t,n,r,i){if(t.type===`Comma`){let a=t;X(e,a.left,n,r,i),X(e,a.right,n,r,i);return}let a=V(t);if(a!==null){i.push([...r,...a]);return}if(t.type===`Iterate`){if(Array.isArray(e))for(let t=0;t<e.length;t++)i.push([...r,t]);else if(e&&typeof e==`object`)for(let t of Object.keys(e))i.push([...r,t]);return}if(t.type===`Recurse`){let t=(e,n)=>{if(i.push([...r,...n]),e&&typeof e==`object`)if(Array.isArray(e))for(let r=0;r<e.length;r++)t(e[r],[...n,r]);else for(let r of Object.keys(e))t(e[r],[...n,r])};t(e,[]);return}if(t.type===`Pipe`){let a=V(t.left);if(a!==null){let o=W(e,t.left,n);for(let e of o)X(e,t.right,n,[...r,...a],i);return}}W(e,t,n).length>0&&i.push(r)}var Z=new Map([[`and`,`AND`],[`or`,`OR`],[`not`,`NOT`],[`if`,`IF`],[`then`,`THEN`],[`elif`,`ELIF`],[`else`,`ELSE`],[`end`,`END`],[`as`,`AS`],[`try`,`TRY`],[`catch`,`CATCH`],[`true`,`TRUE`],[`false`,`FALSE`],[`null`,`NULL`],[`reduce`,`REDUCE`],[`foreach`,`FOREACH`],[`label`,`LABEL`],[`break`,`BREAK`],[`def`,`DEF`]]),Q=new Set(Z.values());function $(e){let t=[],n=0,r=(t=0)=>e[n+t],i=()=>e[n++],a=()=>n>=e.length,o=e=>e>=`0`&&e<=`9`,s=e=>e>=`a`&&e<=`z`||e>=`A`&&e<=`Z`||e===`_`,c=e=>s(e)||o(e);for(;!a();){let l=n,u=i();if(!(u===` `||u===` `||u===`
|
|
3
3
|
`||u===`\r`)){if(u===`#`){for(;!a()&&r()!==`
|
|
4
4
|
`;)i();continue}if(u===`.`&&r()===`.`){i(),t.push({type:`DOTDOT`,pos:l});continue}if(u===`=`&&r()===`=`){i(),t.push({type:`EQ`,pos:l});continue}if(u===`!`&&r()===`=`){i(),t.push({type:`NE`,pos:l});continue}if(u===`<`&&r()===`=`){i(),t.push({type:`LE`,pos:l});continue}if(u===`>`&&r()===`=`){i(),t.push({type:`GE`,pos:l});continue}if(u===`/`&&r()===`/`){i(),r()===`=`?(i(),t.push({type:`UPDATE_ALT`,pos:l})):t.push({type:`ALT`,pos:l});continue}if(u===`+`&&r()===`=`){i(),t.push({type:`UPDATE_ADD`,pos:l});continue}if(u===`-`&&r()===`=`){i(),t.push({type:`UPDATE_SUB`,pos:l});continue}if(u===`*`&&r()===`=`){i(),t.push({type:`UPDATE_MUL`,pos:l});continue}if(u===`/`&&r()===`=`){i(),t.push({type:`UPDATE_DIV`,pos:l});continue}if(u===`%`&&r()===`=`){i(),t.push({type:`UPDATE_MOD`,pos:l});continue}if(u===`=`&&r()!==`=`){t.push({type:`ASSIGN`,pos:l});continue}if(u===`.`){t.push({type:`DOT`,pos:l});continue}if(u===`|`){r()===`=`?(i(),t.push({type:`UPDATE_PIPE`,pos:l})):t.push({type:`PIPE`,pos:l});continue}if(u===`,`){t.push({type:`COMMA`,pos:l});continue}if(u===`:`){t.push({type:`COLON`,pos:l});continue}if(u===`;`){t.push({type:`SEMICOLON`,pos:l});continue}if(u===`(`){t.push({type:`LPAREN`,pos:l});continue}if(u===`)`){t.push({type:`RPAREN`,pos:l});continue}if(u===`[`){t.push({type:`LBRACKET`,pos:l});continue}if(u===`]`){t.push({type:`RBRACKET`,pos:l});continue}if(u===`{`){t.push({type:`LBRACE`,pos:l});continue}if(u===`}`){t.push({type:`RBRACE`,pos:l});continue}if(u===`?`){t.push({type:`QUESTION`,pos:l});continue}if(u===`+`){t.push({type:`PLUS`,pos:l});continue}if(u===`-`){t.push({type:`MINUS`,pos:l});continue}if(u===`*`){t.push({type:`STAR`,pos:l});continue}if(u===`/`){t.push({type:`SLASH`,pos:l});continue}if(u===`%`){t.push({type:`PERCENT`,pos:l});continue}if(u===`<`){t.push({type:`LT`,pos:l});continue}if(u===`>`){t.push({type:`GT`,pos:l});continue}if(o(u)){let s=u;for(;!a()&&(o(r())||r()===`.`||r()===`e`||r()===`E`);)(r()===`e`||r()===`E`)&&(e[n+1]===`+`||e[n+1]===`-`)&&(s+=i()),s+=i();t.push({type:`NUMBER`,value:Number(s),pos:l});continue}if(u===`"`){let e=``;for(;!a()&&r()!==`"`;)if(r()===`\\`){if(i(),a())break;let t=i();switch(t){case`n`:e+=`
|
|
5
5
|
`;break;case`r`:e+=`\r`;break;case`t`:e+=` `;break;case`\\`:e+=`\\`;break;case`"`:e+=`"`;break;case`(`:e+=`\\(`;break;default:e+=t}}else e+=i();a()||i(),t.push({type:`STRING`,value:e,pos:l});continue}if(s(u)||u===`$`||u===`@`){let e=u;for(;!a()&&c(r());)e+=i();let n=Z.get(e);n?t.push({type:n,value:e,pos:l}):t.push({type:`IDENT`,value:e,pos:l});continue}throw Error(`Unexpected character '${u}' at position ${l}`)}}return t.push({type:`EOF`,pos:n}),t}var re=class e{tokens;pos=0;constructor(e){this.tokens=e}peek(e=0){return this.tokens[this.pos+e]??{type:`EOF`,pos:-1}}advance(){return this.tokens[this.pos++]}check(e){return this.peek().type===e}match(...e){for(let t of e)if(this.check(t))return this.advance();return null}expect(e,t){if(!this.check(e))throw Error(`${t} at position ${this.peek().pos}, got ${this.peek().type}`);return this.advance()}isFieldNameAfterDot(e=0){let t=this.peek(e),n=this.peek(e+1);return n.type===`STRING`?!0:n.type===`IDENT`||Q.has(n.type)?n.pos===t.pos+1:!1}isIdentLike(){let e=this.peek().type;return e===`IDENT`||Q.has(e)}consumeFieldNameAfterDot(e){let t=this.peek();return t.type===`STRING`||(t.type===`IDENT`||Q.has(t.type))&&t.pos===e.pos+1?this.advance().value:null}parse(){let e=this.parseExpr();if(!this.check(`EOF`))throw Error(`Unexpected token ${this.peek().type} at position ${this.peek().pos}`);return e}parseExpr(){return this.parsePipe()}parsePattern(){if(this.match(`LBRACKET`)){let e=[];if(!this.check(`RBRACKET`))for(e.push(this.parsePattern());this.match(`COMMA`)&&!this.check(`RBRACKET`);)e.push(this.parsePattern());return this.expect(`RBRACKET`,`Expected ']' after array pattern`),{type:`array`,elements:e}}if(this.match(`LBRACE`)){let e=[];if(!this.check(`RBRACE`))for(e.push(this.parsePatternField());this.match(`COMMA`)&&!this.check(`RBRACE`);)e.push(this.parsePatternField());return this.expect(`RBRACE`,`Expected '}' after object pattern`),{type:`object`,fields:e}}let e=this.expect(`IDENT`,`Expected variable name in pattern`),t=e.value;if(!t.startsWith(`$`))throw Error(`Variable name must start with $ at position ${e.pos}`);return{type:`var`,name:t}}parsePatternField(){if(this.match(`LPAREN`)){let e=this.parseExpr();return this.expect(`RPAREN`,`Expected ')' after computed key`),this.expect(`COLON`,`Expected ':' after computed key`),{key:e,pattern:this.parsePattern()}}let e=this.peek();if(e.type===`IDENT`||Q.has(e.type)){let t=e.value;if(t.startsWith(`$`)){if(this.advance(),this.match(`COLON`)){let e=this.parsePattern();return{key:t.slice(1),pattern:e,keyVar:t}}return{key:t.slice(1),pattern:{type:`var`,name:t}}}return this.advance(),this.match(`COLON`)?{key:t,pattern:this.parsePattern()}:{key:t,pattern:{type:`var`,name:`$${t}`}}}throw Error(`Expected field name in object pattern at position ${e.pos}`)}parsePipe(){let e=this.parseComma();for(;this.match(`PIPE`);){let t=this.parseComma();e={type:`Pipe`,left:e,right:t}}return e}parseComma(){let e=this.parseVarBind();for(;this.match(`COMMA`);){let t=this.parseVarBind();e={type:`Comma`,left:e,right:t}}return e}parseVarBind(){let e=this.parseUpdate();if(this.match(`AS`)){let t=this.parsePattern(),n=[];for(;this.check(`QUESTION`)&&this.peekAhead(1)?.type===`ALT`;)this.advance(),this.advance(),n.push(this.parsePattern());this.expect(`PIPE`,`Expected '|' after variable binding`);let r=this.parseExpr();return t.type===`var`&&n.length===0?{type:`VarBind`,name:t.name,value:e,body:r}:{type:`VarBind`,name:t.type===`var`?t.name:``,value:e,body:r,pattern:t.type===`var`?void 0:t,alternatives:n.length>0?n:void 0}}return e}peekAhead(e){let t=this.pos+e;return t<this.tokens.length?this.tokens[t]:void 0}parseUpdate(){let e=this.parseAlt(),t=new Map([[`ASSIGN`,`=`],[`UPDATE_ADD`,`+=`],[`UPDATE_SUB`,`-=`],[`UPDATE_MUL`,`*=`],[`UPDATE_DIV`,`/=`],[`UPDATE_MOD`,`%=`],[`UPDATE_ALT`,`//=`],[`UPDATE_PIPE`,`|=`]]),n=this.match(`ASSIGN`,`UPDATE_ADD`,`UPDATE_SUB`,`UPDATE_MUL`,`UPDATE_DIV`,`UPDATE_MOD`,`UPDATE_ALT`,`UPDATE_PIPE`);if(n){let r=this.parseVarBind(),i=t.get(n.type);if(i)return{type:`UpdateOp`,op:i,path:e,value:r}}return e}parseAlt(){let e=this.parseOr();for(;this.match(`ALT`);){let t=this.parseOr();e={type:`BinaryOp`,op:`//`,left:e,right:t}}return e}parseOr(){let e=this.parseAnd();for(;this.match(`OR`);){let t=this.parseAnd();e={type:`BinaryOp`,op:`or`,left:e,right:t}}return e}parseAnd(){let e=this.parseNot();for(;this.match(`AND`);){let t=this.parseNot();e={type:`BinaryOp`,op:`and`,left:e,right:t}}return e}parseNot(){return this.parseComparison()}parseComparison(){let e=this.parseAddSub(),t=new Map([[`EQ`,`==`],[`NE`,`!=`],[`LT`,`<`],[`LE`,`<=`],[`GT`,`>`],[`GE`,`>=`]]),n=this.match(`EQ`,`NE`,`LT`,`LE`,`GT`,`GE`);if(n){let r=t.get(n.type);if(r){let t=this.parseAddSub();e={type:`BinaryOp`,op:r,left:e,right:t}}}return e}parseAddSub(){let e=this.parseMulDiv();for(;;)if(this.match(`PLUS`)){let t=this.parseMulDiv();e={type:`BinaryOp`,op:`+`,left:e,right:t}}else if(this.match(`MINUS`)){let t=this.parseMulDiv();e={type:`BinaryOp`,op:`-`,left:e,right:t}}else break;return e}parseMulDiv(){let e=this.parseUnary();for(;;)if(this.match(`STAR`)){let t=this.parseUnary();e={type:`BinaryOp`,op:`*`,left:e,right:t}}else if(this.match(`SLASH`)){let t=this.parseUnary();e={type:`BinaryOp`,op:`/`,left:e,right:t}}else if(this.match(`PERCENT`)){let t=this.parseUnary();e={type:`BinaryOp`,op:`%`,left:e,right:t}}else break;return e}parseUnary(){return this.match(`MINUS`)?{type:`UnaryOp`,op:`-`,operand:this.parseUnary()}:this.parsePostfix()}parsePostfix(){let e=this.parsePrimary();for(;;)if(this.match(`QUESTION`))e={type:`Optional`,expr:e};else if(this.check(`DOT`)&&this.isFieldNameAfterDot())this.advance(),e={type:`Field`,name:this.advance().value,base:e};else if(this.check(`LBRACKET`))if(this.advance(),this.match(`RBRACKET`))e={type:`Iterate`,base:e};else if(this.check(`COLON`)){this.advance();let t=this.check(`RBRACKET`)?void 0:this.parseExpr();this.expect(`RBRACKET`,`Expected ']'`),e={type:`Slice`,end:t,base:e}}else{let t=this.parseExpr();if(this.match(`COLON`)){let n=this.check(`RBRACKET`)?void 0:this.parseExpr();this.expect(`RBRACKET`,`Expected ']'`),e={type:`Slice`,start:t,end:n,base:e}}else this.expect(`RBRACKET`,`Expected ']'`),e={type:`Index`,index:t,base:e}}else break;return e}parsePrimary(){if(this.match(`DOTDOT`))return{type:`Recurse`};if(this.check(`DOT`)){let e=this.advance();if(this.check(`LBRACKET`)){if(this.advance(),this.match(`RBRACKET`))return{type:`Iterate`};if(this.check(`COLON`)){this.advance();let e=this.check(`RBRACKET`)?void 0:this.parseExpr();return this.expect(`RBRACKET`,`Expected ']'`),{type:`Slice`,end:e}}let e=this.parseExpr();if(this.match(`COLON`)){let t=this.check(`RBRACKET`)?void 0:this.parseExpr();return this.expect(`RBRACKET`,`Expected ']'`),{type:`Slice`,start:e,end:t}}return this.expect(`RBRACKET`,`Expected ']'`),{type:`Index`,index:e}}let t=this.consumeFieldNameAfterDot(e);return t===null?{type:`Identity`}:{type:`Field`,name:t}}if(this.match(`TRUE`))return{type:`Literal`,value:!0};if(this.match(`FALSE`))return{type:`Literal`,value:!1};if(this.match(`NULL`))return{type:`Literal`,value:null};if(this.check(`NUMBER`))return{type:`Literal`,value:this.advance().value};if(this.check(`STRING`)){let e=this.advance().value;return e.includes(`\\(`)?this.parseStringInterpolation(e):{type:`Literal`,value:e}}if(this.match(`LBRACKET`)){if(this.match(`RBRACKET`))return{type:`Array`};let e=this.parseExpr();return this.expect(`RBRACKET`,`Expected ']'`),{type:`Array`,elements:e}}if(this.match(`LBRACE`))return this.parseObjectConstruction();if(this.match(`LPAREN`)){let e=this.parseExpr();return this.expect(`RPAREN`,`Expected ')'`),{type:`Paren`,expr:e}}if(this.match(`IF`))return this.parseIf();if(this.match(`TRY`)){let e=this.parsePostfix(),t;return this.match(`CATCH`)&&(t=this.parsePostfix()),{type:`Try`,body:e,catch:t}}if(this.match(`REDUCE`)){let e=this.parseAddSub();this.expect(`AS`,`Expected 'as' after reduce expression`);let t=this.parsePattern();this.expect(`LPAREN`,`Expected '(' after variable`);let n=this.parseExpr();this.expect(`SEMICOLON`,`Expected ';' after init expression`);let r=this.parseExpr();return this.expect(`RPAREN`,`Expected ')' after update expression`),{type:`Reduce`,expr:e,varName:t.type===`var`?t.name:``,init:n,update:r,pattern:t.type===`var`?void 0:t}}if(this.match(`FOREACH`)){let e=this.parseAddSub();this.expect(`AS`,`Expected 'as' after foreach expression`);let t=this.parsePattern();this.expect(`LPAREN`,`Expected '(' after variable`);let n=this.parseExpr();this.expect(`SEMICOLON`,`Expected ';' after init expression`);let r=this.parseExpr(),i;return this.match(`SEMICOLON`)&&(i=this.parseExpr()),this.expect(`RPAREN`,`Expected ')' after expressions`),{type:`Foreach`,expr:e,varName:t.type===`var`?t.name:``,init:n,update:r,extract:i,pattern:t.type===`var`?void 0:t}}if(this.match(`LABEL`)){let e=this.expect(`IDENT`,`Expected label name (e.g., $out)`),t=e.value;if(!t.startsWith(`$`))throw Error(`Label name must start with $ at position ${e.pos}`);return this.expect(`PIPE`,`Expected '|' after label name`),{type:`Label`,name:t,body:this.parseExpr()}}if(this.match(`BREAK`)){let e=this.expect(`IDENT`,`Expected label name to break to`),t=e.value;if(!t.startsWith(`$`))throw Error(`Break label must start with $ at position ${e.pos}`);return{type:`Break`,name:t}}if(this.match(`DEF`)){let e=this.expect(`IDENT`,`Expected function name after def`).value,t=[];if(this.match(`LPAREN`)){if(!this.check(`RPAREN`)){let e=this.expect(`IDENT`,`Expected parameter name`);for(t.push(e.value);this.match(`SEMICOLON`);){let e=this.expect(`IDENT`,`Expected parameter name`);t.push(e.value)}}this.expect(`RPAREN`,`Expected ')' after parameters`)}this.expect(`COLON`,`Expected ':' after function name`);let n=this.parseExpr();return this.expect(`SEMICOLON`,`Expected ';' after function body`),{type:`Def`,name:e,params:t,funcBody:n,body:this.parseExpr()}}if(this.match(`NOT`))return{type:`Call`,name:`not`,args:[]};if(this.check(`IDENT`)){let e=this.advance().value;if(e.startsWith(`$`))return{type:`VarRef`,name:e};if(this.match(`LPAREN`)){let t=[];if(!this.check(`RPAREN`))for(t.push(this.parseExpr());this.match(`SEMICOLON`);)t.push(this.parseExpr());return this.expect(`RPAREN`,`Expected ')'`),{type:`Call`,name:e,args:t}}return{type:`Call`,name:e,args:[]}}throw Error(`Unexpected token ${this.peek().type} at position ${this.peek().pos}`)}parseObjectConstruction(){let e=[];if(!this.check(`RBRACE`))do{let t,n;if(this.match(`LPAREN`))t=this.parseExpr(),this.expect(`RPAREN`,`Expected ')'`),this.expect(`COLON`,`Expected ':'`),n=this.parseObjectValue();else if(this.isIdentLike()){let e=this.advance().value;this.match(`COLON`)?(t=e,n=this.parseObjectValue()):(t=e,n={type:`Field`,name:e})}else if(this.check(`STRING`))t=this.advance().value,this.expect(`COLON`,`Expected ':'`),n=this.parseObjectValue();else throw Error(`Expected object key at position ${this.peek().pos}`);e.push({key:t,value:n})}while(this.match(`COMMA`));return this.expect(`RBRACE`,`Expected '}'`),{type:`Object`,entries:e}}parseObjectValue(){let e=this.parseVarBind();for(;this.match(`PIPE`);){let t=this.parseVarBind();e={type:`Pipe`,left:e,right:t}}return e}parseIf(){let e=this.parseExpr();this.expect(`THEN`,`Expected 'then'`);let t=this.parseExpr(),n=[];for(;this.match(`ELIF`);){let e=this.parseExpr();this.expect(`THEN`,`Expected 'then' after elif`);let t=this.parseExpr();n.push({cond:e,then:t})}let r;return this.match(`ELSE`)&&(r=this.parseExpr()),this.expect(`END`,`Expected 'end'`),{type:`Cond`,cond:e,then:t,elifs:n,else:r}}parseStringInterpolation(t){let n=[],r=``,i=0;for(;i<t.length;)if(t[i]===`\\`&&t[i+1]===`(`){r&&=(n.push(r),``),i+=2;let a=1,o=``;for(;i<t.length&&a>0;)t[i]===`(`?a++:t[i]===`)`&&a--,a>0&&(o+=t[i]),i++;let s=new e($(o));n.push(s.parse())}else r+=t[i],i++;return r&&n.push(r),{type:`StringInterp`,parts:n}}};function ie(e){return new re($(e)).parse()}export{W as n,ie as t};
|
|
6
|
-
//# sourceMappingURL=chunk-BBXLRYSX-
|
|
6
|
+
//# sourceMappingURL=chunk-BBXLRYSX-Oks1GMhO.mjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e,t}from"./chunk-FK9Q3tQk.mjs";import{t as n}from"./chunk-YNYSPYQ5-DesxOVHh.mjs";import{t as r}from"./chunk-5QMZ5MUS-CAp625aG.mjs";import{n as i,r as a,t as o}from"./chunk-74CEPOFO-D1bzz49u.mjs";import{t as s}from"./chunk-X2AJGDEF-BaH6i1Rq.mjs";var c=t(((e,t)=>{var n=[0,1,3,7,15,31,63,127,255],r=function(e){this.stream=e,this.bitOffset=0,this.curByte=0,this.hasByte=!1};r.prototype._ensureByte=function(){this.hasByte||=(this.curByte=this.stream.readByte(),!0)},r.prototype.read=function(e){for(var t=0;e>0;){this._ensureByte();var r=8-this.bitOffset;if(e>=r)t<<=r,t|=n[r]&this.curByte,this.hasByte=!1,this.bitOffset=0,e-=r;else{t<<=e;var i=r-e;t|=(this.curByte&n[e]<<i)>>i,this.bitOffset+=e,e=0}}return t},r.prototype.seek=function(e){var t=e%8,n=(e-t)/8;this.bitOffset=t,this.stream.seek(n),this.hasByte=!1},r.prototype.pi=function(){var e=new Buffer(6),t;for(t=0;t<e.length;t++)e[t]=this.read(8);return e.toString(`hex`)},t.exports=r})),l=t(((e,t)=>{var n=function(){};n.prototype.readByte=function(){throw Error(`abstract method readByte() not implemented`)},n.prototype.read=function(e,t,n){for(var r=0;r<n;){var i=this.readByte();if(i<0)return r===0?-1:r;e[t++]=i,r++}return r},n.prototype.seek=function(e){throw Error(`abstract method seek() not implemented`)},n.prototype.writeByte=function(e){throw Error(`abstract method readByte() not implemented`)},n.prototype.write=function(e,t,n){var r;for(r=0;r<n;r++)this.writeByte(e[t++]);return n},n.prototype.flush=function(){},t.exports=n})),u=t(((e,t)=>{t.exports=(function(){var e=new Uint32Array([0,79764919,159529838,222504665,319059676,398814059,445009330,507990021,638119352,583659535,797628118,726387553,890018660,835552979,1015980042,944750013,1276238704,1221641927,1167319070,1095957929,1595256236,1540665371,1452775106,1381403509,1780037320,1859660671,1671105958,1733955601,2031960084,2111593891,1889500026,1952343757,2552477408,2632100695,2443283854,2506133561,2334638140,2414271883,2191915858,2254759653,3190512472,3135915759,3081330742,3009969537,2905550212,2850959411,2762807018,2691435357,3560074640,3505614887,3719321342,3648080713,3342211916,3287746299,3467911202,3396681109,4063920168,4143685023,4223187782,4286162673,3779000052,3858754371,3904687514,3967668269,881225847,809987520,1023691545,969234094,662832811,591600412,771767749,717299826,311336399,374308984,453813921,533576470,25881363,88864420,134795389,214552010,2023205639,2086057648,1897238633,1976864222,1804852699,1867694188,1645340341,1724971778,1587496639,1516133128,1461550545,1406951526,1302016099,1230646740,1142491917,1087903418,2896545431,2825181984,2770861561,2716262478,3215044683,3143675388,3055782693,3001194130,2326604591,2389456536,2200899649,2280525302,2578013683,2640855108,2418763421,2498394922,3769900519,3832873040,3912640137,3992402750,4088425275,4151408268,4197601365,4277358050,3334271071,3263032808,3476998961,3422541446,3585640067,3514407732,3694837229,3640369242,1762451694,1842216281,1619975040,1682949687,2047383090,2127137669,1938468188,2001449195,1325665622,1271206113,1183200824,1111960463,1543535498,1489069629,1434599652,1363369299,622672798,568075817,748617968,677256519,907627842,853037301,1067152940,995781531,51762726,131386257,177728840,240578815,269590778,349224269,429104020,491947555,4046411278,4126034873,4172115296,4234965207,3794477266,3874110821,3953728444,4016571915,3609705398,3555108353,3735388376,3664026991,3290680682,3236090077,3449943556,3378572211,3174993278,3120533705,3032266256,2961025959,2923101090,2868635157,2813903052,2742672763,2604032198,2683796849,2461293480,2524268063,2284983834,2364738477,2175806836,2238787779,1569362073,1498123566,1409854455,1355396672,1317987909,1246755826,1192025387,1137557660,2072149281,2135122070,1912620623,1992383480,1753615357,1816598090,1627664531,1707420964,295390185,358241886,404320391,483945776,43990325,106832002,186451547,266083308,932423249,861060070,1041341759,986742920,613929101,542559546,756411363,701822548,3316196985,3244833742,3425377559,3370778784,3601682597,3530312978,3744426955,3689838204,3819031489,3881883254,3928223919,4007849240,4037393693,4100235434,4180117107,4259748804,2310601993,2373574846,2151335527,2231098320,2596047829,2659030626,2470359227,2550115596,2947551409,2876312838,2788305887,2733848168,3165939309,3094707162,3040238851,2985771188]);return function(){var t=4294967295;this.getCRC=function(){return~t>>>0},this.updateCRC=function(n){t=t<<8^e[(t>>>24^n)&255]},this.updateCRCRun=function(n,r){for(;r-- >0;)t=t<<8^e[(t>>>24^n)&255]}}})()})),d=t(((e,t)=>{t.exports={name:`seek-bzip`,version:`2.0.0`,contributors:[`C. Scott Ananian (http://cscott.net)`,`Eli Skeggs`,`Kevin Kwok`,`Rob Landley (http://landley.net)`],description:`a pure-JavaScript Node.JS module for random-access decoding bzip2 data`,main:`./lib/index.js`,repository:{type:`git`,url:`https://github.com/cscott/seek-bzip.git`},license:`MIT`,bin:{"seek-bunzip":`./bin/seek-bunzip`,"seek-table":`./bin/seek-bzip-table`},directories:{test:`test`},dependencies:{commander:`^6.0.0`},devDependencies:{fibers:`^5.0.0`,mocha:`^8.1.0`},scripts:{test:`mocha`}}})),f=e(t(((e,t)=>{var n=c(),r=l(),i=u(),a=d(),o=20,s=258,f=0,p=1,m=2,h=6,g=50,_=`314159265359`,v=`177245385090`,y=function(e,t){var n=e[t],r;for(r=t;r>0;r--)e[r]=e[r-1];return e[0]=n,n},b={OK:0,LAST_BLOCK:-1,NOT_BZIP_DATA:-2,UNEXPECTED_INPUT_EOF:-3,UNEXPECTED_OUTPUT_EOF:-4,DATA_ERROR:-5,OUT_OF_MEMORY:-6,OBSOLETE_INPUT:-7,END_OF_BLOCK:-8},x={};x[b.LAST_BLOCK]=`Bad file checksum`,x[b.NOT_BZIP_DATA]=`Not bzip data`,x[b.UNEXPECTED_INPUT_EOF]=`Unexpected input EOF`,x[b.UNEXPECTED_OUTPUT_EOF]=`Unexpected output EOF`,x[b.DATA_ERROR]=`Data error`,x[b.OUT_OF_MEMORY]=`Out of memory`,x[b.OBSOLETE_INPUT]=`Obsolete (pre 0.9.5) bzip format not supported.`;var S=function(e,t){var n=x[e]||`unknown error`;t&&(n+=`: `+t);var r=TypeError(n);throw r.errorCode=e,r},C=function(e,t){this.writePos=this.writeCurrent=this.writeCount=0,this._start_bunzip(e,t)};C.prototype._init_block=function(){return this._get_next_block()?(this.blockCRC=new i,!0):(this.writeCount=-1,!1)},C.prototype._start_bunzip=function(e,t){var r=new Buffer(4);(e.read(r,0,4)!==4||String.fromCharCode(r[0],r[1],r[2])!==`BZh`)&&S(b.NOT_BZIP_DATA,`bad magic`);var i=r[3]-48;(i<1||i>9)&&S(b.NOT_BZIP_DATA,`level out of range`),this.reader=new n(e),this.dbufSize=1e5*i,this.nextoutput=0,this.outputStream=t,this.streamCRC=0},C.prototype._get_next_block=function(){var e,t,n,r=this.reader,i=r.pi();if(i===v)return!1;i!==_&&S(b.NOT_BZIP_DATA),this.targetBlockCRC=r.read(32)>>>0,this.streamCRC=(this.targetBlockCRC^(this.streamCRC<<1|this.streamCRC>>>31))>>>0,r.read(1)&&S(b.OBSOLETE_INPUT);var a=r.read(24);a>this.dbufSize&&S(b.DATA_ERROR,`initial position out of bounds`);var c=r.read(16),l=new Buffer(256),u=0;for(e=0;e<16;e++)if(c&1<<15-e){var d=e*16;for(n=r.read(16),t=0;t<16;t++)n&1<<15-t&&(l[u++]=d+t)}var x=r.read(3);(x<m||x>h)&&S(b.DATA_ERROR);var C=r.read(15);C===0&&S(b.DATA_ERROR);var w=new Buffer(256);for(e=0;e<x;e++)w[e]=e;var T=new Buffer(C);for(e=0;e<C;e++){for(t=0;r.read(1);t++)t>=x&&S(b.DATA_ERROR);T[e]=y(w,t)}var E=u+2,D=[],O;for(t=0;t<x;t++){var k=new Buffer(E),A=new Uint16Array(o+1);for(c=r.read(5),e=0;e<E;e++){for(;(c<1||c>o)&&S(b.DATA_ERROR),r.read(1);)r.read(1)?c--:c++;k[e]=c}var j=M=k[0],M;for(e=1;e<E;e++)k[e]>M?M=k[e]:k[e]<j&&(j=k[e]);O={},D.push(O),O.permute=new Uint16Array(s),O.limit=new Uint32Array(o+2),O.base=new Uint32Array(o+1),O.minLen=j,O.maxLen=M;var N=0;for(e=j;e<=M;e++)for(A[e]=O.limit[e]=0,c=0;c<E;c++)k[c]===e&&(O.permute[N++]=c);for(e=0;e<E;e++)A[k[e]]++;for(N=c=0,e=j;e<M;e++)N+=A[e],O.limit[e]=N-1,N<<=1,c+=A[e],O.base[e+1]=N-c;O.limit[M+1]=Number.MAX_VALUE,O.limit[M]=N+A[M]-1,O.base[j]=0}var P=new Uint32Array(256);for(e=0;e<256;e++)w[e]=e;var F=0,I=0,L=0,R,z=this.dbuf=new Uint32Array(this.dbufSize);for(E=0;;){for(E--||(E=g-1,L>=C&&S(b.DATA_ERROR),O=D[T[L++]]),e=O.minLen,t=r.read(e);e>O.maxLen&&S(b.DATA_ERROR),!(t<=O.limit[e]);e++)t=t<<1|r.read(1);t-=O.base[e],(t<0||t>=s)&&S(b.DATA_ERROR);var B=O.permute[t];if(B===f||B===p){F||(F=1,c=0),B===f?c+=F:c+=2*F,F<<=1;continue}if(F)for(F=0,I+c>this.dbufSize&&S(b.DATA_ERROR),R=l[w[0]],P[R]+=c;c--;)z[I++]=R;if(B>u)break;I>=this.dbufSize&&S(b.DATA_ERROR),e=B-1,R=y(w,e),R=l[R],P[R]++,z[I++]=R}for((a<0||a>=I)&&S(b.DATA_ERROR),t=0,e=0;e<256;e++)n=t+P[e],P[e]=t,t=n;for(e=0;e<I;e++)R=z[e]&255,z[P[R]]|=e<<8,P[R]++;var V=0,ee=0,te=0;return I&&(V=z[a],ee=V&255,V>>=8,te=-1),this.writePos=V,this.writeCurrent=ee,this.writeCount=I,this.writeRun=te,!0},C.prototype._read_bunzip=function(e,t){var n,r,i;if(this.writeCount<0)return 0;var a=this.dbuf,o=this.writePos,s=this.writeCurrent,c=this.writeCount;this.outputsize;for(var l=this.writeRun;c;){for(c--,r=s,o=a[o],s=o&255,o>>=8,l++===3?(n=s,i=r,s=-1):(n=1,i=s),this.blockCRC.updateCRCRun(i,n);n--;)this.outputStream.writeByte(i),this.nextoutput++;s!=r&&(l=0)}return this.writeCount=c,this.blockCRC.getCRC()!==this.targetBlockCRC&&S(b.DATA_ERROR,`Bad block CRC (got `+this.blockCRC.getCRC().toString(16)+` expected `+this.targetBlockCRC.toString(16)+`)`),this.nextoutput};var w=function(e){if(`readByte`in e)return e;var t=new r;return t.pos=0,t.readByte=function(){return e[this.pos++]},t.seek=function(e){this.pos=e},t.eof=function(){return this.pos>=e.length},t},T=function(e){var t=new r,n=!0;if(e)if(typeof e==`number`)t.buffer=new Buffer(e),n=!1;else if(`writeByte`in e)return e;else t.buffer=e,n=!1;else t.buffer=new Buffer(16384);return t.pos=0,t.writeByte=function(e){if(n&&this.pos>=this.buffer.length){var t=new Buffer(this.buffer.length*2);this.buffer.copy(t),this.buffer=t}this.buffer[this.pos++]=e},t.getBuffer=function(){if(this.pos!==this.buffer.length){if(!n)throw TypeError(`outputsize does not match decoded input`);var e=new Buffer(this.pos);this.buffer.copy(e,0,0,this.pos),this.buffer=e}return this.buffer},t._coerced=!0,t};C.Err=b,C.decode=function(e,t,n){for(var r=w(e),i=T(t),a=new C(r,i);!(`eof`in r&&r.eof());)if(a._init_block())a._read_bunzip();else{var o=a.reader.read(32)>>>0;if(o!==a.streamCRC&&S(b.DATA_ERROR,`Bad stream CRC (got `+a.streamCRC.toString(16)+` expected `+o.toString(16)+`)`),n&&`eof`in r&&!r.eof())a._start_bunzip(r,i);else break}if(`getBuffer`in i)return i.getBuffer()},C.decodeBlock=function(e,t,n){var r=w(e),a=T(n),o=new C(r,a);if(o.reader.seek(t),o._get_next_block()&&(o.blockCRC=new i,o.writeCopies=0,o._read_bunzip()),`getBuffer`in a)return a.getBuffer()},C.table=function(e,t,n){var i=new r;i.delegate=w(e),i.pos=0,i.readByte=function(){return this.pos++,this.delegate.readByte()},i.delegate.eof&&(i.eof=i.delegate.eof.bind(i.delegate));var a=new r;a.pos=0,a.writeByte=function(){this.pos++};for(var o=new C(i,a),s=o.dbufSize;!(`eof`in i&&i.eof());){var c=i.pos*8+o.reader.bitOffset;if(o.reader.hasByte&&(c-=8),o._init_block()){var l=a.pos;o._read_bunzip(),t(c,a.pos-l)}else if(o.reader.read(32),n&&`eof`in i&&!i.eof())o._start_bunzip(i,a),console.assert(o.dbufSize===s,`shouldn't change block size within multistream file`);else break}},C.Stream=r,C.version=a.version,C.license=a.license,t.exports=C}))(),1),p=`file`,m=`link`,h=`symlink`,g=`directory`,_={file:`0`,link:`1`,symlink:`2`,"character-device":`3`,"block-device":`4`,directory:`5`,fifo:`6`,"pax-header":`x`,"pax-global-header":`g`,"gnu-long-name":`L`,"gnu-long-link-name":`K`},v={0:p,1:m,2:h,3:`character-device`,4:`block-device`,5:g,6:`fifo`,x:`pax-header`,g:`pax-global-header`,L:`gnu-long-name`,K:`gnu-long-link-name`},y=new Uint8Array(512),b=new Uint8Array,x=new TextEncoder,S=new TextDecoder;function C(e,t,n,r){r&&x.encodeInto(r,e.subarray(t,t+n))}function w(e,t,n,r){if(r===void 0)return;let i=r.toString(8).padStart(n-1,`0`);x.encodeInto(i,e.subarray(t,t+n-1))}function T(e,t,n){let r=e.indexOf(0,t),i=r===-1||r>t+n?t+n:r;return S.decode(e.subarray(t,i))}function E(e,t,n){let r=0,i=t+n;for(let n=t;n<i;n++){let t=e[n];if(t===0)break;t!==32&&(r=r*8+(t-48))}return r}function D(e,t,n){if(e[t]&128){let r=0;r=e[t]&127;for(let i=1;i<n;i++)r=r*256+e[t+i];if(!Number.isSafeInteger(r))throw Error(`TAR number too large`);return r}return E(e,t,n)}var O=e=>e.type===g||e.type===h||e.type===m;async function k(e){if(e==null)return b;if(e instanceof Uint8Array)return e;if(typeof e==`string`)return x.encode(e);if(e instanceof ArrayBuffer)return new Uint8Array(e);if(e instanceof Blob)return new Uint8Array(await e.arrayBuffer());throw TypeError(`Unsupported content type for entry body.`)}function A(e,t){let{strip:n,filter:r,map:i}=t;if(!n&&!r&&!i)return e;let a={...e};if(n&&n>0){let e=a.name.split(`/`).filter(Boolean);if(n>=e.length)return null;let t=e.slice(n).join(`/`);if(a.name=a.type===g&&!t.endsWith(`/`)?`${t}/`:t,a.linkname?.startsWith(`/`)){let e=a.linkname.split(`/`).filter(Boolean);a.linkname=n>=e.length?`/`:`/${e.slice(n).join(`/`)}`}}if(r?.(a)===!1)return null;let o=i?i(a):a;return o&&(!o.name||!o.name.trim()||o.name===`.`||o.name===`/`)?null:o}var j=32,M=48;function N(e){let t=E(e,148,8),n=0;for(let t=0;t<e.length;t++)t>=148&&t<156?n+=j:n+=e[t];return t===n}function P(e){e.fill(j,148,156);let t=0;for(let n of e)t+=n;for(let n=153;n>=148;n--)e[n]=(t&7)+M,t>>=3;e[154]=0,e[155]=j}function F(e){let t={};e.name.length>100&&I(e.name)===null&&(t.path=e.name),e.linkname&&e.linkname.length>100&&(t.linkpath=e.linkname),e.uname&&e.uname.length>32&&(t.uname=e.uname),e.gname&&e.gname.length>32&&(t.gname=e.gname),e.uid!=null&&e.uid>2097151&&(t.uid=String(e.uid)),e.gid!=null&&e.gid>2097151&&(t.gid=String(e.gid)),e.size!=null&&e.size>8589934591&&(t.size=String(e.size)),e.pax&&Object.assign(t,e.pax);let n=Object.entries(t);if(n.length===0)return null;let r=x.encode(n.map(([e,t])=>{let n=`${e}=${t}
|
|
1
|
+
import{o as e,t}from"./chunk-FK9Q3tQk.mjs";import{t as n}from"./chunk-YNYSPYQ5-iQGTFdx0.mjs";import{t as r}from"./chunk-5QMZ5MUS-BfIuRNkK.mjs";import{n as i,r as a,t as o}from"./chunk-74CEPOFO-D1bzz49u.mjs";import{t as s}from"./chunk-X2AJGDEF-BaH6i1Rq.mjs";var c=t(((e,t)=>{var n=[0,1,3,7,15,31,63,127,255],r=function(e){this.stream=e,this.bitOffset=0,this.curByte=0,this.hasByte=!1};r.prototype._ensureByte=function(){this.hasByte||=(this.curByte=this.stream.readByte(),!0)},r.prototype.read=function(e){for(var t=0;e>0;){this._ensureByte();var r=8-this.bitOffset;if(e>=r)t<<=r,t|=n[r]&this.curByte,this.hasByte=!1,this.bitOffset=0,e-=r;else{t<<=e;var i=r-e;t|=(this.curByte&n[e]<<i)>>i,this.bitOffset+=e,e=0}}return t},r.prototype.seek=function(e){var t=e%8,n=(e-t)/8;this.bitOffset=t,this.stream.seek(n),this.hasByte=!1},r.prototype.pi=function(){var e=new Buffer(6),t;for(t=0;t<e.length;t++)e[t]=this.read(8);return e.toString(`hex`)},t.exports=r})),l=t(((e,t)=>{var n=function(){};n.prototype.readByte=function(){throw Error(`abstract method readByte() not implemented`)},n.prototype.read=function(e,t,n){for(var r=0;r<n;){var i=this.readByte();if(i<0)return r===0?-1:r;e[t++]=i,r++}return r},n.prototype.seek=function(e){throw Error(`abstract method seek() not implemented`)},n.prototype.writeByte=function(e){throw Error(`abstract method readByte() not implemented`)},n.prototype.write=function(e,t,n){var r;for(r=0;r<n;r++)this.writeByte(e[t++]);return n},n.prototype.flush=function(){},t.exports=n})),u=t(((e,t)=>{t.exports=(function(){var e=new Uint32Array([0,79764919,159529838,222504665,319059676,398814059,445009330,507990021,638119352,583659535,797628118,726387553,890018660,835552979,1015980042,944750013,1276238704,1221641927,1167319070,1095957929,1595256236,1540665371,1452775106,1381403509,1780037320,1859660671,1671105958,1733955601,2031960084,2111593891,1889500026,1952343757,2552477408,2632100695,2443283854,2506133561,2334638140,2414271883,2191915858,2254759653,3190512472,3135915759,3081330742,3009969537,2905550212,2850959411,2762807018,2691435357,3560074640,3505614887,3719321342,3648080713,3342211916,3287746299,3467911202,3396681109,4063920168,4143685023,4223187782,4286162673,3779000052,3858754371,3904687514,3967668269,881225847,809987520,1023691545,969234094,662832811,591600412,771767749,717299826,311336399,374308984,453813921,533576470,25881363,88864420,134795389,214552010,2023205639,2086057648,1897238633,1976864222,1804852699,1867694188,1645340341,1724971778,1587496639,1516133128,1461550545,1406951526,1302016099,1230646740,1142491917,1087903418,2896545431,2825181984,2770861561,2716262478,3215044683,3143675388,3055782693,3001194130,2326604591,2389456536,2200899649,2280525302,2578013683,2640855108,2418763421,2498394922,3769900519,3832873040,3912640137,3992402750,4088425275,4151408268,4197601365,4277358050,3334271071,3263032808,3476998961,3422541446,3585640067,3514407732,3694837229,3640369242,1762451694,1842216281,1619975040,1682949687,2047383090,2127137669,1938468188,2001449195,1325665622,1271206113,1183200824,1111960463,1543535498,1489069629,1434599652,1363369299,622672798,568075817,748617968,677256519,907627842,853037301,1067152940,995781531,51762726,131386257,177728840,240578815,269590778,349224269,429104020,491947555,4046411278,4126034873,4172115296,4234965207,3794477266,3874110821,3953728444,4016571915,3609705398,3555108353,3735388376,3664026991,3290680682,3236090077,3449943556,3378572211,3174993278,3120533705,3032266256,2961025959,2923101090,2868635157,2813903052,2742672763,2604032198,2683796849,2461293480,2524268063,2284983834,2364738477,2175806836,2238787779,1569362073,1498123566,1409854455,1355396672,1317987909,1246755826,1192025387,1137557660,2072149281,2135122070,1912620623,1992383480,1753615357,1816598090,1627664531,1707420964,295390185,358241886,404320391,483945776,43990325,106832002,186451547,266083308,932423249,861060070,1041341759,986742920,613929101,542559546,756411363,701822548,3316196985,3244833742,3425377559,3370778784,3601682597,3530312978,3744426955,3689838204,3819031489,3881883254,3928223919,4007849240,4037393693,4100235434,4180117107,4259748804,2310601993,2373574846,2151335527,2231098320,2596047829,2659030626,2470359227,2550115596,2947551409,2876312838,2788305887,2733848168,3165939309,3094707162,3040238851,2985771188]);return function(){var t=4294967295;this.getCRC=function(){return~t>>>0},this.updateCRC=function(n){t=t<<8^e[(t>>>24^n)&255]},this.updateCRCRun=function(n,r){for(;r-- >0;)t=t<<8^e[(t>>>24^n)&255]}}})()})),d=t(((e,t)=>{t.exports={name:`seek-bzip`,version:`2.0.0`,contributors:[`C. Scott Ananian (http://cscott.net)`,`Eli Skeggs`,`Kevin Kwok`,`Rob Landley (http://landley.net)`],description:`a pure-JavaScript Node.JS module for random-access decoding bzip2 data`,main:`./lib/index.js`,repository:{type:`git`,url:`https://github.com/cscott/seek-bzip.git`},license:`MIT`,bin:{"seek-bunzip":`./bin/seek-bunzip`,"seek-table":`./bin/seek-bzip-table`},directories:{test:`test`},dependencies:{commander:`^6.0.0`},devDependencies:{fibers:`^5.0.0`,mocha:`^8.1.0`},scripts:{test:`mocha`}}})),f=e(t(((e,t)=>{var n=c(),r=l(),i=u(),a=d(),o=20,s=258,f=0,p=1,m=2,h=6,g=50,_=`314159265359`,v=`177245385090`,y=function(e,t){var n=e[t],r;for(r=t;r>0;r--)e[r]=e[r-1];return e[0]=n,n},b={OK:0,LAST_BLOCK:-1,NOT_BZIP_DATA:-2,UNEXPECTED_INPUT_EOF:-3,UNEXPECTED_OUTPUT_EOF:-4,DATA_ERROR:-5,OUT_OF_MEMORY:-6,OBSOLETE_INPUT:-7,END_OF_BLOCK:-8},x={};x[b.LAST_BLOCK]=`Bad file checksum`,x[b.NOT_BZIP_DATA]=`Not bzip data`,x[b.UNEXPECTED_INPUT_EOF]=`Unexpected input EOF`,x[b.UNEXPECTED_OUTPUT_EOF]=`Unexpected output EOF`,x[b.DATA_ERROR]=`Data error`,x[b.OUT_OF_MEMORY]=`Out of memory`,x[b.OBSOLETE_INPUT]=`Obsolete (pre 0.9.5) bzip format not supported.`;var S=function(e,t){var n=x[e]||`unknown error`;t&&(n+=`: `+t);var r=TypeError(n);throw r.errorCode=e,r},C=function(e,t){this.writePos=this.writeCurrent=this.writeCount=0,this._start_bunzip(e,t)};C.prototype._init_block=function(){return this._get_next_block()?(this.blockCRC=new i,!0):(this.writeCount=-1,!1)},C.prototype._start_bunzip=function(e,t){var r=new Buffer(4);(e.read(r,0,4)!==4||String.fromCharCode(r[0],r[1],r[2])!==`BZh`)&&S(b.NOT_BZIP_DATA,`bad magic`);var i=r[3]-48;(i<1||i>9)&&S(b.NOT_BZIP_DATA,`level out of range`),this.reader=new n(e),this.dbufSize=1e5*i,this.nextoutput=0,this.outputStream=t,this.streamCRC=0},C.prototype._get_next_block=function(){var e,t,n,r=this.reader,i=r.pi();if(i===v)return!1;i!==_&&S(b.NOT_BZIP_DATA),this.targetBlockCRC=r.read(32)>>>0,this.streamCRC=(this.targetBlockCRC^(this.streamCRC<<1|this.streamCRC>>>31))>>>0,r.read(1)&&S(b.OBSOLETE_INPUT);var a=r.read(24);a>this.dbufSize&&S(b.DATA_ERROR,`initial position out of bounds`);var c=r.read(16),l=new Buffer(256),u=0;for(e=0;e<16;e++)if(c&1<<15-e){var d=e*16;for(n=r.read(16),t=0;t<16;t++)n&1<<15-t&&(l[u++]=d+t)}var x=r.read(3);(x<m||x>h)&&S(b.DATA_ERROR);var C=r.read(15);C===0&&S(b.DATA_ERROR);var w=new Buffer(256);for(e=0;e<x;e++)w[e]=e;var T=new Buffer(C);for(e=0;e<C;e++){for(t=0;r.read(1);t++)t>=x&&S(b.DATA_ERROR);T[e]=y(w,t)}var E=u+2,D=[],O;for(t=0;t<x;t++){var k=new Buffer(E),A=new Uint16Array(o+1);for(c=r.read(5),e=0;e<E;e++){for(;(c<1||c>o)&&S(b.DATA_ERROR),r.read(1);)r.read(1)?c--:c++;k[e]=c}var j=M=k[0],M;for(e=1;e<E;e++)k[e]>M?M=k[e]:k[e]<j&&(j=k[e]);O={},D.push(O),O.permute=new Uint16Array(s),O.limit=new Uint32Array(o+2),O.base=new Uint32Array(o+1),O.minLen=j,O.maxLen=M;var N=0;for(e=j;e<=M;e++)for(A[e]=O.limit[e]=0,c=0;c<E;c++)k[c]===e&&(O.permute[N++]=c);for(e=0;e<E;e++)A[k[e]]++;for(N=c=0,e=j;e<M;e++)N+=A[e],O.limit[e]=N-1,N<<=1,c+=A[e],O.base[e+1]=N-c;O.limit[M+1]=Number.MAX_VALUE,O.limit[M]=N+A[M]-1,O.base[j]=0}var P=new Uint32Array(256);for(e=0;e<256;e++)w[e]=e;var F=0,I=0,L=0,R,z=this.dbuf=new Uint32Array(this.dbufSize);for(E=0;;){for(E--||(E=g-1,L>=C&&S(b.DATA_ERROR),O=D[T[L++]]),e=O.minLen,t=r.read(e);e>O.maxLen&&S(b.DATA_ERROR),!(t<=O.limit[e]);e++)t=t<<1|r.read(1);t-=O.base[e],(t<0||t>=s)&&S(b.DATA_ERROR);var B=O.permute[t];if(B===f||B===p){F||(F=1,c=0),B===f?c+=F:c+=2*F,F<<=1;continue}if(F)for(F=0,I+c>this.dbufSize&&S(b.DATA_ERROR),R=l[w[0]],P[R]+=c;c--;)z[I++]=R;if(B>u)break;I>=this.dbufSize&&S(b.DATA_ERROR),e=B-1,R=y(w,e),R=l[R],P[R]++,z[I++]=R}for((a<0||a>=I)&&S(b.DATA_ERROR),t=0,e=0;e<256;e++)n=t+P[e],P[e]=t,t=n;for(e=0;e<I;e++)R=z[e]&255,z[P[R]]|=e<<8,P[R]++;var V=0,ee=0,te=0;return I&&(V=z[a],ee=V&255,V>>=8,te=-1),this.writePos=V,this.writeCurrent=ee,this.writeCount=I,this.writeRun=te,!0},C.prototype._read_bunzip=function(e,t){var n,r,i;if(this.writeCount<0)return 0;var a=this.dbuf,o=this.writePos,s=this.writeCurrent,c=this.writeCount;this.outputsize;for(var l=this.writeRun;c;){for(c--,r=s,o=a[o],s=o&255,o>>=8,l++===3?(n=s,i=r,s=-1):(n=1,i=s),this.blockCRC.updateCRCRun(i,n);n--;)this.outputStream.writeByte(i),this.nextoutput++;s!=r&&(l=0)}return this.writeCount=c,this.blockCRC.getCRC()!==this.targetBlockCRC&&S(b.DATA_ERROR,`Bad block CRC (got `+this.blockCRC.getCRC().toString(16)+` expected `+this.targetBlockCRC.toString(16)+`)`),this.nextoutput};var w=function(e){if(`readByte`in e)return e;var t=new r;return t.pos=0,t.readByte=function(){return e[this.pos++]},t.seek=function(e){this.pos=e},t.eof=function(){return this.pos>=e.length},t},T=function(e){var t=new r,n=!0;if(e)if(typeof e==`number`)t.buffer=new Buffer(e),n=!1;else if(`writeByte`in e)return e;else t.buffer=e,n=!1;else t.buffer=new Buffer(16384);return t.pos=0,t.writeByte=function(e){if(n&&this.pos>=this.buffer.length){var t=new Buffer(this.buffer.length*2);this.buffer.copy(t),this.buffer=t}this.buffer[this.pos++]=e},t.getBuffer=function(){if(this.pos!==this.buffer.length){if(!n)throw TypeError(`outputsize does not match decoded input`);var e=new Buffer(this.pos);this.buffer.copy(e,0,0,this.pos),this.buffer=e}return this.buffer},t._coerced=!0,t};C.Err=b,C.decode=function(e,t,n){for(var r=w(e),i=T(t),a=new C(r,i);!(`eof`in r&&r.eof());)if(a._init_block())a._read_bunzip();else{var o=a.reader.read(32)>>>0;if(o!==a.streamCRC&&S(b.DATA_ERROR,`Bad stream CRC (got `+a.streamCRC.toString(16)+` expected `+o.toString(16)+`)`),n&&`eof`in r&&!r.eof())a._start_bunzip(r,i);else break}if(`getBuffer`in i)return i.getBuffer()},C.decodeBlock=function(e,t,n){var r=w(e),a=T(n),o=new C(r,a);if(o.reader.seek(t),o._get_next_block()&&(o.blockCRC=new i,o.writeCopies=0,o._read_bunzip()),`getBuffer`in a)return a.getBuffer()},C.table=function(e,t,n){var i=new r;i.delegate=w(e),i.pos=0,i.readByte=function(){return this.pos++,this.delegate.readByte()},i.delegate.eof&&(i.eof=i.delegate.eof.bind(i.delegate));var a=new r;a.pos=0,a.writeByte=function(){this.pos++};for(var o=new C(i,a),s=o.dbufSize;!(`eof`in i&&i.eof());){var c=i.pos*8+o.reader.bitOffset;if(o.reader.hasByte&&(c-=8),o._init_block()){var l=a.pos;o._read_bunzip(),t(c,a.pos-l)}else if(o.reader.read(32),n&&`eof`in i&&!i.eof())o._start_bunzip(i,a),console.assert(o.dbufSize===s,`shouldn't change block size within multistream file`);else break}},C.Stream=r,C.version=a.version,C.license=a.license,t.exports=C}))(),1),p=`file`,m=`link`,h=`symlink`,g=`directory`,_={file:`0`,link:`1`,symlink:`2`,"character-device":`3`,"block-device":`4`,directory:`5`,fifo:`6`,"pax-header":`x`,"pax-global-header":`g`,"gnu-long-name":`L`,"gnu-long-link-name":`K`},v={0:p,1:m,2:h,3:`character-device`,4:`block-device`,5:g,6:`fifo`,x:`pax-header`,g:`pax-global-header`,L:`gnu-long-name`,K:`gnu-long-link-name`},y=new Uint8Array(512),b=new Uint8Array,x=new TextEncoder,S=new TextDecoder;function C(e,t,n,r){r&&x.encodeInto(r,e.subarray(t,t+n))}function w(e,t,n,r){if(r===void 0)return;let i=r.toString(8).padStart(n-1,`0`);x.encodeInto(i,e.subarray(t,t+n-1))}function T(e,t,n){let r=e.indexOf(0,t),i=r===-1||r>t+n?t+n:r;return S.decode(e.subarray(t,i))}function E(e,t,n){let r=0,i=t+n;for(let n=t;n<i;n++){let t=e[n];if(t===0)break;t!==32&&(r=r*8+(t-48))}return r}function D(e,t,n){if(e[t]&128){let r=0;r=e[t]&127;for(let i=1;i<n;i++)r=r*256+e[t+i];if(!Number.isSafeInteger(r))throw Error(`TAR number too large`);return r}return E(e,t,n)}var O=e=>e.type===g||e.type===h||e.type===m;async function k(e){if(e==null)return b;if(e instanceof Uint8Array)return e;if(typeof e==`string`)return x.encode(e);if(e instanceof ArrayBuffer)return new Uint8Array(e);if(e instanceof Blob)return new Uint8Array(await e.arrayBuffer());throw TypeError(`Unsupported content type for entry body.`)}function A(e,t){let{strip:n,filter:r,map:i}=t;if(!n&&!r&&!i)return e;let a={...e};if(n&&n>0){let e=a.name.split(`/`).filter(Boolean);if(n>=e.length)return null;let t=e.slice(n).join(`/`);if(a.name=a.type===g&&!t.endsWith(`/`)?`${t}/`:t,a.linkname?.startsWith(`/`)){let e=a.linkname.split(`/`).filter(Boolean);a.linkname=n>=e.length?`/`:`/${e.slice(n).join(`/`)}`}}if(r?.(a)===!1)return null;let o=i?i(a):a;return o&&(!o.name||!o.name.trim()||o.name===`.`||o.name===`/`)?null:o}var j=32,M=48;function N(e){let t=E(e,148,8),n=0;for(let t=0;t<e.length;t++)t>=148&&t<156?n+=j:n+=e[t];return t===n}function P(e){e.fill(j,148,156);let t=0;for(let n of e)t+=n;for(let n=153;n>=148;n--)e[n]=(t&7)+M,t>>=3;e[154]=0,e[155]=j}function F(e){let t={};e.name.length>100&&I(e.name)===null&&(t.path=e.name),e.linkname&&e.linkname.length>100&&(t.linkpath=e.linkname),e.uname&&e.uname.length>32&&(t.uname=e.uname),e.gname&&e.gname.length>32&&(t.gname=e.gname),e.uid!=null&&e.uid>2097151&&(t.uid=String(e.uid)),e.gid!=null&&e.gid>2097151&&(t.gid=String(e.gid)),e.size!=null&&e.size>8589934591&&(t.size=String(e.size)),e.pax&&Object.assign(t,e.pax);let n=Object.entries(t);if(n.length===0)return null;let r=x.encode(n.map(([e,t])=>{let n=`${e}=${t}
|
|
2
2
|
`,r=x.encode(n).length+1,i=r+String(r).length;return i=r+String(i).length,`${i} ${n}`}).join(``));return{paxHeader:L({name:S.decode(x.encode(`PaxHeader/${e.name}`).slice(0,100)),size:r.length,type:`pax-header`,mode:420,mtime:e.mtime,uname:e.uname,gname:e.gname,uid:e.uid,gid:e.gid}),paxBody:r}}function I(e){if(e.length<=100)return null;let t=e.length-100-1,n=e.lastIndexOf(`/`,155);return n>0&&n>=t?{prefix:e.slice(0,n),name:e.slice(n+1)}:null}function L(e){let t=new Uint8Array(512),n=O(e)?0:e.size??0,r=e.name,i=``;if(!e.pax?.path){let e=I(r);e&&(r=e.name,i=e.prefix)}return C(t,0,100,r),w(t,100,8,e.mode??(e.type===g?493:420)),w(t,108,8,e.uid??0),w(t,116,8,e.gid??0),w(t,124,12,n),w(t,136,12,Math.floor((e.mtime?.getTime()??Date.now())/1e3)),C(t,156,1,_[e.type??p]),C(t,157,100,e.linkname),C(t,257,6,`ustar\0`),C(t,263,2,`00`),C(t,265,32,e.uname),C(t,297,32,e.gname),C(t,345,155,i),P(t),t}function R(e,t){if(t&&!N(e))throw Error(`Invalid tar header checksum.`);let n=T(e,156,1),r={name:T(e,0,100),mode:E(e,100,8),uid:D(e,108,8),gid:D(e,116,8),size:D(e,124,12),mtime:new Date(D(e,136,12)*1e3),type:v[n]||p,linkname:T(e,157,100)},i=T(e,257,6);return i.trim()===`ustar`&&(r.uname=T(e,265,32),r.gname=T(e,297,32)),i===`ustar`&&(r.prefix=T(e,345,155)),r}var z={path:[`name`,e=>e],linkpath:[`linkname`,e=>e],size:[`size`,e=>parseInt(e,10)],mtime:[`mtime`,parseFloat],uid:[`uid`,e=>parseInt(e,10)],gid:[`gid`,e=>parseInt(e,10)],uname:[`uname`,e=>e],gname:[`gname`,e=>e]};function B(e){let t=new TextDecoder(`utf-8`),n={},r={},i=0;for(;i<e.length;){let a=e.indexOf(32,i);if(a===-1)break;let o=parseInt(t.decode(e.subarray(i,a)),10);if(Number.isNaN(o)||o===0)break;let s=i+o,[c,l]=t.decode(e.subarray(a+1,s-1)).split(`=`,2);if(c&&l!==void 0){r[c]=l;let e=z[c];if(e){let[t,r]=e,i=r(l);(typeof i==`string`||!Number.isNaN(i))&&(n[t]=i)}}i=s}return Object.keys(r).length>0&&(n.pax=r),n}function V(e,t){t.name!==void 0&&(e.name=t.name),t.linkname!==void 0&&(e.linkname=t.linkname),t.size!==void 0&&(e.size=t.size),t.mtime!==void 0&&(e.mtime=new Date(t.mtime*1e3)),t.uid!==void 0&&(e.uid=t.uid),t.gid!==void 0&&(e.gid=t.gid),t.uname!==void 0&&(e.uname=t.uname),t.gname!==void 0&&(e.gname=t.gname),t.pax&&(e.pax=Object.assign({},e.pax??{},t.pax))}function ee(e){switch(e){case`pax-global-header`:case`pax-header`:return B;case`gnu-long-name`:return e=>({name:T(e,0,e.length)});case`gnu-long-link-name`:return e=>({linkname:T(e,0,e.length)});default:return}}function te(e){let t=L(e),n=F(e);if(!n)return[t];let r=-n.paxBody.length&511,i=r>0?[y.subarray(0,r)]:[];return[n.paxHeader,n.paxBody,...i,t]}var ne=new Uint8Array(512*2);function re(e,t,n){let r=null,i=0,a=!1;return{add(n){if(a){let e=Error(`No new tar entries after finalize.`);throw t(e),e}if(r!==null){let e=Error(`Previous entry must be completed before adding a new one`);throw t(e),e}try{let t=O(n)?0:n.size??0,a=te({...n,size:t});for(let t of a)e(t);r={...n,size:t},i=0}catch(e){t(e)}},write(n){if(!r){let e=Error(`No active tar entry.`);throw t(e),e}if(a){let e=Error(`Cannot write data after finalize.`);throw t(e),e}let o=i+n.length;if(o>r.size){let e=Error(`"${r.name}" exceeds given size of ${r.size} bytes.`);throw t(e),e}try{i=o,e(n)}catch(e){t(e)}},endEntry(){if(!r){let e=Error(`No active entry to end.`);throw t(e),e}if(a){let e=Error(`Cannot end entry after finalize.`);throw t(e),e}try{if(i!==r.size){let e=Error(`Size mismatch for "${r.name}".`);throw t(e),e}let n=-r.size&511;n>0&&e(new Uint8Array(n)),r=null,i=0}catch(e){throw t(e),e}},finalize(){if(a){let e=Error(`Archive has already been finalized`);throw t(e),e}if(r!==null){let e=Error(`Cannot finalize while an entry is still active`);throw t(e),e}try{e(ne),a=!0,n&&n()}catch(e){t(e)}}}}var H=256;function ie(){let e=Array(H),t=e.length-1,n=0,r=0,i=0,a=a=>{let o=e[n];a===o.length?(e[n]=b,n=n+1&t):e[n]=o.subarray(a),i-=a,i===0&&e.length>H&&(e=Array(H),t=H-1,n=0,r=0)};function o(t,r){if(r){let o=0,s=Math.min(t,i);for(;s>0;){let t=e[n],i=Math.min(s,t.length),c=i===t.length?t:t.subarray(0,i);if(a(i),s-=i,o+=i,!r(c))break}return o}if(i<t)return null;if(t===0)return b;let o=e[n];if(o.length>=t){let e=o.length===t?o:o.subarray(0,t);return a(t),e}let s=new Uint8Array(t),c=0,l=t;for(;l>0;){let t=e[n],r=Math.min(l,t.length);s.set(r===t.length?t:t.subarray(0,r),c),c+=r,l-=r,a(r)}return s}return{push:a=>{if(a.length===0)return;let o=r+1&t;if(o===n){let i=e.length,a=i*2,s=Array(a),c=r-n+i&i-1;if(n<r)for(let t=0;t<c;t++)s[t]=e[n+t];else if(c>0){let t=i-n;for(let r=0;r<t;r++)s[r]=e[n+r];for(let n=0;n<r;n++)s[t+n]=e[n]}e=s,t=a-1,n=0,r=c,o=r+1&t}e[r]=a,r=o,i+=a.length},available:()=>i,peek:r=>{if(i<r)return null;if(r===0)return b;let a=e[n];if(a.length>=r)return a.length===r?a:a.subarray(0,r);let o=new Uint8Array(r),s=0,c=n;for(;s<r;){let n=e[c],i=Math.min(r-s,n.length);i===n.length?o.set(n,s):o.set(n.subarray(0,i),s),s+=i,c=c+1&t}return o},discard:t=>{if(t>i)throw Error(`Too many bytes consumed`);if(t===0)return;let r=t;for(;r>0;){let t=e[n],i=Math.min(r,t.length);a(i),r-=i}},pull:o}}var ae=0,U=1,W=Error(`Tar archive is truncated.`);function oe(e={}){let t=e.strict??!1,{available:n,peek:r,push:i,discard:a,pull:o}=ie(),s=ae,c=!1,l=!1,u=!1,d=null,f={},p={},m={isEntryActive:()=>s===U,isBodyComplete:()=>!d||d.remaining===0,write(e){if(c)throw Error(`Archive already ended.`);i(e)},end(){c=!0},readHeader(){if(s!==ae)throw Error(`Cannot read header while an entry is active`);if(!l)for(;!l;){if(n()<512){if(c){if(n()>0&&t)throw W;l=!0;return}return null}let e=r(512);if(se(e)){if(n()<512*2){if(c){if(t)throw W;l=!0;return}return null}if(se(r(512*2).subarray(512))){a(512*2),l=!0,u=!0;return}if(t)throw Error(`Invalid tar header.`);a(512);continue}let i;try{i=R(e,t)}catch(e){if(t)throw e;a(512);continue}let m=ee(i.type);if(m){let e=i.size+511&-512;if(n()<512+e){if(c&&t)throw W;return null}a(512);let r=m(o(e).subarray(0,i.size)),s=i.type===`pax-global-header`?f:p;for(let e in r)s[e]=r[e];continue}a(512);let h=i;return i.prefix&&(h.name=`${i.prefix}/${h.name}`),V(h,f),V(h,p),p={},d={header:h,remaining:h.size,padding:-h.size&511},s=U,h}},streamBody(e){if(s!==U||!d||d.remaining===0)return 0;let t=Math.min(d.remaining,n());if(t===0)return 0;let r=o(t,e);return d.remaining-=r,r},skipPadding(){if(s!==U||!d)return!0;if(d.remaining>0)throw Error(`Body not fully consumed`);return n()<d.padding?!1:(a(d.padding),d=null,s=ae,!0)},skipEntry(){if(s!==U||!d)return!0;let e=Math.min(d.remaining,n());return e>0&&(a(e),d.remaining-=e),d.remaining>0?!1:m.skipPadding()},validateEOF(){if(t){if(!u)throw W;if(n()>0&&o(n()).some(e=>e!==0))throw Error(`Invalid EOF.`)}}};return m}function se(e){if(e.byteOffset%8==0){let t=new BigUint64Array(e.buffer,e.byteOffset,e.length/8);for(let e=0;e<t.length;e++)if(t[e]!==0n)return!1;return!0}for(let t=0;t<e.length;t++)if(e[t]!==0)return!1;return!0}function ce(){return new CompressionStream(`gzip`)}function le(){return new DecompressionStream(`gzip`)}function ue(){let e,t;return{readable:new ReadableStream({start(n){e=n,t=re(n.enqueue.bind(n),n.error.bind(n),n.close.bind(n))}}),controller:{add(n){let r=O(n),i={...n};return r&&(i.size=0),t.add(i),r&&t.endEntry(),new WritableStream({write(e){t.write(e)},close(){r||t.endEntry()},abort(t){e.error(t)}})},finalize(){t.finalize()},error(t){e.error(t)}}}}async function de(e){let t=[],n=e.getReader(),r=0;try{for(;;){let{done:e,value:i}=await n.read();if(e)break;t.push(i),r+=i.length}let e=new Uint8Array(r),i=0;for(let n of t)e.set(n,i),i+=n.length;return e}finally{n.releaseLock()}}var fe=e=>e.pipeTo(new WritableStream);function pe(e={}){let t=oe(e),n=null,r=!1,i=e=>{if(!r){r=!0;try{for(;;)if(t.isEntryActive()){if(n){if(t.streamBody(e=>(n.enqueue(e),!0))===0&&!t.isBodyComplete())break}else if(!t.skipEntry())break;if(t.isBodyComplete()){try{n?.close()}catch{}if(n=null,!t.skipPadding())break}}else{let r=t.readHeader();if(r==null)break;e.enqueue({header:r,body:new ReadableStream({start(e){r.size===0?e.close():n=e},pull:()=>i(e),cancel(){n=null,i(e)}})})}}catch(e){try{n?.error(e)}catch{}throw n=null,e}finally{r=!1}}};return new TransformStream({transform(e,r){try{t.write(e),i(r)}catch(e){try{n?.error(e)}catch{}throw e}},flush(e){try{if(t.end(),i(e),t.validateEOF(),t.isEntryActive()&&!t.isBodyComplete())try{n?.close()}catch{}}catch(e){try{n?.error(e)}catch{}throw e}}},void 0,{highWaterMark:1})}async function me(e){let{readable:t,controller:n}=ue();return await(async()=>{for(let t of e){let e=n.add(t.header),r=`body`in t?t.body:t.data;if(!r){await e.close();continue}if(r instanceof ReadableStream)await r.pipeTo(e);else if(r instanceof Blob)await r.stream().pipeTo(e);else try{let t=await k(r);if(t.length>0){let n=e.getWriter();await n.write(t),await n.close()}else await e.close()}catch{throw TypeError(`Unsupported content type for entry "${t.header.name}".`)}}})().then(()=>n.finalize()).catch(e=>n.error(e)),new Uint8Array(await de(t))}async function he(e,t={}){let n=e instanceof ReadableStream?e:new ReadableStream({start(t){t.enqueue(e instanceof Uint8Array?e:new Uint8Array(e)),t.close()}}),r=[],i=n.pipeThrough(pe(t));for await(let e of i){let n;try{n=A(e.header,t)}catch(t){throw await e.body.cancel(),t}if(n===null){await fe(e.body);continue}O(n)?(await fe(e.body),r.push({header:n})):r.push({header:n,data:await de(e.body)})}return r}var ge=(()=>{let e=new Uint32Array(256);for(let t=0;t<256;t++){let n=t<<24;for(let e=0;e<8;e++)n=n&2147483648?n<<1^79764919:n<<1;e[t]=n>>>0}return e})();function _e(e,t){return(e<<8^ge[(e>>>24^t)&255])>>>0}var ve=class{buffer=[];current=0;bitCount=0;writeBits(e,t){for(let n=e-1;n>=0;n--)this.current=this.current<<1|t>>>n&1,this.bitCount++,this.bitCount===8&&(this.buffer.push(this.current),this.current=0,this.bitCount=0)}writeBit(e){this.current=this.current<<1|e&1,this.bitCount++,this.bitCount===8&&(this.buffer.push(this.current),this.current=0,this.bitCount=0)}finish(){return this.bitCount>0&&this.buffer.push(this.current<<8-this.bitCount),new Uint8Array(this.buffer)}};function ye(e){let t=[],n=0;for(;n<e.length;){let r=e[n],i=1;for(;n+i<e.length&&e[n+i]===r&&i<255;)i++;i>=4?(t.push(r,r,r,r),t.push(i-4),n+=i):(t.push(r),n++)}return new Uint8Array(t)}function be(e){let t=e.length;if(t===0)return{transformed:new Uint8Array,pointer:0};let n=xe(e),r=new Uint8Array(t),i=0;for(let a=0;a<t;a++)n[a]===0?(i=a,r[a]=e[t-1]):r[a]=e[n[a]-1];return{transformed:r,pointer:i}}function xe(e){let t=e.length,n=new Int32Array(t),r=new Int32Array(t);for(let i=0;i<t;i++)n[i]=i,r[i]=e[i];for(let e=1;e<t;e*=2){let i=r.slice();n.sort((n,r)=>i[n]===i[r]?i[(n+e)%t]-i[(r+e)%t]:i[n]-i[r]),r[n[0]]=0;for(let a=1;a<t;a++)i[n[a]]===i[n[a-1]]&&i[(n[a]+e)%t]===i[(n[a-1]+e)%t]?r[n[a]]=r[n[a-1]]:r[n[a]]=r[n[a-1]]+1;if(r[n[t-1]]===t-1)break}return n}function Se(e,t){let n=[];for(let e=0;e<256;e++)t[e]&&n.push(e);let r=Array(256).fill(-1);for(let e=0;e<n.length;e++)r[n[e]]=e;let i=new Uint16Array(e.length),a=n.slice();for(let t=0;t<e.length;t++){let n=e[t],r=0;for(;a[r]!==n;)r++;if(i[t]=r,r>0){let e=a[r];for(let e=r;e>0;e--)a[e]=a[e-1];a[0]=e}}return{encoded:i,length:e.length}}function Ce(e,t,n){let r=n+1,i=[],a=0;for(;a<t;)if(e[a]===0){let n=0;for(;a<t&&e[a]===0;)n++,a++;let r=n;for(;r>0;)r--,r&1?i.push(1):i.push(0),r>>>=1}else i.push(e[a]+1),a++;i.push(r);let o=new Uint16Array(i.length);for(let e=0;e<i.length;e++)o[e]=i[e];return{symbols:o,length:i.length,eob:r}}function we(e,t,n){if(t<=1){let t=Array(e.length).fill(0);for(let n=0;n<e.length;n++)e[n]>0&&(t[n]=1);return{codeLengths:t,maxLen:1,minLen:1}}let r=[];for(let t=0;t<e.length;t++)e[t]>0&&r.push({freq:e[t],symbol:t,left:null,right:null});if(r.length===0)return{codeLengths:Array(e.length).fill(0),maxLen:0,minLen:0};if(r.length===1){let t=Array(e.length).fill(0);return t[r[0].symbol]=1,{codeLengths:t,maxLen:1,minLen:1}}for(;r.length>1;){r.sort((e,t)=>e.freq-t.freq);let e=r.shift(),t=r.shift();r.push({freq:e.freq+t.freq,symbol:-1,left:e,right:t})}let i=Array(e.length).fill(0);function a(e,t){if(!e.left&&!e.right){i[e.symbol]=t;return}e.left&&a(e.left,t+1),e.right&&a(e.right,t+1)}a(r[0],0);let o=!0;for(;o;){o=!1;for(let e=0;e<i.length;e++)i[e]>n&&(i[e]=n,o=!0);if(o){let e=0;for(let t=0;t<i.length;t++)i[t]>0&&(e+=1/(1<<i[t]));if(e>1)for(let t=1;t<n&&e>1;t++)for(let n=0;n<i.length&&e>1;n++)i[n]===t&&(i[n]++,e-=1/(1<<t)-1/(1<<t+1));o=!1;for(let e=0;e<i.length;e++)if(i[e]>n){o=!0;break}}}let s=n,c=0;for(let e=0;e<i.length;e++)i[e]>0&&(i[e]<s&&(s=i[e]),i[e]>c&&(c=i[e]));return{codeLengths:i,maxLen:c,minLen:s}}function Te(e,t){let n=Array(t).fill(0),r=e.slice(0,t),i=Math.max(...r,0),a=Array(i+1).fill(0);for(let e=0;e<t;e++)r[e]>0&&a[r[e]]++;let o=Array(i+1).fill(0),s=0;for(let e=1;e<=i;e++)s=s+a[e-1]<<1,o[e]=s;for(let e=0;e<t;e++)r[e]>0&&(n[e]=o[r[e]]++);return{codes:n,lengths:r}}function Ee(e,t,n){e.writeBits(24,3227993),e.writeBits(24,2511705),e.writeBits(32,n),e.writeBit(0);let{transformed:r,pointer:i}=be(ye(t));e.writeBits(24,i);let a=Array(256).fill(!1);for(let e=0;e<r.length;e++)a[r[e]]=!0;let o=Array(16).fill(!1);for(let e=0;e<16;e++)for(let t=0;t<16;t++)if(a[e*16+t]){o[e]=!0;break}for(let t=0;t<16;t++)e.writeBit(o[t]?1:0);for(let t=0;t<16;t++)if(o[t])for(let n=0;n<16;n++)e.writeBit(a[t*16+n]?1:0);let s=0;for(let e=0;e<256;e++)a[e]&&s++;let{encoded:c,length:l}=Se(r,a),{symbols:u,length:d}=Ce(c,l,s),f=s+2,p=Math.ceil(d/50),m;m=d<200?2:d<600?3:d<1200?4:d<2400?5:6,m>p&&(m=Math.max(2,p));let h=[];for(let e=0;e<m;e++)h.push(Array(f).fill(0));let g=new Int32Array(p);for(let e=0;e<p;e++)g[e]=e%m;for(let e=0;e<p;e++){let t=e*50,n=Math.min(t+50,d),r=g[e];for(let e=t;e<n;e++)h[r][u[e]]++}function _(e){for(let t=0;t<f;t++)e[t]<1&&(e[t]=1)}let v=[];for(let e=0;e<m;e++)_(h[e]),v.push(we(h[e],f,20));for(let e=0;e<4;e++){for(let e=0;e<m;e++)h[e].fill(0);for(let e=0;e<p;e++){let t=e*50,n=Math.min(t+50,d),r=0,i=1/0;for(let e=0;e<m;e++){let a=0;for(let r=t;r<n;r++)a+=v[e].codeLengths[u[r]]||20;a<i&&(i=a,r=e)}g[e]=r;for(let e=t;e<n;e++)h[r][u[e]]++}for(let e=0;e<m;e++)_(h[e]),v[e]=we(h[e],f,20)}e.writeBits(3,m),e.writeBits(15,p);let y=[],b=[];for(let e=0;e<m;e++)b.push(e);for(let e=0;e<p;e++){let t=g[e],n=0;for(;b[n]!==t;)n++;if(y.push(n),n>0){let e=b[n];for(let e=n;e>0;e--)b[e]=b[e-1];b[0]=e}}for(let t=0;t<p;t++){for(let n=0;n<y[t];n++)e.writeBit(1);e.writeBit(0)}for(let t=0;t<m;t++){let n=v[t].codeLengths,r=n[0];e.writeBits(5,r);for(let t=0;t<f;t++){let i=n[t];for(;r<i;)e.writeBit(1),e.writeBit(0),r++;for(;r>i;)e.writeBit(1),e.writeBit(1),r--;e.writeBit(0)}}for(let e=0;e<m;e++){let{codes:t,lengths:n}=Te(v[e].codeLengths,f);v[e]=Object.assign(v[e],{_codes:t,_lengths:n})}let x=0,S=0;for(let t=0;t<d;t++){(S===0||S>=50)&&(t>0&&x++,S=0);let n=v[g[x]],r=u[t],i=n._lengths[r],a=n._codes[r];i>0&&e.writeBits(i,a),S++}}var De=10*1024*1024;function Oe(e,t=9,n=De){if(t<1||t>9)throw Error(`Block size level must be 1-9`);if(e.length>n)throw Error(`Input too large for bzip2 compression (${e.length} bytes, max ${n})`);let r=t*1e5,i=new ve;i.writeBits(8,66),i.writeBits(8,90),i.writeBits(8,104),i.writeBits(8,48+t);let a=0,o=0;for(;o<e.length;){let t=Math.min(o+r,e.length),n=e.subarray(o,t),s=4294967295;for(let e=0;e<n.length;e++)s=_e(s,n[e]);s=~s>>>0,a=(a<<1|a>>>31)>>>0,a=(a^s)>>>0,Ee(i,n,s),o=t}return i.writeBits(24,1536581),i.writeBits(24,3690640),i.writeBits(32,a),i.finish()}var G=null,K=null;async function ke(){if(G)return G;if(K)throw K;try{return G=await r.runTrustedAsync(()=>import(`./lzma-DMoteSiK.mjs`)),G}catch{throw K=Error(`xz compression requires node-liblzma which failed to load. Install liblzma-dev (apt) or xz (brew) and reinstall dependencies.`),K}}var q=null,J=null;async function Ae(){if(q)return q;if(J)throw J;try{return q=await r.runTrustedAsync(()=>import(`./lib-Dl2j2VNl.mjs`).then(t=>e(t.default,1))),q}catch{throw J=Error(`zstd compression requires @mongodb-js/zstd which is not installed. Install it with: npm install @mongodb-js/zstd`),J}}var Y=100*1024*1024,je=512,Me=1e4;function Ne(e){let t=`file`;e.isDirectory?t=`directory`:e.isSymlink&&(t=`symlink`);let n=e.name;e.isDirectory&&!n.endsWith(`/`)&&(n+=`/`);let r;e.content!==void 0&&(r=typeof e.content==`string`?new TextEncoder().encode(e.content):e.content);let i=e.isDirectory||e.isSymlink?0:r?.length??0;return{header:{name:n,mode:e.mode??(e.isDirectory?493:420),uid:e.uid??0,gid:e.gid??0,size:i,mtime:e.mtime??new Date,type:t,linkname:e.linkTarget??``,uname:`user`,gname:`user`},body:r}}async function X(e){return me(e.map(Ne))}async function Pe(e){let t=await X(e),n=new ReadableStream({start(e){e.enqueue(t),e.close()}}).pipeThrough(ce()).getReader(),r=[];for(;;){let{done:e,value:t}=await n.read();if(e)break;r.push(t)}let i=r.reduce((e,t)=>e+t.length,0),a=new Uint8Array(i),o=0;for(let e of r)a.set(e,o),o+=e.length;return a}async function Z(e){if(e.length>Y)return{entries:[],error:`Archive too large (max ${Y} bytes)`};if(e.length<je||e.length%je!==0)return{entries:[],error:`Invalid tar archive format`};try{let t=await he(e),n=[];for(let e of t){if(n.length>=Me)return{entries:n,error:`Too many entries (max ${Me})`};let t=`file`;switch(e.header.type){case`directory`:t=`directory`;break;case`symlink`:t=`symlink`;break;case`link`:t=`hardlink`;break;case`file`:t=`file`;break;default:t=`other`}n.push({name:e.header.name,mode:e.header.mode??420,uid:e.header.uid??0,gid:e.header.gid??0,size:e.header.size,mtime:e.header.mtime??new Date,type:t,linkTarget:e.header.linkname||void 0,content:e.data??new Uint8Array})}return{entries:n}}catch(e){return{entries:[],error:e instanceof Error?e.message:`Unknown error`}}}async function Fe(e){if(e.length>Y)return{entries:[],error:`Archive too large (max ${Y} bytes)`};try{let t=new ReadableStream({start(t){t.enqueue(e),t.close()}}).pipeThrough(le()).getReader(),n=[],r=0;for(;;){let{done:e,value:i}=await t.read();if(e)break;if(r+=i.length,r>Y)return await t.cancel(),{entries:[],error:`Decompressed archive too large (max ${Y} bytes)`};n.push(i)}let i=new Uint8Array(r),a=0;for(let e of n)i.set(e,a),a+=e.length;return Z(i)}catch(e){return{entries:[],error:`Decompression failed: ${e instanceof Error?e.message:`Unknown error`}`}}}function Ie(e){return e.length>=2&&e[0]===31&&e[1]===139}function Le(e){return e.length>=3&&e[0]===66&&e[1]===90&&e[2]===104}function Re(e){return e.length>=6&&e[0]===253&&e[1]===55&&e[2]===122&&e[3]===88&&e[4]===90&&e[5]===0}async function ze(e){let t=f.default.decode(Buffer.from(e));return new Uint8Array(t)}async function Be(e){return Oe(e,9)}async function Ve(e){let t=(await ke()).unxzSync(Buffer.from(e));return new Uint8Array(t)}async function He(e){let t=(await ke()).xzSync(Buffer.from(e));return new Uint8Array(t)}async function Ue(e){return Be(await X(e))}async function We(e,t){if(!t?.allowNativeCodecs)throw Error(`xz compression is disabled by default (native codec risk). Pass { allowNativeCodecs: true } to opt in.`);return He(await X(e))}async function Ge(e){if(e.length>Y)return{entries:[],error:`Archive too large (max ${Y} bytes)`};try{let t=await ze(e);return t.length>Y?{entries:[],error:`Decompressed archive too large (max ${Y} bytes)`}:Z(t)}catch(e){return{entries:[],error:e instanceof Error?e.message:`Unknown error`}}}async function Ke(e,t){if(!t?.allowNativeCodecs)return{entries:[],error:`xz decompression is disabled by default (native codec risk). Pass { allowNativeCodecs: true } to opt in, or decompress the archive externally before extraction.`};if(e.length>Y)return{entries:[],error:`Archive too large (max ${Y} bytes)`};try{let t=await Ve(e);return t.length>Y?{entries:[],error:`Decompressed archive too large (max ${Y} bytes)`}:Z(t)}catch(e){return{entries:[],error:e instanceof Error?e.message:`Unknown error`}}}function qe(e){return e.length>=4&&e[0]===40&&e[1]===181&&e[2]===47&&e[3]===253}async function Je(e){let t=await(await Ae()).compress(Buffer.from(e),3);return new Uint8Array(t)}async function Ye(e){let t=await(await Ae()).decompress(Buffer.from(e));return new Uint8Array(t)}async function Xe(e,t){if(!t?.allowNativeCodecs)throw Error(`zstd compression is disabled by default (native codec risk). Pass { allowNativeCodecs: true } to opt in.`);return Je(await X(e))}async function Ze(e,t){if(!t?.allowNativeCodecs)return{entries:[],error:`zstd decompression is disabled by default (native codec risk). Pass { allowNativeCodecs: true } to opt in, or decompress the archive externally before extraction.`};if(e.length>Y)return{entries:[],error:`Archive too large (max ${Y} bytes)`};try{let t=await Ye(e);return t.length>Y?{entries:[],error:`Decompressed archive too large (max ${Y} bytes)`}:Z(t)}catch(e){return{entries:[],error:e instanceof Error?e.message:`Unknown error`}}}function Qe(e){let t={create:!1,append:!1,update:!1,extract:!1,list:!1,file:``,autoCompress:!1,gzip:!1,bzip2:!1,xz:!1,zstd:!1,verbose:!1,toStdout:!1,keepOldFiles:!1,touch:!1,directory:``,preserve:!1,absoluteNames:!1,strip:0,exclude:[],filesFrom:``,excludeFrom:``,wildcards:!1},n=[],r=0;for(;r<e.length;){let a=e[r];if(a.startsWith(`-`)&&!a.startsWith(`--`)&&a.length>2){if(/^-\d+$/.test(a)){n.push(a),r++;continue}for(let n=1;n<a.length;n++){let o=a[n];switch(o){case`c`:t.create=!0;break;case`r`:t.append=!0;break;case`u`:t.update=!0;break;case`x`:t.extract=!0;break;case`t`:t.list=!0;break;case`a`:t.autoCompress=!0;break;case`z`:t.gzip=!0;break;case`j`:t.bzip2=!0;break;case`J`:t.xz=!0;break;case`v`:t.verbose=!0;break;case`O`:t.toStdout=!0;break;case`k`:t.keepOldFiles=!0;break;case`m`:t.touch=!0;break;case`p`:t.preserve=!0;break;case`P`:t.absoluteNames=!0;break;case`f`:if(n<a.length-1)t.file=a.substring(n+1),n=a.length;else{if(r++,r>=e.length)return{ok:!1,error:{stdout:``,stderr:`tar: option requires an argument -- 'f'
|
|
3
3
|
`,exitCode:2}};t.file=e[r]}break;case`C`:if(n<a.length-1)t.directory=a.substring(n+1),n=a.length;else{if(r++,r>=e.length)return{ok:!1,error:{stdout:``,stderr:`tar: option requires an argument -- 'C'
|
|
4
4
|
`,exitCode:2}};t.directory=e[r]}break;case`T`:if(n<a.length-1)t.filesFrom=a.substring(n+1),n=a.length;else{if(r++,r>=e.length)return{ok:!1,error:{stdout:``,stderr:`tar: option requires an argument -- 'T'
|
|
@@ -60,4 +60,4 @@ import{o as e,t}from"./chunk-FK9Q3tQk.mjs";import{t as n}from"./chunk-YNYSPYQ5-D
|
|
|
60
60
|
`,exitCode:2}}}if(r.excludeFrom){let e=t.fs.resolvePath(t.cwd,r.excludeFrom);try{let n=(await t.fs.readFile(e)).split(`
|
|
61
61
|
`).map(e=>e.trim()).filter(e=>e.length>0&&!e.startsWith(`#`));r.exclude.push(...n)}catch{return{stdout:``,stderr:`tar: ${r.excludeFrom}: Cannot open: No such file or directory
|
|
62
62
|
`,exitCode:2}}}return r.create?ot(t,r,l):r.append?st(t,r,l):r.update?ct(t,r,l):r.extract?lt(t,r,l):ut(t,r,l)}},ft={name:`tar`,flags:[{flag:`-c`,type:`boolean`},{flag:`-x`,type:`boolean`},{flag:`-t`,type:`boolean`},{flag:`-f`,type:`value`,valueHint:`path`},{flag:`-z`,type:`boolean`},{flag:`-j`,type:`boolean`},{flag:`-v`,type:`boolean`},{flag:`-C`,type:`value`,valueHint:`path`},{flag:`--strip-components`,type:`value`,valueHint:`number`},{flag:`--exclude`,type:`value`,valueHint:`pattern`}],needsArgs:!0};export{dt as n,ft as t};
|
|
63
|
-
//# sourceMappingURL=chunk-BRGMQKJV-
|
|
63
|
+
//# sourceMappingURL=chunk-BRGMQKJV-CHO764qS.mjs.map
|