@poe-platform/safe-bash 0.1.813 → 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/image-ast/index.js +1 -1
- 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 +6 -0
- package/dist/pdf-ast/content/evaluator.d.ts +4 -0
- package/dist/pdf-ast/cos/object-reader.d.ts +7 -0
- package/dist/pdf-ast/cos/value-parser.d.ts +1 -0
- package/dist/pdf-ast/edit/retained-form-appearances.d.ts +10 -0
- package/dist/pdf-ast/edit/retained-graph.d.ts +6 -0
- package/dist/pdf-ast/edit/retained-info-updates.d.ts +33 -0
- package/dist/pdf-ast/index.d.ts +1 -1
- package/dist/pdf-ast/index.js +460 -125
- package/dist/pdf-ast/retained-document.d.ts +5 -0
- 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-IHSOOSNC.js → chunk-2ETEJOYX.js} +17 -17
- package/dist/safe-bash/command-chunks/{chunk-XIDGHIGB.js → chunk-2PKBXGXD.js} +5 -5
- package/dist/safe-bash/command-chunks/{chunk-6SRHWVEB.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-GVWVRPG6.js → chunk-3GRMU7TM.js} +6 -6
- package/dist/safe-bash/command-chunks/{chunk-63EMPQ7Z.js → chunk-3JM7E42I.js} +94 -12
- 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-KCE5D4Z4.js → chunk-3ZRCL756.js} +3 -3
- 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-X64XGIXZ.js → chunk-4EHY6J2Z.js} +5 -5
- 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-I4GMCWAT.js → chunk-4YLACJHE.js} +6 -6
- package/dist/safe-bash/command-chunks/{chunk-PK36TVXB.js → chunk-5BIQWWLB.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-P3WU3PSL.js → chunk-5L4YGRQU.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-WPVBUVFK.js → chunk-5LFGXN3D.js} +6 -6
- package/dist/safe-bash/command-chunks/{chunk-YXD6VGVG.js → chunk-5OM3UIK3.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-C5QDEB3I.js → chunk-6LPSKLLD.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-XLYIVBAR.js → chunk-6QYSF7I2.js} +7 -7
- package/dist/safe-bash/command-chunks/{chunk-6IWE7PTK.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-PSCOXGCA.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-RIV6XN7K.js → chunk-7DOLY7IV.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-ET2VPDUA.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-2Z3WRRFT.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-HCKYUQ3L.js → chunk-AM5LANIE.js} +7 -7
- package/dist/safe-bash/command-chunks/{chunk-PKLJRB7W.js → chunk-AVGXFWEB.js} +48 -40
- package/dist/safe-bash/command-chunks/{chunk-RBTC7OFT.js → chunk-AVOGFREX.js} +5 -5
- package/dist/safe-bash/command-chunks/{chunk-G3RUXKVY.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-2E2H7MBH.js → chunk-AY3KQ4EN.js} +7 -7
- package/dist/safe-bash/command-chunks/{chunk-DMCI6T6N.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-2V6FOLXV.js → chunk-BS3ZEQGT.js} +14 -14
- package/dist/safe-bash/command-chunks/{chunk-WFVSUXJL.js → chunk-BS5JEUEW.js} +8 -8
- package/dist/safe-bash/command-chunks/{chunk-X53AEG36.js → chunk-BZMNC7Q5.js} +7 -7
- package/dist/safe-bash/command-chunks/{chunk-5KGEZ3RW.js → chunk-CCMAHM3I.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-3LJAXFH5.js → chunk-CIRDVCAZ.js} +7 -7
- package/dist/safe-bash/command-chunks/{chunk-73NYFNAS.js → chunk-CK2WFJZN.js} +5 -0
- package/dist/safe-bash/command-chunks/{chunk-UZL7G57V.js → chunk-CKEMZUE3.js} +7 -7
- package/dist/safe-bash/command-chunks/{chunk-S2N2V5U4.js → chunk-CQBACD2V.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-G7NENPYV.js → chunk-CSE4VQKG.js} +12 -1
- package/dist/safe-bash/command-chunks/{chunk-X6RHJ6YN.js → chunk-CXME4YHU.js} +23 -0
- package/dist/safe-bash/command-chunks/{chunk-FTLDRH47.js → chunk-CZ5K2YPU.js} +16 -16
- package/dist/safe-bash/command-chunks/{chunk-7PRL6RJ6.js → chunk-DBLQUZGN.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-5VQVZPP3.js → chunk-DBNJEXHK.js} +3 -3
- 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-6CY5BHBS.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-TKRLZIFI.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-4Z6W5EOC.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-QM2HZJSJ.js → chunk-F762XDNG.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-GOBUDKZ3.js → chunk-FF7UGJWS.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-SGPCXAG7.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-FWPVQGYK.js → chunk-FUQMEUAT.js} +6 -6
- package/dist/safe-bash/command-chunks/{chunk-KXPCSVAT.js → chunk-FXCSPPYE.js} +20 -20
- package/dist/safe-bash/command-chunks/{chunk-7QZ2HP2F.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-T6C5QP7T.js → chunk-G3TAX3CV.js} +5963 -5953
- package/dist/safe-bash/command-chunks/{chunk-MKX4JAZ6.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-7UC2Q6Z6.js → chunk-GQGMQMIM.js} +5 -5
- package/dist/safe-bash/command-chunks/{chunk-PI6MOMHA.js → chunk-GXMPXMDP.js} +11 -11
- package/dist/safe-bash/command-chunks/{chunk-57DDYKE5.js → chunk-GYM5ICK4.js} +7 -7
- package/dist/safe-bash/command-chunks/{chunk-5MFDRSGG.js → chunk-H33D4R26.js} +4 -4
- 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-RGOQKIG6.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-PVGZMLC6.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-GKILM4HZ.js → chunk-JR3Q6QNL.js} +7 -7
- package/dist/safe-bash/command-chunks/{chunk-D55REQA3.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-N32GSM3J.js → chunk-K2WOMJOQ.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-TQEB4DH4.js → chunk-K4XNUJVJ.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-HKOMXGJS.js → chunk-KBAQHE5Y.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-T3E5RV3U.js → chunk-KCLJGRU7.js} +12 -12
- 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-C5KLFZGT.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-7NXTEWPR.js → chunk-LAPOMHGY.js} +132 -195
- package/dist/safe-bash/command-chunks/{chunk-KBUBSMCQ.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-TODWFDYB.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-GNXTMSYN.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-BK7ISUJL.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-EJTNVXWF.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-4PBNMKAT.js → chunk-NEMUPUUB.js} +7 -7
- package/dist/safe-bash/command-chunks/{chunk-MUUWBZIC.js → chunk-NEVQWOU6.js} +10 -10
- package/dist/safe-bash/command-chunks/{chunk-KZ5ODST6.js → chunk-NFGCBQN3.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-LD7BONZY.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-ZYLGNIGA.js → chunk-NQINS4XY.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-UAF4IX5H.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-NPFHUS4X.js → chunk-OVQP6KH5.js} +6 -6
- package/dist/safe-bash/command-chunks/{chunk-QFF5KBOM.js → chunk-P2LT6TGR.js} +9 -9
- package/dist/safe-bash/command-chunks/{chunk-RLCQ7BN3.js → chunk-PIVH35EQ.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-BEHUSUOY.js → chunk-PLMF35XK.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-PXWS3Q7L.js → chunk-PLR5IULU.js} +5 -5
- package/dist/safe-bash/command-chunks/{chunk-DBLHCJJU.js → chunk-PS5GDFIP.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-P7EL2FWW.js → chunk-Q5PWYPQV.js} +7 -7
- package/dist/safe-bash/command-chunks/{chunk-AJI55RS7.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-MNHBQBF6.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-XG6UWQV5.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-3TYDSGAH.js → chunk-RQYPFLZJ.js} +6 -6
- package/dist/safe-bash/command-chunks/{chunk-3Y4XZB24.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-JUJHYPYL.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-3D24WDND.js → chunk-SEPUP6TZ.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-JPMYPOYZ.js → chunk-SUTHGUD3.js} +28 -28
- package/dist/safe-bash/command-chunks/{chunk-CTDC4LJT.js → chunk-SW37YCBW.js} +15 -10
- package/dist/safe-bash/command-chunks/{chunk-D6WJY6QO.js → chunk-SWAKALDJ.js} +10 -10
- 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-EZ4NQIPL.js → chunk-TJLXSENN.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-HVW53ARH.js → chunk-TKCUGMRZ.js} +24 -20
- package/dist/safe-bash/command-chunks/{chunk-5P6I2T63.js → chunk-TXPDKEGY.js} +8 -8
- package/dist/safe-bash/command-chunks/{chunk-MPKY37QR.js → chunk-UJERQEJB.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-V37D6AHO.js → chunk-USGZN2KE.js} +5 -5
- package/dist/safe-bash/command-chunks/{chunk-JAHJWVGF.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-M3Z5PU2M.js → chunk-VT2PHQ63.js} +15 -15
- package/dist/safe-bash/command-chunks/{chunk-JORIVUPM.js → chunk-VT7UBPAE.js} +15 -8
- package/dist/safe-bash/command-chunks/{chunk-QDVI2YB6.js → chunk-VUWXLH3E.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-O675URF4.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-6244HYJY.js → chunk-WJ2ERUCQ.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-U5TWQFZY.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-T5ERNELL.js → chunk-WZRFS5OY.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-2DGJOOXM.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-NKTULXVD.js → chunk-XM5QJCPD.js} +8 -8
- package/dist/safe-bash/command-chunks/{chunk-BBAB7LC4.js → chunk-XMTR7QGL.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-5IFRAI7Y.js → chunk-XNGM3W5R.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-Z5BIM5B7.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-EXOQGXEU.js → chunk-XUJAQA3S.js} +30 -30
- package/dist/safe-bash/command-chunks/{chunk-VVWXY6IA.js → chunk-Y42KSX63.js} +6 -6
- package/dist/safe-bash/command-chunks/{chunk-R2BMZAHG.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-YUXTK3XA.js → chunk-YRPXBGRX.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-NMPED6L5.js → chunk-Z2WNYEPD.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-7PZHWMK6.js → chunk-Z7QOSXQC.js} +7 -7
- package/dist/safe-bash/command-chunks/{chunk-VQOINPVF.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-V6XBEYPC.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-X3OLN7N6.js → command-engine-7V6PZR7G.js} +931 -680
- package/dist/safe-bash/command-chunks/{engine-XUCIFZ7V-LJFGZM6O.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-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.js +2 -2
- package/dist/safe-bash-command-html-to-markdown/index.js +3 -234
- 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-htmlq/contracts.d.ts +5 -0
- package/dist/safe-bash-command-htmlq/index.js +1715 -292
- 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 +1 -0
- 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 +4 -4
- package/dist/safe-bash-command-pandoc/index.js +39 -39
- package/dist/safe-bash-command-patch/index.js +6 -6
- package/dist/safe-bash-command-patch/patch-formats.d.ts +6 -1
- 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 +2 -2
- package/dist/safe-bash-command-patch/patch-gnu-reject.js +2 -2
- package/dist/safe-bash-command-patch/patch-publication.js +2 -2
- 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 +13 -8
- package/dist/safe-bash-command-patch/unified.js +3 -1
- package/dist/safe-bash-command-pdftk/index.js +741 -426
- 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 +2 -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 +163 -17
- 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-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 +30 -30
- package/dist/safe-bash-presentation-engine/animation-editing.js +15 -15
- package/dist/safe-bash-presentation-engine/animations.js +15 -15
- package/dist/safe-bash-presentation-engine/backgrounds.js +16 -16
- package/dist/safe-bash-presentation-engine/bytes.js +3 -3
- package/dist/safe-bash-presentation-engine/chart-editing.js +33 -33
- package/dist/safe-bash-presentation-engine/chart-object-operations.js +24 -24
- package/dist/safe-bash-presentation-engine/charts.js +30 -30
- package/dist/safe-bash-presentation-engine/command-placeholder.js +58 -58
- package/dist/safe-bash-presentation-engine/comments.js +16 -16
- package/dist/safe-bash-presentation-engine/connector-operations.js +31 -31
- package/dist/safe-bash-presentation-engine/connectors.js +28 -28
- package/dist/safe-bash-presentation-engine/content-types.js +4 -4
- package/dist/safe-bash-presentation-engine/creation.js +6 -6
- package/dist/safe-bash-presentation-engine/diff.js +31 -31
- package/dist/safe-bash-presentation-engine/drawing-format.js +19 -19
- package/dist/safe-bash-presentation-engine/drawing-operations.js +30 -30
- package/dist/safe-bash-presentation-engine/drawing-schema.js +20 -20
- package/dist/safe-bash-presentation-engine/equations.js +16 -16
- package/dist/safe-bash-presentation-engine/errors.js +2 -2
- package/dist/safe-bash-presentation-engine/fields.js +16 -16
- package/dist/safe-bash-presentation-engine/font-metrics.js +3 -3
- package/dist/safe-bash-presentation-engine/image-extraction.js +19 -19
- package/dist/safe-bash-presentation-engine/image-formatting.js +31 -31
- package/dist/safe-bash-presentation-engine/image-insertion.js +17 -17
- package/dist/safe-bash-presentation-engine/image-replacement.js +20 -20
- package/dist/safe-bash-presentation-engine/image-value.js +4 -4
- package/dist/safe-bash-presentation-engine/images.js +18 -18
- package/dist/safe-bash-presentation-engine/index.js +114 -114
- package/dist/safe-bash-presentation-engine/layouts.js +15 -15
- package/dist/safe-bash-presentation-engine/length.js +3 -3
- package/dist/safe-bash-presentation-engine/links.js +15 -15
- package/dist/safe-bash-presentation-engine/masters.js +14 -14
- package/dist/safe-bash-presentation-engine/media-editing.js +23 -23
- package/dist/safe-bash-presentation-engine/media-extraction.js +16 -16
- package/dist/safe-bash-presentation-engine/media.js +15 -15
- package/dist/safe-bash-presentation-engine/memberships.js +14 -14
- package/dist/safe-bash-presentation-engine/notes.js +15 -15
- package/dist/safe-bash-presentation-engine/ole-enum.js +4 -4
- package/dist/safe-bash-presentation-engine/ole-insertion.js +19 -19
- package/dist/safe-bash-presentation-engine/opaque-objects.js +9 -9
- package/dist/safe-bash-presentation-engine/package-reader.js +5 -5
- package/dist/safe-bash-presentation-engine/package-tools.js +18 -18
- 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 +57 -57
- package/dist/safe-bash-presentation-engine/presentation-settings.js +13 -13
- package/dist/safe-bash-presentation-engine/properties.js +15 -15
- package/dist/safe-bash-presentation-engine/relationships.js +4 -4
- package/dist/safe-bash-presentation-engine/resource-limits.js +1 -1
- package/dist/safe-bash-presentation-engine/retained-frame-formatting.d.ts +14 -0
- package/dist/safe-bash-presentation-engine/retained-inspection.js +13 -13
- package/dist/safe-bash-presentation-engine/retained-package.js +5 -5
- package/dist/safe-bash-presentation-engine/retained-text.d.ts +9 -2
- package/dist/safe-bash-presentation-engine/retained-text.js +130 -31
- package/dist/safe-bash-presentation-engine/retained-xml-document.d.ts +1 -0
- package/dist/safe-bash-presentation-engine/sanitize.js +16 -16
- package/dist/safe-bash-presentation-engine/selectors.js +10 -10
- package/dist/safe-bash-presentation-engine/shape-groups.js +30 -30
- package/dist/safe-bash-presentation-engine/shape-operations.js +29 -29
- package/dist/safe-bash-presentation-engine/shape-path-operations.js +31 -31
- package/dist/safe-bash-presentation-engine/shape-paths.js +15 -15
- package/dist/safe-bash-presentation-engine/shape-presets.js +3 -3
- package/dist/safe-bash-presentation-engine/shape-selection.js +30 -30
- package/dist/safe-bash-presentation-engine/shape-transforms.js +17 -17
- package/dist/safe-bash-presentation-engine/shapes.js +26 -26
- package/dist/safe-bash-presentation-engine/slide-copy.js +16 -16
- package/dist/safe-bash-presentation-engine/slide-import.js +17 -17
- package/dist/safe-bash-presentation-engine/slide-merge-split.js +19 -19
- package/dist/safe-bash-presentation-engine/slide-model.js +42 -42
- package/dist/safe-bash-presentation-engine/slide-removal.js +17 -17
- package/dist/safe-bash-presentation-engine/slide-transfer-budget.js +9 -9
- package/dist/safe-bash-presentation-engine/slides.js +18 -18
- package/dist/safe-bash-presentation-engine/table-operations.js +32 -32
- package/dist/safe-bash-presentation-engine/table-spans.js +31 -31
- package/dist/safe-bash-presentation-engine/tables.js +30 -30
- package/dist/safe-bash-presentation-engine/tags.js +15 -15
- package/dist/safe-bash-presentation-engine/template-bindings.js +32 -32
- package/dist/safe-bash-presentation-engine/template-repeat.js +39 -39
- package/dist/safe-bash-presentation-engine/text-fitting.js +26 -26
- package/dist/safe-bash-presentation-engine/text-frames.d.ts +13 -0
- package/dist/safe-bash-presentation-engine/text-frames.js +28 -26
- package/dist/safe-bash-presentation-engine/text-paragraphs.js +26 -26
- package/dist/safe-bash-presentation-engine/text-reading.js +11 -11
- package/dist/safe-bash-presentation-engine/text-replacement.js +16 -16
- package/dist/safe-bash-presentation-engine/text-runs.js +19 -19
- package/dist/safe-bash-presentation-engine/themes.js +15 -15
- package/dist/safe-bash-presentation-engine/transitions.js +15 -15
- package/dist/safe-bash-presentation-engine/validation.js +9 -9
- package/dist/safe-bash-presentation-engine/xml-parts.js +18 -18
- 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-xml-engine/document.js +3 -3
- package/dist/safe-bash-xml-engine/evaluate.js +1 -1
- package/dist/safe-bash-xml-engine/index.js +6 -6
- package/dist/safe-bash-xml-engine/query.js +2 -2
- package/dist/safe-bash-xml-engine/stored-document.d.ts +2 -2
- 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-format-xls/biff-encrypted-properties.js +7 -6
- package/dist/spreadsheet-format-xls/biff-properties-merge.js +2 -2
- package/dist/spreadsheet-format-xls/biff-properties.js +94 -109
- 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-range.d.ts +17 -3
- package/dist/spreadsheet-format-xls/biff-property-range.js +178 -37
- package/package.json +4 -2
- package/dist/safe-bash/command-chunks/biff-4ALVARRF-7SRX6R6N.js +0 -5192
- 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-3JST2Q7G.js → chunk-KRRG4MGH.js} +3 -3
- 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-X3OLN7N6.js → command-engine-7V6PZR7G.js}
RENAMED
|
@@ -1,13 +1,247 @@
|
|
|
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
|
+
|
|
8
242
|
// packages/safe-bash-command-pptx/src/command-extract-streaming.ts
|
|
9
243
|
import { openRetainedPackageExtraction, stageRetainedExtractionOutput } from "../../safe-bash-presentation-engine/package-tools.js";
|
|
10
|
-
import { OfficeError } from "../../safe-bash-presentation-engine/errors.js";
|
|
244
|
+
import { OfficeError as OfficeError3 } from "../../safe-bash-presentation-engine/errors.js";
|
|
11
245
|
async function prepareRetainedExtraction(args, request, options2) {
|
|
12
246
|
const { streaming, signal } = request, context = { ...options2.context, signal, workingStorage: streaming.workingStorage };
|
|
13
247
|
const input = await streaming.openInput(args.input, Math.min(context.limits.maxBytes, context.archiveLimits.maxArchiveBytes));
|
|
@@ -21,7 +255,7 @@ async function prepareRetainedExtraction(args, request, options2) {
|
|
|
21
255
|
let total = 0;
|
|
22
256
|
for await (const member of extraction.members()) total += member.size;
|
|
23
257
|
if (extraction.count > (args.limits?.maxOutputs ?? context.archiveLimits.maxMembers) || !Number.isSafeInteger(total) || total > options2.maxOutputBytes)
|
|
24
|
-
throw new
|
|
258
|
+
throw new OfficeError3("resource-limit", "Package extraction exceeds output limits.", "validate-intent");
|
|
25
259
|
if (!request.publishOutputStreams && (!args.allowPartialOutput || !request.publishOutput)) throw Object.assign(new Error("Extraction requires a publication capability."), { code: "publication-unsupported" });
|
|
26
260
|
response = await stageRetainedExtractionOutput(extraction, context, { directory: args.outputDir, json: args.json, maxOutputBytes: options2.maxOutputBytes, allowPartialOutput: args.allowPartialOutput ?? false });
|
|
27
261
|
async function* publications(dryRun) {
|
|
@@ -63,7 +297,7 @@ import { openPackageArchive } from "../../safe-bash-presentation-engine/retained
|
|
|
63
297
|
|
|
64
298
|
// packages/safe-bash-command-pptx/src/capabilities-discovery.ts
|
|
65
299
|
import { parseContentTypes } from "../../safe-bash-presentation-engine/content-types.js";
|
|
66
|
-
import { OfficeError as
|
|
300
|
+
import { OfficeError as OfficeError4 } from "../../safe-bash-presentation-engine/errors.js";
|
|
67
301
|
import { readRelationshipGraph } from "../../safe-bash-presentation-engine/relationships.js";
|
|
68
302
|
import { readPackage } from "../../safe-bash-presentation-engine/package-reader.js";
|
|
69
303
|
import { parseXmlPart } from "../../safe-bash-presentation-engine/xml.js";
|
|
@@ -100,7 +334,7 @@ function declaredFeatureCapabilities(features, operations) {
|
|
|
100
334
|
Object.entries(features).map(([name, feature]) => {
|
|
101
335
|
const paths = feature.operations ?? (feature.operation ? [feature.operation] : featureOperations[name]);
|
|
102
336
|
if (!paths?.length || paths.some((path) => !Object.hasOwn(operations, path))) {
|
|
103
|
-
throw new
|
|
337
|
+
throw new OfficeError4(
|
|
104
338
|
"invalid-value",
|
|
105
339
|
"Capability references an undeclared operation.",
|
|
106
340
|
"usage"
|
|
@@ -150,7 +384,7 @@ async function assessCapabilities(input, context) {
|
|
|
150
384
|
try {
|
|
151
385
|
contentType = types.get(part);
|
|
152
386
|
} catch (error) {
|
|
153
|
-
if (!(error instanceof
|
|
387
|
+
if (!(error instanceof OfficeError4) || error.code !== "missing-binding") throw error;
|
|
154
388
|
}
|
|
155
389
|
}
|
|
156
390
|
const type = contentType?.split(";", 1)[0].trim().toLowerCase();
|
|
@@ -165,7 +399,7 @@ async function assessCapabilities(input, context) {
|
|
|
165
399
|
const data = reader.get(part);
|
|
166
400
|
xmlBytes += data.length;
|
|
167
401
|
if (xmlBytes > context.xmlLimits.maxBytes || nodes >= context.xmlLimits.maxNodes)
|
|
168
|
-
throw new
|
|
402
|
+
throw new OfficeError4(
|
|
169
403
|
"resource-limit",
|
|
170
404
|
"Capability XML inspection limit exceeded.",
|
|
171
405
|
"index"
|
|
@@ -176,7 +410,7 @@ async function assessCapabilities(input, context) {
|
|
|
176
410
|
});
|
|
177
411
|
nodes += xml.nodeCount;
|
|
178
412
|
if (nodes > context.xmlLimits.maxNodes)
|
|
179
|
-
throw new
|
|
413
|
+
throw new OfficeError4("resource-limit", "Capability XML node limit exceeded.", "index");
|
|
180
414
|
const pending = [xml.root];
|
|
181
415
|
let visited = 0;
|
|
182
416
|
while (pending.length) {
|
|
@@ -3515,7 +3749,7 @@ var discoverySchemas = Object.fromEntries([
|
|
|
3515
3749
|
}]));
|
|
3516
3750
|
|
|
3517
3751
|
// packages/safe-bash-command-pptx/src/command-objects-add.ts
|
|
3518
|
-
import { OfficeError as
|
|
3752
|
+
import { OfficeError as OfficeError5 } from "../../safe-bash-presentation-engine/errors.js";
|
|
3519
3753
|
import { addOleObject } from "../../safe-bash-presentation-engine/ole-insertion.js";
|
|
3520
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";
|
|
3521
3755
|
var length = {
|
|
@@ -3622,24 +3856,24 @@ var objectsAddSchema = {
|
|
|
3622
3856
|
}
|
|
3623
3857
|
}
|
|
3624
3858
|
};
|
|
3625
|
-
function
|
|
3626
|
-
throw new
|
|
3859
|
+
function usage2(message) {
|
|
3860
|
+
throw new OfficeError5("invalid-value", message, "usage");
|
|
3627
3861
|
}
|
|
3628
3862
|
function validateObjectsAddCommand(args, positionals, seen) {
|
|
3629
3863
|
const allowed = Object.keys(objectsAddSchema.options.properties).map(
|
|
3630
3864
|
(key) => "--" + [...key].map((c) => c >= "A" && c <= "Z" ? "-" + c.toLowerCase() : c).join("")
|
|
3631
3865
|
);
|
|
3632
3866
|
if ([...seen].some((flag) => !allowed.includes(flag)))
|
|
3633
|
-
|
|
3867
|
+
usage2("Option does not apply to object insertion.");
|
|
3634
3868
|
if (positionals.length !== 1 || !positionals[0])
|
|
3635
|
-
|
|
3869
|
+
usage2("Object insertion requires exactly one input.");
|
|
3636
3870
|
args.input = positionals[0];
|
|
3637
3871
|
if (seen.has("--program-id") && seen.has("--program"))
|
|
3638
|
-
|
|
3872
|
+
usage2("Program and program ID are mutually exclusive.");
|
|
3639
3873
|
if (!args.slide || !args.file || !args.icon || !args.objectAdd?.progId)
|
|
3640
|
-
|
|
3874
|
+
usage2("Object insertion requires slide, file, icon and program ID.");
|
|
3641
3875
|
if ([args.input, args.file, args.icon].filter((path) => path === "-").length > 1)
|
|
3642
|
-
|
|
3876
|
+
usage2("Only one input may consume stdin.");
|
|
3643
3877
|
if (!args.iconContentType) {
|
|
3644
3878
|
const extension = args.icon.slice(args.icon.lastIndexOf(".") + 1).toLowerCase();
|
|
3645
3879
|
const type = {
|
|
@@ -3652,16 +3886,16 @@ function validateObjectsAddCommand(args, positionals, seen) {
|
|
|
3652
3886
|
tiff: "image/tiff",
|
|
3653
3887
|
wmf: "image/x-wmf"
|
|
3654
3888
|
};
|
|
3655
|
-
if (!type[extension])
|
|
3889
|
+
if (!type[extension]) usage2("Icon requires a supported extension or explicit content type.");
|
|
3656
3890
|
args.iconContentType = type[extension];
|
|
3657
3891
|
}
|
|
3658
3892
|
if (args.inPlace && (args.input === "-" || args.output))
|
|
3659
|
-
|
|
3660
|
-
if (!args.dryRun && !args.inPlace && !args.output)
|
|
3661
|
-
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.");
|
|
3662
3896
|
if (args.output === args.input && args.output !== "-")
|
|
3663
|
-
|
|
3664
|
-
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.");
|
|
3665
3899
|
}
|
|
3666
3900
|
async function executeObjectsAddCommand(args, request, options2) {
|
|
3667
3901
|
const context = { ...options2.context, signal: request.signal };
|
|
@@ -3853,7 +4087,7 @@ var packageToolsSchemas = Object.fromEntries(
|
|
|
3853
4087
|
);
|
|
3854
4088
|
|
|
3855
4089
|
// packages/safe-bash-command-pptx/src/command-engine-values.ts
|
|
3856
|
-
import { OfficeError as
|
|
4090
|
+
import { OfficeError as OfficeError6 } from "../../safe-bash-presentation-engine/errors.js";
|
|
3857
4091
|
function commandLength(value, minimum = 1) {
|
|
3858
4092
|
const units = { emu: 1, in: 914400, cm: 36e4, mm: 36e3, pt: 12700 };
|
|
3859
4093
|
const unit = Object.keys(units).find((candidate) => value.endsWith(candidate));
|
|
@@ -3862,7 +4096,7 @@ function commandLength(value, minimum = 1) {
|
|
|
3862
4096
|
if (!unit || pieces.length > 2 || !pieces[0] || pieces.some(
|
|
3863
4097
|
(piece) => !piece || [...piece].some((character) => character < "0" || character > "9")
|
|
3864
4098
|
))
|
|
3865
|
-
throw new
|
|
4099
|
+
throw new OfficeError6(
|
|
3866
4100
|
"invalid-value",
|
|
3867
4101
|
"Lengths require a decimal and emu, in, cm, mm or pt unit.",
|
|
3868
4102
|
"usage"
|
|
@@ -3870,13 +4104,13 @@ function commandLength(value, minimum = 1) {
|
|
|
3870
4104
|
const raw = Number(digits) * units[unit];
|
|
3871
4105
|
const result = Math.sign(raw) * Math.round(Math.abs(raw));
|
|
3872
4106
|
if (!Number.isFinite(raw) || Math.abs(raw) > Number.MAX_SAFE_INTEGER || !Number.isSafeInteger(result) || result < minimum)
|
|
3873
|
-
throw new
|
|
4107
|
+
throw new OfficeError6("invalid-value", "Length is outside the supported range.", "usage");
|
|
3874
4108
|
return result;
|
|
3875
4109
|
}
|
|
3876
4110
|
function commandTimestamp(value) {
|
|
3877
4111
|
const date = new Date(value);
|
|
3878
4112
|
if (!Number.isFinite(date.getTime()) || !value.endsWith("Z") || date.toISOString() !== value && date.toISOString() !== value.slice(0, -1) + ".000Z")
|
|
3879
|
-
throw new
|
|
4113
|
+
throw new OfficeError6(
|
|
3880
4114
|
"invalid-value",
|
|
3881
4115
|
"Timestamp requires a valid UTC date with seconds and Z suffix.",
|
|
3882
4116
|
"usage"
|
|
@@ -3910,7 +4144,7 @@ function commandJson(value) {
|
|
|
3910
4144
|
}
|
|
3911
4145
|
return JSON.parse(value);
|
|
3912
4146
|
} catch {
|
|
3913
|
-
throw new
|
|
4147
|
+
throw new OfficeError6(
|
|
3914
4148
|
"invalid-value",
|
|
3915
4149
|
"Structured slides require valid JSON without duplicate keys, at most 32 levels deep.",
|
|
3916
4150
|
"usage"
|
|
@@ -3920,31 +4154,15 @@ function commandJson(value) {
|
|
|
3920
4154
|
|
|
3921
4155
|
// packages/safe-bash-command-pptx/src/command-package-tools.ts
|
|
3922
4156
|
import { sha256 } from "@noble/hashes/sha2.js";
|
|
3923
|
-
import { OfficeError as
|
|
3924
|
-
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";
|
|
3925
4159
|
import { extractPackage, packPackage } from "../../safe-bash-presentation-engine/package-tools.js";
|
|
3926
|
-
function
|
|
3927
|
-
throw new
|
|
3928
|
-
}
|
|
3929
|
-
function scopedPath(manifest, path) {
|
|
3930
|
-
if (path === "-") return path;
|
|
3931
|
-
if (path.includes("\\") || [...path].some((c) => c.charCodeAt(0) < 32))
|
|
3932
|
-
usage2("Invalid scoped file path.");
|
|
3933
|
-
const prefix = path.startsWith("/") ? "" : manifest === "-" ? "/" : manifest.slice(0, manifest.lastIndexOf("/") + 1);
|
|
3934
|
-
const absolute = (prefix + path).startsWith("/");
|
|
3935
|
-
const segments = [];
|
|
3936
|
-
for (const segment of (prefix + path).split("/")) {
|
|
3937
|
-
if (!segment || segment === ".") continue;
|
|
3938
|
-
if (segment === "..") {
|
|
3939
|
-
if (!segments.length) usage2("Scoped path escapes its root.");
|
|
3940
|
-
segments.pop();
|
|
3941
|
-
} else segments.push(segment);
|
|
3942
|
-
}
|
|
3943
|
-
return (absolute ? "/" : "") + segments.join("/");
|
|
4160
|
+
function usage3(message) {
|
|
4161
|
+
throw new OfficeError7("invalid-value", message, "usage");
|
|
3944
4162
|
}
|
|
3945
4163
|
function canonical(part) {
|
|
3946
4164
|
try {
|
|
3947
|
-
return typeof part === "string" &&
|
|
4165
|
+
return typeof part === "string" && partName2(part, false) === part;
|
|
3948
4166
|
} catch {
|
|
3949
4167
|
return false;
|
|
3950
4168
|
}
|
|
@@ -3954,23 +4172,23 @@ function validatePackageCommand(args, positionals, seen) {
|
|
|
3954
4172
|
(key) => "--" + [...key].map((c) => c >= "A" && c <= "Z" ? "-" + c.toLowerCase() : c).join("")
|
|
3955
4173
|
);
|
|
3956
4174
|
if ([...seen].some((flag) => !allowed.includes(flag)))
|
|
3957
|
-
|
|
4175
|
+
usage3("Option does not apply to package tools.");
|
|
3958
4176
|
if (args.operation === "extract") {
|
|
3959
|
-
if (positionals.length !== 1 || !positionals[0])
|
|
4177
|
+
if (positionals.length !== 1 || !positionals[0]) usage3("Extraction requires one input.");
|
|
3960
4178
|
args.input = positionals[0];
|
|
3961
4179
|
if (!args.outputDir || args.outputDir === "-")
|
|
3962
|
-
|
|
3963
|
-
if (args.parts && (!args.parts.length || args.parts.some((part) => !canonical(part)) || new Set(args.parts.map(
|
|
3964
|
-
|
|
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.");
|
|
3965
4183
|
} else {
|
|
3966
4184
|
if (positionals.length || !args.manifest)
|
|
3967
|
-
|
|
3968
|
-
if (!args.output && !args.dryRun)
|
|
3969
|
-
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.");
|
|
3970
4188
|
if (args.output === "-" && args.json && !args.dryRun)
|
|
3971
|
-
|
|
4189
|
+
usage3("Binary stdout cannot be combined with JSON.");
|
|
3972
4190
|
if (args.output === args.manifest && args.output !== "-")
|
|
3973
|
-
|
|
4191
|
+
usage3("Output cannot replace manifest.");
|
|
3974
4192
|
}
|
|
3975
4193
|
}
|
|
3976
4194
|
async function executePackageCommand(args, request, options2) {
|
|
@@ -3991,7 +4209,7 @@ async function executePackageCommand(args, request, options2) {
|
|
|
3991
4209
|
);
|
|
3992
4210
|
const files = await extractPackage(bytes2, context, args.parts ? { parts: args.parts } : {});
|
|
3993
4211
|
if (files.length > (args.limits?.maxOutputs ?? context.archiveLimits.maxMembers) || files.reduce((sum, file) => sum + file.bytes.length, 0) > options2.maxOutputBytes)
|
|
3994
|
-
throw new
|
|
4212
|
+
throw new OfficeError7(
|
|
3995
4213
|
"resource-limit",
|
|
3996
4214
|
"Package extraction exceeds output limits.",
|
|
3997
4215
|
"validate-intent"
|
|
@@ -4023,7 +4241,7 @@ async function executePackageCommand(args, request, options2) {
|
|
|
4023
4241
|
};
|
|
4024
4242
|
}
|
|
4025
4243
|
if (args.creation?.author !== void 0 || args.creation?.timestamp !== void 0)
|
|
4026
|
-
throw new
|
|
4244
|
+
throw new OfficeError7(
|
|
4027
4245
|
"unsupported-edit",
|
|
4028
4246
|
"Pack metadata overrides are unavailable; source properties are preserved.",
|
|
4029
4247
|
"validate-intent"
|
|
@@ -4033,28 +4251,28 @@ async function executePackageCommand(args, request, options2) {
|
|
|
4033
4251
|
Math.min(context.limits.maxBytes, context.xmlLimits.maxBytes)
|
|
4034
4252
|
);
|
|
4035
4253
|
if (encoded.length > Math.min(context.limits.maxBytes, context.xmlLimits.maxBytes))
|
|
4036
|
-
throw new
|
|
4254
|
+
throw new OfficeError7("resource-limit", "Manifest exceeds byte limit.", "admit");
|
|
4037
4255
|
let value;
|
|
4038
4256
|
try {
|
|
4039
4257
|
value = commandJson(new TextDecoder("utf-8", { fatal: true }).decode(encoded));
|
|
4040
4258
|
} catch {
|
|
4041
|
-
|
|
4259
|
+
usage3("Manifest must be valid JSON.");
|
|
4042
4260
|
}
|
|
4043
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)
|
|
4044
|
-
|
|
4262
|
+
usage3("Manifest requires a nonempty parts array.");
|
|
4045
4263
|
if (value.parts.length > context.archiveLimits.maxMembers)
|
|
4046
|
-
throw new
|
|
4264
|
+
throw new OfficeError7("resource-limit", "Manifest exceeds member limit.", "admit");
|
|
4047
4265
|
const parts = value.parts;
|
|
4048
4266
|
for (const item of parts)
|
|
4049
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)
|
|
4050
|
-
|
|
4051
|
-
if (new Set(parts.map((item) =>
|
|
4052
|
-
|
|
4053
|
-
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));
|
|
4054
4272
|
if ([args.manifest, ...paths].filter((path) => path === "-").length > 1)
|
|
4055
|
-
|
|
4273
|
+
usage3("Only one manifest input may consume stdin.");
|
|
4056
4274
|
if (args.output !== "-" && paths.includes(args.output))
|
|
4057
|
-
|
|
4275
|
+
usage3("Output cannot replace a source file.");
|
|
4058
4276
|
let total = 0;
|
|
4059
4277
|
const members = [];
|
|
4060
4278
|
for (const [index, item] of parts.entries()) {
|
|
@@ -4065,7 +4283,7 @@ async function executePackageCommand(args, request, options2) {
|
|
|
4065
4283
|
);
|
|
4066
4284
|
total += bytes2.length;
|
|
4067
4285
|
if (bytes2.length > context.archiveLimits.maxEntryBytes || total > context.archiveLimits.maxTotalBytes)
|
|
4068
|
-
throw new
|
|
4286
|
+
throw new OfficeError7("resource-limit", "Manifest contents exceed byte limit.", "admit");
|
|
4069
4287
|
members.push({ part: item.part, sha256: item.sha256, bytes: bytes2 });
|
|
4070
4288
|
}
|
|
4071
4289
|
const bytes = await packPackage(
|
|
@@ -4074,7 +4292,7 @@ async function executePackageCommand(args, request, options2) {
|
|
|
4074
4292
|
args.creation?.kind ? { kind: args.creation.kind } : {}
|
|
4075
4293
|
);
|
|
4076
4294
|
if (bytes.length > options2.maxOutputBytes)
|
|
4077
|
-
throw new
|
|
4295
|
+
throw new OfficeError7("resource-limit", "Packed output exceeds byte limit.", "validate-intent");
|
|
4078
4296
|
const dryRun = args.dryRun ?? false;
|
|
4079
4297
|
const fingerprint = [...sha256(bytes)].map((byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
4080
4298
|
if (args.output && args.output !== "-" && !request.publishOutput)
|
|
@@ -4110,7 +4328,7 @@ async function executePackageCommand(args, request, options2) {
|
|
|
4110
4328
|
}
|
|
4111
4329
|
|
|
4112
4330
|
// packages/safe-bash-command-pptx/src/command-diff.ts
|
|
4113
|
-
import { OfficeError as
|
|
4331
|
+
import { OfficeError as OfficeError8 } from "../../safe-bash-presentation-engine/errors.js";
|
|
4114
4332
|
import { comparePresentations } from "../../safe-bash-presentation-engine/diff.js";
|
|
4115
4333
|
|
|
4116
4334
|
// packages/safe-bash-command-pptx/src/diff-schema.ts
|
|
@@ -4216,7 +4434,7 @@ async function executeDiffCommand(request, options2) {
|
|
|
4216
4434
|
let human = "";
|
|
4217
4435
|
let exitCode = 0;
|
|
4218
4436
|
const failure = (error) => {
|
|
4219
|
-
const office = error instanceof
|
|
4437
|
+
const office = error instanceof OfficeError8 ? error : void 0;
|
|
4220
4438
|
const code = request.signal.aborted ? "cancelled" : office?.code ?? (error && typeof error === "object" && "code" in error && error.code === "resource-limit" ? "resource-limit" : "io-failure");
|
|
4221
4439
|
exitCode = code === "cancelled" ? 130 : 2;
|
|
4222
4440
|
const message = office?.message ?? (code === "cancelled" ? "Comparison cancelled." : "Comparison input could not be read.");
|
|
@@ -4233,20 +4451,20 @@ async function executeDiffCommand(request, options2) {
|
|
|
4233
4451
|
errors: [{ code, message, context: { phase: office?.phase ?? "admit" } }]
|
|
4234
4452
|
};
|
|
4235
4453
|
};
|
|
4236
|
-
const
|
|
4237
|
-
throw new
|
|
4454
|
+
const usage14 = (message) => {
|
|
4455
|
+
throw new OfficeError8("invalid-value", message, "usage");
|
|
4238
4456
|
};
|
|
4239
4457
|
try {
|
|
4240
4458
|
let byteCount = 0;
|
|
4241
4459
|
const args = request.args.map((bytes2) => {
|
|
4242
|
-
if (!(bytes2 instanceof Uint8Array))
|
|
4460
|
+
if (!(bytes2 instanceof Uint8Array)) usage14("Arguments must be byte arrays.");
|
|
4243
4461
|
byteCount += bytes2.byteLength;
|
|
4244
4462
|
if (byteCount > options2.maxArgumentBytes)
|
|
4245
|
-
throw new
|
|
4463
|
+
throw new OfficeError8("resource-limit", "Argument limit exceeded.", "admit");
|
|
4246
4464
|
try {
|
|
4247
4465
|
return new TextDecoder("utf-8", { fatal: true }).decode(bytes2);
|
|
4248
4466
|
} catch {
|
|
4249
|
-
return
|
|
4467
|
+
return usage14("Arguments must be UTF-8.");
|
|
4250
4468
|
}
|
|
4251
4469
|
});
|
|
4252
4470
|
const delimiter = args.indexOf("--");
|
|
@@ -4265,31 +4483,31 @@ async function executeDiffCommand(request, options2) {
|
|
|
4265
4483
|
}
|
|
4266
4484
|
if (!positionalOnly && arg.startsWith("-") && arg !== "-") {
|
|
4267
4485
|
if (!["--json", "--mode", "--limit", "--help"].includes(arg))
|
|
4268
|
-
|
|
4269
|
-
if (seen.has(arg) && arg !== "--limit")
|
|
4486
|
+
usage14("Unknown comparison option.");
|
|
4487
|
+
if (seen.has(arg) && arg !== "--limit") usage14("Duplicate comparison option.");
|
|
4270
4488
|
seen.add(arg);
|
|
4271
4489
|
if (arg === "--json" || arg === "--help") continue;
|
|
4272
4490
|
const value = args[++i];
|
|
4273
|
-
if (!value)
|
|
4491
|
+
if (!value) usage14("Comparison option requires a value.");
|
|
4274
4492
|
if (arg === "--mode") {
|
|
4275
|
-
if (!diffModes.includes(value))
|
|
4493
|
+
if (!diffModes.includes(value)) usage14("Unsupported comparison mode.");
|
|
4276
4494
|
mode = value;
|
|
4277
4495
|
} else {
|
|
4278
4496
|
const parts = value.split("=");
|
|
4279
4497
|
const name = parts[0];
|
|
4280
4498
|
const number = Number(parts[1]);
|
|
4281
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))
|
|
4282
|
-
|
|
4500
|
+
usage14("Invalid comparison limit.");
|
|
4283
4501
|
limits[name] = number;
|
|
4284
4502
|
}
|
|
4285
4503
|
} else {
|
|
4286
|
-
if (!arg || arg.includes("\0"))
|
|
4504
|
+
if (!arg || arg.includes("\0")) usage14("Invalid comparison input.");
|
|
4287
4505
|
positionals.push(arg);
|
|
4288
4506
|
}
|
|
4289
4507
|
}
|
|
4290
4508
|
if (seen.has("--help")) {
|
|
4291
4509
|
if (positionals.length || [...seen].some((flag) => flag !== "--help" && flag !== "--json"))
|
|
4292
|
-
|
|
4510
|
+
usage14("Comparison help does not accept inputs or options.");
|
|
4293
4511
|
result = {
|
|
4294
4512
|
version: 1,
|
|
4295
4513
|
operation: "help",
|
|
@@ -4303,7 +4521,7 @@ async function executeDiffCommand(request, options2) {
|
|
|
4303
4521
|
human = diffUsage;
|
|
4304
4522
|
} else {
|
|
4305
4523
|
if (positionals.length !== 2 || positionals.every((path) => path === "-"))
|
|
4306
|
-
|
|
4524
|
+
usage14("Comparison requires two inputs and at most one stdin consumer.");
|
|
4307
4525
|
maxOutputBytes = limits.maxOutputBytes ?? maxOutputBytes;
|
|
4308
4526
|
const context = {
|
|
4309
4527
|
...options2.context,
|
|
@@ -4320,7 +4538,7 @@ async function executeDiffCommand(request, options2) {
|
|
|
4320
4538
|
}
|
|
4321
4539
|
};
|
|
4322
4540
|
if (mode === "effective-formatting")
|
|
4323
|
-
throw new
|
|
4541
|
+
throw new OfficeError8(
|
|
4324
4542
|
"unsupported-profile",
|
|
4325
4543
|
"Effective formatting comparison is not supported.",
|
|
4326
4544
|
"usage"
|
|
@@ -4355,7 +4573,7 @@ async function executeDiffCommand(request, options2) {
|
|
|
4355
4573
|
let bytes = encoder.encode(json ? JSON.stringify(result) + "\n" : human);
|
|
4356
4574
|
if (bytes.length > maxOutputBytes) {
|
|
4357
4575
|
result = failure(
|
|
4358
|
-
new
|
|
4576
|
+
new OfficeError8("resource-limit", "Comparison output limit exceeded.", "admit")
|
|
4359
4577
|
);
|
|
4360
4578
|
bytes = encoder.encode(json ? JSON.stringify(result) + "\n" : human);
|
|
4361
4579
|
}
|
|
@@ -4475,7 +4693,7 @@ var templateSchema = {
|
|
|
4475
4693
|
|
|
4476
4694
|
// packages/safe-bash-command-pptx/src/command-template.ts
|
|
4477
4695
|
import { sha256 as sha2562 } from "@noble/hashes/sha2.js";
|
|
4478
|
-
import { OfficeError as
|
|
4696
|
+
import { OfficeError as OfficeError9 } from "../../safe-bash-presentation-engine/errors.js";
|
|
4479
4697
|
import {
|
|
4480
4698
|
applyTemplateBindings,
|
|
4481
4699
|
validateTemplateBindings
|
|
@@ -4488,8 +4706,8 @@ function validateTemplateData(value) {
|
|
|
4488
4706
|
if (Array.isArray(value)) validateTemplateBindings(value);
|
|
4489
4707
|
else validateTemplateRepeat(value);
|
|
4490
4708
|
}
|
|
4491
|
-
function
|
|
4492
|
-
throw new
|
|
4709
|
+
function usage4(message) {
|
|
4710
|
+
throw new OfficeError9("invalid-value", message, "usage");
|
|
4493
4711
|
}
|
|
4494
4712
|
function validateTemplateCommand(args, positionals, seen) {
|
|
4495
4713
|
if ([...seen].some(
|
|
@@ -4504,25 +4722,25 @@ function validateTemplateCommand(args, positionals, seen) {
|
|
|
4504
4722
|
"--dry-run"
|
|
4505
4723
|
].includes(flag)
|
|
4506
4724
|
))
|
|
4507
|
-
|
|
4725
|
+
usage4("Option does not apply to template apply.");
|
|
4508
4726
|
if (positionals.length !== 1 || !positionals[0])
|
|
4509
|
-
|
|
4727
|
+
usage4("Template apply requires exactly one input.");
|
|
4510
4728
|
args.input = positionals[0];
|
|
4511
4729
|
if (args.bindings !== void 0 === (args.dataFile !== void 0))
|
|
4512
|
-
|
|
4513
|
-
if (args.dataFile === "")
|
|
4514
|
-
if (args.input === "-" && args.dataFile === "-")
|
|
4515
|
-
if (args.inPlace && args.input === "-")
|
|
4516
|
-
if (args.inPlace && args.output)
|
|
4517
|
-
if (!args.dryRun && !args.inPlace && !args.output)
|
|
4518
|
-
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.");
|
|
4519
4737
|
if (args.output === args.input && args.output !== "-")
|
|
4520
|
-
|
|
4738
|
+
usage4("Replacing input requires --in-place.");
|
|
4521
4739
|
const destination = args.inPlace ? args.input : args.output;
|
|
4522
4740
|
if (args.dataFile !== void 0 && args.dataFile !== "-" && destination === args.dataFile)
|
|
4523
|
-
|
|
4741
|
+
usage4("Output cannot replace the binding source.");
|
|
4524
4742
|
if (args.output === "-" && args.json && !args.dryRun)
|
|
4525
|
-
|
|
4743
|
+
usage4("Binary stdout cannot be combined with JSON.");
|
|
4526
4744
|
}
|
|
4527
4745
|
async function executeTemplateCommand(args, request, options2) {
|
|
4528
4746
|
const context = { ...options2.context, signal: request.signal };
|
|
@@ -4536,7 +4754,7 @@ async function executeTemplateCommand(args, request, options2) {
|
|
|
4536
4754
|
try {
|
|
4537
4755
|
json = new TextDecoder("utf-8", { fatal: true }).decode(data);
|
|
4538
4756
|
} catch {
|
|
4539
|
-
|
|
4757
|
+
usage4("Binding data must be UTF-8 JSON.");
|
|
4540
4758
|
}
|
|
4541
4759
|
bindings = commandJson(json);
|
|
4542
4760
|
}
|
|
@@ -4841,40 +5059,40 @@ var commentSchemas = Object.fromEntries(
|
|
|
4841
5059
|
);
|
|
4842
5060
|
|
|
4843
5061
|
// packages/safe-bash-command-pptx/src/command-comments.ts
|
|
4844
|
-
import { OfficeError as
|
|
5062
|
+
import { OfficeError as OfficeError10 } from "../../safe-bash-presentation-engine/errors.js";
|
|
4845
5063
|
import { mutateComments, readComments, readCommentAuthors } from "../../safe-bash-presentation-engine/comments.js";
|
|
4846
5064
|
import { SelectionError } from "../../safe-bash-presentation-engine/selectors.js";
|
|
4847
|
-
function
|
|
4848
|
-
throw new
|
|
5065
|
+
function usage5(message) {
|
|
5066
|
+
throw new OfficeError10("invalid-value", message, "usage");
|
|
4849
5067
|
}
|
|
4850
5068
|
function validateCommentsCommand(args, positionals, seen) {
|
|
4851
5069
|
const allowed = Object.keys(commentSchemas[args.operation].options.properties).map(
|
|
4852
5070
|
(key) => "--" + [...key].map((c) => c >= "A" && c <= "Z" ? "-" + c.toLowerCase() : c).join("")
|
|
4853
5071
|
);
|
|
4854
5072
|
if ([...seen].some((flag) => !allowed.includes(flag)))
|
|
4855
|
-
|
|
4856
|
-
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.");
|
|
4857
5075
|
args.input = positionals[0];
|
|
4858
|
-
if (args.scope !== void 0 && args.scope !== "slides")
|
|
5076
|
+
if (args.scope !== void 0 && args.scope !== "slides") usage5("Comments require slides scope.");
|
|
4859
5077
|
if (args.token && ["--slide", "--scope", "--id"].some((flag) => seen.has(flag)))
|
|
4860
|
-
|
|
5078
|
+
usage5("Opaque and simple selectors cannot be combined.");
|
|
4861
5079
|
if (args.operation === "comments.list" || args.operation === "comments.get") return;
|
|
4862
5080
|
if (!args.token && args.slide === void 0 && !args.all)
|
|
4863
5081
|
throw new SelectionError("missing-selection");
|
|
4864
5082
|
if (args.operation === "comments.add" && [args.commentEdit?.text, args.commentEdit?.author, args.commentEdit?.timestamp].some(
|
|
4865
5083
|
(value) => value === void 0
|
|
4866
5084
|
))
|
|
4867
|
-
|
|
5085
|
+
usage5("Comment creation requires text, author and timestamp.");
|
|
4868
5086
|
if (args.operation === "comments.set" && !Object.keys(args.commentEdit ?? {}).some((key) => key !== "id"))
|
|
4869
|
-
|
|
4870
|
-
if (args.inPlace && args.input === "-")
|
|
4871
|
-
if (args.inPlace && args.output)
|
|
4872
|
-
if (!args.dryRun && !args.inPlace && !args.output)
|
|
4873
|
-
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.");
|
|
4874
5092
|
if (args.output === args.input && args.output !== "-")
|
|
4875
|
-
|
|
5093
|
+
usage5("Replacing input requires --in-place.");
|
|
4876
5094
|
if (args.output === "-" && args.json && !args.dryRun)
|
|
4877
|
-
|
|
5095
|
+
usage5("Binary stdout cannot be combined with JSON.");
|
|
4878
5096
|
}
|
|
4879
5097
|
async function executeCommentsCommand(args, request, options2) {
|
|
4880
5098
|
const context = { ...options2.context, signal: request.signal };
|
|
@@ -5347,43 +5565,43 @@ var accessibilitySchemas = Object.fromEntries(
|
|
|
5347
5565
|
);
|
|
5348
5566
|
|
|
5349
5567
|
// packages/safe-bash-command-pptx/src/command-accessibility.ts
|
|
5350
|
-
import { OfficeError as
|
|
5568
|
+
import { OfficeError as OfficeError11 } from "../../safe-bash-presentation-engine/errors.js";
|
|
5351
5569
|
import {
|
|
5352
5570
|
readAccessibility,
|
|
5353
5571
|
mutateAccessibility,
|
|
5354
5572
|
validateAccessibilityUpdate
|
|
5355
5573
|
} from "../../safe-bash-presentation-engine/accessibility.js";
|
|
5356
5574
|
import { SelectionError as SelectionError2 } from "../../safe-bash-presentation-engine/selectors.js";
|
|
5357
|
-
function
|
|
5358
|
-
throw new
|
|
5575
|
+
function usage6(message) {
|
|
5576
|
+
throw new OfficeError11("invalid-value", message, "usage");
|
|
5359
5577
|
}
|
|
5360
5578
|
function validateAccessibilityCommand(args, positionals, seen) {
|
|
5361
5579
|
const allowed = Object.keys(accessibilitySchemas[args.operation].options.properties).map(
|
|
5362
5580
|
(key) => "--" + [...key].map((c) => c >= "A" && c <= "Z" ? "-" + c.toLowerCase() : c).join("")
|
|
5363
5581
|
);
|
|
5364
5582
|
if ([...seen].some((flag) => !allowed.includes(flag)))
|
|
5365
|
-
|
|
5583
|
+
usage6("Option does not apply to accessibility.");
|
|
5366
5584
|
if (positionals.length !== 1 || !positionals[0])
|
|
5367
|
-
|
|
5585
|
+
usage6("Accessibility requires exactly one input.");
|
|
5368
5586
|
args.input = positionals[0];
|
|
5369
5587
|
if (args.scope !== void 0 && !["slides", "layouts", "masters"].includes(args.scope))
|
|
5370
|
-
|
|
5588
|
+
usage6("Unsupported accessibility scope.");
|
|
5371
5589
|
if (args.token && ["--slide", "--shape", "--scope", "--all"].some((flag) => seen.has(flag)))
|
|
5372
|
-
|
|
5590
|
+
usage6("Opaque and simple selectors cannot be combined.");
|
|
5373
5591
|
if (args.shape !== void 0 && args.slide === void 0)
|
|
5374
|
-
|
|
5592
|
+
usage6("Shape selection requires a slide.");
|
|
5375
5593
|
if (args.operation !== "accessibility.set") return;
|
|
5376
5594
|
validateAccessibilityUpdate(args.accessibilityEdit ?? {});
|
|
5377
5595
|
if (!args.token && args.slide === void 0 && !args.all)
|
|
5378
|
-
|
|
5379
|
-
if (args.inPlace && args.input === "-")
|
|
5380
|
-
if (args.inPlace && args.output)
|
|
5381
|
-
if (!args.dryRun && !args.inPlace && !args.output)
|
|
5382
|
-
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.");
|
|
5383
5601
|
if (args.output === args.input && args.output !== "-")
|
|
5384
|
-
|
|
5602
|
+
usage6("Replacing input requires --in-place.");
|
|
5385
5603
|
if (args.output === "-" && args.json && !args.dryRun)
|
|
5386
|
-
|
|
5604
|
+
usage6("Binary stdout cannot be combined with JSON.");
|
|
5387
5605
|
}
|
|
5388
5606
|
async function executeAccessibilityCommand(args, request, options2) {
|
|
5389
5607
|
const context = { ...options2.context, signal: request.signal };
|
|
@@ -5465,13 +5683,13 @@ async function executeAccessibilityCommand(args, request, options2) {
|
|
|
5465
5683
|
}
|
|
5466
5684
|
|
|
5467
5685
|
// packages/safe-bash-command-pptx/src/command-metadata.ts
|
|
5468
|
-
import { OfficeError as
|
|
5686
|
+
import { OfficeError as OfficeError12 } from "../../safe-bash-presentation-engine/errors.js";
|
|
5469
5687
|
import { coreDefinition, mutateProperty, readProperties } from "../../safe-bash-presentation-engine/properties.js";
|
|
5470
5688
|
import { sanitize as sanitizePresentation } from "../../safe-bash-presentation-engine/sanitize.js";
|
|
5471
5689
|
import { mutateTags, readTags } from "../../safe-bash-presentation-engine/tags.js";
|
|
5472
5690
|
import { SelectionError as SelectionError3 } from "../../safe-bash-presentation-engine/selectors.js";
|
|
5473
|
-
function
|
|
5474
|
-
throw new
|
|
5691
|
+
function usage7(message) {
|
|
5692
|
+
throw new OfficeError12("invalid-value", message, "usage");
|
|
5475
5693
|
}
|
|
5476
5694
|
function removalCategories(value) {
|
|
5477
5695
|
const categories = ["notes", "comments", "properties", "links", "objects"];
|
|
@@ -5480,37 +5698,37 @@ function removalCategories(value) {
|
|
|
5480
5698
|
try {
|
|
5481
5699
|
parsed = JSON.parse(value);
|
|
5482
5700
|
} catch {
|
|
5483
|
-
|
|
5701
|
+
usage7("Remove requires a category or a JSON array of categories.");
|
|
5484
5702
|
}
|
|
5485
5703
|
}
|
|
5486
5704
|
const values3 = Array.isArray(parsed) ? parsed : [parsed];
|
|
5487
|
-
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.");
|
|
5488
5706
|
return values3;
|
|
5489
5707
|
}
|
|
5490
5708
|
function validateMetadataCommand(args, positionals, seen) {
|
|
5491
5709
|
const allowed = Object.keys(metadataSchemas[args.operation].options.properties).map((key) => "--" + [...key].map((c) => c >= "A" && c <= "Z" ? "-" + c.toLowerCase() : c).join(""));
|
|
5492
|
-
if ([...seen].some((flag) => !allowed.includes(flag)))
|
|
5493
|
-
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.");
|
|
5494
5712
|
args.input = positionals[0];
|
|
5495
5713
|
const tags = args.operation.startsWith("tags."), sanitize = args.operation === "sanitize";
|
|
5496
5714
|
const action = args.operation.split(".")[1];
|
|
5497
|
-
if (args.scope !== void 0 && !(tags ? ["slides", "presentation"] : ["presentation"]).includes(args.scope))
|
|
5498
|
-
if (args.token && ["--slide", "--scope", "--all"].some((flag) => seen.has(flag)))
|
|
5499
|
-
if (args.scope === "presentation" && args.slide !== void 0)
|
|
5500
|
-
if (!tags && !sanitize && action !== "list" && !args.metadataName)
|
|
5501
|
-
if (args.metadataName === "")
|
|
5502
|
-
if (action === "add" && (!args.metadataName || args.metadataValue === void 0))
|
|
5503
|
-
if (action === "set" && (tags ? args.metadataName === void 0 && args.metadataValue === void 0 : args.metadataValue === void 0))
|
|
5504
|
-
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.");
|
|
5505
5723
|
if (sanitize) removalCategories(args.metadataRemove);
|
|
5506
5724
|
if (!sanitize && ["list", "get"].includes(action)) return;
|
|
5507
5725
|
if (tags && !args.token && args.slide === void 0 && args.scope !== "presentation" && !args.all) throw new SelectionError3("missing-selection");
|
|
5508
|
-
if (args.inPlace && args.input === "-")
|
|
5509
|
-
if (args.inPlace && args.output)
|
|
5510
|
-
if (!args.dryRun && !args.inPlace && !args.output)
|
|
5511
|
-
if (args.force && !args.output)
|
|
5512
|
-
if (args.output === args.input && args.output !== "-")
|
|
5513
|
-
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.");
|
|
5514
5732
|
}
|
|
5515
5733
|
async function executeMetadataCommand(args, request, options2) {
|
|
5516
5734
|
const context = { ...options2.context, signal: request.signal };
|
|
@@ -5545,15 +5763,15 @@ async function executeMetadataCommand(args, request, options2) {
|
|
|
5545
5763
|
const type = args.metadataType ?? known[0]?.type ?? coreDefinition(args.metadataName)?.[2];
|
|
5546
5764
|
let value = args.metadataValue;
|
|
5547
5765
|
if (action === "set" && type === "boolean") {
|
|
5548
|
-
if (value !== "true" && value !== "false")
|
|
5766
|
+
if (value !== "true" && value !== "false") usage7("Boolean properties require true or false.");
|
|
5549
5767
|
value = value === "true";
|
|
5550
5768
|
} else if (action === "set" && type === "number") {
|
|
5551
5769
|
try {
|
|
5552
5770
|
value = JSON.parse(args.metadataValue);
|
|
5553
5771
|
} catch {
|
|
5554
|
-
|
|
5772
|
+
usage7("Number properties require a finite JSON number.");
|
|
5555
5773
|
}
|
|
5556
|
-
if (typeof value !== "number" || !Number.isFinite(value))
|
|
5774
|
+
if (typeof value !== "number" || !Number.isFinite(value)) usage7("Number properties require a finite JSON number.");
|
|
5557
5775
|
}
|
|
5558
5776
|
bytes = (await mutateProperty(original, action, { name: args.metadataName, ...action === "set" ? { value, ...type === void 0 ? {} : { type } } : {} }, context)).bytes;
|
|
5559
5777
|
affected = 1;
|
|
@@ -5573,22 +5791,22 @@ ${sanitization.retained.map((entry) => `Retained ${entry.category} ${entry.kind}
|
|
|
5573
5791
|
}
|
|
5574
5792
|
|
|
5575
5793
|
// packages/safe-bash-command-pptx/src/command-notes.ts
|
|
5576
|
-
import { OfficeError as
|
|
5794
|
+
import { OfficeError as OfficeError13 } from "../../safe-bash-presentation-engine/errors.js";
|
|
5577
5795
|
import { mutateNotes, readNotes, validateNotesOptions } from "../../safe-bash-presentation-engine/notes.js";
|
|
5578
5796
|
import { readSelectionIndex, SelectionError as SelectionError4 } from "../../safe-bash-presentation-engine/selectors.js";
|
|
5579
|
-
function
|
|
5580
|
-
throw new
|
|
5797
|
+
function usage8(message) {
|
|
5798
|
+
throw new OfficeError13("invalid-value", message, "usage");
|
|
5581
5799
|
}
|
|
5582
5800
|
function validateNotesCommand(args, positionals, seen) {
|
|
5583
5801
|
const allowed = Object.keys(noteSchemas[args.operation].options.properties).map(
|
|
5584
5802
|
(key) => "--" + [...key].map((c) => c >= "A" && c <= "Z" ? "-" + c.toLowerCase() : c).join("")
|
|
5585
5803
|
);
|
|
5586
|
-
if ([...seen].some((flag) => !allowed.includes(flag)))
|
|
5587
|
-
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.");
|
|
5588
5806
|
args.input = positionals[0];
|
|
5589
|
-
if (args.scope !== void 0 && args.scope !== "notes")
|
|
5807
|
+
if (args.scope !== void 0 && args.scope !== "notes") usage8("Notes require notes scope.");
|
|
5590
5808
|
if (args.token && ["--slide", "--scope"].some((flag) => seen.has(flag)))
|
|
5591
|
-
|
|
5809
|
+
usage8("Opaque and simple selectors cannot be combined.");
|
|
5592
5810
|
if (args.operation === "notes.list" || args.operation === "notes.get") return;
|
|
5593
5811
|
if (!args.token && args.slide === void 0 && !args.all)
|
|
5594
5812
|
throw new SelectionError4("missing-selection");
|
|
@@ -5596,14 +5814,14 @@ function validateNotesCommand(args, positionals, seen) {
|
|
|
5596
5814
|
selection: { kind: "slide" },
|
|
5597
5815
|
...args.noteText === void 0 ? {} : { text: args.noteText }
|
|
5598
5816
|
});
|
|
5599
|
-
if (args.inPlace && args.input === "-")
|
|
5600
|
-
if (args.inPlace && args.output)
|
|
5601
|
-
if (!args.dryRun && !args.inPlace && !args.output)
|
|
5602
|
-
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.");
|
|
5603
5821
|
if (args.output === args.input && args.output !== "-")
|
|
5604
|
-
|
|
5822
|
+
usage8("Replacing input requires --in-place.");
|
|
5605
5823
|
if (args.output === "-" && args.json && !args.dryRun)
|
|
5606
|
-
|
|
5824
|
+
usage8("Binary stdout cannot be combined with JSON.");
|
|
5607
5825
|
}
|
|
5608
5826
|
async function executeNotesCommand(args, request, options2) {
|
|
5609
5827
|
const context = { ...options2.context, signal: request.signal };
|
|
@@ -5859,33 +6077,33 @@ var linkSchemas = Object.fromEntries(
|
|
|
5859
6077
|
// packages/safe-bash-command-pptx/src/command-links.ts
|
|
5860
6078
|
import { readPackage as readPackage2 } from "../../safe-bash-presentation-engine/package-reader.js";
|
|
5861
6079
|
import { parseXmlPart as parseXmlPart2 } from "../../safe-bash-presentation-engine/xml.js";
|
|
5862
|
-
import { OfficeError as
|
|
6080
|
+
import { OfficeError as OfficeError14 } from "../../safe-bash-presentation-engine/errors.js";
|
|
5863
6081
|
import { listLinks, setLink, removeLink, isOrdinaryLinkUrl } from "../../safe-bash-presentation-engine/links.js";
|
|
5864
6082
|
import { readShapes } from "../../safe-bash-presentation-engine/shape-operations.js";
|
|
5865
6083
|
import { SelectionError as SelectionError5 } from "../../safe-bash-presentation-engine/selectors.js";
|
|
5866
|
-
function
|
|
5867
|
-
throw new
|
|
6084
|
+
function usage9(message) {
|
|
6085
|
+
throw new OfficeError14("invalid-value", message, "usage");
|
|
5868
6086
|
}
|
|
5869
6087
|
function validateLinkCommand(args, positionals, seen) {
|
|
5870
6088
|
const allowed = Object.keys(linkSchemas[args.operation].options.properties).map(
|
|
5871
6089
|
(key) => "--" + [...key].map((c) => c >= "A" && c <= "Z" ? "-" + c.toLowerCase() : c).join("")
|
|
5872
6090
|
);
|
|
5873
|
-
if ([...seen].some((flag) => !allowed.includes(flag)))
|
|
5874
|
-
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.");
|
|
5875
6093
|
args.input = positionals[0];
|
|
5876
|
-
if (args.scope !== void 0 && args.scope !== "slides")
|
|
6094
|
+
if (args.scope !== void 0 && args.scope !== "slides") usage9("Links support slides scope.");
|
|
5877
6095
|
if (args.token && ["--slide", "--shape", "--scope"].some((flag) => seen.has(flag)))
|
|
5878
|
-
|
|
6096
|
+
usage9("Opaque and simple selectors cannot be combined.");
|
|
5879
6097
|
if (args.shape !== void 0 && args.slide === void 0)
|
|
5880
|
-
|
|
6098
|
+
usage9("Shape selection requires a slide.");
|
|
5881
6099
|
const edit = args.linkEdit ?? {};
|
|
5882
6100
|
if (edit.trigger !== void 0 && !["click", "hover"].includes(edit.trigger))
|
|
5883
|
-
|
|
6101
|
+
usage9("Unsupported link trigger.");
|
|
5884
6102
|
if (edit.path !== void 0 && (!Array.isArray(edit.path) || edit.path.some((value) => !Number.isSafeInteger(value) || value < 0)))
|
|
5885
|
-
|
|
6103
|
+
usage9("Link path requires an array of nonnegative integer child positions.");
|
|
5886
6104
|
if (["links.list", "links.get"].includes(args.operation)) return;
|
|
5887
6105
|
if (!args.token && args.slide === void 0 && !args.all)
|
|
5888
|
-
|
|
6106
|
+
usage9("Link mutation requires explicit selection.");
|
|
5889
6107
|
if (args.operation !== "links.remove") {
|
|
5890
6108
|
const url = edit.url !== void 0, slide = edit.targetSlide !== void 0;
|
|
5891
6109
|
if (Number(url) + Number(slide) + Number(
|
|
@@ -5893,20 +6111,20 @@ function validateLinkCommand(args, positionals, seen) {
|
|
|
5893
6111
|
edit.action ?? ""
|
|
5894
6112
|
)
|
|
5895
6113
|
) !== 1)
|
|
5896
|
-
|
|
6114
|
+
usage9("Provide exactly one link destination.");
|
|
5897
6115
|
if (url && (!isOrdinaryLinkUrl(edit.url) || edit.action !== void 0 && edit.action !== "url"))
|
|
5898
|
-
|
|
6116
|
+
usage9("URL action must agree with its destination.");
|
|
5899
6117
|
if (slide && edit.action !== void 0 && edit.action !== "slide")
|
|
5900
|
-
|
|
6118
|
+
usage9("Slide action must agree with its destination.");
|
|
5901
6119
|
}
|
|
5902
|
-
if (args.inPlace && args.input === "-")
|
|
5903
|
-
if (args.inPlace && args.output)
|
|
5904
|
-
if (!args.dryRun && !args.inPlace && !args.output)
|
|
5905
|
-
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.");
|
|
5906
6124
|
if (args.output === args.input && args.output !== "-")
|
|
5907
|
-
|
|
6125
|
+
usage9("Replacing input requires --in-place.");
|
|
5908
6126
|
if (args.output === "-" && args.json && !args.dryRun)
|
|
5909
|
-
|
|
6127
|
+
usage9("Binary stdout cannot be combined with JSON.");
|
|
5910
6128
|
}
|
|
5911
6129
|
var actionNames = {
|
|
5912
6130
|
url: "hyperlink",
|
|
@@ -6002,7 +6220,7 @@ async function executeLinkCommand(args, request, options2) {
|
|
|
6002
6220
|
if (args.operation === "links.add" && selectedLinks.some(
|
|
6003
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])))
|
|
6004
6222
|
))
|
|
6005
|
-
throw new
|
|
6223
|
+
throw new OfficeError14(
|
|
6006
6224
|
"unsupported-edit",
|
|
6007
6225
|
"Selected trigger already contains a link.",
|
|
6008
6226
|
"validate-intent"
|
|
@@ -7029,11 +7247,11 @@ import { readAnimations } from "../../safe-bash-presentation-engine/animations.j
|
|
|
7029
7247
|
import { mutateAnimations, mutateAnimationsBatch, validateAnimationOptions as validateAnimationOptions2 } from "../../safe-bash-presentation-engine/animation-editing.js";
|
|
7030
7248
|
|
|
7031
7249
|
// packages/safe-bash-command-pptx/src/animation-batch-command.ts
|
|
7032
|
-
import { OfficeError as
|
|
7250
|
+
import { OfficeError as OfficeError15 } from "../../safe-bash-presentation-engine/errors.js";
|
|
7033
7251
|
import { validateAnimationOptions } from "../../safe-bash-presentation-engine/animation-editing.js";
|
|
7034
7252
|
import { decodeSelectionToken, SelectionError as SelectionError6 } from "../../safe-bash-presentation-engine/selectors.js";
|
|
7035
7253
|
function invalid(message) {
|
|
7036
|
-
throw new
|
|
7254
|
+
throw new OfficeError15("invalid-value", message, "usage");
|
|
7037
7255
|
}
|
|
7038
7256
|
function record(value, keys) {
|
|
7039
7257
|
if (!value || typeof value !== "object" || Array.isArray(value) || Object.keys(value).some((key) => !keys.includes(key))) invalid("Invalid animation batch fields.");
|
|
@@ -7241,31 +7459,31 @@ var equationSchemas = Object.fromEntries(["list", "get", "add"].map((action) =>
|
|
|
7241
7459
|
}));
|
|
7242
7460
|
|
|
7243
7461
|
// packages/safe-bash-command-pptx/src/command-equations.ts
|
|
7244
|
-
import { OfficeError as
|
|
7462
|
+
import { OfficeError as OfficeError16 } from "../../safe-bash-presentation-engine/errors.js";
|
|
7245
7463
|
import { readEquations, mutateEquations } from "../../safe-bash-presentation-engine/equations.js";
|
|
7246
7464
|
import { SelectionError as SelectionError7 } from "../../safe-bash-presentation-engine/selectors.js";
|
|
7247
|
-
function
|
|
7248
|
-
throw new
|
|
7465
|
+
function usage10(message) {
|
|
7466
|
+
throw new OfficeError16("invalid-value", message, "usage");
|
|
7249
7467
|
}
|
|
7250
7468
|
function validateEquationCommand(args, positionals, seen) {
|
|
7251
7469
|
const schema = equationSchemas[args.operation];
|
|
7252
7470
|
const allowed = Object.keys(schema.options.properties).map((key) => "--" + [...key].map((c) => c >= "A" && c <= "Z" ? "-" + c.toLowerCase() : c).join(""));
|
|
7253
|
-
if ([...seen].some((flag) => !allowed.includes(flag)))
|
|
7254
|
-
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.");
|
|
7255
7473
|
args.input = positionals[0];
|
|
7256
|
-
if (args.scope !== void 0 && args.scope !== "slides")
|
|
7257
|
-
if (args.token && ["--slide", "--shape", "--scope"].some((flag) => seen.has(flag)))
|
|
7258
|
-
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.");
|
|
7259
7477
|
if (args.operation !== "equations.add") return;
|
|
7260
|
-
if (!args.file)
|
|
7261
|
-
if (!args.token && !args.shape)
|
|
7262
|
-
if (args.input === "-" && args.file === "-")
|
|
7263
|
-
if (args.inPlace && args.input === "-")
|
|
7264
|
-
if (args.inPlace && args.output)
|
|
7265
|
-
if (!args.dryRun && !args.inPlace && !args.output)
|
|
7266
|
-
if (args.force && !args.output)
|
|
7267
|
-
if (args.output === args.input && args.output !== "-")
|
|
7268
|
-
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.");
|
|
7269
7487
|
}
|
|
7270
7488
|
async function executeEquationCommand(args, request, options2) {
|
|
7271
7489
|
const context = { ...options2.context, signal: request.signal };
|
|
@@ -7396,30 +7614,30 @@ var opaqueSchemas = Object.fromEntries(["objects.list", "objects.extract", "font
|
|
|
7396
7614
|
|
|
7397
7615
|
// packages/safe-bash-command-pptx/src/command-opaque.ts
|
|
7398
7616
|
import { sha256 as sha2563 } from "@noble/hashes/sha2.js";
|
|
7399
|
-
import { OfficeError as
|
|
7617
|
+
import { OfficeError as OfficeError17 } from "../../safe-bash-presentation-engine/errors.js";
|
|
7400
7618
|
import { extractObject, readFonts, readObjects } from "../../safe-bash-presentation-engine/opaque-objects.js";
|
|
7401
|
-
import { partName as
|
|
7402
|
-
function
|
|
7403
|
-
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");
|
|
7404
7622
|
}
|
|
7405
7623
|
function validateOpaqueCommand(args, positionals, seen) {
|
|
7406
7624
|
const schema = opaqueSchemas[args.operation];
|
|
7407
7625
|
const allowed = Object.keys(schema.options.properties).map((key) => "--" + [...key].map((c) => c >= "A" && c <= "Z" ? "-" + c.toLowerCase() : c).join(""));
|
|
7408
|
-
if ([...seen].some((flag) => !allowed.includes(flag)))
|
|
7409
|
-
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.");
|
|
7410
7628
|
args.input = positionals[0];
|
|
7411
7629
|
const scope = args.operation === "fonts.list" ? "presentation" : "shared";
|
|
7412
|
-
if (args.scope !== void 0 && args.scope !== scope)
|
|
7630
|
+
if (args.scope !== void 0 && args.scope !== scope) usage11("Unsupported opaque resource scope.");
|
|
7413
7631
|
if (args.operation !== "objects.extract") return;
|
|
7414
|
-
if (!args.part)
|
|
7632
|
+
if (!args.part) usage11("Object extraction requires --part.");
|
|
7415
7633
|
try {
|
|
7416
|
-
if (
|
|
7634
|
+
if (partName3(args.part, false) !== args.part) usage11("Object extraction requires a canonical package part.");
|
|
7417
7635
|
} catch {
|
|
7418
|
-
|
|
7636
|
+
usage11("Object extraction requires a canonical package part.");
|
|
7419
7637
|
}
|
|
7420
|
-
if (!args.outputDir && !args.dryRun)
|
|
7421
|
-
if (args.outputDir === "-")
|
|
7422
|
-
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.");
|
|
7423
7641
|
}
|
|
7424
7642
|
async function executeOpaqueCommand(args, request, options2) {
|
|
7425
7643
|
const context = { ...options2.context, signal: request.signal };
|
|
@@ -7437,7 +7655,7 @@ async function executeOpaqueCommand(args, request, options2) {
|
|
|
7437
7655
|
}
|
|
7438
7656
|
const extracted = await extractObject(bytes, { part: args.part }, context);
|
|
7439
7657
|
const files = [{ part: extracted.part, name: extracted.name, bytes: extracted.bytes }, ...extracted.dependencies];
|
|
7440
|
-
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");
|
|
7441
7659
|
const dryRun = args.dryRun ?? false;
|
|
7442
7660
|
const allowPartialOutput = args.allowPartialOutput ?? false;
|
|
7443
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" });
|
|
@@ -7469,7 +7687,7 @@ import { readMedia } from "../../safe-bash-presentation-engine/media.js";
|
|
|
7469
7687
|
import { extractMedia } from "../../safe-bash-presentation-engine/media-extraction.js";
|
|
7470
7688
|
|
|
7471
7689
|
// packages/safe-bash-command-pptx/src/command-media-editing.ts
|
|
7472
|
-
import { OfficeError as
|
|
7690
|
+
import { OfficeError as OfficeError18 } from "../../safe-bash-presentation-engine/errors.js";
|
|
7473
7691
|
import { addMedia, replaceMedia } from "../../safe-bash-presentation-engine/media-editing.js";
|
|
7474
7692
|
|
|
7475
7693
|
// packages/safe-bash-command-pptx/src/media-schema.ts
|
|
@@ -7718,56 +7936,56 @@ for (const action of ["add", "replace", "extract"]) {
|
|
|
7718
7936
|
}
|
|
7719
7937
|
|
|
7720
7938
|
// packages/safe-bash-command-pptx/src/command-media-editing.ts
|
|
7721
|
-
function
|
|
7722
|
-
throw new
|
|
7939
|
+
function usage12(message) {
|
|
7940
|
+
throw new OfficeError18("invalid-value", message, "usage");
|
|
7723
7941
|
}
|
|
7724
7942
|
function validateMediaEditingCommand(args, positionals, seen) {
|
|
7725
7943
|
const allowed = Object.keys(mediaSchemas[args.operation].options.properties).map(
|
|
7726
7944
|
(key) => "--" + [...key].map((c) => c >= "A" && c <= "Z" ? "-" + c.toLowerCase() : c).join("")
|
|
7727
7945
|
);
|
|
7728
7946
|
if ([...seen].some((flag) => !allowed.includes(flag)))
|
|
7729
|
-
|
|
7730
|
-
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.");
|
|
7731
7949
|
args.input = positionals[0];
|
|
7732
7950
|
if (args.token && ["--slide", "--shape", "--scope", "--all"].some((flag) => seen.has(flag)))
|
|
7733
|
-
|
|
7951
|
+
usage12("Opaque and simple selectors cannot be combined.");
|
|
7734
7952
|
if (args.shape !== void 0 && args.slide === void 0)
|
|
7735
|
-
|
|
7953
|
+
usage12("Shape selection requires an owning slide.");
|
|
7736
7954
|
if (args.operation === "media.extract") {
|
|
7737
7955
|
if (!args.outputDir || args.outputDir === "-")
|
|
7738
|
-
|
|
7956
|
+
usage12("Media extraction requires an output directory.");
|
|
7739
7957
|
return;
|
|
7740
7958
|
}
|
|
7741
7959
|
if (args.operation === "media.add" && args.scope !== void 0 && args.scope !== "slides")
|
|
7742
|
-
|
|
7743
|
-
if (!args.file)
|
|
7960
|
+
usage12("Media editing requires slides scope.");
|
|
7961
|
+
if (!args.file) usage12("Media mutation requires --file.");
|
|
7744
7962
|
if (args.operation === "media.add") {
|
|
7745
7963
|
if (args.slide === void 0 || !args.mediaEdit?.kind || !args.mediaEdit.contentType || ["left", "top", "width", "height"].some(
|
|
7746
7964
|
(key) => args.mediaEdit?.[key] === void 0
|
|
7747
7965
|
))
|
|
7748
|
-
|
|
7749
|
-
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.");
|
|
7750
7968
|
} else {
|
|
7751
|
-
if (!args.poster)
|
|
7969
|
+
if (!args.poster) usage12("Media replacement requires an explicit poster.");
|
|
7752
7970
|
if (!args.token && args.shape === void 0 && !args.all)
|
|
7753
|
-
|
|
7971
|
+
usage12("Media replacement requires a shape selector or all.");
|
|
7754
7972
|
}
|
|
7755
7973
|
if ([args.input, args.file, args.poster].filter((value) => value === "-").length > 1)
|
|
7756
|
-
|
|
7974
|
+
usage12("Only one input may consume stdin.");
|
|
7757
7975
|
if (args.poster && !args.posterContentType) {
|
|
7758
7976
|
const extension = args.poster.slice(args.poster.lastIndexOf(".") + 1).toLowerCase();
|
|
7759
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];
|
|
7760
|
-
if (!inferred)
|
|
7978
|
+
if (!inferred) usage12("Poster requires an explicit content type or supported extension.");
|
|
7761
7979
|
args.posterContentType = inferred;
|
|
7762
7980
|
}
|
|
7763
|
-
if (args.inPlace && args.input === "-")
|
|
7764
|
-
if (args.inPlace && args.output)
|
|
7765
|
-
if (!args.dryRun && !args.inPlace && !args.output)
|
|
7766
|
-
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.");
|
|
7767
7985
|
if (args.output === args.input && args.output !== "-")
|
|
7768
|
-
|
|
7986
|
+
usage12("Replacing input requires --in-place.");
|
|
7769
7987
|
if (args.output === "-" && args.json && !args.dryRun)
|
|
7770
|
-
|
|
7988
|
+
usage12("Binary stdout cannot be combined with JSON.");
|
|
7771
7989
|
}
|
|
7772
7990
|
async function executeMediaEditingCommand(args, request, options2) {
|
|
7773
7991
|
const context = { ...options2.context, signal: request.signal };
|
|
@@ -8813,9 +9031,9 @@ import {
|
|
|
8813
9031
|
import { readBackgrounds, mutateBackground } from "../../safe-bash-presentation-engine/backgrounds.js";
|
|
8814
9032
|
import { replacePresentationText } from "../../safe-bash-presentation-engine/text-replacement.js";
|
|
8815
9033
|
import { readPresentationText } from "../../safe-bash-presentation-engine/text-reading.js";
|
|
8816
|
-
import { OfficeError as
|
|
9034
|
+
import { OfficeError as OfficeError19 } from "../../safe-bash-presentation-engine/errors.js";
|
|
8817
9035
|
import { sha256 as sha2564 } from "@noble/hashes/sha2.js";
|
|
8818
|
-
import { packageUri, partName as
|
|
9036
|
+
import { packageUri, partName as partName4 } from "../../safe-bash-presentation-engine/package-uri.js";
|
|
8819
9037
|
import {
|
|
8820
9038
|
SelectionError as SelectionError8,
|
|
8821
9039
|
decodeSelectionToken as decodeSelectionToken2,
|
|
@@ -8848,7 +9066,7 @@ import {
|
|
|
8848
9066
|
import { getXmlPart, stageRetainedXmlPart, stageRetainedXmlReplacement, replaceXmlPart } from "../../safe-bash-presentation-engine/xml-parts.js";
|
|
8849
9067
|
import { validatePresentation, openRetainedPresentationValidation } from "../../safe-bash-presentation-engine/validation.js";
|
|
8850
9068
|
import { readPackage as readPackage3 } from "../../safe-bash-presentation-engine/package-reader.js";
|
|
8851
|
-
import { resourceContext } from "../../safe-bash-presentation-engine/resource-limits.js";
|
|
9069
|
+
import { resourceContext as resourceContext2 } from "../../safe-bash-presentation-engine/resource-limits.js";
|
|
8852
9070
|
var scopes2 = [
|
|
8853
9071
|
"slides",
|
|
8854
9072
|
"notes",
|
|
@@ -9014,15 +9232,15 @@ Dimension conflicts reject by default; destination policy retains source coordin
|
|
|
9014
9232
|
Slides add requires an exact layout name or part URI; position defaults to append.
|
|
9015
9233
|
Title/body match placeholder types; indexed bindings use --placeholders-json.
|
|
9016
9234
|
`;
|
|
9017
|
-
function
|
|
9018
|
-
throw new
|
|
9235
|
+
function usage13(message) {
|
|
9236
|
+
throw new OfficeError19("invalid-value", message, "usage");
|
|
9019
9237
|
}
|
|
9020
9238
|
function paragraphTabLength(length4) {
|
|
9021
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")
|
|
9022
|
-
|
|
9240
|
+
usage13("Tabs require finite explicit lengths.");
|
|
9023
9241
|
const emu = length4.value * commandLength("1" + length4.unit, 0);
|
|
9024
9242
|
if (!Number.isFinite(emu) || emu > Number.MAX_SAFE_INTEGER)
|
|
9025
|
-
|
|
9243
|
+
usage13("Tab length is outside the supported range.");
|
|
9026
9244
|
return Math.round(emu) / 12700;
|
|
9027
9245
|
}
|
|
9028
9246
|
var runFlags = [
|
|
@@ -9270,11 +9488,11 @@ function parse(raw, maximum, output3) {
|
|
|
9270
9488
|
const decoder = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true });
|
|
9271
9489
|
for (let index = 0; index < raw.length; index++) {
|
|
9272
9490
|
const bytes = raw[index];
|
|
9273
|
-
if (!(bytes instanceof Uint8Array))
|
|
9491
|
+
if (!(bytes instanceof Uint8Array)) usage13("Arguments must be byte arrays.");
|
|
9274
9492
|
size += bytes.length + 1;
|
|
9275
9493
|
if (size > maximum) {
|
|
9276
|
-
if (invalidUtf8)
|
|
9277
|
-
throw new
|
|
9494
|
+
if (invalidUtf8) usage13("Arguments must be UTF-8.");
|
|
9495
|
+
throw new OfficeError19("resource-limit", "Argument limit exceeded.", "usage");
|
|
9278
9496
|
}
|
|
9279
9497
|
try {
|
|
9280
9498
|
args.push(decoder.decode(bytes));
|
|
@@ -9345,9 +9563,9 @@ function parse(raw, maximum, output3) {
|
|
|
9345
9563
|
else if (scalarOptions.includes(argument)) hintValue = true;
|
|
9346
9564
|
}
|
|
9347
9565
|
}
|
|
9348
|
-
if (invalidUtf8)
|
|
9566
|
+
if (invalidUtf8) usage13("Arguments must be UTF-8.");
|
|
9349
9567
|
if (args[0] === "accessibility" && ["--help", "-h"].includes(args[1])) {
|
|
9350
|
-
if (args.slice(2).some((argument) => argument !== "--json"))
|
|
9568
|
+
if (args.slice(2).some((argument) => argument !== "--json")) usage13("Unexpected help option.");
|
|
9351
9569
|
return { operation: "help", json: output3.json, schemaPath: "accessibility" };
|
|
9352
9570
|
}
|
|
9353
9571
|
if (args[0] === "text" && ["runs", "paragraphs", "frames"].includes(args[1]) && ["get", "set", "list"].includes(args[2])) {
|
|
@@ -9452,7 +9670,7 @@ function parse(raw, maximum, output3) {
|
|
|
9452
9670
|
"help",
|
|
9453
9671
|
"version"
|
|
9454
9672
|
].includes(operation))
|
|
9455
|
-
|
|
9673
|
+
usage13("Unsupported operation.");
|
|
9456
9674
|
const result = { operation, json: false };
|
|
9457
9675
|
const positionals = [];
|
|
9458
9676
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -9482,10 +9700,10 @@ function parse(raw, maximum, output3) {
|
|
|
9482
9700
|
"--height",
|
|
9483
9701
|
"--workbook-policy"
|
|
9484
9702
|
].includes(argument)) {
|
|
9485
|
-
if (seen.has(argument))
|
|
9703
|
+
if (seen.has(argument)) usage13("Repeated option.");
|
|
9486
9704
|
seen.add(argument);
|
|
9487
9705
|
const value2 = args[++index];
|
|
9488
|
-
if (value2 === void 0)
|
|
9706
|
+
if (value2 === void 0) usage13("Chart option requires a value.");
|
|
9489
9707
|
const key = argument.slice(2);
|
|
9490
9708
|
if (key === "workbook-policy") result.chartWorkbookPolicy = value2;
|
|
9491
9709
|
else {
|
|
@@ -9493,10 +9711,10 @@ function parse(raw, maximum, output3) {
|
|
|
9493
9711
|
if (key === "data" || key === "objects") parsed = commandJson(value2);
|
|
9494
9712
|
else if (key === "style") {
|
|
9495
9713
|
if (!value2.length || [...value2].some((c) => c < "0" || c > "9"))
|
|
9496
|
-
|
|
9714
|
+
usage13("Chart style requires an integer.");
|
|
9497
9715
|
parsed = Number(value2);
|
|
9498
9716
|
} else if (key === "legend") {
|
|
9499
|
-
if (!["true", "false"].includes(value2))
|
|
9717
|
+
if (!["true", "false"].includes(value2)) usage13("Legend requires true or false.");
|
|
9500
9718
|
parsed = value2 === "true";
|
|
9501
9719
|
} else if (["left", "top", "width", "height"].includes(key))
|
|
9502
9720
|
parsed = commandLength(
|
|
@@ -9510,14 +9728,14 @@ function parse(raw, maximum, output3) {
|
|
|
9510
9728
|
if (operation.startsWith("tables.") && (argument === "--table" || argument === "--cell" || ["--from", "--to", "--position", "--span-policy"].includes(argument) || Object.keys(tableValues).some(
|
|
9511
9729
|
(key) => "--" + [...key].map((c) => c >= "A" && c <= "Z" ? "-" + c.toLowerCase() : c).join("") === argument
|
|
9512
9730
|
))) {
|
|
9513
|
-
if (seen.has(argument))
|
|
9731
|
+
if (seen.has(argument)) usage13("Repeated option.");
|
|
9514
9732
|
seen.add(argument);
|
|
9515
9733
|
const value2 = args[++index];
|
|
9516
|
-
if (value2 === void 0)
|
|
9734
|
+
if (value2 === void 0) usage13("Table option requires a value.");
|
|
9517
9735
|
const key = argument.slice(2).split("-").map((word, i) => i ? word[0].toUpperCase() + word.slice(1) : word).join("");
|
|
9518
9736
|
if (key === "table" || key === "rows" || key === "columns" || key === "position") {
|
|
9519
9737
|
if (!value2.length || [...value2].some((c) => c < "0" || c > "9") || !Number.isSafeInteger(Number(value2)) || Number(value2) < 1)
|
|
9520
|
-
|
|
9738
|
+
usage13("Table positions and dimensions require positive integers.");
|
|
9521
9739
|
if (key === "position") result.tablePosition = Number(value2);
|
|
9522
9740
|
else if (key === "table") result.table = Number(value2);
|
|
9523
9741
|
else result.tableEdit = { ...result.tableEdit, [key]: Number(value2) };
|
|
@@ -9526,7 +9744,7 @@ function parse(raw, maximum, output3) {
|
|
|
9526
9744
|
try {
|
|
9527
9745
|
tableCell(value2);
|
|
9528
9746
|
} catch {
|
|
9529
|
-
|
|
9747
|
+
usage13("Cell requires one-based row,column coordinates.");
|
|
9530
9748
|
}
|
|
9531
9749
|
if (key === "from") result.tableFrom = value2;
|
|
9532
9750
|
else if (key === "to") result.tableTo = value2;
|
|
@@ -9548,7 +9766,7 @@ function parse(raw, maximum, output3) {
|
|
|
9548
9766
|
let parsed = value2;
|
|
9549
9767
|
if (key === "data") parsed = commandJson(value2);
|
|
9550
9768
|
else if (["firstRow", "lastRow", "firstCol", "lastCol", "horzBand", "vertBand"].includes(key)) {
|
|
9551
|
-
if (!["true", "false"].includes(value2))
|
|
9769
|
+
if (!["true", "false"].includes(value2)) usage13("Table style flags require true or false.");
|
|
9552
9770
|
parsed = value2 === "true";
|
|
9553
9771
|
} else if (value2 === "null" && !["text"].includes(key)) parsed = null;
|
|
9554
9772
|
else if (lengths.includes(key))
|
|
@@ -9573,10 +9791,10 @@ function parse(raw, maximum, output3) {
|
|
|
9573
9791
|
"--line-width",
|
|
9574
9792
|
"--line-color"
|
|
9575
9793
|
].includes(argument)) {
|
|
9576
|
-
if (seen.has(argument))
|
|
9794
|
+
if (seen.has(argument)) usage13("Repeated option.");
|
|
9577
9795
|
seen.add(argument);
|
|
9578
9796
|
const value2 = args[++index];
|
|
9579
|
-
if (value2 === void 0)
|
|
9797
|
+
if (value2 === void 0) usage13("Connector option requires a value.");
|
|
9580
9798
|
const keys = {
|
|
9581
9799
|
"--begin-x": "beginX",
|
|
9582
9800
|
"--begin-y": "beginY",
|
|
@@ -9590,7 +9808,7 @@ function parse(raw, maximum, output3) {
|
|
|
9590
9808
|
};
|
|
9591
9809
|
const key = keys[argument] ?? argument.slice(2);
|
|
9592
9810
|
if (key === "site" && (!value2 || [...value2].some((c) => c < "0" || c > "9")))
|
|
9593
|
-
|
|
9811
|
+
usage13("Sites require nonnegative decimal integers.");
|
|
9594
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;
|
|
9595
9813
|
result.connectorEdit = { ...result.connectorEdit, [key]: parsed };
|
|
9596
9814
|
continue;
|
|
@@ -9607,14 +9825,14 @@ function parse(raw, maximum, output3) {
|
|
|
9607
9825
|
"--offset-x",
|
|
9608
9826
|
"--offset-y"
|
|
9609
9827
|
].includes(argument)) {
|
|
9610
|
-
if (seen.has(argument))
|
|
9828
|
+
if (seen.has(argument)) usage13("Repeated option.");
|
|
9611
9829
|
seen.add(argument);
|
|
9612
9830
|
const value2 = args[++index];
|
|
9613
|
-
if (value2 === void 0)
|
|
9831
|
+
if (value2 === void 0) usage13("Shape selection option requires a value.");
|
|
9614
9832
|
if (argument === "--shapes") {
|
|
9615
9833
|
const locations = commandJson(value2);
|
|
9616
9834
|
if (!Array.isArray(locations) || locations.length === 0)
|
|
9617
|
-
|
|
9835
|
+
usage13("Shapes requires a nonempty location array.");
|
|
9618
9836
|
result.shapes = locations;
|
|
9619
9837
|
} else {
|
|
9620
9838
|
const key = argument === "--coordinate-system" ? "coordinateSystem" : argument === "--offset-x" ? "offsetX" : argument === "--offset-y" ? "offsetY" : argument.slice(2);
|
|
@@ -9627,24 +9845,24 @@ function parse(raw, maximum, output3) {
|
|
|
9627
9845
|
continue;
|
|
9628
9846
|
}
|
|
9629
9847
|
if (["shapes.group", "shapes.ungroup"].includes(operation) && ["--shapes", "--tolerance"].includes(argument)) {
|
|
9630
|
-
if (seen.has(argument))
|
|
9848
|
+
if (seen.has(argument)) usage13("Repeated option.");
|
|
9631
9849
|
seen.add(argument);
|
|
9632
9850
|
const value2 = args[++index];
|
|
9633
|
-
if (value2 === void 0)
|
|
9851
|
+
if (value2 === void 0) usage13("Group option requires a value.");
|
|
9634
9852
|
if (argument === "--tolerance") result.tolerance = new Emu(commandLength(value2, 0));
|
|
9635
9853
|
else {
|
|
9636
9854
|
const locations = commandJson(value2);
|
|
9637
9855
|
if (!Array.isArray(locations) || locations.length < 2)
|
|
9638
|
-
|
|
9856
|
+
usage13("Grouping requires at least two shape locations.");
|
|
9639
9857
|
result.shapes = locations;
|
|
9640
9858
|
}
|
|
9641
9859
|
continue;
|
|
9642
9860
|
}
|
|
9643
9861
|
if (operation.startsWith("fields.") && ["--kind", "--text", "--update", "--timestamp"].includes(argument)) {
|
|
9644
|
-
if (seen.has(argument))
|
|
9862
|
+
if (seen.has(argument)) usage13("Repeated option.");
|
|
9645
9863
|
seen.add(argument);
|
|
9646
9864
|
const value2 = args[++index];
|
|
9647
|
-
if (value2 === void 0)
|
|
9865
|
+
if (value2 === void 0) usage13("Field option requires a value.");
|
|
9648
9866
|
const key = argument.slice(2);
|
|
9649
9867
|
result.fieldEdit = {
|
|
9650
9868
|
...result.fieldEdit,
|
|
@@ -9653,13 +9871,13 @@ function parse(raw, maximum, output3) {
|
|
|
9653
9871
|
continue;
|
|
9654
9872
|
}
|
|
9655
9873
|
if (operation.startsWith("animations.") && ["--kind", "--trigger", "--duration", "--delay", "--target"].includes(argument)) {
|
|
9656
|
-
if (seen.has(argument))
|
|
9874
|
+
if (seen.has(argument)) usage13("Repeated option.");
|
|
9657
9875
|
seen.add(argument);
|
|
9658
9876
|
const value2 = args[++index];
|
|
9659
|
-
if (value2 === void 0)
|
|
9877
|
+
if (value2 === void 0) usage13("Animation option requires a value.");
|
|
9660
9878
|
let parsed = value2;
|
|
9661
9879
|
if (argument === "--duration" || argument === "--delay") {
|
|
9662
|
-
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.");
|
|
9663
9881
|
parsed = Number(value2);
|
|
9664
9882
|
}
|
|
9665
9883
|
if (argument === "--target") parsed = animationTargetArgument(value2.trimStart().startsWith("{") ? commandJson(value2) : value2);
|
|
@@ -9667,31 +9885,31 @@ function parse(raw, maximum, output3) {
|
|
|
9667
9885
|
continue;
|
|
9668
9886
|
}
|
|
9669
9887
|
if (operation === "batch" && ["--ops-json", "--ops-file"].includes(argument)) {
|
|
9670
|
-
if (seen.has(argument))
|
|
9888
|
+
if (seen.has(argument)) usage13("Repeated option.");
|
|
9671
9889
|
seen.add(argument);
|
|
9672
9890
|
const value2 = args[++index];
|
|
9673
|
-
if (!value2)
|
|
9891
|
+
if (!value2) usage13("Batch option requires a value.");
|
|
9674
9892
|
if (argument === "--ops-json") result.animationBatch = parseAnimationBatch(commandJson(value2));
|
|
9675
9893
|
else result.opsFile = value2;
|
|
9676
9894
|
continue;
|
|
9677
9895
|
}
|
|
9678
9896
|
if (operation.startsWith("comments.") && ["--id", "--text", "--author", "--author-id", "--initials", "--timestamp", "--left", "--top"].includes(argument)) {
|
|
9679
|
-
if (seen.has(argument))
|
|
9897
|
+
if (seen.has(argument)) usage13("Repeated option.");
|
|
9680
9898
|
seen.add(argument);
|
|
9681
9899
|
const value2 = args[++index];
|
|
9682
|
-
if (value2 === void 0)
|
|
9900
|
+
if (value2 === void 0) usage13("Comment option requires a value.");
|
|
9683
9901
|
const key = argument === "--author-id" ? "authorId" : argument.slice(2);
|
|
9684
9902
|
const parsed = ["left", "top"].includes(key) ? commandLength(value2, -Number.MAX_SAFE_INTEGER) : key === "timestamp" ? commandTimestamp(value2).toISOString() : value2;
|
|
9685
9903
|
result.commentEdit = { ...result.commentEdit, [key]: parsed };
|
|
9686
9904
|
continue;
|
|
9687
9905
|
}
|
|
9688
9906
|
if (Object.hasOwn(accessibilitySchemas, operation) && ["--title", "--alt-text", "--decorative"].includes(argument)) {
|
|
9689
|
-
if (seen.has(argument))
|
|
9907
|
+
if (seen.has(argument)) usage13("Repeated option.");
|
|
9690
9908
|
seen.add(argument);
|
|
9691
9909
|
const value2 = args[++index];
|
|
9692
|
-
if (value2 === void 0)
|
|
9910
|
+
if (value2 === void 0) usage13("Accessibility option requires a value.");
|
|
9693
9911
|
if (argument === "--decorative") {
|
|
9694
|
-
if (value2 !== "true" && value2 !== "false")
|
|
9912
|
+
if (value2 !== "true" && value2 !== "false") usage13("Decorative requires true or false.");
|
|
9695
9913
|
result.accessibilityEdit = { ...result.accessibilityEdit, decorative: value2 === "true" };
|
|
9696
9914
|
} else {
|
|
9697
9915
|
const key = argument === "--alt-text" ? "altText" : "title";
|
|
@@ -9700,10 +9918,10 @@ function parse(raw, maximum, output3) {
|
|
|
9700
9918
|
continue;
|
|
9701
9919
|
}
|
|
9702
9920
|
if (Object.hasOwn(metadataSchemas, operation) && ["--name", "--value", "--type", "--remove"].includes(argument)) {
|
|
9703
|
-
if (seen.has(argument))
|
|
9921
|
+
if (seen.has(argument)) usage13("Repeated option.");
|
|
9704
9922
|
seen.add(argument);
|
|
9705
9923
|
const value2 = args[++index];
|
|
9706
|
-
if (value2 === void 0)
|
|
9924
|
+
if (value2 === void 0) usage13("Metadata option requires a value.");
|
|
9707
9925
|
if (argument === "--name") result.metadataName = value2;
|
|
9708
9926
|
else if (argument === "--value") result.metadataValue = value2;
|
|
9709
9927
|
else if (argument === "--type") result.metadataType = value2;
|
|
@@ -9711,49 +9929,49 @@ function parse(raw, maximum, output3) {
|
|
|
9711
9929
|
continue;
|
|
9712
9930
|
}
|
|
9713
9931
|
if (operation.startsWith("notes.") && argument === "--text") {
|
|
9714
|
-
if (seen.has(argument))
|
|
9932
|
+
if (seen.has(argument)) usage13("Repeated option.");
|
|
9715
9933
|
seen.add(argument);
|
|
9716
9934
|
const value2 = args[++index];
|
|
9717
|
-
if (value2 === void 0)
|
|
9935
|
+
if (value2 === void 0) usage13("Notes text requires a value.");
|
|
9718
9936
|
result.noteText = value2;
|
|
9719
9937
|
continue;
|
|
9720
9938
|
}
|
|
9721
9939
|
if (operation.startsWith("links.") && ["--url", "--target-slide", "--action", "--trigger", "--sanitize", "--path"].includes(argument)) {
|
|
9722
|
-
if (seen.has(argument))
|
|
9940
|
+
if (seen.has(argument)) usage13("Repeated option.");
|
|
9723
9941
|
seen.add(argument);
|
|
9724
9942
|
if (argument === "--sanitize") {
|
|
9725
9943
|
result.linkEdit = { ...result.linkEdit, sanitize: true };
|
|
9726
9944
|
continue;
|
|
9727
9945
|
}
|
|
9728
9946
|
const value2 = args[++index];
|
|
9729
|
-
if (value2 === void 0)
|
|
9730
|
-
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.");
|
|
9731
9949
|
const key = argument === "--target-slide" ? "targetSlide" : argument.slice(2);
|
|
9732
9950
|
result.linkEdit = { ...result.linkEdit, [key]: argument === "--target-slide" ? Number(value2) : argument === "--path" ? commandJson(value2) : value2 };
|
|
9733
9951
|
continue;
|
|
9734
9952
|
}
|
|
9735
9953
|
if (operation.startsWith("transitions.") && ["--kind", "--direction", "--duration", "--advance-after", "--advance-on-click"].includes(argument)) {
|
|
9736
|
-
if (seen.has(argument))
|
|
9954
|
+
if (seen.has(argument)) usage13("Repeated option.");
|
|
9737
9955
|
seen.add(argument);
|
|
9738
9956
|
const value2 = args[++index];
|
|
9739
|
-
if (value2 === void 0)
|
|
9957
|
+
if (value2 === void 0) usage13("Transition option requires a value.");
|
|
9740
9958
|
let parsed = value2;
|
|
9741
9959
|
if (argument === "--duration" || argument === "--advance-after") {
|
|
9742
9960
|
if (argument === "--advance-after" && value2 === "null") parsed = null;
|
|
9743
9961
|
else {
|
|
9744
|
-
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.");
|
|
9745
9963
|
parsed = Number(value2);
|
|
9746
9964
|
}
|
|
9747
9965
|
}
|
|
9748
9966
|
if (argument === "--advance-on-click") {
|
|
9749
|
-
if (value2 !== "true" && value2 !== "false")
|
|
9967
|
+
if (value2 !== "true" && value2 !== "false") usage13("Advance on click requires true or false.");
|
|
9750
9968
|
parsed = value2 === "true";
|
|
9751
9969
|
}
|
|
9752
9970
|
const key = argument === "--advance-after" ? "advanceAfter" : argument === "--advance-on-click" ? "advanceOnClick" : argument.slice(2);
|
|
9753
9971
|
result.transitionEdit = { ...result.transitionEdit, [key]: parsed };
|
|
9754
9972
|
continue;
|
|
9755
9973
|
}
|
|
9756
|
-
if (seen.has(argument) && argument !== "--limit")
|
|
9974
|
+
if (seen.has(argument) && argument !== "--limit") usage13("Repeated option.");
|
|
9757
9975
|
seen.add(argument);
|
|
9758
9976
|
if (argument === "--json") {
|
|
9759
9977
|
result.json = true;
|
|
@@ -9761,7 +9979,7 @@ function parse(raw, maximum, output3) {
|
|
|
9761
9979
|
}
|
|
9762
9980
|
if (argument === "--unique") {
|
|
9763
9981
|
if (!["images.list", "images.extract"].includes(operation))
|
|
9764
|
-
|
|
9982
|
+
usage13("Unique requires images list or extract.");
|
|
9765
9983
|
result.unique = true;
|
|
9766
9984
|
continue;
|
|
9767
9985
|
}
|
|
@@ -9774,7 +9992,7 @@ function parse(raw, maximum, output3) {
|
|
|
9774
9992
|
continue;
|
|
9775
9993
|
}
|
|
9776
9994
|
if (argument === "--shared") {
|
|
9777
|
-
if (operation !== "images.replace")
|
|
9995
|
+
if (operation !== "images.replace") usage13("Shared requires images replace.");
|
|
9778
9996
|
result.imageReplace = { ...result.imageReplace, shared: true };
|
|
9779
9997
|
continue;
|
|
9780
9998
|
}
|
|
@@ -9791,12 +10009,12 @@ function parse(raw, maximum, output3) {
|
|
|
9791
10009
|
}
|
|
9792
10010
|
if (argument === "--allow-partial-output") {
|
|
9793
10011
|
if (!["extract", "slides.split", "images.extract", "media.extract", "objects.extract"].includes(operation))
|
|
9794
|
-
|
|
10012
|
+
usage13("Partial output requires a multi-file operation.");
|
|
9795
10013
|
result.allowPartialOutput = true;
|
|
9796
10014
|
continue;
|
|
9797
10015
|
}
|
|
9798
10016
|
if (argument === "--first") {
|
|
9799
|
-
if (operation !== "text.replace")
|
|
10017
|
+
if (operation !== "text.replace") usage13("First requires text replace.");
|
|
9800
10018
|
result.first = true;
|
|
9801
10019
|
continue;
|
|
9802
10020
|
}
|
|
@@ -9804,7 +10022,7 @@ function parse(raw, maximum, output3) {
|
|
|
9804
10022
|
result.all = true;
|
|
9805
10023
|
continue;
|
|
9806
10024
|
}
|
|
9807
|
-
if (!scalarOptions.includes(argument))
|
|
10025
|
+
if (!scalarOptions.includes(argument)) usage13("Unsupported option.");
|
|
9808
10026
|
const booleanValueOptions = [
|
|
9809
10027
|
"--preserve-geometry",
|
|
9810
10028
|
"--preserve-crop",
|
|
@@ -9829,9 +10047,9 @@ function parse(raw, maximum, output3) {
|
|
|
9829
10047
|
"--matching-name",
|
|
9830
10048
|
"--with"
|
|
9831
10049
|
].includes(argument))
|
|
9832
|
-
|
|
10050
|
+
usage13("Missing option value.");
|
|
9833
10051
|
if (["--data-json", "--data-file"].includes(argument)) {
|
|
9834
|
-
if (operation !== "template.apply")
|
|
10052
|
+
if (operation !== "template.apply") usage13("Binding sources require template apply.");
|
|
9835
10053
|
if (argument === "--data-file") result.dataFile = value;
|
|
9836
10054
|
else {
|
|
9837
10055
|
const bindings = commandJson(value);
|
|
@@ -9842,7 +10060,7 @@ function parse(raw, maximum, output3) {
|
|
|
9842
10060
|
}
|
|
9843
10061
|
if (operation === "objects.add" && ["--icon", "--icon-content-type", "--program", "--program-id", "--name", "--left", "--top", "--width", "--height", "--icon-width", "--icon-height"].includes(argument)) {
|
|
9844
10062
|
if (argument === "--program") {
|
|
9845
|
-
if (!Object.hasOwn(PROG_ID, value))
|
|
10063
|
+
if (!Object.hasOwn(PROG_ID, value)) usage13("Unknown registered program.");
|
|
9846
10064
|
result.objectAdd = { ...result.objectAdd, progId: PROG_ID[value] };
|
|
9847
10065
|
} else if (argument === "--icon") result.icon = value;
|
|
9848
10066
|
else if (argument === "--icon-content-type") result.iconContentType = value;
|
|
@@ -9858,10 +10076,10 @@ function parse(raw, maximum, output3) {
|
|
|
9858
10076
|
else if (argument === "--poster-content-type") result.posterContentType = value;
|
|
9859
10077
|
else {
|
|
9860
10078
|
const key = argument === "--mime-type" ? "contentType" : argument.slice(2).split("-").map((part, i) => i ? part[0].toUpperCase() + part.slice(1) : part).join("");
|
|
9861
|
-
if (key === "kind" && !["audio", "video"].includes(value))
|
|
9862
|
-
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.");
|
|
9863
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;
|
|
9864
|
-
if (typeof parsed === "number" && !Number.isFinite(parsed))
|
|
10082
|
+
if (typeof parsed === "number" && !Number.isFinite(parsed)) usage13("Media values must be finite.");
|
|
9865
10083
|
result.mediaEdit = { ...result.mediaEdit, [key]: parsed };
|
|
9866
10084
|
}
|
|
9867
10085
|
continue;
|
|
@@ -9870,13 +10088,13 @@ function parse(raw, maximum, output3) {
|
|
|
9870
10088
|
const key = argument.slice(2).split("-").map((part, i) => i ? part[0].toUpperCase() + part.slice(1) : part).join("");
|
|
9871
10089
|
let parsed = value;
|
|
9872
10090
|
if (key === "flipHorizontal" || key === "flipVertical") {
|
|
9873
|
-
if (value !== "true" && value !== "false")
|
|
10091
|
+
if (value !== "true" && value !== "false") usage13("Picture flips require true or false.");
|
|
9874
10092
|
parsed = value === "true";
|
|
9875
10093
|
} else if (key === "borderWidth") parsed = commandLength(value, 0);
|
|
9876
10094
|
else if (key !== "borderColor" && key !== "altText") {
|
|
9877
10095
|
parsed = Number(value);
|
|
9878
10096
|
if (!value.trim() || !Number.isFinite(parsed))
|
|
9879
|
-
|
|
10097
|
+
usage13("Picture values must be finite numbers.");
|
|
9880
10098
|
}
|
|
9881
10099
|
result.imageSet = { ...result.imageSet, [key]: parsed };
|
|
9882
10100
|
continue;
|
|
@@ -9890,9 +10108,9 @@ function parse(raw, maximum, output3) {
|
|
|
9890
10108
|
].includes(argument)) {
|
|
9891
10109
|
const key = argument.slice(2).split("-").map((part, i) => i ? part[0].toUpperCase() + part.slice(1) : part).join("");
|
|
9892
10110
|
if (key === "contentType" && !["image/png", "image/jpeg", "image/gif", "image/bmp", "image/tiff", "image/x-wmf"].includes(value))
|
|
9893
|
-
|
|
10111
|
+
usage13("Unsupported image content type.");
|
|
9894
10112
|
if (argument.startsWith("--preserve-") && value !== "true" && value !== "false")
|
|
9895
|
-
|
|
10113
|
+
usage13("Image preservation requires true or false.");
|
|
9896
10114
|
result.imageReplace = {
|
|
9897
10115
|
...result.imageReplace,
|
|
9898
10116
|
[key]: argument.startsWith("--preserve-") ? value === "true" : value
|
|
@@ -9904,18 +10122,18 @@ function parse(raw, maximum, output3) {
|
|
|
9904
10122
|
)) {
|
|
9905
10123
|
const key = argument === "--content-type" ? "contentType" : argument === "--alt-text" ? "altText" : argument.slice(2);
|
|
9906
10124
|
if (key === "fit" && !["contain", "cover", "stretch"].includes(value))
|
|
9907
|
-
|
|
10125
|
+
usage13("Invalid image fit.");
|
|
9908
10126
|
if (key === "contentType" && !["image/png", "image/jpeg", "image/gif", "image/bmp", "image/tiff", "image/x-wmf"].includes(value))
|
|
9909
|
-
|
|
10127
|
+
usage13("Unsupported image content type.");
|
|
9910
10128
|
const parsed = ["left", "top", "width", "height"].includes(key) ? commandLength(value, key === "left" || key === "top" ? -27273042316900 : 1) : value;
|
|
9911
10129
|
result.imageAdd = { ...result.imageAdd, [key]: parsed };
|
|
9912
10130
|
continue;
|
|
9913
10131
|
}
|
|
9914
10132
|
if (argument === "--image") {
|
|
9915
10133
|
if (operation !== "images.list" && operation !== "images.extract" && operation !== "images.replace" && operation !== "images.set")
|
|
9916
|
-
|
|
10134
|
+
usage13("Image selection requires images list, extract, replace or set.");
|
|
9917
10135
|
if (!value.length || [...value].some((c) => c < "0" || c > "9") || !Number.isSafeInteger(Number(value)) || Number(value) < 1)
|
|
9918
|
-
|
|
10136
|
+
usage13("Image positions require positive integers.");
|
|
9919
10137
|
result.image = Number(value);
|
|
9920
10138
|
continue;
|
|
9921
10139
|
}
|
|
@@ -9926,17 +10144,17 @@ function parse(raw, maximum, output3) {
|
|
|
9926
10144
|
try {
|
|
9927
10145
|
parsed = admitFontMetrics(JSON.parse(value));
|
|
9928
10146
|
} catch (error) {
|
|
9929
|
-
if (error instanceof
|
|
9930
|
-
|
|
10147
|
+
if (error instanceof OfficeError19) throw error;
|
|
10148
|
+
usage13("Metrics require a valid JSON metric object.");
|
|
9931
10149
|
}
|
|
9932
10150
|
} else if (["bold", "italic", "wrap"].includes(key)) {
|
|
9933
|
-
if (!["true", "false"].includes(value))
|
|
10151
|
+
if (!["true", "false"].includes(value)) usage13("Text fit switches require true or false.");
|
|
9934
10152
|
parsed = value === "true";
|
|
9935
10153
|
} else if (key.startsWith("margin")) parsed = commandLength(value) / 12700;
|
|
9936
10154
|
else if (key !== "fontFamily") {
|
|
9937
10155
|
const pieces = value.split(".");
|
|
9938
10156
|
if (pieces.length > 2 || pieces.some((p) => !p || [...p].some((c) => c < "0" || c > "9")))
|
|
9939
|
-
|
|
10157
|
+
usage13("Text fit sizes and spacing require decimal numbers.");
|
|
9940
10158
|
parsed = Number(value);
|
|
9941
10159
|
}
|
|
9942
10160
|
result.fitEdit = { ...result.fitEdit, [key]: parsed };
|
|
@@ -9948,13 +10166,13 @@ function parse(raw, maximum, output3) {
|
|
|
9948
10166
|
if (value === "null" && key !== "text") parsed = null;
|
|
9949
10167
|
else if (key.startsWith("margin")) parsed = commandLength(value, -2147483648) / 12700;
|
|
9950
10168
|
else if (key === "wrap") {
|
|
9951
|
-
if (!["true", "false"].includes(value))
|
|
10169
|
+
if (!["true", "false"].includes(value)) usage13("Wrap requires true, false or null.");
|
|
9952
10170
|
parsed = value === "true";
|
|
9953
10171
|
} else if (key === "columns" || key === "rotation") {
|
|
9954
10172
|
const digits = key === "rotation" && value.startsWith("-") ? value.slice(1) : value;
|
|
9955
10173
|
const pieces = digits.split(".");
|
|
9956
10174
|
if (pieces.length > (key === "columns" ? 1 : 2) || pieces.some((piece) => !piece || [...piece].some((c) => c < "0" || c > "9")) || !Number.isFinite(Number(value)))
|
|
9957
|
-
|
|
10175
|
+
usage13("Columns require an integer; rotation requires finite decimal degrees.");
|
|
9958
10176
|
parsed = Number(value);
|
|
9959
10177
|
}
|
|
9960
10178
|
result.frameEdit = { ...result.frameEdit, [key]: parsed };
|
|
@@ -9964,12 +10182,12 @@ function parse(raw, maximum, output3) {
|
|
|
9964
10182
|
let key = argument.slice(2).split("-").map((part, index2) => index2 ? part[0].toUpperCase() + part.slice(1) : part).join("");
|
|
9965
10183
|
let parsed = value;
|
|
9966
10184
|
if (key === "direction") {
|
|
9967
|
-
if (seen.has("--rtl"))
|
|
9968
|
-
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.");
|
|
9969
10187
|
key = "rtl";
|
|
9970
10188
|
parsed = value === "null" ? null : value === "rtl";
|
|
9971
10189
|
} else if (key === "numbering") {
|
|
9972
|
-
if (seen.has("--bullet"))
|
|
10190
|
+
if (seen.has("--bullet")) usage13("Bullet and numbering cannot be combined.");
|
|
9973
10191
|
const schemes = {
|
|
9974
10192
|
decimal: "arabicPeriod",
|
|
9975
10193
|
"lower-alpha": "alphaLcPeriod",
|
|
@@ -9978,7 +10196,7 @@ function parse(raw, maximum, output3) {
|
|
|
9978
10196
|
"upper-roman": "romanUcPeriod"
|
|
9979
10197
|
};
|
|
9980
10198
|
if (!Object.hasOwn(schemes, value) && !["none", "null"].includes(value))
|
|
9981
|
-
|
|
10199
|
+
usage13("Unsupported numbering style.");
|
|
9982
10200
|
key = "bullet";
|
|
9983
10201
|
parsed = value === "null" ? null : value === "none" ? { kind: "none" } : { kind: "numbered", scheme: schemes[value] };
|
|
9984
10202
|
} else if (value === "null" && key !== "paragraph") parsed = null;
|
|
@@ -9992,11 +10210,11 @@ function parse(raw, maximum, output3) {
|
|
|
9992
10210
|
].includes(key))
|
|
9993
10211
|
parsed = commandLength(value, key === "indent" ? -Number.MAX_SAFE_INTEGER : 0) / 12700;
|
|
9994
10212
|
else if (key === "rtl") {
|
|
9995
|
-
if (!["true", "false"].includes(value))
|
|
10213
|
+
if (!["true", "false"].includes(value)) usage13("RTL requires true, false or null.");
|
|
9996
10214
|
parsed = value === "true";
|
|
9997
10215
|
} else if (["paragraph", "level"].includes(key)) {
|
|
9998
10216
|
if (![...value].every((c) => c >= "0" && c <= "9") || !Number.isSafeInteger(Number(value)) || key === "paragraph" && Number(value) < 1)
|
|
9999
|
-
|
|
10217
|
+
usage13("Invalid paragraph position or level.");
|
|
10000
10218
|
parsed = Number(value) - (key === "paragraph" ? 1 : 0);
|
|
10001
10219
|
} else if (key === "lineSpacing") {
|
|
10002
10220
|
const pieces = value.split(".");
|
|
@@ -10008,7 +10226,7 @@ function parse(raw, maximum, output3) {
|
|
|
10008
10226
|
parsed = value.startsWith("{") ? commandJson(value) : { kind: "character", character: value };
|
|
10009
10227
|
else if (key === "tabs") {
|
|
10010
10228
|
const tabs = commandJson(value);
|
|
10011
|
-
if (!Array.isArray(tabs))
|
|
10229
|
+
if (!Array.isArray(tabs)) usage13("Tabs require an array or null.");
|
|
10012
10230
|
parsed = tabs.map((tab) => {
|
|
10013
10231
|
if (tab && typeof tab === "object" && "unit" in tab) {
|
|
10014
10232
|
const record3 = tab;
|
|
@@ -10021,7 +10239,7 @@ function parse(raw, maximum, output3) {
|
|
|
10021
10239
|
const aligned = tab;
|
|
10022
10240
|
const length4 = tab.position;
|
|
10023
10241
|
if (Object.keys(aligned).some((key2) => !["position", "alignment"].includes(key2)))
|
|
10024
|
-
|
|
10242
|
+
usage13("Tabs require finite explicit lengths.");
|
|
10025
10243
|
return {
|
|
10026
10244
|
position: paragraphTabLength(length4),
|
|
10027
10245
|
alignment: aligned.alignment
|
|
@@ -10031,9 +10249,9 @@ function parse(raw, maximum, output3) {
|
|
|
10031
10249
|
});
|
|
10032
10250
|
}
|
|
10033
10251
|
if (argument === "--rtl" && seen.has("--direction"))
|
|
10034
|
-
|
|
10252
|
+
usage13("Direction and RTL cannot be combined.");
|
|
10035
10253
|
if (argument === "--bullet" && seen.has("--numbering"))
|
|
10036
|
-
|
|
10254
|
+
usage13("Bullet and numbering cannot be combined.");
|
|
10037
10255
|
result.paragraphEdit = { ...result.paragraphEdit, [key]: parsed };
|
|
10038
10256
|
continue;
|
|
10039
10257
|
}
|
|
@@ -10044,20 +10262,20 @@ function parse(raw, maximum, output3) {
|
|
|
10044
10262
|
else if (["complexScriptCharset", "complexScriptPitchFamily"].includes(key)) {
|
|
10045
10263
|
const digits = value.startsWith("-") ? value.slice(1) : value;
|
|
10046
10264
|
if (!digits || [...digits].some((c) => c < "0" || c > "9") || !Number.isSafeInteger(Number(value)))
|
|
10047
|
-
|
|
10265
|
+
usage13("Font classification requires an integer or null.");
|
|
10048
10266
|
parsed = Number(value);
|
|
10049
10267
|
} else if (["size", "spacing"].includes(key))
|
|
10050
10268
|
parsed = commandLength(value, key === "spacing" ? -Number.MAX_SAFE_INTEGER : 1) / 12700;
|
|
10051
10269
|
else if (["bold", "italic", "rtl"].includes(key)) {
|
|
10052
|
-
if (!["true", "false"].includes(value))
|
|
10270
|
+
if (!["true", "false"].includes(value)) usage13("Emphasis requires true, false or null.");
|
|
10053
10271
|
parsed = value === "true";
|
|
10054
10272
|
} else if (["paragraph", "run"].includes(key)) {
|
|
10055
10273
|
if (![...value].every((c) => c >= "0" && c <= "9") || !Number.isSafeInteger(Number(value)) || Number(value) < 1)
|
|
10056
|
-
|
|
10274
|
+
usage13("Text positions require positive one-based integers.");
|
|
10057
10275
|
parsed = Number(value) - 1;
|
|
10058
10276
|
} else if (key === "baseline") {
|
|
10059
10277
|
if (!value.trim() || !Number.isFinite(Number(value)))
|
|
10060
|
-
|
|
10278
|
+
usage13("Baseline requires a finite percentage.");
|
|
10061
10279
|
parsed = Number(value);
|
|
10062
10280
|
} else if (["color", "highlight"].includes(key) && value.startsWith("{"))
|
|
10063
10281
|
parsed = commandJson(value);
|
|
@@ -10068,20 +10286,20 @@ function parse(raw, maximum, output3) {
|
|
|
10068
10286
|
continue;
|
|
10069
10287
|
}
|
|
10070
10288
|
if (argument === "--style-json") {
|
|
10071
|
-
if (operation !== "text.replace")
|
|
10289
|
+
if (operation !== "text.replace") usage13("Style override requires text replace.");
|
|
10072
10290
|
const style = commandJson(value);
|
|
10073
10291
|
if (!style || typeof style !== "object" || Array.isArray(style) || Object.keys(style).length === 0 || Object.entries(style).some(
|
|
10074
10292
|
([key, field]) => !["bold", "italic"].includes(key) || typeof field !== "boolean"
|
|
10075
10293
|
))
|
|
10076
|
-
|
|
10294
|
+
usage13("Style requires explicit bold or italic boolean values.");
|
|
10077
10295
|
result.style = style;
|
|
10078
10296
|
continue;
|
|
10079
10297
|
}
|
|
10080
10298
|
if (["--find", "--with", "--occurrence"].includes(argument)) {
|
|
10081
|
-
if (operation !== "text.replace")
|
|
10299
|
+
if (operation !== "text.replace") usage13("Match options require text replace.");
|
|
10082
10300
|
if (argument === "--occurrence") {
|
|
10083
10301
|
if (![...value].every((c) => c >= "0" && c <= "9") || !Number.isSafeInteger(Number(value)) || Number(value) < 1)
|
|
10084
|
-
|
|
10302
|
+
usage13("Occurrence must be a positive integer.");
|
|
10085
10303
|
result.occurrence = Number(value);
|
|
10086
10304
|
} else if (argument === "--find") result.find = value;
|
|
10087
10305
|
else result.with = value;
|
|
@@ -10098,7 +10316,7 @@ function parse(raw, maximum, output3) {
|
|
|
10098
10316
|
].includes(argument)) {
|
|
10099
10317
|
const key = argument === "--placeholder-policy" ? "placeholderPolicy" : argument === "--show-master-shapes" ? "showMasterShapes" : argument === "--matching-name" ? "matchingName" : argument === "--placeholders-json" ? "placeholders" : argument.slice(2);
|
|
10100
10318
|
if (["preserve", "showMasterShapes"].includes(key) && !["true", "false"].includes(value))
|
|
10101
|
-
|
|
10319
|
+
usage13("Expected true or false.");
|
|
10102
10320
|
result.layoutEdit = {
|
|
10103
10321
|
...result.layoutEdit,
|
|
10104
10322
|
[key]: key === "placeholders" ? commandJson(value) : ["preserve", "showMasterShapes"].includes(key) ? value === "true" : value
|
|
@@ -10137,18 +10355,18 @@ function parse(raw, maximum, output3) {
|
|
|
10137
10355
|
}
|
|
10138
10356
|
if (operation === "shapes.drawing.set" && ["--fill", "--line", "--shadow-inherit"].includes(argument)) {
|
|
10139
10357
|
if (argument === "--shadow-inherit" && !["true", "false"].includes(value))
|
|
10140
|
-
|
|
10358
|
+
usage13("Shadow inheritance requires true or false.");
|
|
10141
10359
|
const key = argument === "--shadow-inherit" ? "shadowInherit" : argument.slice(2);
|
|
10142
10360
|
result.drawingEdit = { ...result.drawingEdit, [key]: commandJson(value) };
|
|
10143
10361
|
continue;
|
|
10144
10362
|
}
|
|
10145
10363
|
if (operation === "shapes.effects.set" && ["--shadow", "--opacity", "--shadow-blur", "--shadow-color"].includes(argument)) {
|
|
10146
10364
|
if (argument === "--shadow") {
|
|
10147
|
-
if (!["true", "false"].includes(value))
|
|
10365
|
+
if (!["true", "false"].includes(value)) usage13("Shadow requires true or false.");
|
|
10148
10366
|
result.shadowEnabled = value === "true";
|
|
10149
10367
|
} else if (argument === "--opacity") {
|
|
10150
10368
|
if (!value.trim() || !Number.isFinite(Number(value)) || Number(value) < 0 || Number(value) > 1)
|
|
10151
|
-
|
|
10369
|
+
usage13("Opacity requires a ratio from zero to one.");
|
|
10152
10370
|
result.shadowOpacity = Number(value);
|
|
10153
10371
|
} else if (argument === "--shadow-blur")
|
|
10154
10372
|
result.shadowBlur = { value: commandLength(value, 0), unit: "emu" };
|
|
@@ -10157,7 +10375,7 @@ function parse(raw, maximum, output3) {
|
|
|
10157
10375
|
continue;
|
|
10158
10376
|
}
|
|
10159
10377
|
if (operation.startsWith("shapes.paths.") && argument === "--close") {
|
|
10160
|
-
if (!["true", "false"].includes(value))
|
|
10378
|
+
if (!["true", "false"].includes(value)) usage13("Close requires true or false.");
|
|
10161
10379
|
result.close = value === "true";
|
|
10162
10380
|
continue;
|
|
10163
10381
|
}
|
|
@@ -10195,18 +10413,18 @@ function parse(raw, maximum, output3) {
|
|
|
10195
10413
|
value,
|
|
10196
10414
|
["left", "top"].includes(key) ? -27273042316900 : key === "lineWidth" ? 0 : 1
|
|
10197
10415
|
);
|
|
10198
|
-
if (Math.abs(length4) > 27273042316900)
|
|
10416
|
+
if (Math.abs(length4) > 27273042316900) usage13("Shape geometry exceeds DrawingML bounds.");
|
|
10199
10417
|
parsed = { value: length4, unit: "emu" };
|
|
10200
10418
|
} else if (key === "flipHorizontal" || key === "flipVertical") {
|
|
10201
|
-
if (!["true", "false"].includes(value))
|
|
10419
|
+
if (!["true", "false"].includes(value)) usage13("Flips require true or false.");
|
|
10202
10420
|
parsed = value === "true";
|
|
10203
10421
|
} else if (key === "locked") {
|
|
10204
10422
|
if (!["true", "false", "null"].includes(value))
|
|
10205
|
-
|
|
10423
|
+
usage13("Locked requires true, false or null.");
|
|
10206
10424
|
parsed = value === "null" ? null : value === "true";
|
|
10207
10425
|
} else if (key === "rotation") {
|
|
10208
10426
|
if (!value.trim() || !Number.isFinite(Number(value)))
|
|
10209
|
-
|
|
10427
|
+
usage13("Rotation requires finite degrees.");
|
|
10210
10428
|
parsed = Number(value);
|
|
10211
10429
|
} else if (key === "kind" && value.length && [...value].every((c) => c >= "0" && c <= "9"))
|
|
10212
10430
|
parsed = Number(value);
|
|
@@ -10244,7 +10462,7 @@ function parse(raw, maximum, output3) {
|
|
|
10244
10462
|
"--loop",
|
|
10245
10463
|
"--show-type"
|
|
10246
10464
|
].includes(argument) || operation === "settings.set" && ["--width", "--height"].includes(argument)) {
|
|
10247
|
-
if (operation !== "settings.set")
|
|
10465
|
+
if (operation !== "settings.set") usage13("Settings options require settings set.");
|
|
10248
10466
|
if (["--width", "--height", "--notes-width", "--notes-height"].includes(argument)) {
|
|
10249
10467
|
const key = argument === "--notes-width" ? "notesWidth" : argument === "--notes-height" ? "notesHeight" : argument.slice(2);
|
|
10250
10468
|
result.settings = {
|
|
@@ -10253,7 +10471,7 @@ function parse(raw, maximum, output3) {
|
|
|
10253
10471
|
};
|
|
10254
10472
|
} else if (argument === "--orientation" || argument === "--notes-orientation") {
|
|
10255
10473
|
if (value !== "portrait" && value !== "landscape")
|
|
10256
|
-
|
|
10474
|
+
usage13("Orientation requires portrait or landscape.");
|
|
10257
10475
|
result.settings = {
|
|
10258
10476
|
...result.settings,
|
|
10259
10477
|
[argument === "--orientation" ? "orientation" : "notesOrientation"]: value
|
|
@@ -10261,17 +10479,17 @@ function parse(raw, maximum, output3) {
|
|
|
10261
10479
|
} else if (argument === "--slide-number-start") {
|
|
10262
10480
|
const digits = value.startsWith("-") ? value.slice(1) : value;
|
|
10263
10481
|
if (!digits.length || ![...digits].every((c) => c >= "0" && c <= "9") || !Number.isSafeInteger(Number(value)))
|
|
10264
|
-
|
|
10482
|
+
usage13("Slide-number start requires a safe integer.");
|
|
10265
10483
|
result.settings = { ...result.settings, slideNumberStart: Number(value) };
|
|
10266
10484
|
} else if (argument === "--loop" || argument === "--scale-content") {
|
|
10267
|
-
if (value !== "true" && value !== "false")
|
|
10485
|
+
if (value !== "true" && value !== "false") usage13("Boolean settings require true or false.");
|
|
10268
10486
|
result.settings = {
|
|
10269
10487
|
...result.settings,
|
|
10270
10488
|
[argument === "--loop" ? "loop" : "scaleContent"]: value === "true"
|
|
10271
10489
|
};
|
|
10272
10490
|
} else {
|
|
10273
10491
|
if (value !== "speaker" && value !== "window" && value !== "kiosk")
|
|
10274
|
-
|
|
10492
|
+
usage13("Unknown show type.");
|
|
10275
10493
|
result.settings = { ...result.settings, showType: value };
|
|
10276
10494
|
}
|
|
10277
10495
|
continue;
|
|
@@ -10281,24 +10499,24 @@ function parse(raw, maximum, output3) {
|
|
|
10281
10499
|
else if (argument === "--slides") {
|
|
10282
10500
|
const slides = commandJson(value);
|
|
10283
10501
|
if (!Array.isArray(slides) || !slides.length || slides.some((item) => !Number.isSafeInteger(item) || item < 1) || new Set(slides).size !== slides.length)
|
|
10284
|
-
|
|
10502
|
+
usage13("Members require a nonempty array of unique one-based slide positions.");
|
|
10285
10503
|
result.membership = { ...result.membership, slides };
|
|
10286
10504
|
} else {
|
|
10287
10505
|
if (![...value].every((c) => c >= "0" && c <= "9") || !Number.isSafeInteger(Number(value)) || Number(value) < 1)
|
|
10288
|
-
|
|
10506
|
+
usage13("Section positions must be positive integers.");
|
|
10289
10507
|
result.membership = { ...result.membership, position: Number(value) };
|
|
10290
10508
|
}
|
|
10291
10509
|
continue;
|
|
10292
10510
|
}
|
|
10293
10511
|
if (argument === "--sources") {
|
|
10294
|
-
if (operation !== "slides.merge")
|
|
10512
|
+
if (operation !== "slides.merge") usage13("Sources require slides merge.");
|
|
10295
10513
|
const sources = commandJson(value);
|
|
10296
10514
|
if (!Array.isArray(sources) || !sources.length || sources.some(
|
|
10297
10515
|
(source3) => !source3 || typeof source3 !== "object" || Array.isArray(source3) || Object.keys(source3).length !== 1 || typeof source3.vfsPath !== "string" || !source3.vfsPath.length
|
|
10298
10516
|
))
|
|
10299
|
-
|
|
10517
|
+
usage13("Sources require a nonempty ordered array of scoped vfsPath inputs.");
|
|
10300
10518
|
const paths = sources.map((source3) => source3.vfsPath);
|
|
10301
|
-
if (new Set(paths).size !== paths.length)
|
|
10519
|
+
if (new Set(paths).size !== paths.length) usage13("Source inputs must be unique.");
|
|
10302
10520
|
result.sources = paths;
|
|
10303
10521
|
continue;
|
|
10304
10522
|
}
|
|
@@ -10306,57 +10524,57 @@ function parse(raw, maximum, output3) {
|
|
|
10306
10524
|
if (argument === "--manifest") result.manifest = value;
|
|
10307
10525
|
else {
|
|
10308
10526
|
const parts = commandJson(value);
|
|
10309
|
-
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.");
|
|
10310
10528
|
result.parts = parts;
|
|
10311
10529
|
}
|
|
10312
10530
|
continue;
|
|
10313
10531
|
}
|
|
10314
10532
|
if (argument === "--sha256") {
|
|
10315
10533
|
if (operation !== "images.extract" || value.length !== 64 || !Array.from(value).every((character) => "0123456789abcdef".includes(character)))
|
|
10316
|
-
|
|
10534
|
+
usage13("Image extraction requires a lowercase SHA256 hash.");
|
|
10317
10535
|
result.imageSha256 = value;
|
|
10318
10536
|
continue;
|
|
10319
10537
|
}
|
|
10320
10538
|
if (argument === "--output-dir" || argument === "--slides") {
|
|
10321
10539
|
if (operation !== "slides.split" && !(["extract", "images.extract", "media.extract", "objects.extract"].includes(operation) && argument === "--output-dir"))
|
|
10322
|
-
|
|
10540
|
+
usage13("Option requires a multi-file operation.");
|
|
10323
10541
|
if (argument === "--output-dir") result.outputDir = value;
|
|
10324
10542
|
else {
|
|
10325
10543
|
const positions = commandJson(value);
|
|
10326
10544
|
if (!Array.isArray(positions) || !positions.length || positions.some((position) => !Number.isSafeInteger(position) || position < 1) || new Set(positions).size !== positions.length)
|
|
10327
|
-
|
|
10545
|
+
usage13("Slides require a nonempty array of unique one-based positions.");
|
|
10328
10546
|
result.splitSlides = positions;
|
|
10329
10547
|
}
|
|
10330
10548
|
continue;
|
|
10331
10549
|
}
|
|
10332
10550
|
if (argument === "--reference-policy") {
|
|
10333
10551
|
if (operation !== "slides.remove" || value !== "remove")
|
|
10334
|
-
|
|
10552
|
+
usage13("Slide removal reference policy must be remove.");
|
|
10335
10553
|
result.referencePolicy = value;
|
|
10336
10554
|
continue;
|
|
10337
10555
|
}
|
|
10338
10556
|
if (argument === "--media-policy") {
|
|
10339
10557
|
if (operation !== "slides.duplicate" || !["shared-media", "isolated-instance"].includes(value))
|
|
10340
|
-
|
|
10558
|
+
usage13("Slide duplication media policy must be shared-media or isolated-instance.");
|
|
10341
10559
|
result.copyMediaPolicy = value;
|
|
10342
10560
|
continue;
|
|
10343
10561
|
}
|
|
10344
10562
|
if (["--source", "--source-slides", "--theme-policy", "--dimension-policy"].includes(argument)) {
|
|
10345
10563
|
if (operation !== "slides.import" && operation !== "slides.merge")
|
|
10346
|
-
|
|
10564
|
+
usage13("Option requires slides import or merge.");
|
|
10347
10565
|
if (operation === "slides.merge" && argument === "--source")
|
|
10348
|
-
|
|
10566
|
+
usage13("Merge requires --sources.");
|
|
10349
10567
|
if (argument === "--source") result.source = value;
|
|
10350
10568
|
else if (argument === "--source-slides") {
|
|
10351
10569
|
const positions = commandJson(value);
|
|
10352
10570
|
if (!Array.isArray(positions) || !positions.length || positions.some((position) => !Number.isSafeInteger(position) || position < 1) || new Set(positions).size !== positions.length)
|
|
10353
|
-
|
|
10571
|
+
usage13("Source slides require a nonempty array of unique one-based positions.");
|
|
10354
10572
|
result.importing = { ...result.importing, sourceSlides: positions };
|
|
10355
10573
|
} else if (argument === "--theme-policy") {
|
|
10356
|
-
if (value !== "source" && value !== "destination")
|
|
10574
|
+
if (value !== "source" && value !== "destination") usage13("Unknown theme policy.");
|
|
10357
10575
|
result.importing = { ...result.importing, themePolicy: value };
|
|
10358
10576
|
} else {
|
|
10359
|
-
if (value !== "reject" && value !== "destination")
|
|
10577
|
+
if (value !== "reject" && value !== "destination") usage13("Unknown dimension policy.");
|
|
10360
10578
|
result.importing = { ...result.importing, dimensionPolicy: value };
|
|
10361
10579
|
}
|
|
10362
10580
|
continue;
|
|
@@ -10374,7 +10592,7 @@ function parse(raw, maximum, output3) {
|
|
|
10374
10592
|
if (operation === "slides.import" || operation === "slides.duplicate" || operation === "slides.move" || operation === "slides.set") {
|
|
10375
10593
|
if (argument === "--position") {
|
|
10376
10594
|
if (![...value].every((character) => character >= "0" && character <= "9") || !Number.isSafeInteger(Number(value)) || Number(value) < 1)
|
|
10377
|
-
|
|
10595
|
+
usage13("Slide positions must be positive one-based integers.");
|
|
10378
10596
|
if (operation === "slides.import")
|
|
10379
10597
|
result.importing = { ...result.importing, position: Number(value) };
|
|
10380
10598
|
else result.mutation = { ...result.mutation, position: Number(value) };
|
|
@@ -10382,30 +10600,30 @@ function parse(raw, maximum, output3) {
|
|
|
10382
10600
|
result.mutation = { ...result.mutation, name: value };
|
|
10383
10601
|
else if (operation === "slides.set" && argument === "--hidden") {
|
|
10384
10602
|
if (value !== "true" && value !== "false")
|
|
10385
|
-
|
|
10603
|
+
usage13("Slide boolean options require true or false.");
|
|
10386
10604
|
result.mutation = { ...result.mutation, hidden: value === "true" };
|
|
10387
|
-
} else
|
|
10605
|
+
} else usage13("Option is unavailable for this slide operation.");
|
|
10388
10606
|
continue;
|
|
10389
10607
|
}
|
|
10390
|
-
if (operation !== "slides.add")
|
|
10608
|
+
if (operation !== "slides.add") usage13("Slide addition options require slides add.");
|
|
10391
10609
|
result.addition ??= {};
|
|
10392
10610
|
if (argument === "--position") {
|
|
10393
10611
|
if (![...value].every((character) => character >= "0" && character <= "9") || !Number.isSafeInteger(Number(value)) || Number(value) < 1)
|
|
10394
|
-
|
|
10612
|
+
usage13("Insertion positions must be positive one-based integers.");
|
|
10395
10613
|
result.addition = { ...result.addition, position: Number(value) };
|
|
10396
10614
|
} else if (argument === "--hidden" || argument === "--follow-master-background") {
|
|
10397
10615
|
if (value !== "true" && value !== "false")
|
|
10398
|
-
|
|
10616
|
+
usage13("Slide boolean options require true or false.");
|
|
10399
10617
|
result.addition = {
|
|
10400
10618
|
...result.addition,
|
|
10401
10619
|
[argument === "--hidden" ? "hidden" : "followMasterBackground"]: value === "true"
|
|
10402
10620
|
};
|
|
10403
10621
|
} else if (argument === "--placeholders-json") {
|
|
10404
10622
|
const placeholders = commandJson(value);
|
|
10405
|
-
if (!Array.isArray(placeholders))
|
|
10623
|
+
if (!Array.isArray(placeholders)) usage13("Placeholders require an array.");
|
|
10406
10624
|
for (const binding of placeholders) {
|
|
10407
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))
|
|
10408
|
-
|
|
10626
|
+
usage13("Placeholder bindings require type, optional nonnegative index, and text.");
|
|
10409
10627
|
}
|
|
10410
10628
|
result.addition = { ...result.addition, placeholders };
|
|
10411
10629
|
} else result.addition = { ...result.addition, [argument.slice(2)]: value };
|
|
@@ -10422,16 +10640,16 @@ function parse(raw, maximum, output3) {
|
|
|
10422
10640
|
"--slides-json",
|
|
10423
10641
|
"--properties-json"
|
|
10424
10642
|
].includes(argument)) {
|
|
10425
|
-
if (operation !== "create" && operation !== "pack")
|
|
10643
|
+
if (operation !== "create" && operation !== "pack") usage13("Creation options require create or pack.");
|
|
10426
10644
|
result.creation ??= {};
|
|
10427
10645
|
if (argument === "--template") result.template = value;
|
|
10428
10646
|
else if (argument === "--width" || argument === "--height")
|
|
10429
10647
|
result.creation = { ...result.creation, [argument.slice(2)]: commandLength(value) };
|
|
10430
10648
|
else if (argument === "--kind") {
|
|
10431
|
-
if (!["pptx", "potx", "ppsx"].includes(value))
|
|
10649
|
+
if (!["pptx", "potx", "ppsx"].includes(value)) usage13("Unknown presentation kind.");
|
|
10432
10650
|
result.creation = { ...result.creation, kind: value };
|
|
10433
10651
|
} else if (argument === "--dialect") {
|
|
10434
|
-
if (!["strict", "transitional"].includes(value))
|
|
10652
|
+
if (!["strict", "transitional"].includes(value)) usage13("Unknown presentation dialect.");
|
|
10435
10653
|
result.creation = { ...result.creation, dialect: value };
|
|
10436
10654
|
} else if (argument === "--author") result.creation = { ...result.creation, author: value };
|
|
10437
10655
|
else if (argument === "--timestamp")
|
|
@@ -10439,7 +10657,7 @@ function parse(raw, maximum, output3) {
|
|
|
10439
10657
|
else if (argument === "--properties-json") {
|
|
10440
10658
|
const properties = commandJson(value);
|
|
10441
10659
|
if (!properties || typeof properties !== "object" || Array.isArray(properties))
|
|
10442
|
-
|
|
10660
|
+
usage13("Properties require an object.");
|
|
10443
10661
|
if (Object.keys(properties).some(
|
|
10444
10662
|
(key) => ![
|
|
10445
10663
|
"title",
|
|
@@ -10459,11 +10677,11 @@ function parse(raw, maximum, output3) {
|
|
|
10459
10677
|
"lastPrinted"
|
|
10460
10678
|
].includes(key)
|
|
10461
10679
|
))
|
|
10462
|
-
|
|
10680
|
+
usage13("Unknown creation property.");
|
|
10463
10681
|
for (const key of ["created", "modified", "lastPrinted"]) {
|
|
10464
10682
|
if (Object.hasOwn(properties, key)) {
|
|
10465
10683
|
const dates = properties;
|
|
10466
|
-
if (typeof dates[key] !== "string")
|
|
10684
|
+
if (typeof dates[key] !== "string") usage13("Property dates require UTC strings.");
|
|
10467
10685
|
dates[key] = commandTimestamp(dates[key]);
|
|
10468
10686
|
}
|
|
10469
10687
|
}
|
|
@@ -10485,36 +10703,36 @@ function parse(raw, maximum, output3) {
|
|
|
10485
10703
|
}
|
|
10486
10704
|
if (argument === "--selection-json") {
|
|
10487
10705
|
if (operation !== "slides.move" && operation !== "slides.set" && operation !== "slides.remove" && operation !== "slides.duplicate")
|
|
10488
|
-
|
|
10706
|
+
usage13("Selection JSON requires a supported slide mutation.");
|
|
10489
10707
|
const selection = commandJson(value);
|
|
10490
10708
|
if (!selection || typeof selection !== "object")
|
|
10491
|
-
|
|
10709
|
+
usage13("Selection JSON requires a query or nonempty query array.");
|
|
10492
10710
|
const queries = Array.isArray(selection) ? selection : [selection];
|
|
10493
|
-
if (!queries.length)
|
|
10711
|
+
if (!queries.length) usage13("Selection arrays must not be empty.");
|
|
10494
10712
|
for (const query of queries) {
|
|
10495
10713
|
if (!query || typeof query !== "object" || Array.isArray(query) || Object.keys(query).some(
|
|
10496
10714
|
(key) => !["kind", "scope", "owner", "position", "id", "name", "token", "all"].includes(key)
|
|
10497
10715
|
))
|
|
10498
|
-
|
|
10716
|
+
usage13("Invalid slide selection query.");
|
|
10499
10717
|
if (query.token !== void 0) {
|
|
10500
10718
|
if (typeof query.token !== "string" || Object.keys(query).some((key) => !["kind", "token"].includes(key)) || query.kind !== void 0 && query.kind !== "slide")
|
|
10501
|
-
|
|
10719
|
+
usage13("Invalid slide token query.");
|
|
10502
10720
|
decodeSelectionToken2(query.token);
|
|
10503
10721
|
continue;
|
|
10504
10722
|
}
|
|
10505
10723
|
if (query.kind !== "slide" || query.scope !== void 0 && query.scope !== "slides" || query.all !== void 0 && typeof query.all !== "boolean")
|
|
10506
|
-
|
|
10724
|
+
usage13("Selection queries must address slides.");
|
|
10507
10725
|
for (const key of ["id", "name", "owner"])
|
|
10508
10726
|
if (query[key] !== void 0 && (typeof query[key] !== "string" || key !== "name" && !query[key]))
|
|
10509
|
-
|
|
10727
|
+
usage13("Invalid slide selection value.");
|
|
10510
10728
|
if ([query.position, query.id, query.name].filter((item) => item !== void 0).length > 1)
|
|
10511
|
-
|
|
10729
|
+
usage13("Slide identity selectors cannot be combined.");
|
|
10512
10730
|
if (!query.all && query.position === void 0 && query.id === void 0 && query.name === void 0)
|
|
10513
|
-
|
|
10731
|
+
usage13("Slide selection requires an identity or all.");
|
|
10514
10732
|
if (query.position !== void 0) {
|
|
10515
10733
|
const position = query.position;
|
|
10516
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))
|
|
10517
|
-
|
|
10735
|
+
usage13("Invalid slide selection coordinate.");
|
|
10518
10736
|
}
|
|
10519
10737
|
}
|
|
10520
10738
|
result.selection = selection;
|
|
@@ -10524,9 +10742,9 @@ function parse(raw, maximum, output3) {
|
|
|
10524
10742
|
const pieces = value.split("=");
|
|
10525
10743
|
const [name, digits] = pieces;
|
|
10526
10744
|
if (pieces.length !== 2 || !name || !digits || ![...digits].every((c) => c >= "0" && c <= "9") || !Number.isSafeInteger(Number(digits)) || Number(digits) < 1)
|
|
10527
|
-
|
|
10745
|
+
usage13("Limits require NAME=POSITIVE_INTEGER.");
|
|
10528
10746
|
result.limits ??= {};
|
|
10529
|
-
if (Object.hasOwn(result.limits, name))
|
|
10747
|
+
if (Object.hasOwn(result.limits, name)) usage13("Repeated limit name.");
|
|
10530
10748
|
if (![
|
|
10531
10749
|
"maxBytes",
|
|
10532
10750
|
"maxNodes",
|
|
@@ -10534,21 +10752,21 @@ function parse(raw, maximum, output3) {
|
|
|
10534
10752
|
"maxOutputBytes",
|
|
10535
10753
|
...["extract", "images.extract", "media.extract", "objects.extract"].includes(operation) ? ["maxOutputs"] : []
|
|
10536
10754
|
].includes(name))
|
|
10537
|
-
|
|
10755
|
+
usage13("Unknown limit name.");
|
|
10538
10756
|
result.limits[name] = Number(digits);
|
|
10539
10757
|
} else if (argument === "--placeholder") {
|
|
10540
|
-
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.");
|
|
10541
10759
|
result.placeholder = Number(value);
|
|
10542
10760
|
} else if (argument === "--slide") {
|
|
10543
10761
|
if (![...value].every((character) => character >= "0" && character <= "9") || !Number.isSafeInteger(Number(value)) || Number(value) < 1)
|
|
10544
|
-
|
|
10762
|
+
usage13("Slide positions must be positive one-based integers.");
|
|
10545
10763
|
result.slide = Number(value);
|
|
10546
10764
|
} else if (argument === "--shape") result.shape = value;
|
|
10547
10765
|
else if (argument === "--part") {
|
|
10548
10766
|
if (operation === "objects.list" || operation === "fonts.list")
|
|
10549
|
-
|
|
10767
|
+
usage13("Part selection requires object extraction.");
|
|
10550
10768
|
try {
|
|
10551
|
-
result.part =
|
|
10769
|
+
result.part = partName4(value, false);
|
|
10552
10770
|
} catch {
|
|
10553
10771
|
throw new SelectionError8("invalid-selection");
|
|
10554
10772
|
}
|
|
@@ -10556,7 +10774,7 @@ function parse(raw, maximum, output3) {
|
|
|
10556
10774
|
else if (argument === "--file") result.file = value;
|
|
10557
10775
|
else if (argument === "--output") result.output = value;
|
|
10558
10776
|
else {
|
|
10559
|
-
if (!scopes2.includes(value))
|
|
10777
|
+
if (!scopes2.includes(value)) usage13("Unknown scope.");
|
|
10560
10778
|
result.scope = value;
|
|
10561
10779
|
}
|
|
10562
10780
|
}
|
|
@@ -10580,42 +10798,42 @@ function parse(raw, maximum, output3) {
|
|
|
10580
10798
|
"--dry-run"
|
|
10581
10799
|
];
|
|
10582
10800
|
if ([...seen].some((option) => !allowed.includes(option)))
|
|
10583
|
-
|
|
10584
|
-
if (positionals.length !== 1 || !positionals[0])
|
|
10585
|
-
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.");
|
|
10586
10804
|
if (result.scope === "presentation" || result.scope === "shared")
|
|
10587
|
-
|
|
10805
|
+
usage13("Image formatting requires an occurrence scope.");
|
|
10588
10806
|
if (result.token && ["--slide", "--image", "--scope", "--all"].some((option) => seen.has(option)))
|
|
10589
|
-
|
|
10807
|
+
usage13("Opaque and simple selectors cannot be combined.");
|
|
10590
10808
|
if (result.image !== void 0 && (!result.scope || result.scope === "slides") && result.slide === void 0)
|
|
10591
|
-
|
|
10809
|
+
usage13("Slide image selection requires a slide.");
|
|
10592
10810
|
result.input = positionals[0];
|
|
10593
10811
|
result.imageSet = {
|
|
10594
10812
|
...result.imageSet,
|
|
10595
10813
|
...result.all ? { all: true } : {},
|
|
10596
10814
|
...result.allowEmpty ? { allowEmpty: true } : {}
|
|
10597
10815
|
};
|
|
10598
|
-
if (result.inPlace && result.input === "-")
|
|
10599
|
-
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.");
|
|
10600
10818
|
if (!result.dryRun && !result.inPlace && !result.output)
|
|
10601
|
-
|
|
10602
|
-
if (result.force && !result.output)
|
|
10819
|
+
usage13("Mutation requires a destination.");
|
|
10820
|
+
if (result.force && !result.output) usage13("Force requires an explicit output destination.");
|
|
10603
10821
|
if (result.output === result.input && result.output !== "-")
|
|
10604
|
-
|
|
10822
|
+
usage13("Replacing input requires --in-place.");
|
|
10605
10823
|
if (result.output === "-" && result.json && !result.dryRun)
|
|
10606
|
-
|
|
10824
|
+
usage13("Binary stdout cannot be combined with JSON.");
|
|
10607
10825
|
return result;
|
|
10608
10826
|
}
|
|
10609
10827
|
if (result.placeholder !== void 0) {
|
|
10610
10828
|
if (!["images.add", "tables.add", "charts.add"].includes(operation) || result.slide === void 0)
|
|
10611
|
-
|
|
10829
|
+
usage13("Placeholder insertion requires an add operation and --slide.");
|
|
10612
10830
|
if (["--left", "--top", "--width", "--height", "--fit"].some((flag) => seen.has(flag)))
|
|
10613
|
-
|
|
10614
|
-
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.");
|
|
10615
10833
|
if (operation === "tables.add" && Object.keys(result.tableEdit ?? {}).some((key) => !["rows", "columns"].includes(key)))
|
|
10616
|
-
|
|
10834
|
+
usage13("Table placeholder insertion accepts rows and columns.");
|
|
10617
10835
|
if (operation === "charts.add" && Object.keys(result.chartEdit ?? {}).some((key) => !["type", "data"].includes(key)))
|
|
10618
|
-
|
|
10836
|
+
usage13("Chart placeholder insertion accepts type and data.");
|
|
10619
10837
|
}
|
|
10620
10838
|
if (operation === "images.add" || operation === "images.replace") {
|
|
10621
10839
|
const replacing = operation === "images.replace";
|
|
@@ -10643,19 +10861,19 @@ function parse(raw, maximum, output3) {
|
|
|
10643
10861
|
"--dry-run"
|
|
10644
10862
|
];
|
|
10645
10863
|
if ([...seen].some((option) => !allowed.includes(option)))
|
|
10646
|
-
|
|
10864
|
+
usage13("Option does not apply to this image operation.");
|
|
10647
10865
|
if (positionals.length !== 1 || !positionals[0] || !replacing && result.slide === void 0 || !result.file)
|
|
10648
|
-
|
|
10866
|
+
usage13("Image mutation requires one input, selection and file.");
|
|
10649
10867
|
if (replacing) {
|
|
10650
|
-
if (result.scope === "presentation")
|
|
10868
|
+
if (result.scope === "presentation") usage13("Presentation scope has no image owners.");
|
|
10651
10869
|
if (result.scope === "shared" && !result.imageReplace?.shared)
|
|
10652
|
-
|
|
10870
|
+
usage13("Shared scope requires explicit shared replacement.");
|
|
10653
10871
|
if (result.token && ["--slide", "--image", "--scope", "--all"].some((option) => seen.has(option)))
|
|
10654
|
-
|
|
10872
|
+
usage13("Opaque and simple selectors cannot be combined.");
|
|
10655
10873
|
if (!result.token && result.image === void 0 && !result.all)
|
|
10656
|
-
|
|
10874
|
+
usage13("Image replacement requires an image selector or all.");
|
|
10657
10875
|
if (result.image !== void 0 && (!result.scope || result.scope === "slides") && result.slide === void 0)
|
|
10658
|
-
|
|
10876
|
+
usage13("Slide image selection requires a slide.");
|
|
10659
10877
|
result.imageReplace = {
|
|
10660
10878
|
...result.imageReplace,
|
|
10661
10879
|
...result.all ? { all: true } : {},
|
|
@@ -10664,28 +10882,28 @@ function parse(raw, maximum, output3) {
|
|
|
10664
10882
|
}
|
|
10665
10883
|
result.input = positionals[0];
|
|
10666
10884
|
if (result.input === "-" && result.file === "-")
|
|
10667
|
-
|
|
10885
|
+
usage13("Document and image cannot both use stdin.");
|
|
10668
10886
|
const imageOptions = replacing ? result.imageReplace : result.imageAdd;
|
|
10669
10887
|
if (!imageOptions?.contentType) {
|
|
10670
10888
|
const extension = result.file.slice(result.file.lastIndexOf(".") + 1).toLowerCase();
|
|
10671
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];
|
|
10672
10890
|
if (!contentType)
|
|
10673
|
-
|
|
10891
|
+
usage13("Image file requires an explicit supported content type or extension.");
|
|
10674
10892
|
if (replacing) result.imageReplace = { ...result.imageReplace, contentType };
|
|
10675
10893
|
else result.imageAdd = { ...result.imageAdd, contentType };
|
|
10676
10894
|
}
|
|
10677
10895
|
const both = result.imageAdd?.width !== void 0 && result.imageAdd?.height !== void 0;
|
|
10678
10896
|
if (!replacing && !both && result.imageAdd?.fit !== void 0)
|
|
10679
|
-
|
|
10680
|
-
if (result.inPlace && result.input === "-")
|
|
10681
|
-
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.");
|
|
10682
10900
|
if (!result.dryRun && !result.inPlace && !result.output)
|
|
10683
|
-
|
|
10684
|
-
if (result.force && !result.output)
|
|
10901
|
+
usage13("Mutation requires a destination.");
|
|
10902
|
+
if (result.force && !result.output) usage13("Force requires an explicit output destination.");
|
|
10685
10903
|
if (result.output === result.input && result.output !== "-")
|
|
10686
|
-
|
|
10904
|
+
usage13("Replacing input requires --in-place.");
|
|
10687
10905
|
if (result.output === "-" && result.json && !result.dryRun)
|
|
10688
|
-
|
|
10906
|
+
usage13("Binary stdout cannot be combined with JSON.");
|
|
10689
10907
|
return result;
|
|
10690
10908
|
}
|
|
10691
10909
|
if (["media.add", "media.replace", "media.extract"].includes(operation)) {
|
|
@@ -10695,9 +10913,9 @@ function parse(raw, maximum, output3) {
|
|
|
10695
10913
|
if (Object.hasOwn(mediaSchemas, operation)) {
|
|
10696
10914
|
const allowed = ["--json", "--limit", "--scope", "--slide", "--shape", "--select"];
|
|
10697
10915
|
if ([...seen].some((option) => !allowed.includes(option)))
|
|
10698
|
-
|
|
10916
|
+
usage13("Option does not apply to media inspection.");
|
|
10699
10917
|
if (positionals.length !== 1 || !positionals[0])
|
|
10700
|
-
|
|
10918
|
+
usage13("Media inspection requires exactly one input.");
|
|
10701
10919
|
if (result.scope !== void 0 && ![
|
|
10702
10920
|
"slides",
|
|
10703
10921
|
"layouts",
|
|
@@ -10707,11 +10925,11 @@ function parse(raw, maximum, output3) {
|
|
|
10707
10925
|
"handout-master",
|
|
10708
10926
|
"shared"
|
|
10709
10927
|
].includes(result.scope))
|
|
10710
|
-
|
|
10928
|
+
usage13("Unsupported media scope.");
|
|
10711
10929
|
if (result.token && ["--slide", "--shape", "--scope"].some((option) => seen.has(option)))
|
|
10712
|
-
|
|
10930
|
+
usage13("Opaque and simple selectors cannot be combined.");
|
|
10713
10931
|
if (result.shape !== void 0 && result.slide === void 0)
|
|
10714
|
-
|
|
10932
|
+
usage13("Shape selection requires an owning slide.");
|
|
10715
10933
|
result.input = positionals[0];
|
|
10716
10934
|
return result;
|
|
10717
10935
|
}
|
|
@@ -10760,47 +10978,47 @@ function parse(raw, maximum, output3) {
|
|
|
10760
10978
|
(key) => "--" + [...key].map((c) => c >= "A" && c <= "Z" ? "-" + c.toLowerCase() : c).join("")
|
|
10761
10979
|
);
|
|
10762
10980
|
if ([...seen].some((flag) => !allowed.includes(flag)))
|
|
10763
|
-
|
|
10981
|
+
usage13("Option does not apply to chart mutation.");
|
|
10764
10982
|
if (positionals.length !== 1 || !positionals[0])
|
|
10765
|
-
|
|
10983
|
+
usage13("Chart mutation requires exactly one input.");
|
|
10766
10984
|
result.input = positionals[0];
|
|
10767
10985
|
if (result.scope !== void 0 && result.scope !== "slides")
|
|
10768
|
-
|
|
10986
|
+
usage13("Chart mutation supports slides scope.");
|
|
10769
10987
|
if (result.token && ["--slide", "--shape", "--scope", "--all"].some((flag) => seen.has(flag)))
|
|
10770
|
-
|
|
10988
|
+
usage13("Opaque and simple selectors cannot be combined.");
|
|
10771
10989
|
const edit = result.chartEdit ?? {};
|
|
10772
10990
|
const { type, ...update } = edit;
|
|
10773
10991
|
validateChartUpdate(update);
|
|
10774
10992
|
if (operation === "charts.add") {
|
|
10775
10993
|
if (!result.slide || result.token || result.shape || result.all || result.allowEmpty)
|
|
10776
|
-
|
|
10994
|
+
usage13("Chart addition requires one slide.");
|
|
10777
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))
|
|
10778
|
-
|
|
10996
|
+
usage13("Chart addition requires type, data and geometry.");
|
|
10779
10997
|
validateChartData(edit.data, type);
|
|
10780
|
-
} else if (!Object.keys(edit).length)
|
|
10998
|
+
} else if (!Object.keys(edit).length) usage13("Chart mutation requires an update.");
|
|
10781
10999
|
if (operation === "charts.replace" && (!edit.data || !["synchronize-simple", "reject-complex"].includes(result.chartWorkbookPolicy)))
|
|
10782
|
-
|
|
10783
|
-
if (result.inPlace && result.input === "-")
|
|
10784
|
-
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.");
|
|
10785
11003
|
if (!result.dryRun && !result.inPlace && !result.output)
|
|
10786
|
-
|
|
10787
|
-
if (result.force && !result.output)
|
|
11004
|
+
usage13("Mutation requires a destination.");
|
|
11005
|
+
if (result.force && !result.output) usage13("Force requires an explicit output destination.");
|
|
10788
11006
|
if (result.output === result.input && result.output !== "-")
|
|
10789
|
-
|
|
11007
|
+
usage13("Replacing input requires --in-place.");
|
|
10790
11008
|
if (result.output === "-" && result.json && !result.dryRun)
|
|
10791
|
-
|
|
11009
|
+
usage13("Binary stdout cannot be combined with JSON.");
|
|
10792
11010
|
return result;
|
|
10793
11011
|
}
|
|
10794
11012
|
if (operation === "charts.list" || operation === "charts.get") {
|
|
10795
11013
|
const allowed = ["--json", "--limit", "--scope", "--slide", "--shape", "--select"];
|
|
10796
11014
|
if ([...seen].some((option) => !allowed.includes(option)))
|
|
10797
|
-
|
|
11015
|
+
usage13("Option does not apply to chart inspection.");
|
|
10798
11016
|
if (positionals.length !== 1 || !positionals[0])
|
|
10799
|
-
|
|
11017
|
+
usage13("Chart inspection requires exactly one input.");
|
|
10800
11018
|
if (result.scope !== void 0 && result.scope !== "slides")
|
|
10801
|
-
|
|
11019
|
+
usage13("Chart inspection supports slides scope.");
|
|
10802
11020
|
if (result.token && ["--slide", "--shape", "--scope"].some((option) => seen.has(option)))
|
|
10803
|
-
|
|
11021
|
+
usage13("Opaque and simple selectors cannot be combined.");
|
|
10804
11022
|
result.input = positionals[0];
|
|
10805
11023
|
return result;
|
|
10806
11024
|
}
|
|
@@ -10817,33 +11035,33 @@ function parse(raw, maximum, output3) {
|
|
|
10817
11035
|
...extracting ? ["--sha256", "--output-dir", "--allow-partial-output", "--force", "--dry-run"] : []
|
|
10818
11036
|
];
|
|
10819
11037
|
if (extracting) {
|
|
10820
|
-
if (!result.outputDir && !result.dryRun)
|
|
10821
|
-
if (result.outputDir === "-")
|
|
10822
|
-
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.");
|
|
10823
11041
|
}
|
|
10824
11042
|
if ([...seen].some((option) => !allowed.includes(option)))
|
|
10825
|
-
|
|
11043
|
+
usage13("Option does not apply to images list.");
|
|
10826
11044
|
if (positionals.length !== 1 || !positionals[0])
|
|
10827
|
-
|
|
10828
|
-
if (result.scope === "presentation")
|
|
11045
|
+
usage13("Image inventory requires exactly one input.");
|
|
11046
|
+
if (result.scope === "presentation") usage13("Presentation scope has no image owners.");
|
|
10829
11047
|
if (result.token && ["--slide", "--image", "--scope"].some((option) => seen.has(option)))
|
|
10830
|
-
|
|
11048
|
+
usage13("Opaque and simple selectors cannot be combined.");
|
|
10831
11049
|
result.input = positionals[0];
|
|
10832
11050
|
return result;
|
|
10833
11051
|
}
|
|
10834
11052
|
if (operation === "batch") {
|
|
10835
11053
|
const allowed = ["--json", "--limit", "--ops-json", "--ops-file", "--output", "--in-place", "--force", "--dry-run"];
|
|
10836
|
-
if ([...seen].some((flag) => !allowed.includes(flag)))
|
|
10837
|
-
if (positionals.length !== 1 || !positionals[0])
|
|
10838
|
-
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.");
|
|
10839
11057
|
result.input = positionals[0];
|
|
10840
|
-
if (result.input === "-" && result.opsFile === "-")
|
|
10841
|
-
if (result.inPlace && result.input === "-")
|
|
10842
|
-
if (result.inPlace && result.output)
|
|
10843
|
-
if (result.animationBatch?.length && !result.dryRun && !result.inPlace && !result.output)
|
|
10844
|
-
if (result.force && !result.output)
|
|
10845
|
-
if (result.output === result.input && result.output !== "-")
|
|
10846
|
-
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.");
|
|
10847
11065
|
return result;
|
|
10848
11066
|
}
|
|
10849
11067
|
if (Object.hasOwn(animationSchemas, operation)) {
|
|
@@ -10859,21 +11077,21 @@ function parse(raw, maximum, output3) {
|
|
|
10859
11077
|
...mutation2 ? ["--all", "--allow-empty", "--output", "--in-place", "--force", "--dry-run"] : [],
|
|
10860
11078
|
...editing ? ["--kind", "--trigger", "--duration", "--delay", "--target"] : []
|
|
10861
11079
|
];
|
|
10862
|
-
if ([...seen].some((flag) => !allowed.includes(flag)))
|
|
10863
|
-
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.");
|
|
10864
11082
|
result.input = positionals[0];
|
|
10865
|
-
if (result.scope !== void 0 && result.scope !== "slides")
|
|
10866
|
-
if (result.token && ["--scope", "--slide", "--shape"].some((flag) => seen.has(flag)))
|
|
10867
|
-
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.");
|
|
10868
11086
|
if (mutation2) {
|
|
10869
11087
|
validateAnimationOptions2(operation.slice(11), result.animationEdit ?? {});
|
|
10870
|
-
if (operation !== "animations.add" && !result.token && result.slide === void 0 && !result.all)
|
|
10871
|
-
if (result.inPlace && result.input === "-")
|
|
10872
|
-
if (result.inPlace && result.output)
|
|
10873
|
-
if (!result.dryRun && !result.inPlace && !result.output)
|
|
10874
|
-
if (result.force && !result.output)
|
|
10875
|
-
if (result.output === result.input && result.output !== "-")
|
|
10876
|
-
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.");
|
|
10877
11095
|
}
|
|
10878
11096
|
return result;
|
|
10879
11097
|
}
|
|
@@ -10889,20 +11107,20 @@ function parse(raw, maximum, output3) {
|
|
|
10889
11107
|
...mutation2 ? ["--all", "--allow-empty", "--output", "--in-place", "--force", "--dry-run"] : [],
|
|
10890
11108
|
...editing ? ["--kind", "--direction", "--duration", "--advance-after", "--advance-on-click"] : []
|
|
10891
11109
|
];
|
|
10892
|
-
if ([...seen].some((flag) => !allowed.includes(flag)))
|
|
10893
|
-
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.");
|
|
10894
11112
|
result.input = positionals[0];
|
|
10895
|
-
if (result.scope !== void 0 && result.scope !== "slides")
|
|
10896
|
-
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.");
|
|
10897
11115
|
if (mutation2) {
|
|
10898
11116
|
validateTransitionOptions(operation.slice(12), { ...result.transitionEdit, selection: {} });
|
|
10899
|
-
if (!result.token && result.slide === void 0 && !result.all)
|
|
10900
|
-
if (result.inPlace && result.input === "-")
|
|
10901
|
-
if (result.inPlace && result.output)
|
|
10902
|
-
if (!result.dryRun && !result.inPlace && !result.output)
|
|
10903
|
-
if (result.force && !result.output)
|
|
10904
|
-
if (result.output === result.input && result.output !== "-")
|
|
10905
|
-
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.");
|
|
10906
11124
|
}
|
|
10907
11125
|
return result;
|
|
10908
11126
|
}
|
|
@@ -10943,18 +11161,18 @@ function parse(raw, maximum, output3) {
|
|
|
10943
11161
|
if (formatting && [...seen].some(
|
|
10944
11162
|
(flag) => ["--style-json", "--find", "--with", "--first", "--occurrence"].includes(flag)
|
|
10945
11163
|
))
|
|
10946
|
-
|
|
11164
|
+
usage13("Match options do not apply to runs.");
|
|
10947
11165
|
if ([...seen].some((flag) => !allowed.includes(flag)))
|
|
10948
|
-
|
|
10949
|
-
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.");
|
|
10950
11168
|
if (result.scope === "presentation" || result.scope === "shared")
|
|
10951
|
-
|
|
11169
|
+
usage13("Text operation requires a text-bearing scope.");
|
|
10952
11170
|
if (result.token && ["--scope", "--slide", "--shape", "--paragraph", "--run"].some((flag) => seen.has(flag)))
|
|
10953
|
-
|
|
11171
|
+
usage13("Opaque and simple selectors cannot be combined.");
|
|
10954
11172
|
if (result.slide !== void 0 && (result.scope === "notes-master" || result.scope === "handout-master"))
|
|
10955
|
-
|
|
11173
|
+
usage13("Deck-level text master scopes do not accept slide selection.");
|
|
10956
11174
|
if (result.shape && result.slide === void 0)
|
|
10957
|
-
|
|
11175
|
+
usage13("Shape selection requires an owning slide.");
|
|
10958
11176
|
result.input = positionals[0];
|
|
10959
11177
|
if (mutation2) {
|
|
10960
11178
|
if (fields2)
|
|
@@ -10963,7 +11181,7 @@ function parse(raw, maximum, output3) {
|
|
|
10963
11181
|
operation.slice(7)
|
|
10964
11182
|
);
|
|
10965
11183
|
if (fitting) {
|
|
10966
|
-
if (!result.fitEdit?.metrics)
|
|
11184
|
+
if (!result.fitEdit?.metrics) usage13("Text fit requires --metrics JSON.");
|
|
10967
11185
|
validateTextFitOptions(result.fitEdit);
|
|
10968
11186
|
}
|
|
10969
11187
|
if (frames)
|
|
@@ -10977,20 +11195,20 @@ function parse(raw, maximum, output3) {
|
|
|
10977
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)
|
|
10978
11196
|
throw new SelectionError8("missing-selection");
|
|
10979
11197
|
if (!formatting && (result.find === void 0 || result.with === void 0))
|
|
10980
|
-
|
|
11198
|
+
usage13("Text replace requires find and with.");
|
|
10981
11199
|
if (!formatting && [result.first === true, result.all === true, result.occurrence !== void 0].filter(
|
|
10982
11200
|
Boolean
|
|
10983
11201
|
).length !== 1)
|
|
10984
|
-
|
|
10985
|
-
if (result.inPlace && result.input === "-")
|
|
10986
|
-
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.");
|
|
10987
11205
|
if (!result.dryRun && !result.inPlace && !result.output)
|
|
10988
|
-
|
|
10989
|
-
if (result.force && !result.output)
|
|
11206
|
+
usage13("Mutation requires a destination.");
|
|
11207
|
+
if (result.force && !result.output) usage13("Force requires an explicit output destination.");
|
|
10990
11208
|
if (result.output === result.input && result.output !== "-")
|
|
10991
|
-
|
|
11209
|
+
usage13("Replacing input requires --in-place.");
|
|
10992
11210
|
if (result.output === "-" && result.json && !result.dryRun)
|
|
10993
|
-
|
|
11211
|
+
usage13("Binary stdout cannot be combined with JSON.");
|
|
10994
11212
|
}
|
|
10995
11213
|
return result;
|
|
10996
11214
|
}
|
|
@@ -11010,11 +11228,11 @@ function parse(raw, maximum, output3) {
|
|
|
11010
11228
|
(key) => "--" + [...key].map((c) => c >= "A" && c <= "Z" ? "-" + c.toLowerCase() : c).join("")
|
|
11011
11229
|
);
|
|
11012
11230
|
if ([...seen].some((flag) => !flags.includes(flag)))
|
|
11013
|
-
|
|
11014
|
-
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.");
|
|
11015
11233
|
result.input = positionals[0];
|
|
11016
11234
|
if (result.token && (result.slide !== void 0 || result.part || result.shape || result.all))
|
|
11017
|
-
|
|
11235
|
+
usage13("Opaque and simple selectors cannot be combined.");
|
|
11018
11236
|
if (operation.startsWith("tables."))
|
|
11019
11237
|
validateTableSelection(
|
|
11020
11238
|
{
|
|
@@ -11032,28 +11250,28 @@ function parse(raw, maximum, output3) {
|
|
|
11032
11250
|
if (operation.startsWith("tables.")) {
|
|
11033
11251
|
if (operation === "tables.merge") {
|
|
11034
11252
|
if (!result.tableFrom || !result.tableTo)
|
|
11035
|
-
|
|
11253
|
+
usage13("Merge requires from and to coordinates.");
|
|
11036
11254
|
result.tableStructure = {
|
|
11037
11255
|
kind: "merge",
|
|
11038
11256
|
from: tableCell(result.tableFrom),
|
|
11039
11257
|
to: tableCell(result.tableTo)
|
|
11040
11258
|
};
|
|
11041
11259
|
} else if (operation === "tables.split") {
|
|
11042
|
-
if (!result.cell)
|
|
11260
|
+
if (!result.cell) usage13("Split requires one merge origin cell.");
|
|
11043
11261
|
result.tableStructure = { kind: "split", cell: tableCell(result.cell) };
|
|
11044
11262
|
} else if (operation.startsWith("tables.rows.") || operation.startsWith("tables.columns.")) {
|
|
11045
11263
|
const adding = operation.endsWith(".add");
|
|
11046
11264
|
if (!result.tablePosition || !(adding ? ["expand", "reject"] : ["shrink", "reject"]).includes(
|
|
11047
11265
|
result.tableSpanPolicy
|
|
11048
11266
|
))
|
|
11049
|
-
|
|
11267
|
+
usage13("A position and explicit span policy are required.");
|
|
11050
11268
|
result.tableStructure = {
|
|
11051
11269
|
kind: operation.slice(7).split(".").join("-"),
|
|
11052
11270
|
position: result.tablePosition - 1,
|
|
11053
11271
|
spanPolicy: result.tableSpanPolicy
|
|
11054
11272
|
};
|
|
11055
11273
|
} else {
|
|
11056
|
-
if (!result.tableEdit)
|
|
11274
|
+
if (!result.tableEdit) usage13("A table edit is required.");
|
|
11057
11275
|
validateTableUpdate(
|
|
11058
11276
|
{
|
|
11059
11277
|
...result.tableEdit,
|
|
@@ -11064,14 +11282,14 @@ function parse(raw, maximum, output3) {
|
|
|
11064
11282
|
}
|
|
11065
11283
|
} else if (operation === "shapes.remove") {
|
|
11066
11284
|
if (result.connectorEdit?.detachPolicy !== void 0 && !["detach", "remove"].includes(result.connectorEdit.detachPolicy))
|
|
11067
|
-
|
|
11285
|
+
usage13("Invalid detach policy.");
|
|
11068
11286
|
} else if (connector) {
|
|
11069
11287
|
if (operation !== "connectors.remove")
|
|
11070
11288
|
validateConnectorOptions(result.connectorEdit ?? {}, operation === "connectors.add");
|
|
11071
11289
|
} else if (operation === "shapes.effects.set" || operation === "shapes.drawing.set") {
|
|
11072
11290
|
if (operation === "shapes.effects.set") {
|
|
11073
11291
|
if (result.shadowEnabled === void 0 || result.shadowOpacity === void 0 || result.shadowBlur === void 0 || result.shadowColor === void 0)
|
|
11074
|
-
|
|
11292
|
+
usage13("Shadow requires explicit shadow, opacity, blur and color.");
|
|
11075
11293
|
result.drawingEdit = {
|
|
11076
11294
|
shadow: result.shadowEnabled ? {
|
|
11077
11295
|
blur: result.shadowBlur,
|
|
@@ -11082,7 +11300,7 @@ function parse(raw, maximum, output3) {
|
|
|
11082
11300
|
}
|
|
11083
11301
|
if (result.drawingFill) {
|
|
11084
11302
|
if (result.drawingEdit?.fill !== void 0)
|
|
11085
|
-
|
|
11303
|
+
usage13("Structured fill and simple fill flags cannot be mixed.");
|
|
11086
11304
|
result.drawingEdit = {
|
|
11087
11305
|
...result.drawingEdit,
|
|
11088
11306
|
fill: result.drawingFill
|
|
@@ -11090,9 +11308,9 @@ function parse(raw, maximum, output3) {
|
|
|
11090
11308
|
}
|
|
11091
11309
|
if (result.file !== void 0) {
|
|
11092
11310
|
if (result.input === "-" && result.file === "-")
|
|
11093
|
-
|
|
11311
|
+
usage13("Document and image cannot both use stdin.");
|
|
11094
11312
|
if (result.drawingEdit?.fill?.kind !== "picture" || result.drawingEdit.fill.relationshipId !== void 0)
|
|
11095
|
-
|
|
11313
|
+
usage13("File requires picture fill without a relationship ID.");
|
|
11096
11314
|
}
|
|
11097
11315
|
validateDrawingUpdate(
|
|
11098
11316
|
result.file !== void 0 && result.drawingEdit?.fill?.kind === "picture" ? {
|
|
@@ -11102,7 +11320,7 @@ function parse(raw, maximum, output3) {
|
|
|
11102
11320
|
);
|
|
11103
11321
|
} else if (selectionMutation) {
|
|
11104
11322
|
if (result.shapes && (result.slide !== void 0 || result.part || result.shape || result.token || result.all || result.allowEmpty))
|
|
11105
|
-
|
|
11323
|
+
usage13("Location arrays and simple or opaque selectors cannot be combined.");
|
|
11106
11324
|
result.selectionEdit = {
|
|
11107
11325
|
...result.selectionEdit,
|
|
11108
11326
|
action: operation.slice(7),
|
|
@@ -11117,9 +11335,9 @@ function parse(raw, maximum, output3) {
|
|
|
11117
11335
|
};
|
|
11118
11336
|
validateShapeSelectionOptions(result.selectionEdit);
|
|
11119
11337
|
} else if (grouping) {
|
|
11120
|
-
if (result.tolerance === void 0)
|
|
11338
|
+
if (result.tolerance === void 0) usage13("Grouping requires explicit tolerance.");
|
|
11121
11339
|
if (operation === "shapes.group" && result.shapes === void 0)
|
|
11122
|
-
|
|
11340
|
+
usage13("Grouping requires shape locations.");
|
|
11123
11341
|
validateGroupOptions(
|
|
11124
11342
|
{
|
|
11125
11343
|
tolerance: result.tolerance,
|
|
@@ -11136,30 +11354,30 @@ function parse(raw, maximum, output3) {
|
|
|
11136
11354
|
);
|
|
11137
11355
|
} else if (operation.startsWith("shapes.paths.")) {
|
|
11138
11356
|
if (result.path !== void 0 && (result.vertices !== void 0 || result.close !== void 0))
|
|
11139
|
-
|
|
11357
|
+
usage13("Path and vertices/close cannot be combined.");
|
|
11140
11358
|
if (result.vertices !== void 0) {
|
|
11141
|
-
if (result.close === void 0)
|
|
11359
|
+
if (result.close === void 0) usage13("Vertices require explicit --close true|false.");
|
|
11142
11360
|
if (!Array.isArray(result.vertices) || result.vertices.some((vertex) => Array.isArray(vertex)))
|
|
11143
|
-
|
|
11361
|
+
usage13("Vertices require objects with x and y coordinates.");
|
|
11144
11362
|
result.path = pathFromVertices(result.vertices, result.close);
|
|
11145
11363
|
}
|
|
11146
|
-
if (result.path === void 0)
|
|
11364
|
+
if (result.path === void 0) usage13("Path mutation requires --path or --vertices.");
|
|
11147
11365
|
validateShapePath(result.path);
|
|
11148
11366
|
if (operation.endsWith(".add"))
|
|
11149
11367
|
validateShapeOptions({ ...result.shapeEdit, kind: "text-box" }, true);
|
|
11150
11368
|
} else {
|
|
11151
|
-
if (!result.shapeEdit)
|
|
11369
|
+
if (!result.shapeEdit) usage13("Shape mutation requires update fields.");
|
|
11152
11370
|
validateShapeOptions(result.shapeEdit, operation === "shapes.add");
|
|
11153
11371
|
}
|
|
11154
|
-
if (result.inPlace && result.input === "-")
|
|
11155
|
-
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.");
|
|
11156
11374
|
if (!result.dryRun && !result.inPlace && !result.output)
|
|
11157
|
-
|
|
11158
|
-
if (result.force && !result.output)
|
|
11375
|
+
usage13("Mutation requires a destination.");
|
|
11376
|
+
if (result.force && !result.output) usage13("Force requires an explicit output destination.");
|
|
11159
11377
|
if (result.output === result.input && result.output !== "-")
|
|
11160
|
-
|
|
11378
|
+
usage13("Replacing input requires --in-place.");
|
|
11161
11379
|
if (result.output === "-" && result.json && !result.dryRun)
|
|
11162
|
-
|
|
11380
|
+
usage13("Binary stdout cannot be combined with JSON.");
|
|
11163
11381
|
}
|
|
11164
11382
|
return result;
|
|
11165
11383
|
}
|
|
@@ -11174,53 +11392,53 @@ function parse(raw, maximum, output3) {
|
|
|
11174
11392
|
(key) => key === "placeholders" ? "--placeholders-json" : "--" + [...key].map((char) => char >= "A" && char <= "Z" ? "-" + char.toLowerCase() : char).join("")
|
|
11175
11393
|
);
|
|
11176
11394
|
if ([...seen].some((flag) => !flags.includes(flag)))
|
|
11177
|
-
|
|
11395
|
+
usage13("Option does not apply to this shared-content operation.");
|
|
11178
11396
|
if (positionals.length !== 1 || !positionals[0])
|
|
11179
|
-
|
|
11397
|
+
usage13("Shared-content operations require one input.");
|
|
11180
11398
|
result.input = positionals[0];
|
|
11181
11399
|
if (mutation2 && !applying && !background && result.scope === void 0)
|
|
11182
|
-
|
|
11400
|
+
usage13("Shared-content mutation requires explicit scope.");
|
|
11183
11401
|
if (result.scope !== void 0 && !(theme ? ["shared"] : background ? ["slides", "layouts", "masters", "shared"] : applying ? ["slides"] : layout ? ["layouts", "shared"] : ["masters", "shared"]).includes(result.scope))
|
|
11184
|
-
|
|
11402
|
+
usage13("Scope does not match this shared-content operation.");
|
|
11185
11403
|
if (applying && result.token && result.scope !== void 0)
|
|
11186
|
-
|
|
11404
|
+
usage13("Opaque selectors cannot be combined with scope.");
|
|
11187
11405
|
if (result.token && (result.part || result.slide !== void 0 || result.shape || result.all))
|
|
11188
|
-
|
|
11406
|
+
usage13("Opaque and simple selectors cannot be combined.");
|
|
11189
11407
|
if (result.part && result.slide !== void 0)
|
|
11190
|
-
|
|
11408
|
+
usage13("Part and slide selectors cannot be combined.");
|
|
11191
11409
|
const edit = result.masterEdit;
|
|
11192
|
-
if (operation === "masters.add" && !edit?.name)
|
|
11410
|
+
if (operation === "masters.add" && !edit?.name) usage13("Master creation requires a name.");
|
|
11193
11411
|
if (operation === "masters.set" && edit?.name === void 0 && edit?.text === void 0)
|
|
11194
|
-
|
|
11412
|
+
usage13("Master set requires name or text.");
|
|
11195
11413
|
if (operation === "masters.set" && edit?.text !== void 0 && !result.shape && !result.token)
|
|
11196
|
-
|
|
11414
|
+
usage13("Master text edits require a selected text shape.");
|
|
11197
11415
|
if (operation === "layouts.add" && (!edit?.name || !edit.master))
|
|
11198
|
-
|
|
11416
|
+
usage13("Layout creation requires name and master.");
|
|
11199
11417
|
if (operation === "layouts.set" && !edit && !result.layoutEdit)
|
|
11200
|
-
|
|
11418
|
+
usage13("Layout set requires update fields.");
|
|
11201
11419
|
if (operation === "layouts.set" && edit?.text !== void 0 && !result.shape && !result.token)
|
|
11202
|
-
|
|
11420
|
+
usage13("Layout text requires a selected shape.");
|
|
11203
11421
|
if (layout && mutation2 && operation !== "layouts.add" && !result.part && !result.token && result.slide === void 0 && !result.all)
|
|
11204
|
-
|
|
11422
|
+
usage13("Layout mutation requires an explicit selector.");
|
|
11205
11423
|
if (applying && (!result.layoutEdit?.layout || !["type-index", "reject-unmatched"].includes(result.layoutEdit.placeholderPolicy)))
|
|
11206
|
-
|
|
11424
|
+
usage13("Layout application requires layout and placeholder policy.");
|
|
11207
11425
|
if (operation === "shapes.add" && (edit?.kind !== "text-box" || [edit.x, edit.y, edit.width, edit.height].some((value) => value === void 0)))
|
|
11208
|
-
|
|
11426
|
+
usage13("Master shape creation requires text-box kind and explicit geometry.");
|
|
11209
11427
|
if (operation === "shapes.set" && (!edit || !result.shape && !result.token))
|
|
11210
|
-
|
|
11428
|
+
usage13("Shape edits require update fields and a selected shape.");
|
|
11211
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)))
|
|
11212
|
-
|
|
11430
|
+
usage13("Theme set requires paired palette or font values, or a name.");
|
|
11213
11431
|
if (result.themeEdit?.colorSlot !== void 0 && !themeColorSlots.includes(result.themeEdit.colorSlot))
|
|
11214
|
-
|
|
11432
|
+
usage13("Unknown theme color slot.");
|
|
11215
11433
|
if (result.themeEdit?.fontSlot !== void 0 && !themeFontSlots.includes(result.themeEdit.fontSlot))
|
|
11216
|
-
|
|
11434
|
+
usage13("Unknown theme font slot.");
|
|
11217
11435
|
if (background && result.scope === "shared" && !result.part && !result.token)
|
|
11218
|
-
|
|
11436
|
+
usage13("Shared background scope requires an exact part or selector.");
|
|
11219
11437
|
if (operation === "backgrounds.set") {
|
|
11220
11438
|
if (!result.part && !result.token && result.slide === void 0 && !result.all)
|
|
11221
|
-
|
|
11439
|
+
usage13("Background mutation requires a selector or all.");
|
|
11222
11440
|
if (result.file === "-" && result.input === "-")
|
|
11223
|
-
|
|
11441
|
+
usage13("Presentation and image cannot both read stdin.");
|
|
11224
11442
|
const edit2 = result.backgroundEdit;
|
|
11225
11443
|
const required = {
|
|
11226
11444
|
solid: ["color"],
|
|
@@ -11229,24 +11447,24 @@ function parse(raw, maximum, output3) {
|
|
|
11229
11447
|
inherit: [],
|
|
11230
11448
|
"style-reference": ["styleIndex", "styleColor"]
|
|
11231
11449
|
};
|
|
11232
|
-
if (!edit2?.kind || !Object.hasOwn(required, edit2.kind))
|
|
11450
|
+
if (!edit2?.kind || !Object.hasOwn(required, edit2.kind)) usage13("Background kind is required.");
|
|
11233
11451
|
const fields2 = { ...edit2, ...result.file === void 0 ? {} : { file: result.file } };
|
|
11234
11452
|
const keys = required[edit2.kind];
|
|
11235
11453
|
if (keys.some((key) => !Object.hasOwn(fields2, key)) || Object.keys(fields2).some(
|
|
11236
11454
|
(key) => key !== "kind" && !keys.includes(key) && !(edit2.kind === "gradient" && key === "angle")
|
|
11237
11455
|
))
|
|
11238
|
-
|
|
11456
|
+
usage13("Background payload does not match its kind.");
|
|
11239
11457
|
}
|
|
11240
11458
|
if (mutation2) {
|
|
11241
|
-
if (result.inPlace && result.input === "-")
|
|
11242
|
-
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.");
|
|
11243
11461
|
if (!result.dryRun && !result.inPlace && !result.output)
|
|
11244
|
-
|
|
11245
|
-
if (result.force && !result.output)
|
|
11462
|
+
usage13("Mutation requires a destination.");
|
|
11463
|
+
if (result.force && !result.output) usage13("Force requires an explicit output destination.");
|
|
11246
11464
|
if (result.output === result.input && result.output !== "-")
|
|
11247
|
-
|
|
11465
|
+
usage13("Replacing input requires --in-place.");
|
|
11248
11466
|
if (result.output === "-" && result.json && !result.dryRun)
|
|
11249
|
-
|
|
11467
|
+
usage13("Binary stdout cannot be combined with JSON.");
|
|
11250
11468
|
}
|
|
11251
11469
|
return result;
|
|
11252
11470
|
}
|
|
@@ -11273,20 +11491,20 @@ function parse(raw, maximum, output3) {
|
|
|
11273
11491
|
] : []
|
|
11274
11492
|
];
|
|
11275
11493
|
if ([...seen].some((flag) => !allowed.includes(flag)))
|
|
11276
|
-
|
|
11277
|
-
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.");
|
|
11278
11496
|
result.input = positionals[0];
|
|
11279
11497
|
if (mutation2) {
|
|
11280
|
-
if (!result.settings)
|
|
11281
|
-
if (result.inPlace && result.input === "-")
|
|
11282
|
-
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.");
|
|
11283
11501
|
if (!result.dryRun && !result.inPlace && !result.output)
|
|
11284
|
-
|
|
11285
|
-
if (result.force && !result.output)
|
|
11502
|
+
usage13("Mutation requires a destination.");
|
|
11503
|
+
if (result.force && !result.output) usage13("Force requires an explicit output destination.");
|
|
11286
11504
|
if (result.output === result.input && result.output !== "-")
|
|
11287
|
-
|
|
11505
|
+
usage13("Replacing input requires --in-place.");
|
|
11288
11506
|
if (result.output === "-" && result.json && !result.dryRun)
|
|
11289
|
-
|
|
11507
|
+
usage13("Binary stdout cannot be combined with JSON.");
|
|
11290
11508
|
}
|
|
11291
11509
|
return result;
|
|
11292
11510
|
}
|
|
@@ -11303,32 +11521,32 @@ function parse(raw, maximum, output3) {
|
|
|
11303
11521
|
...["add", "set"].includes(action) ? ["--name", "--slides", "--position"] : []
|
|
11304
11522
|
];
|
|
11305
11523
|
if ([...seen].some((flag) => !allowed.includes(flag)))
|
|
11306
|
-
|
|
11524
|
+
usage13("Option does not apply to this membership operation.");
|
|
11307
11525
|
if (positionals.length !== 1 || !positionals[0])
|
|
11308
|
-
|
|
11526
|
+
usage13("Membership operations require one input.");
|
|
11309
11527
|
result.input = positionals[0];
|
|
11310
11528
|
if (result.scope !== void 0 && result.scope !== "presentation")
|
|
11311
|
-
|
|
11529
|
+
usage13("Membership operations require presentation scope.");
|
|
11312
11530
|
if (result.token && ["--slide", "--scope", "--all"].some((flag) => seen.has(flag)))
|
|
11313
|
-
|
|
11531
|
+
usage13("Opaque and simple selectors cannot be combined.");
|
|
11314
11532
|
if (action === "add" && (result.membership?.name === void 0 || !result.membership.slides))
|
|
11315
|
-
|
|
11316
|
-
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.");
|
|
11317
11535
|
if (mutation2) {
|
|
11318
|
-
if (result.inPlace && result.input === "-")
|
|
11319
|
-
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.");
|
|
11320
11538
|
if (!result.dryRun && !result.inPlace && !result.output)
|
|
11321
|
-
|
|
11322
|
-
if (result.force && !result.output)
|
|
11539
|
+
usage13("Mutation requires a destination.");
|
|
11540
|
+
if (result.force && !result.output) usage13("Force requires an explicit output destination.");
|
|
11323
11541
|
if (result.output === result.input && result.output !== "-")
|
|
11324
|
-
|
|
11542
|
+
usage13("Replacing input requires --in-place.");
|
|
11325
11543
|
if (result.output === "-" && result.json && !result.dryRun)
|
|
11326
|
-
|
|
11544
|
+
usage13("Binary stdout cannot be combined with JSON.");
|
|
11327
11545
|
}
|
|
11328
11546
|
return result;
|
|
11329
11547
|
}
|
|
11330
11548
|
if (result.allowEmpty && !slideMutation)
|
|
11331
|
-
|
|
11549
|
+
usage13("Allow-empty requires a supported slide mutation.");
|
|
11332
11550
|
if (operation === "slides.merge" || operation === "slides.split") {
|
|
11333
11551
|
const allowed = [
|
|
11334
11552
|
"--json",
|
|
@@ -11345,36 +11563,36 @@ function parse(raw, maximum, output3) {
|
|
|
11345
11563
|
] : ["--slides", "--output-dir", "--allow-partial-output"]
|
|
11346
11564
|
];
|
|
11347
11565
|
if ([...seen].some((option) => !allowed.includes(option)))
|
|
11348
|
-
|
|
11566
|
+
usage13("Option does not apply to this assembly operation.");
|
|
11349
11567
|
if (positionals.length !== 1 || !positionals[0])
|
|
11350
|
-
|
|
11568
|
+
usage13("Assembly requires one destination or source input.");
|
|
11351
11569
|
result.input = positionals[0];
|
|
11352
11570
|
if (operation === "slides.split") {
|
|
11353
|
-
if (!result.splitSlides)
|
|
11354
|
-
if (!result.outputDir && !result.dryRun)
|
|
11355
|
-
if (result.outputDir === "-")
|
|
11356
|
-
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.");
|
|
11357
11575
|
} else {
|
|
11358
11576
|
if (!result.sources || !result.importing?.themePolicy)
|
|
11359
|
-
|
|
11577
|
+
usage13("Merge requires sources and an explicit theme policy.");
|
|
11360
11578
|
if ([result.input, ...result.sources].filter((path) => path === "-").length > 1)
|
|
11361
|
-
|
|
11362
|
-
if (result.inPlace && result.input === "-")
|
|
11363
|
-
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.");
|
|
11364
11582
|
if (!result.dryRun && !result.inPlace && !result.output)
|
|
11365
|
-
|
|
11366
|
-
if (result.force && !result.output)
|
|
11583
|
+
usage13("Merge requires a destination.");
|
|
11584
|
+
if (result.force && !result.output) usage13("Force requires an explicit output destination.");
|
|
11367
11585
|
if (result.output === result.input && result.output !== "-")
|
|
11368
|
-
|
|
11586
|
+
usage13("Replacing input requires --in-place.");
|
|
11369
11587
|
if (result.sources.includes(result.inPlace ? result.input : result.output ?? "") && (result.inPlace || result.output !== "-"))
|
|
11370
|
-
|
|
11588
|
+
usage13("Merge output cannot replace a source.");
|
|
11371
11589
|
if (result.output === "-" && result.json && !result.dryRun)
|
|
11372
|
-
|
|
11590
|
+
usage13("Binary stdout cannot be combined with JSON.");
|
|
11373
11591
|
}
|
|
11374
11592
|
return result;
|
|
11375
11593
|
}
|
|
11376
11594
|
if (operation === "create") {
|
|
11377
|
-
if (positionals.length)
|
|
11595
|
+
if (positionals.length) usage13("Creation takes no input positional arguments.");
|
|
11378
11596
|
const allowed = [
|
|
11379
11597
|
"--width",
|
|
11380
11598
|
"--height",
|
|
@@ -11392,11 +11610,11 @@ function parse(raw, maximum, output3) {
|
|
|
11392
11610
|
"--dry-run"
|
|
11393
11611
|
];
|
|
11394
11612
|
if ([...seen].some((option) => !allowed.includes(option)))
|
|
11395
|
-
|
|
11396
|
-
if (!result.output && !result.dryRun)
|
|
11397
|
-
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.");
|
|
11398
11616
|
if (result.output === "-" && result.json && !result.dryRun)
|
|
11399
|
-
|
|
11617
|
+
usage13("Binary stdout cannot be combined with JSON.");
|
|
11400
11618
|
return result;
|
|
11401
11619
|
}
|
|
11402
11620
|
if (operation === "slides.import") {
|
|
@@ -11414,14 +11632,14 @@ function parse(raw, maximum, output3) {
|
|
|
11414
11632
|
"--dry-run"
|
|
11415
11633
|
];
|
|
11416
11634
|
if ([...seen].some((option) => !allowed.includes(option)))
|
|
11417
|
-
|
|
11635
|
+
usage13("Option does not apply to slide import.");
|
|
11418
11636
|
if (!result.source || !result.importing?.sourceSlides)
|
|
11419
|
-
|
|
11420
|
-
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.");
|
|
11421
11639
|
if (result.output === result.source && result.output !== "-")
|
|
11422
|
-
|
|
11640
|
+
usage13("Import output cannot replace its source.");
|
|
11423
11641
|
if (result.inPlace && positionals[0] === result.source)
|
|
11424
|
-
|
|
11642
|
+
usage13("Import in-place destination must differ from source.");
|
|
11425
11643
|
} else if (operation === "slides.add") {
|
|
11426
11644
|
const allowed = [
|
|
11427
11645
|
"--layout",
|
|
@@ -11440,11 +11658,11 @@ function parse(raw, maximum, output3) {
|
|
|
11440
11658
|
"--dry-run"
|
|
11441
11659
|
];
|
|
11442
11660
|
if ([...seen].some((option) => !allowed.includes(option)))
|
|
11443
|
-
|
|
11661
|
+
usage13("Option does not apply to slide addition.");
|
|
11444
11662
|
if (positionals.length !== 1 || !positionals[0])
|
|
11445
|
-
|
|
11663
|
+
usage13("Slide addition requires exactly one input.");
|
|
11446
11664
|
result.input = positionals[0];
|
|
11447
|
-
if (!result.addition?.layout)
|
|
11665
|
+
if (!result.addition?.layout) usage13("Slide addition requires --layout.");
|
|
11448
11666
|
} else if (slideMutation) {
|
|
11449
11667
|
const allowed = [
|
|
11450
11668
|
"--selection-json",
|
|
@@ -11464,29 +11682,29 @@ function parse(raw, maximum, output3) {
|
|
|
11464
11682
|
...operation === "slides.set" ? ["--name", "--hidden"] : []
|
|
11465
11683
|
];
|
|
11466
11684
|
if ([...seen].some((option) => !allowed.includes(option)))
|
|
11467
|
-
|
|
11685
|
+
usage13("Option does not apply to this slide mutation.");
|
|
11468
11686
|
if (seen.has("--selection-json") && ["--slide", "--select", "--scope", "--all"].some((flag) => seen.has(flag)))
|
|
11469
|
-
|
|
11687
|
+
usage13("Structured and simple selectors cannot be combined.");
|
|
11470
11688
|
if (!seen.has("--selection-json") && result.slide === void 0 && !result.token && !result.all)
|
|
11471
|
-
|
|
11689
|
+
usage13("Slide mutation requires a selector or --all.");
|
|
11472
11690
|
if (operation !== "slides.remove" && (!result.mutation || (operation === "slides.move" || operation === "slides.duplicate") && result.mutation.position === void 0))
|
|
11473
|
-
|
|
11691
|
+
usage13("Slide mutation requires update fields; move/duplicate require --position.");
|
|
11474
11692
|
if (result.scope !== void 0 && result.scope !== "slides")
|
|
11475
|
-
|
|
11693
|
+
usage13("Slide mutations require slides scope.");
|
|
11476
11694
|
} else if (operation === "validate") {
|
|
11477
11695
|
if ([...seen].some((flag) => flag !== "--json" && flag !== "--limit"))
|
|
11478
|
-
|
|
11696
|
+
usage13("Option does not apply to validation.");
|
|
11479
11697
|
if (result.limits && ["maxOutputs", "maxOutputBytes"].some((name) => Object.hasOwn(result.limits, name)))
|
|
11480
|
-
|
|
11481
|
-
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.");
|
|
11482
11700
|
result.input = positionals[0];
|
|
11483
11701
|
return result;
|
|
11484
11702
|
} else if (operation !== "inspect" && !xml) {
|
|
11485
11703
|
if ([...seen].some((option) => option !== "--json" && !(operation === "capabilities" && option === "--limit")))
|
|
11486
|
-
|
|
11704
|
+
usage13("Selection options require inspect.");
|
|
11487
11705
|
if (operation === "capabilities") {
|
|
11488
|
-
if (result.limits && Object.hasOwn(result.limits, "maxOutputs"))
|
|
11489
|
-
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.");
|
|
11490
11708
|
if (positionals[0] !== void 0) result.input = positionals[0];
|
|
11491
11709
|
return result;
|
|
11492
11710
|
}
|
|
@@ -11547,43 +11765,43 @@ function parse(raw, maximum, output3) {
|
|
|
11547
11765
|
result.schemaPath = positionals.join(".");
|
|
11548
11766
|
return result;
|
|
11549
11767
|
}
|
|
11550
|
-
if (positionals.length)
|
|
11768
|
+
if (positionals.length) usage13("Unexpected input.");
|
|
11551
11769
|
return result;
|
|
11552
11770
|
}
|
|
11553
|
-
if (positionals.length !== 1)
|
|
11771
|
+
if (positionals.length !== 1) usage13("Inspection requires exactly one input.");
|
|
11554
11772
|
result.input = positionals[0];
|
|
11555
|
-
if (result.input.length === 0)
|
|
11773
|
+
if (result.input.length === 0) usage13("Input path must not be empty.");
|
|
11556
11774
|
if (result.token && ["--slide", "--shape", "--part", "--scope", "--all"].some((option) => seen.has(option)))
|
|
11557
|
-
|
|
11775
|
+
usage13("Opaque and simple selectors cannot be combined.");
|
|
11558
11776
|
if (result.part && result.slide !== void 0)
|
|
11559
|
-
|
|
11777
|
+
usage13("Part and slide selectors cannot be combined.");
|
|
11560
11778
|
if (result.shape && result.slide === void 0 && !result.part)
|
|
11561
|
-
|
|
11779
|
+
usage13("Shape selection requires an owning slide or part.");
|
|
11562
11780
|
if (result.slide !== void 0 && result.scope !== void 0 && result.scope !== "slides")
|
|
11563
|
-
|
|
11781
|
+
usage13("Slide positions require slides scope.");
|
|
11564
11782
|
const mutationOptions = ["--file", "--output", "--in-place", "--force", "--dry-run"];
|
|
11565
11783
|
if (operation !== "xml.set" && operation !== "slides.add" && operation !== "slides.import" && !slideMutation && mutationOptions.some((option) => seen.has(option)))
|
|
11566
|
-
|
|
11784
|
+
usage13("Publication options require xml set.");
|
|
11567
11785
|
if (!xml && operation !== "inspect" && operation !== "slides.add" && operation !== "slides.import" && !slideMutation && result.limits)
|
|
11568
|
-
|
|
11569
|
-
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.");
|
|
11570
11788
|
if (xml) {
|
|
11571
11789
|
if (result.slide !== void 0 || result.shape || result.all)
|
|
11572
|
-
|
|
11573
|
-
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.");
|
|
11574
11792
|
}
|
|
11575
11793
|
if (operation === "xml.set" || operation === "slides.add" || operation === "slides.import" || slideMutation) {
|
|
11576
|
-
if (operation === "xml.set" && !result.file)
|
|
11577
|
-
if (result.input === "-" && result.file === "-")
|
|
11578
|
-
if (result.inPlace && result.input === "-")
|
|
11579
|
-
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.");
|
|
11580
11798
|
if (!result.dryRun && !result.inPlace && !result.output)
|
|
11581
|
-
|
|
11582
|
-
if (result.force && !result.output)
|
|
11799
|
+
usage13("Mutation requires a destination.");
|
|
11800
|
+
if (result.force && !result.output) usage13("Force requires an explicit output destination.");
|
|
11583
11801
|
if (result.output === result.input && result.output !== "-")
|
|
11584
|
-
|
|
11802
|
+
usage13("Replacing input requires --in-place.");
|
|
11585
11803
|
if (result.output === "-" && result.json && !result.dryRun)
|
|
11586
|
-
|
|
11804
|
+
usage13("Binary stdout cannot be combined with JSON.");
|
|
11587
11805
|
}
|
|
11588
11806
|
return result;
|
|
11589
11807
|
}
|
|
@@ -11652,7 +11870,7 @@ async function transferLocations(bytes, budget) {
|
|
|
11652
11870
|
(edge) => relationshipNamespaces.some((namespace) => edge.type === `${namespace}/officeDocument`)
|
|
11653
11871
|
);
|
|
11654
11872
|
const root = roots.length === 1 ? roots[0].targetPart : void 0;
|
|
11655
|
-
if (!root) throw new
|
|
11873
|
+
if (!root) throw new OfficeError19("invalid-opc", "Presentation part is missing.", "index");
|
|
11656
11874
|
const relationshipNamespace = roots[0].type.slice(0, -"/officeDocument".length);
|
|
11657
11875
|
const xml = budget.xml(reader.get(root));
|
|
11658
11876
|
const fingerprint = Array.from(sha2564(bytes), (byte) => byte.toString(16).padStart(2, "0")).join(
|
|
@@ -11671,7 +11889,7 @@ async function transferLocations(bytes, budget) {
|
|
|
11671
11889
|
(edge) => edge.id === reference && edge.type === `${relationshipNamespace}/slide`
|
|
11672
11890
|
)?.targetPart;
|
|
11673
11891
|
if (!id || !owner || !reader.has(owner))
|
|
11674
|
-
throw new
|
|
11892
|
+
throw new OfficeError19("invalid-opc", "Referenced slide is missing.", "index");
|
|
11675
11893
|
return {
|
|
11676
11894
|
fingerprint,
|
|
11677
11895
|
scope: "slides",
|
|
@@ -11754,7 +11972,7 @@ async function executeRequest(request, options2, owned) {
|
|
|
11754
11972
|
let allowPartialOutput = false;
|
|
11755
11973
|
try {
|
|
11756
11974
|
request.signal.throwIfAborted();
|
|
11757
|
-
if (!Array.isArray(request.args))
|
|
11975
|
+
if (!Array.isArray(request.args)) usage13("Arguments must be byte arrays.");
|
|
11758
11976
|
const args = parse(request.args, options2.maxArgumentBytes, output3);
|
|
11759
11977
|
if (args.limits) {
|
|
11760
11978
|
const validation = options2.context.validationLimits;
|
|
@@ -11780,14 +11998,47 @@ async function executeRequest(request, options2, owned) {
|
|
|
11780
11998
|
output3.json = args.json;
|
|
11781
11999
|
output3.operation = args.operation;
|
|
11782
12000
|
const operation2 = args.operation;
|
|
11783
|
-
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)) {
|
|
11784
12035
|
retainedExtraction = await prepareRetainedExtraction(args, request, options2);
|
|
11785
12036
|
owned.push(retainedExtraction);
|
|
11786
12037
|
result = success(operation2, null);
|
|
11787
12038
|
} else if (args.operation === "xml.set" && request.streaming) {
|
|
11788
12039
|
if (args.token) decodeSelectionToken2(args.token);
|
|
11789
12040
|
const streaming = request.streaming, context = { ...options2.context, signal: request.signal, workingStorage: streaming.workingStorage };
|
|
11790
|
-
if (!context.validationLimits) throw new
|
|
12041
|
+
if (!context.validationLimits) throw new OfficeError19("invalid-value", "XML operations require explicit validation limits.", "usage");
|
|
11791
12042
|
const input = await streaming.openInput(args.input, Math.min(context.limits.maxBytes, context.archiveLimits.maxArchiveBytes));
|
|
11792
12043
|
const maxReplacementBytes = Math.min(context.validationLimits.maxBytes, context.archiveLimits.maxEntryBytes), file = args.file;
|
|
11793
12044
|
async function* replacement() {
|
|
@@ -11827,7 +12078,7 @@ async function executeRequest(request, options2, owned) {
|
|
|
11827
12078
|
publication = { inputPath: args.input, outputPath: destination, bytes: staged.bytes(), originalBytes: input, inPlace: args.inPlace ?? false, force: args.force ?? false, dryRun };
|
|
11828
12079
|
}
|
|
11829
12080
|
result = success(operation2, null);
|
|
11830
|
-
} 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) {
|
|
11831
12082
|
if (args.token) decodeSelectionToken2(args.token);
|
|
11832
12083
|
const input = await request.streaming.openInput(args.input, Math.min(options2.context.limits.maxBytes, options2.context.archiveLimits.maxArchiveBytes));
|
|
11833
12084
|
const hash = sha2564.create();
|
|
@@ -11862,7 +12113,7 @@ async function executeRequest(request, options2, owned) {
|
|
|
11862
12113
|
}, context, { json: args.json, maxOutputBytes: options2.maxOutputBytes });
|
|
11863
12114
|
} catch (error) {
|
|
11864
12115
|
failed = true;
|
|
11865
|
-
if (error instanceof
|
|
12116
|
+
if (error instanceof OfficeError19 && error.code === "resource-limit" && error.phase === "publish") return outputLimitFailure(operation2, args.json);
|
|
11866
12117
|
throw error;
|
|
11867
12118
|
} finally {
|
|
11868
12119
|
try {
|
|
@@ -11887,7 +12138,7 @@ async function executeRequest(request, options2, owned) {
|
|
|
11887
12138
|
let failed = false;
|
|
11888
12139
|
try {
|
|
11889
12140
|
validation = await openRetainedPresentationValidation(archive, context, limits);
|
|
11890
|
-
if (!validation.valid) throw new
|
|
12141
|
+
if (!validation.valid) throw new OfficeError19("invalid-opc", "Presentation semantic validation failed.", "index");
|
|
11891
12142
|
result = success(operation2, { valid: true, schema: validation.schema, rules: validation.rules, issues: [] });
|
|
11892
12143
|
} catch (error) {
|
|
11893
12144
|
failed = true;
|
|
@@ -11902,15 +12153,15 @@ async function executeRequest(request, options2, owned) {
|
|
|
11902
12153
|
const bytes = await request.readInput(args.input, maxBytes);
|
|
11903
12154
|
const reader = await readPackage3(bytes, { ...options2.context, signal: request.signal });
|
|
11904
12155
|
const validation = validatePresentation(reader, limits);
|
|
11905
|
-
if (!validation.valid) throw new
|
|
12156
|
+
if (!validation.valid) throw new OfficeError19("invalid-opc", "Presentation semantic validation failed.", "index");
|
|
11906
12157
|
result = success(operation2, validation);
|
|
11907
12158
|
}
|
|
11908
12159
|
human = "Presentation is semantically valid; XML schema validation not checked.\n";
|
|
11909
12160
|
} else if (args.operation === "help") {
|
|
11910
|
-
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;
|
|
11911
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(
|
|
11912
12163
|
args.schemaPath ?? ""
|
|
11913
|
-
) ? "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;
|
|
11914
12165
|
if (args.schemaPath === "diff") resolvedUsage = diffUsage;
|
|
11915
12166
|
if (args.schemaPath?.startsWith("comments.")) resolvedUsage = commentsUsage;
|
|
11916
12167
|
if (args.schemaPath?.startsWith("notes.")) resolvedUsage = notesUsage;
|
|
@@ -12259,11 +12510,11 @@ ${JSON.stringify(result.data, null, 2)}
|
|
|
12259
12510
|
try {
|
|
12260
12511
|
text2 = new TextDecoder("utf-8", { fatal: true }).decode(encoded2);
|
|
12261
12512
|
} catch {
|
|
12262
|
-
|
|
12513
|
+
usage13("Batch JSON must be UTF-8.");
|
|
12263
12514
|
}
|
|
12264
12515
|
items = parseAnimationBatch(commandJson(text2));
|
|
12265
12516
|
}
|
|
12266
|
-
if (items.length && !args.dryRun && !args.inPlace && !args.output)
|
|
12517
|
+
if (items.length && !args.dryRun && !args.inPlace && !args.output) usage13("Mutation requires a destination.");
|
|
12267
12518
|
const bytes = await request.readInput(args.input, Math.min(context.limits.maxBytes, context.archiveLimits.maxArchiveBytes));
|
|
12268
12519
|
const index = await readSelectionIndex2(bytes, context);
|
|
12269
12520
|
const changed = await mutateAnimationsBatch(bytes, resolveAnimationBatch(items, index), context);
|
|
@@ -13498,13 +13749,13 @@ ${item.parts.map((part) => ` ${part}
|
|
|
13498
13749
|
const inputs = [];
|
|
13499
13750
|
for (const path of [args.input, ...args.sources ?? []]) {
|
|
13500
13751
|
if (remaining < 1)
|
|
13501
|
-
throw new
|
|
13752
|
+
throw new OfficeError19("resource-limit", "Combined input limit exceeded.", "admit");
|
|
13502
13753
|
const bytes = await request.readInput(
|
|
13503
13754
|
path,
|
|
13504
13755
|
Math.min(remaining, context.archiveLimits.maxArchiveBytes)
|
|
13505
13756
|
);
|
|
13506
13757
|
if (bytes.length > remaining || bytes.length > context.archiveLimits.maxArchiveBytes)
|
|
13507
|
-
throw new
|
|
13758
|
+
throw new OfficeError19("resource-limit", "Combined input limit exceeded.", "admit");
|
|
13508
13759
|
remaining -= bytes.length;
|
|
13509
13760
|
inputs.push(await budget.read(bytes));
|
|
13510
13761
|
}
|
|
@@ -13605,7 +13856,7 @@ ${JSON.stringify(result.data, null, 2)}
|
|
|
13605
13856
|
}
|
|
13606
13857
|
} else if (args.operation === "create") {
|
|
13607
13858
|
if (args.template)
|
|
13608
|
-
throw new
|
|
13859
|
+
throw new OfficeError19(
|
|
13609
13860
|
"unsupported-profile",
|
|
13610
13861
|
"Template-based creation is unavailable.",
|
|
13611
13862
|
"validate-intent"
|
|
@@ -13657,7 +13908,7 @@ ${JSON.stringify(result.data, null, 2)}
|
|
|
13657
13908
|
);
|
|
13658
13909
|
} catch (error) {
|
|
13659
13910
|
if (error && typeof error === "object" && "code" in error && error.code === "resource-limit")
|
|
13660
|
-
throw new
|
|
13911
|
+
throw new OfficeError19("resource-limit", "Input limit exceeded.", "admit");
|
|
13661
13912
|
throw error;
|
|
13662
13913
|
}
|
|
13663
13914
|
const index = await readSelectionIndex2(bytes, { ...options2.context, signal: request.signal });
|
|
@@ -13802,7 +14053,7 @@ ${JSON.stringify(result.data, null, 2)}
|
|
|
13802
14053
|
const part = metadata2 ?? records[0].part;
|
|
13803
14054
|
const validationLimits = options2.context.validationLimits;
|
|
13804
14055
|
if (!validationLimits)
|
|
13805
|
-
throw new
|
|
14056
|
+
throw new OfficeError19(
|
|
13806
14057
|
"invalid-value",
|
|
13807
14058
|
"XML operations require explicit validation limits.",
|
|
13808
14059
|
"usage"
|
|
@@ -13878,10 +14129,10 @@ ${xml.xml}
|
|
|
13878
14129
|
await stagedOutput?.close().catch(() => {
|
|
13879
14130
|
});
|
|
13880
14131
|
stagedOutput = void 0;
|
|
13881
|
-
if (error instanceof
|
|
14132
|
+
if (error instanceof OfficeError19 && error.code === "resource-limit" && error.phase === "publish") return outputLimitFailure(output3.operation, output3.json);
|
|
13882
14133
|
if (request.signal.aborted)
|
|
13883
14134
|
return { exitCode: 130, stdout: new Uint8Array(), stderr: new Uint8Array() };
|
|
13884
|
-
const office = error instanceof
|
|
14135
|
+
const office = error instanceof OfficeError19 ? error : void 0;
|
|
13885
14136
|
const capabilityCode = error && typeof error === "object" && "code" in error ? error.code : void 0;
|
|
13886
14137
|
const limit = office?.code === "resource-limit" || capabilityCode === "resource-limit";
|
|
13887
14138
|
const unsupported = capabilityCode === "publication-unsupported";
|
|
@@ -13984,7 +14235,7 @@ ${JSON.stringify(failure.data)}
|
|
|
13984
14235
|
} catch (error) {
|
|
13985
14236
|
if (request.signal.aborted)
|
|
13986
14237
|
return { exitCode: 130, stdout: new Uint8Array(), stderr: new Uint8Array() };
|
|
13987
|
-
const office = error instanceof
|
|
14238
|
+
const office = error instanceof OfficeError19 ? error : void 0;
|
|
13988
14239
|
const rawCode = error && typeof error === "object" && "code" in error ? error.code : void 0;
|
|
13989
14240
|
const code = typeof rawCode === "string" && [
|
|
13990
14241
|
"resource-limit",
|
|
@@ -14066,7 +14317,7 @@ async function execute(request, options2) {
|
|
|
14066
14317
|
}
|
|
14067
14318
|
}
|
|
14068
14319
|
function createPptxCommandEngine(settings = {}) {
|
|
14069
|
-
const context =
|
|
14320
|
+
const context = resourceContext2(settings.context);
|
|
14070
14321
|
const options2 = {
|
|
14071
14322
|
maxArgumentBytes: settings.maxArgumentBytes ?? Infinity,
|
|
14072
14323
|
maxOutputBytes: settings.maxOutputBytes ?? Infinity,
|