@poe-platform/safe-bash 0.1.812 → 0.1.814
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/audio-ast/id3-source.d.ts +27 -0
- package/dist/audio-ast/index.d.ts +4 -0
- package/dist/audio-ast/index.js +996 -596
- package/dist/audio-ast/mp3-source.d.ts +18 -0
- package/dist/audio-ast/ogg-source.d.ts +25 -0
- package/dist/audio-ast/ogg-stream-source.d.ts +22 -0
- package/dist/image-ast/index.js +139 -9
- package/dist/mp4-ast/containers/adapters.d.ts +7 -0
- package/dist/mp4-ast/index.d.ts +2 -0
- package/dist/mp4-ast/mp4-sample-source.d.ts +52 -0
- package/dist/mp4-ast/mp4-source.d.ts +32 -0
- package/dist/office-xml/retained-xml-document.d.ts +14 -0
- package/dist/pdf-ast/ast.d.ts +2 -0
- package/dist/pdf-ast/content/dictionary-cursor.d.ts +15 -0
- package/dist/pdf-ast/content/evaluator.d.ts +4 -0
- package/dist/pdf-ast/content/range-operator-parser.d.ts +4 -0
- package/dist/pdf-ast/content/stored-dictionary.d.ts +10 -0
- package/dist/pdf-ast/cos/lexer.d.ts +8 -5
- package/dist/pdf-ast/cos/object-reader.d.ts +11 -3
- package/dist/pdf-ast/cos/range-parser.d.ts +4 -0
- package/dist/pdf-ast/cos/retained-objects.d.ts +1 -0
- package/dist/pdf-ast/cos/retained-writer.d.ts +1 -0
- package/dist/pdf-ast/cos/value-parser.d.ts +10 -0
- package/dist/pdf-ast/edit/retained-append-attachments.d.ts +13 -0
- package/dist/pdf-ast/edit/retained-bookmarks.d.ts +13 -0
- package/dist/pdf-ast/edit/retained-form-appearances.d.ts +10 -0
- package/dist/pdf-ast/edit/retained-graph.d.ts +12 -0
- package/dist/pdf-ast/edit/retained-info-updates.d.ts +33 -0
- package/dist/pdf-ast/edit/retained-save.d.ts +2 -0
- package/dist/pdf-ast/edit/retained-stamps.d.ts +9 -0
- package/dist/pdf-ast/fonts/resolve.d.ts +3 -1
- package/dist/pdf-ast/index.d.ts +3 -1
- package/dist/pdf-ast/index.js +1966 -844
- package/dist/pdf-ast/retained-document.d.ts +5 -0
- package/dist/safe-bash/audio-ast.browser.js +6 -1
- package/dist/safe-bash/chunks/{chunk-HHSOUC3Z.js → chunk-HPQE675Q.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-BUYRKFW2.js → chunk-I6ECNJMR.js} +1 -1
- package/dist/safe-bash/chunks/{pdftk-WRYEP3CA.js → pdftk-Y2TX74LY.js} +2 -1
- package/dist/safe-bash/command-chunks/biff-KRHJ63K3-VQPJCVIL.js +5309 -0
- package/dist/safe-bash/command-chunks/{chunk-34G2SQX2.js → chunk-2BLTUQNK.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-LLU2IQEJ.js → chunk-2BNGPR6Z.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-HWQ2UHMT.js → chunk-2ETEJOYX.js} +18 -18
- package/dist/safe-bash/command-chunks/{chunk-NQDIT667.js → chunk-2PKBXGXD.js} +5 -5
- package/dist/safe-bash/command-chunks/{chunk-MMBZTYXO.js → chunk-2PQRZDNR.js} +221 -0
- package/dist/safe-bash/command-chunks/{chunk-6QBMND4A.js → chunk-2VVJRVYM.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-G5QVZQCO.js → chunk-3EASXF5D.js} +5 -5
- package/dist/safe-bash/command-chunks/{chunk-U3SBHEKH.js → chunk-3EB2FSAN.js} +9 -9
- package/dist/safe-bash/command-chunks/{chunk-VB2TUPO2.js → chunk-3EW7GYHM.js} +9 -9
- package/dist/safe-bash/command-chunks/{chunk-RNSKXOG3.js → chunk-3GRMU7TM.js} +6 -6
- package/dist/safe-bash/command-chunks/chunk-3JM7E42I.js +197 -0
- package/dist/safe-bash/command-chunks/{chunk-6L4IYQAT.js → chunk-3MG5EAMX.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-RASQPOSV.js → chunk-3SPLP2DB.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-K5COUQAQ.js → chunk-3VGQTLO6.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-K7CV55K5.js → chunk-3YEQI5B7.js} +10 -10
- package/dist/safe-bash/command-chunks/{chunk-ZXR6LXV5.js → chunk-3ZRCL756.js} +48 -4
- package/dist/safe-bash/command-chunks/{chunk-SOFM3GPG.js → chunk-42MEXZBJ.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-GQ2ZSPZ3.js → chunk-46AMTJPE.js} +10 -10
- package/dist/safe-bash/command-chunks/{chunk-MTWZEPAR.js → chunk-47IAU25U.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-6GI3NTCW.js → chunk-4B2ZUGLT.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-L5MCW6CM.js → chunk-4EHY6J2Z.js} +9 -155
- package/dist/safe-bash/command-chunks/{chunk-QQVACHZA.js → chunk-4EZJV4FZ.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-SSKMPDN4.js → chunk-4GQKCUS5.js} +15 -15
- package/dist/safe-bash/command-chunks/{chunk-UOBW5K3M.js → chunk-4RRYWHED.js} +7 -7
- package/dist/safe-bash/command-chunks/{chunk-PINR7QET.js → chunk-4UPKVQWH.js} +8 -8
- package/dist/safe-bash/command-chunks/{chunk-M7QE2MN7.js → chunk-4YLACJHE.js} +6 -6
- package/dist/safe-bash/command-chunks/chunk-5BIQWWLB.js +175 -0
- package/dist/safe-bash/command-chunks/{chunk-P3WU3PSL.js → chunk-5L4YGRQU.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-HKATEVAP.js → chunk-5LFGXN3D.js} +6 -6
- package/dist/safe-bash/command-chunks/{chunk-SPLOIABU.js → chunk-5OM3UIK3.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-TVH4JORU.js → chunk-6LPSKLLD.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-CV7M2QJU.js → chunk-6QYSF7I2.js} +7 -7
- package/dist/safe-bash/command-chunks/{chunk-XVP6V5K3.js → chunk-6VBDJC6V.js} +6 -6
- package/dist/safe-bash/command-chunks/{chunk-6N5GHM72.js → chunk-6WNVGCXD.js} +8 -8
- package/dist/safe-bash/command-chunks/{chunk-6CCQI6XZ.js → chunk-6XES7Z4G.js} +12 -12
- package/dist/safe-bash/command-chunks/{chunk-AFROLW6S.js → chunk-6XGDWFNQ.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-WTE23QXN.js → chunk-6ZGCKUAM.js} +3 -3
- package/dist/safe-bash/command-chunks/chunk-6ZHQB453.js +35 -0
- package/dist/safe-bash/command-chunks/{chunk-RIV6XN7K.js → chunk-7DOLY7IV.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-QD7ZRDUN.js → chunk-7KZ5LWV2.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-NGR5KOPQ.js → chunk-A347DLRB.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-ZM2Y4Z3C.js → chunk-A45UG4KT.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-56NYSX65.js → chunk-ADHFF2IM.js} +9 -9
- package/dist/safe-bash/command-chunks/{chunk-ATI464W3.js → chunk-AG2SNMP5.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-FDCIPJBQ.js → chunk-AM5LANIE.js} +7 -7
- package/dist/safe-bash/command-chunks/{chunk-3Q247UDJ.js → chunk-AVGXFWEB.js} +278 -135
- package/dist/safe-bash/command-chunks/{chunk-RBTC7OFT.js → chunk-AVOGFREX.js} +5 -5
- package/dist/safe-bash/command-chunks/{chunk-QC5RMGSA.js → chunk-AWPI4DZR.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-FYMNHG7R.js → chunk-AXXZNB7U.js} +13 -13
- package/dist/safe-bash/command-chunks/{chunk-Q6S57NOQ.js → chunk-AY3KQ4EN.js} +7 -7
- package/dist/safe-bash/command-chunks/{chunk-456PHA3L.js → chunk-BLGGAHQW.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-CU4DLVME.js → chunk-BLIFGBIO.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-NARD63DY.js → chunk-BS3ZEQGT.js} +22 -66
- package/dist/safe-bash/command-chunks/{chunk-WFVSUXJL.js → chunk-BS5JEUEW.js} +8 -8
- package/dist/safe-bash/command-chunks/{chunk-UYWSIIUX.js → chunk-BZMNC7Q5.js} +7 -7
- package/dist/safe-bash/command-chunks/{chunk-RHYJVTJO.js → chunk-CCMAHM3I.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-N4R2SHSS.js → chunk-CCZZVCHX.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-WGG6G2KG.js → chunk-CIRDVCAZ.js} +7 -7
- package/dist/safe-bash/command-chunks/chunk-CK2WFJZN.js +178 -0
- package/dist/safe-bash/command-chunks/{chunk-UZL7G57V.js → chunk-CKEMZUE3.js} +7 -7
- package/dist/safe-bash/command-chunks/{chunk-B5LDP7AA.js → chunk-CQBACD2V.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-JYUJAF4L.js → chunk-CSE4VQKG.js} +16 -1
- package/dist/safe-bash/command-chunks/{chunk-Q73EMLLZ.js → chunk-CXME4YHU.js} +107 -5
- package/dist/safe-bash/command-chunks/{chunk-FTLDRH47.js → chunk-CZ5K2YPU.js} +16 -16
- package/dist/safe-bash/command-chunks/{chunk-554Z6IKP.js → chunk-DBLQUZGN.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-6M6TM5Z5.js → chunk-DBNJEXHK.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-SPW4GW4Z.js → chunk-DFI7QF3M.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-ZO5WBWLL.js → chunk-DN6MSXY7.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-GXLXWZWH.js → chunk-DZH54L3F.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-XRVKWGVQ.js → chunk-EBHOZIBS.js} +6 -6
- package/dist/safe-bash/command-chunks/{chunk-3Y5EME26.js → chunk-ENEIE44W.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-ATTWQVR2.js → chunk-EQWFKNHJ.js} +17 -17
- package/dist/safe-bash/command-chunks/{chunk-YV72XQKL.js → chunk-ETXPMVR6.js} +13 -13
- package/dist/safe-bash/command-chunks/{chunk-JFYWVQ4V.js → chunk-EV5G535P.js} +8 -8
- package/dist/safe-bash/command-chunks/{chunk-PZMU3Z4L.js → chunk-EVYKV3QI.js} +5 -5
- package/dist/safe-bash/command-chunks/{chunk-D6UMSC45.js → chunk-F4YFTO2K.js} +11 -11
- package/dist/safe-bash/command-chunks/{chunk-MPUHH2KR.js → chunk-F762XDNG.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-D2ASPM7R.js → chunk-FF7UGJWS.js} +5 -5
- package/dist/safe-bash/command-chunks/{chunk-OA75SGN2.js → chunk-FOONI6BD.js} +7 -7
- package/dist/safe-bash/command-chunks/{chunk-DYLNU57U.js → chunk-FSVJ67G5.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-CLKOGAR3.js → chunk-FSYMSWJU.js} +8 -8
- package/dist/safe-bash/command-chunks/{chunk-22MOB45U.js → chunk-FUQMEUAT.js} +6 -6
- package/dist/safe-bash/command-chunks/chunk-FWKLBDMK.js +0 -0
- package/dist/safe-bash/command-chunks/{chunk-KXPCSVAT.js → chunk-FXCSPPYE.js} +20 -20
- package/dist/safe-bash/command-chunks/{chunk-XZ2FWFNV.js → chunk-FYYFV6PW.js} +6 -6
- package/dist/safe-bash/command-chunks/{chunk-3OETVNJA.js → chunk-G2COZLXX.js} +9 -9
- package/dist/safe-bash/command-chunks/{chunk-ZEX53S5I.js → chunk-G3TAX3CV.js} +7369 -7221
- package/dist/safe-bash/command-chunks/{chunk-LXLLA4PM.js → chunk-GCHB7VNX.js} +17 -17
- package/dist/safe-bash/command-chunks/{chunk-4Y6O2K35.js → chunk-GLAF45M7.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-OEJM666F.js → chunk-GQGMQMIM.js} +5 -5
- package/dist/safe-bash/command-chunks/{chunk-RRL3Y562.js → chunk-GXMPXMDP.js} +11 -11
- package/dist/safe-bash/command-chunks/{chunk-GEM47B2P.js → chunk-GYM5ICK4.js} +7 -7
- package/dist/safe-bash/command-chunks/{chunk-A5FZBR7X.js → chunk-H33D4R26.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-AGLK7OJR.js → chunk-HDSIIQBS.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-3ZDANXIC.js → chunk-HELAVGZH.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-S4QH5BXZ.js → chunk-HGIMFVI2.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-35IPOBWL.js → chunk-HI6ZYH3W.js} +10 -10
- package/dist/safe-bash/command-chunks/{chunk-KB7DUBVL.js → chunk-HK6MSB7Z.js} +5 -5
- package/dist/safe-bash/command-chunks/{chunk-7ZE3VIAN.js → chunk-IB5QP4LF.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-UCR5YDV3.js → chunk-IBYMPAUW.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-LABOWPFB.js → chunk-IHXZMAMY.js} +9 -9
- package/dist/safe-bash/command-chunks/{chunk-XPD636C4.js → chunk-IWHNRYER.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-PPO7YUZF.js → chunk-JGKSWDGP.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-KCOJA7EM.js → chunk-JR3Q6QNL.js} +7 -7
- package/dist/safe-bash/command-chunks/{chunk-S6R3IB36.js → chunk-JUHOL5KB.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-3O2YEI47.js → chunk-JVKE7YZN.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-6NATRKUJ.js → chunk-JW6WVNTM.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-IK6K2HCG.js → chunk-JWORWL72.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-JOCFI7TG.js → chunk-K2WOMJOQ.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-XVLWZTPY.js → chunk-K4XNUJVJ.js} +543 -144
- package/dist/safe-bash/command-chunks/{chunk-DM2CPMB4.js → chunk-KBAQHE5Y.js} +2 -2
- package/dist/safe-bash/command-chunks/chunk-KCLJGRU7.js +737 -0
- package/dist/safe-bash/command-chunks/{chunk-TUDFMNPP.js → chunk-KINIV2SV.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-43TRBJ2N.js → chunk-KPHLESD4.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-47NEG4UO.js → chunk-KRRG4MGH.js} +222 -46
- package/dist/safe-bash/command-chunks/{chunk-33YCKZZX.js → chunk-KSBNZTAZ.js} +6 -6
- package/dist/safe-bash/command-chunks/{chunk-4Y34ZG4T.js → chunk-KUOCGGEU.js} +11 -11
- package/dist/safe-bash/command-chunks/{chunk-ML5R5JML.js → chunk-KY4LCHUF.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-2JSDKQ4J.js → chunk-LAPOMHGY.js} +251 -239
- package/dist/safe-bash/command-chunks/{chunk-ENT3IV2G.js → chunk-LDW3RF7Y.js} +12 -12
- package/dist/safe-bash/command-chunks/{chunk-U27XPNLP.js → chunk-LEO4VRIN.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-GZ3VIWNN.js → chunk-LKGTH2Q7.js} +7 -7
- package/dist/safe-bash/command-chunks/{chunk-ZMHEGDU2.js → chunk-LNTEV56A.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-DVGXLBUW.js → chunk-LZ2JFMKT.js} +10 -10
- package/dist/safe-bash/command-chunks/{chunk-6D2BMAF4.js → chunk-MEM2ZPMI.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-HTVIYLVB.js → chunk-MGMTRGKM.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-B3NLITWP.js → chunk-MKK6FM5H.js} +7 -7
- package/dist/safe-bash/command-chunks/{chunk-Z2JW6M2D.js → chunk-MKOIPOXX.js} +3 -3
- package/dist/safe-bash/command-chunks/chunk-MLOYUXUV.js +244 -0
- package/dist/safe-bash/command-chunks/{chunk-CBNKHBLD.js → chunk-MNK3DDH6.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-JVGUVHWI.js → chunk-MPXMRTMY.js} +10 -10
- package/dist/safe-bash/command-chunks/{chunk-TW73OXPR.js → chunk-MVLVIMJ6.js} +6 -6
- package/dist/safe-bash/command-chunks/{chunk-TY4WDAHM.js → chunk-MYZ46FQL.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-TBAIMDGL.js → chunk-N4MUBJCT.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-NPLVFAD6.js → chunk-N6G3345Q.js} +8 -8
- package/dist/safe-bash/command-chunks/{chunk-ZIIO6GRY.js → chunk-NEMUPUUB.js} +7 -7
- package/dist/safe-bash/command-chunks/{chunk-K5GB2YMN.js → chunk-NEVQWOU6.js} +10 -10
- package/dist/safe-bash/command-chunks/{chunk-FIIAYCWS.js → chunk-NFGCBQN3.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-PNGDJA6M.js → chunk-NFII726L.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-JQPNA77Y.js → chunk-NHNZYWPW.js} +2 -2
- package/dist/safe-bash/command-chunks/chunk-NQINS4XY.js +156 -0
- package/dist/safe-bash/command-chunks/{chunk-APEWTWCC.js → chunk-NRFTYZ2R.js} +6 -6
- package/dist/safe-bash/command-chunks/{chunk-THMZLJQD.js → chunk-NYFYTL5G.js} +18 -18
- package/dist/safe-bash/command-chunks/{chunk-SMSGLRIH.js → chunk-OTF2AJ5M.js} +6 -6
- package/dist/safe-bash/command-chunks/{chunk-QZZ73J2O.js → chunk-OVQP6KH5.js} +6 -6
- package/dist/safe-bash/command-chunks/{chunk-HDJVJTCK.js → chunk-P2LT6TGR.js} +9 -9
- package/dist/safe-bash/command-chunks/{chunk-YS25EI54.js → chunk-PCCFLPUQ.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-26VCZHLJ.js → chunk-PIOQBOEK.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-D2KZ66W4.js → chunk-PIVH35EQ.js} +190 -42
- package/dist/safe-bash/command-chunks/{chunk-QYMEASQ6.js → chunk-PLMF35XK.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-JQVHUSDD.js → chunk-PLR5IULU.js} +5 -5
- package/dist/safe-bash/command-chunks/{chunk-2CORNDGF.js → chunk-PS5GDFIP.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-R6EGGK5M.js → chunk-Q5PWYPQV.js} +7 -7
- package/dist/safe-bash/command-chunks/{chunk-COKYZUBW.js → chunk-Q7TVCBU2.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-EHTOHOTR.js → chunk-QB72X7FF.js} +9 -9
- package/dist/safe-bash/command-chunks/{chunk-F3GP3EXE.js → chunk-RGDOYWOD.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-RQIQ75W5.js → chunk-RHDERFMR.js} +5 -5
- package/dist/safe-bash/command-chunks/{chunk-3KMOXEGH.js → chunk-RHU44OMN.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-7PVHO47B.js → chunk-RIVKF77R.js} +6 -6
- package/dist/safe-bash/command-chunks/{chunk-UOR6PXZZ.js → chunk-ROL5AEX6.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-AHA6IWAJ.js → chunk-RQYPFLZJ.js} +6 -6
- package/dist/safe-bash/command-chunks/{chunk-YSMNXMAO.js → chunk-RTNI47C5.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-W5LLKV5H.js → chunk-RV5AGXOV.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-PMAM4N33.js → chunk-RXQ2G2YK.js} +9 -9
- package/dist/safe-bash/command-chunks/{chunk-EVU7FLDA.js → chunk-S2QNBAN6.js} +7 -7
- package/dist/safe-bash/command-chunks/{chunk-YE6OAKK7.js → chunk-S43QRKDC.js} +7 -7
- package/dist/safe-bash/command-chunks/{chunk-774GLJAO.js → chunk-S7HIOT7Z.js} +4 -4
- package/dist/safe-bash/command-chunks/chunk-SEPUP6TZ.js +63 -0
- package/dist/safe-bash/command-chunks/{chunk-JPMYPOYZ.js → chunk-SUTHGUD3.js} +28 -28
- package/dist/safe-bash/command-chunks/chunk-SW37YCBW.js +286 -0
- package/dist/safe-bash/command-chunks/{chunk-Y4EYCZFT.js → chunk-SWAKALDJ.js} +10 -10
- package/dist/safe-bash/command-chunks/{chunk-QUM3SYAJ.js → chunk-SYSX46IV.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-WGH3RLJY.js → chunk-T5S4SJGO.js} +9 -9
- package/dist/safe-bash/command-chunks/{chunk-7JEIWA3A.js → chunk-TID5TSQW.js} +5 -5
- package/dist/safe-bash/command-chunks/{chunk-CRV2Q3PB.js → chunk-TJLXSENN.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-IT7TAC3F.js → chunk-TKCUGMRZ.js} +24 -20
- package/dist/safe-bash/command-chunks/{chunk-7GKKMNL6.js → chunk-TXPDKEGY.js} +8 -8
- package/dist/safe-bash/command-chunks/{chunk-A2CLZMQZ.js → chunk-UJERQEJB.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-6VPQ3CDZ.js → chunk-USGZN2KE.js} +5 -5
- package/dist/safe-bash/command-chunks/{chunk-LCZDBW55.js → chunk-UYGQEQIP.js} +5 -5
- package/dist/safe-bash/command-chunks/{chunk-MPORWUTU.js → chunk-V5XC43BX.js} +8 -8
- package/dist/safe-bash/command-chunks/{chunk-AIMSZBWP.js → chunk-V7E3PZOK.js} +9 -9
- package/dist/safe-bash/command-chunks/{chunk-CNHRVUHA.js → chunk-VDTFVRYX.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-KJ4XXZIL.js → chunk-VT2PHQ63.js} +582 -59
- package/dist/safe-bash/command-chunks/{chunk-MOZD7RUY.js → chunk-VT7UBPAE.js} +38 -15
- package/dist/safe-bash/command-chunks/{chunk-QDVI2YB6.js → chunk-VUWXLH3E.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-X7FA7ZD5.js → chunk-W3ZSWK76.js} +8 -8
- package/dist/safe-bash/command-chunks/{chunk-JPA2PUYI.js → chunk-WBKB7HBZ.js} +8 -8
- package/dist/safe-bash/command-chunks/{chunk-MIRL7HTF.js → chunk-WJ2ERUCQ.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-36XGIPOG.js → chunk-WTVJLHMG.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-SLQWQKXP.js → chunk-WWHMI4S3.js} +9 -9
- package/dist/safe-bash/command-chunks/{chunk-2UBZALAK.js → chunk-WYZG3DRR.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-YORJDX4V.js → chunk-WZRFS5OY.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-EHSM5ZQS.js → chunk-X6OHFKBL.js} +8 -8
- package/dist/safe-bash/command-chunks/{chunk-S6ZTBXYO.js → chunk-XKAUKLF7.js} +13 -13
- package/dist/safe-bash/command-chunks/{chunk-EUT24Y5Z.js → chunk-XM5QJCPD.js} +8 -8
- package/dist/safe-bash/command-chunks/{chunk-WXRYDALR.js → chunk-XMTR7QGL.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-4CKFNXRN.js → chunk-XNGM3W5R.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-2ZFLMWOX.js → chunk-XTEIT5CI.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-4DLIUTQV.js → chunk-XU6S3XUZ.js} +11 -11
- package/dist/safe-bash/command-chunks/{chunk-CJQSAATC.js → chunk-XUJAQA3S.js} +30 -30
- package/dist/safe-bash/command-chunks/{chunk-W5YSINXC.js → chunk-Y42KSX63.js} +6 -6
- package/dist/safe-bash/command-chunks/{chunk-UAXSE3XE.js → chunk-Y54L4P4J.js} +5 -5
- package/dist/safe-bash/command-chunks/{chunk-6WQD7LRA.js → chunk-YAD7EV4N.js} +14 -14
- package/dist/safe-bash/command-chunks/{chunk-WVMHRNXZ.js → chunk-YRPXBGRX.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-5HPU7D36.js → chunk-Z2WNYEPD.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-SDTPO2VV.js → chunk-Z7QOSXQC.js} +7 -7
- package/dist/safe-bash/command-chunks/{chunk-WJCN2IXI.js → chunk-ZQM37BGE.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-W3HV45CI.js → chunk-ZSQZHFWS.js} +9 -9
- package/dist/safe-bash/command-chunks/{chunk-IDJQP3A6.js → chunk-ZTMZO4IT.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-RID6VYS3.js → chunk-ZU2KJMXO.js} +8 -8
- package/dist/safe-bash/command-chunks/{chunk-YXKNJ6EM.js → chunk-ZXELXF2H.js} +5 -5
- package/dist/safe-bash/command-chunks/{clipboard-BBDK33GP-VB22F7GI.js → clipboard-BBDK33GP-QZ4ERNQX.js} +2 -2
- package/dist/safe-bash/command-chunks/{command-engine-BCUQGJJ4.js → command-engine-7V6PZR7G.js} +1012 -678
- package/dist/safe-bash/command-chunks/{engine-LAUEWYSQ-DQCEI5HE.js → engine-UYJENSWK-VSCGKSQV.js} +1 -1
- package/dist/safe-bash/command-chunks/{gnumeric-UJPXWBVR-YPXTNEDZ.js → gnumeric-UJPXWBVR-7VOHQAPM.js} +2 -2
- package/dist/safe-bash/command-chunks/{model-store-E7BHBFJC.js → model-store-UB5DWMAP.js} +24 -24
- package/dist/safe-bash/command-chunks/paradox-4FCZE53D-LQPGVMEL.js +365 -0
- package/dist/safe-bash/commands/pandoc/index.browser.js +1 -1
- package/dist/safe-bash/full-core.browser.js +2 -2
- package/dist/safe-bash/plugins/index.browser.js +2 -2
- package/dist/safe-bash-command-awk/awk-runtime.js +3 -3
- package/dist/safe-bash-command-awk/awk.js +4 -4
- package/dist/safe-bash-command-awk/index.js +4 -4
- package/dist/safe-bash-command-diff/diff.js +2 -2
- package/dist/safe-bash-command-diff/index.js +3 -3
- package/dist/safe-bash-command-diff/sync.js +2 -2
- package/dist/safe-bash-command-du/du.js +2 -2
- package/dist/safe-bash-command-du/index.js +2 -2
- package/dist/safe-bash-command-ffmpeg/index.js +1 -1
- package/dist/safe-bash-command-ffprobe/index.js +2 -2
- package/dist/safe-bash-command-ffprobe/media.d.ts +3 -1
- package/dist/safe-bash-command-ffprobe/media.js +2 -2
- package/dist/safe-bash-command-html-to-markdown/budget.js +2 -1
- package/dist/safe-bash-command-html-to-markdown/entities.js +4 -3
- package/dist/safe-bash-command-html-to-markdown/index.js +533 -310
- package/dist/safe-bash-command-html-to-markdown/input.js +6 -5
- package/dist/safe-bash-command-html-to-markdown/options.js +2 -1
- package/dist/safe-bash-command-html-to-markdown/parser.js +5 -4
- package/dist/safe-bash-command-html-to-markdown/render.js +6 -5
- package/dist/safe-bash-command-html-to-markdown/stored-text.d.ts +50 -0
- package/dist/safe-bash-command-html-to-markdown/stored-text.js +12 -0
- package/dist/safe-bash-command-html-to-markdown/text.js +3 -2
- package/dist/safe-bash-command-htmlq/contracts.d.ts +5 -0
- package/dist/safe-bash-command-htmlq/index.js +2006 -259
- package/dist/safe-bash-command-htmlq/selectors.d.ts +38 -1
- package/dist/safe-bash-command-htmlq/serializer.d.ts +1 -0
- package/dist/safe-bash-command-htmlq/tree.d.ts +4 -2
- package/dist/safe-bash-command-iconv/command.js +2 -2
- package/dist/safe-bash-command-iconv/index.js +2 -2
- package/dist/safe-bash-command-llm/command.js +3 -3
- package/dist/safe-bash-command-llm/index.js +9 -9
- package/dist/safe-bash-command-llm/openai.js +2 -2
- package/dist/safe-bash-command-llm/providers/index.js +2 -2
- package/dist/safe-bash-command-llm/providers/openai.js +2 -2
- package/dist/safe-bash-command-node/commands/node/browser.js +2 -2
- package/dist/safe-bash-command-node/commands/node/default-runtime.js +2 -2
- package/dist/safe-bash-command-node/commands/node/safejs.js +2 -2
- package/dist/safe-bash-command-pandoc/command.js +7 -7
- package/dist/safe-bash-command-pandoc/index.js +46 -46
- package/dist/safe-bash-command-patch/index.js +6 -6
- package/dist/safe-bash-command-patch/patch-envelope.js +53 -3
- package/dist/safe-bash-command-patch/patch-formats.d.ts +7 -2
- package/dist/safe-bash-command-patch/patch-formats.js +6 -4
- package/dist/safe-bash-command-patch/patch-gnu-paths.d.ts +7 -7
- package/dist/safe-bash-command-patch/patch-gnu-reject.d.ts +3 -2
- package/dist/safe-bash-command-patch/patch-gnu-reject.js +4 -3
- package/dist/safe-bash-command-patch/patch-publication.js +2 -1
- package/dist/safe-bash-command-patch/patch.js +6 -6
- package/dist/safe-bash-command-patch/stored-patch.d.ts +26 -0
- package/dist/safe-bash-command-patch/stored-target.d.ts +40 -0
- package/dist/safe-bash-command-patch/unified.d.ts +23 -10
- package/dist/safe-bash-command-patch/unified.js +3 -1
- package/dist/safe-bash-command-pdftk/index.d.ts +6 -2
- package/dist/safe-bash-command-pdftk/index.js +1247 -373
- package/dist/safe-bash-command-playwright-cli/index.js +26 -26
- package/dist/safe-bash-command-playwright-cli/playwright/abilities.js +10 -10
- package/dist/safe-bash-command-playwright-cli/playwright/controller.js +14 -14
- package/dist/safe-bash-command-playwright-cli/playwright/index.js +23 -23
- package/dist/safe-bash-command-playwright-cli/playwright/snapshot.js +2 -2
- package/dist/safe-bash-command-playwright-cli/playwright/standard-capabilities.js +6 -6
- package/dist/safe-bash-command-playwright-cli/playwright/storage-capabilities.js +4 -4
- package/dist/safe-bash-command-pptx/command-engine.d.ts +5 -1
- package/dist/safe-bash-command-pptx/engine.js +1 -1
- package/dist/safe-bash-command-pptx/index.d.ts +1 -1
- package/dist/safe-bash-command-pptx/index.js +172 -19
- package/dist/safe-bash-command-pptx/streaming-inputs.d.ts +7 -2
- package/dist/safe-bash-command-python/executor.js +5 -5
- package/dist/safe-bash-command-python/index.js +5 -5
- package/dist/safe-bash-command-python/jspi.js +2 -2
- package/dist/safe-bash-command-soffice/index.js +1 -1
- package/dist/safe-bash-command-sort/index.js +3 -3
- package/dist/safe-bash-command-ssconvert/index.js +2 -2
- package/dist/safe-bash-command-tar/create.js +2 -2
- package/dist/safe-bash-command-tar/extract.js +2 -2
- package/dist/safe-bash-command-tar/index.js +8 -8
- package/dist/safe-bash-command-tar/modes.js +4 -4
- package/dist/safe-bash-command-timeout/index.js +3 -3
- package/dist/safe-bash-command-tree/index.js +2 -2
- package/dist/safe-bash-command-tree/tree.js +2 -2
- package/dist/safe-bash-command-xmllint/index.js +22 -31
- package/dist/safe-bash-command-xz/index.js +5 -5
- package/dist/safe-bash-compression-engine/files.js +2 -2
- package/dist/safe-bash-compression-engine/operand.js +4 -4
- package/dist/safe-bash-contracts/diagnostics.js +3 -3
- package/dist/safe-bash-contracts/escaping.js +10 -10
- package/dist/safe-bash-contracts/filesystem-descriptor.js +1 -1
- package/dist/safe-bash-contracts/filesystem-output.js +6 -6
- package/dist/safe-bash-contracts/index.js +33 -33
- package/dist/safe-bash-contracts/io.js +2 -2
- package/dist/safe-bash-contracts/output.js +3 -3
- package/dist/safe-bash-docx-engine/ancillary-resources.js +5 -5
- package/dist/safe-bash-docx-engine/batch-operations.js +63 -63
- package/dist/safe-bash-docx-engine/batch-result-schema.js +74 -74
- package/dist/safe-bash-docx-engine/batch.js +74 -74
- package/dist/safe-bash-docx-engine/bookmarks.js +13 -13
- package/dist/safe-bash-docx-engine/charts.js +6 -6
- package/dist/safe-bash-docx-engine/command-option-rules.js +3 -3
- package/dist/safe-bash-docx-engine/comments.js +21 -21
- package/dist/safe-bash-docx-engine/control-bindings.js +16 -16
- package/dist/safe-bash-docx-engine/control-repeat.js +16 -16
- package/dist/safe-bash-docx-engine/controls.js +14 -14
- package/dist/safe-bash-docx-engine/create.js +8 -8
- package/dist/safe-bash-docx-engine/diagrams.js +6 -6
- package/dist/safe-bash-docx-engine/diff.js +8 -8
- package/dist/safe-bash-docx-engine/document-properties.js +12 -12
- package/dist/safe-bash-docx-engine/equations.js +12 -12
- package/dist/safe-bash-docx-engine/extract.js +9 -9
- package/dist/safe-bash-docx-engine/fields.js +18 -18
- package/dist/safe-bash-docx-engine/font-inventory.js +13 -13
- package/dist/safe-bash-docx-engine/font-resources.js +3 -3
- package/dist/safe-bash-docx-engine/image-batch-operations.js +11 -11
- package/dist/safe-bash-docx-engine/image-insertion.js +17 -17
- package/dist/safe-bash-docx-engine/image-layout.js +14 -14
- package/dist/safe-bash-docx-engine/image-replacement.js +19 -19
- package/dist/safe-bash-docx-engine/images.js +14 -14
- package/dist/safe-bash-docx-engine/index.js +102 -102
- package/dist/safe-bash-docx-engine/inspection.js +15 -15
- package/dist/safe-bash-docx-engine/invocation.js +4 -4
- package/dist/safe-bash-docx-engine/io.js +6 -6
- package/dist/safe-bash-docx-engine/links.js +17 -17
- package/dist/safe-bash-docx-engine/lists.js +16 -16
- package/dist/safe-bash-docx-engine/locations.js +10 -10
- package/dist/safe-bash-docx-engine/notes.js +18 -18
- package/dist/safe-bash-docx-engine/objects.js +14 -14
- package/dist/safe-bash-docx-engine/pack.js +9 -9
- package/dist/safe-bash-docx-engine/package-view-batch-operations.js +19 -19
- package/dist/safe-bash-docx-engine/pandoc-adapter.js +25 -25
- package/dist/safe-bash-docx-engine/paragraph-edit.js +21 -21
- package/dist/safe-bash-docx-engine/publication.js +6 -6
- package/dist/safe-bash-docx-engine/removal.js +16 -16
- package/dist/safe-bash-docx-engine/revision-decisions.js +16 -16
- package/dist/safe-bash-docx-engine/revision-edit.js +15 -15
- package/dist/safe-bash-docx-engine/revisions.js +12 -12
- package/dist/safe-bash-docx-engine/run-format.js +15 -15
- package/dist/safe-bash-docx-engine/sanitize.js +29 -29
- package/dist/safe-bash-docx-engine/sections.js +15 -15
- package/dist/safe-bash-docx-engine/settings.js +6 -6
- package/dist/safe-bash-docx-engine/shape-edit.js +16 -16
- package/dist/safe-bash-docx-engine/signatures.js +11 -11
- package/dist/safe-bash-docx-engine/stories.js +18 -18
- package/dist/safe-bash-docx-engine/structure-model-batch-operations.js +34 -34
- package/dist/safe-bash-docx-engine/style-model-batch-operations.js +24 -24
- package/dist/safe-bash-docx-engine/style-model-result-schema.js +39 -39
- package/dist/safe-bash-docx-engine/styles.js +14 -14
- package/dist/safe-bash-docx-engine/table-edit.js +23 -23
- package/dist/safe-bash-docx-engine/table-read.js +11 -11
- package/dist/safe-bash-docx-engine/template.js +17 -17
- package/dist/safe-bash-docx-engine/text-replace.js +15 -15
- package/dist/safe-bash-docx-engine/text-resource-read.js +11 -11
- package/dist/safe-bash-docx-engine/text.js +11 -11
- package/dist/safe-bash-docx-engine/validation.js +4 -4
- package/dist/safe-bash-docx-engine/xml-parts.js +17 -17
- package/dist/safe-bash-io-engine/commands/text-programs/shared.js +4 -4
- package/dist/safe-bash-line-ending-engine/command.js +3 -3
- package/dist/safe-bash-line-ending-engine/convert.js +2 -2
- package/dist/safe-bash-line-ending-engine/index.js +6 -6
- package/dist/safe-bash-line-ending-engine/info.js +2 -2
- package/dist/safe-bash-markdown-engine/commonmark-blocks.js +4 -4
- package/dist/safe-bash-markdown-engine/commonmark-inlines.js +4 -4
- package/dist/safe-bash-markdown-engine/commonmark-syntax.js +2 -2
- package/dist/safe-bash-markdown-engine/gfm-syntax.js +3 -3
- package/dist/safe-bash-markdown-engine/index.js +5 -5
- package/dist/safe-bash-network-engine/transfer.js +3 -3
- package/dist/safe-bash-presentation-engine/accessibility.js +31 -30
- package/dist/safe-bash-presentation-engine/animation-editing.js +16 -15
- package/dist/safe-bash-presentation-engine/animations.js +16 -15
- package/dist/safe-bash-presentation-engine/backgrounds.js +17 -16
- package/dist/safe-bash-presentation-engine/bytes.js +3 -3
- package/dist/safe-bash-presentation-engine/chart-editing.js +34 -33
- package/dist/safe-bash-presentation-engine/chart-object-operations.js +25 -24
- package/dist/safe-bash-presentation-engine/charts.js +31 -30
- package/dist/safe-bash-presentation-engine/command-placeholder.js +59 -56
- package/dist/safe-bash-presentation-engine/comments.js +17 -16
- package/dist/safe-bash-presentation-engine/connector-operations.js +32 -31
- package/dist/safe-bash-presentation-engine/connectors.js +29 -28
- package/dist/safe-bash-presentation-engine/content-types.js +4 -4
- package/dist/safe-bash-presentation-engine/creation.js +6 -6
- package/dist/safe-bash-presentation-engine/diff.js +32 -31
- package/dist/safe-bash-presentation-engine/drawing-enums.d.ts +10 -10
- package/dist/safe-bash-presentation-engine/drawing-format.js +20 -19
- package/dist/safe-bash-presentation-engine/drawing-operations.js +31 -30
- package/dist/safe-bash-presentation-engine/drawing-schema.js +21 -20
- package/dist/safe-bash-presentation-engine/equations.js +17 -16
- package/dist/safe-bash-presentation-engine/errors.js +2 -2
- package/dist/safe-bash-presentation-engine/fields.js +17 -16
- package/dist/safe-bash-presentation-engine/font-metrics.js +3 -3
- package/dist/safe-bash-presentation-engine/image-extraction.js +20 -19
- package/dist/safe-bash-presentation-engine/image-formatting.js +32 -31
- package/dist/safe-bash-presentation-engine/image-insertion.js +18 -17
- package/dist/safe-bash-presentation-engine/image-replacement.js +21 -20
- package/dist/safe-bash-presentation-engine/image-value.js +4 -4
- package/dist/safe-bash-presentation-engine/images.js +19 -18
- package/dist/safe-bash-presentation-engine/index.d.ts +5 -1
- package/dist/safe-bash-presentation-engine/index.js +121 -108
- package/dist/safe-bash-presentation-engine/layouts.js +16 -15
- package/dist/safe-bash-presentation-engine/length.js +3 -3
- package/dist/safe-bash-presentation-engine/links.js +16 -15
- package/dist/safe-bash-presentation-engine/masters.js +15 -14
- package/dist/safe-bash-presentation-engine/media-editing.js +24 -23
- package/dist/safe-bash-presentation-engine/media-extraction.js +17 -16
- package/dist/safe-bash-presentation-engine/media.js +16 -15
- package/dist/safe-bash-presentation-engine/memberships.js +15 -14
- package/dist/safe-bash-presentation-engine/notes.js +16 -15
- package/dist/safe-bash-presentation-engine/ole-enum.js +4 -4
- package/dist/safe-bash-presentation-engine/ole-insertion.js +20 -19
- package/dist/safe-bash-presentation-engine/opaque-objects.js +9 -9
- package/dist/safe-bash-presentation-engine/package-reader.js +5 -5
- package/dist/safe-bash-presentation-engine/package-tools.d.ts +3 -0
- package/dist/safe-bash-presentation-engine/package-tools.js +27 -17
- package/dist/safe-bash-presentation-engine/package-uri.js +3 -3
- package/dist/safe-bash-presentation-engine/package-writer.js +4 -4
- package/dist/safe-bash-presentation-engine/presentation-model.js +58 -55
- package/dist/safe-bash-presentation-engine/presentation-settings.js +14 -13
- package/dist/safe-bash-presentation-engine/properties.js +16 -15
- package/dist/safe-bash-presentation-engine/relationships.js +4 -4
- package/dist/safe-bash-presentation-engine/resource-limits.js +1 -1
- package/dist/safe-bash-presentation-engine/retained-archive-staging.d.ts +19 -0
- package/dist/safe-bash-presentation-engine/retained-extraction-output.d.ts +18 -0
- package/dist/safe-bash-presentation-engine/retained-frame-formatting.d.ts +14 -0
- package/dist/safe-bash-presentation-engine/retained-inspection.js +14 -12
- package/dist/safe-bash-presentation-engine/retained-package-extraction.d.ts +22 -0
- package/dist/safe-bash-presentation-engine/retained-package-packing.d.ts +19 -0
- package/dist/safe-bash-presentation-engine/retained-package.d.ts +2 -0
- package/dist/safe-bash-presentation-engine/retained-package.js +6 -4
- package/dist/safe-bash-presentation-engine/retained-text.d.ts +9 -2
- package/dist/safe-bash-presentation-engine/retained-text.js +131 -30
- package/dist/safe-bash-presentation-engine/retained-xml-document.d.ts +1 -0
- package/dist/safe-bash-presentation-engine/retained-xml-parts.d.ts +5 -1
- package/dist/safe-bash-presentation-engine/retained-xml-publication.d.ts +18 -0
- package/dist/safe-bash-presentation-engine/retained-xml-replacement.d.ts +13 -0
- package/dist/safe-bash-presentation-engine/sanitize.js +17 -16
- package/dist/safe-bash-presentation-engine/selectors.js +10 -10
- package/dist/safe-bash-presentation-engine/shape-groups.js +31 -30
- package/dist/safe-bash-presentation-engine/shape-operations.js +30 -29
- package/dist/safe-bash-presentation-engine/shape-path-operations.js +32 -31
- package/dist/safe-bash-presentation-engine/shape-paths.js +16 -15
- package/dist/safe-bash-presentation-engine/shape-presets.js +3 -3
- package/dist/safe-bash-presentation-engine/shape-selection.js +31 -30
- package/dist/safe-bash-presentation-engine/shape-transforms.js +18 -17
- package/dist/safe-bash-presentation-engine/shapes.d.ts +1 -1
- package/dist/safe-bash-presentation-engine/shapes.js +27 -26
- package/dist/safe-bash-presentation-engine/slide-copy.js +17 -16
- package/dist/safe-bash-presentation-engine/slide-import.js +18 -17
- package/dist/safe-bash-presentation-engine/slide-merge-split.js +20 -19
- package/dist/safe-bash-presentation-engine/slide-model.js +43 -42
- package/dist/safe-bash-presentation-engine/slide-removal.js +18 -17
- package/dist/safe-bash-presentation-engine/slide-transfer-budget.js +9 -9
- package/dist/safe-bash-presentation-engine/slides.js +19 -16
- package/dist/safe-bash-presentation-engine/table-operations.js +33 -32
- package/dist/safe-bash-presentation-engine/table-spans.js +32 -31
- package/dist/safe-bash-presentation-engine/tables.js +31 -30
- package/dist/safe-bash-presentation-engine/tags.js +16 -15
- package/dist/safe-bash-presentation-engine/template-bindings.js +33 -32
- package/dist/safe-bash-presentation-engine/template-repeat.js +40 -39
- package/dist/safe-bash-presentation-engine/text-fitting.js +27 -26
- package/dist/safe-bash-presentation-engine/text-frames.d.ts +13 -0
- package/dist/safe-bash-presentation-engine/text-frames.js +29 -26
- package/dist/safe-bash-presentation-engine/text-paragraphs.js +27 -26
- package/dist/safe-bash-presentation-engine/text-reading.js +11 -11
- package/dist/safe-bash-presentation-engine/text-replacement.js +17 -16
- package/dist/safe-bash-presentation-engine/text-runs.js +20 -19
- package/dist/safe-bash-presentation-engine/themes.js +16 -15
- package/dist/safe-bash-presentation-engine/transitions.js +16 -15
- package/dist/safe-bash-presentation-engine/validation.js +10 -9
- package/dist/safe-bash-presentation-engine/xml-parts.d.ts +2 -0
- package/dist/safe-bash-presentation-engine/xml-parts.js +23 -15
- package/dist/safe-bash-presentation-engine/xml-view.js +3 -3
- package/dist/safe-bash-presentation-engine/xml.js +3 -3
- package/dist/safe-bash-query-engine/index.js +4 -4
- package/dist/safe-bash-query-engine/interpreter.js +2 -2
- package/dist/safe-bash-query-engine/query-core.js +4 -4
- package/dist/safe-bash-regex-engine/index.js +1 -1
- package/dist/safe-bash-regex-engine/python-glob.js +1 -1
- package/dist/safe-bash-regex-engine/text/regex.d.ts +19 -0
- package/dist/safe-bash-regex-engine/text/regex.js +1 -1
- package/dist/safe-bash-xml-engine/document.js +3 -3
- package/dist/safe-bash-xml-engine/evaluate.js +1 -1
- package/dist/safe-bash-xml-engine/index.d.ts +1 -0
- package/dist/safe-bash-xml-engine/index.js +9 -5
- package/dist/safe-bash-xml-engine/query.js +2 -2
- package/dist/safe-bash-xml-engine/recovery.d.ts +10 -0
- package/dist/safe-bash-xml-engine/stored-document.d.ts +3 -3
- package/dist/safe-bash-xml-engine/stored-document.js +1 -1
- package/dist/safe-bash-xml-engine/stored-evaluate.js +1 -1
- package/dist/safe-bash-zip-engine/zip/repair.js +3 -3
- package/dist/safe-bash-zip-engine/zip/volumes.js +3 -3
- package/dist/spreadsheet-engine/datasource.js +16 -2
- package/dist/spreadsheet-engine/formulas/diagnostics.d.ts +2 -1
- package/dist/spreadsheet-engine/formulas/diagnostics.js +2 -2
- package/dist/spreadsheet-engine/formulas/evaluator.d.ts +1 -1
- package/dist/spreadsheet-engine/formulas/evaluator.js +2 -1
- package/dist/spreadsheet-engine/formulas/functions/python-printf.js +56 -33
- package/dist/spreadsheet-format-xls/biff-encrypted-properties.d.ts +1 -1
- package/dist/spreadsheet-format-xls/biff-encrypted-properties.js +54 -24
- package/dist/spreadsheet-format-xls/biff-properties-merge.d.ts +6 -2
- package/dist/spreadsheet-format-xls/biff-properties-merge.js +413 -296
- package/dist/spreadsheet-format-xls/biff-properties-write.js +40 -23
- package/dist/spreadsheet-format-xls/biff-properties.js +95 -175
- package/dist/spreadsheet-format-xls/biff-property-dictionary.d.ts +5 -0
- package/dist/spreadsheet-format-xls/biff-property-dictionary.js +75 -0
- package/dist/spreadsheet-format-xls/biff-property-index.d.ts +23 -0
- package/dist/spreadsheet-format-xls/biff-property-index.js +93 -0
- package/dist/spreadsheet-format-xls/biff-property-name.d.ts +4 -0
- package/dist/spreadsheet-format-xls/biff-property-name.js +114 -0
- package/dist/spreadsheet-format-xls/biff-property-range.d.ts +17 -3
- package/dist/spreadsheet-format-xls/biff-property-range.js +178 -37
- package/dist/spreadsheet-format-xls/biff-property-text.d.ts +6 -0
- package/dist/spreadsheet-format-xls/biff-property-text.js +68 -0
- package/dist/spreadsheet-format-xls/biff-property-transcode.d.ts +5 -0
- package/dist/spreadsheet-format-xls/biff-property-transcode.js +45 -0
- package/package.json +8 -3
- package/dist/safe-bash/command-chunks/biff-YKPDH35C-MVQIWNKV.js +0 -4974
- package/dist/safe-bash/command-chunks/chunk-2VLAXKTS.js +0 -245
- package/dist/safe-bash/command-chunks/chunk-5Q22ZLNC.js +0 -127
- package/dist/safe-bash/command-chunks/chunk-JKLOBSMP.js +0 -56
- package/dist/safe-bash/command-chunks/chunk-JYTESTBS.js +0 -99
- package/dist/safe-bash/command-chunks/chunk-ZEGNRZV2.js +0 -333
- package/dist/safe-bash/command-chunks/paradox-ZWWXYY4J-JYOSWSBL.js +0 -362
- package/dist/spreadsheet-format-xls/biff-properties-layout.js +0 -56
- package/dist/safe-bash/command-chunks/{chunk-X2HVVMTW.js → chunk-AW4Q3GZW.js} +6 -6
- package/dist/safe-bash/command-chunks/{chunk-JC2EV66U.js → chunk-BJXADHRT.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-XI2LETBJ.js → chunk-BXU5Y7I5.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-PVLPWVRH.js → chunk-D3HW7R2N.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-OLK3DCJD.js → chunk-DYERIXPU.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-WYBCSJFG.js → chunk-FWCUEZ3K.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-FF2SQ2GP.js → chunk-GGH376XQ.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-D66Q7QJ3.js → chunk-JRSZ5IGD.js} +6 -6
- package/dist/safe-bash/command-chunks/{chunk-Z3YB4EVE.js → chunk-KSM5CCHT.js} +8 -8
- package/dist/safe-bash/command-chunks/{chunk-NJ4NTTCR.js → chunk-LNLACEAN.js} +8 -8
- package/dist/safe-bash/command-chunks/{chunk-NBTG6NF6.js → chunk-LTJRUMK6.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-XCYTG7CR.js → chunk-NJGL5JQ6.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-SZ66JC25.js → chunk-Q7J2NTH2.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-MDV7W5AS.js → chunk-SKNI2XQA.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-7ZWACKCG.js → chunk-T6OXG7QQ.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-ECDEPKKW.js → chunk-W25EIKDJ.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-4YSBUQPV.js → chunk-W2FKFEVY.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-2CIDPOUV.js → chunk-WSNHJZQ5.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-4H3TYOVC.js → chunk-Y7AXMCFV.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-U6IEK2CI.js → chunk-YPG55QTP.js} +7 -7
- package/dist/safe-bash/command-chunks/{chunk-252L5YC5.js → chunk-Z37OM247.js} +6 -6
- package/dist/safe-bash/command-chunks/{pln-DFS7VLVS-JATX6FS7.js → pln-DFS7VLVS-OVOBS4QX.js} +3 -3
- package/dist/safe-bash/command-chunks/{psion-YBI6JEQI-6OMC2PGC.js → psion-YBI6JEQI-GY4S6ZLC.js} +3 -3
package/dist/safe-bash/command-chunks/{command-engine-BCUQGJJ4.js → command-engine-7V6PZR7G.js}
RENAMED
|
@@ -1,10 +1,295 @@
|
|
|
1
1
|
import "./chunk-37XCUS43.js";
|
|
2
|
-
import
|
|
2
|
+
import {
|
|
3
|
+
ZipDirectoryIndex
|
|
4
|
+
} from "./chunk-IOEUZ4EA.js";
|
|
3
5
|
import {
|
|
4
6
|
yieldEventLoop
|
|
5
7
|
} from "./chunk-E6SK3OU2.js";
|
|
8
|
+
import {
|
|
9
|
+
BackedJson,
|
|
10
|
+
parseBackedJson
|
|
11
|
+
} from "./chunk-NUGQQDGE.js";
|
|
6
12
|
import "./chunk-65DS4IOB.js";
|
|
7
13
|
|
|
14
|
+
// packages/safe-bash-command-pptx/src/retained-pack-manifest.ts
|
|
15
|
+
import { PagedStorage } from "@poe-platform/safe-fs/storage";
|
|
16
|
+
import { resourceContext } from "../../safe-bash-presentation-engine/resource-limits.js";
|
|
17
|
+
import { OfficeError as OfficeError2 } from "../../safe-bash-presentation-engine/errors.js";
|
|
18
|
+
import { asciiKey, partName } from "../../safe-bash-presentation-engine/package-uri.js";
|
|
19
|
+
|
|
20
|
+
// packages/safe-bash-command-pptx/src/command-package-path.ts
|
|
21
|
+
import { OfficeError } from "../../safe-bash-presentation-engine/errors.js";
|
|
22
|
+
function usage(message) {
|
|
23
|
+
throw new OfficeError("invalid-value", message, "usage");
|
|
24
|
+
}
|
|
25
|
+
function scopedPackagePath(manifest, path) {
|
|
26
|
+
if (path === "-") return path;
|
|
27
|
+
if (path.includes("\\") || [...path].some((c) => c.charCodeAt(0) < 32))
|
|
28
|
+
usage("Invalid scoped file path.");
|
|
29
|
+
const prefix = path.startsWith("/") ? "" : manifest === "-" ? "/" : manifest.slice(0, manifest.lastIndexOf("/") + 1);
|
|
30
|
+
const absolute = (prefix + path).startsWith("/");
|
|
31
|
+
const segments = [];
|
|
32
|
+
for (const segment of (prefix + path).split("/")) {
|
|
33
|
+
if (!segment || segment === ".") continue;
|
|
34
|
+
if (segment === "..") {
|
|
35
|
+
if (!segments.length) usage("Scoped path escapes its root.");
|
|
36
|
+
segments.pop();
|
|
37
|
+
} else segments.push(segment);
|
|
38
|
+
}
|
|
39
|
+
return (absolute ? "/" : "") + segments.join("/");
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// packages/safe-bash-command-pptx/src/retained-pack-manifest.ts
|
|
43
|
+
async function openRetainedPackManifest(source3, settings, options2) {
|
|
44
|
+
const context = resourceContext(settings), signal = context.signal ?? new AbortController().signal;
|
|
45
|
+
const working = { ...settings.workingStorage }, cacheBytes = working.cacheBytes ?? 1024 * 1024;
|
|
46
|
+
if (!working.fs || typeof working.directory !== "string" || !working.directory.startsWith("/") || !Number.isSafeInteger(cacheBytes) || cacheBytes < 16384 || cacheBytes % 16384)
|
|
47
|
+
throw new OfficeError2("invalid-value", "Explicit manifest storage and a valid cache budget are required.", "usage");
|
|
48
|
+
const manifestPath = options2.manifest, outputPath = options2.output;
|
|
49
|
+
const pages = new PagedStorage({ fs: working.fs, cwd: working.directory, env: {}, signal }, cacheBytes / 16384);
|
|
50
|
+
const index = new PagedStorage({ fs: working.fs, cwd: working.directory, env: {}, signal }, cacheBytes / 16384);
|
|
51
|
+
let closed = false, closing, count = 0, parts = 0;
|
|
52
|
+
const check = () => {
|
|
53
|
+
if (closed) throw new OfficeError2("invalid-handle", "Manifest is closed.", "admit");
|
|
54
|
+
if (signal.aborted) throw new OfficeError2("cancelled", "Operation cancelled.", "admit");
|
|
55
|
+
};
|
|
56
|
+
const usage14 = () => {
|
|
57
|
+
throw new OfficeError2("invalid-value", "Manifest requires unique canonical parts, hashes and explicit scoped files.", "usage");
|
|
58
|
+
};
|
|
59
|
+
const limit = () => {
|
|
60
|
+
throw new OfficeError2("resource-limit", "Manifest exceeds input limits.", "admit");
|
|
61
|
+
};
|
|
62
|
+
const failure = (error) => error instanceof OfficeError2 ? error : new OfficeError2(signal.aborted ? "cancelled" : error && typeof error === "object" && "code" in error && error.code === "EFBIG" ? "resource-limit" : "io-failure", "Manifest input or storage failed.", "admit");
|
|
63
|
+
const close = () => {
|
|
64
|
+
closed = true;
|
|
65
|
+
return closing ??= (async () => {
|
|
66
|
+
const outcomes = await Promise.allSettled([pages.close(), index.close()]);
|
|
67
|
+
for (const outcome of outcomes) if (outcome.status === "rejected") throw outcome.reason;
|
|
68
|
+
})();
|
|
69
|
+
};
|
|
70
|
+
let work = 0;
|
|
71
|
+
const cooperate = async (units = 1) => {
|
|
72
|
+
check();
|
|
73
|
+
work += units;
|
|
74
|
+
if (work >= 4096) {
|
|
75
|
+
work = 0;
|
|
76
|
+
await yieldEventLoop();
|
|
77
|
+
check();
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
const tree = new BackedJson(pages, cooperate), names = new ZipDirectoryIndex(index, { signal });
|
|
81
|
+
async function text2(position) {
|
|
82
|
+
let value = "";
|
|
83
|
+
for await (const fragment of tree.scalarChunks(position)) {
|
|
84
|
+
check();
|
|
85
|
+
value += fragment;
|
|
86
|
+
}
|
|
87
|
+
return value;
|
|
88
|
+
}
|
|
89
|
+
async function fields2(position, keys) {
|
|
90
|
+
const header = await tree.describe(position);
|
|
91
|
+
if (header.kind !== "object" || header.children !== keys.length * 2) usage14();
|
|
92
|
+
const result = {};
|
|
93
|
+
let key;
|
|
94
|
+
for await (const child of tree.children(position)) {
|
|
95
|
+
check();
|
|
96
|
+
if (key === void 0) {
|
|
97
|
+
key = await tree.smallText(child, Math.max(...keys.map((key2) => key2.length)));
|
|
98
|
+
if (key === void 0 || !keys.includes(key)) usage14();
|
|
99
|
+
} else {
|
|
100
|
+
result[key] = child;
|
|
101
|
+
key = void 0;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return result;
|
|
105
|
+
}
|
|
106
|
+
async function member(row) {
|
|
107
|
+
const fields3 = { part: await tree.property(row, "part"), sha256: await tree.property(row, "sha256") };
|
|
108
|
+
const part = await tree.smallText(fields3.part, 65535), sha2565 = await tree.smallText(fields3.sha256, 64);
|
|
109
|
+
if (part === void 0) return limit();
|
|
110
|
+
if (sha2565 === void 0) return usage14();
|
|
111
|
+
return { part, sha256: sha2565 };
|
|
112
|
+
}
|
|
113
|
+
async function pathAt(row) {
|
|
114
|
+
const file = await tree.property(row, "file"), path = await tree.property(file, "vfsPath");
|
|
115
|
+
return scopedPackagePath(manifestPath, await text2(path));
|
|
116
|
+
}
|
|
117
|
+
async function* decoded() {
|
|
118
|
+
let iterator, exhausted = false, size = 0;
|
|
119
|
+
const decoder = new TextDecoder("utf-8", { fatal: true });
|
|
120
|
+
try {
|
|
121
|
+
iterator = source3[Symbol.asyncIterator]();
|
|
122
|
+
for (let reads = 0; reads < context.limits.maxReads; reads++) {
|
|
123
|
+
await cooperate();
|
|
124
|
+
const item = await iterator.next();
|
|
125
|
+
check();
|
|
126
|
+
if (item.done) {
|
|
127
|
+
exhausted = true;
|
|
128
|
+
let tail;
|
|
129
|
+
try {
|
|
130
|
+
tail = decoder.decode();
|
|
131
|
+
} catch {
|
|
132
|
+
usage14();
|
|
133
|
+
}
|
|
134
|
+
if (tail) yield tail;
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
if (!(item.value instanceof Uint8Array)) throw new OfficeError2("invalid-type", "Manifest source returned invalid bytes.", "admit");
|
|
138
|
+
size += item.value.length;
|
|
139
|
+
if (!Number.isSafeInteger(size) || size > Math.min(context.limits.maxBytes, context.xmlLimits.maxBytes)) limit();
|
|
140
|
+
for (let offset = 0; offset < item.value.length; offset += 16384) {
|
|
141
|
+
check();
|
|
142
|
+
let fragment;
|
|
143
|
+
try {
|
|
144
|
+
fragment = decoder.decode(item.value.subarray(offset, offset + 16384), { stream: true });
|
|
145
|
+
} catch {
|
|
146
|
+
usage14();
|
|
147
|
+
}
|
|
148
|
+
if (fragment) yield fragment;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
limit();
|
|
152
|
+
} finally {
|
|
153
|
+
if (!exhausted) try {
|
|
154
|
+
await iterator?.return?.();
|
|
155
|
+
} catch {
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
try {
|
|
160
|
+
check();
|
|
161
|
+
await parseBackedJson(decoded(), tree, index, cooperate, usage14, void 0, false, (depth) => {
|
|
162
|
+
if (depth > 32) usage14();
|
|
163
|
+
});
|
|
164
|
+
parts = (await fields2(tree.rootPosition, ["parts"])).parts;
|
|
165
|
+
const array = await tree.describe(parts);
|
|
166
|
+
if (array.kind !== "array" || !array.children) usage14();
|
|
167
|
+
count = array.children;
|
|
168
|
+
if (count > context.archiveLimits.maxMembers) limit();
|
|
169
|
+
let stdin = manifestPath === "-" ? 1 : 0;
|
|
170
|
+
if (outputPath !== "-" && outputPath === manifestPath) usage14();
|
|
171
|
+
for await (const row of tree.children(parts)) {
|
|
172
|
+
check();
|
|
173
|
+
const values3 = await fields2(row, ["part", "sha256", "file"]);
|
|
174
|
+
for (const key2 of ["part", "sha256"]) if ((await tree.describe(values3[key2])).kind !== "string") usage14();
|
|
175
|
+
const item = await member(row);
|
|
176
|
+
try {
|
|
177
|
+
if (partName(item.part, false) !== item.part) usage14();
|
|
178
|
+
} catch {
|
|
179
|
+
usage14();
|
|
180
|
+
}
|
|
181
|
+
if (item.sha256.length !== 64 || [...item.sha256].some((character) => !"0123456789abcdef".includes(character))) usage14();
|
|
182
|
+
const key = asciiKey(item.part);
|
|
183
|
+
if (await names.get(key) !== void 0) usage14();
|
|
184
|
+
await names.set(key, row);
|
|
185
|
+
const file = await fields2(values3.file, ["vfsPath"]);
|
|
186
|
+
if ((await tree.describe(file.vfsPath)).kind !== "string") usage14();
|
|
187
|
+
const rawPath = await text2(file.vfsPath);
|
|
188
|
+
if (!rawPath.length) usage14();
|
|
189
|
+
const path = scopedPackagePath(manifestPath, rawPath);
|
|
190
|
+
if (path === "-" && ++stdin > 1 || outputPath !== "-" && path === outputPath) usage14();
|
|
191
|
+
}
|
|
192
|
+
return Object.freeze({
|
|
193
|
+
count,
|
|
194
|
+
close,
|
|
195
|
+
async *members() {
|
|
196
|
+
try {
|
|
197
|
+
check();
|
|
198
|
+
for await (const row of tree.children(parts)) {
|
|
199
|
+
check();
|
|
200
|
+
yield await member(row);
|
|
201
|
+
}
|
|
202
|
+
check();
|
|
203
|
+
} catch (error) {
|
|
204
|
+
throw failure(error);
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
async path(part) {
|
|
208
|
+
try {
|
|
209
|
+
check();
|
|
210
|
+
const row = await names.get(asciiKey(part));
|
|
211
|
+
if (row === void 0) throw new OfficeError2("missing-binding", "Manifest member is absent.", "admit");
|
|
212
|
+
return await pathAt(row);
|
|
213
|
+
} catch (error) {
|
|
214
|
+
throw failure(error);
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
async *paths() {
|
|
218
|
+
try {
|
|
219
|
+
check();
|
|
220
|
+
yield manifestPath;
|
|
221
|
+
for await (const row of tree.children(parts)) {
|
|
222
|
+
check();
|
|
223
|
+
yield await pathAt(row);
|
|
224
|
+
}
|
|
225
|
+
check();
|
|
226
|
+
} catch (error) {
|
|
227
|
+
throw failure(error);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
} catch (error) {
|
|
232
|
+
const primary = failure(error);
|
|
233
|
+
await close().catch(() => {
|
|
234
|
+
});
|
|
235
|
+
throw primary;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
// packages/safe-bash-command-pptx/src/command-engine.ts
|
|
240
|
+
import { stageRetainedPackage } from "../../safe-bash-presentation-engine/package-tools.js";
|
|
241
|
+
|
|
242
|
+
// packages/safe-bash-command-pptx/src/command-extract-streaming.ts
|
|
243
|
+
import { openRetainedPackageExtraction, stageRetainedExtractionOutput } from "../../safe-bash-presentation-engine/package-tools.js";
|
|
244
|
+
import { OfficeError as OfficeError3 } from "../../safe-bash-presentation-engine/errors.js";
|
|
245
|
+
async function prepareRetainedExtraction(args, request, options2) {
|
|
246
|
+
const { streaming, signal } = request, context = { ...options2.context, signal, workingStorage: streaming.workingStorage };
|
|
247
|
+
const input = await streaming.openInput(args.input, Math.min(context.limits.maxBytes, context.archiveLimits.maxArchiveBytes));
|
|
248
|
+
const extraction = await openRetainedPackageExtraction(input, context, args.parts ? { parts: args.parts } : {});
|
|
249
|
+
let response, closing;
|
|
250
|
+
const close = () => closing ??= (async () => {
|
|
251
|
+
const results = await Promise.allSettled([response?.close(), extraction.close()]);
|
|
252
|
+
for (const result of results) if (result.status === "rejected") throw result.reason;
|
|
253
|
+
})();
|
|
254
|
+
try {
|
|
255
|
+
let total = 0;
|
|
256
|
+
for await (const member of extraction.members()) total += member.size;
|
|
257
|
+
if (extraction.count > (args.limits?.maxOutputs ?? context.archiveLimits.maxMembers) || !Number.isSafeInteger(total) || total > options2.maxOutputBytes)
|
|
258
|
+
throw new OfficeError3("resource-limit", "Package extraction exceeds output limits.", "validate-intent");
|
|
259
|
+
if (!request.publishOutputStreams && (!args.allowPartialOutput || !request.publishOutput)) throw Object.assign(new Error("Extraction requires a publication capability."), { code: "publication-unsupported" });
|
|
260
|
+
response = await stageRetainedExtractionOutput(extraction, context, { directory: args.outputDir, json: args.json, maxOutputBytes: options2.maxOutputBytes, allowPartialOutput: args.allowPartialOutput ?? false });
|
|
261
|
+
async function* publications(dryRun) {
|
|
262
|
+
for await (const member of extraction.members()) {
|
|
263
|
+
signal.throwIfAborted();
|
|
264
|
+
yield { inputPath: args.input, outputPath: response.path(member.name), bytes: member.bytes(), originalBytes: input, inPlace: false, force: args.force ?? false, dryRun };
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
return { close, async publish() {
|
|
268
|
+
let published = 0, code;
|
|
269
|
+
try {
|
|
270
|
+
for await (const item of publications(true)) {
|
|
271
|
+
if (request.preflightOutputStream) await request.preflightOutputStream(item);
|
|
272
|
+
else if (request.publishOutput) await request.publishOutput(item);
|
|
273
|
+
}
|
|
274
|
+
if (request.publishOutputStreams) await request.publishOutputStreams(publications(false));
|
|
275
|
+
else for await (const item of publications(false)) {
|
|
276
|
+
await request.publishOutput(item);
|
|
277
|
+
published++;
|
|
278
|
+
}
|
|
279
|
+
} catch (error) {
|
|
280
|
+
const raw = error && typeof error === "object" && "code" in error ? error.code : void 0;
|
|
281
|
+
code = signal.aborted ? "cancelled" : typeof raw === "string" && ["resource-limit", "stale-input", "publication-unsupported"].includes(raw) ? raw : "io-failure";
|
|
282
|
+
}
|
|
283
|
+
await response.write(!code || args.json ? streaming.stdout : streaming.stderr, code ? { code, published } : void 0);
|
|
284
|
+
return { exitCode: !code ? 0 : code === "cancelled" ? 130 : code === "resource-limit" ? 4 : code === "stale-input" ? 1 : 3, stdout: new Uint8Array(), stderr: new Uint8Array() };
|
|
285
|
+
} };
|
|
286
|
+
} catch (error) {
|
|
287
|
+
await close().catch(() => {
|
|
288
|
+
});
|
|
289
|
+
throw error;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
8
293
|
// packages/safe-bash-command-pptx/src/command-engine.ts
|
|
9
294
|
import { stageRetainedText } from "../../safe-bash-presentation-engine/retained-text.js";
|
|
10
295
|
import { stageRetainedInspection } from "../../safe-bash-presentation-engine/retained-inspection.js";
|
|
@@ -12,7 +297,7 @@ import { openPackageArchive } from "../../safe-bash-presentation-engine/retained
|
|
|
12
297
|
|
|
13
298
|
// packages/safe-bash-command-pptx/src/capabilities-discovery.ts
|
|
14
299
|
import { parseContentTypes } from "../../safe-bash-presentation-engine/content-types.js";
|
|
15
|
-
import { OfficeError } from "../../safe-bash-presentation-engine/errors.js";
|
|
300
|
+
import { OfficeError as OfficeError4 } from "../../safe-bash-presentation-engine/errors.js";
|
|
16
301
|
import { readRelationshipGraph } from "../../safe-bash-presentation-engine/relationships.js";
|
|
17
302
|
import { readPackage } from "../../safe-bash-presentation-engine/package-reader.js";
|
|
18
303
|
import { parseXmlPart } from "../../safe-bash-presentation-engine/xml.js";
|
|
@@ -49,7 +334,7 @@ function declaredFeatureCapabilities(features, operations) {
|
|
|
49
334
|
Object.entries(features).map(([name, feature]) => {
|
|
50
335
|
const paths = feature.operations ?? (feature.operation ? [feature.operation] : featureOperations[name]);
|
|
51
336
|
if (!paths?.length || paths.some((path) => !Object.hasOwn(operations, path))) {
|
|
52
|
-
throw new
|
|
337
|
+
throw new OfficeError4(
|
|
53
338
|
"invalid-value",
|
|
54
339
|
"Capability references an undeclared operation.",
|
|
55
340
|
"usage"
|
|
@@ -99,7 +384,7 @@ async function assessCapabilities(input, context) {
|
|
|
99
384
|
try {
|
|
100
385
|
contentType = types.get(part);
|
|
101
386
|
} catch (error) {
|
|
102
|
-
if (!(error instanceof
|
|
387
|
+
if (!(error instanceof OfficeError4) || error.code !== "missing-binding") throw error;
|
|
103
388
|
}
|
|
104
389
|
}
|
|
105
390
|
const type = contentType?.split(";", 1)[0].trim().toLowerCase();
|
|
@@ -114,7 +399,7 @@ async function assessCapabilities(input, context) {
|
|
|
114
399
|
const data = reader.get(part);
|
|
115
400
|
xmlBytes += data.length;
|
|
116
401
|
if (xmlBytes > context.xmlLimits.maxBytes || nodes >= context.xmlLimits.maxNodes)
|
|
117
|
-
throw new
|
|
402
|
+
throw new OfficeError4(
|
|
118
403
|
"resource-limit",
|
|
119
404
|
"Capability XML inspection limit exceeded.",
|
|
120
405
|
"index"
|
|
@@ -125,7 +410,7 @@ async function assessCapabilities(input, context) {
|
|
|
125
410
|
});
|
|
126
411
|
nodes += xml.nodeCount;
|
|
127
412
|
if (nodes > context.xmlLimits.maxNodes)
|
|
128
|
-
throw new
|
|
413
|
+
throw new OfficeError4("resource-limit", "Capability XML node limit exceeded.", "index");
|
|
129
414
|
const pending = [xml.root];
|
|
130
415
|
let visited = 0;
|
|
131
416
|
while (pending.length) {
|
|
@@ -3464,7 +3749,7 @@ var discoverySchemas = Object.fromEntries([
|
|
|
3464
3749
|
}]));
|
|
3465
3750
|
|
|
3466
3751
|
// packages/safe-bash-command-pptx/src/command-objects-add.ts
|
|
3467
|
-
import { OfficeError as
|
|
3752
|
+
import { OfficeError as OfficeError5 } from "../../safe-bash-presentation-engine/errors.js";
|
|
3468
3753
|
import { addOleObject } from "../../safe-bash-presentation-engine/ole-insertion.js";
|
|
3469
3754
|
var objectsAddUsage = "Usage: pptx objects add INPUT --slide N --file PATH --icon PATH (--program-id TEXT | --program DOCX|PPTX|XLSX) [--icon-content-type TYPE]\n --left LENGTH --top LENGTH --width LENGTH --height LENGTH --icon-width LENGTH --icon-height LENGTH --name TEXT\n --output PATH|--in-place|--dry-run [--force] [--json] [--limit NAME=VALUE]\nEmbed explicit inert bytes with an explicit icon. No activation or recursive payload parsing.\n";
|
|
3470
3755
|
var length = {
|
|
@@ -3571,24 +3856,24 @@ var objectsAddSchema = {
|
|
|
3571
3856
|
}
|
|
3572
3857
|
}
|
|
3573
3858
|
};
|
|
3574
|
-
function
|
|
3575
|
-
throw new
|
|
3859
|
+
function usage2(message) {
|
|
3860
|
+
throw new OfficeError5("invalid-value", message, "usage");
|
|
3576
3861
|
}
|
|
3577
3862
|
function validateObjectsAddCommand(args, positionals, seen) {
|
|
3578
3863
|
const allowed = Object.keys(objectsAddSchema.options.properties).map(
|
|
3579
3864
|
(key) => "--" + [...key].map((c) => c >= "A" && c <= "Z" ? "-" + c.toLowerCase() : c).join("")
|
|
3580
3865
|
);
|
|
3581
3866
|
if ([...seen].some((flag) => !allowed.includes(flag)))
|
|
3582
|
-
|
|
3867
|
+
usage2("Option does not apply to object insertion.");
|
|
3583
3868
|
if (positionals.length !== 1 || !positionals[0])
|
|
3584
|
-
|
|
3869
|
+
usage2("Object insertion requires exactly one input.");
|
|
3585
3870
|
args.input = positionals[0];
|
|
3586
3871
|
if (seen.has("--program-id") && seen.has("--program"))
|
|
3587
|
-
|
|
3872
|
+
usage2("Program and program ID are mutually exclusive.");
|
|
3588
3873
|
if (!args.slide || !args.file || !args.icon || !args.objectAdd?.progId)
|
|
3589
|
-
|
|
3874
|
+
usage2("Object insertion requires slide, file, icon and program ID.");
|
|
3590
3875
|
if ([args.input, args.file, args.icon].filter((path) => path === "-").length > 1)
|
|
3591
|
-
|
|
3876
|
+
usage2("Only one input may consume stdin.");
|
|
3592
3877
|
if (!args.iconContentType) {
|
|
3593
3878
|
const extension = args.icon.slice(args.icon.lastIndexOf(".") + 1).toLowerCase();
|
|
3594
3879
|
const type = {
|
|
@@ -3601,16 +3886,16 @@ function validateObjectsAddCommand(args, positionals, seen) {
|
|
|
3601
3886
|
tiff: "image/tiff",
|
|
3602
3887
|
wmf: "image/x-wmf"
|
|
3603
3888
|
};
|
|
3604
|
-
if (!type[extension])
|
|
3889
|
+
if (!type[extension]) usage2("Icon requires a supported extension or explicit content type.");
|
|
3605
3890
|
args.iconContentType = type[extension];
|
|
3606
3891
|
}
|
|
3607
3892
|
if (args.inPlace && (args.input === "-" || args.output))
|
|
3608
|
-
|
|
3609
|
-
if (!args.dryRun && !args.inPlace && !args.output)
|
|
3610
|
-
if (args.force && !args.output)
|
|
3893
|
+
usage2("In-place requires a named input and no output flag.");
|
|
3894
|
+
if (!args.dryRun && !args.inPlace && !args.output) usage2("Mutation requires a destination.");
|
|
3895
|
+
if (args.force && !args.output) usage2("Force requires an explicit output.");
|
|
3611
3896
|
if (args.output === args.input && args.output !== "-")
|
|
3612
|
-
|
|
3613
|
-
if (args.output === "-" && args.json && !args.dryRun)
|
|
3897
|
+
usage2("Replacing input requires --in-place.");
|
|
3898
|
+
if (args.output === "-" && args.json && !args.dryRun) usage2("Binary stdout conflicts with JSON.");
|
|
3614
3899
|
}
|
|
3615
3900
|
async function executeObjectsAddCommand(args, request, options2) {
|
|
3616
3901
|
const context = { ...options2.context, signal: request.signal };
|
|
@@ -3802,7 +4087,7 @@ var packageToolsSchemas = Object.fromEntries(
|
|
|
3802
4087
|
);
|
|
3803
4088
|
|
|
3804
4089
|
// packages/safe-bash-command-pptx/src/command-engine-values.ts
|
|
3805
|
-
import { OfficeError as
|
|
4090
|
+
import { OfficeError as OfficeError6 } from "../../safe-bash-presentation-engine/errors.js";
|
|
3806
4091
|
function commandLength(value, minimum = 1) {
|
|
3807
4092
|
const units = { emu: 1, in: 914400, cm: 36e4, mm: 36e3, pt: 12700 };
|
|
3808
4093
|
const unit = Object.keys(units).find((candidate) => value.endsWith(candidate));
|
|
@@ -3811,7 +4096,7 @@ function commandLength(value, minimum = 1) {
|
|
|
3811
4096
|
if (!unit || pieces.length > 2 || !pieces[0] || pieces.some(
|
|
3812
4097
|
(piece) => !piece || [...piece].some((character) => character < "0" || character > "9")
|
|
3813
4098
|
))
|
|
3814
|
-
throw new
|
|
4099
|
+
throw new OfficeError6(
|
|
3815
4100
|
"invalid-value",
|
|
3816
4101
|
"Lengths require a decimal and emu, in, cm, mm or pt unit.",
|
|
3817
4102
|
"usage"
|
|
@@ -3819,13 +4104,13 @@ function commandLength(value, minimum = 1) {
|
|
|
3819
4104
|
const raw = Number(digits) * units[unit];
|
|
3820
4105
|
const result = Math.sign(raw) * Math.round(Math.abs(raw));
|
|
3821
4106
|
if (!Number.isFinite(raw) || Math.abs(raw) > Number.MAX_SAFE_INTEGER || !Number.isSafeInteger(result) || result < minimum)
|
|
3822
|
-
throw new
|
|
4107
|
+
throw new OfficeError6("invalid-value", "Length is outside the supported range.", "usage");
|
|
3823
4108
|
return result;
|
|
3824
4109
|
}
|
|
3825
4110
|
function commandTimestamp(value) {
|
|
3826
4111
|
const date = new Date(value);
|
|
3827
4112
|
if (!Number.isFinite(date.getTime()) || !value.endsWith("Z") || date.toISOString() !== value && date.toISOString() !== value.slice(0, -1) + ".000Z")
|
|
3828
|
-
throw new
|
|
4113
|
+
throw new OfficeError6(
|
|
3829
4114
|
"invalid-value",
|
|
3830
4115
|
"Timestamp requires a valid UTC date with seconds and Z suffix.",
|
|
3831
4116
|
"usage"
|
|
@@ -3859,7 +4144,7 @@ function commandJson(value) {
|
|
|
3859
4144
|
}
|
|
3860
4145
|
return JSON.parse(value);
|
|
3861
4146
|
} catch {
|
|
3862
|
-
throw new
|
|
4147
|
+
throw new OfficeError6(
|
|
3863
4148
|
"invalid-value",
|
|
3864
4149
|
"Structured slides require valid JSON without duplicate keys, at most 32 levels deep.",
|
|
3865
4150
|
"usage"
|
|
@@ -3869,31 +4154,15 @@ function commandJson(value) {
|
|
|
3869
4154
|
|
|
3870
4155
|
// packages/safe-bash-command-pptx/src/command-package-tools.ts
|
|
3871
4156
|
import { sha256 } from "@noble/hashes/sha2.js";
|
|
3872
|
-
import { OfficeError as
|
|
3873
|
-
import { asciiKey, partName } from "../../safe-bash-presentation-engine/package-uri.js";
|
|
4157
|
+
import { OfficeError as OfficeError7 } from "../../safe-bash-presentation-engine/errors.js";
|
|
4158
|
+
import { asciiKey as asciiKey2, partName as partName2 } from "../../safe-bash-presentation-engine/package-uri.js";
|
|
3874
4159
|
import { extractPackage, packPackage } from "../../safe-bash-presentation-engine/package-tools.js";
|
|
3875
|
-
function
|
|
3876
|
-
throw new
|
|
3877
|
-
}
|
|
3878
|
-
function scopedPath(manifest, path) {
|
|
3879
|
-
if (path === "-") return path;
|
|
3880
|
-
if (path.includes("\\") || [...path].some((c) => c.charCodeAt(0) < 32))
|
|
3881
|
-
usage2("Invalid scoped file path.");
|
|
3882
|
-
const prefix = path.startsWith("/") ? "" : manifest === "-" ? "/" : manifest.slice(0, manifest.lastIndexOf("/") + 1);
|
|
3883
|
-
const absolute = (prefix + path).startsWith("/");
|
|
3884
|
-
const segments = [];
|
|
3885
|
-
for (const segment of (prefix + path).split("/")) {
|
|
3886
|
-
if (!segment || segment === ".") continue;
|
|
3887
|
-
if (segment === "..") {
|
|
3888
|
-
if (!segments.length) usage2("Scoped path escapes its root.");
|
|
3889
|
-
segments.pop();
|
|
3890
|
-
} else segments.push(segment);
|
|
3891
|
-
}
|
|
3892
|
-
return (absolute ? "/" : "") + segments.join("/");
|
|
4160
|
+
function usage3(message) {
|
|
4161
|
+
throw new OfficeError7("invalid-value", message, "usage");
|
|
3893
4162
|
}
|
|
3894
4163
|
function canonical(part) {
|
|
3895
4164
|
try {
|
|
3896
|
-
return typeof part === "string" &&
|
|
4165
|
+
return typeof part === "string" && partName2(part, false) === part;
|
|
3897
4166
|
} catch {
|
|
3898
4167
|
return false;
|
|
3899
4168
|
}
|
|
@@ -3903,23 +4172,23 @@ function validatePackageCommand(args, positionals, seen) {
|
|
|
3903
4172
|
(key) => "--" + [...key].map((c) => c >= "A" && c <= "Z" ? "-" + c.toLowerCase() : c).join("")
|
|
3904
4173
|
);
|
|
3905
4174
|
if ([...seen].some((flag) => !allowed.includes(flag)))
|
|
3906
|
-
|
|
4175
|
+
usage3("Option does not apply to package tools.");
|
|
3907
4176
|
if (args.operation === "extract") {
|
|
3908
|
-
if (positionals.length !== 1 || !positionals[0])
|
|
4177
|
+
if (positionals.length !== 1 || !positionals[0]) usage3("Extraction requires one input.");
|
|
3909
4178
|
args.input = positionals[0];
|
|
3910
4179
|
if (!args.outputDir || args.outputDir === "-")
|
|
3911
|
-
|
|
3912
|
-
if (args.parts && (!args.parts.length || args.parts.some((part) => !canonical(part)) || new Set(args.parts.map(
|
|
3913
|
-
|
|
4180
|
+
usage3("Extraction requires an output directory.");
|
|
4181
|
+
if (args.parts && (!args.parts.length || args.parts.some((part) => !canonical(part)) || new Set(args.parts.map(asciiKey2)).size !== args.parts.length))
|
|
4182
|
+
usage3("Parts require unique canonical part URIs.");
|
|
3914
4183
|
} else {
|
|
3915
4184
|
if (positionals.length || !args.manifest)
|
|
3916
|
-
|
|
3917
|
-
if (!args.output && !args.dryRun)
|
|
3918
|
-
if (args.force && !args.output)
|
|
4185
|
+
usage3("Pack requires a manifest and no positional inputs.");
|
|
4186
|
+
if (!args.output && !args.dryRun) usage3("Pack requires output or dry-run.");
|
|
4187
|
+
if (args.force && !args.output) usage3("Force requires output.");
|
|
3919
4188
|
if (args.output === "-" && args.json && !args.dryRun)
|
|
3920
|
-
|
|
4189
|
+
usage3("Binary stdout cannot be combined with JSON.");
|
|
3921
4190
|
if (args.output === args.manifest && args.output !== "-")
|
|
3922
|
-
|
|
4191
|
+
usage3("Output cannot replace manifest.");
|
|
3923
4192
|
}
|
|
3924
4193
|
}
|
|
3925
4194
|
async function executePackageCommand(args, request, options2) {
|
|
@@ -3940,7 +4209,7 @@ async function executePackageCommand(args, request, options2) {
|
|
|
3940
4209
|
);
|
|
3941
4210
|
const files = await extractPackage(bytes2, context, args.parts ? { parts: args.parts } : {});
|
|
3942
4211
|
if (files.length > (args.limits?.maxOutputs ?? context.archiveLimits.maxMembers) || files.reduce((sum, file) => sum + file.bytes.length, 0) > options2.maxOutputBytes)
|
|
3943
|
-
throw new
|
|
4212
|
+
throw new OfficeError7(
|
|
3944
4213
|
"resource-limit",
|
|
3945
4214
|
"Package extraction exceeds output limits.",
|
|
3946
4215
|
"validate-intent"
|
|
@@ -3972,7 +4241,7 @@ async function executePackageCommand(args, request, options2) {
|
|
|
3972
4241
|
};
|
|
3973
4242
|
}
|
|
3974
4243
|
if (args.creation?.author !== void 0 || args.creation?.timestamp !== void 0)
|
|
3975
|
-
throw new
|
|
4244
|
+
throw new OfficeError7(
|
|
3976
4245
|
"unsupported-edit",
|
|
3977
4246
|
"Pack metadata overrides are unavailable; source properties are preserved.",
|
|
3978
4247
|
"validate-intent"
|
|
@@ -3982,28 +4251,28 @@ async function executePackageCommand(args, request, options2) {
|
|
|
3982
4251
|
Math.min(context.limits.maxBytes, context.xmlLimits.maxBytes)
|
|
3983
4252
|
);
|
|
3984
4253
|
if (encoded.length > Math.min(context.limits.maxBytes, context.xmlLimits.maxBytes))
|
|
3985
|
-
throw new
|
|
4254
|
+
throw new OfficeError7("resource-limit", "Manifest exceeds byte limit.", "admit");
|
|
3986
4255
|
let value;
|
|
3987
4256
|
try {
|
|
3988
4257
|
value = commandJson(new TextDecoder("utf-8", { fatal: true }).decode(encoded));
|
|
3989
4258
|
} catch {
|
|
3990
|
-
|
|
4259
|
+
usage3("Manifest must be valid JSON.");
|
|
3991
4260
|
}
|
|
3992
4261
|
if (!value || typeof value !== "object" || Array.isArray(value) || Object.keys(value).some((key) => key !== "parts") || !("parts" in value) || !Array.isArray(value.parts) || !value.parts.length)
|
|
3993
|
-
|
|
4262
|
+
usage3("Manifest requires a nonempty parts array.");
|
|
3994
4263
|
if (value.parts.length > context.archiveLimits.maxMembers)
|
|
3995
|
-
throw new
|
|
4264
|
+
throw new OfficeError7("resource-limit", "Manifest exceeds member limit.", "admit");
|
|
3996
4265
|
const parts = value.parts;
|
|
3997
4266
|
for (const item of parts)
|
|
3998
4267
|
if (!item || typeof item !== "object" || Object.keys(item).some((key) => !["part", "sha256", "file"].includes(key)) || !canonical(item.part) || typeof item.sha256 !== "string" || item.sha256.length !== 64 || [...item.sha256].some((c) => !"0123456789abcdef".includes(c)) || !item.file || typeof item.file !== "object" || Object.keys(item.file).length !== 1 || typeof item.file.vfsPath !== "string" || !item.file.vfsPath.length)
|
|
3999
|
-
|
|
4000
|
-
if (new Set(parts.map((item) =>
|
|
4001
|
-
|
|
4002
|
-
const paths = parts.map((item) =>
|
|
4268
|
+
usage3("Manifest parts require canonical URIs, hashes and explicit scoped files.");
|
|
4269
|
+
if (new Set(parts.map((item) => asciiKey2(item.part))).size !== parts.length)
|
|
4270
|
+
usage3("Manifest parts must be unique.");
|
|
4271
|
+
const paths = parts.map((item) => scopedPackagePath(args.manifest, item.file.vfsPath));
|
|
4003
4272
|
if ([args.manifest, ...paths].filter((path) => path === "-").length > 1)
|
|
4004
|
-
|
|
4273
|
+
usage3("Only one manifest input may consume stdin.");
|
|
4005
4274
|
if (args.output !== "-" && paths.includes(args.output))
|
|
4006
|
-
|
|
4275
|
+
usage3("Output cannot replace a source file.");
|
|
4007
4276
|
let total = 0;
|
|
4008
4277
|
const members = [];
|
|
4009
4278
|
for (const [index, item] of parts.entries()) {
|
|
@@ -4014,7 +4283,7 @@ async function executePackageCommand(args, request, options2) {
|
|
|
4014
4283
|
);
|
|
4015
4284
|
total += bytes2.length;
|
|
4016
4285
|
if (bytes2.length > context.archiveLimits.maxEntryBytes || total > context.archiveLimits.maxTotalBytes)
|
|
4017
|
-
throw new
|
|
4286
|
+
throw new OfficeError7("resource-limit", "Manifest contents exceed byte limit.", "admit");
|
|
4018
4287
|
members.push({ part: item.part, sha256: item.sha256, bytes: bytes2 });
|
|
4019
4288
|
}
|
|
4020
4289
|
const bytes = await packPackage(
|
|
@@ -4023,7 +4292,7 @@ async function executePackageCommand(args, request, options2) {
|
|
|
4023
4292
|
args.creation?.kind ? { kind: args.creation.kind } : {}
|
|
4024
4293
|
);
|
|
4025
4294
|
if (bytes.length > options2.maxOutputBytes)
|
|
4026
|
-
throw new
|
|
4295
|
+
throw new OfficeError7("resource-limit", "Packed output exceeds byte limit.", "validate-intent");
|
|
4027
4296
|
const dryRun = args.dryRun ?? false;
|
|
4028
4297
|
const fingerprint = [...sha256(bytes)].map((byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
4029
4298
|
if (args.output && args.output !== "-" && !request.publishOutput)
|
|
@@ -4059,7 +4328,7 @@ async function executePackageCommand(args, request, options2) {
|
|
|
4059
4328
|
}
|
|
4060
4329
|
|
|
4061
4330
|
// packages/safe-bash-command-pptx/src/command-diff.ts
|
|
4062
|
-
import { OfficeError as
|
|
4331
|
+
import { OfficeError as OfficeError8 } from "../../safe-bash-presentation-engine/errors.js";
|
|
4063
4332
|
import { comparePresentations } from "../../safe-bash-presentation-engine/diff.js";
|
|
4064
4333
|
|
|
4065
4334
|
// packages/safe-bash-command-pptx/src/diff-schema.ts
|
|
@@ -4165,7 +4434,7 @@ async function executeDiffCommand(request, options2) {
|
|
|
4165
4434
|
let human = "";
|
|
4166
4435
|
let exitCode = 0;
|
|
4167
4436
|
const failure = (error) => {
|
|
4168
|
-
const office = error instanceof
|
|
4437
|
+
const office = error instanceof OfficeError8 ? error : void 0;
|
|
4169
4438
|
const code = request.signal.aborted ? "cancelled" : office?.code ?? (error && typeof error === "object" && "code" in error && error.code === "resource-limit" ? "resource-limit" : "io-failure");
|
|
4170
4439
|
exitCode = code === "cancelled" ? 130 : 2;
|
|
4171
4440
|
const message = office?.message ?? (code === "cancelled" ? "Comparison cancelled." : "Comparison input could not be read.");
|
|
@@ -4182,20 +4451,20 @@ async function executeDiffCommand(request, options2) {
|
|
|
4182
4451
|
errors: [{ code, message, context: { phase: office?.phase ?? "admit" } }]
|
|
4183
4452
|
};
|
|
4184
4453
|
};
|
|
4185
|
-
const
|
|
4186
|
-
throw new
|
|
4454
|
+
const usage14 = (message) => {
|
|
4455
|
+
throw new OfficeError8("invalid-value", message, "usage");
|
|
4187
4456
|
};
|
|
4188
4457
|
try {
|
|
4189
4458
|
let byteCount = 0;
|
|
4190
4459
|
const args = request.args.map((bytes2) => {
|
|
4191
|
-
if (!(bytes2 instanceof Uint8Array))
|
|
4460
|
+
if (!(bytes2 instanceof Uint8Array)) usage14("Arguments must be byte arrays.");
|
|
4192
4461
|
byteCount += bytes2.byteLength;
|
|
4193
4462
|
if (byteCount > options2.maxArgumentBytes)
|
|
4194
|
-
throw new
|
|
4463
|
+
throw new OfficeError8("resource-limit", "Argument limit exceeded.", "admit");
|
|
4195
4464
|
try {
|
|
4196
4465
|
return new TextDecoder("utf-8", { fatal: true }).decode(bytes2);
|
|
4197
4466
|
} catch {
|
|
4198
|
-
return
|
|
4467
|
+
return usage14("Arguments must be UTF-8.");
|
|
4199
4468
|
}
|
|
4200
4469
|
});
|
|
4201
4470
|
const delimiter = args.indexOf("--");
|
|
@@ -4214,31 +4483,31 @@ async function executeDiffCommand(request, options2) {
|
|
|
4214
4483
|
}
|
|
4215
4484
|
if (!positionalOnly && arg.startsWith("-") && arg !== "-") {
|
|
4216
4485
|
if (!["--json", "--mode", "--limit", "--help"].includes(arg))
|
|
4217
|
-
|
|
4218
|
-
if (seen.has(arg) && arg !== "--limit")
|
|
4486
|
+
usage14("Unknown comparison option.");
|
|
4487
|
+
if (seen.has(arg) && arg !== "--limit") usage14("Duplicate comparison option.");
|
|
4219
4488
|
seen.add(arg);
|
|
4220
4489
|
if (arg === "--json" || arg === "--help") continue;
|
|
4221
4490
|
const value = args[++i];
|
|
4222
|
-
if (!value)
|
|
4491
|
+
if (!value) usage14("Comparison option requires a value.");
|
|
4223
4492
|
if (arg === "--mode") {
|
|
4224
|
-
if (!diffModes.includes(value))
|
|
4493
|
+
if (!diffModes.includes(value)) usage14("Unsupported comparison mode.");
|
|
4225
4494
|
mode = value;
|
|
4226
4495
|
} else {
|
|
4227
4496
|
const parts = value.split("=");
|
|
4228
4497
|
const name = parts[0];
|
|
4229
4498
|
const number = Number(parts[1]);
|
|
4230
4499
|
if (parts.length !== 2 || !["maxBytes", "maxNodes", "maxDepth", "maxOutputBytes"].includes(name) || !parts[1] || ![...parts[1]].every((c) => c >= "0" && c <= "9") || !Number.isSafeInteger(number) || number <= 0 || Object.hasOwn(limits, name))
|
|
4231
|
-
|
|
4500
|
+
usage14("Invalid comparison limit.");
|
|
4232
4501
|
limits[name] = number;
|
|
4233
4502
|
}
|
|
4234
4503
|
} else {
|
|
4235
|
-
if (!arg || arg.includes("\0"))
|
|
4504
|
+
if (!arg || arg.includes("\0")) usage14("Invalid comparison input.");
|
|
4236
4505
|
positionals.push(arg);
|
|
4237
4506
|
}
|
|
4238
4507
|
}
|
|
4239
4508
|
if (seen.has("--help")) {
|
|
4240
4509
|
if (positionals.length || [...seen].some((flag) => flag !== "--help" && flag !== "--json"))
|
|
4241
|
-
|
|
4510
|
+
usage14("Comparison help does not accept inputs or options.");
|
|
4242
4511
|
result = {
|
|
4243
4512
|
version: 1,
|
|
4244
4513
|
operation: "help",
|
|
@@ -4252,7 +4521,7 @@ async function executeDiffCommand(request, options2) {
|
|
|
4252
4521
|
human = diffUsage;
|
|
4253
4522
|
} else {
|
|
4254
4523
|
if (positionals.length !== 2 || positionals.every((path) => path === "-"))
|
|
4255
|
-
|
|
4524
|
+
usage14("Comparison requires two inputs and at most one stdin consumer.");
|
|
4256
4525
|
maxOutputBytes = limits.maxOutputBytes ?? maxOutputBytes;
|
|
4257
4526
|
const context = {
|
|
4258
4527
|
...options2.context,
|
|
@@ -4269,7 +4538,7 @@ async function executeDiffCommand(request, options2) {
|
|
|
4269
4538
|
}
|
|
4270
4539
|
};
|
|
4271
4540
|
if (mode === "effective-formatting")
|
|
4272
|
-
throw new
|
|
4541
|
+
throw new OfficeError8(
|
|
4273
4542
|
"unsupported-profile",
|
|
4274
4543
|
"Effective formatting comparison is not supported.",
|
|
4275
4544
|
"usage"
|
|
@@ -4304,7 +4573,7 @@ async function executeDiffCommand(request, options2) {
|
|
|
4304
4573
|
let bytes = encoder.encode(json ? JSON.stringify(result) + "\n" : human);
|
|
4305
4574
|
if (bytes.length > maxOutputBytes) {
|
|
4306
4575
|
result = failure(
|
|
4307
|
-
new
|
|
4576
|
+
new OfficeError8("resource-limit", "Comparison output limit exceeded.", "admit")
|
|
4308
4577
|
);
|
|
4309
4578
|
bytes = encoder.encode(json ? JSON.stringify(result) + "\n" : human);
|
|
4310
4579
|
}
|
|
@@ -4424,7 +4693,7 @@ var templateSchema = {
|
|
|
4424
4693
|
|
|
4425
4694
|
// packages/safe-bash-command-pptx/src/command-template.ts
|
|
4426
4695
|
import { sha256 as sha2562 } from "@noble/hashes/sha2.js";
|
|
4427
|
-
import { OfficeError as
|
|
4696
|
+
import { OfficeError as OfficeError9 } from "../../safe-bash-presentation-engine/errors.js";
|
|
4428
4697
|
import {
|
|
4429
4698
|
applyTemplateBindings,
|
|
4430
4699
|
validateTemplateBindings
|
|
@@ -4437,8 +4706,8 @@ function validateTemplateData(value) {
|
|
|
4437
4706
|
if (Array.isArray(value)) validateTemplateBindings(value);
|
|
4438
4707
|
else validateTemplateRepeat(value);
|
|
4439
4708
|
}
|
|
4440
|
-
function
|
|
4441
|
-
throw new
|
|
4709
|
+
function usage4(message) {
|
|
4710
|
+
throw new OfficeError9("invalid-value", message, "usage");
|
|
4442
4711
|
}
|
|
4443
4712
|
function validateTemplateCommand(args, positionals, seen) {
|
|
4444
4713
|
if ([...seen].some(
|
|
@@ -4453,25 +4722,25 @@ function validateTemplateCommand(args, positionals, seen) {
|
|
|
4453
4722
|
"--dry-run"
|
|
4454
4723
|
].includes(flag)
|
|
4455
4724
|
))
|
|
4456
|
-
|
|
4725
|
+
usage4("Option does not apply to template apply.");
|
|
4457
4726
|
if (positionals.length !== 1 || !positionals[0])
|
|
4458
|
-
|
|
4727
|
+
usage4("Template apply requires exactly one input.");
|
|
4459
4728
|
args.input = positionals[0];
|
|
4460
4729
|
if (args.bindings !== void 0 === (args.dataFile !== void 0))
|
|
4461
|
-
|
|
4462
|
-
if (args.dataFile === "")
|
|
4463
|
-
if (args.input === "-" && args.dataFile === "-")
|
|
4464
|
-
if (args.inPlace && args.input === "-")
|
|
4465
|
-
if (args.inPlace && args.output)
|
|
4466
|
-
if (!args.dryRun && !args.inPlace && !args.output)
|
|
4467
|
-
if (args.force && !args.output)
|
|
4730
|
+
usage4("Template apply requires exactly one binding source.");
|
|
4731
|
+
if (args.dataFile === "") usage4("Binding file path must not be empty.");
|
|
4732
|
+
if (args.input === "-" && args.dataFile === "-") usage4("Only one input may consume stdin.");
|
|
4733
|
+
if (args.inPlace && args.input === "-") usage4("Stdin cannot be edited in place.");
|
|
4734
|
+
if (args.inPlace && args.output) usage4("Output and in-place cannot be combined.");
|
|
4735
|
+
if (!args.dryRun && !args.inPlace && !args.output) usage4("Mutation requires a destination.");
|
|
4736
|
+
if (args.force && !args.output) usage4("Force requires an explicit output destination.");
|
|
4468
4737
|
if (args.output === args.input && args.output !== "-")
|
|
4469
|
-
|
|
4738
|
+
usage4("Replacing input requires --in-place.");
|
|
4470
4739
|
const destination = args.inPlace ? args.input : args.output;
|
|
4471
4740
|
if (args.dataFile !== void 0 && args.dataFile !== "-" && destination === args.dataFile)
|
|
4472
|
-
|
|
4741
|
+
usage4("Output cannot replace the binding source.");
|
|
4473
4742
|
if (args.output === "-" && args.json && !args.dryRun)
|
|
4474
|
-
|
|
4743
|
+
usage4("Binary stdout cannot be combined with JSON.");
|
|
4475
4744
|
}
|
|
4476
4745
|
async function executeTemplateCommand(args, request, options2) {
|
|
4477
4746
|
const context = { ...options2.context, signal: request.signal };
|
|
@@ -4485,7 +4754,7 @@ async function executeTemplateCommand(args, request, options2) {
|
|
|
4485
4754
|
try {
|
|
4486
4755
|
json = new TextDecoder("utf-8", { fatal: true }).decode(data);
|
|
4487
4756
|
} catch {
|
|
4488
|
-
|
|
4757
|
+
usage4("Binding data must be UTF-8 JSON.");
|
|
4489
4758
|
}
|
|
4490
4759
|
bindings = commandJson(json);
|
|
4491
4760
|
}
|
|
@@ -4790,40 +5059,40 @@ var commentSchemas = Object.fromEntries(
|
|
|
4790
5059
|
);
|
|
4791
5060
|
|
|
4792
5061
|
// packages/safe-bash-command-pptx/src/command-comments.ts
|
|
4793
|
-
import { OfficeError as
|
|
5062
|
+
import { OfficeError as OfficeError10 } from "../../safe-bash-presentation-engine/errors.js";
|
|
4794
5063
|
import { mutateComments, readComments, readCommentAuthors } from "../../safe-bash-presentation-engine/comments.js";
|
|
4795
5064
|
import { SelectionError } from "../../safe-bash-presentation-engine/selectors.js";
|
|
4796
|
-
function
|
|
4797
|
-
throw new
|
|
5065
|
+
function usage5(message) {
|
|
5066
|
+
throw new OfficeError10("invalid-value", message, "usage");
|
|
4798
5067
|
}
|
|
4799
5068
|
function validateCommentsCommand(args, positionals, seen) {
|
|
4800
5069
|
const allowed = Object.keys(commentSchemas[args.operation].options.properties).map(
|
|
4801
5070
|
(key) => "--" + [...key].map((c) => c >= "A" && c <= "Z" ? "-" + c.toLowerCase() : c).join("")
|
|
4802
5071
|
);
|
|
4803
5072
|
if ([...seen].some((flag) => !allowed.includes(flag)))
|
|
4804
|
-
|
|
4805
|
-
if (positionals.length !== 1 || !positionals[0])
|
|
5073
|
+
usage5("Option does not apply to comments.");
|
|
5074
|
+
if (positionals.length !== 1 || !positionals[0]) usage5("Comments require exactly one input.");
|
|
4806
5075
|
args.input = positionals[0];
|
|
4807
|
-
if (args.scope !== void 0 && args.scope !== "slides")
|
|
5076
|
+
if (args.scope !== void 0 && args.scope !== "slides") usage5("Comments require slides scope.");
|
|
4808
5077
|
if (args.token && ["--slide", "--scope", "--id"].some((flag) => seen.has(flag)))
|
|
4809
|
-
|
|
5078
|
+
usage5("Opaque and simple selectors cannot be combined.");
|
|
4810
5079
|
if (args.operation === "comments.list" || args.operation === "comments.get") return;
|
|
4811
5080
|
if (!args.token && args.slide === void 0 && !args.all)
|
|
4812
5081
|
throw new SelectionError("missing-selection");
|
|
4813
5082
|
if (args.operation === "comments.add" && [args.commentEdit?.text, args.commentEdit?.author, args.commentEdit?.timestamp].some(
|
|
4814
5083
|
(value) => value === void 0
|
|
4815
5084
|
))
|
|
4816
|
-
|
|
5085
|
+
usage5("Comment creation requires text, author and timestamp.");
|
|
4817
5086
|
if (args.operation === "comments.set" && !Object.keys(args.commentEdit ?? {}).some((key) => key !== "id"))
|
|
4818
|
-
|
|
4819
|
-
if (args.inPlace && args.input === "-")
|
|
4820
|
-
if (args.inPlace && args.output)
|
|
4821
|
-
if (!args.dryRun && !args.inPlace && !args.output)
|
|
4822
|
-
if (args.force && !args.output)
|
|
5087
|
+
usage5("Comment update requires an edit.");
|
|
5088
|
+
if (args.inPlace && args.input === "-") usage5("Stdin cannot be edited in place.");
|
|
5089
|
+
if (args.inPlace && args.output) usage5("Output and in-place cannot be combined.");
|
|
5090
|
+
if (!args.dryRun && !args.inPlace && !args.output) usage5("Mutation requires a destination.");
|
|
5091
|
+
if (args.force && !args.output) usage5("Force requires an explicit output destination.");
|
|
4823
5092
|
if (args.output === args.input && args.output !== "-")
|
|
4824
|
-
|
|
5093
|
+
usage5("Replacing input requires --in-place.");
|
|
4825
5094
|
if (args.output === "-" && args.json && !args.dryRun)
|
|
4826
|
-
|
|
5095
|
+
usage5("Binary stdout cannot be combined with JSON.");
|
|
4827
5096
|
}
|
|
4828
5097
|
async function executeCommentsCommand(args, request, options2) {
|
|
4829
5098
|
const context = { ...options2.context, signal: request.signal };
|
|
@@ -5296,43 +5565,43 @@ var accessibilitySchemas = Object.fromEntries(
|
|
|
5296
5565
|
);
|
|
5297
5566
|
|
|
5298
5567
|
// packages/safe-bash-command-pptx/src/command-accessibility.ts
|
|
5299
|
-
import { OfficeError as
|
|
5568
|
+
import { OfficeError as OfficeError11 } from "../../safe-bash-presentation-engine/errors.js";
|
|
5300
5569
|
import {
|
|
5301
5570
|
readAccessibility,
|
|
5302
5571
|
mutateAccessibility,
|
|
5303
5572
|
validateAccessibilityUpdate
|
|
5304
5573
|
} from "../../safe-bash-presentation-engine/accessibility.js";
|
|
5305
5574
|
import { SelectionError as SelectionError2 } from "../../safe-bash-presentation-engine/selectors.js";
|
|
5306
|
-
function
|
|
5307
|
-
throw new
|
|
5575
|
+
function usage6(message) {
|
|
5576
|
+
throw new OfficeError11("invalid-value", message, "usage");
|
|
5308
5577
|
}
|
|
5309
5578
|
function validateAccessibilityCommand(args, positionals, seen) {
|
|
5310
5579
|
const allowed = Object.keys(accessibilitySchemas[args.operation].options.properties).map(
|
|
5311
5580
|
(key) => "--" + [...key].map((c) => c >= "A" && c <= "Z" ? "-" + c.toLowerCase() : c).join("")
|
|
5312
5581
|
);
|
|
5313
5582
|
if ([...seen].some((flag) => !allowed.includes(flag)))
|
|
5314
|
-
|
|
5583
|
+
usage6("Option does not apply to accessibility.");
|
|
5315
5584
|
if (positionals.length !== 1 || !positionals[0])
|
|
5316
|
-
|
|
5585
|
+
usage6("Accessibility requires exactly one input.");
|
|
5317
5586
|
args.input = positionals[0];
|
|
5318
5587
|
if (args.scope !== void 0 && !["slides", "layouts", "masters"].includes(args.scope))
|
|
5319
|
-
|
|
5588
|
+
usage6("Unsupported accessibility scope.");
|
|
5320
5589
|
if (args.token && ["--slide", "--shape", "--scope", "--all"].some((flag) => seen.has(flag)))
|
|
5321
|
-
|
|
5590
|
+
usage6("Opaque and simple selectors cannot be combined.");
|
|
5322
5591
|
if (args.shape !== void 0 && args.slide === void 0)
|
|
5323
|
-
|
|
5592
|
+
usage6("Shape selection requires a slide.");
|
|
5324
5593
|
if (args.operation !== "accessibility.set") return;
|
|
5325
5594
|
validateAccessibilityUpdate(args.accessibilityEdit ?? {});
|
|
5326
5595
|
if (!args.token && args.slide === void 0 && !args.all)
|
|
5327
|
-
|
|
5328
|
-
if (args.inPlace && args.input === "-")
|
|
5329
|
-
if (args.inPlace && args.output)
|
|
5330
|
-
if (!args.dryRun && !args.inPlace && !args.output)
|
|
5331
|
-
if (args.force && !args.output)
|
|
5596
|
+
usage6("Accessibility mutation requires explicit selection.");
|
|
5597
|
+
if (args.inPlace && args.input === "-") usage6("Stdin cannot be edited in place.");
|
|
5598
|
+
if (args.inPlace && args.output) usage6("Output and in-place cannot be combined.");
|
|
5599
|
+
if (!args.dryRun && !args.inPlace && !args.output) usage6("Mutation requires a destination.");
|
|
5600
|
+
if (args.force && !args.output) usage6("Force requires an output destination.");
|
|
5332
5601
|
if (args.output === args.input && args.output !== "-")
|
|
5333
|
-
|
|
5602
|
+
usage6("Replacing input requires --in-place.");
|
|
5334
5603
|
if (args.output === "-" && args.json && !args.dryRun)
|
|
5335
|
-
|
|
5604
|
+
usage6("Binary stdout cannot be combined with JSON.");
|
|
5336
5605
|
}
|
|
5337
5606
|
async function executeAccessibilityCommand(args, request, options2) {
|
|
5338
5607
|
const context = { ...options2.context, signal: request.signal };
|
|
@@ -5414,13 +5683,13 @@ async function executeAccessibilityCommand(args, request, options2) {
|
|
|
5414
5683
|
}
|
|
5415
5684
|
|
|
5416
5685
|
// packages/safe-bash-command-pptx/src/command-metadata.ts
|
|
5417
|
-
import { OfficeError as
|
|
5686
|
+
import { OfficeError as OfficeError12 } from "../../safe-bash-presentation-engine/errors.js";
|
|
5418
5687
|
import { coreDefinition, mutateProperty, readProperties } from "../../safe-bash-presentation-engine/properties.js";
|
|
5419
5688
|
import { sanitize as sanitizePresentation } from "../../safe-bash-presentation-engine/sanitize.js";
|
|
5420
5689
|
import { mutateTags, readTags } from "../../safe-bash-presentation-engine/tags.js";
|
|
5421
5690
|
import { SelectionError as SelectionError3 } from "../../safe-bash-presentation-engine/selectors.js";
|
|
5422
|
-
function
|
|
5423
|
-
throw new
|
|
5691
|
+
function usage7(message) {
|
|
5692
|
+
throw new OfficeError12("invalid-value", message, "usage");
|
|
5424
5693
|
}
|
|
5425
5694
|
function removalCategories(value) {
|
|
5426
5695
|
const categories = ["notes", "comments", "properties", "links", "objects"];
|
|
@@ -5429,37 +5698,37 @@ function removalCategories(value) {
|
|
|
5429
5698
|
try {
|
|
5430
5699
|
parsed = JSON.parse(value);
|
|
5431
5700
|
} catch {
|
|
5432
|
-
|
|
5701
|
+
usage7("Remove requires a category or a JSON array of categories.");
|
|
5433
5702
|
}
|
|
5434
5703
|
}
|
|
5435
5704
|
const values3 = Array.isArray(parsed) ? parsed : [parsed];
|
|
5436
|
-
if (!values3.length || values3.some((item) => typeof item !== "string" || !categories.includes(item)) || new Set(values3).size !== values3.length)
|
|
5705
|
+
if (!values3.length || values3.some((item) => typeof item !== "string" || !categories.includes(item)) || new Set(values3).size !== values3.length) usage7("Remove requires distinct notes, comments, properties, links or objects categories.");
|
|
5437
5706
|
return values3;
|
|
5438
5707
|
}
|
|
5439
5708
|
function validateMetadataCommand(args, positionals, seen) {
|
|
5440
5709
|
const allowed = Object.keys(metadataSchemas[args.operation].options.properties).map((key) => "--" + [...key].map((c) => c >= "A" && c <= "Z" ? "-" + c.toLowerCase() : c).join(""));
|
|
5441
|
-
if ([...seen].some((flag) => !allowed.includes(flag)))
|
|
5442
|
-
if (positionals.length !== 1 || !positionals[0])
|
|
5710
|
+
if ([...seen].some((flag) => !allowed.includes(flag))) usage7("Option does not apply to this metadata operation.");
|
|
5711
|
+
if (positionals.length !== 1 || !positionals[0]) usage7("Metadata operations require exactly one input.");
|
|
5443
5712
|
args.input = positionals[0];
|
|
5444
5713
|
const tags = args.operation.startsWith("tags."), sanitize = args.operation === "sanitize";
|
|
5445
5714
|
const action = args.operation.split(".")[1];
|
|
5446
|
-
if (args.scope !== void 0 && !(tags ? ["slides", "presentation"] : ["presentation"]).includes(args.scope))
|
|
5447
|
-
if (args.token && ["--slide", "--scope", "--all"].some((flag) => seen.has(flag)))
|
|
5448
|
-
if (args.scope === "presentation" && args.slide !== void 0)
|
|
5449
|
-
if (!tags && !sanitize && action !== "list" && !args.metadataName)
|
|
5450
|
-
if (args.metadataName === "")
|
|
5451
|
-
if (action === "add" && (!args.metadataName || args.metadataValue === void 0))
|
|
5452
|
-
if (action === "set" && (tags ? args.metadataName === void 0 && args.metadataValue === void 0 : args.metadataValue === void 0))
|
|
5453
|
-
if (args.metadataType !== void 0 && !["string", "number", "boolean", "date"].includes(args.metadataType))
|
|
5715
|
+
if (args.scope !== void 0 && !(tags ? ["slides", "presentation"] : ["presentation"]).includes(args.scope)) usage7("Unsupported metadata scope.");
|
|
5716
|
+
if (args.token && ["--slide", "--scope", "--all"].some((flag) => seen.has(flag))) usage7("Opaque and simple selectors cannot be combined.");
|
|
5717
|
+
if (args.scope === "presentation" && args.slide !== void 0) usage7("Presentation scope rejects slide selection.");
|
|
5718
|
+
if (!tags && !sanitize && action !== "list" && !args.metadataName) usage7("Property name is required.");
|
|
5719
|
+
if (args.metadataName === "") usage7("Metadata names cannot be empty.");
|
|
5720
|
+
if (action === "add" && (!args.metadataName || args.metadataValue === void 0)) usage7("New tags require name and value.");
|
|
5721
|
+
if (action === "set" && (tags ? args.metadataName === void 0 && args.metadataValue === void 0 : args.metadataValue === void 0)) usage7("Metadata edit value is required.");
|
|
5722
|
+
if (args.metadataType !== void 0 && !["string", "number", "boolean", "date"].includes(args.metadataType)) usage7("Unknown property type.");
|
|
5454
5723
|
if (sanitize) removalCategories(args.metadataRemove);
|
|
5455
5724
|
if (!sanitize && ["list", "get"].includes(action)) return;
|
|
5456
5725
|
if (tags && !args.token && args.slide === void 0 && args.scope !== "presentation" && !args.all) throw new SelectionError3("missing-selection");
|
|
5457
|
-
if (args.inPlace && args.input === "-")
|
|
5458
|
-
if (args.inPlace && args.output)
|
|
5459
|
-
if (!args.dryRun && !args.inPlace && !args.output)
|
|
5460
|
-
if (args.force && !args.output)
|
|
5461
|
-
if (args.output === args.input && args.output !== "-")
|
|
5462
|
-
if (args.output === "-" && args.json && !args.dryRun)
|
|
5726
|
+
if (args.inPlace && args.input === "-") usage7("Stdin cannot be edited in place.");
|
|
5727
|
+
if (args.inPlace && args.output) usage7("Output and in-place cannot be combined.");
|
|
5728
|
+
if (!args.dryRun && !args.inPlace && !args.output) usage7("Mutation requires a destination.");
|
|
5729
|
+
if (args.force && !args.output) usage7("Force requires an output destination.");
|
|
5730
|
+
if (args.output === args.input && args.output !== "-") usage7("Replacing input requires --in-place.");
|
|
5731
|
+
if (args.output === "-" && args.json && !args.dryRun) usage7("Binary stdout cannot be combined with JSON.");
|
|
5463
5732
|
}
|
|
5464
5733
|
async function executeMetadataCommand(args, request, options2) {
|
|
5465
5734
|
const context = { ...options2.context, signal: request.signal };
|
|
@@ -5494,15 +5763,15 @@ async function executeMetadataCommand(args, request, options2) {
|
|
|
5494
5763
|
const type = args.metadataType ?? known[0]?.type ?? coreDefinition(args.metadataName)?.[2];
|
|
5495
5764
|
let value = args.metadataValue;
|
|
5496
5765
|
if (action === "set" && type === "boolean") {
|
|
5497
|
-
if (value !== "true" && value !== "false")
|
|
5766
|
+
if (value !== "true" && value !== "false") usage7("Boolean properties require true or false.");
|
|
5498
5767
|
value = value === "true";
|
|
5499
5768
|
} else if (action === "set" && type === "number") {
|
|
5500
5769
|
try {
|
|
5501
5770
|
value = JSON.parse(args.metadataValue);
|
|
5502
5771
|
} catch {
|
|
5503
|
-
|
|
5772
|
+
usage7("Number properties require a finite JSON number.");
|
|
5504
5773
|
}
|
|
5505
|
-
if (typeof value !== "number" || !Number.isFinite(value))
|
|
5774
|
+
if (typeof value !== "number" || !Number.isFinite(value)) usage7("Number properties require a finite JSON number.");
|
|
5506
5775
|
}
|
|
5507
5776
|
bytes = (await mutateProperty(original, action, { name: args.metadataName, ...action === "set" ? { value, ...type === void 0 ? {} : { type } } : {} }, context)).bytes;
|
|
5508
5777
|
affected = 1;
|
|
@@ -5522,22 +5791,22 @@ ${sanitization.retained.map((entry) => `Retained ${entry.category} ${entry.kind}
|
|
|
5522
5791
|
}
|
|
5523
5792
|
|
|
5524
5793
|
// packages/safe-bash-command-pptx/src/command-notes.ts
|
|
5525
|
-
import { OfficeError as
|
|
5794
|
+
import { OfficeError as OfficeError13 } from "../../safe-bash-presentation-engine/errors.js";
|
|
5526
5795
|
import { mutateNotes, readNotes, validateNotesOptions } from "../../safe-bash-presentation-engine/notes.js";
|
|
5527
5796
|
import { readSelectionIndex, SelectionError as SelectionError4 } from "../../safe-bash-presentation-engine/selectors.js";
|
|
5528
|
-
function
|
|
5529
|
-
throw new
|
|
5797
|
+
function usage8(message) {
|
|
5798
|
+
throw new OfficeError13("invalid-value", message, "usage");
|
|
5530
5799
|
}
|
|
5531
5800
|
function validateNotesCommand(args, positionals, seen) {
|
|
5532
5801
|
const allowed = Object.keys(noteSchemas[args.operation].options.properties).map(
|
|
5533
5802
|
(key) => "--" + [...key].map((c) => c >= "A" && c <= "Z" ? "-" + c.toLowerCase() : c).join("")
|
|
5534
5803
|
);
|
|
5535
|
-
if ([...seen].some((flag) => !allowed.includes(flag)))
|
|
5536
|
-
if (positionals.length !== 1 || !positionals[0])
|
|
5804
|
+
if ([...seen].some((flag) => !allowed.includes(flag))) usage8("Option does not apply to notes.");
|
|
5805
|
+
if (positionals.length !== 1 || !positionals[0]) usage8("Notes require exactly one input.");
|
|
5537
5806
|
args.input = positionals[0];
|
|
5538
|
-
if (args.scope !== void 0 && args.scope !== "notes")
|
|
5807
|
+
if (args.scope !== void 0 && args.scope !== "notes") usage8("Notes require notes scope.");
|
|
5539
5808
|
if (args.token && ["--slide", "--scope"].some((flag) => seen.has(flag)))
|
|
5540
|
-
|
|
5809
|
+
usage8("Opaque and simple selectors cannot be combined.");
|
|
5541
5810
|
if (args.operation === "notes.list" || args.operation === "notes.get") return;
|
|
5542
5811
|
if (!args.token && args.slide === void 0 && !args.all)
|
|
5543
5812
|
throw new SelectionError4("missing-selection");
|
|
@@ -5545,14 +5814,14 @@ function validateNotesCommand(args, positionals, seen) {
|
|
|
5545
5814
|
selection: { kind: "slide" },
|
|
5546
5815
|
...args.noteText === void 0 ? {} : { text: args.noteText }
|
|
5547
5816
|
});
|
|
5548
|
-
if (args.inPlace && args.input === "-")
|
|
5549
|
-
if (args.inPlace && args.output)
|
|
5550
|
-
if (!args.dryRun && !args.inPlace && !args.output)
|
|
5551
|
-
if (args.force && !args.output)
|
|
5817
|
+
if (args.inPlace && args.input === "-") usage8("Stdin cannot be edited in place.");
|
|
5818
|
+
if (args.inPlace && args.output) usage8("Output and in-place cannot be combined.");
|
|
5819
|
+
if (!args.dryRun && !args.inPlace && !args.output) usage8("Mutation requires a destination.");
|
|
5820
|
+
if (args.force && !args.output) usage8("Force requires an explicit output destination.");
|
|
5552
5821
|
if (args.output === args.input && args.output !== "-")
|
|
5553
|
-
|
|
5822
|
+
usage8("Replacing input requires --in-place.");
|
|
5554
5823
|
if (args.output === "-" && args.json && !args.dryRun)
|
|
5555
|
-
|
|
5824
|
+
usage8("Binary stdout cannot be combined with JSON.");
|
|
5556
5825
|
}
|
|
5557
5826
|
async function executeNotesCommand(args, request, options2) {
|
|
5558
5827
|
const context = { ...options2.context, signal: request.signal };
|
|
@@ -5808,33 +6077,33 @@ var linkSchemas = Object.fromEntries(
|
|
|
5808
6077
|
// packages/safe-bash-command-pptx/src/command-links.ts
|
|
5809
6078
|
import { readPackage as readPackage2 } from "../../safe-bash-presentation-engine/package-reader.js";
|
|
5810
6079
|
import { parseXmlPart as parseXmlPart2 } from "../../safe-bash-presentation-engine/xml.js";
|
|
5811
|
-
import { OfficeError as
|
|
6080
|
+
import { OfficeError as OfficeError14 } from "../../safe-bash-presentation-engine/errors.js";
|
|
5812
6081
|
import { listLinks, setLink, removeLink, isOrdinaryLinkUrl } from "../../safe-bash-presentation-engine/links.js";
|
|
5813
6082
|
import { readShapes } from "../../safe-bash-presentation-engine/shape-operations.js";
|
|
5814
6083
|
import { SelectionError as SelectionError5 } from "../../safe-bash-presentation-engine/selectors.js";
|
|
5815
|
-
function
|
|
5816
|
-
throw new
|
|
6084
|
+
function usage9(message) {
|
|
6085
|
+
throw new OfficeError14("invalid-value", message, "usage");
|
|
5817
6086
|
}
|
|
5818
6087
|
function validateLinkCommand(args, positionals, seen) {
|
|
5819
6088
|
const allowed = Object.keys(linkSchemas[args.operation].options.properties).map(
|
|
5820
6089
|
(key) => "--" + [...key].map((c) => c >= "A" && c <= "Z" ? "-" + c.toLowerCase() : c).join("")
|
|
5821
6090
|
);
|
|
5822
|
-
if ([...seen].some((flag) => !allowed.includes(flag)))
|
|
5823
|
-
if (positionals.length !== 1 || !positionals[0])
|
|
6091
|
+
if ([...seen].some((flag) => !allowed.includes(flag))) usage9("Option does not apply to links.");
|
|
6092
|
+
if (positionals.length !== 1 || !positionals[0]) usage9("Links require exactly one input.");
|
|
5824
6093
|
args.input = positionals[0];
|
|
5825
|
-
if (args.scope !== void 0 && args.scope !== "slides")
|
|
6094
|
+
if (args.scope !== void 0 && args.scope !== "slides") usage9("Links support slides scope.");
|
|
5826
6095
|
if (args.token && ["--slide", "--shape", "--scope"].some((flag) => seen.has(flag)))
|
|
5827
|
-
|
|
6096
|
+
usage9("Opaque and simple selectors cannot be combined.");
|
|
5828
6097
|
if (args.shape !== void 0 && args.slide === void 0)
|
|
5829
|
-
|
|
6098
|
+
usage9("Shape selection requires a slide.");
|
|
5830
6099
|
const edit = args.linkEdit ?? {};
|
|
5831
6100
|
if (edit.trigger !== void 0 && !["click", "hover"].includes(edit.trigger))
|
|
5832
|
-
|
|
6101
|
+
usage9("Unsupported link trigger.");
|
|
5833
6102
|
if (edit.path !== void 0 && (!Array.isArray(edit.path) || edit.path.some((value) => !Number.isSafeInteger(value) || value < 0)))
|
|
5834
|
-
|
|
6103
|
+
usage9("Link path requires an array of nonnegative integer child positions.");
|
|
5835
6104
|
if (["links.list", "links.get"].includes(args.operation)) return;
|
|
5836
6105
|
if (!args.token && args.slide === void 0 && !args.all)
|
|
5837
|
-
|
|
6106
|
+
usage9("Link mutation requires explicit selection.");
|
|
5838
6107
|
if (args.operation !== "links.remove") {
|
|
5839
6108
|
const url = edit.url !== void 0, slide = edit.targetSlide !== void 0;
|
|
5840
6109
|
if (Number(url) + Number(slide) + Number(
|
|
@@ -5842,20 +6111,20 @@ function validateLinkCommand(args, positionals, seen) {
|
|
|
5842
6111
|
edit.action ?? ""
|
|
5843
6112
|
)
|
|
5844
6113
|
) !== 1)
|
|
5845
|
-
|
|
6114
|
+
usage9("Provide exactly one link destination.");
|
|
5846
6115
|
if (url && (!isOrdinaryLinkUrl(edit.url) || edit.action !== void 0 && edit.action !== "url"))
|
|
5847
|
-
|
|
6116
|
+
usage9("URL action must agree with its destination.");
|
|
5848
6117
|
if (slide && edit.action !== void 0 && edit.action !== "slide")
|
|
5849
|
-
|
|
6118
|
+
usage9("Slide action must agree with its destination.");
|
|
5850
6119
|
}
|
|
5851
|
-
if (args.inPlace && args.input === "-")
|
|
5852
|
-
if (args.inPlace && args.output)
|
|
5853
|
-
if (!args.dryRun && !args.inPlace && !args.output)
|
|
5854
|
-
if (args.force && !args.output)
|
|
6120
|
+
if (args.inPlace && args.input === "-") usage9("Stdin cannot be edited in place.");
|
|
6121
|
+
if (args.inPlace && args.output) usage9("Output and in-place cannot be combined.");
|
|
6122
|
+
if (!args.dryRun && !args.inPlace && !args.output) usage9("Mutation requires a destination.");
|
|
6123
|
+
if (args.force && !args.output) usage9("Force requires an explicit output destination.");
|
|
5855
6124
|
if (args.output === args.input && args.output !== "-")
|
|
5856
|
-
|
|
6125
|
+
usage9("Replacing input requires --in-place.");
|
|
5857
6126
|
if (args.output === "-" && args.json && !args.dryRun)
|
|
5858
|
-
|
|
6127
|
+
usage9("Binary stdout cannot be combined with JSON.");
|
|
5859
6128
|
}
|
|
5860
6129
|
var actionNames = {
|
|
5861
6130
|
url: "hyperlink",
|
|
@@ -5951,7 +6220,7 @@ async function executeLinkCommand(args, request, options2) {
|
|
|
5951
6220
|
if (args.operation === "links.add" && selectedLinks.some(
|
|
5952
6221
|
(link) => link.part === selection.owner && link.shapeId === selection.id && (path ? link.path.length === path.length + 1 && path.every((position, i) => link.path[i] === position) : existingShapeLinks.has(JSON.stringify([link.part, link.shapeId])))
|
|
5953
6222
|
))
|
|
5954
|
-
throw new
|
|
6223
|
+
throw new OfficeError14(
|
|
5955
6224
|
"unsupported-edit",
|
|
5956
6225
|
"Selected trigger already contains a link.",
|
|
5957
6226
|
"validate-intent"
|
|
@@ -6978,11 +7247,11 @@ import { readAnimations } from "../../safe-bash-presentation-engine/animations.j
|
|
|
6978
7247
|
import { mutateAnimations, mutateAnimationsBatch, validateAnimationOptions as validateAnimationOptions2 } from "../../safe-bash-presentation-engine/animation-editing.js";
|
|
6979
7248
|
|
|
6980
7249
|
// packages/safe-bash-command-pptx/src/animation-batch-command.ts
|
|
6981
|
-
import { OfficeError as
|
|
7250
|
+
import { OfficeError as OfficeError15 } from "../../safe-bash-presentation-engine/errors.js";
|
|
6982
7251
|
import { validateAnimationOptions } from "../../safe-bash-presentation-engine/animation-editing.js";
|
|
6983
7252
|
import { decodeSelectionToken, SelectionError as SelectionError6 } from "../../safe-bash-presentation-engine/selectors.js";
|
|
6984
7253
|
function invalid(message) {
|
|
6985
|
-
throw new
|
|
7254
|
+
throw new OfficeError15("invalid-value", message, "usage");
|
|
6986
7255
|
}
|
|
6987
7256
|
function record(value, keys) {
|
|
6988
7257
|
if (!value || typeof value !== "object" || Array.isArray(value) || Object.keys(value).some((key) => !keys.includes(key))) invalid("Invalid animation batch fields.");
|
|
@@ -7190,31 +7459,31 @@ var equationSchemas = Object.fromEntries(["list", "get", "add"].map((action) =>
|
|
|
7190
7459
|
}));
|
|
7191
7460
|
|
|
7192
7461
|
// packages/safe-bash-command-pptx/src/command-equations.ts
|
|
7193
|
-
import { OfficeError as
|
|
7462
|
+
import { OfficeError as OfficeError16 } from "../../safe-bash-presentation-engine/errors.js";
|
|
7194
7463
|
import { readEquations, mutateEquations } from "../../safe-bash-presentation-engine/equations.js";
|
|
7195
7464
|
import { SelectionError as SelectionError7 } from "../../safe-bash-presentation-engine/selectors.js";
|
|
7196
|
-
function
|
|
7197
|
-
throw new
|
|
7465
|
+
function usage10(message) {
|
|
7466
|
+
throw new OfficeError16("invalid-value", message, "usage");
|
|
7198
7467
|
}
|
|
7199
7468
|
function validateEquationCommand(args, positionals, seen) {
|
|
7200
7469
|
const schema = equationSchemas[args.operation];
|
|
7201
7470
|
const allowed = Object.keys(schema.options.properties).map((key) => "--" + [...key].map((c) => c >= "A" && c <= "Z" ? "-" + c.toLowerCase() : c).join(""));
|
|
7202
|
-
if ([...seen].some((flag) => !allowed.includes(flag)))
|
|
7203
|
-
if (positionals.length !== 1 || !positionals[0])
|
|
7471
|
+
if ([...seen].some((flag) => !allowed.includes(flag))) usage10("Option does not apply to equations.");
|
|
7472
|
+
if (positionals.length !== 1 || !positionals[0]) usage10("Equations require exactly one input.");
|
|
7204
7473
|
args.input = positionals[0];
|
|
7205
|
-
if (args.scope !== void 0 && args.scope !== "slides")
|
|
7206
|
-
if (args.token && ["--slide", "--shape", "--scope"].some((flag) => seen.has(flag)))
|
|
7207
|
-
if (args.shape !== void 0 && args.slide === void 0)
|
|
7474
|
+
if (args.scope !== void 0 && args.scope !== "slides") usage10("Equations support slides scope.");
|
|
7475
|
+
if (args.token && ["--slide", "--shape", "--scope"].some((flag) => seen.has(flag))) usage10("Opaque and simple selectors cannot be combined.");
|
|
7476
|
+
if (args.shape !== void 0 && args.slide === void 0) usage10("Shape selection requires a slide.");
|
|
7208
7477
|
if (args.operation !== "equations.add") return;
|
|
7209
|
-
if (!args.file)
|
|
7210
|
-
if (!args.token && !args.shape)
|
|
7211
|
-
if (args.input === "-" && args.file === "-")
|
|
7212
|
-
if (args.inPlace && args.input === "-")
|
|
7213
|
-
if (args.inPlace && args.output)
|
|
7214
|
-
if (!args.dryRun && !args.inPlace && !args.output)
|
|
7215
|
-
if (args.force && !args.output)
|
|
7216
|
-
if (args.output === args.input && args.output !== "-")
|
|
7217
|
-
if (args.output === "-" && args.json && !args.dryRun)
|
|
7478
|
+
if (!args.file) usage10("Equation insertion requires --file.");
|
|
7479
|
+
if (!args.token && !args.shape) usage10("Equation insertion requires a shape selector.");
|
|
7480
|
+
if (args.input === "-" && args.file === "-") usage10("Only one input may consume stdin.");
|
|
7481
|
+
if (args.inPlace && args.input === "-") usage10("Stdin cannot be edited in place.");
|
|
7482
|
+
if (args.inPlace && args.output) usage10("Output and in-place cannot be combined.");
|
|
7483
|
+
if (!args.dryRun && !args.inPlace && !args.output) usage10("Mutation requires a destination.");
|
|
7484
|
+
if (args.force && !args.output) usage10("Force requires an explicit output destination.");
|
|
7485
|
+
if (args.output === args.input && args.output !== "-") usage10("Replacing input requires --in-place.");
|
|
7486
|
+
if (args.output === "-" && args.json && !args.dryRun) usage10("Binary stdout cannot be combined with JSON.");
|
|
7218
7487
|
}
|
|
7219
7488
|
async function executeEquationCommand(args, request, options2) {
|
|
7220
7489
|
const context = { ...options2.context, signal: request.signal };
|
|
@@ -7345,30 +7614,30 @@ var opaqueSchemas = Object.fromEntries(["objects.list", "objects.extract", "font
|
|
|
7345
7614
|
|
|
7346
7615
|
// packages/safe-bash-command-pptx/src/command-opaque.ts
|
|
7347
7616
|
import { sha256 as sha2563 } from "@noble/hashes/sha2.js";
|
|
7348
|
-
import { OfficeError as
|
|
7617
|
+
import { OfficeError as OfficeError17 } from "../../safe-bash-presentation-engine/errors.js";
|
|
7349
7618
|
import { extractObject, readFonts, readObjects } from "../../safe-bash-presentation-engine/opaque-objects.js";
|
|
7350
|
-
import { partName as
|
|
7351
|
-
function
|
|
7352
|
-
throw new
|
|
7619
|
+
import { partName as partName3 } from "../../safe-bash-presentation-engine/package-uri.js";
|
|
7620
|
+
function usage11(message) {
|
|
7621
|
+
throw new OfficeError17("invalid-value", message, "usage");
|
|
7353
7622
|
}
|
|
7354
7623
|
function validateOpaqueCommand(args, positionals, seen) {
|
|
7355
7624
|
const schema = opaqueSchemas[args.operation];
|
|
7356
7625
|
const allowed = Object.keys(schema.options.properties).map((key) => "--" + [...key].map((c) => c >= "A" && c <= "Z" ? "-" + c.toLowerCase() : c).join(""));
|
|
7357
|
-
if ([...seen].some((flag) => !allowed.includes(flag)))
|
|
7358
|
-
if (positionals.length !== 1 || !positionals[0])
|
|
7626
|
+
if ([...seen].some((flag) => !allowed.includes(flag))) usage11("Option does not apply to opaque resources.");
|
|
7627
|
+
if (positionals.length !== 1 || !positionals[0]) usage11("Opaque resources require exactly one input.");
|
|
7359
7628
|
args.input = positionals[0];
|
|
7360
7629
|
const scope = args.operation === "fonts.list" ? "presentation" : "shared";
|
|
7361
|
-
if (args.scope !== void 0 && args.scope !== scope)
|
|
7630
|
+
if (args.scope !== void 0 && args.scope !== scope) usage11("Unsupported opaque resource scope.");
|
|
7362
7631
|
if (args.operation !== "objects.extract") return;
|
|
7363
|
-
if (!args.part)
|
|
7632
|
+
if (!args.part) usage11("Object extraction requires --part.");
|
|
7364
7633
|
try {
|
|
7365
|
-
if (
|
|
7634
|
+
if (partName3(args.part, false) !== args.part) usage11("Object extraction requires a canonical package part.");
|
|
7366
7635
|
} catch {
|
|
7367
|
-
|
|
7636
|
+
usage11("Object extraction requires a canonical package part.");
|
|
7368
7637
|
}
|
|
7369
|
-
if (!args.outputDir && !args.dryRun)
|
|
7370
|
-
if (args.outputDir === "-")
|
|
7371
|
-
if (args.force && !args.outputDir)
|
|
7638
|
+
if (!args.outputDir && !args.dryRun) usage11("Object extraction requires --output-dir.");
|
|
7639
|
+
if (args.outputDir === "-") usage11("Output directories cannot be stdout.");
|
|
7640
|
+
if (args.force && !args.outputDir) usage11("Force requires an output directory.");
|
|
7372
7641
|
}
|
|
7373
7642
|
async function executeOpaqueCommand(args, request, options2) {
|
|
7374
7643
|
const context = { ...options2.context, signal: request.signal };
|
|
@@ -7386,7 +7655,7 @@ async function executeOpaqueCommand(args, request, options2) {
|
|
|
7386
7655
|
}
|
|
7387
7656
|
const extracted = await extractObject(bytes, { part: args.part }, context);
|
|
7388
7657
|
const files = [{ part: extracted.part, name: extracted.name, bytes: extracted.bytes }, ...extracted.dependencies];
|
|
7389
|
-
if (files.length > (args.limits?.maxOutputs ?? context.archiveLimits.maxMembers)) throw new
|
|
7658
|
+
if (files.length > (args.limits?.maxOutputs ?? context.archiveLimits.maxMembers)) throw new OfficeError17("resource-limit", "Opaque output count exceeds limit.", "validate-intent");
|
|
7390
7659
|
const dryRun = args.dryRun ?? false;
|
|
7391
7660
|
const allowPartialOutput = args.allowPartialOutput ?? false;
|
|
7392
7661
|
if (!dryRun && !request.publishOutputs && (!allowPartialOutput || !request.publishOutput)) throw Object.assign(new Error("Object extraction requires atomic publication or explicit partial output."), { code: "publication-unsupported" });
|
|
@@ -7418,7 +7687,7 @@ import { readMedia } from "../../safe-bash-presentation-engine/media.js";
|
|
|
7418
7687
|
import { extractMedia } from "../../safe-bash-presentation-engine/media-extraction.js";
|
|
7419
7688
|
|
|
7420
7689
|
// packages/safe-bash-command-pptx/src/command-media-editing.ts
|
|
7421
|
-
import { OfficeError as
|
|
7690
|
+
import { OfficeError as OfficeError18 } from "../../safe-bash-presentation-engine/errors.js";
|
|
7422
7691
|
import { addMedia, replaceMedia } from "../../safe-bash-presentation-engine/media-editing.js";
|
|
7423
7692
|
|
|
7424
7693
|
// packages/safe-bash-command-pptx/src/media-schema.ts
|
|
@@ -7667,56 +7936,56 @@ for (const action of ["add", "replace", "extract"]) {
|
|
|
7667
7936
|
}
|
|
7668
7937
|
|
|
7669
7938
|
// packages/safe-bash-command-pptx/src/command-media-editing.ts
|
|
7670
|
-
function
|
|
7671
|
-
throw new
|
|
7939
|
+
function usage12(message) {
|
|
7940
|
+
throw new OfficeError18("invalid-value", message, "usage");
|
|
7672
7941
|
}
|
|
7673
7942
|
function validateMediaEditingCommand(args, positionals, seen) {
|
|
7674
7943
|
const allowed = Object.keys(mediaSchemas[args.operation].options.properties).map(
|
|
7675
7944
|
(key) => "--" + [...key].map((c) => c >= "A" && c <= "Z" ? "-" + c.toLowerCase() : c).join("")
|
|
7676
7945
|
);
|
|
7677
7946
|
if ([...seen].some((flag) => !allowed.includes(flag)))
|
|
7678
|
-
|
|
7679
|
-
if (positionals.length !== 1 || !positionals[0])
|
|
7947
|
+
usage12("Option does not apply to this media operation.");
|
|
7948
|
+
if (positionals.length !== 1 || !positionals[0]) usage12("Media requires exactly one input.");
|
|
7680
7949
|
args.input = positionals[0];
|
|
7681
7950
|
if (args.token && ["--slide", "--shape", "--scope", "--all"].some((flag) => seen.has(flag)))
|
|
7682
|
-
|
|
7951
|
+
usage12("Opaque and simple selectors cannot be combined.");
|
|
7683
7952
|
if (args.shape !== void 0 && args.slide === void 0)
|
|
7684
|
-
|
|
7953
|
+
usage12("Shape selection requires an owning slide.");
|
|
7685
7954
|
if (args.operation === "media.extract") {
|
|
7686
7955
|
if (!args.outputDir || args.outputDir === "-")
|
|
7687
|
-
|
|
7956
|
+
usage12("Media extraction requires an output directory.");
|
|
7688
7957
|
return;
|
|
7689
7958
|
}
|
|
7690
7959
|
if (args.operation === "media.add" && args.scope !== void 0 && args.scope !== "slides")
|
|
7691
|
-
|
|
7692
|
-
if (!args.file)
|
|
7960
|
+
usage12("Media editing requires slides scope.");
|
|
7961
|
+
if (!args.file) usage12("Media mutation requires --file.");
|
|
7693
7962
|
if (args.operation === "media.add") {
|
|
7694
7963
|
if (args.slide === void 0 || !args.mediaEdit?.kind || !args.mediaEdit.contentType || ["left", "top", "width", "height"].some(
|
|
7695
7964
|
(key) => args.mediaEdit?.[key] === void 0
|
|
7696
7965
|
))
|
|
7697
|
-
|
|
7698
|
-
if (!args.poster)
|
|
7966
|
+
usage12("Media insertion requires slide, kind, MIME type and explicit geometry.");
|
|
7967
|
+
if (!args.poster) usage12("Media insertion requires an explicit poster.");
|
|
7699
7968
|
} else {
|
|
7700
|
-
if (!args.poster)
|
|
7969
|
+
if (!args.poster) usage12("Media replacement requires an explicit poster.");
|
|
7701
7970
|
if (!args.token && args.shape === void 0 && !args.all)
|
|
7702
|
-
|
|
7971
|
+
usage12("Media replacement requires a shape selector or all.");
|
|
7703
7972
|
}
|
|
7704
7973
|
if ([args.input, args.file, args.poster].filter((value) => value === "-").length > 1)
|
|
7705
|
-
|
|
7974
|
+
usage12("Only one input may consume stdin.");
|
|
7706
7975
|
if (args.poster && !args.posterContentType) {
|
|
7707
7976
|
const extension = args.poster.slice(args.poster.lastIndexOf(".") + 1).toLowerCase();
|
|
7708
7977
|
const inferred = { png: "image/png", jpg: "image/jpeg", jpeg: "image/jpeg", gif: "image/gif", bmp: "image/bmp", tif: "image/tiff", tiff: "image/tiff", wmf: "image/x-wmf" }[extension];
|
|
7709
|
-
if (!inferred)
|
|
7978
|
+
if (!inferred) usage12("Poster requires an explicit content type or supported extension.");
|
|
7710
7979
|
args.posterContentType = inferred;
|
|
7711
7980
|
}
|
|
7712
|
-
if (args.inPlace && args.input === "-")
|
|
7713
|
-
if (args.inPlace && args.output)
|
|
7714
|
-
if (!args.dryRun && !args.inPlace && !args.output)
|
|
7715
|
-
if (args.force && !args.output)
|
|
7981
|
+
if (args.inPlace && args.input === "-") usage12("Stdin cannot be edited in place.");
|
|
7982
|
+
if (args.inPlace && args.output) usage12("Output and in-place cannot be combined.");
|
|
7983
|
+
if (!args.dryRun && !args.inPlace && !args.output) usage12("Mutation requires a destination.");
|
|
7984
|
+
if (args.force && !args.output) usage12("Force requires an explicit output destination.");
|
|
7716
7985
|
if (args.output === args.input && args.output !== "-")
|
|
7717
|
-
|
|
7986
|
+
usage12("Replacing input requires --in-place.");
|
|
7718
7987
|
if (args.output === "-" && args.json && !args.dryRun)
|
|
7719
|
-
|
|
7988
|
+
usage12("Binary stdout cannot be combined with JSON.");
|
|
7720
7989
|
}
|
|
7721
7990
|
async function executeMediaEditingCommand(args, request, options2) {
|
|
7722
7991
|
const context = { ...options2.context, signal: request.signal };
|
|
@@ -8762,9 +9031,9 @@ import {
|
|
|
8762
9031
|
import { readBackgrounds, mutateBackground } from "../../safe-bash-presentation-engine/backgrounds.js";
|
|
8763
9032
|
import { replacePresentationText } from "../../safe-bash-presentation-engine/text-replacement.js";
|
|
8764
9033
|
import { readPresentationText } from "../../safe-bash-presentation-engine/text-reading.js";
|
|
8765
|
-
import { OfficeError as
|
|
9034
|
+
import { OfficeError as OfficeError19 } from "../../safe-bash-presentation-engine/errors.js";
|
|
8766
9035
|
import { sha256 as sha2564 } from "@noble/hashes/sha2.js";
|
|
8767
|
-
import { packageUri, partName as
|
|
9036
|
+
import { packageUri, partName as partName4 } from "../../safe-bash-presentation-engine/package-uri.js";
|
|
8768
9037
|
import {
|
|
8769
9038
|
SelectionError as SelectionError8,
|
|
8770
9039
|
decodeSelectionToken as decodeSelectionToken2,
|
|
@@ -8794,10 +9063,10 @@ import {
|
|
|
8794
9063
|
readPresentationSettings,
|
|
8795
9064
|
mutatePresentationSettings
|
|
8796
9065
|
} from "../../safe-bash-presentation-engine/presentation-settings.js";
|
|
8797
|
-
import { getXmlPart, stageRetainedXmlPart, replaceXmlPart } from "../../safe-bash-presentation-engine/xml-parts.js";
|
|
9066
|
+
import { getXmlPart, stageRetainedXmlPart, stageRetainedXmlReplacement, replaceXmlPart } from "../../safe-bash-presentation-engine/xml-parts.js";
|
|
8798
9067
|
import { validatePresentation, openRetainedPresentationValidation } from "../../safe-bash-presentation-engine/validation.js";
|
|
8799
9068
|
import { readPackage as readPackage3 } from "../../safe-bash-presentation-engine/package-reader.js";
|
|
8800
|
-
import { resourceContext } from "../../safe-bash-presentation-engine/resource-limits.js";
|
|
9069
|
+
import { resourceContext as resourceContext2 } from "../../safe-bash-presentation-engine/resource-limits.js";
|
|
8801
9070
|
var scopes2 = [
|
|
8802
9071
|
"slides",
|
|
8803
9072
|
"notes",
|
|
@@ -8963,15 +9232,15 @@ Dimension conflicts reject by default; destination policy retains source coordin
|
|
|
8963
9232
|
Slides add requires an exact layout name or part URI; position defaults to append.
|
|
8964
9233
|
Title/body match placeholder types; indexed bindings use --placeholders-json.
|
|
8965
9234
|
`;
|
|
8966
|
-
function
|
|
8967
|
-
throw new
|
|
9235
|
+
function usage13(message) {
|
|
9236
|
+
throw new OfficeError19("invalid-value", message, "usage");
|
|
8968
9237
|
}
|
|
8969
9238
|
function paragraphTabLength(length4) {
|
|
8970
9239
|
if (Object.keys(length4).some((key) => !["value", "unit"].includes(key)) || typeof length4.value !== "number" || !Number.isFinite(length4.value) || length4.value < 0 || typeof length4.unit !== "string")
|
|
8971
|
-
|
|
9240
|
+
usage13("Tabs require finite explicit lengths.");
|
|
8972
9241
|
const emu = length4.value * commandLength("1" + length4.unit, 0);
|
|
8973
9242
|
if (!Number.isFinite(emu) || emu > Number.MAX_SAFE_INTEGER)
|
|
8974
|
-
|
|
9243
|
+
usage13("Tab length is outside the supported range.");
|
|
8975
9244
|
return Math.round(emu) / 12700;
|
|
8976
9245
|
}
|
|
8977
9246
|
var runFlags = [
|
|
@@ -9219,11 +9488,11 @@ function parse(raw, maximum, output3) {
|
|
|
9219
9488
|
const decoder = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true });
|
|
9220
9489
|
for (let index = 0; index < raw.length; index++) {
|
|
9221
9490
|
const bytes = raw[index];
|
|
9222
|
-
if (!(bytes instanceof Uint8Array))
|
|
9491
|
+
if (!(bytes instanceof Uint8Array)) usage13("Arguments must be byte arrays.");
|
|
9223
9492
|
size += bytes.length + 1;
|
|
9224
9493
|
if (size > maximum) {
|
|
9225
|
-
if (invalidUtf8)
|
|
9226
|
-
throw new
|
|
9494
|
+
if (invalidUtf8) usage13("Arguments must be UTF-8.");
|
|
9495
|
+
throw new OfficeError19("resource-limit", "Argument limit exceeded.", "usage");
|
|
9227
9496
|
}
|
|
9228
9497
|
try {
|
|
9229
9498
|
args.push(decoder.decode(bytes));
|
|
@@ -9294,9 +9563,9 @@ function parse(raw, maximum, output3) {
|
|
|
9294
9563
|
else if (scalarOptions.includes(argument)) hintValue = true;
|
|
9295
9564
|
}
|
|
9296
9565
|
}
|
|
9297
|
-
if (invalidUtf8)
|
|
9566
|
+
if (invalidUtf8) usage13("Arguments must be UTF-8.");
|
|
9298
9567
|
if (args[0] === "accessibility" && ["--help", "-h"].includes(args[1])) {
|
|
9299
|
-
if (args.slice(2).some((argument) => argument !== "--json"))
|
|
9568
|
+
if (args.slice(2).some((argument) => argument !== "--json")) usage13("Unexpected help option.");
|
|
9300
9569
|
return { operation: "help", json: output3.json, schemaPath: "accessibility" };
|
|
9301
9570
|
}
|
|
9302
9571
|
if (args[0] === "text" && ["runs", "paragraphs", "frames"].includes(args[1]) && ["get", "set", "list"].includes(args[2])) {
|
|
@@ -9401,7 +9670,7 @@ function parse(raw, maximum, output3) {
|
|
|
9401
9670
|
"help",
|
|
9402
9671
|
"version"
|
|
9403
9672
|
].includes(operation))
|
|
9404
|
-
|
|
9673
|
+
usage13("Unsupported operation.");
|
|
9405
9674
|
const result = { operation, json: false };
|
|
9406
9675
|
const positionals = [];
|
|
9407
9676
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -9431,10 +9700,10 @@ function parse(raw, maximum, output3) {
|
|
|
9431
9700
|
"--height",
|
|
9432
9701
|
"--workbook-policy"
|
|
9433
9702
|
].includes(argument)) {
|
|
9434
|
-
if (seen.has(argument))
|
|
9703
|
+
if (seen.has(argument)) usage13("Repeated option.");
|
|
9435
9704
|
seen.add(argument);
|
|
9436
9705
|
const value2 = args[++index];
|
|
9437
|
-
if (value2 === void 0)
|
|
9706
|
+
if (value2 === void 0) usage13("Chart option requires a value.");
|
|
9438
9707
|
const key = argument.slice(2);
|
|
9439
9708
|
if (key === "workbook-policy") result.chartWorkbookPolicy = value2;
|
|
9440
9709
|
else {
|
|
@@ -9442,10 +9711,10 @@ function parse(raw, maximum, output3) {
|
|
|
9442
9711
|
if (key === "data" || key === "objects") parsed = commandJson(value2);
|
|
9443
9712
|
else if (key === "style") {
|
|
9444
9713
|
if (!value2.length || [...value2].some((c) => c < "0" || c > "9"))
|
|
9445
|
-
|
|
9714
|
+
usage13("Chart style requires an integer.");
|
|
9446
9715
|
parsed = Number(value2);
|
|
9447
9716
|
} else if (key === "legend") {
|
|
9448
|
-
if (!["true", "false"].includes(value2))
|
|
9717
|
+
if (!["true", "false"].includes(value2)) usage13("Legend requires true or false.");
|
|
9449
9718
|
parsed = value2 === "true";
|
|
9450
9719
|
} else if (["left", "top", "width", "height"].includes(key))
|
|
9451
9720
|
parsed = commandLength(
|
|
@@ -9459,14 +9728,14 @@ function parse(raw, maximum, output3) {
|
|
|
9459
9728
|
if (operation.startsWith("tables.") && (argument === "--table" || argument === "--cell" || ["--from", "--to", "--position", "--span-policy"].includes(argument) || Object.keys(tableValues).some(
|
|
9460
9729
|
(key) => "--" + [...key].map((c) => c >= "A" && c <= "Z" ? "-" + c.toLowerCase() : c).join("") === argument
|
|
9461
9730
|
))) {
|
|
9462
|
-
if (seen.has(argument))
|
|
9731
|
+
if (seen.has(argument)) usage13("Repeated option.");
|
|
9463
9732
|
seen.add(argument);
|
|
9464
9733
|
const value2 = args[++index];
|
|
9465
|
-
if (value2 === void 0)
|
|
9734
|
+
if (value2 === void 0) usage13("Table option requires a value.");
|
|
9466
9735
|
const key = argument.slice(2).split("-").map((word, i) => i ? word[0].toUpperCase() + word.slice(1) : word).join("");
|
|
9467
9736
|
if (key === "table" || key === "rows" || key === "columns" || key === "position") {
|
|
9468
9737
|
if (!value2.length || [...value2].some((c) => c < "0" || c > "9") || !Number.isSafeInteger(Number(value2)) || Number(value2) < 1)
|
|
9469
|
-
|
|
9738
|
+
usage13("Table positions and dimensions require positive integers.");
|
|
9470
9739
|
if (key === "position") result.tablePosition = Number(value2);
|
|
9471
9740
|
else if (key === "table") result.table = Number(value2);
|
|
9472
9741
|
else result.tableEdit = { ...result.tableEdit, [key]: Number(value2) };
|
|
@@ -9475,7 +9744,7 @@ function parse(raw, maximum, output3) {
|
|
|
9475
9744
|
try {
|
|
9476
9745
|
tableCell(value2);
|
|
9477
9746
|
} catch {
|
|
9478
|
-
|
|
9747
|
+
usage13("Cell requires one-based row,column coordinates.");
|
|
9479
9748
|
}
|
|
9480
9749
|
if (key === "from") result.tableFrom = value2;
|
|
9481
9750
|
else if (key === "to") result.tableTo = value2;
|
|
@@ -9497,7 +9766,7 @@ function parse(raw, maximum, output3) {
|
|
|
9497
9766
|
let parsed = value2;
|
|
9498
9767
|
if (key === "data") parsed = commandJson(value2);
|
|
9499
9768
|
else if (["firstRow", "lastRow", "firstCol", "lastCol", "horzBand", "vertBand"].includes(key)) {
|
|
9500
|
-
if (!["true", "false"].includes(value2))
|
|
9769
|
+
if (!["true", "false"].includes(value2)) usage13("Table style flags require true or false.");
|
|
9501
9770
|
parsed = value2 === "true";
|
|
9502
9771
|
} else if (value2 === "null" && !["text"].includes(key)) parsed = null;
|
|
9503
9772
|
else if (lengths.includes(key))
|
|
@@ -9522,10 +9791,10 @@ function parse(raw, maximum, output3) {
|
|
|
9522
9791
|
"--line-width",
|
|
9523
9792
|
"--line-color"
|
|
9524
9793
|
].includes(argument)) {
|
|
9525
|
-
if (seen.has(argument))
|
|
9794
|
+
if (seen.has(argument)) usage13("Repeated option.");
|
|
9526
9795
|
seen.add(argument);
|
|
9527
9796
|
const value2 = args[++index];
|
|
9528
|
-
if (value2 === void 0)
|
|
9797
|
+
if (value2 === void 0) usage13("Connector option requires a value.");
|
|
9529
9798
|
const keys = {
|
|
9530
9799
|
"--begin-x": "beginX",
|
|
9531
9800
|
"--begin-y": "beginY",
|
|
@@ -9539,7 +9808,7 @@ function parse(raw, maximum, output3) {
|
|
|
9539
9808
|
};
|
|
9540
9809
|
const key = keys[argument] ?? argument.slice(2);
|
|
9541
9810
|
if (key === "site" && (!value2 || [...value2].some((c) => c < "0" || c > "9")))
|
|
9542
|
-
|
|
9811
|
+
usage13("Sites require nonnegative decimal integers.");
|
|
9543
9812
|
const parsed = key === "lineWidth" ? value2 === "null" ? null : new Emu(commandLength(value2, 0)) : ["beginX", "beginY", "endX", "endY"].includes(key) ? new Emu(commandLength(value2, -Number.MAX_SAFE_INTEGER)) : ["beginTarget", "endTarget"].includes(key) ? commandJson(value2) : key === "site" ? Number(value2) : key === "kind" && ["1", "2", "3"].includes(value2) ? Number(value2) : key !== "name" && value2 === "null" ? null : value2;
|
|
9544
9813
|
result.connectorEdit = { ...result.connectorEdit, [key]: parsed };
|
|
9545
9814
|
continue;
|
|
@@ -9556,14 +9825,14 @@ function parse(raw, maximum, output3) {
|
|
|
9556
9825
|
"--offset-x",
|
|
9557
9826
|
"--offset-y"
|
|
9558
9827
|
].includes(argument)) {
|
|
9559
|
-
if (seen.has(argument))
|
|
9828
|
+
if (seen.has(argument)) usage13("Repeated option.");
|
|
9560
9829
|
seen.add(argument);
|
|
9561
9830
|
const value2 = args[++index];
|
|
9562
|
-
if (value2 === void 0)
|
|
9831
|
+
if (value2 === void 0) usage13("Shape selection option requires a value.");
|
|
9563
9832
|
if (argument === "--shapes") {
|
|
9564
9833
|
const locations = commandJson(value2);
|
|
9565
9834
|
if (!Array.isArray(locations) || locations.length === 0)
|
|
9566
|
-
|
|
9835
|
+
usage13("Shapes requires a nonempty location array.");
|
|
9567
9836
|
result.shapes = locations;
|
|
9568
9837
|
} else {
|
|
9569
9838
|
const key = argument === "--coordinate-system" ? "coordinateSystem" : argument === "--offset-x" ? "offsetX" : argument === "--offset-y" ? "offsetY" : argument.slice(2);
|
|
@@ -9576,24 +9845,24 @@ function parse(raw, maximum, output3) {
|
|
|
9576
9845
|
continue;
|
|
9577
9846
|
}
|
|
9578
9847
|
if (["shapes.group", "shapes.ungroup"].includes(operation) && ["--shapes", "--tolerance"].includes(argument)) {
|
|
9579
|
-
if (seen.has(argument))
|
|
9848
|
+
if (seen.has(argument)) usage13("Repeated option.");
|
|
9580
9849
|
seen.add(argument);
|
|
9581
9850
|
const value2 = args[++index];
|
|
9582
|
-
if (value2 === void 0)
|
|
9851
|
+
if (value2 === void 0) usage13("Group option requires a value.");
|
|
9583
9852
|
if (argument === "--tolerance") result.tolerance = new Emu(commandLength(value2, 0));
|
|
9584
9853
|
else {
|
|
9585
9854
|
const locations = commandJson(value2);
|
|
9586
9855
|
if (!Array.isArray(locations) || locations.length < 2)
|
|
9587
|
-
|
|
9856
|
+
usage13("Grouping requires at least two shape locations.");
|
|
9588
9857
|
result.shapes = locations;
|
|
9589
9858
|
}
|
|
9590
9859
|
continue;
|
|
9591
9860
|
}
|
|
9592
9861
|
if (operation.startsWith("fields.") && ["--kind", "--text", "--update", "--timestamp"].includes(argument)) {
|
|
9593
|
-
if (seen.has(argument))
|
|
9862
|
+
if (seen.has(argument)) usage13("Repeated option.");
|
|
9594
9863
|
seen.add(argument);
|
|
9595
9864
|
const value2 = args[++index];
|
|
9596
|
-
if (value2 === void 0)
|
|
9865
|
+
if (value2 === void 0) usage13("Field option requires a value.");
|
|
9597
9866
|
const key = argument.slice(2);
|
|
9598
9867
|
result.fieldEdit = {
|
|
9599
9868
|
...result.fieldEdit,
|
|
@@ -9602,13 +9871,13 @@ function parse(raw, maximum, output3) {
|
|
|
9602
9871
|
continue;
|
|
9603
9872
|
}
|
|
9604
9873
|
if (operation.startsWith("animations.") && ["--kind", "--trigger", "--duration", "--delay", "--target"].includes(argument)) {
|
|
9605
|
-
if (seen.has(argument))
|
|
9874
|
+
if (seen.has(argument)) usage13("Repeated option.");
|
|
9606
9875
|
seen.add(argument);
|
|
9607
9876
|
const value2 = args[++index];
|
|
9608
|
-
if (value2 === void 0)
|
|
9877
|
+
if (value2 === void 0) usage13("Animation option requires a value.");
|
|
9609
9878
|
let parsed = value2;
|
|
9610
9879
|
if (argument === "--duration" || argument === "--delay") {
|
|
9611
|
-
if (!value2.length || [...value2].some((character) => character < "0" || character > "9"))
|
|
9880
|
+
if (!value2.length || [...value2].some((character) => character < "0" || character > "9")) usage13("Timing requires integer milliseconds.");
|
|
9612
9881
|
parsed = Number(value2);
|
|
9613
9882
|
}
|
|
9614
9883
|
if (argument === "--target") parsed = animationTargetArgument(value2.trimStart().startsWith("{") ? commandJson(value2) : value2);
|
|
@@ -9616,31 +9885,31 @@ function parse(raw, maximum, output3) {
|
|
|
9616
9885
|
continue;
|
|
9617
9886
|
}
|
|
9618
9887
|
if (operation === "batch" && ["--ops-json", "--ops-file"].includes(argument)) {
|
|
9619
|
-
if (seen.has(argument))
|
|
9888
|
+
if (seen.has(argument)) usage13("Repeated option.");
|
|
9620
9889
|
seen.add(argument);
|
|
9621
9890
|
const value2 = args[++index];
|
|
9622
|
-
if (!value2)
|
|
9891
|
+
if (!value2) usage13("Batch option requires a value.");
|
|
9623
9892
|
if (argument === "--ops-json") result.animationBatch = parseAnimationBatch(commandJson(value2));
|
|
9624
9893
|
else result.opsFile = value2;
|
|
9625
9894
|
continue;
|
|
9626
9895
|
}
|
|
9627
9896
|
if (operation.startsWith("comments.") && ["--id", "--text", "--author", "--author-id", "--initials", "--timestamp", "--left", "--top"].includes(argument)) {
|
|
9628
|
-
if (seen.has(argument))
|
|
9897
|
+
if (seen.has(argument)) usage13("Repeated option.");
|
|
9629
9898
|
seen.add(argument);
|
|
9630
9899
|
const value2 = args[++index];
|
|
9631
|
-
if (value2 === void 0)
|
|
9900
|
+
if (value2 === void 0) usage13("Comment option requires a value.");
|
|
9632
9901
|
const key = argument === "--author-id" ? "authorId" : argument.slice(2);
|
|
9633
9902
|
const parsed = ["left", "top"].includes(key) ? commandLength(value2, -Number.MAX_SAFE_INTEGER) : key === "timestamp" ? commandTimestamp(value2).toISOString() : value2;
|
|
9634
9903
|
result.commentEdit = { ...result.commentEdit, [key]: parsed };
|
|
9635
9904
|
continue;
|
|
9636
9905
|
}
|
|
9637
9906
|
if (Object.hasOwn(accessibilitySchemas, operation) && ["--title", "--alt-text", "--decorative"].includes(argument)) {
|
|
9638
|
-
if (seen.has(argument))
|
|
9907
|
+
if (seen.has(argument)) usage13("Repeated option.");
|
|
9639
9908
|
seen.add(argument);
|
|
9640
9909
|
const value2 = args[++index];
|
|
9641
|
-
if (value2 === void 0)
|
|
9910
|
+
if (value2 === void 0) usage13("Accessibility option requires a value.");
|
|
9642
9911
|
if (argument === "--decorative") {
|
|
9643
|
-
if (value2 !== "true" && value2 !== "false")
|
|
9912
|
+
if (value2 !== "true" && value2 !== "false") usage13("Decorative requires true or false.");
|
|
9644
9913
|
result.accessibilityEdit = { ...result.accessibilityEdit, decorative: value2 === "true" };
|
|
9645
9914
|
} else {
|
|
9646
9915
|
const key = argument === "--alt-text" ? "altText" : "title";
|
|
@@ -9649,10 +9918,10 @@ function parse(raw, maximum, output3) {
|
|
|
9649
9918
|
continue;
|
|
9650
9919
|
}
|
|
9651
9920
|
if (Object.hasOwn(metadataSchemas, operation) && ["--name", "--value", "--type", "--remove"].includes(argument)) {
|
|
9652
|
-
if (seen.has(argument))
|
|
9921
|
+
if (seen.has(argument)) usage13("Repeated option.");
|
|
9653
9922
|
seen.add(argument);
|
|
9654
9923
|
const value2 = args[++index];
|
|
9655
|
-
if (value2 === void 0)
|
|
9924
|
+
if (value2 === void 0) usage13("Metadata option requires a value.");
|
|
9656
9925
|
if (argument === "--name") result.metadataName = value2;
|
|
9657
9926
|
else if (argument === "--value") result.metadataValue = value2;
|
|
9658
9927
|
else if (argument === "--type") result.metadataType = value2;
|
|
@@ -9660,49 +9929,49 @@ function parse(raw, maximum, output3) {
|
|
|
9660
9929
|
continue;
|
|
9661
9930
|
}
|
|
9662
9931
|
if (operation.startsWith("notes.") && argument === "--text") {
|
|
9663
|
-
if (seen.has(argument))
|
|
9932
|
+
if (seen.has(argument)) usage13("Repeated option.");
|
|
9664
9933
|
seen.add(argument);
|
|
9665
9934
|
const value2 = args[++index];
|
|
9666
|
-
if (value2 === void 0)
|
|
9935
|
+
if (value2 === void 0) usage13("Notes text requires a value.");
|
|
9667
9936
|
result.noteText = value2;
|
|
9668
9937
|
continue;
|
|
9669
9938
|
}
|
|
9670
9939
|
if (operation.startsWith("links.") && ["--url", "--target-slide", "--action", "--trigger", "--sanitize", "--path"].includes(argument)) {
|
|
9671
|
-
if (seen.has(argument))
|
|
9940
|
+
if (seen.has(argument)) usage13("Repeated option.");
|
|
9672
9941
|
seen.add(argument);
|
|
9673
9942
|
if (argument === "--sanitize") {
|
|
9674
9943
|
result.linkEdit = { ...result.linkEdit, sanitize: true };
|
|
9675
9944
|
continue;
|
|
9676
9945
|
}
|
|
9677
9946
|
const value2 = args[++index];
|
|
9678
|
-
if (value2 === void 0)
|
|
9679
|
-
if (argument === "--target-slide" && (!value2.length || [...value2].some((c) => c < "0" || c > "9") || !Number.isSafeInteger(Number(value2)) || Number(value2) < 1))
|
|
9947
|
+
if (value2 === void 0) usage13("Link option requires a value.");
|
|
9948
|
+
if (argument === "--target-slide" && (!value2.length || [...value2].some((c) => c < "0" || c > "9") || !Number.isSafeInteger(Number(value2)) || Number(value2) < 1)) usage13("Slide target requires a positive integer.");
|
|
9680
9949
|
const key = argument === "--target-slide" ? "targetSlide" : argument.slice(2);
|
|
9681
9950
|
result.linkEdit = { ...result.linkEdit, [key]: argument === "--target-slide" ? Number(value2) : argument === "--path" ? commandJson(value2) : value2 };
|
|
9682
9951
|
continue;
|
|
9683
9952
|
}
|
|
9684
9953
|
if (operation.startsWith("transitions.") && ["--kind", "--direction", "--duration", "--advance-after", "--advance-on-click"].includes(argument)) {
|
|
9685
|
-
if (seen.has(argument))
|
|
9954
|
+
if (seen.has(argument)) usage13("Repeated option.");
|
|
9686
9955
|
seen.add(argument);
|
|
9687
9956
|
const value2 = args[++index];
|
|
9688
|
-
if (value2 === void 0)
|
|
9957
|
+
if (value2 === void 0) usage13("Transition option requires a value.");
|
|
9689
9958
|
let parsed = value2;
|
|
9690
9959
|
if (argument === "--duration" || argument === "--advance-after") {
|
|
9691
9960
|
if (argument === "--advance-after" && value2 === "null") parsed = null;
|
|
9692
9961
|
else {
|
|
9693
|
-
if (!value2.length || [...value2].some((character) => character < "0" || character > "9"))
|
|
9962
|
+
if (!value2.length || [...value2].some((character) => character < "0" || character > "9")) usage13("Timing requires integer milliseconds.");
|
|
9694
9963
|
parsed = Number(value2);
|
|
9695
9964
|
}
|
|
9696
9965
|
}
|
|
9697
9966
|
if (argument === "--advance-on-click") {
|
|
9698
|
-
if (value2 !== "true" && value2 !== "false")
|
|
9967
|
+
if (value2 !== "true" && value2 !== "false") usage13("Advance on click requires true or false.");
|
|
9699
9968
|
parsed = value2 === "true";
|
|
9700
9969
|
}
|
|
9701
9970
|
const key = argument === "--advance-after" ? "advanceAfter" : argument === "--advance-on-click" ? "advanceOnClick" : argument.slice(2);
|
|
9702
9971
|
result.transitionEdit = { ...result.transitionEdit, [key]: parsed };
|
|
9703
9972
|
continue;
|
|
9704
9973
|
}
|
|
9705
|
-
if (seen.has(argument) && argument !== "--limit")
|
|
9974
|
+
if (seen.has(argument) && argument !== "--limit") usage13("Repeated option.");
|
|
9706
9975
|
seen.add(argument);
|
|
9707
9976
|
if (argument === "--json") {
|
|
9708
9977
|
result.json = true;
|
|
@@ -9710,7 +9979,7 @@ function parse(raw, maximum, output3) {
|
|
|
9710
9979
|
}
|
|
9711
9980
|
if (argument === "--unique") {
|
|
9712
9981
|
if (!["images.list", "images.extract"].includes(operation))
|
|
9713
|
-
|
|
9982
|
+
usage13("Unique requires images list or extract.");
|
|
9714
9983
|
result.unique = true;
|
|
9715
9984
|
continue;
|
|
9716
9985
|
}
|
|
@@ -9723,7 +9992,7 @@ function parse(raw, maximum, output3) {
|
|
|
9723
9992
|
continue;
|
|
9724
9993
|
}
|
|
9725
9994
|
if (argument === "--shared") {
|
|
9726
|
-
if (operation !== "images.replace")
|
|
9995
|
+
if (operation !== "images.replace") usage13("Shared requires images replace.");
|
|
9727
9996
|
result.imageReplace = { ...result.imageReplace, shared: true };
|
|
9728
9997
|
continue;
|
|
9729
9998
|
}
|
|
@@ -9740,12 +10009,12 @@ function parse(raw, maximum, output3) {
|
|
|
9740
10009
|
}
|
|
9741
10010
|
if (argument === "--allow-partial-output") {
|
|
9742
10011
|
if (!["extract", "slides.split", "images.extract", "media.extract", "objects.extract"].includes(operation))
|
|
9743
|
-
|
|
10012
|
+
usage13("Partial output requires a multi-file operation.");
|
|
9744
10013
|
result.allowPartialOutput = true;
|
|
9745
10014
|
continue;
|
|
9746
10015
|
}
|
|
9747
10016
|
if (argument === "--first") {
|
|
9748
|
-
if (operation !== "text.replace")
|
|
10017
|
+
if (operation !== "text.replace") usage13("First requires text replace.");
|
|
9749
10018
|
result.first = true;
|
|
9750
10019
|
continue;
|
|
9751
10020
|
}
|
|
@@ -9753,7 +10022,7 @@ function parse(raw, maximum, output3) {
|
|
|
9753
10022
|
result.all = true;
|
|
9754
10023
|
continue;
|
|
9755
10024
|
}
|
|
9756
|
-
if (!scalarOptions.includes(argument))
|
|
10025
|
+
if (!scalarOptions.includes(argument)) usage13("Unsupported option.");
|
|
9757
10026
|
const booleanValueOptions = [
|
|
9758
10027
|
"--preserve-geometry",
|
|
9759
10028
|
"--preserve-crop",
|
|
@@ -9778,9 +10047,9 @@ function parse(raw, maximum, output3) {
|
|
|
9778
10047
|
"--matching-name",
|
|
9779
10048
|
"--with"
|
|
9780
10049
|
].includes(argument))
|
|
9781
|
-
|
|
10050
|
+
usage13("Missing option value.");
|
|
9782
10051
|
if (["--data-json", "--data-file"].includes(argument)) {
|
|
9783
|
-
if (operation !== "template.apply")
|
|
10052
|
+
if (operation !== "template.apply") usage13("Binding sources require template apply.");
|
|
9784
10053
|
if (argument === "--data-file") result.dataFile = value;
|
|
9785
10054
|
else {
|
|
9786
10055
|
const bindings = commandJson(value);
|
|
@@ -9791,7 +10060,7 @@ function parse(raw, maximum, output3) {
|
|
|
9791
10060
|
}
|
|
9792
10061
|
if (operation === "objects.add" && ["--icon", "--icon-content-type", "--program", "--program-id", "--name", "--left", "--top", "--width", "--height", "--icon-width", "--icon-height"].includes(argument)) {
|
|
9793
10062
|
if (argument === "--program") {
|
|
9794
|
-
if (!Object.hasOwn(PROG_ID, value))
|
|
10063
|
+
if (!Object.hasOwn(PROG_ID, value)) usage13("Unknown registered program.");
|
|
9795
10064
|
result.objectAdd = { ...result.objectAdd, progId: PROG_ID[value] };
|
|
9796
10065
|
} else if (argument === "--icon") result.icon = value;
|
|
9797
10066
|
else if (argument === "--icon-content-type") result.iconContentType = value;
|
|
@@ -9807,10 +10076,10 @@ function parse(raw, maximum, output3) {
|
|
|
9807
10076
|
else if (argument === "--poster-content-type") result.posterContentType = value;
|
|
9808
10077
|
else {
|
|
9809
10078
|
const key = argument === "--mime-type" ? "contentType" : argument.slice(2).split("-").map((part, i) => i ? part[0].toUpperCase() + part.slice(1) : part).join("");
|
|
9810
|
-
if (key === "kind" && !["audio", "video"].includes(value))
|
|
9811
|
-
if (key === "loop" && !["true", "false"].includes(value))
|
|
10079
|
+
if (key === "kind" && !["audio", "video"].includes(value)) usage13("Media kind requires audio or video.");
|
|
10080
|
+
if (key === "loop" && !["true", "false"].includes(value)) usage13("Loop requires true or false.");
|
|
9812
10081
|
const parsed = ["left", "top", "width", "height"].includes(key) ? commandLength(value, ["width", "height"].includes(key) ? 1 : -27273042316900) : key === "loop" ? value === "true" : ["trimStart", "trimEnd", "volume"].includes(key) ? Number(value) : value;
|
|
9813
|
-
if (typeof parsed === "number" && !Number.isFinite(parsed))
|
|
10082
|
+
if (typeof parsed === "number" && !Number.isFinite(parsed)) usage13("Media values must be finite.");
|
|
9814
10083
|
result.mediaEdit = { ...result.mediaEdit, [key]: parsed };
|
|
9815
10084
|
}
|
|
9816
10085
|
continue;
|
|
@@ -9819,13 +10088,13 @@ function parse(raw, maximum, output3) {
|
|
|
9819
10088
|
const key = argument.slice(2).split("-").map((part, i) => i ? part[0].toUpperCase() + part.slice(1) : part).join("");
|
|
9820
10089
|
let parsed = value;
|
|
9821
10090
|
if (key === "flipHorizontal" || key === "flipVertical") {
|
|
9822
|
-
if (value !== "true" && value !== "false")
|
|
10091
|
+
if (value !== "true" && value !== "false") usage13("Picture flips require true or false.");
|
|
9823
10092
|
parsed = value === "true";
|
|
9824
10093
|
} else if (key === "borderWidth") parsed = commandLength(value, 0);
|
|
9825
10094
|
else if (key !== "borderColor" && key !== "altText") {
|
|
9826
10095
|
parsed = Number(value);
|
|
9827
10096
|
if (!value.trim() || !Number.isFinite(parsed))
|
|
9828
|
-
|
|
10097
|
+
usage13("Picture values must be finite numbers.");
|
|
9829
10098
|
}
|
|
9830
10099
|
result.imageSet = { ...result.imageSet, [key]: parsed };
|
|
9831
10100
|
continue;
|
|
@@ -9839,9 +10108,9 @@ function parse(raw, maximum, output3) {
|
|
|
9839
10108
|
].includes(argument)) {
|
|
9840
10109
|
const key = argument.slice(2).split("-").map((part, i) => i ? part[0].toUpperCase() + part.slice(1) : part).join("");
|
|
9841
10110
|
if (key === "contentType" && !["image/png", "image/jpeg", "image/gif", "image/bmp", "image/tiff", "image/x-wmf"].includes(value))
|
|
9842
|
-
|
|
10111
|
+
usage13("Unsupported image content type.");
|
|
9843
10112
|
if (argument.startsWith("--preserve-") && value !== "true" && value !== "false")
|
|
9844
|
-
|
|
10113
|
+
usage13("Image preservation requires true or false.");
|
|
9845
10114
|
result.imageReplace = {
|
|
9846
10115
|
...result.imageReplace,
|
|
9847
10116
|
[key]: argument.startsWith("--preserve-") ? value === "true" : value
|
|
@@ -9853,18 +10122,18 @@ function parse(raw, maximum, output3) {
|
|
|
9853
10122
|
)) {
|
|
9854
10123
|
const key = argument === "--content-type" ? "contentType" : argument === "--alt-text" ? "altText" : argument.slice(2);
|
|
9855
10124
|
if (key === "fit" && !["contain", "cover", "stretch"].includes(value))
|
|
9856
|
-
|
|
10125
|
+
usage13("Invalid image fit.");
|
|
9857
10126
|
if (key === "contentType" && !["image/png", "image/jpeg", "image/gif", "image/bmp", "image/tiff", "image/x-wmf"].includes(value))
|
|
9858
|
-
|
|
10127
|
+
usage13("Unsupported image content type.");
|
|
9859
10128
|
const parsed = ["left", "top", "width", "height"].includes(key) ? commandLength(value, key === "left" || key === "top" ? -27273042316900 : 1) : value;
|
|
9860
10129
|
result.imageAdd = { ...result.imageAdd, [key]: parsed };
|
|
9861
10130
|
continue;
|
|
9862
10131
|
}
|
|
9863
10132
|
if (argument === "--image") {
|
|
9864
10133
|
if (operation !== "images.list" && operation !== "images.extract" && operation !== "images.replace" && operation !== "images.set")
|
|
9865
|
-
|
|
10134
|
+
usage13("Image selection requires images list, extract, replace or set.");
|
|
9866
10135
|
if (!value.length || [...value].some((c) => c < "0" || c > "9") || !Number.isSafeInteger(Number(value)) || Number(value) < 1)
|
|
9867
|
-
|
|
10136
|
+
usage13("Image positions require positive integers.");
|
|
9868
10137
|
result.image = Number(value);
|
|
9869
10138
|
continue;
|
|
9870
10139
|
}
|
|
@@ -9875,17 +10144,17 @@ function parse(raw, maximum, output3) {
|
|
|
9875
10144
|
try {
|
|
9876
10145
|
parsed = admitFontMetrics(JSON.parse(value));
|
|
9877
10146
|
} catch (error) {
|
|
9878
|
-
if (error instanceof
|
|
9879
|
-
|
|
10147
|
+
if (error instanceof OfficeError19) throw error;
|
|
10148
|
+
usage13("Metrics require a valid JSON metric object.");
|
|
9880
10149
|
}
|
|
9881
10150
|
} else if (["bold", "italic", "wrap"].includes(key)) {
|
|
9882
|
-
if (!["true", "false"].includes(value))
|
|
10151
|
+
if (!["true", "false"].includes(value)) usage13("Text fit switches require true or false.");
|
|
9883
10152
|
parsed = value === "true";
|
|
9884
10153
|
} else if (key.startsWith("margin")) parsed = commandLength(value) / 12700;
|
|
9885
10154
|
else if (key !== "fontFamily") {
|
|
9886
10155
|
const pieces = value.split(".");
|
|
9887
10156
|
if (pieces.length > 2 || pieces.some((p) => !p || [...p].some((c) => c < "0" || c > "9")))
|
|
9888
|
-
|
|
10157
|
+
usage13("Text fit sizes and spacing require decimal numbers.");
|
|
9889
10158
|
parsed = Number(value);
|
|
9890
10159
|
}
|
|
9891
10160
|
result.fitEdit = { ...result.fitEdit, [key]: parsed };
|
|
@@ -9897,13 +10166,13 @@ function parse(raw, maximum, output3) {
|
|
|
9897
10166
|
if (value === "null" && key !== "text") parsed = null;
|
|
9898
10167
|
else if (key.startsWith("margin")) parsed = commandLength(value, -2147483648) / 12700;
|
|
9899
10168
|
else if (key === "wrap") {
|
|
9900
|
-
if (!["true", "false"].includes(value))
|
|
10169
|
+
if (!["true", "false"].includes(value)) usage13("Wrap requires true, false or null.");
|
|
9901
10170
|
parsed = value === "true";
|
|
9902
10171
|
} else if (key === "columns" || key === "rotation") {
|
|
9903
10172
|
const digits = key === "rotation" && value.startsWith("-") ? value.slice(1) : value;
|
|
9904
10173
|
const pieces = digits.split(".");
|
|
9905
10174
|
if (pieces.length > (key === "columns" ? 1 : 2) || pieces.some((piece) => !piece || [...piece].some((c) => c < "0" || c > "9")) || !Number.isFinite(Number(value)))
|
|
9906
|
-
|
|
10175
|
+
usage13("Columns require an integer; rotation requires finite decimal degrees.");
|
|
9907
10176
|
parsed = Number(value);
|
|
9908
10177
|
}
|
|
9909
10178
|
result.frameEdit = { ...result.frameEdit, [key]: parsed };
|
|
@@ -9913,12 +10182,12 @@ function parse(raw, maximum, output3) {
|
|
|
9913
10182
|
let key = argument.slice(2).split("-").map((part, index2) => index2 ? part[0].toUpperCase() + part.slice(1) : part).join("");
|
|
9914
10183
|
let parsed = value;
|
|
9915
10184
|
if (key === "direction") {
|
|
9916
|
-
if (seen.has("--rtl"))
|
|
9917
|
-
if (!["ltr", "rtl", "null"].includes(value))
|
|
10185
|
+
if (seen.has("--rtl")) usage13("Direction and RTL cannot be combined.");
|
|
10186
|
+
if (!["ltr", "rtl", "null"].includes(value)) usage13("Direction requires ltr, rtl or null.");
|
|
9918
10187
|
key = "rtl";
|
|
9919
10188
|
parsed = value === "null" ? null : value === "rtl";
|
|
9920
10189
|
} else if (key === "numbering") {
|
|
9921
|
-
if (seen.has("--bullet"))
|
|
10190
|
+
if (seen.has("--bullet")) usage13("Bullet and numbering cannot be combined.");
|
|
9922
10191
|
const schemes = {
|
|
9923
10192
|
decimal: "arabicPeriod",
|
|
9924
10193
|
"lower-alpha": "alphaLcPeriod",
|
|
@@ -9927,7 +10196,7 @@ function parse(raw, maximum, output3) {
|
|
|
9927
10196
|
"upper-roman": "romanUcPeriod"
|
|
9928
10197
|
};
|
|
9929
10198
|
if (!Object.hasOwn(schemes, value) && !["none", "null"].includes(value))
|
|
9930
|
-
|
|
10199
|
+
usage13("Unsupported numbering style.");
|
|
9931
10200
|
key = "bullet";
|
|
9932
10201
|
parsed = value === "null" ? null : value === "none" ? { kind: "none" } : { kind: "numbered", scheme: schemes[value] };
|
|
9933
10202
|
} else if (value === "null" && key !== "paragraph") parsed = null;
|
|
@@ -9941,11 +10210,11 @@ function parse(raw, maximum, output3) {
|
|
|
9941
10210
|
].includes(key))
|
|
9942
10211
|
parsed = commandLength(value, key === "indent" ? -Number.MAX_SAFE_INTEGER : 0) / 12700;
|
|
9943
10212
|
else if (key === "rtl") {
|
|
9944
|
-
if (!["true", "false"].includes(value))
|
|
10213
|
+
if (!["true", "false"].includes(value)) usage13("RTL requires true, false or null.");
|
|
9945
10214
|
parsed = value === "true";
|
|
9946
10215
|
} else if (["paragraph", "level"].includes(key)) {
|
|
9947
10216
|
if (![...value].every((c) => c >= "0" && c <= "9") || !Number.isSafeInteger(Number(value)) || key === "paragraph" && Number(value) < 1)
|
|
9948
|
-
|
|
10217
|
+
usage13("Invalid paragraph position or level.");
|
|
9949
10218
|
parsed = Number(value) - (key === "paragraph" ? 1 : 0);
|
|
9950
10219
|
} else if (key === "lineSpacing") {
|
|
9951
10220
|
const pieces = value.split(".");
|
|
@@ -9957,7 +10226,7 @@ function parse(raw, maximum, output3) {
|
|
|
9957
10226
|
parsed = value.startsWith("{") ? commandJson(value) : { kind: "character", character: value };
|
|
9958
10227
|
else if (key === "tabs") {
|
|
9959
10228
|
const tabs = commandJson(value);
|
|
9960
|
-
if (!Array.isArray(tabs))
|
|
10229
|
+
if (!Array.isArray(tabs)) usage13("Tabs require an array or null.");
|
|
9961
10230
|
parsed = tabs.map((tab) => {
|
|
9962
10231
|
if (tab && typeof tab === "object" && "unit" in tab) {
|
|
9963
10232
|
const record3 = tab;
|
|
@@ -9970,7 +10239,7 @@ function parse(raw, maximum, output3) {
|
|
|
9970
10239
|
const aligned = tab;
|
|
9971
10240
|
const length4 = tab.position;
|
|
9972
10241
|
if (Object.keys(aligned).some((key2) => !["position", "alignment"].includes(key2)))
|
|
9973
|
-
|
|
10242
|
+
usage13("Tabs require finite explicit lengths.");
|
|
9974
10243
|
return {
|
|
9975
10244
|
position: paragraphTabLength(length4),
|
|
9976
10245
|
alignment: aligned.alignment
|
|
@@ -9980,9 +10249,9 @@ function parse(raw, maximum, output3) {
|
|
|
9980
10249
|
});
|
|
9981
10250
|
}
|
|
9982
10251
|
if (argument === "--rtl" && seen.has("--direction"))
|
|
9983
|
-
|
|
10252
|
+
usage13("Direction and RTL cannot be combined.");
|
|
9984
10253
|
if (argument === "--bullet" && seen.has("--numbering"))
|
|
9985
|
-
|
|
10254
|
+
usage13("Bullet and numbering cannot be combined.");
|
|
9986
10255
|
result.paragraphEdit = { ...result.paragraphEdit, [key]: parsed };
|
|
9987
10256
|
continue;
|
|
9988
10257
|
}
|
|
@@ -9993,20 +10262,20 @@ function parse(raw, maximum, output3) {
|
|
|
9993
10262
|
else if (["complexScriptCharset", "complexScriptPitchFamily"].includes(key)) {
|
|
9994
10263
|
const digits = value.startsWith("-") ? value.slice(1) : value;
|
|
9995
10264
|
if (!digits || [...digits].some((c) => c < "0" || c > "9") || !Number.isSafeInteger(Number(value)))
|
|
9996
|
-
|
|
10265
|
+
usage13("Font classification requires an integer or null.");
|
|
9997
10266
|
parsed = Number(value);
|
|
9998
10267
|
} else if (["size", "spacing"].includes(key))
|
|
9999
10268
|
parsed = commandLength(value, key === "spacing" ? -Number.MAX_SAFE_INTEGER : 1) / 12700;
|
|
10000
10269
|
else if (["bold", "italic", "rtl"].includes(key)) {
|
|
10001
|
-
if (!["true", "false"].includes(value))
|
|
10270
|
+
if (!["true", "false"].includes(value)) usage13("Emphasis requires true, false or null.");
|
|
10002
10271
|
parsed = value === "true";
|
|
10003
10272
|
} else if (["paragraph", "run"].includes(key)) {
|
|
10004
10273
|
if (![...value].every((c) => c >= "0" && c <= "9") || !Number.isSafeInteger(Number(value)) || Number(value) < 1)
|
|
10005
|
-
|
|
10274
|
+
usage13("Text positions require positive one-based integers.");
|
|
10006
10275
|
parsed = Number(value) - 1;
|
|
10007
10276
|
} else if (key === "baseline") {
|
|
10008
10277
|
if (!value.trim() || !Number.isFinite(Number(value)))
|
|
10009
|
-
|
|
10278
|
+
usage13("Baseline requires a finite percentage.");
|
|
10010
10279
|
parsed = Number(value);
|
|
10011
10280
|
} else if (["color", "highlight"].includes(key) && value.startsWith("{"))
|
|
10012
10281
|
parsed = commandJson(value);
|
|
@@ -10017,20 +10286,20 @@ function parse(raw, maximum, output3) {
|
|
|
10017
10286
|
continue;
|
|
10018
10287
|
}
|
|
10019
10288
|
if (argument === "--style-json") {
|
|
10020
|
-
if (operation !== "text.replace")
|
|
10289
|
+
if (operation !== "text.replace") usage13("Style override requires text replace.");
|
|
10021
10290
|
const style = commandJson(value);
|
|
10022
10291
|
if (!style || typeof style !== "object" || Array.isArray(style) || Object.keys(style).length === 0 || Object.entries(style).some(
|
|
10023
10292
|
([key, field]) => !["bold", "italic"].includes(key) || typeof field !== "boolean"
|
|
10024
10293
|
))
|
|
10025
|
-
|
|
10294
|
+
usage13("Style requires explicit bold or italic boolean values.");
|
|
10026
10295
|
result.style = style;
|
|
10027
10296
|
continue;
|
|
10028
10297
|
}
|
|
10029
10298
|
if (["--find", "--with", "--occurrence"].includes(argument)) {
|
|
10030
|
-
if (operation !== "text.replace")
|
|
10299
|
+
if (operation !== "text.replace") usage13("Match options require text replace.");
|
|
10031
10300
|
if (argument === "--occurrence") {
|
|
10032
10301
|
if (![...value].every((c) => c >= "0" && c <= "9") || !Number.isSafeInteger(Number(value)) || Number(value) < 1)
|
|
10033
|
-
|
|
10302
|
+
usage13("Occurrence must be a positive integer.");
|
|
10034
10303
|
result.occurrence = Number(value);
|
|
10035
10304
|
} else if (argument === "--find") result.find = value;
|
|
10036
10305
|
else result.with = value;
|
|
@@ -10047,7 +10316,7 @@ function parse(raw, maximum, output3) {
|
|
|
10047
10316
|
].includes(argument)) {
|
|
10048
10317
|
const key = argument === "--placeholder-policy" ? "placeholderPolicy" : argument === "--show-master-shapes" ? "showMasterShapes" : argument === "--matching-name" ? "matchingName" : argument === "--placeholders-json" ? "placeholders" : argument.slice(2);
|
|
10049
10318
|
if (["preserve", "showMasterShapes"].includes(key) && !["true", "false"].includes(value))
|
|
10050
|
-
|
|
10319
|
+
usage13("Expected true or false.");
|
|
10051
10320
|
result.layoutEdit = {
|
|
10052
10321
|
...result.layoutEdit,
|
|
10053
10322
|
[key]: key === "placeholders" ? commandJson(value) : ["preserve", "showMasterShapes"].includes(key) ? value === "true" : value
|
|
@@ -10086,18 +10355,18 @@ function parse(raw, maximum, output3) {
|
|
|
10086
10355
|
}
|
|
10087
10356
|
if (operation === "shapes.drawing.set" && ["--fill", "--line", "--shadow-inherit"].includes(argument)) {
|
|
10088
10357
|
if (argument === "--shadow-inherit" && !["true", "false"].includes(value))
|
|
10089
|
-
|
|
10358
|
+
usage13("Shadow inheritance requires true or false.");
|
|
10090
10359
|
const key = argument === "--shadow-inherit" ? "shadowInherit" : argument.slice(2);
|
|
10091
10360
|
result.drawingEdit = { ...result.drawingEdit, [key]: commandJson(value) };
|
|
10092
10361
|
continue;
|
|
10093
10362
|
}
|
|
10094
10363
|
if (operation === "shapes.effects.set" && ["--shadow", "--opacity", "--shadow-blur", "--shadow-color"].includes(argument)) {
|
|
10095
10364
|
if (argument === "--shadow") {
|
|
10096
|
-
if (!["true", "false"].includes(value))
|
|
10365
|
+
if (!["true", "false"].includes(value)) usage13("Shadow requires true or false.");
|
|
10097
10366
|
result.shadowEnabled = value === "true";
|
|
10098
10367
|
} else if (argument === "--opacity") {
|
|
10099
10368
|
if (!value.trim() || !Number.isFinite(Number(value)) || Number(value) < 0 || Number(value) > 1)
|
|
10100
|
-
|
|
10369
|
+
usage13("Opacity requires a ratio from zero to one.");
|
|
10101
10370
|
result.shadowOpacity = Number(value);
|
|
10102
10371
|
} else if (argument === "--shadow-blur")
|
|
10103
10372
|
result.shadowBlur = { value: commandLength(value, 0), unit: "emu" };
|
|
@@ -10106,7 +10375,7 @@ function parse(raw, maximum, output3) {
|
|
|
10106
10375
|
continue;
|
|
10107
10376
|
}
|
|
10108
10377
|
if (operation.startsWith("shapes.paths.") && argument === "--close") {
|
|
10109
|
-
if (!["true", "false"].includes(value))
|
|
10378
|
+
if (!["true", "false"].includes(value)) usage13("Close requires true or false.");
|
|
10110
10379
|
result.close = value === "true";
|
|
10111
10380
|
continue;
|
|
10112
10381
|
}
|
|
@@ -10144,18 +10413,18 @@ function parse(raw, maximum, output3) {
|
|
|
10144
10413
|
value,
|
|
10145
10414
|
["left", "top"].includes(key) ? -27273042316900 : key === "lineWidth" ? 0 : 1
|
|
10146
10415
|
);
|
|
10147
|
-
if (Math.abs(length4) > 27273042316900)
|
|
10416
|
+
if (Math.abs(length4) > 27273042316900) usage13("Shape geometry exceeds DrawingML bounds.");
|
|
10148
10417
|
parsed = { value: length4, unit: "emu" };
|
|
10149
10418
|
} else if (key === "flipHorizontal" || key === "flipVertical") {
|
|
10150
|
-
if (!["true", "false"].includes(value))
|
|
10419
|
+
if (!["true", "false"].includes(value)) usage13("Flips require true or false.");
|
|
10151
10420
|
parsed = value === "true";
|
|
10152
10421
|
} else if (key === "locked") {
|
|
10153
10422
|
if (!["true", "false", "null"].includes(value))
|
|
10154
|
-
|
|
10423
|
+
usage13("Locked requires true, false or null.");
|
|
10155
10424
|
parsed = value === "null" ? null : value === "true";
|
|
10156
10425
|
} else if (key === "rotation") {
|
|
10157
10426
|
if (!value.trim() || !Number.isFinite(Number(value)))
|
|
10158
|
-
|
|
10427
|
+
usage13("Rotation requires finite degrees.");
|
|
10159
10428
|
parsed = Number(value);
|
|
10160
10429
|
} else if (key === "kind" && value.length && [...value].every((c) => c >= "0" && c <= "9"))
|
|
10161
10430
|
parsed = Number(value);
|
|
@@ -10193,7 +10462,7 @@ function parse(raw, maximum, output3) {
|
|
|
10193
10462
|
"--loop",
|
|
10194
10463
|
"--show-type"
|
|
10195
10464
|
].includes(argument) || operation === "settings.set" && ["--width", "--height"].includes(argument)) {
|
|
10196
|
-
if (operation !== "settings.set")
|
|
10465
|
+
if (operation !== "settings.set") usage13("Settings options require settings set.");
|
|
10197
10466
|
if (["--width", "--height", "--notes-width", "--notes-height"].includes(argument)) {
|
|
10198
10467
|
const key = argument === "--notes-width" ? "notesWidth" : argument === "--notes-height" ? "notesHeight" : argument.slice(2);
|
|
10199
10468
|
result.settings = {
|
|
@@ -10202,7 +10471,7 @@ function parse(raw, maximum, output3) {
|
|
|
10202
10471
|
};
|
|
10203
10472
|
} else if (argument === "--orientation" || argument === "--notes-orientation") {
|
|
10204
10473
|
if (value !== "portrait" && value !== "landscape")
|
|
10205
|
-
|
|
10474
|
+
usage13("Orientation requires portrait or landscape.");
|
|
10206
10475
|
result.settings = {
|
|
10207
10476
|
...result.settings,
|
|
10208
10477
|
[argument === "--orientation" ? "orientation" : "notesOrientation"]: value
|
|
@@ -10210,17 +10479,17 @@ function parse(raw, maximum, output3) {
|
|
|
10210
10479
|
} else if (argument === "--slide-number-start") {
|
|
10211
10480
|
const digits = value.startsWith("-") ? value.slice(1) : value;
|
|
10212
10481
|
if (!digits.length || ![...digits].every((c) => c >= "0" && c <= "9") || !Number.isSafeInteger(Number(value)))
|
|
10213
|
-
|
|
10482
|
+
usage13("Slide-number start requires a safe integer.");
|
|
10214
10483
|
result.settings = { ...result.settings, slideNumberStart: Number(value) };
|
|
10215
10484
|
} else if (argument === "--loop" || argument === "--scale-content") {
|
|
10216
|
-
if (value !== "true" && value !== "false")
|
|
10485
|
+
if (value !== "true" && value !== "false") usage13("Boolean settings require true or false.");
|
|
10217
10486
|
result.settings = {
|
|
10218
10487
|
...result.settings,
|
|
10219
10488
|
[argument === "--loop" ? "loop" : "scaleContent"]: value === "true"
|
|
10220
10489
|
};
|
|
10221
10490
|
} else {
|
|
10222
10491
|
if (value !== "speaker" && value !== "window" && value !== "kiosk")
|
|
10223
|
-
|
|
10492
|
+
usage13("Unknown show type.");
|
|
10224
10493
|
result.settings = { ...result.settings, showType: value };
|
|
10225
10494
|
}
|
|
10226
10495
|
continue;
|
|
@@ -10230,24 +10499,24 @@ function parse(raw, maximum, output3) {
|
|
|
10230
10499
|
else if (argument === "--slides") {
|
|
10231
10500
|
const slides = commandJson(value);
|
|
10232
10501
|
if (!Array.isArray(slides) || !slides.length || slides.some((item) => !Number.isSafeInteger(item) || item < 1) || new Set(slides).size !== slides.length)
|
|
10233
|
-
|
|
10502
|
+
usage13("Members require a nonempty array of unique one-based slide positions.");
|
|
10234
10503
|
result.membership = { ...result.membership, slides };
|
|
10235
10504
|
} else {
|
|
10236
10505
|
if (![...value].every((c) => c >= "0" && c <= "9") || !Number.isSafeInteger(Number(value)) || Number(value) < 1)
|
|
10237
|
-
|
|
10506
|
+
usage13("Section positions must be positive integers.");
|
|
10238
10507
|
result.membership = { ...result.membership, position: Number(value) };
|
|
10239
10508
|
}
|
|
10240
10509
|
continue;
|
|
10241
10510
|
}
|
|
10242
10511
|
if (argument === "--sources") {
|
|
10243
|
-
if (operation !== "slides.merge")
|
|
10512
|
+
if (operation !== "slides.merge") usage13("Sources require slides merge.");
|
|
10244
10513
|
const sources = commandJson(value);
|
|
10245
10514
|
if (!Array.isArray(sources) || !sources.length || sources.some(
|
|
10246
10515
|
(source3) => !source3 || typeof source3 !== "object" || Array.isArray(source3) || Object.keys(source3).length !== 1 || typeof source3.vfsPath !== "string" || !source3.vfsPath.length
|
|
10247
10516
|
))
|
|
10248
|
-
|
|
10517
|
+
usage13("Sources require a nonempty ordered array of scoped vfsPath inputs.");
|
|
10249
10518
|
const paths = sources.map((source3) => source3.vfsPath);
|
|
10250
|
-
if (new Set(paths).size !== paths.length)
|
|
10519
|
+
if (new Set(paths).size !== paths.length) usage13("Source inputs must be unique.");
|
|
10251
10520
|
result.sources = paths;
|
|
10252
10521
|
continue;
|
|
10253
10522
|
}
|
|
@@ -10255,57 +10524,57 @@ function parse(raw, maximum, output3) {
|
|
|
10255
10524
|
if (argument === "--manifest") result.manifest = value;
|
|
10256
10525
|
else {
|
|
10257
10526
|
const parts = commandJson(value);
|
|
10258
|
-
if (!Array.isArray(parts) || parts.some((part) => typeof part !== "string"))
|
|
10527
|
+
if (!Array.isArray(parts) || parts.some((part) => typeof part !== "string")) usage13("Parts require a string array.");
|
|
10259
10528
|
result.parts = parts;
|
|
10260
10529
|
}
|
|
10261
10530
|
continue;
|
|
10262
10531
|
}
|
|
10263
10532
|
if (argument === "--sha256") {
|
|
10264
10533
|
if (operation !== "images.extract" || value.length !== 64 || !Array.from(value).every((character) => "0123456789abcdef".includes(character)))
|
|
10265
|
-
|
|
10534
|
+
usage13("Image extraction requires a lowercase SHA256 hash.");
|
|
10266
10535
|
result.imageSha256 = value;
|
|
10267
10536
|
continue;
|
|
10268
10537
|
}
|
|
10269
10538
|
if (argument === "--output-dir" || argument === "--slides") {
|
|
10270
10539
|
if (operation !== "slides.split" && !(["extract", "images.extract", "media.extract", "objects.extract"].includes(operation) && argument === "--output-dir"))
|
|
10271
|
-
|
|
10540
|
+
usage13("Option requires a multi-file operation.");
|
|
10272
10541
|
if (argument === "--output-dir") result.outputDir = value;
|
|
10273
10542
|
else {
|
|
10274
10543
|
const positions = commandJson(value);
|
|
10275
10544
|
if (!Array.isArray(positions) || !positions.length || positions.some((position) => !Number.isSafeInteger(position) || position < 1) || new Set(positions).size !== positions.length)
|
|
10276
|
-
|
|
10545
|
+
usage13("Slides require a nonempty array of unique one-based positions.");
|
|
10277
10546
|
result.splitSlides = positions;
|
|
10278
10547
|
}
|
|
10279
10548
|
continue;
|
|
10280
10549
|
}
|
|
10281
10550
|
if (argument === "--reference-policy") {
|
|
10282
10551
|
if (operation !== "slides.remove" || value !== "remove")
|
|
10283
|
-
|
|
10552
|
+
usage13("Slide removal reference policy must be remove.");
|
|
10284
10553
|
result.referencePolicy = value;
|
|
10285
10554
|
continue;
|
|
10286
10555
|
}
|
|
10287
10556
|
if (argument === "--media-policy") {
|
|
10288
10557
|
if (operation !== "slides.duplicate" || !["shared-media", "isolated-instance"].includes(value))
|
|
10289
|
-
|
|
10558
|
+
usage13("Slide duplication media policy must be shared-media or isolated-instance.");
|
|
10290
10559
|
result.copyMediaPolicy = value;
|
|
10291
10560
|
continue;
|
|
10292
10561
|
}
|
|
10293
10562
|
if (["--source", "--source-slides", "--theme-policy", "--dimension-policy"].includes(argument)) {
|
|
10294
10563
|
if (operation !== "slides.import" && operation !== "slides.merge")
|
|
10295
|
-
|
|
10564
|
+
usage13("Option requires slides import or merge.");
|
|
10296
10565
|
if (operation === "slides.merge" && argument === "--source")
|
|
10297
|
-
|
|
10566
|
+
usage13("Merge requires --sources.");
|
|
10298
10567
|
if (argument === "--source") result.source = value;
|
|
10299
10568
|
else if (argument === "--source-slides") {
|
|
10300
10569
|
const positions = commandJson(value);
|
|
10301
10570
|
if (!Array.isArray(positions) || !positions.length || positions.some((position) => !Number.isSafeInteger(position) || position < 1) || new Set(positions).size !== positions.length)
|
|
10302
|
-
|
|
10571
|
+
usage13("Source slides require a nonempty array of unique one-based positions.");
|
|
10303
10572
|
result.importing = { ...result.importing, sourceSlides: positions };
|
|
10304
10573
|
} else if (argument === "--theme-policy") {
|
|
10305
|
-
if (value !== "source" && value !== "destination")
|
|
10574
|
+
if (value !== "source" && value !== "destination") usage13("Unknown theme policy.");
|
|
10306
10575
|
result.importing = { ...result.importing, themePolicy: value };
|
|
10307
10576
|
} else {
|
|
10308
|
-
if (value !== "reject" && value !== "destination")
|
|
10577
|
+
if (value !== "reject" && value !== "destination") usage13("Unknown dimension policy.");
|
|
10309
10578
|
result.importing = { ...result.importing, dimensionPolicy: value };
|
|
10310
10579
|
}
|
|
10311
10580
|
continue;
|
|
@@ -10323,7 +10592,7 @@ function parse(raw, maximum, output3) {
|
|
|
10323
10592
|
if (operation === "slides.import" || operation === "slides.duplicate" || operation === "slides.move" || operation === "slides.set") {
|
|
10324
10593
|
if (argument === "--position") {
|
|
10325
10594
|
if (![...value].every((character) => character >= "0" && character <= "9") || !Number.isSafeInteger(Number(value)) || Number(value) < 1)
|
|
10326
|
-
|
|
10595
|
+
usage13("Slide positions must be positive one-based integers.");
|
|
10327
10596
|
if (operation === "slides.import")
|
|
10328
10597
|
result.importing = { ...result.importing, position: Number(value) };
|
|
10329
10598
|
else result.mutation = { ...result.mutation, position: Number(value) };
|
|
@@ -10331,30 +10600,30 @@ function parse(raw, maximum, output3) {
|
|
|
10331
10600
|
result.mutation = { ...result.mutation, name: value };
|
|
10332
10601
|
else if (operation === "slides.set" && argument === "--hidden") {
|
|
10333
10602
|
if (value !== "true" && value !== "false")
|
|
10334
|
-
|
|
10603
|
+
usage13("Slide boolean options require true or false.");
|
|
10335
10604
|
result.mutation = { ...result.mutation, hidden: value === "true" };
|
|
10336
|
-
} else
|
|
10605
|
+
} else usage13("Option is unavailable for this slide operation.");
|
|
10337
10606
|
continue;
|
|
10338
10607
|
}
|
|
10339
|
-
if (operation !== "slides.add")
|
|
10608
|
+
if (operation !== "slides.add") usage13("Slide addition options require slides add.");
|
|
10340
10609
|
result.addition ??= {};
|
|
10341
10610
|
if (argument === "--position") {
|
|
10342
10611
|
if (![...value].every((character) => character >= "0" && character <= "9") || !Number.isSafeInteger(Number(value)) || Number(value) < 1)
|
|
10343
|
-
|
|
10612
|
+
usage13("Insertion positions must be positive one-based integers.");
|
|
10344
10613
|
result.addition = { ...result.addition, position: Number(value) };
|
|
10345
10614
|
} else if (argument === "--hidden" || argument === "--follow-master-background") {
|
|
10346
10615
|
if (value !== "true" && value !== "false")
|
|
10347
|
-
|
|
10616
|
+
usage13("Slide boolean options require true or false.");
|
|
10348
10617
|
result.addition = {
|
|
10349
10618
|
...result.addition,
|
|
10350
10619
|
[argument === "--hidden" ? "hidden" : "followMasterBackground"]: value === "true"
|
|
10351
10620
|
};
|
|
10352
10621
|
} else if (argument === "--placeholders-json") {
|
|
10353
10622
|
const placeholders = commandJson(value);
|
|
10354
|
-
if (!Array.isArray(placeholders))
|
|
10623
|
+
if (!Array.isArray(placeholders)) usage13("Placeholders require an array.");
|
|
10355
10624
|
for (const binding of placeholders) {
|
|
10356
10625
|
if (!binding || typeof binding !== "object" || Array.isArray(binding) || Object.keys(binding).some((key) => !["type", "index", "text"].includes(key)) || typeof binding.type !== "string" || !binding.type.length || typeof binding.text !== "string" || Object.hasOwn(binding, "index") && (!Number.isSafeInteger(binding.index) || binding.index < 0 || binding.index > 4294967295))
|
|
10357
|
-
|
|
10626
|
+
usage13("Placeholder bindings require type, optional nonnegative index, and text.");
|
|
10358
10627
|
}
|
|
10359
10628
|
result.addition = { ...result.addition, placeholders };
|
|
10360
10629
|
} else result.addition = { ...result.addition, [argument.slice(2)]: value };
|
|
@@ -10371,16 +10640,16 @@ function parse(raw, maximum, output3) {
|
|
|
10371
10640
|
"--slides-json",
|
|
10372
10641
|
"--properties-json"
|
|
10373
10642
|
].includes(argument)) {
|
|
10374
|
-
if (operation !== "create" && operation !== "pack")
|
|
10643
|
+
if (operation !== "create" && operation !== "pack") usage13("Creation options require create or pack.");
|
|
10375
10644
|
result.creation ??= {};
|
|
10376
10645
|
if (argument === "--template") result.template = value;
|
|
10377
10646
|
else if (argument === "--width" || argument === "--height")
|
|
10378
10647
|
result.creation = { ...result.creation, [argument.slice(2)]: commandLength(value) };
|
|
10379
10648
|
else if (argument === "--kind") {
|
|
10380
|
-
if (!["pptx", "potx", "ppsx"].includes(value))
|
|
10649
|
+
if (!["pptx", "potx", "ppsx"].includes(value)) usage13("Unknown presentation kind.");
|
|
10381
10650
|
result.creation = { ...result.creation, kind: value };
|
|
10382
10651
|
} else if (argument === "--dialect") {
|
|
10383
|
-
if (!["strict", "transitional"].includes(value))
|
|
10652
|
+
if (!["strict", "transitional"].includes(value)) usage13("Unknown presentation dialect.");
|
|
10384
10653
|
result.creation = { ...result.creation, dialect: value };
|
|
10385
10654
|
} else if (argument === "--author") result.creation = { ...result.creation, author: value };
|
|
10386
10655
|
else if (argument === "--timestamp")
|
|
@@ -10388,7 +10657,7 @@ function parse(raw, maximum, output3) {
|
|
|
10388
10657
|
else if (argument === "--properties-json") {
|
|
10389
10658
|
const properties = commandJson(value);
|
|
10390
10659
|
if (!properties || typeof properties !== "object" || Array.isArray(properties))
|
|
10391
|
-
|
|
10660
|
+
usage13("Properties require an object.");
|
|
10392
10661
|
if (Object.keys(properties).some(
|
|
10393
10662
|
(key) => ![
|
|
10394
10663
|
"title",
|
|
@@ -10408,11 +10677,11 @@ function parse(raw, maximum, output3) {
|
|
|
10408
10677
|
"lastPrinted"
|
|
10409
10678
|
].includes(key)
|
|
10410
10679
|
))
|
|
10411
|
-
|
|
10680
|
+
usage13("Unknown creation property.");
|
|
10412
10681
|
for (const key of ["created", "modified", "lastPrinted"]) {
|
|
10413
10682
|
if (Object.hasOwn(properties, key)) {
|
|
10414
10683
|
const dates = properties;
|
|
10415
|
-
if (typeof dates[key] !== "string")
|
|
10684
|
+
if (typeof dates[key] !== "string") usage13("Property dates require UTC strings.");
|
|
10416
10685
|
dates[key] = commandTimestamp(dates[key]);
|
|
10417
10686
|
}
|
|
10418
10687
|
}
|
|
@@ -10434,36 +10703,36 @@ function parse(raw, maximum, output3) {
|
|
|
10434
10703
|
}
|
|
10435
10704
|
if (argument === "--selection-json") {
|
|
10436
10705
|
if (operation !== "slides.move" && operation !== "slides.set" && operation !== "slides.remove" && operation !== "slides.duplicate")
|
|
10437
|
-
|
|
10706
|
+
usage13("Selection JSON requires a supported slide mutation.");
|
|
10438
10707
|
const selection = commandJson(value);
|
|
10439
10708
|
if (!selection || typeof selection !== "object")
|
|
10440
|
-
|
|
10709
|
+
usage13("Selection JSON requires a query or nonempty query array.");
|
|
10441
10710
|
const queries = Array.isArray(selection) ? selection : [selection];
|
|
10442
|
-
if (!queries.length)
|
|
10711
|
+
if (!queries.length) usage13("Selection arrays must not be empty.");
|
|
10443
10712
|
for (const query of queries) {
|
|
10444
10713
|
if (!query || typeof query !== "object" || Array.isArray(query) || Object.keys(query).some(
|
|
10445
10714
|
(key) => !["kind", "scope", "owner", "position", "id", "name", "token", "all"].includes(key)
|
|
10446
10715
|
))
|
|
10447
|
-
|
|
10716
|
+
usage13("Invalid slide selection query.");
|
|
10448
10717
|
if (query.token !== void 0) {
|
|
10449
10718
|
if (typeof query.token !== "string" || Object.keys(query).some((key) => !["kind", "token"].includes(key)) || query.kind !== void 0 && query.kind !== "slide")
|
|
10450
|
-
|
|
10719
|
+
usage13("Invalid slide token query.");
|
|
10451
10720
|
decodeSelectionToken2(query.token);
|
|
10452
10721
|
continue;
|
|
10453
10722
|
}
|
|
10454
10723
|
if (query.kind !== "slide" || query.scope !== void 0 && query.scope !== "slides" || query.all !== void 0 && typeof query.all !== "boolean")
|
|
10455
|
-
|
|
10724
|
+
usage13("Selection queries must address slides.");
|
|
10456
10725
|
for (const key of ["id", "name", "owner"])
|
|
10457
10726
|
if (query[key] !== void 0 && (typeof query[key] !== "string" || key !== "name" && !query[key]))
|
|
10458
|
-
|
|
10727
|
+
usage13("Invalid slide selection value.");
|
|
10459
10728
|
if ([query.position, query.id, query.name].filter((item) => item !== void 0).length > 1)
|
|
10460
|
-
|
|
10729
|
+
usage13("Slide identity selectors cannot be combined.");
|
|
10461
10730
|
if (!query.all && query.position === void 0 && query.id === void 0 && query.name === void 0)
|
|
10462
|
-
|
|
10731
|
+
usage13("Slide selection requires an identity or all.");
|
|
10463
10732
|
if (query.position !== void 0) {
|
|
10464
10733
|
const position = query.position;
|
|
10465
10734
|
if (!position || typeof position !== "object" || Array.isArray(position) || Object.keys(position).some((key) => !["coordinateSystem", "value"].includes(key)) || !["one-based", "zero-based"].includes(position.coordinateSystem) || !Number.isSafeInteger(position.value) || position.value < (position.coordinateSystem === "one-based" ? 1 : 0))
|
|
10466
|
-
|
|
10735
|
+
usage13("Invalid slide selection coordinate.");
|
|
10467
10736
|
}
|
|
10468
10737
|
}
|
|
10469
10738
|
result.selection = selection;
|
|
@@ -10473,9 +10742,9 @@ function parse(raw, maximum, output3) {
|
|
|
10473
10742
|
const pieces = value.split("=");
|
|
10474
10743
|
const [name, digits] = pieces;
|
|
10475
10744
|
if (pieces.length !== 2 || !name || !digits || ![...digits].every((c) => c >= "0" && c <= "9") || !Number.isSafeInteger(Number(digits)) || Number(digits) < 1)
|
|
10476
|
-
|
|
10745
|
+
usage13("Limits require NAME=POSITIVE_INTEGER.");
|
|
10477
10746
|
result.limits ??= {};
|
|
10478
|
-
if (Object.hasOwn(result.limits, name))
|
|
10747
|
+
if (Object.hasOwn(result.limits, name)) usage13("Repeated limit name.");
|
|
10479
10748
|
if (![
|
|
10480
10749
|
"maxBytes",
|
|
10481
10750
|
"maxNodes",
|
|
@@ -10483,21 +10752,21 @@ function parse(raw, maximum, output3) {
|
|
|
10483
10752
|
"maxOutputBytes",
|
|
10484
10753
|
...["extract", "images.extract", "media.extract", "objects.extract"].includes(operation) ? ["maxOutputs"] : []
|
|
10485
10754
|
].includes(name))
|
|
10486
|
-
|
|
10755
|
+
usage13("Unknown limit name.");
|
|
10487
10756
|
result.limits[name] = Number(digits);
|
|
10488
10757
|
} else if (argument === "--placeholder") {
|
|
10489
|
-
if (!value.length || ![...value].every((c) => c >= "0" && c <= "9") || (!Number.isSafeInteger(Number(value)) || Number(value) > 4294967295))
|
|
10758
|
+
if (!value.length || ![...value].every((c) => c >= "0" && c <= "9") || (!Number.isSafeInteger(Number(value)) || Number(value) > 4294967295)) usage13("Placeholder idx must be a nonnegative integer.");
|
|
10490
10759
|
result.placeholder = Number(value);
|
|
10491
10760
|
} else if (argument === "--slide") {
|
|
10492
10761
|
if (![...value].every((character) => character >= "0" && character <= "9") || !Number.isSafeInteger(Number(value)) || Number(value) < 1)
|
|
10493
|
-
|
|
10762
|
+
usage13("Slide positions must be positive one-based integers.");
|
|
10494
10763
|
result.slide = Number(value);
|
|
10495
10764
|
} else if (argument === "--shape") result.shape = value;
|
|
10496
10765
|
else if (argument === "--part") {
|
|
10497
10766
|
if (operation === "objects.list" || operation === "fonts.list")
|
|
10498
|
-
|
|
10767
|
+
usage13("Part selection requires object extraction.");
|
|
10499
10768
|
try {
|
|
10500
|
-
result.part =
|
|
10769
|
+
result.part = partName4(value, false);
|
|
10501
10770
|
} catch {
|
|
10502
10771
|
throw new SelectionError8("invalid-selection");
|
|
10503
10772
|
}
|
|
@@ -10505,7 +10774,7 @@ function parse(raw, maximum, output3) {
|
|
|
10505
10774
|
else if (argument === "--file") result.file = value;
|
|
10506
10775
|
else if (argument === "--output") result.output = value;
|
|
10507
10776
|
else {
|
|
10508
|
-
if (!scopes2.includes(value))
|
|
10777
|
+
if (!scopes2.includes(value)) usage13("Unknown scope.");
|
|
10509
10778
|
result.scope = value;
|
|
10510
10779
|
}
|
|
10511
10780
|
}
|
|
@@ -10529,42 +10798,42 @@ function parse(raw, maximum, output3) {
|
|
|
10529
10798
|
"--dry-run"
|
|
10530
10799
|
];
|
|
10531
10800
|
if ([...seen].some((option) => !allowed.includes(option)))
|
|
10532
|
-
|
|
10533
|
-
if (positionals.length !== 1 || !positionals[0])
|
|
10534
|
-
if (!result.imageSet)
|
|
10801
|
+
usage13("Option does not apply to images set.");
|
|
10802
|
+
if (positionals.length !== 1 || !positionals[0]) usage13("Image formatting requires one input.");
|
|
10803
|
+
if (!result.imageSet) usage13("Image formatting requires an update.");
|
|
10535
10804
|
if (result.scope === "presentation" || result.scope === "shared")
|
|
10536
|
-
|
|
10805
|
+
usage13("Image formatting requires an occurrence scope.");
|
|
10537
10806
|
if (result.token && ["--slide", "--image", "--scope", "--all"].some((option) => seen.has(option)))
|
|
10538
|
-
|
|
10807
|
+
usage13("Opaque and simple selectors cannot be combined.");
|
|
10539
10808
|
if (result.image !== void 0 && (!result.scope || result.scope === "slides") && result.slide === void 0)
|
|
10540
|
-
|
|
10809
|
+
usage13("Slide image selection requires a slide.");
|
|
10541
10810
|
result.input = positionals[0];
|
|
10542
10811
|
result.imageSet = {
|
|
10543
10812
|
...result.imageSet,
|
|
10544
10813
|
...result.all ? { all: true } : {},
|
|
10545
10814
|
...result.allowEmpty ? { allowEmpty: true } : {}
|
|
10546
10815
|
};
|
|
10547
|
-
if (result.inPlace && result.input === "-")
|
|
10548
|
-
if (result.inPlace && result.output)
|
|
10816
|
+
if (result.inPlace && result.input === "-") usage13("Stdin cannot be edited in place.");
|
|
10817
|
+
if (result.inPlace && result.output) usage13("Output and in-place cannot be combined.");
|
|
10549
10818
|
if (!result.dryRun && !result.inPlace && !result.output)
|
|
10550
|
-
|
|
10551
|
-
if (result.force && !result.output)
|
|
10819
|
+
usage13("Mutation requires a destination.");
|
|
10820
|
+
if (result.force && !result.output) usage13("Force requires an explicit output destination.");
|
|
10552
10821
|
if (result.output === result.input && result.output !== "-")
|
|
10553
|
-
|
|
10822
|
+
usage13("Replacing input requires --in-place.");
|
|
10554
10823
|
if (result.output === "-" && result.json && !result.dryRun)
|
|
10555
|
-
|
|
10824
|
+
usage13("Binary stdout cannot be combined with JSON.");
|
|
10556
10825
|
return result;
|
|
10557
10826
|
}
|
|
10558
10827
|
if (result.placeholder !== void 0) {
|
|
10559
10828
|
if (!["images.add", "tables.add", "charts.add"].includes(operation) || result.slide === void 0)
|
|
10560
|
-
|
|
10829
|
+
usage13("Placeholder insertion requires an add operation and --slide.");
|
|
10561
10830
|
if (["--left", "--top", "--width", "--height", "--fit"].some((flag) => seen.has(flag)))
|
|
10562
|
-
|
|
10563
|
-
if (operation === "tables.add" && (!result.tableEdit?.rows || !result.tableEdit?.columns))
|
|
10831
|
+
usage13("Placeholder insertion uses inherited geometry.");
|
|
10832
|
+
if (operation === "tables.add" && (!result.tableEdit?.rows || !result.tableEdit?.columns)) usage13("Table placeholder insertion requires rows and columns.");
|
|
10564
10833
|
if (operation === "tables.add" && Object.keys(result.tableEdit ?? {}).some((key) => !["rows", "columns"].includes(key)))
|
|
10565
|
-
|
|
10834
|
+
usage13("Table placeholder insertion accepts rows and columns.");
|
|
10566
10835
|
if (operation === "charts.add" && Object.keys(result.chartEdit ?? {}).some((key) => !["type", "data"].includes(key)))
|
|
10567
|
-
|
|
10836
|
+
usage13("Chart placeholder insertion accepts type and data.");
|
|
10568
10837
|
}
|
|
10569
10838
|
if (operation === "images.add" || operation === "images.replace") {
|
|
10570
10839
|
const replacing = operation === "images.replace";
|
|
@@ -10592,19 +10861,19 @@ function parse(raw, maximum, output3) {
|
|
|
10592
10861
|
"--dry-run"
|
|
10593
10862
|
];
|
|
10594
10863
|
if ([...seen].some((option) => !allowed.includes(option)))
|
|
10595
|
-
|
|
10864
|
+
usage13("Option does not apply to this image operation.");
|
|
10596
10865
|
if (positionals.length !== 1 || !positionals[0] || !replacing && result.slide === void 0 || !result.file)
|
|
10597
|
-
|
|
10866
|
+
usage13("Image mutation requires one input, selection and file.");
|
|
10598
10867
|
if (replacing) {
|
|
10599
|
-
if (result.scope === "presentation")
|
|
10868
|
+
if (result.scope === "presentation") usage13("Presentation scope has no image owners.");
|
|
10600
10869
|
if (result.scope === "shared" && !result.imageReplace?.shared)
|
|
10601
|
-
|
|
10870
|
+
usage13("Shared scope requires explicit shared replacement.");
|
|
10602
10871
|
if (result.token && ["--slide", "--image", "--scope", "--all"].some((option) => seen.has(option)))
|
|
10603
|
-
|
|
10872
|
+
usage13("Opaque and simple selectors cannot be combined.");
|
|
10604
10873
|
if (!result.token && result.image === void 0 && !result.all)
|
|
10605
|
-
|
|
10874
|
+
usage13("Image replacement requires an image selector or all.");
|
|
10606
10875
|
if (result.image !== void 0 && (!result.scope || result.scope === "slides") && result.slide === void 0)
|
|
10607
|
-
|
|
10876
|
+
usage13("Slide image selection requires a slide.");
|
|
10608
10877
|
result.imageReplace = {
|
|
10609
10878
|
...result.imageReplace,
|
|
10610
10879
|
...result.all ? { all: true } : {},
|
|
@@ -10613,28 +10882,28 @@ function parse(raw, maximum, output3) {
|
|
|
10613
10882
|
}
|
|
10614
10883
|
result.input = positionals[0];
|
|
10615
10884
|
if (result.input === "-" && result.file === "-")
|
|
10616
|
-
|
|
10885
|
+
usage13("Document and image cannot both use stdin.");
|
|
10617
10886
|
const imageOptions = replacing ? result.imageReplace : result.imageAdd;
|
|
10618
10887
|
if (!imageOptions?.contentType) {
|
|
10619
10888
|
const extension = result.file.slice(result.file.lastIndexOf(".") + 1).toLowerCase();
|
|
10620
10889
|
const contentType = { png: "image/png", jpg: "image/jpeg", jpeg: "image/jpeg", gif: "image/gif", bmp: "image/bmp", tif: "image/tiff", tiff: "image/tiff", wmf: "image/x-wmf" }[extension];
|
|
10621
10890
|
if (!contentType)
|
|
10622
|
-
|
|
10891
|
+
usage13("Image file requires an explicit supported content type or extension.");
|
|
10623
10892
|
if (replacing) result.imageReplace = { ...result.imageReplace, contentType };
|
|
10624
10893
|
else result.imageAdd = { ...result.imageAdd, contentType };
|
|
10625
10894
|
}
|
|
10626
10895
|
const both = result.imageAdd?.width !== void 0 && result.imageAdd?.height !== void 0;
|
|
10627
10896
|
if (!replacing && !both && result.imageAdd?.fit !== void 0)
|
|
10628
|
-
|
|
10629
|
-
if (result.inPlace && result.input === "-")
|
|
10630
|
-
if (result.inPlace && result.output)
|
|
10897
|
+
usage13("Both dimensions and explicit fit must be supplied together.");
|
|
10898
|
+
if (result.inPlace && result.input === "-") usage13("Stdin cannot be edited in place.");
|
|
10899
|
+
if (result.inPlace && result.output) usage13("Output and in-place cannot be combined.");
|
|
10631
10900
|
if (!result.dryRun && !result.inPlace && !result.output)
|
|
10632
|
-
|
|
10633
|
-
if (result.force && !result.output)
|
|
10901
|
+
usage13("Mutation requires a destination.");
|
|
10902
|
+
if (result.force && !result.output) usage13("Force requires an explicit output destination.");
|
|
10634
10903
|
if (result.output === result.input && result.output !== "-")
|
|
10635
|
-
|
|
10904
|
+
usage13("Replacing input requires --in-place.");
|
|
10636
10905
|
if (result.output === "-" && result.json && !result.dryRun)
|
|
10637
|
-
|
|
10906
|
+
usage13("Binary stdout cannot be combined with JSON.");
|
|
10638
10907
|
return result;
|
|
10639
10908
|
}
|
|
10640
10909
|
if (["media.add", "media.replace", "media.extract"].includes(operation)) {
|
|
@@ -10644,9 +10913,9 @@ function parse(raw, maximum, output3) {
|
|
|
10644
10913
|
if (Object.hasOwn(mediaSchemas, operation)) {
|
|
10645
10914
|
const allowed = ["--json", "--limit", "--scope", "--slide", "--shape", "--select"];
|
|
10646
10915
|
if ([...seen].some((option) => !allowed.includes(option)))
|
|
10647
|
-
|
|
10916
|
+
usage13("Option does not apply to media inspection.");
|
|
10648
10917
|
if (positionals.length !== 1 || !positionals[0])
|
|
10649
|
-
|
|
10918
|
+
usage13("Media inspection requires exactly one input.");
|
|
10650
10919
|
if (result.scope !== void 0 && ![
|
|
10651
10920
|
"slides",
|
|
10652
10921
|
"layouts",
|
|
@@ -10656,11 +10925,11 @@ function parse(raw, maximum, output3) {
|
|
|
10656
10925
|
"handout-master",
|
|
10657
10926
|
"shared"
|
|
10658
10927
|
].includes(result.scope))
|
|
10659
|
-
|
|
10928
|
+
usage13("Unsupported media scope.");
|
|
10660
10929
|
if (result.token && ["--slide", "--shape", "--scope"].some((option) => seen.has(option)))
|
|
10661
|
-
|
|
10930
|
+
usage13("Opaque and simple selectors cannot be combined.");
|
|
10662
10931
|
if (result.shape !== void 0 && result.slide === void 0)
|
|
10663
|
-
|
|
10932
|
+
usage13("Shape selection requires an owning slide.");
|
|
10664
10933
|
result.input = positionals[0];
|
|
10665
10934
|
return result;
|
|
10666
10935
|
}
|
|
@@ -10709,47 +10978,47 @@ function parse(raw, maximum, output3) {
|
|
|
10709
10978
|
(key) => "--" + [...key].map((c) => c >= "A" && c <= "Z" ? "-" + c.toLowerCase() : c).join("")
|
|
10710
10979
|
);
|
|
10711
10980
|
if ([...seen].some((flag) => !allowed.includes(flag)))
|
|
10712
|
-
|
|
10981
|
+
usage13("Option does not apply to chart mutation.");
|
|
10713
10982
|
if (positionals.length !== 1 || !positionals[0])
|
|
10714
|
-
|
|
10983
|
+
usage13("Chart mutation requires exactly one input.");
|
|
10715
10984
|
result.input = positionals[0];
|
|
10716
10985
|
if (result.scope !== void 0 && result.scope !== "slides")
|
|
10717
|
-
|
|
10986
|
+
usage13("Chart mutation supports slides scope.");
|
|
10718
10987
|
if (result.token && ["--slide", "--shape", "--scope", "--all"].some((flag) => seen.has(flag)))
|
|
10719
|
-
|
|
10988
|
+
usage13("Opaque and simple selectors cannot be combined.");
|
|
10720
10989
|
const edit = result.chartEdit ?? {};
|
|
10721
10990
|
const { type, ...update } = edit;
|
|
10722
10991
|
validateChartUpdate(update);
|
|
10723
10992
|
if (operation === "charts.add") {
|
|
10724
10993
|
if (!result.slide || result.token || result.shape || result.all || result.allowEmpty)
|
|
10725
|
-
|
|
10994
|
+
usage13("Chart addition requires one slide.");
|
|
10726
10995
|
if (!type || !chartTypes2.includes(type) || !edit.data || result.placeholder === void 0 && [edit.left, edit.top, edit.width, edit.height].some((value) => value === void 0))
|
|
10727
|
-
|
|
10996
|
+
usage13("Chart addition requires type, data and geometry.");
|
|
10728
10997
|
validateChartData(edit.data, type);
|
|
10729
|
-
} else if (!Object.keys(edit).length)
|
|
10998
|
+
} else if (!Object.keys(edit).length) usage13("Chart mutation requires an update.");
|
|
10730
10999
|
if (operation === "charts.replace" && (!edit.data || !["synchronize-simple", "reject-complex"].includes(result.chartWorkbookPolicy)))
|
|
10731
|
-
|
|
10732
|
-
if (result.inPlace && result.input === "-")
|
|
10733
|
-
if (result.output && result.inPlace)
|
|
11000
|
+
usage13("Chart replacement requires data and an explicit workbook policy.");
|
|
11001
|
+
if (result.inPlace && result.input === "-") usage13("Stdin cannot be edited in place.");
|
|
11002
|
+
if (result.output && result.inPlace) usage13("Output and in-place are mutually exclusive.");
|
|
10734
11003
|
if (!result.dryRun && !result.inPlace && !result.output)
|
|
10735
|
-
|
|
10736
|
-
if (result.force && !result.output)
|
|
11004
|
+
usage13("Mutation requires a destination.");
|
|
11005
|
+
if (result.force && !result.output) usage13("Force requires an explicit output destination.");
|
|
10737
11006
|
if (result.output === result.input && result.output !== "-")
|
|
10738
|
-
|
|
11007
|
+
usage13("Replacing input requires --in-place.");
|
|
10739
11008
|
if (result.output === "-" && result.json && !result.dryRun)
|
|
10740
|
-
|
|
11009
|
+
usage13("Binary stdout cannot be combined with JSON.");
|
|
10741
11010
|
return result;
|
|
10742
11011
|
}
|
|
10743
11012
|
if (operation === "charts.list" || operation === "charts.get") {
|
|
10744
11013
|
const allowed = ["--json", "--limit", "--scope", "--slide", "--shape", "--select"];
|
|
10745
11014
|
if ([...seen].some((option) => !allowed.includes(option)))
|
|
10746
|
-
|
|
11015
|
+
usage13("Option does not apply to chart inspection.");
|
|
10747
11016
|
if (positionals.length !== 1 || !positionals[0])
|
|
10748
|
-
|
|
11017
|
+
usage13("Chart inspection requires exactly one input.");
|
|
10749
11018
|
if (result.scope !== void 0 && result.scope !== "slides")
|
|
10750
|
-
|
|
11019
|
+
usage13("Chart inspection supports slides scope.");
|
|
10751
11020
|
if (result.token && ["--slide", "--shape", "--scope"].some((option) => seen.has(option)))
|
|
10752
|
-
|
|
11021
|
+
usage13("Opaque and simple selectors cannot be combined.");
|
|
10753
11022
|
result.input = positionals[0];
|
|
10754
11023
|
return result;
|
|
10755
11024
|
}
|
|
@@ -10766,33 +11035,33 @@ function parse(raw, maximum, output3) {
|
|
|
10766
11035
|
...extracting ? ["--sha256", "--output-dir", "--allow-partial-output", "--force", "--dry-run"] : []
|
|
10767
11036
|
];
|
|
10768
11037
|
if (extracting) {
|
|
10769
|
-
if (!result.outputDir && !result.dryRun)
|
|
10770
|
-
if (result.outputDir === "-")
|
|
10771
|
-
if (result.force && !result.outputDir)
|
|
11038
|
+
if (!result.outputDir && !result.dryRun) usage13("Image extraction requires --output-dir.");
|
|
11039
|
+
if (result.outputDir === "-") usage13("Output directories cannot be stdout.");
|
|
11040
|
+
if (result.force && !result.outputDir) usage13("Force requires an output directory.");
|
|
10772
11041
|
}
|
|
10773
11042
|
if ([...seen].some((option) => !allowed.includes(option)))
|
|
10774
|
-
|
|
11043
|
+
usage13("Option does not apply to images list.");
|
|
10775
11044
|
if (positionals.length !== 1 || !positionals[0])
|
|
10776
|
-
|
|
10777
|
-
if (result.scope === "presentation")
|
|
11045
|
+
usage13("Image inventory requires exactly one input.");
|
|
11046
|
+
if (result.scope === "presentation") usage13("Presentation scope has no image owners.");
|
|
10778
11047
|
if (result.token && ["--slide", "--image", "--scope"].some((option) => seen.has(option)))
|
|
10779
|
-
|
|
11048
|
+
usage13("Opaque and simple selectors cannot be combined.");
|
|
10780
11049
|
result.input = positionals[0];
|
|
10781
11050
|
return result;
|
|
10782
11051
|
}
|
|
10783
11052
|
if (operation === "batch") {
|
|
10784
11053
|
const allowed = ["--json", "--limit", "--ops-json", "--ops-file", "--output", "--in-place", "--force", "--dry-run"];
|
|
10785
|
-
if ([...seen].some((flag) => !allowed.includes(flag)))
|
|
10786
|
-
if (positionals.length !== 1 || !positionals[0])
|
|
10787
|
-
if (result.animationBatch !== void 0 === (result.opsFile !== void 0))
|
|
11054
|
+
if ([...seen].some((flag) => !allowed.includes(flag))) usage13("Option does not apply to batch.");
|
|
11055
|
+
if (positionals.length !== 1 || !positionals[0]) usage13("Batch requires one input.");
|
|
11056
|
+
if (result.animationBatch !== void 0 === (result.opsFile !== void 0)) usage13("Batch requires exactly one operation source.");
|
|
10788
11057
|
result.input = positionals[0];
|
|
10789
|
-
if (result.input === "-" && result.opsFile === "-")
|
|
10790
|
-
if (result.inPlace && result.input === "-")
|
|
10791
|
-
if (result.inPlace && result.output)
|
|
10792
|
-
if (result.animationBatch?.length && !result.dryRun && !result.inPlace && !result.output)
|
|
10793
|
-
if (result.force && !result.output)
|
|
10794
|
-
if (result.output === result.input && result.output !== "-")
|
|
10795
|
-
if (result.output === "-" && result.json && !result.dryRun)
|
|
11058
|
+
if (result.input === "-" && result.opsFile === "-") usage13("Document and batch cannot both use stdin.");
|
|
11059
|
+
if (result.inPlace && result.input === "-") usage13("Stdin cannot be edited in place.");
|
|
11060
|
+
if (result.inPlace && result.output) usage13("Output and in-place cannot be combined.");
|
|
11061
|
+
if (result.animationBatch?.length && !result.dryRun && !result.inPlace && !result.output) usage13("Mutation requires a destination.");
|
|
11062
|
+
if (result.force && !result.output) usage13("Force requires an explicit output destination.");
|
|
11063
|
+
if (result.output === result.input && result.output !== "-") usage13("Replacing input requires --in-place.");
|
|
11064
|
+
if (result.output === "-" && result.json && !result.dryRun) usage13("Binary stdout cannot be combined with JSON.");
|
|
10796
11065
|
return result;
|
|
10797
11066
|
}
|
|
10798
11067
|
if (Object.hasOwn(animationSchemas, operation)) {
|
|
@@ -10808,21 +11077,21 @@ function parse(raw, maximum, output3) {
|
|
|
10808
11077
|
...mutation2 ? ["--all", "--allow-empty", "--output", "--in-place", "--force", "--dry-run"] : [],
|
|
10809
11078
|
...editing ? ["--kind", "--trigger", "--duration", "--delay", "--target"] : []
|
|
10810
11079
|
];
|
|
10811
|
-
if ([...seen].some((flag) => !allowed.includes(flag)))
|
|
10812
|
-
if (positionals.length !== 1 || !positionals[0])
|
|
11080
|
+
if ([...seen].some((flag) => !allowed.includes(flag))) usage13("Option does not apply to animations.");
|
|
11081
|
+
if (positionals.length !== 1 || !positionals[0]) usage13("Animations require one input.");
|
|
10813
11082
|
result.input = positionals[0];
|
|
10814
|
-
if (result.scope !== void 0 && result.scope !== "slides")
|
|
10815
|
-
if (result.token && ["--scope", "--slide", "--shape"].some((flag) => seen.has(flag)))
|
|
10816
|
-
if (result.shape !== void 0 && result.slide === void 0)
|
|
11083
|
+
if (result.scope !== void 0 && result.scope !== "slides") usage13("Animations require slides scope.");
|
|
11084
|
+
if (result.token && ["--scope", "--slide", "--shape"].some((flag) => seen.has(flag))) usage13("Opaque and simple selectors cannot be combined.");
|
|
11085
|
+
if (result.shape !== void 0 && result.slide === void 0) usage13("Shape selection requires a slide.");
|
|
10817
11086
|
if (mutation2) {
|
|
10818
11087
|
validateAnimationOptions2(operation.slice(11), result.animationEdit ?? {});
|
|
10819
|
-
if (operation !== "animations.add" && !result.token && result.slide === void 0 && !result.all)
|
|
10820
|
-
if (result.inPlace && result.input === "-")
|
|
10821
|
-
if (result.inPlace && result.output)
|
|
10822
|
-
if (!result.dryRun && !result.inPlace && !result.output)
|
|
10823
|
-
if (result.force && !result.output)
|
|
10824
|
-
if (result.output === result.input && result.output !== "-")
|
|
10825
|
-
if (result.output === "-" && result.json && !result.dryRun)
|
|
11088
|
+
if (operation !== "animations.add" && !result.token && result.slide === void 0 && !result.all) usage13("Animation mutation requires a selector or --all.");
|
|
11089
|
+
if (result.inPlace && result.input === "-") usage13("Stdin cannot be edited in place.");
|
|
11090
|
+
if (result.inPlace && result.output) usage13("Output and in-place cannot be combined.");
|
|
11091
|
+
if (!result.dryRun && !result.inPlace && !result.output) usage13("Mutation requires a destination.");
|
|
11092
|
+
if (result.force && !result.output) usage13("Force requires an explicit output destination.");
|
|
11093
|
+
if (result.output === result.input && result.output !== "-") usage13("Replacing input requires --in-place.");
|
|
11094
|
+
if (result.output === "-" && result.json && !result.dryRun) usage13("Binary stdout cannot be combined with JSON.");
|
|
10826
11095
|
}
|
|
10827
11096
|
return result;
|
|
10828
11097
|
}
|
|
@@ -10838,20 +11107,20 @@ function parse(raw, maximum, output3) {
|
|
|
10838
11107
|
...mutation2 ? ["--all", "--allow-empty", "--output", "--in-place", "--force", "--dry-run"] : [],
|
|
10839
11108
|
...editing ? ["--kind", "--direction", "--duration", "--advance-after", "--advance-on-click"] : []
|
|
10840
11109
|
];
|
|
10841
|
-
if ([...seen].some((flag) => !allowed.includes(flag)))
|
|
10842
|
-
if (positionals.length !== 1 || !positionals[0])
|
|
11110
|
+
if ([...seen].some((flag) => !allowed.includes(flag))) usage13("Option does not apply to transitions.");
|
|
11111
|
+
if (positionals.length !== 1 || !positionals[0]) usage13("Transitions require one input.");
|
|
10843
11112
|
result.input = positionals[0];
|
|
10844
|
-
if (result.scope !== void 0 && result.scope !== "slides")
|
|
10845
|
-
if (result.token && ["--scope", "--slide"].some((flag) => seen.has(flag)))
|
|
11113
|
+
if (result.scope !== void 0 && result.scope !== "slides") usage13("Transitions require slides scope.");
|
|
11114
|
+
if (result.token && ["--scope", "--slide"].some((flag) => seen.has(flag))) usage13("Opaque and simple selectors cannot be combined.");
|
|
10846
11115
|
if (mutation2) {
|
|
10847
11116
|
validateTransitionOptions(operation.slice(12), { ...result.transitionEdit, selection: {} });
|
|
10848
|
-
if (!result.token && result.slide === void 0 && !result.all)
|
|
10849
|
-
if (result.inPlace && result.input === "-")
|
|
10850
|
-
if (result.inPlace && result.output)
|
|
10851
|
-
if (!result.dryRun && !result.inPlace && !result.output)
|
|
10852
|
-
if (result.force && !result.output)
|
|
10853
|
-
if (result.output === result.input && result.output !== "-")
|
|
10854
|
-
if (result.output === "-" && result.json && !result.dryRun)
|
|
11117
|
+
if (!result.token && result.slide === void 0 && !result.all) usage13("Transition mutation requires a selector or --all.");
|
|
11118
|
+
if (result.inPlace && result.input === "-") usage13("Stdin cannot be edited in place.");
|
|
11119
|
+
if (result.inPlace && result.output) usage13("Output and in-place cannot be combined.");
|
|
11120
|
+
if (!result.dryRun && !result.inPlace && !result.output) usage13("Mutation requires a destination.");
|
|
11121
|
+
if (result.force && !result.output) usage13("Force requires an explicit output destination.");
|
|
11122
|
+
if (result.output === result.input && result.output !== "-") usage13("Replacing input requires --in-place.");
|
|
11123
|
+
if (result.output === "-" && result.json && !result.dryRun) usage13("Binary stdout cannot be combined with JSON.");
|
|
10855
11124
|
}
|
|
10856
11125
|
return result;
|
|
10857
11126
|
}
|
|
@@ -10892,18 +11161,18 @@ function parse(raw, maximum, output3) {
|
|
|
10892
11161
|
if (formatting && [...seen].some(
|
|
10893
11162
|
(flag) => ["--style-json", "--find", "--with", "--first", "--occurrence"].includes(flag)
|
|
10894
11163
|
))
|
|
10895
|
-
|
|
11164
|
+
usage13("Match options do not apply to runs.");
|
|
10896
11165
|
if ([...seen].some((flag) => !allowed.includes(flag)))
|
|
10897
|
-
|
|
10898
|
-
if (positionals.length !== 1 || !positionals[0])
|
|
11166
|
+
usage13("Option does not apply to this text operation.");
|
|
11167
|
+
if (positionals.length !== 1 || !positionals[0]) usage13("Text operation requires one input.");
|
|
10899
11168
|
if (result.scope === "presentation" || result.scope === "shared")
|
|
10900
|
-
|
|
11169
|
+
usage13("Text operation requires a text-bearing scope.");
|
|
10901
11170
|
if (result.token && ["--scope", "--slide", "--shape", "--paragraph", "--run"].some((flag) => seen.has(flag)))
|
|
10902
|
-
|
|
11171
|
+
usage13("Opaque and simple selectors cannot be combined.");
|
|
10903
11172
|
if (result.slide !== void 0 && (result.scope === "notes-master" || result.scope === "handout-master"))
|
|
10904
|
-
|
|
11173
|
+
usage13("Deck-level text master scopes do not accept slide selection.");
|
|
10905
11174
|
if (result.shape && result.slide === void 0)
|
|
10906
|
-
|
|
11175
|
+
usage13("Shape selection requires an owning slide.");
|
|
10907
11176
|
result.input = positionals[0];
|
|
10908
11177
|
if (mutation2) {
|
|
10909
11178
|
if (fields2)
|
|
@@ -10912,7 +11181,7 @@ function parse(raw, maximum, output3) {
|
|
|
10912
11181
|
operation.slice(7)
|
|
10913
11182
|
);
|
|
10914
11183
|
if (fitting) {
|
|
10915
|
-
if (!result.fitEdit?.metrics)
|
|
11184
|
+
if (!result.fitEdit?.metrics) usage13("Text fit requires --metrics JSON.");
|
|
10916
11185
|
validateTextFitOptions(result.fitEdit);
|
|
10917
11186
|
}
|
|
10918
11187
|
if (frames)
|
|
@@ -10926,20 +11195,20 @@ function parse(raw, maximum, output3) {
|
|
|
10926
11195
|
if (formatting && !result.all && result.token === void 0 && result.slide === void 0 && result.shape === void 0 && result.paragraphEdit?.paragraph === void 0 && result.runEdit?.paragraph === void 0 && result.runEdit?.run === void 0)
|
|
10927
11196
|
throw new SelectionError8("missing-selection");
|
|
10928
11197
|
if (!formatting && (result.find === void 0 || result.with === void 0))
|
|
10929
|
-
|
|
11198
|
+
usage13("Text replace requires find and with.");
|
|
10930
11199
|
if (!formatting && [result.first === true, result.all === true, result.occurrence !== void 0].filter(
|
|
10931
11200
|
Boolean
|
|
10932
11201
|
).length !== 1)
|
|
10933
|
-
|
|
10934
|
-
if (result.inPlace && result.input === "-")
|
|
10935
|
-
if (result.inPlace && result.output)
|
|
11202
|
+
usage13("Text replace requires exactly one of first, all or occurrence.");
|
|
11203
|
+
if (result.inPlace && result.input === "-") usage13("Stdin cannot be edited in place.");
|
|
11204
|
+
if (result.inPlace && result.output) usage13("Output and in-place cannot be combined.");
|
|
10936
11205
|
if (!result.dryRun && !result.inPlace && !result.output)
|
|
10937
|
-
|
|
10938
|
-
if (result.force && !result.output)
|
|
11206
|
+
usage13("Mutation requires a destination.");
|
|
11207
|
+
if (result.force && !result.output) usage13("Force requires an explicit output destination.");
|
|
10939
11208
|
if (result.output === result.input && result.output !== "-")
|
|
10940
|
-
|
|
11209
|
+
usage13("Replacing input requires --in-place.");
|
|
10941
11210
|
if (result.output === "-" && result.json && !result.dryRun)
|
|
10942
|
-
|
|
11211
|
+
usage13("Binary stdout cannot be combined with JSON.");
|
|
10943
11212
|
}
|
|
10944
11213
|
return result;
|
|
10945
11214
|
}
|
|
@@ -10959,11 +11228,11 @@ function parse(raw, maximum, output3) {
|
|
|
10959
11228
|
(key) => "--" + [...key].map((c) => c >= "A" && c <= "Z" ? "-" + c.toLowerCase() : c).join("")
|
|
10960
11229
|
);
|
|
10961
11230
|
if ([...seen].some((flag) => !flags.includes(flag)))
|
|
10962
|
-
|
|
10963
|
-
if (positionals.length !== 1 || !positionals[0])
|
|
11231
|
+
usage13("Option does not apply to this shape operation.");
|
|
11232
|
+
if (positionals.length !== 1 || !positionals[0]) usage13("Shape operations require one input.");
|
|
10964
11233
|
result.input = positionals[0];
|
|
10965
11234
|
if (result.token && (result.slide !== void 0 || result.part || result.shape || result.all))
|
|
10966
|
-
|
|
11235
|
+
usage13("Opaque and simple selectors cannot be combined.");
|
|
10967
11236
|
if (operation.startsWith("tables."))
|
|
10968
11237
|
validateTableSelection(
|
|
10969
11238
|
{
|
|
@@ -10981,28 +11250,28 @@ function parse(raw, maximum, output3) {
|
|
|
10981
11250
|
if (operation.startsWith("tables.")) {
|
|
10982
11251
|
if (operation === "tables.merge") {
|
|
10983
11252
|
if (!result.tableFrom || !result.tableTo)
|
|
10984
|
-
|
|
11253
|
+
usage13("Merge requires from and to coordinates.");
|
|
10985
11254
|
result.tableStructure = {
|
|
10986
11255
|
kind: "merge",
|
|
10987
11256
|
from: tableCell(result.tableFrom),
|
|
10988
11257
|
to: tableCell(result.tableTo)
|
|
10989
11258
|
};
|
|
10990
11259
|
} else if (operation === "tables.split") {
|
|
10991
|
-
if (!result.cell)
|
|
11260
|
+
if (!result.cell) usage13("Split requires one merge origin cell.");
|
|
10992
11261
|
result.tableStructure = { kind: "split", cell: tableCell(result.cell) };
|
|
10993
11262
|
} else if (operation.startsWith("tables.rows.") || operation.startsWith("tables.columns.")) {
|
|
10994
11263
|
const adding = operation.endsWith(".add");
|
|
10995
11264
|
if (!result.tablePosition || !(adding ? ["expand", "reject"] : ["shrink", "reject"]).includes(
|
|
10996
11265
|
result.tableSpanPolicy
|
|
10997
11266
|
))
|
|
10998
|
-
|
|
11267
|
+
usage13("A position and explicit span policy are required.");
|
|
10999
11268
|
result.tableStructure = {
|
|
11000
11269
|
kind: operation.slice(7).split(".").join("-"),
|
|
11001
11270
|
position: result.tablePosition - 1,
|
|
11002
11271
|
spanPolicy: result.tableSpanPolicy
|
|
11003
11272
|
};
|
|
11004
11273
|
} else {
|
|
11005
|
-
if (!result.tableEdit)
|
|
11274
|
+
if (!result.tableEdit) usage13("A table edit is required.");
|
|
11006
11275
|
validateTableUpdate(
|
|
11007
11276
|
{
|
|
11008
11277
|
...result.tableEdit,
|
|
@@ -11013,14 +11282,14 @@ function parse(raw, maximum, output3) {
|
|
|
11013
11282
|
}
|
|
11014
11283
|
} else if (operation === "shapes.remove") {
|
|
11015
11284
|
if (result.connectorEdit?.detachPolicy !== void 0 && !["detach", "remove"].includes(result.connectorEdit.detachPolicy))
|
|
11016
|
-
|
|
11285
|
+
usage13("Invalid detach policy.");
|
|
11017
11286
|
} else if (connector) {
|
|
11018
11287
|
if (operation !== "connectors.remove")
|
|
11019
11288
|
validateConnectorOptions(result.connectorEdit ?? {}, operation === "connectors.add");
|
|
11020
11289
|
} else if (operation === "shapes.effects.set" || operation === "shapes.drawing.set") {
|
|
11021
11290
|
if (operation === "shapes.effects.set") {
|
|
11022
11291
|
if (result.shadowEnabled === void 0 || result.shadowOpacity === void 0 || result.shadowBlur === void 0 || result.shadowColor === void 0)
|
|
11023
|
-
|
|
11292
|
+
usage13("Shadow requires explicit shadow, opacity, blur and color.");
|
|
11024
11293
|
result.drawingEdit = {
|
|
11025
11294
|
shadow: result.shadowEnabled ? {
|
|
11026
11295
|
blur: result.shadowBlur,
|
|
@@ -11031,7 +11300,7 @@ function parse(raw, maximum, output3) {
|
|
|
11031
11300
|
}
|
|
11032
11301
|
if (result.drawingFill) {
|
|
11033
11302
|
if (result.drawingEdit?.fill !== void 0)
|
|
11034
|
-
|
|
11303
|
+
usage13("Structured fill and simple fill flags cannot be mixed.");
|
|
11035
11304
|
result.drawingEdit = {
|
|
11036
11305
|
...result.drawingEdit,
|
|
11037
11306
|
fill: result.drawingFill
|
|
@@ -11039,9 +11308,9 @@ function parse(raw, maximum, output3) {
|
|
|
11039
11308
|
}
|
|
11040
11309
|
if (result.file !== void 0) {
|
|
11041
11310
|
if (result.input === "-" && result.file === "-")
|
|
11042
|
-
|
|
11311
|
+
usage13("Document and image cannot both use stdin.");
|
|
11043
11312
|
if (result.drawingEdit?.fill?.kind !== "picture" || result.drawingEdit.fill.relationshipId !== void 0)
|
|
11044
|
-
|
|
11313
|
+
usage13("File requires picture fill without a relationship ID.");
|
|
11045
11314
|
}
|
|
11046
11315
|
validateDrawingUpdate(
|
|
11047
11316
|
result.file !== void 0 && result.drawingEdit?.fill?.kind === "picture" ? {
|
|
@@ -11051,7 +11320,7 @@ function parse(raw, maximum, output3) {
|
|
|
11051
11320
|
);
|
|
11052
11321
|
} else if (selectionMutation) {
|
|
11053
11322
|
if (result.shapes && (result.slide !== void 0 || result.part || result.shape || result.token || result.all || result.allowEmpty))
|
|
11054
|
-
|
|
11323
|
+
usage13("Location arrays and simple or opaque selectors cannot be combined.");
|
|
11055
11324
|
result.selectionEdit = {
|
|
11056
11325
|
...result.selectionEdit,
|
|
11057
11326
|
action: operation.slice(7),
|
|
@@ -11066,9 +11335,9 @@ function parse(raw, maximum, output3) {
|
|
|
11066
11335
|
};
|
|
11067
11336
|
validateShapeSelectionOptions(result.selectionEdit);
|
|
11068
11337
|
} else if (grouping) {
|
|
11069
|
-
if (result.tolerance === void 0)
|
|
11338
|
+
if (result.tolerance === void 0) usage13("Grouping requires explicit tolerance.");
|
|
11070
11339
|
if (operation === "shapes.group" && result.shapes === void 0)
|
|
11071
|
-
|
|
11340
|
+
usage13("Grouping requires shape locations.");
|
|
11072
11341
|
validateGroupOptions(
|
|
11073
11342
|
{
|
|
11074
11343
|
tolerance: result.tolerance,
|
|
@@ -11085,30 +11354,30 @@ function parse(raw, maximum, output3) {
|
|
|
11085
11354
|
);
|
|
11086
11355
|
} else if (operation.startsWith("shapes.paths.")) {
|
|
11087
11356
|
if (result.path !== void 0 && (result.vertices !== void 0 || result.close !== void 0))
|
|
11088
|
-
|
|
11357
|
+
usage13("Path and vertices/close cannot be combined.");
|
|
11089
11358
|
if (result.vertices !== void 0) {
|
|
11090
|
-
if (result.close === void 0)
|
|
11359
|
+
if (result.close === void 0) usage13("Vertices require explicit --close true|false.");
|
|
11091
11360
|
if (!Array.isArray(result.vertices) || result.vertices.some((vertex) => Array.isArray(vertex)))
|
|
11092
|
-
|
|
11361
|
+
usage13("Vertices require objects with x and y coordinates.");
|
|
11093
11362
|
result.path = pathFromVertices(result.vertices, result.close);
|
|
11094
11363
|
}
|
|
11095
|
-
if (result.path === void 0)
|
|
11364
|
+
if (result.path === void 0) usage13("Path mutation requires --path or --vertices.");
|
|
11096
11365
|
validateShapePath(result.path);
|
|
11097
11366
|
if (operation.endsWith(".add"))
|
|
11098
11367
|
validateShapeOptions({ ...result.shapeEdit, kind: "text-box" }, true);
|
|
11099
11368
|
} else {
|
|
11100
|
-
if (!result.shapeEdit)
|
|
11369
|
+
if (!result.shapeEdit) usage13("Shape mutation requires update fields.");
|
|
11101
11370
|
validateShapeOptions(result.shapeEdit, operation === "shapes.add");
|
|
11102
11371
|
}
|
|
11103
|
-
if (result.inPlace && result.input === "-")
|
|
11104
|
-
if (result.inPlace && result.output)
|
|
11372
|
+
if (result.inPlace && result.input === "-") usage13("Stdin cannot be edited in place.");
|
|
11373
|
+
if (result.inPlace && result.output) usage13("Output and in-place cannot be combined.");
|
|
11105
11374
|
if (!result.dryRun && !result.inPlace && !result.output)
|
|
11106
|
-
|
|
11107
|
-
if (result.force && !result.output)
|
|
11375
|
+
usage13("Mutation requires a destination.");
|
|
11376
|
+
if (result.force && !result.output) usage13("Force requires an explicit output destination.");
|
|
11108
11377
|
if (result.output === result.input && result.output !== "-")
|
|
11109
|
-
|
|
11378
|
+
usage13("Replacing input requires --in-place.");
|
|
11110
11379
|
if (result.output === "-" && result.json && !result.dryRun)
|
|
11111
|
-
|
|
11380
|
+
usage13("Binary stdout cannot be combined with JSON.");
|
|
11112
11381
|
}
|
|
11113
11382
|
return result;
|
|
11114
11383
|
}
|
|
@@ -11123,53 +11392,53 @@ function parse(raw, maximum, output3) {
|
|
|
11123
11392
|
(key) => key === "placeholders" ? "--placeholders-json" : "--" + [...key].map((char) => char >= "A" && char <= "Z" ? "-" + char.toLowerCase() : char).join("")
|
|
11124
11393
|
);
|
|
11125
11394
|
if ([...seen].some((flag) => !flags.includes(flag)))
|
|
11126
|
-
|
|
11395
|
+
usage13("Option does not apply to this shared-content operation.");
|
|
11127
11396
|
if (positionals.length !== 1 || !positionals[0])
|
|
11128
|
-
|
|
11397
|
+
usage13("Shared-content operations require one input.");
|
|
11129
11398
|
result.input = positionals[0];
|
|
11130
11399
|
if (mutation2 && !applying && !background && result.scope === void 0)
|
|
11131
|
-
|
|
11400
|
+
usage13("Shared-content mutation requires explicit scope.");
|
|
11132
11401
|
if (result.scope !== void 0 && !(theme ? ["shared"] : background ? ["slides", "layouts", "masters", "shared"] : applying ? ["slides"] : layout ? ["layouts", "shared"] : ["masters", "shared"]).includes(result.scope))
|
|
11133
|
-
|
|
11402
|
+
usage13("Scope does not match this shared-content operation.");
|
|
11134
11403
|
if (applying && result.token && result.scope !== void 0)
|
|
11135
|
-
|
|
11404
|
+
usage13("Opaque selectors cannot be combined with scope.");
|
|
11136
11405
|
if (result.token && (result.part || result.slide !== void 0 || result.shape || result.all))
|
|
11137
|
-
|
|
11406
|
+
usage13("Opaque and simple selectors cannot be combined.");
|
|
11138
11407
|
if (result.part && result.slide !== void 0)
|
|
11139
|
-
|
|
11408
|
+
usage13("Part and slide selectors cannot be combined.");
|
|
11140
11409
|
const edit = result.masterEdit;
|
|
11141
|
-
if (operation === "masters.add" && !edit?.name)
|
|
11410
|
+
if (operation === "masters.add" && !edit?.name) usage13("Master creation requires a name.");
|
|
11142
11411
|
if (operation === "masters.set" && edit?.name === void 0 && edit?.text === void 0)
|
|
11143
|
-
|
|
11412
|
+
usage13("Master set requires name or text.");
|
|
11144
11413
|
if (operation === "masters.set" && edit?.text !== void 0 && !result.shape && !result.token)
|
|
11145
|
-
|
|
11414
|
+
usage13("Master text edits require a selected text shape.");
|
|
11146
11415
|
if (operation === "layouts.add" && (!edit?.name || !edit.master))
|
|
11147
|
-
|
|
11416
|
+
usage13("Layout creation requires name and master.");
|
|
11148
11417
|
if (operation === "layouts.set" && !edit && !result.layoutEdit)
|
|
11149
|
-
|
|
11418
|
+
usage13("Layout set requires update fields.");
|
|
11150
11419
|
if (operation === "layouts.set" && edit?.text !== void 0 && !result.shape && !result.token)
|
|
11151
|
-
|
|
11420
|
+
usage13("Layout text requires a selected shape.");
|
|
11152
11421
|
if (layout && mutation2 && operation !== "layouts.add" && !result.part && !result.token && result.slide === void 0 && !result.all)
|
|
11153
|
-
|
|
11422
|
+
usage13("Layout mutation requires an explicit selector.");
|
|
11154
11423
|
if (applying && (!result.layoutEdit?.layout || !["type-index", "reject-unmatched"].includes(result.layoutEdit.placeholderPolicy)))
|
|
11155
|
-
|
|
11424
|
+
usage13("Layout application requires layout and placeholder policy.");
|
|
11156
11425
|
if (operation === "shapes.add" && (edit?.kind !== "text-box" || [edit.x, edit.y, edit.width, edit.height].some((value) => value === void 0)))
|
|
11157
|
-
|
|
11426
|
+
usage13("Master shape creation requires text-box kind and explicit geometry.");
|
|
11158
11427
|
if (operation === "shapes.set" && (!edit || !result.shape && !result.token))
|
|
11159
|
-
|
|
11428
|
+
usage13("Shape edits require update fields and a selected shape.");
|
|
11160
11429
|
if (operation === "themes.set" && (!result.themeEdit || result.themeEdit.colorSlot === void 0 !== (result.themeEdit.color === void 0) || result.themeEdit.fontSlot === void 0 !== (result.themeEdit.font === void 0)))
|
|
11161
|
-
|
|
11430
|
+
usage13("Theme set requires paired palette or font values, or a name.");
|
|
11162
11431
|
if (result.themeEdit?.colorSlot !== void 0 && !themeColorSlots.includes(result.themeEdit.colorSlot))
|
|
11163
|
-
|
|
11432
|
+
usage13("Unknown theme color slot.");
|
|
11164
11433
|
if (result.themeEdit?.fontSlot !== void 0 && !themeFontSlots.includes(result.themeEdit.fontSlot))
|
|
11165
|
-
|
|
11434
|
+
usage13("Unknown theme font slot.");
|
|
11166
11435
|
if (background && result.scope === "shared" && !result.part && !result.token)
|
|
11167
|
-
|
|
11436
|
+
usage13("Shared background scope requires an exact part or selector.");
|
|
11168
11437
|
if (operation === "backgrounds.set") {
|
|
11169
11438
|
if (!result.part && !result.token && result.slide === void 0 && !result.all)
|
|
11170
|
-
|
|
11439
|
+
usage13("Background mutation requires a selector or all.");
|
|
11171
11440
|
if (result.file === "-" && result.input === "-")
|
|
11172
|
-
|
|
11441
|
+
usage13("Presentation and image cannot both read stdin.");
|
|
11173
11442
|
const edit2 = result.backgroundEdit;
|
|
11174
11443
|
const required = {
|
|
11175
11444
|
solid: ["color"],
|
|
@@ -11178,24 +11447,24 @@ function parse(raw, maximum, output3) {
|
|
|
11178
11447
|
inherit: [],
|
|
11179
11448
|
"style-reference": ["styleIndex", "styleColor"]
|
|
11180
11449
|
};
|
|
11181
|
-
if (!edit2?.kind || !Object.hasOwn(required, edit2.kind))
|
|
11450
|
+
if (!edit2?.kind || !Object.hasOwn(required, edit2.kind)) usage13("Background kind is required.");
|
|
11182
11451
|
const fields2 = { ...edit2, ...result.file === void 0 ? {} : { file: result.file } };
|
|
11183
11452
|
const keys = required[edit2.kind];
|
|
11184
11453
|
if (keys.some((key) => !Object.hasOwn(fields2, key)) || Object.keys(fields2).some(
|
|
11185
11454
|
(key) => key !== "kind" && !keys.includes(key) && !(edit2.kind === "gradient" && key === "angle")
|
|
11186
11455
|
))
|
|
11187
|
-
|
|
11456
|
+
usage13("Background payload does not match its kind.");
|
|
11188
11457
|
}
|
|
11189
11458
|
if (mutation2) {
|
|
11190
|
-
if (result.inPlace && result.input === "-")
|
|
11191
|
-
if (result.inPlace && result.output)
|
|
11459
|
+
if (result.inPlace && result.input === "-") usage13("Stdin cannot be edited in place.");
|
|
11460
|
+
if (result.inPlace && result.output) usage13("Output and in-place cannot be combined.");
|
|
11192
11461
|
if (!result.dryRun && !result.inPlace && !result.output)
|
|
11193
|
-
|
|
11194
|
-
if (result.force && !result.output)
|
|
11462
|
+
usage13("Mutation requires a destination.");
|
|
11463
|
+
if (result.force && !result.output) usage13("Force requires an explicit output destination.");
|
|
11195
11464
|
if (result.output === result.input && result.output !== "-")
|
|
11196
|
-
|
|
11465
|
+
usage13("Replacing input requires --in-place.");
|
|
11197
11466
|
if (result.output === "-" && result.json && !result.dryRun)
|
|
11198
|
-
|
|
11467
|
+
usage13("Binary stdout cannot be combined with JSON.");
|
|
11199
11468
|
}
|
|
11200
11469
|
return result;
|
|
11201
11470
|
}
|
|
@@ -11222,20 +11491,20 @@ function parse(raw, maximum, output3) {
|
|
|
11222
11491
|
] : []
|
|
11223
11492
|
];
|
|
11224
11493
|
if ([...seen].some((flag) => !allowed.includes(flag)))
|
|
11225
|
-
|
|
11226
|
-
if (positionals.length !== 1 || !positionals[0])
|
|
11494
|
+
usage13("Option does not apply to this settings operation.");
|
|
11495
|
+
if (positionals.length !== 1 || !positionals[0]) usage13("Settings require one input.");
|
|
11227
11496
|
result.input = positionals[0];
|
|
11228
11497
|
if (mutation2) {
|
|
11229
|
-
if (!result.settings)
|
|
11230
|
-
if (result.inPlace && result.input === "-")
|
|
11231
|
-
if (result.inPlace && result.output)
|
|
11498
|
+
if (!result.settings) usage13("Settings set requires update fields.");
|
|
11499
|
+
if (result.inPlace && result.input === "-") usage13("Stdin cannot be edited in place.");
|
|
11500
|
+
if (result.inPlace && result.output) usage13("Output and in-place cannot be combined.");
|
|
11232
11501
|
if (!result.dryRun && !result.inPlace && !result.output)
|
|
11233
|
-
|
|
11234
|
-
if (result.force && !result.output)
|
|
11502
|
+
usage13("Mutation requires a destination.");
|
|
11503
|
+
if (result.force && !result.output) usage13("Force requires an explicit output destination.");
|
|
11235
11504
|
if (result.output === result.input && result.output !== "-")
|
|
11236
|
-
|
|
11505
|
+
usage13("Replacing input requires --in-place.");
|
|
11237
11506
|
if (result.output === "-" && result.json && !result.dryRun)
|
|
11238
|
-
|
|
11507
|
+
usage13("Binary stdout cannot be combined with JSON.");
|
|
11239
11508
|
}
|
|
11240
11509
|
return result;
|
|
11241
11510
|
}
|
|
@@ -11252,32 +11521,32 @@ function parse(raw, maximum, output3) {
|
|
|
11252
11521
|
...["add", "set"].includes(action) ? ["--name", "--slides", "--position"] : []
|
|
11253
11522
|
];
|
|
11254
11523
|
if ([...seen].some((flag) => !allowed.includes(flag)))
|
|
11255
|
-
|
|
11524
|
+
usage13("Option does not apply to this membership operation.");
|
|
11256
11525
|
if (positionals.length !== 1 || !positionals[0])
|
|
11257
|
-
|
|
11526
|
+
usage13("Membership operations require one input.");
|
|
11258
11527
|
result.input = positionals[0];
|
|
11259
11528
|
if (result.scope !== void 0 && result.scope !== "presentation")
|
|
11260
|
-
|
|
11529
|
+
usage13("Membership operations require presentation scope.");
|
|
11261
11530
|
if (result.token && ["--slide", "--scope", "--all"].some((flag) => seen.has(flag)))
|
|
11262
|
-
|
|
11531
|
+
usage13("Opaque and simple selectors cannot be combined.");
|
|
11263
11532
|
if (action === "add" && (result.membership?.name === void 0 || !result.membership.slides))
|
|
11264
|
-
|
|
11265
|
-
if (action === "set" && !result.membership)
|
|
11533
|
+
usage13("Membership creation requires name and slides.");
|
|
11534
|
+
if (action === "set" && !result.membership) usage13("Membership set requires update fields.");
|
|
11266
11535
|
if (mutation2) {
|
|
11267
|
-
if (result.inPlace && result.input === "-")
|
|
11268
|
-
if (result.inPlace && result.output)
|
|
11536
|
+
if (result.inPlace && result.input === "-") usage13("Stdin cannot be edited in place.");
|
|
11537
|
+
if (result.inPlace && result.output) usage13("Output and in-place cannot be combined.");
|
|
11269
11538
|
if (!result.dryRun && !result.inPlace && !result.output)
|
|
11270
|
-
|
|
11271
|
-
if (result.force && !result.output)
|
|
11539
|
+
usage13("Mutation requires a destination.");
|
|
11540
|
+
if (result.force && !result.output) usage13("Force requires an explicit output destination.");
|
|
11272
11541
|
if (result.output === result.input && result.output !== "-")
|
|
11273
|
-
|
|
11542
|
+
usage13("Replacing input requires --in-place.");
|
|
11274
11543
|
if (result.output === "-" && result.json && !result.dryRun)
|
|
11275
|
-
|
|
11544
|
+
usage13("Binary stdout cannot be combined with JSON.");
|
|
11276
11545
|
}
|
|
11277
11546
|
return result;
|
|
11278
11547
|
}
|
|
11279
11548
|
if (result.allowEmpty && !slideMutation)
|
|
11280
|
-
|
|
11549
|
+
usage13("Allow-empty requires a supported slide mutation.");
|
|
11281
11550
|
if (operation === "slides.merge" || operation === "slides.split") {
|
|
11282
11551
|
const allowed = [
|
|
11283
11552
|
"--json",
|
|
@@ -11294,36 +11563,36 @@ function parse(raw, maximum, output3) {
|
|
|
11294
11563
|
] : ["--slides", "--output-dir", "--allow-partial-output"]
|
|
11295
11564
|
];
|
|
11296
11565
|
if ([...seen].some((option) => !allowed.includes(option)))
|
|
11297
|
-
|
|
11566
|
+
usage13("Option does not apply to this assembly operation.");
|
|
11298
11567
|
if (positionals.length !== 1 || !positionals[0])
|
|
11299
|
-
|
|
11568
|
+
usage13("Assembly requires one destination or source input.");
|
|
11300
11569
|
result.input = positionals[0];
|
|
11301
11570
|
if (operation === "slides.split") {
|
|
11302
|
-
if (!result.splitSlides)
|
|
11303
|
-
if (!result.outputDir && !result.dryRun)
|
|
11304
|
-
if (result.outputDir === "-")
|
|
11305
|
-
if (result.force && !result.outputDir)
|
|
11571
|
+
if (!result.splitSlides) usage13("Split requires --slides.");
|
|
11572
|
+
if (!result.outputDir && !result.dryRun) usage13("Split requires --output-dir.");
|
|
11573
|
+
if (result.outputDir === "-") usage13("Output directories cannot be stdout.");
|
|
11574
|
+
if (result.force && !result.outputDir) usage13("Force requires an output directory.");
|
|
11306
11575
|
} else {
|
|
11307
11576
|
if (!result.sources || !result.importing?.themePolicy)
|
|
11308
|
-
|
|
11577
|
+
usage13("Merge requires sources and an explicit theme policy.");
|
|
11309
11578
|
if ([result.input, ...result.sources].filter((path) => path === "-").length > 1)
|
|
11310
|
-
|
|
11311
|
-
if (result.inPlace && result.input === "-")
|
|
11312
|
-
if (result.inPlace && result.output)
|
|
11579
|
+
usage13("Only one input may consume stdin.");
|
|
11580
|
+
if (result.inPlace && result.input === "-") usage13("Stdin cannot be edited in place.");
|
|
11581
|
+
if (result.inPlace && result.output) usage13("Output and in-place cannot be combined.");
|
|
11313
11582
|
if (!result.dryRun && !result.inPlace && !result.output)
|
|
11314
|
-
|
|
11315
|
-
if (result.force && !result.output)
|
|
11583
|
+
usage13("Merge requires a destination.");
|
|
11584
|
+
if (result.force && !result.output) usage13("Force requires an explicit output destination.");
|
|
11316
11585
|
if (result.output === result.input && result.output !== "-")
|
|
11317
|
-
|
|
11586
|
+
usage13("Replacing input requires --in-place.");
|
|
11318
11587
|
if (result.sources.includes(result.inPlace ? result.input : result.output ?? "") && (result.inPlace || result.output !== "-"))
|
|
11319
|
-
|
|
11588
|
+
usage13("Merge output cannot replace a source.");
|
|
11320
11589
|
if (result.output === "-" && result.json && !result.dryRun)
|
|
11321
|
-
|
|
11590
|
+
usage13("Binary stdout cannot be combined with JSON.");
|
|
11322
11591
|
}
|
|
11323
11592
|
return result;
|
|
11324
11593
|
}
|
|
11325
11594
|
if (operation === "create") {
|
|
11326
|
-
if (positionals.length)
|
|
11595
|
+
if (positionals.length) usage13("Creation takes no input positional arguments.");
|
|
11327
11596
|
const allowed = [
|
|
11328
11597
|
"--width",
|
|
11329
11598
|
"--height",
|
|
@@ -11341,11 +11610,11 @@ function parse(raw, maximum, output3) {
|
|
|
11341
11610
|
"--dry-run"
|
|
11342
11611
|
];
|
|
11343
11612
|
if ([...seen].some((option) => !allowed.includes(option)))
|
|
11344
|
-
|
|
11345
|
-
if (!result.output && !result.dryRun)
|
|
11346
|
-
if (result.force && !result.output)
|
|
11613
|
+
usage13("Option does not apply to creation.");
|
|
11614
|
+
if (!result.output && !result.dryRun) usage13("Creation requires an output destination.");
|
|
11615
|
+
if (result.force && !result.output) usage13("Force requires an explicit output destination.");
|
|
11347
11616
|
if (result.output === "-" && result.json && !result.dryRun)
|
|
11348
|
-
|
|
11617
|
+
usage13("Binary stdout cannot be combined with JSON.");
|
|
11349
11618
|
return result;
|
|
11350
11619
|
}
|
|
11351
11620
|
if (operation === "slides.import") {
|
|
@@ -11363,14 +11632,14 @@ function parse(raw, maximum, output3) {
|
|
|
11363
11632
|
"--dry-run"
|
|
11364
11633
|
];
|
|
11365
11634
|
if ([...seen].some((option) => !allowed.includes(option)))
|
|
11366
|
-
|
|
11635
|
+
usage13("Option does not apply to slide import.");
|
|
11367
11636
|
if (!result.source || !result.importing?.sourceSlides)
|
|
11368
|
-
|
|
11369
|
-
if (positionals[0] === "-" && result.source === "-")
|
|
11637
|
+
usage13("Import requires source and source slides.");
|
|
11638
|
+
if (positionals[0] === "-" && result.source === "-") usage13("Only one input may consume stdin.");
|
|
11370
11639
|
if (result.output === result.source && result.output !== "-")
|
|
11371
|
-
|
|
11640
|
+
usage13("Import output cannot replace its source.");
|
|
11372
11641
|
if (result.inPlace && positionals[0] === result.source)
|
|
11373
|
-
|
|
11642
|
+
usage13("Import in-place destination must differ from source.");
|
|
11374
11643
|
} else if (operation === "slides.add") {
|
|
11375
11644
|
const allowed = [
|
|
11376
11645
|
"--layout",
|
|
@@ -11389,11 +11658,11 @@ function parse(raw, maximum, output3) {
|
|
|
11389
11658
|
"--dry-run"
|
|
11390
11659
|
];
|
|
11391
11660
|
if ([...seen].some((option) => !allowed.includes(option)))
|
|
11392
|
-
|
|
11661
|
+
usage13("Option does not apply to slide addition.");
|
|
11393
11662
|
if (positionals.length !== 1 || !positionals[0])
|
|
11394
|
-
|
|
11663
|
+
usage13("Slide addition requires exactly one input.");
|
|
11395
11664
|
result.input = positionals[0];
|
|
11396
|
-
if (!result.addition?.layout)
|
|
11665
|
+
if (!result.addition?.layout) usage13("Slide addition requires --layout.");
|
|
11397
11666
|
} else if (slideMutation) {
|
|
11398
11667
|
const allowed = [
|
|
11399
11668
|
"--selection-json",
|
|
@@ -11413,29 +11682,29 @@ function parse(raw, maximum, output3) {
|
|
|
11413
11682
|
...operation === "slides.set" ? ["--name", "--hidden"] : []
|
|
11414
11683
|
];
|
|
11415
11684
|
if ([...seen].some((option) => !allowed.includes(option)))
|
|
11416
|
-
|
|
11685
|
+
usage13("Option does not apply to this slide mutation.");
|
|
11417
11686
|
if (seen.has("--selection-json") && ["--slide", "--select", "--scope", "--all"].some((flag) => seen.has(flag)))
|
|
11418
|
-
|
|
11687
|
+
usage13("Structured and simple selectors cannot be combined.");
|
|
11419
11688
|
if (!seen.has("--selection-json") && result.slide === void 0 && !result.token && !result.all)
|
|
11420
|
-
|
|
11689
|
+
usage13("Slide mutation requires a selector or --all.");
|
|
11421
11690
|
if (operation !== "slides.remove" && (!result.mutation || (operation === "slides.move" || operation === "slides.duplicate") && result.mutation.position === void 0))
|
|
11422
|
-
|
|
11691
|
+
usage13("Slide mutation requires update fields; move/duplicate require --position.");
|
|
11423
11692
|
if (result.scope !== void 0 && result.scope !== "slides")
|
|
11424
|
-
|
|
11693
|
+
usage13("Slide mutations require slides scope.");
|
|
11425
11694
|
} else if (operation === "validate") {
|
|
11426
11695
|
if ([...seen].some((flag) => flag !== "--json" && flag !== "--limit"))
|
|
11427
|
-
|
|
11696
|
+
usage13("Option does not apply to validation.");
|
|
11428
11697
|
if (result.limits && ["maxOutputs", "maxOutputBytes"].some((name) => Object.hasOwn(result.limits, name)))
|
|
11429
|
-
|
|
11430
|
-
if (positionals.length !== 1 || !positionals[0])
|
|
11698
|
+
usage13("Output limits do not apply to validation.");
|
|
11699
|
+
if (positionals.length !== 1 || !positionals[0]) usage13("Validation requires exactly one nonempty input.");
|
|
11431
11700
|
result.input = positionals[0];
|
|
11432
11701
|
return result;
|
|
11433
11702
|
} else if (operation !== "inspect" && !xml) {
|
|
11434
11703
|
if ([...seen].some((option) => option !== "--json" && !(operation === "capabilities" && option === "--limit")))
|
|
11435
|
-
|
|
11704
|
+
usage13("Selection options require inspect.");
|
|
11436
11705
|
if (operation === "capabilities") {
|
|
11437
|
-
if (result.limits && Object.hasOwn(result.limits, "maxOutputs"))
|
|
11438
|
-
if (positionals.length > 1 || positionals[0] === "")
|
|
11706
|
+
if (result.limits && Object.hasOwn(result.limits, "maxOutputs")) usage13("Output-count limits do not apply to capabilities.");
|
|
11707
|
+
if (positionals.length > 1 || positionals[0] === "") usage13("Capabilities accepts at most one nonempty input.");
|
|
11439
11708
|
if (positionals[0] !== void 0) result.input = positionals[0];
|
|
11440
11709
|
return result;
|
|
11441
11710
|
}
|
|
@@ -11496,43 +11765,43 @@ function parse(raw, maximum, output3) {
|
|
|
11496
11765
|
result.schemaPath = positionals.join(".");
|
|
11497
11766
|
return result;
|
|
11498
11767
|
}
|
|
11499
|
-
if (positionals.length)
|
|
11768
|
+
if (positionals.length) usage13("Unexpected input.");
|
|
11500
11769
|
return result;
|
|
11501
11770
|
}
|
|
11502
|
-
if (positionals.length !== 1)
|
|
11771
|
+
if (positionals.length !== 1) usage13("Inspection requires exactly one input.");
|
|
11503
11772
|
result.input = positionals[0];
|
|
11504
|
-
if (result.input.length === 0)
|
|
11773
|
+
if (result.input.length === 0) usage13("Input path must not be empty.");
|
|
11505
11774
|
if (result.token && ["--slide", "--shape", "--part", "--scope", "--all"].some((option) => seen.has(option)))
|
|
11506
|
-
|
|
11775
|
+
usage13("Opaque and simple selectors cannot be combined.");
|
|
11507
11776
|
if (result.part && result.slide !== void 0)
|
|
11508
|
-
|
|
11777
|
+
usage13("Part and slide selectors cannot be combined.");
|
|
11509
11778
|
if (result.shape && result.slide === void 0 && !result.part)
|
|
11510
|
-
|
|
11779
|
+
usage13("Shape selection requires an owning slide or part.");
|
|
11511
11780
|
if (result.slide !== void 0 && result.scope !== void 0 && result.scope !== "slides")
|
|
11512
|
-
|
|
11781
|
+
usage13("Slide positions require slides scope.");
|
|
11513
11782
|
const mutationOptions = ["--file", "--output", "--in-place", "--force", "--dry-run"];
|
|
11514
11783
|
if (operation !== "xml.set" && operation !== "slides.add" && operation !== "slides.import" && !slideMutation && mutationOptions.some((option) => seen.has(option)))
|
|
11515
|
-
|
|
11784
|
+
usage13("Publication options require xml set.");
|
|
11516
11785
|
if (!xml && operation !== "inspect" && operation !== "slides.add" && operation !== "slides.import" && !slideMutation && result.limits)
|
|
11517
|
-
|
|
11518
|
-
if (operation !== "xml.get" && result.pretty)
|
|
11786
|
+
usage13("Limit overrides require inspect, XML operations or slides add.");
|
|
11787
|
+
if (operation !== "xml.get" && result.pretty) usage13("Pretty output requires xml get.");
|
|
11519
11788
|
if (xml) {
|
|
11520
11789
|
if (result.slide !== void 0 || result.shape || result.all)
|
|
11521
|
-
|
|
11522
|
-
if (!result.part && !result.token)
|
|
11790
|
+
usage13("XML operations require one part selector.");
|
|
11791
|
+
if (!result.part && !result.token) usage13("XML operations require a part or opaque selector.");
|
|
11523
11792
|
}
|
|
11524
11793
|
if (operation === "xml.set" || operation === "slides.add" || operation === "slides.import" || slideMutation) {
|
|
11525
|
-
if (operation === "xml.set" && !result.file)
|
|
11526
|
-
if (result.input === "-" && result.file === "-")
|
|
11527
|
-
if (result.inPlace && result.input === "-")
|
|
11528
|
-
if (result.inPlace && result.output)
|
|
11794
|
+
if (operation === "xml.set" && !result.file) usage13("XML replacement requires --file.");
|
|
11795
|
+
if (result.input === "-" && result.file === "-") usage13("Only one input may consume stdin.");
|
|
11796
|
+
if (result.inPlace && result.input === "-") usage13("Stdin cannot be edited in place.");
|
|
11797
|
+
if (result.inPlace && result.output) usage13("Output and in-place cannot be combined.");
|
|
11529
11798
|
if (!result.dryRun && !result.inPlace && !result.output)
|
|
11530
|
-
|
|
11531
|
-
if (result.force && !result.output)
|
|
11799
|
+
usage13("Mutation requires a destination.");
|
|
11800
|
+
if (result.force && !result.output) usage13("Force requires an explicit output destination.");
|
|
11532
11801
|
if (result.output === result.input && result.output !== "-")
|
|
11533
|
-
|
|
11802
|
+
usage13("Replacing input requires --in-place.");
|
|
11534
11803
|
if (result.output === "-" && result.json && !result.dryRun)
|
|
11535
|
-
|
|
11804
|
+
usage13("Binary stdout cannot be combined with JSON.");
|
|
11536
11805
|
}
|
|
11537
11806
|
return result;
|
|
11538
11807
|
}
|
|
@@ -11601,7 +11870,7 @@ async function transferLocations(bytes, budget) {
|
|
|
11601
11870
|
(edge) => relationshipNamespaces.some((namespace) => edge.type === `${namespace}/officeDocument`)
|
|
11602
11871
|
);
|
|
11603
11872
|
const root = roots.length === 1 ? roots[0].targetPart : void 0;
|
|
11604
|
-
if (!root) throw new
|
|
11873
|
+
if (!root) throw new OfficeError19("invalid-opc", "Presentation part is missing.", "index");
|
|
11605
11874
|
const relationshipNamespace = roots[0].type.slice(0, -"/officeDocument".length);
|
|
11606
11875
|
const xml = budget.xml(reader.get(root));
|
|
11607
11876
|
const fingerprint = Array.from(sha2564(bytes), (byte) => byte.toString(16).padStart(2, "0")).join(
|
|
@@ -11620,7 +11889,7 @@ async function transferLocations(bytes, budget) {
|
|
|
11620
11889
|
(edge) => edge.id === reference && edge.type === `${relationshipNamespace}/slide`
|
|
11621
11890
|
)?.targetPart;
|
|
11622
11891
|
if (!id || !owner || !reader.has(owner))
|
|
11623
|
-
throw new
|
|
11892
|
+
throw new OfficeError19("invalid-opc", "Referenced slide is missing.", "index");
|
|
11624
11893
|
return {
|
|
11625
11894
|
fingerprint,
|
|
11626
11895
|
scope: "slides",
|
|
@@ -11688,6 +11957,7 @@ async function executeRequest(request, options2, owned) {
|
|
|
11688
11957
|
if (request.args?.[0] instanceof Uint8Array && request.args[0].length === 4 && request.args[0].every((byte, index) => byte === [100, 105, 102, 102][index]))
|
|
11689
11958
|
return executeDiffCommand(request, options2);
|
|
11690
11959
|
const output3 = { json: false, operation: "help" };
|
|
11960
|
+
let retainedExtraction;
|
|
11691
11961
|
let result;
|
|
11692
11962
|
let exitCode = 0;
|
|
11693
11963
|
let stagedOutput;
|
|
@@ -11702,7 +11972,7 @@ async function executeRequest(request, options2, owned) {
|
|
|
11702
11972
|
let allowPartialOutput = false;
|
|
11703
11973
|
try {
|
|
11704
11974
|
request.signal.throwIfAborted();
|
|
11705
|
-
if (!Array.isArray(request.args))
|
|
11975
|
+
if (!Array.isArray(request.args)) usage13("Arguments must be byte arrays.");
|
|
11706
11976
|
const args = parse(request.args, options2.maxArgumentBytes, output3);
|
|
11707
11977
|
if (args.limits) {
|
|
11708
11978
|
const validation = options2.context.validationLimits;
|
|
@@ -11728,7 +11998,70 @@ async function executeRequest(request, options2, owned) {
|
|
|
11728
11998
|
output3.json = args.json;
|
|
11729
11999
|
output3.operation = args.operation;
|
|
11730
12000
|
const operation2 = args.operation;
|
|
11731
|
-
if (args.operation === "
|
|
12001
|
+
if (args.operation === "pack" && request.streaming) {
|
|
12002
|
+
if (args.creation?.author !== void 0 || args.creation?.timestamp !== void 0) throw new OfficeError19("unsupported-edit", "Pack metadata overrides are unavailable; source properties are preserved.", "validate-intent");
|
|
12003
|
+
const streaming = request.streaming, context = { ...options2.context, signal: request.signal, workingStorage: streaming.workingStorage };
|
|
12004
|
+
const input = await streaming.openInput(args.manifest, Math.min(context.limits.maxBytes, context.xmlLimits.maxBytes));
|
|
12005
|
+
const manifest = await openRetainedPackManifest(input.stream(), context, { manifest: args.manifest, ...args.output === void 0 ? {} : { output: args.output } });
|
|
12006
|
+
owned.push(manifest);
|
|
12007
|
+
let total = 0;
|
|
12008
|
+
const packed = await stageRetainedPackage(manifest.members(), async function* (part) {
|
|
12009
|
+
const source3 = await streaming.openInput(await manifest.path(part), Math.min(context.limits.maxBytes, context.archiveLimits.maxEntryBytes, context.archiveLimits.maxTotalBytes - total));
|
|
12010
|
+
total += source3.size;
|
|
12011
|
+
yield* source3.stream();
|
|
12012
|
+
}, context, args.creation?.kind ? { kind: args.creation.kind } : {});
|
|
12013
|
+
owned.push(packed);
|
|
12014
|
+
if (packed.size > options2.maxOutputBytes) throw new OfficeError19("resource-limit", "Packed output exceeds byte limit.", "validate-intent");
|
|
12015
|
+
const dryRun = args.dryRun ?? false;
|
|
12016
|
+
result = {
|
|
12017
|
+
version: 1,
|
|
12018
|
+
operation: operation2,
|
|
12019
|
+
ok: true,
|
|
12020
|
+
warnings: [],
|
|
12021
|
+
errors: [],
|
|
12022
|
+
locations: [],
|
|
12023
|
+
affected: packed.count,
|
|
12024
|
+
data: { effects: ["packed"], outputs: dryRun ? [] : [{ path: args.output, sha256: packed.fingerprint, bytes: packed.size }], fingerprint: dryRun ? null : packed.fingerprint, dryRun }
|
|
12025
|
+
};
|
|
12026
|
+
human = `${dryRun ? "Validated" : "Packed"} ${packed.count} package part(s)
|
|
12027
|
+
`;
|
|
12028
|
+
if (args.output && args.output !== "-") {
|
|
12029
|
+
if (!request.publishOutput) throw Object.assign(new Error("Output publication unavailable."), { code: "publication-unsupported" });
|
|
12030
|
+
publication = { outputPath: args.output, protectedInputPaths: manifest.paths(), bytes: packed.bytes(), originalBytes: input, inPlace: false, force: args.force ?? false, dryRun };
|
|
12031
|
+
} else if (args.output === "-" && !dryRun) stagedOutput = { close: packed.close, async write(sink) {
|
|
12032
|
+
for await (const bytes of packed.bytes()) await sink.write(bytes);
|
|
12033
|
+
} };
|
|
12034
|
+
} else if (args.operation === "extract" && request.streaming && (!request.publishOutputs || request.publishOutputStreams) && (!request.preflightOutput || request.preflightOutputStream)) {
|
|
12035
|
+
retainedExtraction = await prepareRetainedExtraction(args, request, options2);
|
|
12036
|
+
owned.push(retainedExtraction);
|
|
12037
|
+
result = success(operation2, null);
|
|
12038
|
+
} else if (args.operation === "xml.set" && request.streaming) {
|
|
12039
|
+
if (args.token) decodeSelectionToken2(args.token);
|
|
12040
|
+
const streaming = request.streaming, context = { ...options2.context, signal: request.signal, workingStorage: streaming.workingStorage };
|
|
12041
|
+
if (!context.validationLimits) throw new OfficeError19("invalid-value", "XML operations require explicit validation limits.", "usage");
|
|
12042
|
+
const input = await streaming.openInput(args.input, Math.min(context.limits.maxBytes, context.archiveLimits.maxArchiveBytes));
|
|
12043
|
+
const maxReplacementBytes = Math.min(context.validationLimits.maxBytes, context.archiveLimits.maxEntryBytes), file = args.file;
|
|
12044
|
+
async function* replacement() {
|
|
12045
|
+
const source3 = await streaming.openInput(file, maxReplacementBytes);
|
|
12046
|
+
yield* source3.stream();
|
|
12047
|
+
}
|
|
12048
|
+
const destination = args.inPlace ? args.input : args.output, dryRun = args.dryRun ?? false;
|
|
12049
|
+
const staged = await stageRetainedXmlReplacement(input, replacement(), {
|
|
12050
|
+
...args.token === void 0 ? {} : { token: args.token },
|
|
12051
|
+
...args.slide === void 0 ? {} : { slide: args.slide },
|
|
12052
|
+
...args.shape === void 0 ? {} : { shape: args.shape },
|
|
12053
|
+
...args.part === void 0 ? {} : { part: args.part },
|
|
12054
|
+
...args.scope === void 0 ? {} : { scope: args.scope },
|
|
12055
|
+
...args.all === void 0 ? {} : { all: args.all }
|
|
12056
|
+
}, context, { json: args.json, dryRun, ...destination === void 0 ? {} : { destination }, maxOutputBytes: options2.maxOutputBytes });
|
|
12057
|
+
owned.push(staged);
|
|
12058
|
+
stagedOutput = staged.output;
|
|
12059
|
+
if (destination && destination !== "-") {
|
|
12060
|
+
if (!request.publishOutput) throw Object.assign(new Error("Output publication capability is unavailable."), { code: "publication-unsupported" });
|
|
12061
|
+
publication = { inputPath: args.input, outputPath: destination, bytes: staged.bytes(), originalBytes: input, inPlace: args.inPlace ?? false, force: args.force ?? false, dryRun };
|
|
12062
|
+
}
|
|
12063
|
+
result = success(operation2, null);
|
|
12064
|
+
} else if (args.operation === "slides.set" && request.streaming) {
|
|
11732
12065
|
if (args.token) decodeSelectionToken2(args.token);
|
|
11733
12066
|
const input = await request.streaming.openInput(args.input, Math.min(options2.context.limits.maxBytes, options2.context.archiveLimits.maxArchiveBytes));
|
|
11734
12067
|
const destination = args.inPlace ? args.input : args.output;
|
|
@@ -11745,7 +12078,7 @@ async function executeRequest(request, options2, owned) {
|
|
|
11745
12078
|
publication = { inputPath: args.input, outputPath: destination, bytes: staged.bytes(), originalBytes: input, inPlace: args.inPlace ?? false, force: args.force ?? false, dryRun };
|
|
11746
12079
|
}
|
|
11747
12080
|
result = success(operation2, null);
|
|
11748
|
-
} else if ((args.operation === "inspect" || args.operation === "text.get" || args.operation === "fields.list" || args.operation === "fields.get" || args.operation === "xml.get") && request.streaming) {
|
|
12081
|
+
} else if ((args.operation === "inspect" || args.operation === "text.get" || args.operation === "fields.list" || args.operation === "fields.get" || args.operation === "text.frames.list" || args.operation === "text.frames.get" || args.operation === "xml.get") && request.streaming) {
|
|
11749
12082
|
if (args.token) decodeSelectionToken2(args.token);
|
|
11750
12083
|
const input = await request.streaming.openInput(args.input, Math.min(options2.context.limits.maxBytes, options2.context.archiveLimits.maxArchiveBytes));
|
|
11751
12084
|
const hash = sha2564.create();
|
|
@@ -11780,7 +12113,7 @@ async function executeRequest(request, options2, owned) {
|
|
|
11780
12113
|
}, context, { json: args.json, maxOutputBytes: options2.maxOutputBytes });
|
|
11781
12114
|
} catch (error) {
|
|
11782
12115
|
failed = true;
|
|
11783
|
-
if (error instanceof
|
|
12116
|
+
if (error instanceof OfficeError19 && error.code === "resource-limit" && error.phase === "publish") return outputLimitFailure(operation2, args.json);
|
|
11784
12117
|
throw error;
|
|
11785
12118
|
} finally {
|
|
11786
12119
|
try {
|
|
@@ -11805,7 +12138,7 @@ async function executeRequest(request, options2, owned) {
|
|
|
11805
12138
|
let failed = false;
|
|
11806
12139
|
try {
|
|
11807
12140
|
validation = await openRetainedPresentationValidation(archive, context, limits);
|
|
11808
|
-
if (!validation.valid) throw new
|
|
12141
|
+
if (!validation.valid) throw new OfficeError19("invalid-opc", "Presentation semantic validation failed.", "index");
|
|
11809
12142
|
result = success(operation2, { valid: true, schema: validation.schema, rules: validation.rules, issues: [] });
|
|
11810
12143
|
} catch (error) {
|
|
11811
12144
|
failed = true;
|
|
@@ -11820,15 +12153,15 @@ async function executeRequest(request, options2, owned) {
|
|
|
11820
12153
|
const bytes = await request.readInput(args.input, maxBytes);
|
|
11821
12154
|
const reader = await readPackage3(bytes, { ...options2.context, signal: request.signal });
|
|
11822
12155
|
const validation = validatePresentation(reader, limits);
|
|
11823
|
-
if (!validation.valid) throw new
|
|
12156
|
+
if (!validation.valid) throw new OfficeError19("invalid-opc", "Presentation semantic validation failed.", "index");
|
|
11824
12157
|
result = success(operation2, validation);
|
|
11825
12158
|
}
|
|
11826
12159
|
human = "Presentation is semantically valid; XML schema validation not checked.\n";
|
|
11827
12160
|
} else if (args.operation === "help") {
|
|
11828
|
-
const
|
|
12161
|
+
const usage14 = args.schemaPath === "validate" ? "Usage: pptx validate INPUT [--json] [--limit NAME=VALUE]\nBounded semantic validation; XML schema validation is not checked.\n" : args.schemaPath && Object.hasOwn(packageToolsSchemas, args.schemaPath) ? packageToolsUsage : args.schemaPath === "objects.add" ? objectsAddUsage : args.schemaPath && Object.hasOwn(opaqueSchemas, args.schemaPath) ? opaqueUsage : args.schemaPath?.startsWith("equations.") ? equationsUsage : args.schemaPath === "text.fit" ? "Usage: pptx text fit INPUT --metrics JSON [selection] [output]\nSelection: --slide N --shape NAME | --select TOKEN | --all\nOutput: --output PATH | --in-place | --dry-run\n--font-family NAME --min-size N --max-size N\n--bold true|false --italic true|false --wrap true|false\n--margin-left LENGTH --margin-right LENGTH\n--margin-top LENGTH --margin-bottom LENGTH --line-spacing MULTIPLIER\n--json --allow-empty --force --scope SCOPE --limit NAME=VALUE\nDefaults: Calibri, 1..18pt, regular, wrap, line spacing 1.\nSupplied scalar metrics; horizontal single-column shapes with local extents.\nNo host font discovery. Platform rendering may differ.\n" : args.schemaPath?.startsWith("text.frames.") ? frameHelp : args.schemaPath?.startsWith("text.paragraphs.") ? paragraphHelp : args.schemaPath?.startsWith("text.runs.") ? runHelp : help;
|
|
11829
12162
|
let resolvedUsage = args.schemaPath === "shapes.remove" ? "Usage: pptx shapes remove INPUT --slide N --shape NAME [--detach-policy detach|remove] [output]\nSelection also accepts --select TOKEN or --all. Referenced targets require explicit policy.\nDetach keeps connectors with free coordinates; remove deletes affected connectors. Timing references reject deletion.\nOutput: --output PATH | --in-place | --dry-run; --force --json --limit NAME=VALUE.\n" : args.schemaPath?.startsWith("tables.") ? "Usage: pptx tables list|get|add|set|merge|split INPUT [--slide N --table N --cell row,column] [properties] [output]\nMerge: --from row,column --to row,column; split: --cell row,column (merge origin).\nRows/columns: tables rows|columns add|remove INPUT --position N --span-policy expand|shrink|reject\nInsertion accepts expand/reject; deletion accepts shrink/reject. Partial intersecting merges fail.\nAdd: --rows N --columns N --left LENGTH --top LENGTH --width LENGTH --height LENGTH [--data JSON]\nPlaceholder add: --slide N --placeholder IDX --rows N --columns N. Inherits position/width; rows set height.\nSet: --text TEXT (one cell), --data JSON, --row-height LENGTH, --column-width LENGTH, --style ID\nFormatting: --fill RGB --border-color RGB --border-width LENGTH --margin-left|right|top|bottom LENGTH\nStyle flags: --first-row|last-row|first-col|last-col|horz-band|vert-band true|false; --vertical-anchor top|middle|bottom\nOutput: --output PATH or --in-place; --dry-run validates without publication. Selectors are one-based.\n" : args.schemaPath?.startsWith("connectors.") ? "Usage: pptx connectors list|get|add|set|remove INPUT [selection] [properties] [output]\nSelection: --slide N [--shape NAME | --all] | --select TOKEN.\nAdd requires --kind STRAIGHT|ELBOW|CURVE --begin-x LENGTH --begin-y LENGTH --end-x LENGTH --end-y LENGTH.\nAttach: --begin-target LOCATION_JSON --end-target LOCATION_JSON --site N (zero-based).\nSet target null to detach one endpoint; --detach-policy detach detaches both, remove removes the connector.\nLengths use explicit emu/in/cm/mm/pt in parent coordinates. --name TEXT sets the name.\nLine: --line-color RGB|solid|null --line-width LENGTH|null. Solid preserves existing solid color.\nOutput: --output PATH | --in-place | --dry-run; --force --json --limit NAME=VALUE.\nTargets: rect/ellipse/roundRect sites 0..3. Grouped connectors require same-parent targets.\nNonzero-rotated coordinate edits reject; arbitrary routing/guide geometry is preserve-only.\n" : ["shapes.move", "shapes.align", "shapes.distribute", "shapes.duplicate"].includes(
|
|
11830
12163
|
args.schemaPath ?? ""
|
|
11831
|
-
) ? "Usage: pptx shapes move|align|distribute|duplicate INPUT [selection] --coordinate-system slide|group [output]\nSelection: --shapes JSON Location array, or --slide N [--shape NAME | --all], or --select TOKEN.\nMove: --order front|back|forward|backward OR --position N (one-based).\nAlign: --alignment left|center|right|top|middle|bottom. Distribute: --axis horizontal|vertical.\nDuplicate: --offset-x LENGTH --offset-y LENGTH (explicit units, signed offsets).\nHidden siblings participate; locked selections fail. Mixed slides or parent groups fail.\nOutput: --output PATH | --in-place | --dry-run; --force, --json, --limit NAME=VALUE.\n" : args.schemaPath?.startsWith("shapes.paths.") ? "Usage: pptx shapes paths list|get|add|set INPUT [selection] [path] [output]\nRead: list|get INPUT [selection]. Add/set require --path JSON or --vertices JSON.\nPath: {unit:emu,width,height,commands:[move|line|quadratic|cubic|close]}\nCoordinates: integer local EMUs, -2147483647..2147483647; viewport 1..2147483647.\nAt most 4096 commands; explicit closure; command order preserved without winding evaluation.\nAlternatively --vertices JSON --close true|false uses {x,y} local EMU vertices and a derived viewport.\nAdd placement: --left LENGTH --top LENGTH --width LENGTH --height LENGTH.\nAdd accepts shape name, text, paint and metadata properties. Lengths require emu/in/cm/mm/pt.\nSelection: --slide N [--shape NAME] | --part URI --scope SCOPE | --select TOKEN.\nSet: selects one shape unless --all; --allow-empty accepts zero matches.\nScopes: slides (default), layouts, masters; shared requires --part URI.\nOutput: --output PATH | --in-place | --dry-run; --force --json --limit NAME=VALUE.\nUnsupported formulas, arcs and arbitrary existing geometry are preserve-only.\n" : ["shapes.group", "shapes.ungroup"].includes(args.schemaPath ?? "") ? "Usage: pptx shapes group|ungroup INPUT --tolerance LENGTH [selection] [output]\nGroup: --shapes JSON array of at least two inspected Location objects.\nShapes must be distinct contiguous siblings; original IDs and z-order are retained.\nUngroup: --slide N --shape NAME | --select TOKEN; selects one group.\nSelection: --part URI --scope SCOPE. Exact cardinality; --all/--allow-empty are unsupported.\nTolerance is explicit nonnegative EMU precision using emu/in/cm/mm/pt lengths.\nIdentity groups preserve child XML; transformed ungrouping supports nested groups and rectangles\nwithout text, styles or strokes.\nTransformed ungrouping supports quarter-turn rotation chains only.\nWorld geometry must remain within tolerance; unsupported geometry and references fail.\nOutput: --output PATH | --in-place | --dry-run; --force --json --limit NAME=VALUE.\n" : args.schemaPath?.startsWith("shapes.drawing.") || args.schemaPath === "shapes.effects.set" ? "Usage: pptx shapes drawing get|set INPUT [selection] [paint] [output]\n pptx shapes effects set INPUT [selection] --shadow true|false\n --opacity RATIO --shadow-blur LENGTH --shadow-color COLOR [output]\nPaint: --fill-kind inherit|none|solid|gradient|pattern|picture\n --color COLOR; gradient: --stops JSON --angle DEGREES\n pattern: --pattern PRESET [--foreground COLOR --background COLOR]\n picture: --file PATH --mode stretch|tile\nAdvanced paint: --fill JSON --line JSON --shadow-inherit true|false\nCOLOR is six-digit RGB or JSON with rgb/theme, optional brightness and opacity.\nSelection: --slide N --shape NAME | --part URI --scope SCOPE | --select TOKEN\nScopes: slides (default), layouts, masters; shared requires a part.\nSet selects one shape unless --all; --allow-empty accepts zero matches.\nOutput: --output PATH | --in-place | --dry-run; --force --json --limit NAME=VALUE.\nLengths require emu/in/cm/mm/pt. Simple shadows have zero offset.\nComplex effects and 3D remain intact; editing unsupported effects fails.\n" : args.schemaPath?.startsWith("shapes.") ? "Usage: pptx shapes list|get|add|set INPUT [selection] [properties] [output]\nSelection: --slide N --shape NAME | --select TOKEN; --part URI --scope SCOPE\nScopes: slides (default), layouts, masters; shared requires a part.\nAdd: --kind text-box|PRESET --left LENGTH --top LENGTH --width LENGTH --height LENGTH\nProperties: --name TEXT --text TEXT --title TEXT --description TEXT --alt-text TEXT\n --locked true|false|null --rotation DEGREES --fill RGB --line-color RGB --line-width LENGTH\n --flip-horizontal true|false --flip-vertical true|false\n --adjustments JSON_ARRAY (normalized preset values in guide order)\n Geometry uses parent coordinates; inspection corners use slide EMUs.\nLengths require emu/in/cm/mm/pt. Presets use enum names or numeric values from schema.\nNull clears direct title/description/lock; null fill/line color disables fill/line.\nOmitted values stay unchanged.\nNull line width restores inherited width.\nFill/line color solid selects solid fill; existing solid colors are retained.\nShape IDs are read-only. Unsupported geometry and advanced formatting are preserve-only.\nOutput: --output PATH | --in-place | --dry-run; --force --json --limit NAME=VALUE\nSet: --all edits every match; --allow-empty accepts zero matches.\n" : args.schemaPath?.startsWith("fields.") ? "Usage: pptx fields list|get|set|add|remove INPUT [options]\nSelection: --slide N --shape NAME | --select TOKEN\n --scope SCOPE --json --limit NAME=VALUE\nMutation: --all --allow-empty\nOutput: --output PATH | --in-place | --dry-run; --force\nSet/add: --kind slide-number|date|footer|header\n --update preserve|explicit --text TEXT --timestamp UTC\nAdd requires --kind and one text body; appends to its last paragraph.\nPreserve is default: retains the cache (empty on add), rejects text/time.\nExplicit requires text; date fields also require a caller UTC timestamp.\nNo field evaluation, automatic numbering or inherited-content flattening.\nList/get are read-only; get requires one field. Remove accepts no policy.\n" :
|
|
12164
|
+
) ? "Usage: pptx shapes move|align|distribute|duplicate INPUT [selection] --coordinate-system slide|group [output]\nSelection: --shapes JSON Location array, or --slide N [--shape NAME | --all], or --select TOKEN.\nMove: --order front|back|forward|backward OR --position N (one-based).\nAlign: --alignment left|center|right|top|middle|bottom. Distribute: --axis horizontal|vertical.\nDuplicate: --offset-x LENGTH --offset-y LENGTH (explicit units, signed offsets).\nHidden siblings participate; locked selections fail. Mixed slides or parent groups fail.\nOutput: --output PATH | --in-place | --dry-run; --force, --json, --limit NAME=VALUE.\n" : args.schemaPath?.startsWith("shapes.paths.") ? "Usage: pptx shapes paths list|get|add|set INPUT [selection] [path] [output]\nRead: list|get INPUT [selection]. Add/set require --path JSON or --vertices JSON.\nPath: {unit:emu,width,height,commands:[move|line|quadratic|cubic|close]}\nCoordinates: integer local EMUs, -2147483647..2147483647; viewport 1..2147483647.\nAt most 4096 commands; explicit closure; command order preserved without winding evaluation.\nAlternatively --vertices JSON --close true|false uses {x,y} local EMU vertices and a derived viewport.\nAdd placement: --left LENGTH --top LENGTH --width LENGTH --height LENGTH.\nAdd accepts shape name, text, paint and metadata properties. Lengths require emu/in/cm/mm/pt.\nSelection: --slide N [--shape NAME] | --part URI --scope SCOPE | --select TOKEN.\nSet: selects one shape unless --all; --allow-empty accepts zero matches.\nScopes: slides (default), layouts, masters; shared requires --part URI.\nOutput: --output PATH | --in-place | --dry-run; --force --json --limit NAME=VALUE.\nUnsupported formulas, arcs and arbitrary existing geometry are preserve-only.\n" : ["shapes.group", "shapes.ungroup"].includes(args.schemaPath ?? "") ? "Usage: pptx shapes group|ungroup INPUT --tolerance LENGTH [selection] [output]\nGroup: --shapes JSON array of at least two inspected Location objects.\nShapes must be distinct contiguous siblings; original IDs and z-order are retained.\nUngroup: --slide N --shape NAME | --select TOKEN; selects one group.\nSelection: --part URI --scope SCOPE. Exact cardinality; --all/--allow-empty are unsupported.\nTolerance is explicit nonnegative EMU precision using emu/in/cm/mm/pt lengths.\nIdentity groups preserve child XML; transformed ungrouping supports nested groups and rectangles\nwithout text, styles or strokes.\nTransformed ungrouping supports quarter-turn rotation chains only.\nWorld geometry must remain within tolerance; unsupported geometry and references fail.\nOutput: --output PATH | --in-place | --dry-run; --force --json --limit NAME=VALUE.\n" : args.schemaPath?.startsWith("shapes.drawing.") || args.schemaPath === "shapes.effects.set" ? "Usage: pptx shapes drawing get|set INPUT [selection] [paint] [output]\n pptx shapes effects set INPUT [selection] --shadow true|false\n --opacity RATIO --shadow-blur LENGTH --shadow-color COLOR [output]\nPaint: --fill-kind inherit|none|solid|gradient|pattern|picture\n --color COLOR; gradient: --stops JSON --angle DEGREES\n pattern: --pattern PRESET [--foreground COLOR --background COLOR]\n picture: --file PATH --mode stretch|tile\nAdvanced paint: --fill JSON --line JSON --shadow-inherit true|false\nCOLOR is six-digit RGB or JSON with rgb/theme, optional brightness and opacity.\nSelection: --slide N --shape NAME | --part URI --scope SCOPE | --select TOKEN\nScopes: slides (default), layouts, masters; shared requires a part.\nSet selects one shape unless --all; --allow-empty accepts zero matches.\nOutput: --output PATH | --in-place | --dry-run; --force --json --limit NAME=VALUE.\nLengths require emu/in/cm/mm/pt. Simple shadows have zero offset.\nComplex effects and 3D remain intact; editing unsupported effects fails.\n" : args.schemaPath?.startsWith("shapes.") ? "Usage: pptx shapes list|get|add|set INPUT [selection] [properties] [output]\nSelection: --slide N --shape NAME | --select TOKEN; --part URI --scope SCOPE\nScopes: slides (default), layouts, masters; shared requires a part.\nAdd: --kind text-box|PRESET --left LENGTH --top LENGTH --width LENGTH --height LENGTH\nProperties: --name TEXT --text TEXT --title TEXT --description TEXT --alt-text TEXT\n --locked true|false|null --rotation DEGREES --fill RGB --line-color RGB --line-width LENGTH\n --flip-horizontal true|false --flip-vertical true|false\n --adjustments JSON_ARRAY (normalized preset values in guide order)\n Geometry uses parent coordinates; inspection corners use slide EMUs.\nLengths require emu/in/cm/mm/pt. Presets use enum names or numeric values from schema.\nNull clears direct title/description/lock; null fill/line color disables fill/line.\nOmitted values stay unchanged.\nNull line width restores inherited width.\nFill/line color solid selects solid fill; existing solid colors are retained.\nShape IDs are read-only. Unsupported geometry and advanced formatting are preserve-only.\nOutput: --output PATH | --in-place | --dry-run; --force --json --limit NAME=VALUE\nSet: --all edits every match; --allow-empty accepts zero matches.\n" : args.schemaPath?.startsWith("fields.") ? "Usage: pptx fields list|get|set|add|remove INPUT [options]\nSelection: --slide N --shape NAME | --select TOKEN\n --scope SCOPE --json --limit NAME=VALUE\nMutation: --all --allow-empty\nOutput: --output PATH | --in-place | --dry-run; --force\nSet/add: --kind slide-number|date|footer|header\n --update preserve|explicit --text TEXT --timestamp UTC\nAdd requires --kind and one text body; appends to its last paragraph.\nPreserve is default: retains the cache (empty on add), rejects text/time.\nExplicit requires text; date fields also require a caller UTC timestamp.\nNo field evaluation, automatic numbering or inherited-content flattening.\nList/get are read-only; get requires one field. Remove accepts no policy.\n" : usage14;
|
|
11832
12165
|
if (args.schemaPath === "diff") resolvedUsage = diffUsage;
|
|
11833
12166
|
if (args.schemaPath?.startsWith("comments.")) resolvedUsage = commentsUsage;
|
|
11834
12167
|
if (args.schemaPath?.startsWith("notes.")) resolvedUsage = notesUsage;
|
|
@@ -12177,11 +12510,11 @@ ${JSON.stringify(result.data, null, 2)}
|
|
|
12177
12510
|
try {
|
|
12178
12511
|
text2 = new TextDecoder("utf-8", { fatal: true }).decode(encoded2);
|
|
12179
12512
|
} catch {
|
|
12180
|
-
|
|
12513
|
+
usage13("Batch JSON must be UTF-8.");
|
|
12181
12514
|
}
|
|
12182
12515
|
items = parseAnimationBatch(commandJson(text2));
|
|
12183
12516
|
}
|
|
12184
|
-
if (items.length && !args.dryRun && !args.inPlace && !args.output)
|
|
12517
|
+
if (items.length && !args.dryRun && !args.inPlace && !args.output) usage13("Mutation requires a destination.");
|
|
12185
12518
|
const bytes = await request.readInput(args.input, Math.min(context.limits.maxBytes, context.archiveLimits.maxArchiveBytes));
|
|
12186
12519
|
const index = await readSelectionIndex2(bytes, context);
|
|
12187
12520
|
const changed = await mutateAnimationsBatch(bytes, resolveAnimationBatch(items, index), context);
|
|
@@ -13416,13 +13749,13 @@ ${item.parts.map((part) => ` ${part}
|
|
|
13416
13749
|
const inputs = [];
|
|
13417
13750
|
for (const path of [args.input, ...args.sources ?? []]) {
|
|
13418
13751
|
if (remaining < 1)
|
|
13419
|
-
throw new
|
|
13752
|
+
throw new OfficeError19("resource-limit", "Combined input limit exceeded.", "admit");
|
|
13420
13753
|
const bytes = await request.readInput(
|
|
13421
13754
|
path,
|
|
13422
13755
|
Math.min(remaining, context.archiveLimits.maxArchiveBytes)
|
|
13423
13756
|
);
|
|
13424
13757
|
if (bytes.length > remaining || bytes.length > context.archiveLimits.maxArchiveBytes)
|
|
13425
|
-
throw new
|
|
13758
|
+
throw new OfficeError19("resource-limit", "Combined input limit exceeded.", "admit");
|
|
13426
13759
|
remaining -= bytes.length;
|
|
13427
13760
|
inputs.push(await budget.read(bytes));
|
|
13428
13761
|
}
|
|
@@ -13523,7 +13856,7 @@ ${JSON.stringify(result.data, null, 2)}
|
|
|
13523
13856
|
}
|
|
13524
13857
|
} else if (args.operation === "create") {
|
|
13525
13858
|
if (args.template)
|
|
13526
|
-
throw new
|
|
13859
|
+
throw new OfficeError19(
|
|
13527
13860
|
"unsupported-profile",
|
|
13528
13861
|
"Template-based creation is unavailable.",
|
|
13529
13862
|
"validate-intent"
|
|
@@ -13575,7 +13908,7 @@ ${JSON.stringify(result.data, null, 2)}
|
|
|
13575
13908
|
);
|
|
13576
13909
|
} catch (error) {
|
|
13577
13910
|
if (error && typeof error === "object" && "code" in error && error.code === "resource-limit")
|
|
13578
|
-
throw new
|
|
13911
|
+
throw new OfficeError19("resource-limit", "Input limit exceeded.", "admit");
|
|
13579
13912
|
throw error;
|
|
13580
13913
|
}
|
|
13581
13914
|
const index = await readSelectionIndex2(bytes, { ...options2.context, signal: request.signal });
|
|
@@ -13720,7 +14053,7 @@ ${JSON.stringify(result.data, null, 2)}
|
|
|
13720
14053
|
const part = metadata2 ?? records[0].part;
|
|
13721
14054
|
const validationLimits = options2.context.validationLimits;
|
|
13722
14055
|
if (!validationLimits)
|
|
13723
|
-
throw new
|
|
14056
|
+
throw new OfficeError19(
|
|
13724
14057
|
"invalid-value",
|
|
13725
14058
|
"XML operations require explicit validation limits.",
|
|
13726
14059
|
"usage"
|
|
@@ -13796,10 +14129,10 @@ ${xml.xml}
|
|
|
13796
14129
|
await stagedOutput?.close().catch(() => {
|
|
13797
14130
|
});
|
|
13798
14131
|
stagedOutput = void 0;
|
|
13799
|
-
if (error instanceof
|
|
14132
|
+
if (error instanceof OfficeError19 && error.code === "resource-limit" && error.phase === "publish") return outputLimitFailure(output3.operation, output3.json);
|
|
13800
14133
|
if (request.signal.aborted)
|
|
13801
14134
|
return { exitCode: 130, stdout: new Uint8Array(), stderr: new Uint8Array() };
|
|
13802
|
-
const office = error instanceof
|
|
14135
|
+
const office = error instanceof OfficeError19 ? error : void 0;
|
|
13803
14136
|
const capabilityCode = error && typeof error === "object" && "code" in error ? error.code : void 0;
|
|
13804
14137
|
const limit = office?.code === "resource-limit" || capabilityCode === "resource-limit";
|
|
13805
14138
|
const unsupported = capabilityCode === "publication-unsupported";
|
|
@@ -13825,6 +14158,7 @@ ${xml.xml}
|
|
|
13825
14158
|
human = `pptx: ${diagnostic.code}: ${diagnostic.message}
|
|
13826
14159
|
`;
|
|
13827
14160
|
}
|
|
14161
|
+
if (retainedExtraction && result.ok) return retainedExtraction.publish();
|
|
13828
14162
|
const { json, operation } = output3;
|
|
13829
14163
|
const encoded = (stagedOutput ? new Uint8Array() : binary) ?? new TextEncoder().encode(
|
|
13830
14164
|
json ? `${JSON.stringify(result)}
|
|
@@ -13901,7 +14235,7 @@ ${JSON.stringify(failure.data)}
|
|
|
13901
14235
|
} catch (error) {
|
|
13902
14236
|
if (request.signal.aborted)
|
|
13903
14237
|
return { exitCode: 130, stdout: new Uint8Array(), stderr: new Uint8Array() };
|
|
13904
|
-
const office = error instanceof
|
|
14238
|
+
const office = error instanceof OfficeError19 ? error : void 0;
|
|
13905
14239
|
const rawCode = error && typeof error === "object" && "code" in error ? error.code : void 0;
|
|
13906
14240
|
const code = typeof rawCode === "string" && [
|
|
13907
14241
|
"resource-limit",
|
|
@@ -13983,7 +14317,7 @@ async function execute(request, options2) {
|
|
|
13983
14317
|
}
|
|
13984
14318
|
}
|
|
13985
14319
|
function createPptxCommandEngine(settings = {}) {
|
|
13986
|
-
const context =
|
|
14320
|
+
const context = resourceContext2(settings.context);
|
|
13987
14321
|
const options2 = {
|
|
13988
14322
|
maxArgumentBytes: settings.maxArgumentBytes ?? Infinity,
|
|
13989
14323
|
maxOutputBytes: settings.maxOutputBytes ?? Infinity,
|