@poe-platform/safe-bash 0.1.813 → 0.1.815
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 +3 -0
- package/dist/mp4-ast/mp4-fragment-source.d.ts +35 -0
- package/dist/mp4-ast/mp4-sample-source.d.ts +55 -0
- package/dist/mp4-ast/mp4-source.d.ts +32 -0
- package/dist/mp4-ast/types.d.ts +11 -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 +8 -0
- package/dist/pdf-ast/cos/value-parser.d.ts +1 -0
- package/dist/pdf-ast/edit/forms.d.ts +1 -0
- package/dist/pdf-ast/edit/retained-form-appearances.d.ts +10 -0
- package/dist/pdf-ast/edit/retained-form-data.d.ts +9 -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 +2 -1
- package/dist/pdf-ast/index.js +895 -139
- package/dist/pdf-ast/retained-document.d.ts +5 -0
- package/dist/safe-bash/command-chunks/biff-A7XPBWAK-DCLG5QKF.js +5417 -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-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-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-PKLJRB7W.js → chunk-44F5TOHZ.js} +219 -90
- 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-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-RLCQ7BN3.js → chunk-6CDDKNNA.js} +4 -3
- package/dist/safe-bash/command-chunks/{chunk-TQEB4DH4.js → chunk-6EINUY5G.js} +149 -165
- 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-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-PK36TVXB.js → chunk-CFMJXJS5.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-3LJAXFH5.js → chunk-CIRDVCAZ.js} +7 -7
- 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-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-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-GPGLTWNR.js +271 -0
- 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-IHSOOSNC.js → chunk-HQ2UN2L2.js} +17 -17
- 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-73NYFNAS.js → chunk-KASXIRKD.js} +12 -9
- 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-KHUT7BB5.js +65 -0
- package/dist/safe-bash/command-chunks/{chunk-TUDFMNPP.js → chunk-KINIV2SV.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-43TRBJ2N.js → chunk-KPHLESD4.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-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-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-7NXTEWPR.js → chunk-NEYITAAO.js} +208 -254
- 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-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-GOBUDKZ3.js → chunk-QDVDBN2N.js} +4 -4
- 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-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-CTDC4LJT.js → chunk-U3C6IT2C.js} +55 -36
- 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-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-T6C5QP7T.js → chunk-WAT2562G.js} +6039 -5958
- 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-JORIVUPM.js → chunk-YW2VYN4V.js} +34 -15
- 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-7UC2Q6Z6.js → chunk-ZIGENXGC.js} +248 -6
- 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-M7S4QIXV.js} +942 -683
- package/dist/safe-bash/command-chunks/{engine-XUCIFZ7V-LJFGZM6O.js → engine-YUYZJIB4-NZUDFEHL.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.d.ts +8 -2
- package/dist/safe-bash-command-ffprobe/media.js +4 -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 +40 -40
- package/dist/safe-bash-command-patch/index.js +7 -6
- package/dist/safe-bash-command-patch/patch-formats.d.ts +7 -1
- package/dist/safe-bash-command-patch/patch-formats.js +7 -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 +3 -2
- package/dist/safe-bash-command-patch/patch-publication.js +3 -2
- package/dist/safe-bash-command-patch/patch-text.d.ts +13 -0
- package/dist/safe-bash-command-patch/patch.js +7 -6
- package/dist/safe-bash-command-patch/stored-patch.d.ts +51 -0
- package/dist/safe-bash-command-patch/stored-target.d.ts +41 -0
- package/dist/safe-bash-command-patch/unified.d.ts +28 -9
- package/dist/safe-bash-command-patch/unified.js +4 -1
- package/dist/safe-bash-command-pdftk/index.js +758 -433
- 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.d.ts +1 -0
- package/dist/safe-bash-presentation-engine/notes.js +21 -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-notes.d.ts +27 -0
- 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 +41 -22
- 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/dist/spreadsheet-format-xls/biff-property-values.d.ts +31 -0
- package/dist/spreadsheet-format-xls/biff-property-values.js +158 -0
- package/package.json +5 -2
- package/dist/safe-bash/command-chunks/biff-4ALVARRF-7SRX6R6N.js +0 -5192
- package/dist/safe-bash/command-chunks/chunk-63EMPQ7Z.js +0 -115
- 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-M7S4QIXV.js}
RENAMED
|
@@ -1,13 +1,250 @@
|
|
|
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/command-engine.ts
|
|
15
|
+
import { stageRetainedNotes } from "../../safe-bash-presentation-engine/notes.js";
|
|
16
|
+
|
|
17
|
+
// packages/safe-bash-command-pptx/src/retained-pack-manifest.ts
|
|
18
|
+
import { PagedStorage } from "@poe-platform/safe-fs/storage";
|
|
19
|
+
import { resourceContext } from "../../safe-bash-presentation-engine/resource-limits.js";
|
|
20
|
+
import { OfficeError as OfficeError2 } from "../../safe-bash-presentation-engine/errors.js";
|
|
21
|
+
import { asciiKey, partName } from "../../safe-bash-presentation-engine/package-uri.js";
|
|
22
|
+
|
|
23
|
+
// packages/safe-bash-command-pptx/src/command-package-path.ts
|
|
24
|
+
import { OfficeError } from "../../safe-bash-presentation-engine/errors.js";
|
|
25
|
+
function usage(message) {
|
|
26
|
+
throw new OfficeError("invalid-value", message, "usage");
|
|
27
|
+
}
|
|
28
|
+
function scopedPackagePath(manifest, path) {
|
|
29
|
+
if (path === "-") return path;
|
|
30
|
+
if (path.includes("\\") || [...path].some((c) => c.charCodeAt(0) < 32))
|
|
31
|
+
usage("Invalid scoped file path.");
|
|
32
|
+
const prefix = path.startsWith("/") ? "" : manifest === "-" ? "/" : manifest.slice(0, manifest.lastIndexOf("/") + 1);
|
|
33
|
+
const absolute = (prefix + path).startsWith("/");
|
|
34
|
+
const segments = [];
|
|
35
|
+
for (const segment of (prefix + path).split("/")) {
|
|
36
|
+
if (!segment || segment === ".") continue;
|
|
37
|
+
if (segment === "..") {
|
|
38
|
+
if (!segments.length) usage("Scoped path escapes its root.");
|
|
39
|
+
segments.pop();
|
|
40
|
+
} else segments.push(segment);
|
|
41
|
+
}
|
|
42
|
+
return (absolute ? "/" : "") + segments.join("/");
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// packages/safe-bash-command-pptx/src/retained-pack-manifest.ts
|
|
46
|
+
async function openRetainedPackManifest(source3, settings, options2) {
|
|
47
|
+
const context = resourceContext(settings), signal = context.signal ?? new AbortController().signal;
|
|
48
|
+
const working = { ...settings.workingStorage }, cacheBytes = working.cacheBytes ?? 1024 * 1024;
|
|
49
|
+
if (!working.fs || typeof working.directory !== "string" || !working.directory.startsWith("/") || !Number.isSafeInteger(cacheBytes) || cacheBytes < 16384 || cacheBytes % 16384)
|
|
50
|
+
throw new OfficeError2("invalid-value", "Explicit manifest storage and a valid cache budget are required.", "usage");
|
|
51
|
+
const manifestPath = options2.manifest, outputPath = options2.output;
|
|
52
|
+
const pages = new PagedStorage({ fs: working.fs, cwd: working.directory, env: {}, signal }, cacheBytes / 16384);
|
|
53
|
+
const index = new PagedStorage({ fs: working.fs, cwd: working.directory, env: {}, signal }, cacheBytes / 16384);
|
|
54
|
+
let closed = false, closing, count = 0, parts = 0;
|
|
55
|
+
const check = () => {
|
|
56
|
+
if (closed) throw new OfficeError2("invalid-handle", "Manifest is closed.", "admit");
|
|
57
|
+
if (signal.aborted) throw new OfficeError2("cancelled", "Operation cancelled.", "admit");
|
|
58
|
+
};
|
|
59
|
+
const usage14 = () => {
|
|
60
|
+
throw new OfficeError2("invalid-value", "Manifest requires unique canonical parts, hashes and explicit scoped files.", "usage");
|
|
61
|
+
};
|
|
62
|
+
const limit = () => {
|
|
63
|
+
throw new OfficeError2("resource-limit", "Manifest exceeds input limits.", "admit");
|
|
64
|
+
};
|
|
65
|
+
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");
|
|
66
|
+
const close = () => {
|
|
67
|
+
closed = true;
|
|
68
|
+
return closing ??= (async () => {
|
|
69
|
+
const outcomes = await Promise.allSettled([pages.close(), index.close()]);
|
|
70
|
+
for (const outcome of outcomes) if (outcome.status === "rejected") throw outcome.reason;
|
|
71
|
+
})();
|
|
72
|
+
};
|
|
73
|
+
let work = 0;
|
|
74
|
+
const cooperate = async (units = 1) => {
|
|
75
|
+
check();
|
|
76
|
+
work += units;
|
|
77
|
+
if (work >= 4096) {
|
|
78
|
+
work = 0;
|
|
79
|
+
await yieldEventLoop();
|
|
80
|
+
check();
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
const tree = new BackedJson(pages, cooperate), names = new ZipDirectoryIndex(index, { signal });
|
|
84
|
+
async function text2(position) {
|
|
85
|
+
let value = "";
|
|
86
|
+
for await (const fragment of tree.scalarChunks(position)) {
|
|
87
|
+
check();
|
|
88
|
+
value += fragment;
|
|
89
|
+
}
|
|
90
|
+
return value;
|
|
91
|
+
}
|
|
92
|
+
async function fields2(position, keys) {
|
|
93
|
+
const header = await tree.describe(position);
|
|
94
|
+
if (header.kind !== "object" || header.children !== keys.length * 2) usage14();
|
|
95
|
+
const result = {};
|
|
96
|
+
let key;
|
|
97
|
+
for await (const child of tree.children(position)) {
|
|
98
|
+
check();
|
|
99
|
+
if (key === void 0) {
|
|
100
|
+
key = await tree.smallText(child, Math.max(...keys.map((key2) => key2.length)));
|
|
101
|
+
if (key === void 0 || !keys.includes(key)) usage14();
|
|
102
|
+
} else {
|
|
103
|
+
result[key] = child;
|
|
104
|
+
key = void 0;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return result;
|
|
108
|
+
}
|
|
109
|
+
async function member(row) {
|
|
110
|
+
const fields3 = { part: await tree.property(row, "part"), sha256: await tree.property(row, "sha256") };
|
|
111
|
+
const part = await tree.smallText(fields3.part, 65535), sha2565 = await tree.smallText(fields3.sha256, 64);
|
|
112
|
+
if (part === void 0) return limit();
|
|
113
|
+
if (sha2565 === void 0) return usage14();
|
|
114
|
+
return { part, sha256: sha2565 };
|
|
115
|
+
}
|
|
116
|
+
async function pathAt(row) {
|
|
117
|
+
const file = await tree.property(row, "file"), path = await tree.property(file, "vfsPath");
|
|
118
|
+
return scopedPackagePath(manifestPath, await text2(path));
|
|
119
|
+
}
|
|
120
|
+
async function* decoded() {
|
|
121
|
+
let iterator, exhausted = false, size = 0;
|
|
122
|
+
const decoder = new TextDecoder("utf-8", { fatal: true });
|
|
123
|
+
try {
|
|
124
|
+
iterator = source3[Symbol.asyncIterator]();
|
|
125
|
+
for (let reads = 0; reads < context.limits.maxReads; reads++) {
|
|
126
|
+
await cooperate();
|
|
127
|
+
const item = await iterator.next();
|
|
128
|
+
check();
|
|
129
|
+
if (item.done) {
|
|
130
|
+
exhausted = true;
|
|
131
|
+
let tail;
|
|
132
|
+
try {
|
|
133
|
+
tail = decoder.decode();
|
|
134
|
+
} catch {
|
|
135
|
+
usage14();
|
|
136
|
+
}
|
|
137
|
+
if (tail) yield tail;
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
if (!(item.value instanceof Uint8Array)) throw new OfficeError2("invalid-type", "Manifest source returned invalid bytes.", "admit");
|
|
141
|
+
size += item.value.length;
|
|
142
|
+
if (!Number.isSafeInteger(size) || size > Math.min(context.limits.maxBytes, context.xmlLimits.maxBytes)) limit();
|
|
143
|
+
for (let offset = 0; offset < item.value.length; offset += 16384) {
|
|
144
|
+
check();
|
|
145
|
+
let fragment;
|
|
146
|
+
try {
|
|
147
|
+
fragment = decoder.decode(item.value.subarray(offset, offset + 16384), { stream: true });
|
|
148
|
+
} catch {
|
|
149
|
+
usage14();
|
|
150
|
+
}
|
|
151
|
+
if (fragment) yield fragment;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
limit();
|
|
155
|
+
} finally {
|
|
156
|
+
if (!exhausted) try {
|
|
157
|
+
await iterator?.return?.();
|
|
158
|
+
} catch {
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
try {
|
|
163
|
+
check();
|
|
164
|
+
await parseBackedJson(decoded(), tree, index, cooperate, usage14, void 0, false, (depth) => {
|
|
165
|
+
if (depth > 32) usage14();
|
|
166
|
+
});
|
|
167
|
+
parts = (await fields2(tree.rootPosition, ["parts"])).parts;
|
|
168
|
+
const array = await tree.describe(parts);
|
|
169
|
+
if (array.kind !== "array" || !array.children) usage14();
|
|
170
|
+
count = array.children;
|
|
171
|
+
if (count > context.archiveLimits.maxMembers) limit();
|
|
172
|
+
let stdin = manifestPath === "-" ? 1 : 0;
|
|
173
|
+
if (outputPath !== "-" && outputPath === manifestPath) usage14();
|
|
174
|
+
for await (const row of tree.children(parts)) {
|
|
175
|
+
check();
|
|
176
|
+
const values3 = await fields2(row, ["part", "sha256", "file"]);
|
|
177
|
+
for (const key2 of ["part", "sha256"]) if ((await tree.describe(values3[key2])).kind !== "string") usage14();
|
|
178
|
+
const item = await member(row);
|
|
179
|
+
try {
|
|
180
|
+
if (partName(item.part, false) !== item.part) usage14();
|
|
181
|
+
} catch {
|
|
182
|
+
usage14();
|
|
183
|
+
}
|
|
184
|
+
if (item.sha256.length !== 64 || [...item.sha256].some((character) => !"0123456789abcdef".includes(character))) usage14();
|
|
185
|
+
const key = asciiKey(item.part);
|
|
186
|
+
if (await names.get(key) !== void 0) usage14();
|
|
187
|
+
await names.set(key, row);
|
|
188
|
+
const file = await fields2(values3.file, ["vfsPath"]);
|
|
189
|
+
if ((await tree.describe(file.vfsPath)).kind !== "string") usage14();
|
|
190
|
+
const rawPath = await text2(file.vfsPath);
|
|
191
|
+
if (!rawPath.length) usage14();
|
|
192
|
+
const path = scopedPackagePath(manifestPath, rawPath);
|
|
193
|
+
if (path === "-" && ++stdin > 1 || outputPath !== "-" && path === outputPath) usage14();
|
|
194
|
+
}
|
|
195
|
+
return Object.freeze({
|
|
196
|
+
count,
|
|
197
|
+
close,
|
|
198
|
+
async *members() {
|
|
199
|
+
try {
|
|
200
|
+
check();
|
|
201
|
+
for await (const row of tree.children(parts)) {
|
|
202
|
+
check();
|
|
203
|
+
yield await member(row);
|
|
204
|
+
}
|
|
205
|
+
check();
|
|
206
|
+
} catch (error) {
|
|
207
|
+
throw failure(error);
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
async path(part) {
|
|
211
|
+
try {
|
|
212
|
+
check();
|
|
213
|
+
const row = await names.get(asciiKey(part));
|
|
214
|
+
if (row === void 0) throw new OfficeError2("missing-binding", "Manifest member is absent.", "admit");
|
|
215
|
+
return await pathAt(row);
|
|
216
|
+
} catch (error) {
|
|
217
|
+
throw failure(error);
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
async *paths() {
|
|
221
|
+
try {
|
|
222
|
+
check();
|
|
223
|
+
yield manifestPath;
|
|
224
|
+
for await (const row of tree.children(parts)) {
|
|
225
|
+
check();
|
|
226
|
+
yield await pathAt(row);
|
|
227
|
+
}
|
|
228
|
+
check();
|
|
229
|
+
} catch (error) {
|
|
230
|
+
throw failure(error);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
} catch (error) {
|
|
235
|
+
const primary = failure(error);
|
|
236
|
+
await close().catch(() => {
|
|
237
|
+
});
|
|
238
|
+
throw primary;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
// packages/safe-bash-command-pptx/src/command-engine.ts
|
|
243
|
+
import { stageRetainedPackage } from "../../safe-bash-presentation-engine/package-tools.js";
|
|
244
|
+
|
|
8
245
|
// packages/safe-bash-command-pptx/src/command-extract-streaming.ts
|
|
9
246
|
import { openRetainedPackageExtraction, stageRetainedExtractionOutput } from "../../safe-bash-presentation-engine/package-tools.js";
|
|
10
|
-
import { OfficeError } from "../../safe-bash-presentation-engine/errors.js";
|
|
247
|
+
import { OfficeError as OfficeError3 } from "../../safe-bash-presentation-engine/errors.js";
|
|
11
248
|
async function prepareRetainedExtraction(args, request, options2) {
|
|
12
249
|
const { streaming, signal } = request, context = { ...options2.context, signal, workingStorage: streaming.workingStorage };
|
|
13
250
|
const input = await streaming.openInput(args.input, Math.min(context.limits.maxBytes, context.archiveLimits.maxArchiveBytes));
|
|
@@ -21,7 +258,7 @@ async function prepareRetainedExtraction(args, request, options2) {
|
|
|
21
258
|
let total = 0;
|
|
22
259
|
for await (const member of extraction.members()) total += member.size;
|
|
23
260
|
if (extraction.count > (args.limits?.maxOutputs ?? context.archiveLimits.maxMembers) || !Number.isSafeInteger(total) || total > options2.maxOutputBytes)
|
|
24
|
-
throw new
|
|
261
|
+
throw new OfficeError3("resource-limit", "Package extraction exceeds output limits.", "validate-intent");
|
|
25
262
|
if (!request.publishOutputStreams && (!args.allowPartialOutput || !request.publishOutput)) throw Object.assign(new Error("Extraction requires a publication capability."), { code: "publication-unsupported" });
|
|
26
263
|
response = await stageRetainedExtractionOutput(extraction, context, { directory: args.outputDir, json: args.json, maxOutputBytes: options2.maxOutputBytes, allowPartialOutput: args.allowPartialOutput ?? false });
|
|
27
264
|
async function* publications(dryRun) {
|
|
@@ -63,7 +300,7 @@ import { openPackageArchive } from "../../safe-bash-presentation-engine/retained
|
|
|
63
300
|
|
|
64
301
|
// packages/safe-bash-command-pptx/src/capabilities-discovery.ts
|
|
65
302
|
import { parseContentTypes } from "../../safe-bash-presentation-engine/content-types.js";
|
|
66
|
-
import { OfficeError as
|
|
303
|
+
import { OfficeError as OfficeError4 } from "../../safe-bash-presentation-engine/errors.js";
|
|
67
304
|
import { readRelationshipGraph } from "../../safe-bash-presentation-engine/relationships.js";
|
|
68
305
|
import { readPackage } from "../../safe-bash-presentation-engine/package-reader.js";
|
|
69
306
|
import { parseXmlPart } from "../../safe-bash-presentation-engine/xml.js";
|
|
@@ -100,7 +337,7 @@ function declaredFeatureCapabilities(features, operations) {
|
|
|
100
337
|
Object.entries(features).map(([name, feature]) => {
|
|
101
338
|
const paths = feature.operations ?? (feature.operation ? [feature.operation] : featureOperations[name]);
|
|
102
339
|
if (!paths?.length || paths.some((path) => !Object.hasOwn(operations, path))) {
|
|
103
|
-
throw new
|
|
340
|
+
throw new OfficeError4(
|
|
104
341
|
"invalid-value",
|
|
105
342
|
"Capability references an undeclared operation.",
|
|
106
343
|
"usage"
|
|
@@ -150,7 +387,7 @@ async function assessCapabilities(input, context) {
|
|
|
150
387
|
try {
|
|
151
388
|
contentType = types.get(part);
|
|
152
389
|
} catch (error) {
|
|
153
|
-
if (!(error instanceof
|
|
390
|
+
if (!(error instanceof OfficeError4) || error.code !== "missing-binding") throw error;
|
|
154
391
|
}
|
|
155
392
|
}
|
|
156
393
|
const type = contentType?.split(";", 1)[0].trim().toLowerCase();
|
|
@@ -165,7 +402,7 @@ async function assessCapabilities(input, context) {
|
|
|
165
402
|
const data = reader.get(part);
|
|
166
403
|
xmlBytes += data.length;
|
|
167
404
|
if (xmlBytes > context.xmlLimits.maxBytes || nodes >= context.xmlLimits.maxNodes)
|
|
168
|
-
throw new
|
|
405
|
+
throw new OfficeError4(
|
|
169
406
|
"resource-limit",
|
|
170
407
|
"Capability XML inspection limit exceeded.",
|
|
171
408
|
"index"
|
|
@@ -176,7 +413,7 @@ async function assessCapabilities(input, context) {
|
|
|
176
413
|
});
|
|
177
414
|
nodes += xml.nodeCount;
|
|
178
415
|
if (nodes > context.xmlLimits.maxNodes)
|
|
179
|
-
throw new
|
|
416
|
+
throw new OfficeError4("resource-limit", "Capability XML node limit exceeded.", "index");
|
|
180
417
|
const pending = [xml.root];
|
|
181
418
|
let visited = 0;
|
|
182
419
|
while (pending.length) {
|
|
@@ -3515,7 +3752,7 @@ var discoverySchemas = Object.fromEntries([
|
|
|
3515
3752
|
}]));
|
|
3516
3753
|
|
|
3517
3754
|
// packages/safe-bash-command-pptx/src/command-objects-add.ts
|
|
3518
|
-
import { OfficeError as
|
|
3755
|
+
import { OfficeError as OfficeError5 } from "../../safe-bash-presentation-engine/errors.js";
|
|
3519
3756
|
import { addOleObject } from "../../safe-bash-presentation-engine/ole-insertion.js";
|
|
3520
3757
|
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
3758
|
var length = {
|
|
@@ -3622,24 +3859,24 @@ var objectsAddSchema = {
|
|
|
3622
3859
|
}
|
|
3623
3860
|
}
|
|
3624
3861
|
};
|
|
3625
|
-
function
|
|
3626
|
-
throw new
|
|
3862
|
+
function usage2(message) {
|
|
3863
|
+
throw new OfficeError5("invalid-value", message, "usage");
|
|
3627
3864
|
}
|
|
3628
3865
|
function validateObjectsAddCommand(args, positionals, seen) {
|
|
3629
3866
|
const allowed = Object.keys(objectsAddSchema.options.properties).map(
|
|
3630
3867
|
(key) => "--" + [...key].map((c) => c >= "A" && c <= "Z" ? "-" + c.toLowerCase() : c).join("")
|
|
3631
3868
|
);
|
|
3632
3869
|
if ([...seen].some((flag) => !allowed.includes(flag)))
|
|
3633
|
-
|
|
3870
|
+
usage2("Option does not apply to object insertion.");
|
|
3634
3871
|
if (positionals.length !== 1 || !positionals[0])
|
|
3635
|
-
|
|
3872
|
+
usage2("Object insertion requires exactly one input.");
|
|
3636
3873
|
args.input = positionals[0];
|
|
3637
3874
|
if (seen.has("--program-id") && seen.has("--program"))
|
|
3638
|
-
|
|
3875
|
+
usage2("Program and program ID are mutually exclusive.");
|
|
3639
3876
|
if (!args.slide || !args.file || !args.icon || !args.objectAdd?.progId)
|
|
3640
|
-
|
|
3877
|
+
usage2("Object insertion requires slide, file, icon and program ID.");
|
|
3641
3878
|
if ([args.input, args.file, args.icon].filter((path) => path === "-").length > 1)
|
|
3642
|
-
|
|
3879
|
+
usage2("Only one input may consume stdin.");
|
|
3643
3880
|
if (!args.iconContentType) {
|
|
3644
3881
|
const extension = args.icon.slice(args.icon.lastIndexOf(".") + 1).toLowerCase();
|
|
3645
3882
|
const type = {
|
|
@@ -3652,16 +3889,16 @@ function validateObjectsAddCommand(args, positionals, seen) {
|
|
|
3652
3889
|
tiff: "image/tiff",
|
|
3653
3890
|
wmf: "image/x-wmf"
|
|
3654
3891
|
};
|
|
3655
|
-
if (!type[extension])
|
|
3892
|
+
if (!type[extension]) usage2("Icon requires a supported extension or explicit content type.");
|
|
3656
3893
|
args.iconContentType = type[extension];
|
|
3657
3894
|
}
|
|
3658
3895
|
if (args.inPlace && (args.input === "-" || args.output))
|
|
3659
|
-
|
|
3660
|
-
if (!args.dryRun && !args.inPlace && !args.output)
|
|
3661
|
-
if (args.force && !args.output)
|
|
3896
|
+
usage2("In-place requires a named input and no output flag.");
|
|
3897
|
+
if (!args.dryRun && !args.inPlace && !args.output) usage2("Mutation requires a destination.");
|
|
3898
|
+
if (args.force && !args.output) usage2("Force requires an explicit output.");
|
|
3662
3899
|
if (args.output === args.input && args.output !== "-")
|
|
3663
|
-
|
|
3664
|
-
if (args.output === "-" && args.json && !args.dryRun)
|
|
3900
|
+
usage2("Replacing input requires --in-place.");
|
|
3901
|
+
if (args.output === "-" && args.json && !args.dryRun) usage2("Binary stdout conflicts with JSON.");
|
|
3665
3902
|
}
|
|
3666
3903
|
async function executeObjectsAddCommand(args, request, options2) {
|
|
3667
3904
|
const context = { ...options2.context, signal: request.signal };
|
|
@@ -3853,7 +4090,7 @@ var packageToolsSchemas = Object.fromEntries(
|
|
|
3853
4090
|
);
|
|
3854
4091
|
|
|
3855
4092
|
// packages/safe-bash-command-pptx/src/command-engine-values.ts
|
|
3856
|
-
import { OfficeError as
|
|
4093
|
+
import { OfficeError as OfficeError6 } from "../../safe-bash-presentation-engine/errors.js";
|
|
3857
4094
|
function commandLength(value, minimum = 1) {
|
|
3858
4095
|
const units = { emu: 1, in: 914400, cm: 36e4, mm: 36e3, pt: 12700 };
|
|
3859
4096
|
const unit = Object.keys(units).find((candidate) => value.endsWith(candidate));
|
|
@@ -3862,7 +4099,7 @@ function commandLength(value, minimum = 1) {
|
|
|
3862
4099
|
if (!unit || pieces.length > 2 || !pieces[0] || pieces.some(
|
|
3863
4100
|
(piece) => !piece || [...piece].some((character) => character < "0" || character > "9")
|
|
3864
4101
|
))
|
|
3865
|
-
throw new
|
|
4102
|
+
throw new OfficeError6(
|
|
3866
4103
|
"invalid-value",
|
|
3867
4104
|
"Lengths require a decimal and emu, in, cm, mm or pt unit.",
|
|
3868
4105
|
"usage"
|
|
@@ -3870,13 +4107,13 @@ function commandLength(value, minimum = 1) {
|
|
|
3870
4107
|
const raw = Number(digits) * units[unit];
|
|
3871
4108
|
const result = Math.sign(raw) * Math.round(Math.abs(raw));
|
|
3872
4109
|
if (!Number.isFinite(raw) || Math.abs(raw) > Number.MAX_SAFE_INTEGER || !Number.isSafeInteger(result) || result < minimum)
|
|
3873
|
-
throw new
|
|
4110
|
+
throw new OfficeError6("invalid-value", "Length is outside the supported range.", "usage");
|
|
3874
4111
|
return result;
|
|
3875
4112
|
}
|
|
3876
4113
|
function commandTimestamp(value) {
|
|
3877
4114
|
const date = new Date(value);
|
|
3878
4115
|
if (!Number.isFinite(date.getTime()) || !value.endsWith("Z") || date.toISOString() !== value && date.toISOString() !== value.slice(0, -1) + ".000Z")
|
|
3879
|
-
throw new
|
|
4116
|
+
throw new OfficeError6(
|
|
3880
4117
|
"invalid-value",
|
|
3881
4118
|
"Timestamp requires a valid UTC date with seconds and Z suffix.",
|
|
3882
4119
|
"usage"
|
|
@@ -3910,7 +4147,7 @@ function commandJson(value) {
|
|
|
3910
4147
|
}
|
|
3911
4148
|
return JSON.parse(value);
|
|
3912
4149
|
} catch {
|
|
3913
|
-
throw new
|
|
4150
|
+
throw new OfficeError6(
|
|
3914
4151
|
"invalid-value",
|
|
3915
4152
|
"Structured slides require valid JSON without duplicate keys, at most 32 levels deep.",
|
|
3916
4153
|
"usage"
|
|
@@ -3920,31 +4157,15 @@ function commandJson(value) {
|
|
|
3920
4157
|
|
|
3921
4158
|
// packages/safe-bash-command-pptx/src/command-package-tools.ts
|
|
3922
4159
|
import { sha256 } from "@noble/hashes/sha2.js";
|
|
3923
|
-
import { OfficeError as
|
|
3924
|
-
import { asciiKey, partName } from "../../safe-bash-presentation-engine/package-uri.js";
|
|
4160
|
+
import { OfficeError as OfficeError7 } from "../../safe-bash-presentation-engine/errors.js";
|
|
4161
|
+
import { asciiKey as asciiKey2, partName as partName2 } from "../../safe-bash-presentation-engine/package-uri.js";
|
|
3925
4162
|
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("/");
|
|
4163
|
+
function usage3(message) {
|
|
4164
|
+
throw new OfficeError7("invalid-value", message, "usage");
|
|
3944
4165
|
}
|
|
3945
4166
|
function canonical(part) {
|
|
3946
4167
|
try {
|
|
3947
|
-
return typeof part === "string" &&
|
|
4168
|
+
return typeof part === "string" && partName2(part, false) === part;
|
|
3948
4169
|
} catch {
|
|
3949
4170
|
return false;
|
|
3950
4171
|
}
|
|
@@ -3954,23 +4175,23 @@ function validatePackageCommand(args, positionals, seen) {
|
|
|
3954
4175
|
(key) => "--" + [...key].map((c) => c >= "A" && c <= "Z" ? "-" + c.toLowerCase() : c).join("")
|
|
3955
4176
|
);
|
|
3956
4177
|
if ([...seen].some((flag) => !allowed.includes(flag)))
|
|
3957
|
-
|
|
4178
|
+
usage3("Option does not apply to package tools.");
|
|
3958
4179
|
if (args.operation === "extract") {
|
|
3959
|
-
if (positionals.length !== 1 || !positionals[0])
|
|
4180
|
+
if (positionals.length !== 1 || !positionals[0]) usage3("Extraction requires one input.");
|
|
3960
4181
|
args.input = positionals[0];
|
|
3961
4182
|
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
|
-
|
|
4183
|
+
usage3("Extraction requires an output directory.");
|
|
4184
|
+
if (args.parts && (!args.parts.length || args.parts.some((part) => !canonical(part)) || new Set(args.parts.map(asciiKey2)).size !== args.parts.length))
|
|
4185
|
+
usage3("Parts require unique canonical part URIs.");
|
|
3965
4186
|
} else {
|
|
3966
4187
|
if (positionals.length || !args.manifest)
|
|
3967
|
-
|
|
3968
|
-
if (!args.output && !args.dryRun)
|
|
3969
|
-
if (args.force && !args.output)
|
|
4188
|
+
usage3("Pack requires a manifest and no positional inputs.");
|
|
4189
|
+
if (!args.output && !args.dryRun) usage3("Pack requires output or dry-run.");
|
|
4190
|
+
if (args.force && !args.output) usage3("Force requires output.");
|
|
3970
4191
|
if (args.output === "-" && args.json && !args.dryRun)
|
|
3971
|
-
|
|
4192
|
+
usage3("Binary stdout cannot be combined with JSON.");
|
|
3972
4193
|
if (args.output === args.manifest && args.output !== "-")
|
|
3973
|
-
|
|
4194
|
+
usage3("Output cannot replace manifest.");
|
|
3974
4195
|
}
|
|
3975
4196
|
}
|
|
3976
4197
|
async function executePackageCommand(args, request, options2) {
|
|
@@ -3991,7 +4212,7 @@ async function executePackageCommand(args, request, options2) {
|
|
|
3991
4212
|
);
|
|
3992
4213
|
const files = await extractPackage(bytes2, context, args.parts ? { parts: args.parts } : {});
|
|
3993
4214
|
if (files.length > (args.limits?.maxOutputs ?? context.archiveLimits.maxMembers) || files.reduce((sum, file) => sum + file.bytes.length, 0) > options2.maxOutputBytes)
|
|
3994
|
-
throw new
|
|
4215
|
+
throw new OfficeError7(
|
|
3995
4216
|
"resource-limit",
|
|
3996
4217
|
"Package extraction exceeds output limits.",
|
|
3997
4218
|
"validate-intent"
|
|
@@ -4023,7 +4244,7 @@ async function executePackageCommand(args, request, options2) {
|
|
|
4023
4244
|
};
|
|
4024
4245
|
}
|
|
4025
4246
|
if (args.creation?.author !== void 0 || args.creation?.timestamp !== void 0)
|
|
4026
|
-
throw new
|
|
4247
|
+
throw new OfficeError7(
|
|
4027
4248
|
"unsupported-edit",
|
|
4028
4249
|
"Pack metadata overrides are unavailable; source properties are preserved.",
|
|
4029
4250
|
"validate-intent"
|
|
@@ -4033,28 +4254,28 @@ async function executePackageCommand(args, request, options2) {
|
|
|
4033
4254
|
Math.min(context.limits.maxBytes, context.xmlLimits.maxBytes)
|
|
4034
4255
|
);
|
|
4035
4256
|
if (encoded.length > Math.min(context.limits.maxBytes, context.xmlLimits.maxBytes))
|
|
4036
|
-
throw new
|
|
4257
|
+
throw new OfficeError7("resource-limit", "Manifest exceeds byte limit.", "admit");
|
|
4037
4258
|
let value;
|
|
4038
4259
|
try {
|
|
4039
4260
|
value = commandJson(new TextDecoder("utf-8", { fatal: true }).decode(encoded));
|
|
4040
4261
|
} catch {
|
|
4041
|
-
|
|
4262
|
+
usage3("Manifest must be valid JSON.");
|
|
4042
4263
|
}
|
|
4043
4264
|
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
|
-
|
|
4265
|
+
usage3("Manifest requires a nonempty parts array.");
|
|
4045
4266
|
if (value.parts.length > context.archiveLimits.maxMembers)
|
|
4046
|
-
throw new
|
|
4267
|
+
throw new OfficeError7("resource-limit", "Manifest exceeds member limit.", "admit");
|
|
4047
4268
|
const parts = value.parts;
|
|
4048
4269
|
for (const item of parts)
|
|
4049
4270
|
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) =>
|
|
4271
|
+
usage3("Manifest parts require canonical URIs, hashes and explicit scoped files.");
|
|
4272
|
+
if (new Set(parts.map((item) => asciiKey2(item.part))).size !== parts.length)
|
|
4273
|
+
usage3("Manifest parts must be unique.");
|
|
4274
|
+
const paths = parts.map((item) => scopedPackagePath(args.manifest, item.file.vfsPath));
|
|
4054
4275
|
if ([args.manifest, ...paths].filter((path) => path === "-").length > 1)
|
|
4055
|
-
|
|
4276
|
+
usage3("Only one manifest input may consume stdin.");
|
|
4056
4277
|
if (args.output !== "-" && paths.includes(args.output))
|
|
4057
|
-
|
|
4278
|
+
usage3("Output cannot replace a source file.");
|
|
4058
4279
|
let total = 0;
|
|
4059
4280
|
const members = [];
|
|
4060
4281
|
for (const [index, item] of parts.entries()) {
|
|
@@ -4065,7 +4286,7 @@ async function executePackageCommand(args, request, options2) {
|
|
|
4065
4286
|
);
|
|
4066
4287
|
total += bytes2.length;
|
|
4067
4288
|
if (bytes2.length > context.archiveLimits.maxEntryBytes || total > context.archiveLimits.maxTotalBytes)
|
|
4068
|
-
throw new
|
|
4289
|
+
throw new OfficeError7("resource-limit", "Manifest contents exceed byte limit.", "admit");
|
|
4069
4290
|
members.push({ part: item.part, sha256: item.sha256, bytes: bytes2 });
|
|
4070
4291
|
}
|
|
4071
4292
|
const bytes = await packPackage(
|
|
@@ -4074,7 +4295,7 @@ async function executePackageCommand(args, request, options2) {
|
|
|
4074
4295
|
args.creation?.kind ? { kind: args.creation.kind } : {}
|
|
4075
4296
|
);
|
|
4076
4297
|
if (bytes.length > options2.maxOutputBytes)
|
|
4077
|
-
throw new
|
|
4298
|
+
throw new OfficeError7("resource-limit", "Packed output exceeds byte limit.", "validate-intent");
|
|
4078
4299
|
const dryRun = args.dryRun ?? false;
|
|
4079
4300
|
const fingerprint = [...sha256(bytes)].map((byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
4080
4301
|
if (args.output && args.output !== "-" && !request.publishOutput)
|
|
@@ -4110,7 +4331,7 @@ async function executePackageCommand(args, request, options2) {
|
|
|
4110
4331
|
}
|
|
4111
4332
|
|
|
4112
4333
|
// packages/safe-bash-command-pptx/src/command-diff.ts
|
|
4113
|
-
import { OfficeError as
|
|
4334
|
+
import { OfficeError as OfficeError8 } from "../../safe-bash-presentation-engine/errors.js";
|
|
4114
4335
|
import { comparePresentations } from "../../safe-bash-presentation-engine/diff.js";
|
|
4115
4336
|
|
|
4116
4337
|
// packages/safe-bash-command-pptx/src/diff-schema.ts
|
|
@@ -4216,7 +4437,7 @@ async function executeDiffCommand(request, options2) {
|
|
|
4216
4437
|
let human = "";
|
|
4217
4438
|
let exitCode = 0;
|
|
4218
4439
|
const failure = (error) => {
|
|
4219
|
-
const office = error instanceof
|
|
4440
|
+
const office = error instanceof OfficeError8 ? error : void 0;
|
|
4220
4441
|
const code = request.signal.aborted ? "cancelled" : office?.code ?? (error && typeof error === "object" && "code" in error && error.code === "resource-limit" ? "resource-limit" : "io-failure");
|
|
4221
4442
|
exitCode = code === "cancelled" ? 130 : 2;
|
|
4222
4443
|
const message = office?.message ?? (code === "cancelled" ? "Comparison cancelled." : "Comparison input could not be read.");
|
|
@@ -4233,20 +4454,20 @@ async function executeDiffCommand(request, options2) {
|
|
|
4233
4454
|
errors: [{ code, message, context: { phase: office?.phase ?? "admit" } }]
|
|
4234
4455
|
};
|
|
4235
4456
|
};
|
|
4236
|
-
const
|
|
4237
|
-
throw new
|
|
4457
|
+
const usage14 = (message) => {
|
|
4458
|
+
throw new OfficeError8("invalid-value", message, "usage");
|
|
4238
4459
|
};
|
|
4239
4460
|
try {
|
|
4240
4461
|
let byteCount = 0;
|
|
4241
4462
|
const args = request.args.map((bytes2) => {
|
|
4242
|
-
if (!(bytes2 instanceof Uint8Array))
|
|
4463
|
+
if (!(bytes2 instanceof Uint8Array)) usage14("Arguments must be byte arrays.");
|
|
4243
4464
|
byteCount += bytes2.byteLength;
|
|
4244
4465
|
if (byteCount > options2.maxArgumentBytes)
|
|
4245
|
-
throw new
|
|
4466
|
+
throw new OfficeError8("resource-limit", "Argument limit exceeded.", "admit");
|
|
4246
4467
|
try {
|
|
4247
4468
|
return new TextDecoder("utf-8", { fatal: true }).decode(bytes2);
|
|
4248
4469
|
} catch {
|
|
4249
|
-
return
|
|
4470
|
+
return usage14("Arguments must be UTF-8.");
|
|
4250
4471
|
}
|
|
4251
4472
|
});
|
|
4252
4473
|
const delimiter = args.indexOf("--");
|
|
@@ -4265,31 +4486,31 @@ async function executeDiffCommand(request, options2) {
|
|
|
4265
4486
|
}
|
|
4266
4487
|
if (!positionalOnly && arg.startsWith("-") && arg !== "-") {
|
|
4267
4488
|
if (!["--json", "--mode", "--limit", "--help"].includes(arg))
|
|
4268
|
-
|
|
4269
|
-
if (seen.has(arg) && arg !== "--limit")
|
|
4489
|
+
usage14("Unknown comparison option.");
|
|
4490
|
+
if (seen.has(arg) && arg !== "--limit") usage14("Duplicate comparison option.");
|
|
4270
4491
|
seen.add(arg);
|
|
4271
4492
|
if (arg === "--json" || arg === "--help") continue;
|
|
4272
4493
|
const value = args[++i];
|
|
4273
|
-
if (!value)
|
|
4494
|
+
if (!value) usage14("Comparison option requires a value.");
|
|
4274
4495
|
if (arg === "--mode") {
|
|
4275
|
-
if (!diffModes.includes(value))
|
|
4496
|
+
if (!diffModes.includes(value)) usage14("Unsupported comparison mode.");
|
|
4276
4497
|
mode = value;
|
|
4277
4498
|
} else {
|
|
4278
4499
|
const parts = value.split("=");
|
|
4279
4500
|
const name = parts[0];
|
|
4280
4501
|
const number = Number(parts[1]);
|
|
4281
4502
|
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
|
-
|
|
4503
|
+
usage14("Invalid comparison limit.");
|
|
4283
4504
|
limits[name] = number;
|
|
4284
4505
|
}
|
|
4285
4506
|
} else {
|
|
4286
|
-
if (!arg || arg.includes("\0"))
|
|
4507
|
+
if (!arg || arg.includes("\0")) usage14("Invalid comparison input.");
|
|
4287
4508
|
positionals.push(arg);
|
|
4288
4509
|
}
|
|
4289
4510
|
}
|
|
4290
4511
|
if (seen.has("--help")) {
|
|
4291
4512
|
if (positionals.length || [...seen].some((flag) => flag !== "--help" && flag !== "--json"))
|
|
4292
|
-
|
|
4513
|
+
usage14("Comparison help does not accept inputs or options.");
|
|
4293
4514
|
result = {
|
|
4294
4515
|
version: 1,
|
|
4295
4516
|
operation: "help",
|
|
@@ -4303,7 +4524,7 @@ async function executeDiffCommand(request, options2) {
|
|
|
4303
4524
|
human = diffUsage;
|
|
4304
4525
|
} else {
|
|
4305
4526
|
if (positionals.length !== 2 || positionals.every((path) => path === "-"))
|
|
4306
|
-
|
|
4527
|
+
usage14("Comparison requires two inputs and at most one stdin consumer.");
|
|
4307
4528
|
maxOutputBytes = limits.maxOutputBytes ?? maxOutputBytes;
|
|
4308
4529
|
const context = {
|
|
4309
4530
|
...options2.context,
|
|
@@ -4320,7 +4541,7 @@ async function executeDiffCommand(request, options2) {
|
|
|
4320
4541
|
}
|
|
4321
4542
|
};
|
|
4322
4543
|
if (mode === "effective-formatting")
|
|
4323
|
-
throw new
|
|
4544
|
+
throw new OfficeError8(
|
|
4324
4545
|
"unsupported-profile",
|
|
4325
4546
|
"Effective formatting comparison is not supported.",
|
|
4326
4547
|
"usage"
|
|
@@ -4355,7 +4576,7 @@ async function executeDiffCommand(request, options2) {
|
|
|
4355
4576
|
let bytes = encoder.encode(json ? JSON.stringify(result) + "\n" : human);
|
|
4356
4577
|
if (bytes.length > maxOutputBytes) {
|
|
4357
4578
|
result = failure(
|
|
4358
|
-
new
|
|
4579
|
+
new OfficeError8("resource-limit", "Comparison output limit exceeded.", "admit")
|
|
4359
4580
|
);
|
|
4360
4581
|
bytes = encoder.encode(json ? JSON.stringify(result) + "\n" : human);
|
|
4361
4582
|
}
|
|
@@ -4475,7 +4696,7 @@ var templateSchema = {
|
|
|
4475
4696
|
|
|
4476
4697
|
// packages/safe-bash-command-pptx/src/command-template.ts
|
|
4477
4698
|
import { sha256 as sha2562 } from "@noble/hashes/sha2.js";
|
|
4478
|
-
import { OfficeError as
|
|
4699
|
+
import { OfficeError as OfficeError9 } from "../../safe-bash-presentation-engine/errors.js";
|
|
4479
4700
|
import {
|
|
4480
4701
|
applyTemplateBindings,
|
|
4481
4702
|
validateTemplateBindings
|
|
@@ -4488,8 +4709,8 @@ function validateTemplateData(value) {
|
|
|
4488
4709
|
if (Array.isArray(value)) validateTemplateBindings(value);
|
|
4489
4710
|
else validateTemplateRepeat(value);
|
|
4490
4711
|
}
|
|
4491
|
-
function
|
|
4492
|
-
throw new
|
|
4712
|
+
function usage4(message) {
|
|
4713
|
+
throw new OfficeError9("invalid-value", message, "usage");
|
|
4493
4714
|
}
|
|
4494
4715
|
function validateTemplateCommand(args, positionals, seen) {
|
|
4495
4716
|
if ([...seen].some(
|
|
@@ -4504,25 +4725,25 @@ function validateTemplateCommand(args, positionals, seen) {
|
|
|
4504
4725
|
"--dry-run"
|
|
4505
4726
|
].includes(flag)
|
|
4506
4727
|
))
|
|
4507
|
-
|
|
4728
|
+
usage4("Option does not apply to template apply.");
|
|
4508
4729
|
if (positionals.length !== 1 || !positionals[0])
|
|
4509
|
-
|
|
4730
|
+
usage4("Template apply requires exactly one input.");
|
|
4510
4731
|
args.input = positionals[0];
|
|
4511
4732
|
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)
|
|
4733
|
+
usage4("Template apply requires exactly one binding source.");
|
|
4734
|
+
if (args.dataFile === "") usage4("Binding file path must not be empty.");
|
|
4735
|
+
if (args.input === "-" && args.dataFile === "-") usage4("Only one input may consume stdin.");
|
|
4736
|
+
if (args.inPlace && args.input === "-") usage4("Stdin cannot be edited in place.");
|
|
4737
|
+
if (args.inPlace && args.output) usage4("Output and in-place cannot be combined.");
|
|
4738
|
+
if (!args.dryRun && !args.inPlace && !args.output) usage4("Mutation requires a destination.");
|
|
4739
|
+
if (args.force && !args.output) usage4("Force requires an explicit output destination.");
|
|
4519
4740
|
if (args.output === args.input && args.output !== "-")
|
|
4520
|
-
|
|
4741
|
+
usage4("Replacing input requires --in-place.");
|
|
4521
4742
|
const destination = args.inPlace ? args.input : args.output;
|
|
4522
4743
|
if (args.dataFile !== void 0 && args.dataFile !== "-" && destination === args.dataFile)
|
|
4523
|
-
|
|
4744
|
+
usage4("Output cannot replace the binding source.");
|
|
4524
4745
|
if (args.output === "-" && args.json && !args.dryRun)
|
|
4525
|
-
|
|
4746
|
+
usage4("Binary stdout cannot be combined with JSON.");
|
|
4526
4747
|
}
|
|
4527
4748
|
async function executeTemplateCommand(args, request, options2) {
|
|
4528
4749
|
const context = { ...options2.context, signal: request.signal };
|
|
@@ -4536,7 +4757,7 @@ async function executeTemplateCommand(args, request, options2) {
|
|
|
4536
4757
|
try {
|
|
4537
4758
|
json = new TextDecoder("utf-8", { fatal: true }).decode(data);
|
|
4538
4759
|
} catch {
|
|
4539
|
-
|
|
4760
|
+
usage4("Binding data must be UTF-8 JSON.");
|
|
4540
4761
|
}
|
|
4541
4762
|
bindings = commandJson(json);
|
|
4542
4763
|
}
|
|
@@ -4841,40 +5062,40 @@ var commentSchemas = Object.fromEntries(
|
|
|
4841
5062
|
);
|
|
4842
5063
|
|
|
4843
5064
|
// packages/safe-bash-command-pptx/src/command-comments.ts
|
|
4844
|
-
import { OfficeError as
|
|
5065
|
+
import { OfficeError as OfficeError10 } from "../../safe-bash-presentation-engine/errors.js";
|
|
4845
5066
|
import { mutateComments, readComments, readCommentAuthors } from "../../safe-bash-presentation-engine/comments.js";
|
|
4846
5067
|
import { SelectionError } from "../../safe-bash-presentation-engine/selectors.js";
|
|
4847
|
-
function
|
|
4848
|
-
throw new
|
|
5068
|
+
function usage5(message) {
|
|
5069
|
+
throw new OfficeError10("invalid-value", message, "usage");
|
|
4849
5070
|
}
|
|
4850
5071
|
function validateCommentsCommand(args, positionals, seen) {
|
|
4851
5072
|
const allowed = Object.keys(commentSchemas[args.operation].options.properties).map(
|
|
4852
5073
|
(key) => "--" + [...key].map((c) => c >= "A" && c <= "Z" ? "-" + c.toLowerCase() : c).join("")
|
|
4853
5074
|
);
|
|
4854
5075
|
if ([...seen].some((flag) => !allowed.includes(flag)))
|
|
4855
|
-
|
|
4856
|
-
if (positionals.length !== 1 || !positionals[0])
|
|
5076
|
+
usage5("Option does not apply to comments.");
|
|
5077
|
+
if (positionals.length !== 1 || !positionals[0]) usage5("Comments require exactly one input.");
|
|
4857
5078
|
args.input = positionals[0];
|
|
4858
|
-
if (args.scope !== void 0 && args.scope !== "slides")
|
|
5079
|
+
if (args.scope !== void 0 && args.scope !== "slides") usage5("Comments require slides scope.");
|
|
4859
5080
|
if (args.token && ["--slide", "--scope", "--id"].some((flag) => seen.has(flag)))
|
|
4860
|
-
|
|
5081
|
+
usage5("Opaque and simple selectors cannot be combined.");
|
|
4861
5082
|
if (args.operation === "comments.list" || args.operation === "comments.get") return;
|
|
4862
5083
|
if (!args.token && args.slide === void 0 && !args.all)
|
|
4863
5084
|
throw new SelectionError("missing-selection");
|
|
4864
5085
|
if (args.operation === "comments.add" && [args.commentEdit?.text, args.commentEdit?.author, args.commentEdit?.timestamp].some(
|
|
4865
5086
|
(value) => value === void 0
|
|
4866
5087
|
))
|
|
4867
|
-
|
|
5088
|
+
usage5("Comment creation requires text, author and timestamp.");
|
|
4868
5089
|
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)
|
|
5090
|
+
usage5("Comment update requires an edit.");
|
|
5091
|
+
if (args.inPlace && args.input === "-") usage5("Stdin cannot be edited in place.");
|
|
5092
|
+
if (args.inPlace && args.output) usage5("Output and in-place cannot be combined.");
|
|
5093
|
+
if (!args.dryRun && !args.inPlace && !args.output) usage5("Mutation requires a destination.");
|
|
5094
|
+
if (args.force && !args.output) usage5("Force requires an explicit output destination.");
|
|
4874
5095
|
if (args.output === args.input && args.output !== "-")
|
|
4875
|
-
|
|
5096
|
+
usage5("Replacing input requires --in-place.");
|
|
4876
5097
|
if (args.output === "-" && args.json && !args.dryRun)
|
|
4877
|
-
|
|
5098
|
+
usage5("Binary stdout cannot be combined with JSON.");
|
|
4878
5099
|
}
|
|
4879
5100
|
async function executeCommentsCommand(args, request, options2) {
|
|
4880
5101
|
const context = { ...options2.context, signal: request.signal };
|
|
@@ -5347,43 +5568,43 @@ var accessibilitySchemas = Object.fromEntries(
|
|
|
5347
5568
|
);
|
|
5348
5569
|
|
|
5349
5570
|
// packages/safe-bash-command-pptx/src/command-accessibility.ts
|
|
5350
|
-
import { OfficeError as
|
|
5571
|
+
import { OfficeError as OfficeError11 } from "../../safe-bash-presentation-engine/errors.js";
|
|
5351
5572
|
import {
|
|
5352
5573
|
readAccessibility,
|
|
5353
5574
|
mutateAccessibility,
|
|
5354
5575
|
validateAccessibilityUpdate
|
|
5355
5576
|
} from "../../safe-bash-presentation-engine/accessibility.js";
|
|
5356
5577
|
import { SelectionError as SelectionError2 } from "../../safe-bash-presentation-engine/selectors.js";
|
|
5357
|
-
function
|
|
5358
|
-
throw new
|
|
5578
|
+
function usage6(message) {
|
|
5579
|
+
throw new OfficeError11("invalid-value", message, "usage");
|
|
5359
5580
|
}
|
|
5360
5581
|
function validateAccessibilityCommand(args, positionals, seen) {
|
|
5361
5582
|
const allowed = Object.keys(accessibilitySchemas[args.operation].options.properties).map(
|
|
5362
5583
|
(key) => "--" + [...key].map((c) => c >= "A" && c <= "Z" ? "-" + c.toLowerCase() : c).join("")
|
|
5363
5584
|
);
|
|
5364
5585
|
if ([...seen].some((flag) => !allowed.includes(flag)))
|
|
5365
|
-
|
|
5586
|
+
usage6("Option does not apply to accessibility.");
|
|
5366
5587
|
if (positionals.length !== 1 || !positionals[0])
|
|
5367
|
-
|
|
5588
|
+
usage6("Accessibility requires exactly one input.");
|
|
5368
5589
|
args.input = positionals[0];
|
|
5369
5590
|
if (args.scope !== void 0 && !["slides", "layouts", "masters"].includes(args.scope))
|
|
5370
|
-
|
|
5591
|
+
usage6("Unsupported accessibility scope.");
|
|
5371
5592
|
if (args.token && ["--slide", "--shape", "--scope", "--all"].some((flag) => seen.has(flag)))
|
|
5372
|
-
|
|
5593
|
+
usage6("Opaque and simple selectors cannot be combined.");
|
|
5373
5594
|
if (args.shape !== void 0 && args.slide === void 0)
|
|
5374
|
-
|
|
5595
|
+
usage6("Shape selection requires a slide.");
|
|
5375
5596
|
if (args.operation !== "accessibility.set") return;
|
|
5376
5597
|
validateAccessibilityUpdate(args.accessibilityEdit ?? {});
|
|
5377
5598
|
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)
|
|
5599
|
+
usage6("Accessibility mutation requires explicit selection.");
|
|
5600
|
+
if (args.inPlace && args.input === "-") usage6("Stdin cannot be edited in place.");
|
|
5601
|
+
if (args.inPlace && args.output) usage6("Output and in-place cannot be combined.");
|
|
5602
|
+
if (!args.dryRun && !args.inPlace && !args.output) usage6("Mutation requires a destination.");
|
|
5603
|
+
if (args.force && !args.output) usage6("Force requires an output destination.");
|
|
5383
5604
|
if (args.output === args.input && args.output !== "-")
|
|
5384
|
-
|
|
5605
|
+
usage6("Replacing input requires --in-place.");
|
|
5385
5606
|
if (args.output === "-" && args.json && !args.dryRun)
|
|
5386
|
-
|
|
5607
|
+
usage6("Binary stdout cannot be combined with JSON.");
|
|
5387
5608
|
}
|
|
5388
5609
|
async function executeAccessibilityCommand(args, request, options2) {
|
|
5389
5610
|
const context = { ...options2.context, signal: request.signal };
|
|
@@ -5465,13 +5686,13 @@ async function executeAccessibilityCommand(args, request, options2) {
|
|
|
5465
5686
|
}
|
|
5466
5687
|
|
|
5467
5688
|
// packages/safe-bash-command-pptx/src/command-metadata.ts
|
|
5468
|
-
import { OfficeError as
|
|
5689
|
+
import { OfficeError as OfficeError12 } from "../../safe-bash-presentation-engine/errors.js";
|
|
5469
5690
|
import { coreDefinition, mutateProperty, readProperties } from "../../safe-bash-presentation-engine/properties.js";
|
|
5470
5691
|
import { sanitize as sanitizePresentation } from "../../safe-bash-presentation-engine/sanitize.js";
|
|
5471
5692
|
import { mutateTags, readTags } from "../../safe-bash-presentation-engine/tags.js";
|
|
5472
5693
|
import { SelectionError as SelectionError3 } from "../../safe-bash-presentation-engine/selectors.js";
|
|
5473
|
-
function
|
|
5474
|
-
throw new
|
|
5694
|
+
function usage7(message) {
|
|
5695
|
+
throw new OfficeError12("invalid-value", message, "usage");
|
|
5475
5696
|
}
|
|
5476
5697
|
function removalCategories(value) {
|
|
5477
5698
|
const categories = ["notes", "comments", "properties", "links", "objects"];
|
|
@@ -5480,37 +5701,37 @@ function removalCategories(value) {
|
|
|
5480
5701
|
try {
|
|
5481
5702
|
parsed = JSON.parse(value);
|
|
5482
5703
|
} catch {
|
|
5483
|
-
|
|
5704
|
+
usage7("Remove requires a category or a JSON array of categories.");
|
|
5484
5705
|
}
|
|
5485
5706
|
}
|
|
5486
5707
|
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)
|
|
5708
|
+
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
5709
|
return values3;
|
|
5489
5710
|
}
|
|
5490
5711
|
function validateMetadataCommand(args, positionals, seen) {
|
|
5491
5712
|
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])
|
|
5713
|
+
if ([...seen].some((flag) => !allowed.includes(flag))) usage7("Option does not apply to this metadata operation.");
|
|
5714
|
+
if (positionals.length !== 1 || !positionals[0]) usage7("Metadata operations require exactly one input.");
|
|
5494
5715
|
args.input = positionals[0];
|
|
5495
5716
|
const tags = args.operation.startsWith("tags."), sanitize = args.operation === "sanitize";
|
|
5496
5717
|
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))
|
|
5718
|
+
if (args.scope !== void 0 && !(tags ? ["slides", "presentation"] : ["presentation"]).includes(args.scope)) usage7("Unsupported metadata scope.");
|
|
5719
|
+
if (args.token && ["--slide", "--scope", "--all"].some((flag) => seen.has(flag))) usage7("Opaque and simple selectors cannot be combined.");
|
|
5720
|
+
if (args.scope === "presentation" && args.slide !== void 0) usage7("Presentation scope rejects slide selection.");
|
|
5721
|
+
if (!tags && !sanitize && action !== "list" && !args.metadataName) usage7("Property name is required.");
|
|
5722
|
+
if (args.metadataName === "") usage7("Metadata names cannot be empty.");
|
|
5723
|
+
if (action === "add" && (!args.metadataName || args.metadataValue === void 0)) usage7("New tags require name and value.");
|
|
5724
|
+
if (action === "set" && (tags ? args.metadataName === void 0 && args.metadataValue === void 0 : args.metadataValue === void 0)) usage7("Metadata edit value is required.");
|
|
5725
|
+
if (args.metadataType !== void 0 && !["string", "number", "boolean", "date"].includes(args.metadataType)) usage7("Unknown property type.");
|
|
5505
5726
|
if (sanitize) removalCategories(args.metadataRemove);
|
|
5506
5727
|
if (!sanitize && ["list", "get"].includes(action)) return;
|
|
5507
5728
|
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)
|
|
5729
|
+
if (args.inPlace && args.input === "-") usage7("Stdin cannot be edited in place.");
|
|
5730
|
+
if (args.inPlace && args.output) usage7("Output and in-place cannot be combined.");
|
|
5731
|
+
if (!args.dryRun && !args.inPlace && !args.output) usage7("Mutation requires a destination.");
|
|
5732
|
+
if (args.force && !args.output) usage7("Force requires an output destination.");
|
|
5733
|
+
if (args.output === args.input && args.output !== "-") usage7("Replacing input requires --in-place.");
|
|
5734
|
+
if (args.output === "-" && args.json && !args.dryRun) usage7("Binary stdout cannot be combined with JSON.");
|
|
5514
5735
|
}
|
|
5515
5736
|
async function executeMetadataCommand(args, request, options2) {
|
|
5516
5737
|
const context = { ...options2.context, signal: request.signal };
|
|
@@ -5545,15 +5766,15 @@ async function executeMetadataCommand(args, request, options2) {
|
|
|
5545
5766
|
const type = args.metadataType ?? known[0]?.type ?? coreDefinition(args.metadataName)?.[2];
|
|
5546
5767
|
let value = args.metadataValue;
|
|
5547
5768
|
if (action === "set" && type === "boolean") {
|
|
5548
|
-
if (value !== "true" && value !== "false")
|
|
5769
|
+
if (value !== "true" && value !== "false") usage7("Boolean properties require true or false.");
|
|
5549
5770
|
value = value === "true";
|
|
5550
5771
|
} else if (action === "set" && type === "number") {
|
|
5551
5772
|
try {
|
|
5552
5773
|
value = JSON.parse(args.metadataValue);
|
|
5553
5774
|
} catch {
|
|
5554
|
-
|
|
5775
|
+
usage7("Number properties require a finite JSON number.");
|
|
5555
5776
|
}
|
|
5556
|
-
if (typeof value !== "number" || !Number.isFinite(value))
|
|
5777
|
+
if (typeof value !== "number" || !Number.isFinite(value)) usage7("Number properties require a finite JSON number.");
|
|
5557
5778
|
}
|
|
5558
5779
|
bytes = (await mutateProperty(original, action, { name: args.metadataName, ...action === "set" ? { value, ...type === void 0 ? {} : { type } } : {} }, context)).bytes;
|
|
5559
5780
|
affected = 1;
|
|
@@ -5573,22 +5794,22 @@ ${sanitization.retained.map((entry) => `Retained ${entry.category} ${entry.kind}
|
|
|
5573
5794
|
}
|
|
5574
5795
|
|
|
5575
5796
|
// packages/safe-bash-command-pptx/src/command-notes.ts
|
|
5576
|
-
import { OfficeError as
|
|
5797
|
+
import { OfficeError as OfficeError13 } from "../../safe-bash-presentation-engine/errors.js";
|
|
5577
5798
|
import { mutateNotes, readNotes, validateNotesOptions } from "../../safe-bash-presentation-engine/notes.js";
|
|
5578
5799
|
import { readSelectionIndex, SelectionError as SelectionError4 } from "../../safe-bash-presentation-engine/selectors.js";
|
|
5579
|
-
function
|
|
5580
|
-
throw new
|
|
5800
|
+
function usage8(message) {
|
|
5801
|
+
throw new OfficeError13("invalid-value", message, "usage");
|
|
5581
5802
|
}
|
|
5582
5803
|
function validateNotesCommand(args, positionals, seen) {
|
|
5583
5804
|
const allowed = Object.keys(noteSchemas[args.operation].options.properties).map(
|
|
5584
5805
|
(key) => "--" + [...key].map((c) => c >= "A" && c <= "Z" ? "-" + c.toLowerCase() : c).join("")
|
|
5585
5806
|
);
|
|
5586
|
-
if ([...seen].some((flag) => !allowed.includes(flag)))
|
|
5587
|
-
if (positionals.length !== 1 || !positionals[0])
|
|
5807
|
+
if ([...seen].some((flag) => !allowed.includes(flag))) usage8("Option does not apply to notes.");
|
|
5808
|
+
if (positionals.length !== 1 || !positionals[0]) usage8("Notes require exactly one input.");
|
|
5588
5809
|
args.input = positionals[0];
|
|
5589
|
-
if (args.scope !== void 0 && args.scope !== "notes")
|
|
5810
|
+
if (args.scope !== void 0 && args.scope !== "notes") usage8("Notes require notes scope.");
|
|
5590
5811
|
if (args.token && ["--slide", "--scope"].some((flag) => seen.has(flag)))
|
|
5591
|
-
|
|
5812
|
+
usage8("Opaque and simple selectors cannot be combined.");
|
|
5592
5813
|
if (args.operation === "notes.list" || args.operation === "notes.get") return;
|
|
5593
5814
|
if (!args.token && args.slide === void 0 && !args.all)
|
|
5594
5815
|
throw new SelectionError4("missing-selection");
|
|
@@ -5596,14 +5817,14 @@ function validateNotesCommand(args, positionals, seen) {
|
|
|
5596
5817
|
selection: { kind: "slide" },
|
|
5597
5818
|
...args.noteText === void 0 ? {} : { text: args.noteText }
|
|
5598
5819
|
});
|
|
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)
|
|
5820
|
+
if (args.inPlace && args.input === "-") usage8("Stdin cannot be edited in place.");
|
|
5821
|
+
if (args.inPlace && args.output) usage8("Output and in-place cannot be combined.");
|
|
5822
|
+
if (!args.dryRun && !args.inPlace && !args.output) usage8("Mutation requires a destination.");
|
|
5823
|
+
if (args.force && !args.output) usage8("Force requires an explicit output destination.");
|
|
5603
5824
|
if (args.output === args.input && args.output !== "-")
|
|
5604
|
-
|
|
5825
|
+
usage8("Replacing input requires --in-place.");
|
|
5605
5826
|
if (args.output === "-" && args.json && !args.dryRun)
|
|
5606
|
-
|
|
5827
|
+
usage8("Binary stdout cannot be combined with JSON.");
|
|
5607
5828
|
}
|
|
5608
5829
|
async function executeNotesCommand(args, request, options2) {
|
|
5609
5830
|
const context = { ...options2.context, signal: request.signal };
|
|
@@ -5859,33 +6080,33 @@ var linkSchemas = Object.fromEntries(
|
|
|
5859
6080
|
// packages/safe-bash-command-pptx/src/command-links.ts
|
|
5860
6081
|
import { readPackage as readPackage2 } from "../../safe-bash-presentation-engine/package-reader.js";
|
|
5861
6082
|
import { parseXmlPart as parseXmlPart2 } from "../../safe-bash-presentation-engine/xml.js";
|
|
5862
|
-
import { OfficeError as
|
|
6083
|
+
import { OfficeError as OfficeError14 } from "../../safe-bash-presentation-engine/errors.js";
|
|
5863
6084
|
import { listLinks, setLink, removeLink, isOrdinaryLinkUrl } from "../../safe-bash-presentation-engine/links.js";
|
|
5864
6085
|
import { readShapes } from "../../safe-bash-presentation-engine/shape-operations.js";
|
|
5865
6086
|
import { SelectionError as SelectionError5 } from "../../safe-bash-presentation-engine/selectors.js";
|
|
5866
|
-
function
|
|
5867
|
-
throw new
|
|
6087
|
+
function usage9(message) {
|
|
6088
|
+
throw new OfficeError14("invalid-value", message, "usage");
|
|
5868
6089
|
}
|
|
5869
6090
|
function validateLinkCommand(args, positionals, seen) {
|
|
5870
6091
|
const allowed = Object.keys(linkSchemas[args.operation].options.properties).map(
|
|
5871
6092
|
(key) => "--" + [...key].map((c) => c >= "A" && c <= "Z" ? "-" + c.toLowerCase() : c).join("")
|
|
5872
6093
|
);
|
|
5873
|
-
if ([...seen].some((flag) => !allowed.includes(flag)))
|
|
5874
|
-
if (positionals.length !== 1 || !positionals[0])
|
|
6094
|
+
if ([...seen].some((flag) => !allowed.includes(flag))) usage9("Option does not apply to links.");
|
|
6095
|
+
if (positionals.length !== 1 || !positionals[0]) usage9("Links require exactly one input.");
|
|
5875
6096
|
args.input = positionals[0];
|
|
5876
|
-
if (args.scope !== void 0 && args.scope !== "slides")
|
|
6097
|
+
if (args.scope !== void 0 && args.scope !== "slides") usage9("Links support slides scope.");
|
|
5877
6098
|
if (args.token && ["--slide", "--shape", "--scope"].some((flag) => seen.has(flag)))
|
|
5878
|
-
|
|
6099
|
+
usage9("Opaque and simple selectors cannot be combined.");
|
|
5879
6100
|
if (args.shape !== void 0 && args.slide === void 0)
|
|
5880
|
-
|
|
6101
|
+
usage9("Shape selection requires a slide.");
|
|
5881
6102
|
const edit = args.linkEdit ?? {};
|
|
5882
6103
|
if (edit.trigger !== void 0 && !["click", "hover"].includes(edit.trigger))
|
|
5883
|
-
|
|
6104
|
+
usage9("Unsupported link trigger.");
|
|
5884
6105
|
if (edit.path !== void 0 && (!Array.isArray(edit.path) || edit.path.some((value) => !Number.isSafeInteger(value) || value < 0)))
|
|
5885
|
-
|
|
6106
|
+
usage9("Link path requires an array of nonnegative integer child positions.");
|
|
5886
6107
|
if (["links.list", "links.get"].includes(args.operation)) return;
|
|
5887
6108
|
if (!args.token && args.slide === void 0 && !args.all)
|
|
5888
|
-
|
|
6109
|
+
usage9("Link mutation requires explicit selection.");
|
|
5889
6110
|
if (args.operation !== "links.remove") {
|
|
5890
6111
|
const url = edit.url !== void 0, slide = edit.targetSlide !== void 0;
|
|
5891
6112
|
if (Number(url) + Number(slide) + Number(
|
|
@@ -5893,20 +6114,20 @@ function validateLinkCommand(args, positionals, seen) {
|
|
|
5893
6114
|
edit.action ?? ""
|
|
5894
6115
|
)
|
|
5895
6116
|
) !== 1)
|
|
5896
|
-
|
|
6117
|
+
usage9("Provide exactly one link destination.");
|
|
5897
6118
|
if (url && (!isOrdinaryLinkUrl(edit.url) || edit.action !== void 0 && edit.action !== "url"))
|
|
5898
|
-
|
|
6119
|
+
usage9("URL action must agree with its destination.");
|
|
5899
6120
|
if (slide && edit.action !== void 0 && edit.action !== "slide")
|
|
5900
|
-
|
|
6121
|
+
usage9("Slide action must agree with its destination.");
|
|
5901
6122
|
}
|
|
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)
|
|
6123
|
+
if (args.inPlace && args.input === "-") usage9("Stdin cannot be edited in place.");
|
|
6124
|
+
if (args.inPlace && args.output) usage9("Output and in-place cannot be combined.");
|
|
6125
|
+
if (!args.dryRun && !args.inPlace && !args.output) usage9("Mutation requires a destination.");
|
|
6126
|
+
if (args.force && !args.output) usage9("Force requires an explicit output destination.");
|
|
5906
6127
|
if (args.output === args.input && args.output !== "-")
|
|
5907
|
-
|
|
6128
|
+
usage9("Replacing input requires --in-place.");
|
|
5908
6129
|
if (args.output === "-" && args.json && !args.dryRun)
|
|
5909
|
-
|
|
6130
|
+
usage9("Binary stdout cannot be combined with JSON.");
|
|
5910
6131
|
}
|
|
5911
6132
|
var actionNames = {
|
|
5912
6133
|
url: "hyperlink",
|
|
@@ -6002,7 +6223,7 @@ async function executeLinkCommand(args, request, options2) {
|
|
|
6002
6223
|
if (args.operation === "links.add" && selectedLinks.some(
|
|
6003
6224
|
(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
6225
|
))
|
|
6005
|
-
throw new
|
|
6226
|
+
throw new OfficeError14(
|
|
6006
6227
|
"unsupported-edit",
|
|
6007
6228
|
"Selected trigger already contains a link.",
|
|
6008
6229
|
"validate-intent"
|
|
@@ -7029,11 +7250,11 @@ import { readAnimations } from "../../safe-bash-presentation-engine/animations.j
|
|
|
7029
7250
|
import { mutateAnimations, mutateAnimationsBatch, validateAnimationOptions as validateAnimationOptions2 } from "../../safe-bash-presentation-engine/animation-editing.js";
|
|
7030
7251
|
|
|
7031
7252
|
// packages/safe-bash-command-pptx/src/animation-batch-command.ts
|
|
7032
|
-
import { OfficeError as
|
|
7253
|
+
import { OfficeError as OfficeError15 } from "../../safe-bash-presentation-engine/errors.js";
|
|
7033
7254
|
import { validateAnimationOptions } from "../../safe-bash-presentation-engine/animation-editing.js";
|
|
7034
7255
|
import { decodeSelectionToken, SelectionError as SelectionError6 } from "../../safe-bash-presentation-engine/selectors.js";
|
|
7035
7256
|
function invalid(message) {
|
|
7036
|
-
throw new
|
|
7257
|
+
throw new OfficeError15("invalid-value", message, "usage");
|
|
7037
7258
|
}
|
|
7038
7259
|
function record(value, keys) {
|
|
7039
7260
|
if (!value || typeof value !== "object" || Array.isArray(value) || Object.keys(value).some((key) => !keys.includes(key))) invalid("Invalid animation batch fields.");
|
|
@@ -7241,31 +7462,31 @@ var equationSchemas = Object.fromEntries(["list", "get", "add"].map((action) =>
|
|
|
7241
7462
|
}));
|
|
7242
7463
|
|
|
7243
7464
|
// packages/safe-bash-command-pptx/src/command-equations.ts
|
|
7244
|
-
import { OfficeError as
|
|
7465
|
+
import { OfficeError as OfficeError16 } from "../../safe-bash-presentation-engine/errors.js";
|
|
7245
7466
|
import { readEquations, mutateEquations } from "../../safe-bash-presentation-engine/equations.js";
|
|
7246
7467
|
import { SelectionError as SelectionError7 } from "../../safe-bash-presentation-engine/selectors.js";
|
|
7247
|
-
function
|
|
7248
|
-
throw new
|
|
7468
|
+
function usage10(message) {
|
|
7469
|
+
throw new OfficeError16("invalid-value", message, "usage");
|
|
7249
7470
|
}
|
|
7250
7471
|
function validateEquationCommand(args, positionals, seen) {
|
|
7251
7472
|
const schema = equationSchemas[args.operation];
|
|
7252
7473
|
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])
|
|
7474
|
+
if ([...seen].some((flag) => !allowed.includes(flag))) usage10("Option does not apply to equations.");
|
|
7475
|
+
if (positionals.length !== 1 || !positionals[0]) usage10("Equations require exactly one input.");
|
|
7255
7476
|
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)
|
|
7477
|
+
if (args.scope !== void 0 && args.scope !== "slides") usage10("Equations support slides scope.");
|
|
7478
|
+
if (args.token && ["--slide", "--shape", "--scope"].some((flag) => seen.has(flag))) usage10("Opaque and simple selectors cannot be combined.");
|
|
7479
|
+
if (args.shape !== void 0 && args.slide === void 0) usage10("Shape selection requires a slide.");
|
|
7259
7480
|
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)
|
|
7481
|
+
if (!args.file) usage10("Equation insertion requires --file.");
|
|
7482
|
+
if (!args.token && !args.shape) usage10("Equation insertion requires a shape selector.");
|
|
7483
|
+
if (args.input === "-" && args.file === "-") usage10("Only one input may consume stdin.");
|
|
7484
|
+
if (args.inPlace && args.input === "-") usage10("Stdin cannot be edited in place.");
|
|
7485
|
+
if (args.inPlace && args.output) usage10("Output and in-place cannot be combined.");
|
|
7486
|
+
if (!args.dryRun && !args.inPlace && !args.output) usage10("Mutation requires a destination.");
|
|
7487
|
+
if (args.force && !args.output) usage10("Force requires an explicit output destination.");
|
|
7488
|
+
if (args.output === args.input && args.output !== "-") usage10("Replacing input requires --in-place.");
|
|
7489
|
+
if (args.output === "-" && args.json && !args.dryRun) usage10("Binary stdout cannot be combined with JSON.");
|
|
7269
7490
|
}
|
|
7270
7491
|
async function executeEquationCommand(args, request, options2) {
|
|
7271
7492
|
const context = { ...options2.context, signal: request.signal };
|
|
@@ -7396,30 +7617,30 @@ var opaqueSchemas = Object.fromEntries(["objects.list", "objects.extract", "font
|
|
|
7396
7617
|
|
|
7397
7618
|
// packages/safe-bash-command-pptx/src/command-opaque.ts
|
|
7398
7619
|
import { sha256 as sha2563 } from "@noble/hashes/sha2.js";
|
|
7399
|
-
import { OfficeError as
|
|
7620
|
+
import { OfficeError as OfficeError17 } from "../../safe-bash-presentation-engine/errors.js";
|
|
7400
7621
|
import { extractObject, readFonts, readObjects } from "../../safe-bash-presentation-engine/opaque-objects.js";
|
|
7401
|
-
import { partName as
|
|
7402
|
-
function
|
|
7403
|
-
throw new
|
|
7622
|
+
import { partName as partName3 } from "../../safe-bash-presentation-engine/package-uri.js";
|
|
7623
|
+
function usage11(message) {
|
|
7624
|
+
throw new OfficeError17("invalid-value", message, "usage");
|
|
7404
7625
|
}
|
|
7405
7626
|
function validateOpaqueCommand(args, positionals, seen) {
|
|
7406
7627
|
const schema = opaqueSchemas[args.operation];
|
|
7407
7628
|
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])
|
|
7629
|
+
if ([...seen].some((flag) => !allowed.includes(flag))) usage11("Option does not apply to opaque resources.");
|
|
7630
|
+
if (positionals.length !== 1 || !positionals[0]) usage11("Opaque resources require exactly one input.");
|
|
7410
7631
|
args.input = positionals[0];
|
|
7411
7632
|
const scope = args.operation === "fonts.list" ? "presentation" : "shared";
|
|
7412
|
-
if (args.scope !== void 0 && args.scope !== scope)
|
|
7633
|
+
if (args.scope !== void 0 && args.scope !== scope) usage11("Unsupported opaque resource scope.");
|
|
7413
7634
|
if (args.operation !== "objects.extract") return;
|
|
7414
|
-
if (!args.part)
|
|
7635
|
+
if (!args.part) usage11("Object extraction requires --part.");
|
|
7415
7636
|
try {
|
|
7416
|
-
if (
|
|
7637
|
+
if (partName3(args.part, false) !== args.part) usage11("Object extraction requires a canonical package part.");
|
|
7417
7638
|
} catch {
|
|
7418
|
-
|
|
7639
|
+
usage11("Object extraction requires a canonical package part.");
|
|
7419
7640
|
}
|
|
7420
|
-
if (!args.outputDir && !args.dryRun)
|
|
7421
|
-
if (args.outputDir === "-")
|
|
7422
|
-
if (args.force && !args.outputDir)
|
|
7641
|
+
if (!args.outputDir && !args.dryRun) usage11("Object extraction requires --output-dir.");
|
|
7642
|
+
if (args.outputDir === "-") usage11("Output directories cannot be stdout.");
|
|
7643
|
+
if (args.force && !args.outputDir) usage11("Force requires an output directory.");
|
|
7423
7644
|
}
|
|
7424
7645
|
async function executeOpaqueCommand(args, request, options2) {
|
|
7425
7646
|
const context = { ...options2.context, signal: request.signal };
|
|
@@ -7437,7 +7658,7 @@ async function executeOpaqueCommand(args, request, options2) {
|
|
|
7437
7658
|
}
|
|
7438
7659
|
const extracted = await extractObject(bytes, { part: args.part }, context);
|
|
7439
7660
|
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
|
|
7661
|
+
if (files.length > (args.limits?.maxOutputs ?? context.archiveLimits.maxMembers)) throw new OfficeError17("resource-limit", "Opaque output count exceeds limit.", "validate-intent");
|
|
7441
7662
|
const dryRun = args.dryRun ?? false;
|
|
7442
7663
|
const allowPartialOutput = args.allowPartialOutput ?? false;
|
|
7443
7664
|
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 +7690,7 @@ import { readMedia } from "../../safe-bash-presentation-engine/media.js";
|
|
|
7469
7690
|
import { extractMedia } from "../../safe-bash-presentation-engine/media-extraction.js";
|
|
7470
7691
|
|
|
7471
7692
|
// packages/safe-bash-command-pptx/src/command-media-editing.ts
|
|
7472
|
-
import { OfficeError as
|
|
7693
|
+
import { OfficeError as OfficeError18 } from "../../safe-bash-presentation-engine/errors.js";
|
|
7473
7694
|
import { addMedia, replaceMedia } from "../../safe-bash-presentation-engine/media-editing.js";
|
|
7474
7695
|
|
|
7475
7696
|
// packages/safe-bash-command-pptx/src/media-schema.ts
|
|
@@ -7718,56 +7939,56 @@ for (const action of ["add", "replace", "extract"]) {
|
|
|
7718
7939
|
}
|
|
7719
7940
|
|
|
7720
7941
|
// packages/safe-bash-command-pptx/src/command-media-editing.ts
|
|
7721
|
-
function
|
|
7722
|
-
throw new
|
|
7942
|
+
function usage12(message) {
|
|
7943
|
+
throw new OfficeError18("invalid-value", message, "usage");
|
|
7723
7944
|
}
|
|
7724
7945
|
function validateMediaEditingCommand(args, positionals, seen) {
|
|
7725
7946
|
const allowed = Object.keys(mediaSchemas[args.operation].options.properties).map(
|
|
7726
7947
|
(key) => "--" + [...key].map((c) => c >= "A" && c <= "Z" ? "-" + c.toLowerCase() : c).join("")
|
|
7727
7948
|
);
|
|
7728
7949
|
if ([...seen].some((flag) => !allowed.includes(flag)))
|
|
7729
|
-
|
|
7730
|
-
if (positionals.length !== 1 || !positionals[0])
|
|
7950
|
+
usage12("Option does not apply to this media operation.");
|
|
7951
|
+
if (positionals.length !== 1 || !positionals[0]) usage12("Media requires exactly one input.");
|
|
7731
7952
|
args.input = positionals[0];
|
|
7732
7953
|
if (args.token && ["--slide", "--shape", "--scope", "--all"].some((flag) => seen.has(flag)))
|
|
7733
|
-
|
|
7954
|
+
usage12("Opaque and simple selectors cannot be combined.");
|
|
7734
7955
|
if (args.shape !== void 0 && args.slide === void 0)
|
|
7735
|
-
|
|
7956
|
+
usage12("Shape selection requires an owning slide.");
|
|
7736
7957
|
if (args.operation === "media.extract") {
|
|
7737
7958
|
if (!args.outputDir || args.outputDir === "-")
|
|
7738
|
-
|
|
7959
|
+
usage12("Media extraction requires an output directory.");
|
|
7739
7960
|
return;
|
|
7740
7961
|
}
|
|
7741
7962
|
if (args.operation === "media.add" && args.scope !== void 0 && args.scope !== "slides")
|
|
7742
|
-
|
|
7743
|
-
if (!args.file)
|
|
7963
|
+
usage12("Media editing requires slides scope.");
|
|
7964
|
+
if (!args.file) usage12("Media mutation requires --file.");
|
|
7744
7965
|
if (args.operation === "media.add") {
|
|
7745
7966
|
if (args.slide === void 0 || !args.mediaEdit?.kind || !args.mediaEdit.contentType || ["left", "top", "width", "height"].some(
|
|
7746
7967
|
(key) => args.mediaEdit?.[key] === void 0
|
|
7747
7968
|
))
|
|
7748
|
-
|
|
7749
|
-
if (!args.poster)
|
|
7969
|
+
usage12("Media insertion requires slide, kind, MIME type and explicit geometry.");
|
|
7970
|
+
if (!args.poster) usage12("Media insertion requires an explicit poster.");
|
|
7750
7971
|
} else {
|
|
7751
|
-
if (!args.poster)
|
|
7972
|
+
if (!args.poster) usage12("Media replacement requires an explicit poster.");
|
|
7752
7973
|
if (!args.token && args.shape === void 0 && !args.all)
|
|
7753
|
-
|
|
7974
|
+
usage12("Media replacement requires a shape selector or all.");
|
|
7754
7975
|
}
|
|
7755
7976
|
if ([args.input, args.file, args.poster].filter((value) => value === "-").length > 1)
|
|
7756
|
-
|
|
7977
|
+
usage12("Only one input may consume stdin.");
|
|
7757
7978
|
if (args.poster && !args.posterContentType) {
|
|
7758
7979
|
const extension = args.poster.slice(args.poster.lastIndexOf(".") + 1).toLowerCase();
|
|
7759
7980
|
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)
|
|
7981
|
+
if (!inferred) usage12("Poster requires an explicit content type or supported extension.");
|
|
7761
7982
|
args.posterContentType = inferred;
|
|
7762
7983
|
}
|
|
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)
|
|
7984
|
+
if (args.inPlace && args.input === "-") usage12("Stdin cannot be edited in place.");
|
|
7985
|
+
if (args.inPlace && args.output) usage12("Output and in-place cannot be combined.");
|
|
7986
|
+
if (!args.dryRun && !args.inPlace && !args.output) usage12("Mutation requires a destination.");
|
|
7987
|
+
if (args.force && !args.output) usage12("Force requires an explicit output destination.");
|
|
7767
7988
|
if (args.output === args.input && args.output !== "-")
|
|
7768
|
-
|
|
7989
|
+
usage12("Replacing input requires --in-place.");
|
|
7769
7990
|
if (args.output === "-" && args.json && !args.dryRun)
|
|
7770
|
-
|
|
7991
|
+
usage12("Binary stdout cannot be combined with JSON.");
|
|
7771
7992
|
}
|
|
7772
7993
|
async function executeMediaEditingCommand(args, request, options2) {
|
|
7773
7994
|
const context = { ...options2.context, signal: request.signal };
|
|
@@ -8813,9 +9034,9 @@ import {
|
|
|
8813
9034
|
import { readBackgrounds, mutateBackground } from "../../safe-bash-presentation-engine/backgrounds.js";
|
|
8814
9035
|
import { replacePresentationText } from "../../safe-bash-presentation-engine/text-replacement.js";
|
|
8815
9036
|
import { readPresentationText } from "../../safe-bash-presentation-engine/text-reading.js";
|
|
8816
|
-
import { OfficeError as
|
|
9037
|
+
import { OfficeError as OfficeError19 } from "../../safe-bash-presentation-engine/errors.js";
|
|
8817
9038
|
import { sha256 as sha2564 } from "@noble/hashes/sha2.js";
|
|
8818
|
-
import { packageUri, partName as
|
|
9039
|
+
import { packageUri, partName as partName4 } from "../../safe-bash-presentation-engine/package-uri.js";
|
|
8819
9040
|
import {
|
|
8820
9041
|
SelectionError as SelectionError8,
|
|
8821
9042
|
decodeSelectionToken as decodeSelectionToken2,
|
|
@@ -8848,7 +9069,7 @@ import {
|
|
|
8848
9069
|
import { getXmlPart, stageRetainedXmlPart, stageRetainedXmlReplacement, replaceXmlPart } from "../../safe-bash-presentation-engine/xml-parts.js";
|
|
8849
9070
|
import { validatePresentation, openRetainedPresentationValidation } from "../../safe-bash-presentation-engine/validation.js";
|
|
8850
9071
|
import { readPackage as readPackage3 } from "../../safe-bash-presentation-engine/package-reader.js";
|
|
8851
|
-
import { resourceContext } from "../../safe-bash-presentation-engine/resource-limits.js";
|
|
9072
|
+
import { resourceContext as resourceContext2 } from "../../safe-bash-presentation-engine/resource-limits.js";
|
|
8852
9073
|
var scopes2 = [
|
|
8853
9074
|
"slides",
|
|
8854
9075
|
"notes",
|
|
@@ -9014,15 +9235,15 @@ Dimension conflicts reject by default; destination policy retains source coordin
|
|
|
9014
9235
|
Slides add requires an exact layout name or part URI; position defaults to append.
|
|
9015
9236
|
Title/body match placeholder types; indexed bindings use --placeholders-json.
|
|
9016
9237
|
`;
|
|
9017
|
-
function
|
|
9018
|
-
throw new
|
|
9238
|
+
function usage13(message) {
|
|
9239
|
+
throw new OfficeError19("invalid-value", message, "usage");
|
|
9019
9240
|
}
|
|
9020
9241
|
function paragraphTabLength(length4) {
|
|
9021
9242
|
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
|
-
|
|
9243
|
+
usage13("Tabs require finite explicit lengths.");
|
|
9023
9244
|
const emu = length4.value * commandLength("1" + length4.unit, 0);
|
|
9024
9245
|
if (!Number.isFinite(emu) || emu > Number.MAX_SAFE_INTEGER)
|
|
9025
|
-
|
|
9246
|
+
usage13("Tab length is outside the supported range.");
|
|
9026
9247
|
return Math.round(emu) / 12700;
|
|
9027
9248
|
}
|
|
9028
9249
|
var runFlags = [
|
|
@@ -9270,11 +9491,11 @@ function parse(raw, maximum, output3) {
|
|
|
9270
9491
|
const decoder = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true });
|
|
9271
9492
|
for (let index = 0; index < raw.length; index++) {
|
|
9272
9493
|
const bytes = raw[index];
|
|
9273
|
-
if (!(bytes instanceof Uint8Array))
|
|
9494
|
+
if (!(bytes instanceof Uint8Array)) usage13("Arguments must be byte arrays.");
|
|
9274
9495
|
size += bytes.length + 1;
|
|
9275
9496
|
if (size > maximum) {
|
|
9276
|
-
if (invalidUtf8)
|
|
9277
|
-
throw new
|
|
9497
|
+
if (invalidUtf8) usage13("Arguments must be UTF-8.");
|
|
9498
|
+
throw new OfficeError19("resource-limit", "Argument limit exceeded.", "usage");
|
|
9278
9499
|
}
|
|
9279
9500
|
try {
|
|
9280
9501
|
args.push(decoder.decode(bytes));
|
|
@@ -9345,9 +9566,9 @@ function parse(raw, maximum, output3) {
|
|
|
9345
9566
|
else if (scalarOptions.includes(argument)) hintValue = true;
|
|
9346
9567
|
}
|
|
9347
9568
|
}
|
|
9348
|
-
if (invalidUtf8)
|
|
9569
|
+
if (invalidUtf8) usage13("Arguments must be UTF-8.");
|
|
9349
9570
|
if (args[0] === "accessibility" && ["--help", "-h"].includes(args[1])) {
|
|
9350
|
-
if (args.slice(2).some((argument) => argument !== "--json"))
|
|
9571
|
+
if (args.slice(2).some((argument) => argument !== "--json")) usage13("Unexpected help option.");
|
|
9351
9572
|
return { operation: "help", json: output3.json, schemaPath: "accessibility" };
|
|
9352
9573
|
}
|
|
9353
9574
|
if (args[0] === "text" && ["runs", "paragraphs", "frames"].includes(args[1]) && ["get", "set", "list"].includes(args[2])) {
|
|
@@ -9452,7 +9673,7 @@ function parse(raw, maximum, output3) {
|
|
|
9452
9673
|
"help",
|
|
9453
9674
|
"version"
|
|
9454
9675
|
].includes(operation))
|
|
9455
|
-
|
|
9676
|
+
usage13("Unsupported operation.");
|
|
9456
9677
|
const result = { operation, json: false };
|
|
9457
9678
|
const positionals = [];
|
|
9458
9679
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -9482,10 +9703,10 @@ function parse(raw, maximum, output3) {
|
|
|
9482
9703
|
"--height",
|
|
9483
9704
|
"--workbook-policy"
|
|
9484
9705
|
].includes(argument)) {
|
|
9485
|
-
if (seen.has(argument))
|
|
9706
|
+
if (seen.has(argument)) usage13("Repeated option.");
|
|
9486
9707
|
seen.add(argument);
|
|
9487
9708
|
const value2 = args[++index];
|
|
9488
|
-
if (value2 === void 0)
|
|
9709
|
+
if (value2 === void 0) usage13("Chart option requires a value.");
|
|
9489
9710
|
const key = argument.slice(2);
|
|
9490
9711
|
if (key === "workbook-policy") result.chartWorkbookPolicy = value2;
|
|
9491
9712
|
else {
|
|
@@ -9493,10 +9714,10 @@ function parse(raw, maximum, output3) {
|
|
|
9493
9714
|
if (key === "data" || key === "objects") parsed = commandJson(value2);
|
|
9494
9715
|
else if (key === "style") {
|
|
9495
9716
|
if (!value2.length || [...value2].some((c) => c < "0" || c > "9"))
|
|
9496
|
-
|
|
9717
|
+
usage13("Chart style requires an integer.");
|
|
9497
9718
|
parsed = Number(value2);
|
|
9498
9719
|
} else if (key === "legend") {
|
|
9499
|
-
if (!["true", "false"].includes(value2))
|
|
9720
|
+
if (!["true", "false"].includes(value2)) usage13("Legend requires true or false.");
|
|
9500
9721
|
parsed = value2 === "true";
|
|
9501
9722
|
} else if (["left", "top", "width", "height"].includes(key))
|
|
9502
9723
|
parsed = commandLength(
|
|
@@ -9510,14 +9731,14 @@ function parse(raw, maximum, output3) {
|
|
|
9510
9731
|
if (operation.startsWith("tables.") && (argument === "--table" || argument === "--cell" || ["--from", "--to", "--position", "--span-policy"].includes(argument) || Object.keys(tableValues).some(
|
|
9511
9732
|
(key) => "--" + [...key].map((c) => c >= "A" && c <= "Z" ? "-" + c.toLowerCase() : c).join("") === argument
|
|
9512
9733
|
))) {
|
|
9513
|
-
if (seen.has(argument))
|
|
9734
|
+
if (seen.has(argument)) usage13("Repeated option.");
|
|
9514
9735
|
seen.add(argument);
|
|
9515
9736
|
const value2 = args[++index];
|
|
9516
|
-
if (value2 === void 0)
|
|
9737
|
+
if (value2 === void 0) usage13("Table option requires a value.");
|
|
9517
9738
|
const key = argument.slice(2).split("-").map((word, i) => i ? word[0].toUpperCase() + word.slice(1) : word).join("");
|
|
9518
9739
|
if (key === "table" || key === "rows" || key === "columns" || key === "position") {
|
|
9519
9740
|
if (!value2.length || [...value2].some((c) => c < "0" || c > "9") || !Number.isSafeInteger(Number(value2)) || Number(value2) < 1)
|
|
9520
|
-
|
|
9741
|
+
usage13("Table positions and dimensions require positive integers.");
|
|
9521
9742
|
if (key === "position") result.tablePosition = Number(value2);
|
|
9522
9743
|
else if (key === "table") result.table = Number(value2);
|
|
9523
9744
|
else result.tableEdit = { ...result.tableEdit, [key]: Number(value2) };
|
|
@@ -9526,7 +9747,7 @@ function parse(raw, maximum, output3) {
|
|
|
9526
9747
|
try {
|
|
9527
9748
|
tableCell(value2);
|
|
9528
9749
|
} catch {
|
|
9529
|
-
|
|
9750
|
+
usage13("Cell requires one-based row,column coordinates.");
|
|
9530
9751
|
}
|
|
9531
9752
|
if (key === "from") result.tableFrom = value2;
|
|
9532
9753
|
else if (key === "to") result.tableTo = value2;
|
|
@@ -9548,7 +9769,7 @@ function parse(raw, maximum, output3) {
|
|
|
9548
9769
|
let parsed = value2;
|
|
9549
9770
|
if (key === "data") parsed = commandJson(value2);
|
|
9550
9771
|
else if (["firstRow", "lastRow", "firstCol", "lastCol", "horzBand", "vertBand"].includes(key)) {
|
|
9551
|
-
if (!["true", "false"].includes(value2))
|
|
9772
|
+
if (!["true", "false"].includes(value2)) usage13("Table style flags require true or false.");
|
|
9552
9773
|
parsed = value2 === "true";
|
|
9553
9774
|
} else if (value2 === "null" && !["text"].includes(key)) parsed = null;
|
|
9554
9775
|
else if (lengths.includes(key))
|
|
@@ -9573,10 +9794,10 @@ function parse(raw, maximum, output3) {
|
|
|
9573
9794
|
"--line-width",
|
|
9574
9795
|
"--line-color"
|
|
9575
9796
|
].includes(argument)) {
|
|
9576
|
-
if (seen.has(argument))
|
|
9797
|
+
if (seen.has(argument)) usage13("Repeated option.");
|
|
9577
9798
|
seen.add(argument);
|
|
9578
9799
|
const value2 = args[++index];
|
|
9579
|
-
if (value2 === void 0)
|
|
9800
|
+
if (value2 === void 0) usage13("Connector option requires a value.");
|
|
9580
9801
|
const keys = {
|
|
9581
9802
|
"--begin-x": "beginX",
|
|
9582
9803
|
"--begin-y": "beginY",
|
|
@@ -9590,7 +9811,7 @@ function parse(raw, maximum, output3) {
|
|
|
9590
9811
|
};
|
|
9591
9812
|
const key = keys[argument] ?? argument.slice(2);
|
|
9592
9813
|
if (key === "site" && (!value2 || [...value2].some((c) => c < "0" || c > "9")))
|
|
9593
|
-
|
|
9814
|
+
usage13("Sites require nonnegative decimal integers.");
|
|
9594
9815
|
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
9816
|
result.connectorEdit = { ...result.connectorEdit, [key]: parsed };
|
|
9596
9817
|
continue;
|
|
@@ -9607,14 +9828,14 @@ function parse(raw, maximum, output3) {
|
|
|
9607
9828
|
"--offset-x",
|
|
9608
9829
|
"--offset-y"
|
|
9609
9830
|
].includes(argument)) {
|
|
9610
|
-
if (seen.has(argument))
|
|
9831
|
+
if (seen.has(argument)) usage13("Repeated option.");
|
|
9611
9832
|
seen.add(argument);
|
|
9612
9833
|
const value2 = args[++index];
|
|
9613
|
-
if (value2 === void 0)
|
|
9834
|
+
if (value2 === void 0) usage13("Shape selection option requires a value.");
|
|
9614
9835
|
if (argument === "--shapes") {
|
|
9615
9836
|
const locations = commandJson(value2);
|
|
9616
9837
|
if (!Array.isArray(locations) || locations.length === 0)
|
|
9617
|
-
|
|
9838
|
+
usage13("Shapes requires a nonempty location array.");
|
|
9618
9839
|
result.shapes = locations;
|
|
9619
9840
|
} else {
|
|
9620
9841
|
const key = argument === "--coordinate-system" ? "coordinateSystem" : argument === "--offset-x" ? "offsetX" : argument === "--offset-y" ? "offsetY" : argument.slice(2);
|
|
@@ -9627,24 +9848,24 @@ function parse(raw, maximum, output3) {
|
|
|
9627
9848
|
continue;
|
|
9628
9849
|
}
|
|
9629
9850
|
if (["shapes.group", "shapes.ungroup"].includes(operation) && ["--shapes", "--tolerance"].includes(argument)) {
|
|
9630
|
-
if (seen.has(argument))
|
|
9851
|
+
if (seen.has(argument)) usage13("Repeated option.");
|
|
9631
9852
|
seen.add(argument);
|
|
9632
9853
|
const value2 = args[++index];
|
|
9633
|
-
if (value2 === void 0)
|
|
9854
|
+
if (value2 === void 0) usage13("Group option requires a value.");
|
|
9634
9855
|
if (argument === "--tolerance") result.tolerance = new Emu(commandLength(value2, 0));
|
|
9635
9856
|
else {
|
|
9636
9857
|
const locations = commandJson(value2);
|
|
9637
9858
|
if (!Array.isArray(locations) || locations.length < 2)
|
|
9638
|
-
|
|
9859
|
+
usage13("Grouping requires at least two shape locations.");
|
|
9639
9860
|
result.shapes = locations;
|
|
9640
9861
|
}
|
|
9641
9862
|
continue;
|
|
9642
9863
|
}
|
|
9643
9864
|
if (operation.startsWith("fields.") && ["--kind", "--text", "--update", "--timestamp"].includes(argument)) {
|
|
9644
|
-
if (seen.has(argument))
|
|
9865
|
+
if (seen.has(argument)) usage13("Repeated option.");
|
|
9645
9866
|
seen.add(argument);
|
|
9646
9867
|
const value2 = args[++index];
|
|
9647
|
-
if (value2 === void 0)
|
|
9868
|
+
if (value2 === void 0) usage13("Field option requires a value.");
|
|
9648
9869
|
const key = argument.slice(2);
|
|
9649
9870
|
result.fieldEdit = {
|
|
9650
9871
|
...result.fieldEdit,
|
|
@@ -9653,13 +9874,13 @@ function parse(raw, maximum, output3) {
|
|
|
9653
9874
|
continue;
|
|
9654
9875
|
}
|
|
9655
9876
|
if (operation.startsWith("animations.") && ["--kind", "--trigger", "--duration", "--delay", "--target"].includes(argument)) {
|
|
9656
|
-
if (seen.has(argument))
|
|
9877
|
+
if (seen.has(argument)) usage13("Repeated option.");
|
|
9657
9878
|
seen.add(argument);
|
|
9658
9879
|
const value2 = args[++index];
|
|
9659
|
-
if (value2 === void 0)
|
|
9880
|
+
if (value2 === void 0) usage13("Animation option requires a value.");
|
|
9660
9881
|
let parsed = value2;
|
|
9661
9882
|
if (argument === "--duration" || argument === "--delay") {
|
|
9662
|
-
if (!value2.length || [...value2].some((character) => character < "0" || character > "9"))
|
|
9883
|
+
if (!value2.length || [...value2].some((character) => character < "0" || character > "9")) usage13("Timing requires integer milliseconds.");
|
|
9663
9884
|
parsed = Number(value2);
|
|
9664
9885
|
}
|
|
9665
9886
|
if (argument === "--target") parsed = animationTargetArgument(value2.trimStart().startsWith("{") ? commandJson(value2) : value2);
|
|
@@ -9667,31 +9888,31 @@ function parse(raw, maximum, output3) {
|
|
|
9667
9888
|
continue;
|
|
9668
9889
|
}
|
|
9669
9890
|
if (operation === "batch" && ["--ops-json", "--ops-file"].includes(argument)) {
|
|
9670
|
-
if (seen.has(argument))
|
|
9891
|
+
if (seen.has(argument)) usage13("Repeated option.");
|
|
9671
9892
|
seen.add(argument);
|
|
9672
9893
|
const value2 = args[++index];
|
|
9673
|
-
if (!value2)
|
|
9894
|
+
if (!value2) usage13("Batch option requires a value.");
|
|
9674
9895
|
if (argument === "--ops-json") result.animationBatch = parseAnimationBatch(commandJson(value2));
|
|
9675
9896
|
else result.opsFile = value2;
|
|
9676
9897
|
continue;
|
|
9677
9898
|
}
|
|
9678
9899
|
if (operation.startsWith("comments.") && ["--id", "--text", "--author", "--author-id", "--initials", "--timestamp", "--left", "--top"].includes(argument)) {
|
|
9679
|
-
if (seen.has(argument))
|
|
9900
|
+
if (seen.has(argument)) usage13("Repeated option.");
|
|
9680
9901
|
seen.add(argument);
|
|
9681
9902
|
const value2 = args[++index];
|
|
9682
|
-
if (value2 === void 0)
|
|
9903
|
+
if (value2 === void 0) usage13("Comment option requires a value.");
|
|
9683
9904
|
const key = argument === "--author-id" ? "authorId" : argument.slice(2);
|
|
9684
9905
|
const parsed = ["left", "top"].includes(key) ? commandLength(value2, -Number.MAX_SAFE_INTEGER) : key === "timestamp" ? commandTimestamp(value2).toISOString() : value2;
|
|
9685
9906
|
result.commentEdit = { ...result.commentEdit, [key]: parsed };
|
|
9686
9907
|
continue;
|
|
9687
9908
|
}
|
|
9688
9909
|
if (Object.hasOwn(accessibilitySchemas, operation) && ["--title", "--alt-text", "--decorative"].includes(argument)) {
|
|
9689
|
-
if (seen.has(argument))
|
|
9910
|
+
if (seen.has(argument)) usage13("Repeated option.");
|
|
9690
9911
|
seen.add(argument);
|
|
9691
9912
|
const value2 = args[++index];
|
|
9692
|
-
if (value2 === void 0)
|
|
9913
|
+
if (value2 === void 0) usage13("Accessibility option requires a value.");
|
|
9693
9914
|
if (argument === "--decorative") {
|
|
9694
|
-
if (value2 !== "true" && value2 !== "false")
|
|
9915
|
+
if (value2 !== "true" && value2 !== "false") usage13("Decorative requires true or false.");
|
|
9695
9916
|
result.accessibilityEdit = { ...result.accessibilityEdit, decorative: value2 === "true" };
|
|
9696
9917
|
} else {
|
|
9697
9918
|
const key = argument === "--alt-text" ? "altText" : "title";
|
|
@@ -9700,10 +9921,10 @@ function parse(raw, maximum, output3) {
|
|
|
9700
9921
|
continue;
|
|
9701
9922
|
}
|
|
9702
9923
|
if (Object.hasOwn(metadataSchemas, operation) && ["--name", "--value", "--type", "--remove"].includes(argument)) {
|
|
9703
|
-
if (seen.has(argument))
|
|
9924
|
+
if (seen.has(argument)) usage13("Repeated option.");
|
|
9704
9925
|
seen.add(argument);
|
|
9705
9926
|
const value2 = args[++index];
|
|
9706
|
-
if (value2 === void 0)
|
|
9927
|
+
if (value2 === void 0) usage13("Metadata option requires a value.");
|
|
9707
9928
|
if (argument === "--name") result.metadataName = value2;
|
|
9708
9929
|
else if (argument === "--value") result.metadataValue = value2;
|
|
9709
9930
|
else if (argument === "--type") result.metadataType = value2;
|
|
@@ -9711,49 +9932,49 @@ function parse(raw, maximum, output3) {
|
|
|
9711
9932
|
continue;
|
|
9712
9933
|
}
|
|
9713
9934
|
if (operation.startsWith("notes.") && argument === "--text") {
|
|
9714
|
-
if (seen.has(argument))
|
|
9935
|
+
if (seen.has(argument)) usage13("Repeated option.");
|
|
9715
9936
|
seen.add(argument);
|
|
9716
9937
|
const value2 = args[++index];
|
|
9717
|
-
if (value2 === void 0)
|
|
9938
|
+
if (value2 === void 0) usage13("Notes text requires a value.");
|
|
9718
9939
|
result.noteText = value2;
|
|
9719
9940
|
continue;
|
|
9720
9941
|
}
|
|
9721
9942
|
if (operation.startsWith("links.") && ["--url", "--target-slide", "--action", "--trigger", "--sanitize", "--path"].includes(argument)) {
|
|
9722
|
-
if (seen.has(argument))
|
|
9943
|
+
if (seen.has(argument)) usage13("Repeated option.");
|
|
9723
9944
|
seen.add(argument);
|
|
9724
9945
|
if (argument === "--sanitize") {
|
|
9725
9946
|
result.linkEdit = { ...result.linkEdit, sanitize: true };
|
|
9726
9947
|
continue;
|
|
9727
9948
|
}
|
|
9728
9949
|
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))
|
|
9950
|
+
if (value2 === void 0) usage13("Link option requires a value.");
|
|
9951
|
+
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
9952
|
const key = argument === "--target-slide" ? "targetSlide" : argument.slice(2);
|
|
9732
9953
|
result.linkEdit = { ...result.linkEdit, [key]: argument === "--target-slide" ? Number(value2) : argument === "--path" ? commandJson(value2) : value2 };
|
|
9733
9954
|
continue;
|
|
9734
9955
|
}
|
|
9735
9956
|
if (operation.startsWith("transitions.") && ["--kind", "--direction", "--duration", "--advance-after", "--advance-on-click"].includes(argument)) {
|
|
9736
|
-
if (seen.has(argument))
|
|
9957
|
+
if (seen.has(argument)) usage13("Repeated option.");
|
|
9737
9958
|
seen.add(argument);
|
|
9738
9959
|
const value2 = args[++index];
|
|
9739
|
-
if (value2 === void 0)
|
|
9960
|
+
if (value2 === void 0) usage13("Transition option requires a value.");
|
|
9740
9961
|
let parsed = value2;
|
|
9741
9962
|
if (argument === "--duration" || argument === "--advance-after") {
|
|
9742
9963
|
if (argument === "--advance-after" && value2 === "null") parsed = null;
|
|
9743
9964
|
else {
|
|
9744
|
-
if (!value2.length || [...value2].some((character) => character < "0" || character > "9"))
|
|
9965
|
+
if (!value2.length || [...value2].some((character) => character < "0" || character > "9")) usage13("Timing requires integer milliseconds.");
|
|
9745
9966
|
parsed = Number(value2);
|
|
9746
9967
|
}
|
|
9747
9968
|
}
|
|
9748
9969
|
if (argument === "--advance-on-click") {
|
|
9749
|
-
if (value2 !== "true" && value2 !== "false")
|
|
9970
|
+
if (value2 !== "true" && value2 !== "false") usage13("Advance on click requires true or false.");
|
|
9750
9971
|
parsed = value2 === "true";
|
|
9751
9972
|
}
|
|
9752
9973
|
const key = argument === "--advance-after" ? "advanceAfter" : argument === "--advance-on-click" ? "advanceOnClick" : argument.slice(2);
|
|
9753
9974
|
result.transitionEdit = { ...result.transitionEdit, [key]: parsed };
|
|
9754
9975
|
continue;
|
|
9755
9976
|
}
|
|
9756
|
-
if (seen.has(argument) && argument !== "--limit")
|
|
9977
|
+
if (seen.has(argument) && argument !== "--limit") usage13("Repeated option.");
|
|
9757
9978
|
seen.add(argument);
|
|
9758
9979
|
if (argument === "--json") {
|
|
9759
9980
|
result.json = true;
|
|
@@ -9761,7 +9982,7 @@ function parse(raw, maximum, output3) {
|
|
|
9761
9982
|
}
|
|
9762
9983
|
if (argument === "--unique") {
|
|
9763
9984
|
if (!["images.list", "images.extract"].includes(operation))
|
|
9764
|
-
|
|
9985
|
+
usage13("Unique requires images list or extract.");
|
|
9765
9986
|
result.unique = true;
|
|
9766
9987
|
continue;
|
|
9767
9988
|
}
|
|
@@ -9774,7 +9995,7 @@ function parse(raw, maximum, output3) {
|
|
|
9774
9995
|
continue;
|
|
9775
9996
|
}
|
|
9776
9997
|
if (argument === "--shared") {
|
|
9777
|
-
if (operation !== "images.replace")
|
|
9998
|
+
if (operation !== "images.replace") usage13("Shared requires images replace.");
|
|
9778
9999
|
result.imageReplace = { ...result.imageReplace, shared: true };
|
|
9779
10000
|
continue;
|
|
9780
10001
|
}
|
|
@@ -9791,12 +10012,12 @@ function parse(raw, maximum, output3) {
|
|
|
9791
10012
|
}
|
|
9792
10013
|
if (argument === "--allow-partial-output") {
|
|
9793
10014
|
if (!["extract", "slides.split", "images.extract", "media.extract", "objects.extract"].includes(operation))
|
|
9794
|
-
|
|
10015
|
+
usage13("Partial output requires a multi-file operation.");
|
|
9795
10016
|
result.allowPartialOutput = true;
|
|
9796
10017
|
continue;
|
|
9797
10018
|
}
|
|
9798
10019
|
if (argument === "--first") {
|
|
9799
|
-
if (operation !== "text.replace")
|
|
10020
|
+
if (operation !== "text.replace") usage13("First requires text replace.");
|
|
9800
10021
|
result.first = true;
|
|
9801
10022
|
continue;
|
|
9802
10023
|
}
|
|
@@ -9804,7 +10025,7 @@ function parse(raw, maximum, output3) {
|
|
|
9804
10025
|
result.all = true;
|
|
9805
10026
|
continue;
|
|
9806
10027
|
}
|
|
9807
|
-
if (!scalarOptions.includes(argument))
|
|
10028
|
+
if (!scalarOptions.includes(argument)) usage13("Unsupported option.");
|
|
9808
10029
|
const booleanValueOptions = [
|
|
9809
10030
|
"--preserve-geometry",
|
|
9810
10031
|
"--preserve-crop",
|
|
@@ -9829,9 +10050,9 @@ function parse(raw, maximum, output3) {
|
|
|
9829
10050
|
"--matching-name",
|
|
9830
10051
|
"--with"
|
|
9831
10052
|
].includes(argument))
|
|
9832
|
-
|
|
10053
|
+
usage13("Missing option value.");
|
|
9833
10054
|
if (["--data-json", "--data-file"].includes(argument)) {
|
|
9834
|
-
if (operation !== "template.apply")
|
|
10055
|
+
if (operation !== "template.apply") usage13("Binding sources require template apply.");
|
|
9835
10056
|
if (argument === "--data-file") result.dataFile = value;
|
|
9836
10057
|
else {
|
|
9837
10058
|
const bindings = commandJson(value);
|
|
@@ -9842,7 +10063,7 @@ function parse(raw, maximum, output3) {
|
|
|
9842
10063
|
}
|
|
9843
10064
|
if (operation === "objects.add" && ["--icon", "--icon-content-type", "--program", "--program-id", "--name", "--left", "--top", "--width", "--height", "--icon-width", "--icon-height"].includes(argument)) {
|
|
9844
10065
|
if (argument === "--program") {
|
|
9845
|
-
if (!Object.hasOwn(PROG_ID, value))
|
|
10066
|
+
if (!Object.hasOwn(PROG_ID, value)) usage13("Unknown registered program.");
|
|
9846
10067
|
result.objectAdd = { ...result.objectAdd, progId: PROG_ID[value] };
|
|
9847
10068
|
} else if (argument === "--icon") result.icon = value;
|
|
9848
10069
|
else if (argument === "--icon-content-type") result.iconContentType = value;
|
|
@@ -9858,10 +10079,10 @@ function parse(raw, maximum, output3) {
|
|
|
9858
10079
|
else if (argument === "--poster-content-type") result.posterContentType = value;
|
|
9859
10080
|
else {
|
|
9860
10081
|
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))
|
|
10082
|
+
if (key === "kind" && !["audio", "video"].includes(value)) usage13("Media kind requires audio or video.");
|
|
10083
|
+
if (key === "loop" && !["true", "false"].includes(value)) usage13("Loop requires true or false.");
|
|
9863
10084
|
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))
|
|
10085
|
+
if (typeof parsed === "number" && !Number.isFinite(parsed)) usage13("Media values must be finite.");
|
|
9865
10086
|
result.mediaEdit = { ...result.mediaEdit, [key]: parsed };
|
|
9866
10087
|
}
|
|
9867
10088
|
continue;
|
|
@@ -9870,13 +10091,13 @@ function parse(raw, maximum, output3) {
|
|
|
9870
10091
|
const key = argument.slice(2).split("-").map((part, i) => i ? part[0].toUpperCase() + part.slice(1) : part).join("");
|
|
9871
10092
|
let parsed = value;
|
|
9872
10093
|
if (key === "flipHorizontal" || key === "flipVertical") {
|
|
9873
|
-
if (value !== "true" && value !== "false")
|
|
10094
|
+
if (value !== "true" && value !== "false") usage13("Picture flips require true or false.");
|
|
9874
10095
|
parsed = value === "true";
|
|
9875
10096
|
} else if (key === "borderWidth") parsed = commandLength(value, 0);
|
|
9876
10097
|
else if (key !== "borderColor" && key !== "altText") {
|
|
9877
10098
|
parsed = Number(value);
|
|
9878
10099
|
if (!value.trim() || !Number.isFinite(parsed))
|
|
9879
|
-
|
|
10100
|
+
usage13("Picture values must be finite numbers.");
|
|
9880
10101
|
}
|
|
9881
10102
|
result.imageSet = { ...result.imageSet, [key]: parsed };
|
|
9882
10103
|
continue;
|
|
@@ -9890,9 +10111,9 @@ function parse(raw, maximum, output3) {
|
|
|
9890
10111
|
].includes(argument)) {
|
|
9891
10112
|
const key = argument.slice(2).split("-").map((part, i) => i ? part[0].toUpperCase() + part.slice(1) : part).join("");
|
|
9892
10113
|
if (key === "contentType" && !["image/png", "image/jpeg", "image/gif", "image/bmp", "image/tiff", "image/x-wmf"].includes(value))
|
|
9893
|
-
|
|
10114
|
+
usage13("Unsupported image content type.");
|
|
9894
10115
|
if (argument.startsWith("--preserve-") && value !== "true" && value !== "false")
|
|
9895
|
-
|
|
10116
|
+
usage13("Image preservation requires true or false.");
|
|
9896
10117
|
result.imageReplace = {
|
|
9897
10118
|
...result.imageReplace,
|
|
9898
10119
|
[key]: argument.startsWith("--preserve-") ? value === "true" : value
|
|
@@ -9904,18 +10125,18 @@ function parse(raw, maximum, output3) {
|
|
|
9904
10125
|
)) {
|
|
9905
10126
|
const key = argument === "--content-type" ? "contentType" : argument === "--alt-text" ? "altText" : argument.slice(2);
|
|
9906
10127
|
if (key === "fit" && !["contain", "cover", "stretch"].includes(value))
|
|
9907
|
-
|
|
10128
|
+
usage13("Invalid image fit.");
|
|
9908
10129
|
if (key === "contentType" && !["image/png", "image/jpeg", "image/gif", "image/bmp", "image/tiff", "image/x-wmf"].includes(value))
|
|
9909
|
-
|
|
10130
|
+
usage13("Unsupported image content type.");
|
|
9910
10131
|
const parsed = ["left", "top", "width", "height"].includes(key) ? commandLength(value, key === "left" || key === "top" ? -27273042316900 : 1) : value;
|
|
9911
10132
|
result.imageAdd = { ...result.imageAdd, [key]: parsed };
|
|
9912
10133
|
continue;
|
|
9913
10134
|
}
|
|
9914
10135
|
if (argument === "--image") {
|
|
9915
10136
|
if (operation !== "images.list" && operation !== "images.extract" && operation !== "images.replace" && operation !== "images.set")
|
|
9916
|
-
|
|
10137
|
+
usage13("Image selection requires images list, extract, replace or set.");
|
|
9917
10138
|
if (!value.length || [...value].some((c) => c < "0" || c > "9") || !Number.isSafeInteger(Number(value)) || Number(value) < 1)
|
|
9918
|
-
|
|
10139
|
+
usage13("Image positions require positive integers.");
|
|
9919
10140
|
result.image = Number(value);
|
|
9920
10141
|
continue;
|
|
9921
10142
|
}
|
|
@@ -9926,17 +10147,17 @@ function parse(raw, maximum, output3) {
|
|
|
9926
10147
|
try {
|
|
9927
10148
|
parsed = admitFontMetrics(JSON.parse(value));
|
|
9928
10149
|
} catch (error) {
|
|
9929
|
-
if (error instanceof
|
|
9930
|
-
|
|
10150
|
+
if (error instanceof OfficeError19) throw error;
|
|
10151
|
+
usage13("Metrics require a valid JSON metric object.");
|
|
9931
10152
|
}
|
|
9932
10153
|
} else if (["bold", "italic", "wrap"].includes(key)) {
|
|
9933
|
-
if (!["true", "false"].includes(value))
|
|
10154
|
+
if (!["true", "false"].includes(value)) usage13("Text fit switches require true or false.");
|
|
9934
10155
|
parsed = value === "true";
|
|
9935
10156
|
} else if (key.startsWith("margin")) parsed = commandLength(value) / 12700;
|
|
9936
10157
|
else if (key !== "fontFamily") {
|
|
9937
10158
|
const pieces = value.split(".");
|
|
9938
10159
|
if (pieces.length > 2 || pieces.some((p) => !p || [...p].some((c) => c < "0" || c > "9")))
|
|
9939
|
-
|
|
10160
|
+
usage13("Text fit sizes and spacing require decimal numbers.");
|
|
9940
10161
|
parsed = Number(value);
|
|
9941
10162
|
}
|
|
9942
10163
|
result.fitEdit = { ...result.fitEdit, [key]: parsed };
|
|
@@ -9948,13 +10169,13 @@ function parse(raw, maximum, output3) {
|
|
|
9948
10169
|
if (value === "null" && key !== "text") parsed = null;
|
|
9949
10170
|
else if (key.startsWith("margin")) parsed = commandLength(value, -2147483648) / 12700;
|
|
9950
10171
|
else if (key === "wrap") {
|
|
9951
|
-
if (!["true", "false"].includes(value))
|
|
10172
|
+
if (!["true", "false"].includes(value)) usage13("Wrap requires true, false or null.");
|
|
9952
10173
|
parsed = value === "true";
|
|
9953
10174
|
} else if (key === "columns" || key === "rotation") {
|
|
9954
10175
|
const digits = key === "rotation" && value.startsWith("-") ? value.slice(1) : value;
|
|
9955
10176
|
const pieces = digits.split(".");
|
|
9956
10177
|
if (pieces.length > (key === "columns" ? 1 : 2) || pieces.some((piece) => !piece || [...piece].some((c) => c < "0" || c > "9")) || !Number.isFinite(Number(value)))
|
|
9957
|
-
|
|
10178
|
+
usage13("Columns require an integer; rotation requires finite decimal degrees.");
|
|
9958
10179
|
parsed = Number(value);
|
|
9959
10180
|
}
|
|
9960
10181
|
result.frameEdit = { ...result.frameEdit, [key]: parsed };
|
|
@@ -9964,12 +10185,12 @@ function parse(raw, maximum, output3) {
|
|
|
9964
10185
|
let key = argument.slice(2).split("-").map((part, index2) => index2 ? part[0].toUpperCase() + part.slice(1) : part).join("");
|
|
9965
10186
|
let parsed = value;
|
|
9966
10187
|
if (key === "direction") {
|
|
9967
|
-
if (seen.has("--rtl"))
|
|
9968
|
-
if (!["ltr", "rtl", "null"].includes(value))
|
|
10188
|
+
if (seen.has("--rtl")) usage13("Direction and RTL cannot be combined.");
|
|
10189
|
+
if (!["ltr", "rtl", "null"].includes(value)) usage13("Direction requires ltr, rtl or null.");
|
|
9969
10190
|
key = "rtl";
|
|
9970
10191
|
parsed = value === "null" ? null : value === "rtl";
|
|
9971
10192
|
} else if (key === "numbering") {
|
|
9972
|
-
if (seen.has("--bullet"))
|
|
10193
|
+
if (seen.has("--bullet")) usage13("Bullet and numbering cannot be combined.");
|
|
9973
10194
|
const schemes = {
|
|
9974
10195
|
decimal: "arabicPeriod",
|
|
9975
10196
|
"lower-alpha": "alphaLcPeriod",
|
|
@@ -9978,7 +10199,7 @@ function parse(raw, maximum, output3) {
|
|
|
9978
10199
|
"upper-roman": "romanUcPeriod"
|
|
9979
10200
|
};
|
|
9980
10201
|
if (!Object.hasOwn(schemes, value) && !["none", "null"].includes(value))
|
|
9981
|
-
|
|
10202
|
+
usage13("Unsupported numbering style.");
|
|
9982
10203
|
key = "bullet";
|
|
9983
10204
|
parsed = value === "null" ? null : value === "none" ? { kind: "none" } : { kind: "numbered", scheme: schemes[value] };
|
|
9984
10205
|
} else if (value === "null" && key !== "paragraph") parsed = null;
|
|
@@ -9992,11 +10213,11 @@ function parse(raw, maximum, output3) {
|
|
|
9992
10213
|
].includes(key))
|
|
9993
10214
|
parsed = commandLength(value, key === "indent" ? -Number.MAX_SAFE_INTEGER : 0) / 12700;
|
|
9994
10215
|
else if (key === "rtl") {
|
|
9995
|
-
if (!["true", "false"].includes(value))
|
|
10216
|
+
if (!["true", "false"].includes(value)) usage13("RTL requires true, false or null.");
|
|
9996
10217
|
parsed = value === "true";
|
|
9997
10218
|
} else if (["paragraph", "level"].includes(key)) {
|
|
9998
10219
|
if (![...value].every((c) => c >= "0" && c <= "9") || !Number.isSafeInteger(Number(value)) || key === "paragraph" && Number(value) < 1)
|
|
9999
|
-
|
|
10220
|
+
usage13("Invalid paragraph position or level.");
|
|
10000
10221
|
parsed = Number(value) - (key === "paragraph" ? 1 : 0);
|
|
10001
10222
|
} else if (key === "lineSpacing") {
|
|
10002
10223
|
const pieces = value.split(".");
|
|
@@ -10008,7 +10229,7 @@ function parse(raw, maximum, output3) {
|
|
|
10008
10229
|
parsed = value.startsWith("{") ? commandJson(value) : { kind: "character", character: value };
|
|
10009
10230
|
else if (key === "tabs") {
|
|
10010
10231
|
const tabs = commandJson(value);
|
|
10011
|
-
if (!Array.isArray(tabs))
|
|
10232
|
+
if (!Array.isArray(tabs)) usage13("Tabs require an array or null.");
|
|
10012
10233
|
parsed = tabs.map((tab) => {
|
|
10013
10234
|
if (tab && typeof tab === "object" && "unit" in tab) {
|
|
10014
10235
|
const record3 = tab;
|
|
@@ -10021,7 +10242,7 @@ function parse(raw, maximum, output3) {
|
|
|
10021
10242
|
const aligned = tab;
|
|
10022
10243
|
const length4 = tab.position;
|
|
10023
10244
|
if (Object.keys(aligned).some((key2) => !["position", "alignment"].includes(key2)))
|
|
10024
|
-
|
|
10245
|
+
usage13("Tabs require finite explicit lengths.");
|
|
10025
10246
|
return {
|
|
10026
10247
|
position: paragraphTabLength(length4),
|
|
10027
10248
|
alignment: aligned.alignment
|
|
@@ -10031,9 +10252,9 @@ function parse(raw, maximum, output3) {
|
|
|
10031
10252
|
});
|
|
10032
10253
|
}
|
|
10033
10254
|
if (argument === "--rtl" && seen.has("--direction"))
|
|
10034
|
-
|
|
10255
|
+
usage13("Direction and RTL cannot be combined.");
|
|
10035
10256
|
if (argument === "--bullet" && seen.has("--numbering"))
|
|
10036
|
-
|
|
10257
|
+
usage13("Bullet and numbering cannot be combined.");
|
|
10037
10258
|
result.paragraphEdit = { ...result.paragraphEdit, [key]: parsed };
|
|
10038
10259
|
continue;
|
|
10039
10260
|
}
|
|
@@ -10044,20 +10265,20 @@ function parse(raw, maximum, output3) {
|
|
|
10044
10265
|
else if (["complexScriptCharset", "complexScriptPitchFamily"].includes(key)) {
|
|
10045
10266
|
const digits = value.startsWith("-") ? value.slice(1) : value;
|
|
10046
10267
|
if (!digits || [...digits].some((c) => c < "0" || c > "9") || !Number.isSafeInteger(Number(value)))
|
|
10047
|
-
|
|
10268
|
+
usage13("Font classification requires an integer or null.");
|
|
10048
10269
|
parsed = Number(value);
|
|
10049
10270
|
} else if (["size", "spacing"].includes(key))
|
|
10050
10271
|
parsed = commandLength(value, key === "spacing" ? -Number.MAX_SAFE_INTEGER : 1) / 12700;
|
|
10051
10272
|
else if (["bold", "italic", "rtl"].includes(key)) {
|
|
10052
|
-
if (!["true", "false"].includes(value))
|
|
10273
|
+
if (!["true", "false"].includes(value)) usage13("Emphasis requires true, false or null.");
|
|
10053
10274
|
parsed = value === "true";
|
|
10054
10275
|
} else if (["paragraph", "run"].includes(key)) {
|
|
10055
10276
|
if (![...value].every((c) => c >= "0" && c <= "9") || !Number.isSafeInteger(Number(value)) || Number(value) < 1)
|
|
10056
|
-
|
|
10277
|
+
usage13("Text positions require positive one-based integers.");
|
|
10057
10278
|
parsed = Number(value) - 1;
|
|
10058
10279
|
} else if (key === "baseline") {
|
|
10059
10280
|
if (!value.trim() || !Number.isFinite(Number(value)))
|
|
10060
|
-
|
|
10281
|
+
usage13("Baseline requires a finite percentage.");
|
|
10061
10282
|
parsed = Number(value);
|
|
10062
10283
|
} else if (["color", "highlight"].includes(key) && value.startsWith("{"))
|
|
10063
10284
|
parsed = commandJson(value);
|
|
@@ -10068,20 +10289,20 @@ function parse(raw, maximum, output3) {
|
|
|
10068
10289
|
continue;
|
|
10069
10290
|
}
|
|
10070
10291
|
if (argument === "--style-json") {
|
|
10071
|
-
if (operation !== "text.replace")
|
|
10292
|
+
if (operation !== "text.replace") usage13("Style override requires text replace.");
|
|
10072
10293
|
const style = commandJson(value);
|
|
10073
10294
|
if (!style || typeof style !== "object" || Array.isArray(style) || Object.keys(style).length === 0 || Object.entries(style).some(
|
|
10074
10295
|
([key, field]) => !["bold", "italic"].includes(key) || typeof field !== "boolean"
|
|
10075
10296
|
))
|
|
10076
|
-
|
|
10297
|
+
usage13("Style requires explicit bold or italic boolean values.");
|
|
10077
10298
|
result.style = style;
|
|
10078
10299
|
continue;
|
|
10079
10300
|
}
|
|
10080
10301
|
if (["--find", "--with", "--occurrence"].includes(argument)) {
|
|
10081
|
-
if (operation !== "text.replace")
|
|
10302
|
+
if (operation !== "text.replace") usage13("Match options require text replace.");
|
|
10082
10303
|
if (argument === "--occurrence") {
|
|
10083
10304
|
if (![...value].every((c) => c >= "0" && c <= "9") || !Number.isSafeInteger(Number(value)) || Number(value) < 1)
|
|
10084
|
-
|
|
10305
|
+
usage13("Occurrence must be a positive integer.");
|
|
10085
10306
|
result.occurrence = Number(value);
|
|
10086
10307
|
} else if (argument === "--find") result.find = value;
|
|
10087
10308
|
else result.with = value;
|
|
@@ -10098,7 +10319,7 @@ function parse(raw, maximum, output3) {
|
|
|
10098
10319
|
].includes(argument)) {
|
|
10099
10320
|
const key = argument === "--placeholder-policy" ? "placeholderPolicy" : argument === "--show-master-shapes" ? "showMasterShapes" : argument === "--matching-name" ? "matchingName" : argument === "--placeholders-json" ? "placeholders" : argument.slice(2);
|
|
10100
10321
|
if (["preserve", "showMasterShapes"].includes(key) && !["true", "false"].includes(value))
|
|
10101
|
-
|
|
10322
|
+
usage13("Expected true or false.");
|
|
10102
10323
|
result.layoutEdit = {
|
|
10103
10324
|
...result.layoutEdit,
|
|
10104
10325
|
[key]: key === "placeholders" ? commandJson(value) : ["preserve", "showMasterShapes"].includes(key) ? value === "true" : value
|
|
@@ -10137,18 +10358,18 @@ function parse(raw, maximum, output3) {
|
|
|
10137
10358
|
}
|
|
10138
10359
|
if (operation === "shapes.drawing.set" && ["--fill", "--line", "--shadow-inherit"].includes(argument)) {
|
|
10139
10360
|
if (argument === "--shadow-inherit" && !["true", "false"].includes(value))
|
|
10140
|
-
|
|
10361
|
+
usage13("Shadow inheritance requires true or false.");
|
|
10141
10362
|
const key = argument === "--shadow-inherit" ? "shadowInherit" : argument.slice(2);
|
|
10142
10363
|
result.drawingEdit = { ...result.drawingEdit, [key]: commandJson(value) };
|
|
10143
10364
|
continue;
|
|
10144
10365
|
}
|
|
10145
10366
|
if (operation === "shapes.effects.set" && ["--shadow", "--opacity", "--shadow-blur", "--shadow-color"].includes(argument)) {
|
|
10146
10367
|
if (argument === "--shadow") {
|
|
10147
|
-
if (!["true", "false"].includes(value))
|
|
10368
|
+
if (!["true", "false"].includes(value)) usage13("Shadow requires true or false.");
|
|
10148
10369
|
result.shadowEnabled = value === "true";
|
|
10149
10370
|
} else if (argument === "--opacity") {
|
|
10150
10371
|
if (!value.trim() || !Number.isFinite(Number(value)) || Number(value) < 0 || Number(value) > 1)
|
|
10151
|
-
|
|
10372
|
+
usage13("Opacity requires a ratio from zero to one.");
|
|
10152
10373
|
result.shadowOpacity = Number(value);
|
|
10153
10374
|
} else if (argument === "--shadow-blur")
|
|
10154
10375
|
result.shadowBlur = { value: commandLength(value, 0), unit: "emu" };
|
|
@@ -10157,7 +10378,7 @@ function parse(raw, maximum, output3) {
|
|
|
10157
10378
|
continue;
|
|
10158
10379
|
}
|
|
10159
10380
|
if (operation.startsWith("shapes.paths.") && argument === "--close") {
|
|
10160
|
-
if (!["true", "false"].includes(value))
|
|
10381
|
+
if (!["true", "false"].includes(value)) usage13("Close requires true or false.");
|
|
10161
10382
|
result.close = value === "true";
|
|
10162
10383
|
continue;
|
|
10163
10384
|
}
|
|
@@ -10195,18 +10416,18 @@ function parse(raw, maximum, output3) {
|
|
|
10195
10416
|
value,
|
|
10196
10417
|
["left", "top"].includes(key) ? -27273042316900 : key === "lineWidth" ? 0 : 1
|
|
10197
10418
|
);
|
|
10198
|
-
if (Math.abs(length4) > 27273042316900)
|
|
10419
|
+
if (Math.abs(length4) > 27273042316900) usage13("Shape geometry exceeds DrawingML bounds.");
|
|
10199
10420
|
parsed = { value: length4, unit: "emu" };
|
|
10200
10421
|
} else if (key === "flipHorizontal" || key === "flipVertical") {
|
|
10201
|
-
if (!["true", "false"].includes(value))
|
|
10422
|
+
if (!["true", "false"].includes(value)) usage13("Flips require true or false.");
|
|
10202
10423
|
parsed = value === "true";
|
|
10203
10424
|
} else if (key === "locked") {
|
|
10204
10425
|
if (!["true", "false", "null"].includes(value))
|
|
10205
|
-
|
|
10426
|
+
usage13("Locked requires true, false or null.");
|
|
10206
10427
|
parsed = value === "null" ? null : value === "true";
|
|
10207
10428
|
} else if (key === "rotation") {
|
|
10208
10429
|
if (!value.trim() || !Number.isFinite(Number(value)))
|
|
10209
|
-
|
|
10430
|
+
usage13("Rotation requires finite degrees.");
|
|
10210
10431
|
parsed = Number(value);
|
|
10211
10432
|
} else if (key === "kind" && value.length && [...value].every((c) => c >= "0" && c <= "9"))
|
|
10212
10433
|
parsed = Number(value);
|
|
@@ -10244,7 +10465,7 @@ function parse(raw, maximum, output3) {
|
|
|
10244
10465
|
"--loop",
|
|
10245
10466
|
"--show-type"
|
|
10246
10467
|
].includes(argument) || operation === "settings.set" && ["--width", "--height"].includes(argument)) {
|
|
10247
|
-
if (operation !== "settings.set")
|
|
10468
|
+
if (operation !== "settings.set") usage13("Settings options require settings set.");
|
|
10248
10469
|
if (["--width", "--height", "--notes-width", "--notes-height"].includes(argument)) {
|
|
10249
10470
|
const key = argument === "--notes-width" ? "notesWidth" : argument === "--notes-height" ? "notesHeight" : argument.slice(2);
|
|
10250
10471
|
result.settings = {
|
|
@@ -10253,7 +10474,7 @@ function parse(raw, maximum, output3) {
|
|
|
10253
10474
|
};
|
|
10254
10475
|
} else if (argument === "--orientation" || argument === "--notes-orientation") {
|
|
10255
10476
|
if (value !== "portrait" && value !== "landscape")
|
|
10256
|
-
|
|
10477
|
+
usage13("Orientation requires portrait or landscape.");
|
|
10257
10478
|
result.settings = {
|
|
10258
10479
|
...result.settings,
|
|
10259
10480
|
[argument === "--orientation" ? "orientation" : "notesOrientation"]: value
|
|
@@ -10261,17 +10482,17 @@ function parse(raw, maximum, output3) {
|
|
|
10261
10482
|
} else if (argument === "--slide-number-start") {
|
|
10262
10483
|
const digits = value.startsWith("-") ? value.slice(1) : value;
|
|
10263
10484
|
if (!digits.length || ![...digits].every((c) => c >= "0" && c <= "9") || !Number.isSafeInteger(Number(value)))
|
|
10264
|
-
|
|
10485
|
+
usage13("Slide-number start requires a safe integer.");
|
|
10265
10486
|
result.settings = { ...result.settings, slideNumberStart: Number(value) };
|
|
10266
10487
|
} else if (argument === "--loop" || argument === "--scale-content") {
|
|
10267
|
-
if (value !== "true" && value !== "false")
|
|
10488
|
+
if (value !== "true" && value !== "false") usage13("Boolean settings require true or false.");
|
|
10268
10489
|
result.settings = {
|
|
10269
10490
|
...result.settings,
|
|
10270
10491
|
[argument === "--loop" ? "loop" : "scaleContent"]: value === "true"
|
|
10271
10492
|
};
|
|
10272
10493
|
} else {
|
|
10273
10494
|
if (value !== "speaker" && value !== "window" && value !== "kiosk")
|
|
10274
|
-
|
|
10495
|
+
usage13("Unknown show type.");
|
|
10275
10496
|
result.settings = { ...result.settings, showType: value };
|
|
10276
10497
|
}
|
|
10277
10498
|
continue;
|
|
@@ -10281,24 +10502,24 @@ function parse(raw, maximum, output3) {
|
|
|
10281
10502
|
else if (argument === "--slides") {
|
|
10282
10503
|
const slides = commandJson(value);
|
|
10283
10504
|
if (!Array.isArray(slides) || !slides.length || slides.some((item) => !Number.isSafeInteger(item) || item < 1) || new Set(slides).size !== slides.length)
|
|
10284
|
-
|
|
10505
|
+
usage13("Members require a nonempty array of unique one-based slide positions.");
|
|
10285
10506
|
result.membership = { ...result.membership, slides };
|
|
10286
10507
|
} else {
|
|
10287
10508
|
if (![...value].every((c) => c >= "0" && c <= "9") || !Number.isSafeInteger(Number(value)) || Number(value) < 1)
|
|
10288
|
-
|
|
10509
|
+
usage13("Section positions must be positive integers.");
|
|
10289
10510
|
result.membership = { ...result.membership, position: Number(value) };
|
|
10290
10511
|
}
|
|
10291
10512
|
continue;
|
|
10292
10513
|
}
|
|
10293
10514
|
if (argument === "--sources") {
|
|
10294
|
-
if (operation !== "slides.merge")
|
|
10515
|
+
if (operation !== "slides.merge") usage13("Sources require slides merge.");
|
|
10295
10516
|
const sources = commandJson(value);
|
|
10296
10517
|
if (!Array.isArray(sources) || !sources.length || sources.some(
|
|
10297
10518
|
(source3) => !source3 || typeof source3 !== "object" || Array.isArray(source3) || Object.keys(source3).length !== 1 || typeof source3.vfsPath !== "string" || !source3.vfsPath.length
|
|
10298
10519
|
))
|
|
10299
|
-
|
|
10520
|
+
usage13("Sources require a nonempty ordered array of scoped vfsPath inputs.");
|
|
10300
10521
|
const paths = sources.map((source3) => source3.vfsPath);
|
|
10301
|
-
if (new Set(paths).size !== paths.length)
|
|
10522
|
+
if (new Set(paths).size !== paths.length) usage13("Source inputs must be unique.");
|
|
10302
10523
|
result.sources = paths;
|
|
10303
10524
|
continue;
|
|
10304
10525
|
}
|
|
@@ -10306,57 +10527,57 @@ function parse(raw, maximum, output3) {
|
|
|
10306
10527
|
if (argument === "--manifest") result.manifest = value;
|
|
10307
10528
|
else {
|
|
10308
10529
|
const parts = commandJson(value);
|
|
10309
|
-
if (!Array.isArray(parts) || parts.some((part) => typeof part !== "string"))
|
|
10530
|
+
if (!Array.isArray(parts) || parts.some((part) => typeof part !== "string")) usage13("Parts require a string array.");
|
|
10310
10531
|
result.parts = parts;
|
|
10311
10532
|
}
|
|
10312
10533
|
continue;
|
|
10313
10534
|
}
|
|
10314
10535
|
if (argument === "--sha256") {
|
|
10315
10536
|
if (operation !== "images.extract" || value.length !== 64 || !Array.from(value).every((character) => "0123456789abcdef".includes(character)))
|
|
10316
|
-
|
|
10537
|
+
usage13("Image extraction requires a lowercase SHA256 hash.");
|
|
10317
10538
|
result.imageSha256 = value;
|
|
10318
10539
|
continue;
|
|
10319
10540
|
}
|
|
10320
10541
|
if (argument === "--output-dir" || argument === "--slides") {
|
|
10321
10542
|
if (operation !== "slides.split" && !(["extract", "images.extract", "media.extract", "objects.extract"].includes(operation) && argument === "--output-dir"))
|
|
10322
|
-
|
|
10543
|
+
usage13("Option requires a multi-file operation.");
|
|
10323
10544
|
if (argument === "--output-dir") result.outputDir = value;
|
|
10324
10545
|
else {
|
|
10325
10546
|
const positions = commandJson(value);
|
|
10326
10547
|
if (!Array.isArray(positions) || !positions.length || positions.some((position) => !Number.isSafeInteger(position) || position < 1) || new Set(positions).size !== positions.length)
|
|
10327
|
-
|
|
10548
|
+
usage13("Slides require a nonempty array of unique one-based positions.");
|
|
10328
10549
|
result.splitSlides = positions;
|
|
10329
10550
|
}
|
|
10330
10551
|
continue;
|
|
10331
10552
|
}
|
|
10332
10553
|
if (argument === "--reference-policy") {
|
|
10333
10554
|
if (operation !== "slides.remove" || value !== "remove")
|
|
10334
|
-
|
|
10555
|
+
usage13("Slide removal reference policy must be remove.");
|
|
10335
10556
|
result.referencePolicy = value;
|
|
10336
10557
|
continue;
|
|
10337
10558
|
}
|
|
10338
10559
|
if (argument === "--media-policy") {
|
|
10339
10560
|
if (operation !== "slides.duplicate" || !["shared-media", "isolated-instance"].includes(value))
|
|
10340
|
-
|
|
10561
|
+
usage13("Slide duplication media policy must be shared-media or isolated-instance.");
|
|
10341
10562
|
result.copyMediaPolicy = value;
|
|
10342
10563
|
continue;
|
|
10343
10564
|
}
|
|
10344
10565
|
if (["--source", "--source-slides", "--theme-policy", "--dimension-policy"].includes(argument)) {
|
|
10345
10566
|
if (operation !== "slides.import" && operation !== "slides.merge")
|
|
10346
|
-
|
|
10567
|
+
usage13("Option requires slides import or merge.");
|
|
10347
10568
|
if (operation === "slides.merge" && argument === "--source")
|
|
10348
|
-
|
|
10569
|
+
usage13("Merge requires --sources.");
|
|
10349
10570
|
if (argument === "--source") result.source = value;
|
|
10350
10571
|
else if (argument === "--source-slides") {
|
|
10351
10572
|
const positions = commandJson(value);
|
|
10352
10573
|
if (!Array.isArray(positions) || !positions.length || positions.some((position) => !Number.isSafeInteger(position) || position < 1) || new Set(positions).size !== positions.length)
|
|
10353
|
-
|
|
10574
|
+
usage13("Source slides require a nonempty array of unique one-based positions.");
|
|
10354
10575
|
result.importing = { ...result.importing, sourceSlides: positions };
|
|
10355
10576
|
} else if (argument === "--theme-policy") {
|
|
10356
|
-
if (value !== "source" && value !== "destination")
|
|
10577
|
+
if (value !== "source" && value !== "destination") usage13("Unknown theme policy.");
|
|
10357
10578
|
result.importing = { ...result.importing, themePolicy: value };
|
|
10358
10579
|
} else {
|
|
10359
|
-
if (value !== "reject" && value !== "destination")
|
|
10580
|
+
if (value !== "reject" && value !== "destination") usage13("Unknown dimension policy.");
|
|
10360
10581
|
result.importing = { ...result.importing, dimensionPolicy: value };
|
|
10361
10582
|
}
|
|
10362
10583
|
continue;
|
|
@@ -10374,7 +10595,7 @@ function parse(raw, maximum, output3) {
|
|
|
10374
10595
|
if (operation === "slides.import" || operation === "slides.duplicate" || operation === "slides.move" || operation === "slides.set") {
|
|
10375
10596
|
if (argument === "--position") {
|
|
10376
10597
|
if (![...value].every((character) => character >= "0" && character <= "9") || !Number.isSafeInteger(Number(value)) || Number(value) < 1)
|
|
10377
|
-
|
|
10598
|
+
usage13("Slide positions must be positive one-based integers.");
|
|
10378
10599
|
if (operation === "slides.import")
|
|
10379
10600
|
result.importing = { ...result.importing, position: Number(value) };
|
|
10380
10601
|
else result.mutation = { ...result.mutation, position: Number(value) };
|
|
@@ -10382,30 +10603,30 @@ function parse(raw, maximum, output3) {
|
|
|
10382
10603
|
result.mutation = { ...result.mutation, name: value };
|
|
10383
10604
|
else if (operation === "slides.set" && argument === "--hidden") {
|
|
10384
10605
|
if (value !== "true" && value !== "false")
|
|
10385
|
-
|
|
10606
|
+
usage13("Slide boolean options require true or false.");
|
|
10386
10607
|
result.mutation = { ...result.mutation, hidden: value === "true" };
|
|
10387
|
-
} else
|
|
10608
|
+
} else usage13("Option is unavailable for this slide operation.");
|
|
10388
10609
|
continue;
|
|
10389
10610
|
}
|
|
10390
|
-
if (operation !== "slides.add")
|
|
10611
|
+
if (operation !== "slides.add") usage13("Slide addition options require slides add.");
|
|
10391
10612
|
result.addition ??= {};
|
|
10392
10613
|
if (argument === "--position") {
|
|
10393
10614
|
if (![...value].every((character) => character >= "0" && character <= "9") || !Number.isSafeInteger(Number(value)) || Number(value) < 1)
|
|
10394
|
-
|
|
10615
|
+
usage13("Insertion positions must be positive one-based integers.");
|
|
10395
10616
|
result.addition = { ...result.addition, position: Number(value) };
|
|
10396
10617
|
} else if (argument === "--hidden" || argument === "--follow-master-background") {
|
|
10397
10618
|
if (value !== "true" && value !== "false")
|
|
10398
|
-
|
|
10619
|
+
usage13("Slide boolean options require true or false.");
|
|
10399
10620
|
result.addition = {
|
|
10400
10621
|
...result.addition,
|
|
10401
10622
|
[argument === "--hidden" ? "hidden" : "followMasterBackground"]: value === "true"
|
|
10402
10623
|
};
|
|
10403
10624
|
} else if (argument === "--placeholders-json") {
|
|
10404
10625
|
const placeholders = commandJson(value);
|
|
10405
|
-
if (!Array.isArray(placeholders))
|
|
10626
|
+
if (!Array.isArray(placeholders)) usage13("Placeholders require an array.");
|
|
10406
10627
|
for (const binding of placeholders) {
|
|
10407
10628
|
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
|
-
|
|
10629
|
+
usage13("Placeholder bindings require type, optional nonnegative index, and text.");
|
|
10409
10630
|
}
|
|
10410
10631
|
result.addition = { ...result.addition, placeholders };
|
|
10411
10632
|
} else result.addition = { ...result.addition, [argument.slice(2)]: value };
|
|
@@ -10422,16 +10643,16 @@ function parse(raw, maximum, output3) {
|
|
|
10422
10643
|
"--slides-json",
|
|
10423
10644
|
"--properties-json"
|
|
10424
10645
|
].includes(argument)) {
|
|
10425
|
-
if (operation !== "create" && operation !== "pack")
|
|
10646
|
+
if (operation !== "create" && operation !== "pack") usage13("Creation options require create or pack.");
|
|
10426
10647
|
result.creation ??= {};
|
|
10427
10648
|
if (argument === "--template") result.template = value;
|
|
10428
10649
|
else if (argument === "--width" || argument === "--height")
|
|
10429
10650
|
result.creation = { ...result.creation, [argument.slice(2)]: commandLength(value) };
|
|
10430
10651
|
else if (argument === "--kind") {
|
|
10431
|
-
if (!["pptx", "potx", "ppsx"].includes(value))
|
|
10652
|
+
if (!["pptx", "potx", "ppsx"].includes(value)) usage13("Unknown presentation kind.");
|
|
10432
10653
|
result.creation = { ...result.creation, kind: value };
|
|
10433
10654
|
} else if (argument === "--dialect") {
|
|
10434
|
-
if (!["strict", "transitional"].includes(value))
|
|
10655
|
+
if (!["strict", "transitional"].includes(value)) usage13("Unknown presentation dialect.");
|
|
10435
10656
|
result.creation = { ...result.creation, dialect: value };
|
|
10436
10657
|
} else if (argument === "--author") result.creation = { ...result.creation, author: value };
|
|
10437
10658
|
else if (argument === "--timestamp")
|
|
@@ -10439,7 +10660,7 @@ function parse(raw, maximum, output3) {
|
|
|
10439
10660
|
else if (argument === "--properties-json") {
|
|
10440
10661
|
const properties = commandJson(value);
|
|
10441
10662
|
if (!properties || typeof properties !== "object" || Array.isArray(properties))
|
|
10442
|
-
|
|
10663
|
+
usage13("Properties require an object.");
|
|
10443
10664
|
if (Object.keys(properties).some(
|
|
10444
10665
|
(key) => ![
|
|
10445
10666
|
"title",
|
|
@@ -10459,11 +10680,11 @@ function parse(raw, maximum, output3) {
|
|
|
10459
10680
|
"lastPrinted"
|
|
10460
10681
|
].includes(key)
|
|
10461
10682
|
))
|
|
10462
|
-
|
|
10683
|
+
usage13("Unknown creation property.");
|
|
10463
10684
|
for (const key of ["created", "modified", "lastPrinted"]) {
|
|
10464
10685
|
if (Object.hasOwn(properties, key)) {
|
|
10465
10686
|
const dates = properties;
|
|
10466
|
-
if (typeof dates[key] !== "string")
|
|
10687
|
+
if (typeof dates[key] !== "string") usage13("Property dates require UTC strings.");
|
|
10467
10688
|
dates[key] = commandTimestamp(dates[key]);
|
|
10468
10689
|
}
|
|
10469
10690
|
}
|
|
@@ -10485,36 +10706,36 @@ function parse(raw, maximum, output3) {
|
|
|
10485
10706
|
}
|
|
10486
10707
|
if (argument === "--selection-json") {
|
|
10487
10708
|
if (operation !== "slides.move" && operation !== "slides.set" && operation !== "slides.remove" && operation !== "slides.duplicate")
|
|
10488
|
-
|
|
10709
|
+
usage13("Selection JSON requires a supported slide mutation.");
|
|
10489
10710
|
const selection = commandJson(value);
|
|
10490
10711
|
if (!selection || typeof selection !== "object")
|
|
10491
|
-
|
|
10712
|
+
usage13("Selection JSON requires a query or nonempty query array.");
|
|
10492
10713
|
const queries = Array.isArray(selection) ? selection : [selection];
|
|
10493
|
-
if (!queries.length)
|
|
10714
|
+
if (!queries.length) usage13("Selection arrays must not be empty.");
|
|
10494
10715
|
for (const query of queries) {
|
|
10495
10716
|
if (!query || typeof query !== "object" || Array.isArray(query) || Object.keys(query).some(
|
|
10496
10717
|
(key) => !["kind", "scope", "owner", "position", "id", "name", "token", "all"].includes(key)
|
|
10497
10718
|
))
|
|
10498
|
-
|
|
10719
|
+
usage13("Invalid slide selection query.");
|
|
10499
10720
|
if (query.token !== void 0) {
|
|
10500
10721
|
if (typeof query.token !== "string" || Object.keys(query).some((key) => !["kind", "token"].includes(key)) || query.kind !== void 0 && query.kind !== "slide")
|
|
10501
|
-
|
|
10722
|
+
usage13("Invalid slide token query.");
|
|
10502
10723
|
decodeSelectionToken2(query.token);
|
|
10503
10724
|
continue;
|
|
10504
10725
|
}
|
|
10505
10726
|
if (query.kind !== "slide" || query.scope !== void 0 && query.scope !== "slides" || query.all !== void 0 && typeof query.all !== "boolean")
|
|
10506
|
-
|
|
10727
|
+
usage13("Selection queries must address slides.");
|
|
10507
10728
|
for (const key of ["id", "name", "owner"])
|
|
10508
10729
|
if (query[key] !== void 0 && (typeof query[key] !== "string" || key !== "name" && !query[key]))
|
|
10509
|
-
|
|
10730
|
+
usage13("Invalid slide selection value.");
|
|
10510
10731
|
if ([query.position, query.id, query.name].filter((item) => item !== void 0).length > 1)
|
|
10511
|
-
|
|
10732
|
+
usage13("Slide identity selectors cannot be combined.");
|
|
10512
10733
|
if (!query.all && query.position === void 0 && query.id === void 0 && query.name === void 0)
|
|
10513
|
-
|
|
10734
|
+
usage13("Slide selection requires an identity or all.");
|
|
10514
10735
|
if (query.position !== void 0) {
|
|
10515
10736
|
const position = query.position;
|
|
10516
10737
|
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
|
-
|
|
10738
|
+
usage13("Invalid slide selection coordinate.");
|
|
10518
10739
|
}
|
|
10519
10740
|
}
|
|
10520
10741
|
result.selection = selection;
|
|
@@ -10524,9 +10745,9 @@ function parse(raw, maximum, output3) {
|
|
|
10524
10745
|
const pieces = value.split("=");
|
|
10525
10746
|
const [name, digits] = pieces;
|
|
10526
10747
|
if (pieces.length !== 2 || !name || !digits || ![...digits].every((c) => c >= "0" && c <= "9") || !Number.isSafeInteger(Number(digits)) || Number(digits) < 1)
|
|
10527
|
-
|
|
10748
|
+
usage13("Limits require NAME=POSITIVE_INTEGER.");
|
|
10528
10749
|
result.limits ??= {};
|
|
10529
|
-
if (Object.hasOwn(result.limits, name))
|
|
10750
|
+
if (Object.hasOwn(result.limits, name)) usage13("Repeated limit name.");
|
|
10530
10751
|
if (![
|
|
10531
10752
|
"maxBytes",
|
|
10532
10753
|
"maxNodes",
|
|
@@ -10534,21 +10755,21 @@ function parse(raw, maximum, output3) {
|
|
|
10534
10755
|
"maxOutputBytes",
|
|
10535
10756
|
...["extract", "images.extract", "media.extract", "objects.extract"].includes(operation) ? ["maxOutputs"] : []
|
|
10536
10757
|
].includes(name))
|
|
10537
|
-
|
|
10758
|
+
usage13("Unknown limit name.");
|
|
10538
10759
|
result.limits[name] = Number(digits);
|
|
10539
10760
|
} else if (argument === "--placeholder") {
|
|
10540
|
-
if (!value.length || ![...value].every((c) => c >= "0" && c <= "9") || (!Number.isSafeInteger(Number(value)) || Number(value) > 4294967295))
|
|
10761
|
+
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
10762
|
result.placeholder = Number(value);
|
|
10542
10763
|
} else if (argument === "--slide") {
|
|
10543
10764
|
if (![...value].every((character) => character >= "0" && character <= "9") || !Number.isSafeInteger(Number(value)) || Number(value) < 1)
|
|
10544
|
-
|
|
10765
|
+
usage13("Slide positions must be positive one-based integers.");
|
|
10545
10766
|
result.slide = Number(value);
|
|
10546
10767
|
} else if (argument === "--shape") result.shape = value;
|
|
10547
10768
|
else if (argument === "--part") {
|
|
10548
10769
|
if (operation === "objects.list" || operation === "fonts.list")
|
|
10549
|
-
|
|
10770
|
+
usage13("Part selection requires object extraction.");
|
|
10550
10771
|
try {
|
|
10551
|
-
result.part =
|
|
10772
|
+
result.part = partName4(value, false);
|
|
10552
10773
|
} catch {
|
|
10553
10774
|
throw new SelectionError8("invalid-selection");
|
|
10554
10775
|
}
|
|
@@ -10556,7 +10777,7 @@ function parse(raw, maximum, output3) {
|
|
|
10556
10777
|
else if (argument === "--file") result.file = value;
|
|
10557
10778
|
else if (argument === "--output") result.output = value;
|
|
10558
10779
|
else {
|
|
10559
|
-
if (!scopes2.includes(value))
|
|
10780
|
+
if (!scopes2.includes(value)) usage13("Unknown scope.");
|
|
10560
10781
|
result.scope = value;
|
|
10561
10782
|
}
|
|
10562
10783
|
}
|
|
@@ -10580,42 +10801,42 @@ function parse(raw, maximum, output3) {
|
|
|
10580
10801
|
"--dry-run"
|
|
10581
10802
|
];
|
|
10582
10803
|
if ([...seen].some((option) => !allowed.includes(option)))
|
|
10583
|
-
|
|
10584
|
-
if (positionals.length !== 1 || !positionals[0])
|
|
10585
|
-
if (!result.imageSet)
|
|
10804
|
+
usage13("Option does not apply to images set.");
|
|
10805
|
+
if (positionals.length !== 1 || !positionals[0]) usage13("Image formatting requires one input.");
|
|
10806
|
+
if (!result.imageSet) usage13("Image formatting requires an update.");
|
|
10586
10807
|
if (result.scope === "presentation" || result.scope === "shared")
|
|
10587
|
-
|
|
10808
|
+
usage13("Image formatting requires an occurrence scope.");
|
|
10588
10809
|
if (result.token && ["--slide", "--image", "--scope", "--all"].some((option) => seen.has(option)))
|
|
10589
|
-
|
|
10810
|
+
usage13("Opaque and simple selectors cannot be combined.");
|
|
10590
10811
|
if (result.image !== void 0 && (!result.scope || result.scope === "slides") && result.slide === void 0)
|
|
10591
|
-
|
|
10812
|
+
usage13("Slide image selection requires a slide.");
|
|
10592
10813
|
result.input = positionals[0];
|
|
10593
10814
|
result.imageSet = {
|
|
10594
10815
|
...result.imageSet,
|
|
10595
10816
|
...result.all ? { all: true } : {},
|
|
10596
10817
|
...result.allowEmpty ? { allowEmpty: true } : {}
|
|
10597
10818
|
};
|
|
10598
|
-
if (result.inPlace && result.input === "-")
|
|
10599
|
-
if (result.inPlace && result.output)
|
|
10819
|
+
if (result.inPlace && result.input === "-") usage13("Stdin cannot be edited in place.");
|
|
10820
|
+
if (result.inPlace && result.output) usage13("Output and in-place cannot be combined.");
|
|
10600
10821
|
if (!result.dryRun && !result.inPlace && !result.output)
|
|
10601
|
-
|
|
10602
|
-
if (result.force && !result.output)
|
|
10822
|
+
usage13("Mutation requires a destination.");
|
|
10823
|
+
if (result.force && !result.output) usage13("Force requires an explicit output destination.");
|
|
10603
10824
|
if (result.output === result.input && result.output !== "-")
|
|
10604
|
-
|
|
10825
|
+
usage13("Replacing input requires --in-place.");
|
|
10605
10826
|
if (result.output === "-" && result.json && !result.dryRun)
|
|
10606
|
-
|
|
10827
|
+
usage13("Binary stdout cannot be combined with JSON.");
|
|
10607
10828
|
return result;
|
|
10608
10829
|
}
|
|
10609
10830
|
if (result.placeholder !== void 0) {
|
|
10610
10831
|
if (!["images.add", "tables.add", "charts.add"].includes(operation) || result.slide === void 0)
|
|
10611
|
-
|
|
10832
|
+
usage13("Placeholder insertion requires an add operation and --slide.");
|
|
10612
10833
|
if (["--left", "--top", "--width", "--height", "--fit"].some((flag) => seen.has(flag)))
|
|
10613
|
-
|
|
10614
|
-
if (operation === "tables.add" && (!result.tableEdit?.rows || !result.tableEdit?.columns))
|
|
10834
|
+
usage13("Placeholder insertion uses inherited geometry.");
|
|
10835
|
+
if (operation === "tables.add" && (!result.tableEdit?.rows || !result.tableEdit?.columns)) usage13("Table placeholder insertion requires rows and columns.");
|
|
10615
10836
|
if (operation === "tables.add" && Object.keys(result.tableEdit ?? {}).some((key) => !["rows", "columns"].includes(key)))
|
|
10616
|
-
|
|
10837
|
+
usage13("Table placeholder insertion accepts rows and columns.");
|
|
10617
10838
|
if (operation === "charts.add" && Object.keys(result.chartEdit ?? {}).some((key) => !["type", "data"].includes(key)))
|
|
10618
|
-
|
|
10839
|
+
usage13("Chart placeholder insertion accepts type and data.");
|
|
10619
10840
|
}
|
|
10620
10841
|
if (operation === "images.add" || operation === "images.replace") {
|
|
10621
10842
|
const replacing = operation === "images.replace";
|
|
@@ -10643,19 +10864,19 @@ function parse(raw, maximum, output3) {
|
|
|
10643
10864
|
"--dry-run"
|
|
10644
10865
|
];
|
|
10645
10866
|
if ([...seen].some((option) => !allowed.includes(option)))
|
|
10646
|
-
|
|
10867
|
+
usage13("Option does not apply to this image operation.");
|
|
10647
10868
|
if (positionals.length !== 1 || !positionals[0] || !replacing && result.slide === void 0 || !result.file)
|
|
10648
|
-
|
|
10869
|
+
usage13("Image mutation requires one input, selection and file.");
|
|
10649
10870
|
if (replacing) {
|
|
10650
|
-
if (result.scope === "presentation")
|
|
10871
|
+
if (result.scope === "presentation") usage13("Presentation scope has no image owners.");
|
|
10651
10872
|
if (result.scope === "shared" && !result.imageReplace?.shared)
|
|
10652
|
-
|
|
10873
|
+
usage13("Shared scope requires explicit shared replacement.");
|
|
10653
10874
|
if (result.token && ["--slide", "--image", "--scope", "--all"].some((option) => seen.has(option)))
|
|
10654
|
-
|
|
10875
|
+
usage13("Opaque and simple selectors cannot be combined.");
|
|
10655
10876
|
if (!result.token && result.image === void 0 && !result.all)
|
|
10656
|
-
|
|
10877
|
+
usage13("Image replacement requires an image selector or all.");
|
|
10657
10878
|
if (result.image !== void 0 && (!result.scope || result.scope === "slides") && result.slide === void 0)
|
|
10658
|
-
|
|
10879
|
+
usage13("Slide image selection requires a slide.");
|
|
10659
10880
|
result.imageReplace = {
|
|
10660
10881
|
...result.imageReplace,
|
|
10661
10882
|
...result.all ? { all: true } : {},
|
|
@@ -10664,28 +10885,28 @@ function parse(raw, maximum, output3) {
|
|
|
10664
10885
|
}
|
|
10665
10886
|
result.input = positionals[0];
|
|
10666
10887
|
if (result.input === "-" && result.file === "-")
|
|
10667
|
-
|
|
10888
|
+
usage13("Document and image cannot both use stdin.");
|
|
10668
10889
|
const imageOptions = replacing ? result.imageReplace : result.imageAdd;
|
|
10669
10890
|
if (!imageOptions?.contentType) {
|
|
10670
10891
|
const extension = result.file.slice(result.file.lastIndexOf(".") + 1).toLowerCase();
|
|
10671
10892
|
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
10893
|
if (!contentType)
|
|
10673
|
-
|
|
10894
|
+
usage13("Image file requires an explicit supported content type or extension.");
|
|
10674
10895
|
if (replacing) result.imageReplace = { ...result.imageReplace, contentType };
|
|
10675
10896
|
else result.imageAdd = { ...result.imageAdd, contentType };
|
|
10676
10897
|
}
|
|
10677
10898
|
const both = result.imageAdd?.width !== void 0 && result.imageAdd?.height !== void 0;
|
|
10678
10899
|
if (!replacing && !both && result.imageAdd?.fit !== void 0)
|
|
10679
|
-
|
|
10680
|
-
if (result.inPlace && result.input === "-")
|
|
10681
|
-
if (result.inPlace && result.output)
|
|
10900
|
+
usage13("Both dimensions and explicit fit must be supplied together.");
|
|
10901
|
+
if (result.inPlace && result.input === "-") usage13("Stdin cannot be edited in place.");
|
|
10902
|
+
if (result.inPlace && result.output) usage13("Output and in-place cannot be combined.");
|
|
10682
10903
|
if (!result.dryRun && !result.inPlace && !result.output)
|
|
10683
|
-
|
|
10684
|
-
if (result.force && !result.output)
|
|
10904
|
+
usage13("Mutation requires a destination.");
|
|
10905
|
+
if (result.force && !result.output) usage13("Force requires an explicit output destination.");
|
|
10685
10906
|
if (result.output === result.input && result.output !== "-")
|
|
10686
|
-
|
|
10907
|
+
usage13("Replacing input requires --in-place.");
|
|
10687
10908
|
if (result.output === "-" && result.json && !result.dryRun)
|
|
10688
|
-
|
|
10909
|
+
usage13("Binary stdout cannot be combined with JSON.");
|
|
10689
10910
|
return result;
|
|
10690
10911
|
}
|
|
10691
10912
|
if (["media.add", "media.replace", "media.extract"].includes(operation)) {
|
|
@@ -10695,9 +10916,9 @@ function parse(raw, maximum, output3) {
|
|
|
10695
10916
|
if (Object.hasOwn(mediaSchemas, operation)) {
|
|
10696
10917
|
const allowed = ["--json", "--limit", "--scope", "--slide", "--shape", "--select"];
|
|
10697
10918
|
if ([...seen].some((option) => !allowed.includes(option)))
|
|
10698
|
-
|
|
10919
|
+
usage13("Option does not apply to media inspection.");
|
|
10699
10920
|
if (positionals.length !== 1 || !positionals[0])
|
|
10700
|
-
|
|
10921
|
+
usage13("Media inspection requires exactly one input.");
|
|
10701
10922
|
if (result.scope !== void 0 && ![
|
|
10702
10923
|
"slides",
|
|
10703
10924
|
"layouts",
|
|
@@ -10707,11 +10928,11 @@ function parse(raw, maximum, output3) {
|
|
|
10707
10928
|
"handout-master",
|
|
10708
10929
|
"shared"
|
|
10709
10930
|
].includes(result.scope))
|
|
10710
|
-
|
|
10931
|
+
usage13("Unsupported media scope.");
|
|
10711
10932
|
if (result.token && ["--slide", "--shape", "--scope"].some((option) => seen.has(option)))
|
|
10712
|
-
|
|
10933
|
+
usage13("Opaque and simple selectors cannot be combined.");
|
|
10713
10934
|
if (result.shape !== void 0 && result.slide === void 0)
|
|
10714
|
-
|
|
10935
|
+
usage13("Shape selection requires an owning slide.");
|
|
10715
10936
|
result.input = positionals[0];
|
|
10716
10937
|
return result;
|
|
10717
10938
|
}
|
|
@@ -10760,47 +10981,47 @@ function parse(raw, maximum, output3) {
|
|
|
10760
10981
|
(key) => "--" + [...key].map((c) => c >= "A" && c <= "Z" ? "-" + c.toLowerCase() : c).join("")
|
|
10761
10982
|
);
|
|
10762
10983
|
if ([...seen].some((flag) => !allowed.includes(flag)))
|
|
10763
|
-
|
|
10984
|
+
usage13("Option does not apply to chart mutation.");
|
|
10764
10985
|
if (positionals.length !== 1 || !positionals[0])
|
|
10765
|
-
|
|
10986
|
+
usage13("Chart mutation requires exactly one input.");
|
|
10766
10987
|
result.input = positionals[0];
|
|
10767
10988
|
if (result.scope !== void 0 && result.scope !== "slides")
|
|
10768
|
-
|
|
10989
|
+
usage13("Chart mutation supports slides scope.");
|
|
10769
10990
|
if (result.token && ["--slide", "--shape", "--scope", "--all"].some((flag) => seen.has(flag)))
|
|
10770
|
-
|
|
10991
|
+
usage13("Opaque and simple selectors cannot be combined.");
|
|
10771
10992
|
const edit = result.chartEdit ?? {};
|
|
10772
10993
|
const { type, ...update } = edit;
|
|
10773
10994
|
validateChartUpdate(update);
|
|
10774
10995
|
if (operation === "charts.add") {
|
|
10775
10996
|
if (!result.slide || result.token || result.shape || result.all || result.allowEmpty)
|
|
10776
|
-
|
|
10997
|
+
usage13("Chart addition requires one slide.");
|
|
10777
10998
|
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
|
-
|
|
10999
|
+
usage13("Chart addition requires type, data and geometry.");
|
|
10779
11000
|
validateChartData(edit.data, type);
|
|
10780
|
-
} else if (!Object.keys(edit).length)
|
|
11001
|
+
} else if (!Object.keys(edit).length) usage13("Chart mutation requires an update.");
|
|
10781
11002
|
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)
|
|
11003
|
+
usage13("Chart replacement requires data and an explicit workbook policy.");
|
|
11004
|
+
if (result.inPlace && result.input === "-") usage13("Stdin cannot be edited in place.");
|
|
11005
|
+
if (result.output && result.inPlace) usage13("Output and in-place are mutually exclusive.");
|
|
10785
11006
|
if (!result.dryRun && !result.inPlace && !result.output)
|
|
10786
|
-
|
|
10787
|
-
if (result.force && !result.output)
|
|
11007
|
+
usage13("Mutation requires a destination.");
|
|
11008
|
+
if (result.force && !result.output) usage13("Force requires an explicit output destination.");
|
|
10788
11009
|
if (result.output === result.input && result.output !== "-")
|
|
10789
|
-
|
|
11010
|
+
usage13("Replacing input requires --in-place.");
|
|
10790
11011
|
if (result.output === "-" && result.json && !result.dryRun)
|
|
10791
|
-
|
|
11012
|
+
usage13("Binary stdout cannot be combined with JSON.");
|
|
10792
11013
|
return result;
|
|
10793
11014
|
}
|
|
10794
11015
|
if (operation === "charts.list" || operation === "charts.get") {
|
|
10795
11016
|
const allowed = ["--json", "--limit", "--scope", "--slide", "--shape", "--select"];
|
|
10796
11017
|
if ([...seen].some((option) => !allowed.includes(option)))
|
|
10797
|
-
|
|
11018
|
+
usage13("Option does not apply to chart inspection.");
|
|
10798
11019
|
if (positionals.length !== 1 || !positionals[0])
|
|
10799
|
-
|
|
11020
|
+
usage13("Chart inspection requires exactly one input.");
|
|
10800
11021
|
if (result.scope !== void 0 && result.scope !== "slides")
|
|
10801
|
-
|
|
11022
|
+
usage13("Chart inspection supports slides scope.");
|
|
10802
11023
|
if (result.token && ["--slide", "--shape", "--scope"].some((option) => seen.has(option)))
|
|
10803
|
-
|
|
11024
|
+
usage13("Opaque and simple selectors cannot be combined.");
|
|
10804
11025
|
result.input = positionals[0];
|
|
10805
11026
|
return result;
|
|
10806
11027
|
}
|
|
@@ -10817,33 +11038,33 @@ function parse(raw, maximum, output3) {
|
|
|
10817
11038
|
...extracting ? ["--sha256", "--output-dir", "--allow-partial-output", "--force", "--dry-run"] : []
|
|
10818
11039
|
];
|
|
10819
11040
|
if (extracting) {
|
|
10820
|
-
if (!result.outputDir && !result.dryRun)
|
|
10821
|
-
if (result.outputDir === "-")
|
|
10822
|
-
if (result.force && !result.outputDir)
|
|
11041
|
+
if (!result.outputDir && !result.dryRun) usage13("Image extraction requires --output-dir.");
|
|
11042
|
+
if (result.outputDir === "-") usage13("Output directories cannot be stdout.");
|
|
11043
|
+
if (result.force && !result.outputDir) usage13("Force requires an output directory.");
|
|
10823
11044
|
}
|
|
10824
11045
|
if ([...seen].some((option) => !allowed.includes(option)))
|
|
10825
|
-
|
|
11046
|
+
usage13("Option does not apply to images list.");
|
|
10826
11047
|
if (positionals.length !== 1 || !positionals[0])
|
|
10827
|
-
|
|
10828
|
-
if (result.scope === "presentation")
|
|
11048
|
+
usage13("Image inventory requires exactly one input.");
|
|
11049
|
+
if (result.scope === "presentation") usage13("Presentation scope has no image owners.");
|
|
10829
11050
|
if (result.token && ["--slide", "--image", "--scope"].some((option) => seen.has(option)))
|
|
10830
|
-
|
|
11051
|
+
usage13("Opaque and simple selectors cannot be combined.");
|
|
10831
11052
|
result.input = positionals[0];
|
|
10832
11053
|
return result;
|
|
10833
11054
|
}
|
|
10834
11055
|
if (operation === "batch") {
|
|
10835
11056
|
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))
|
|
11057
|
+
if ([...seen].some((flag) => !allowed.includes(flag))) usage13("Option does not apply to batch.");
|
|
11058
|
+
if (positionals.length !== 1 || !positionals[0]) usage13("Batch requires one input.");
|
|
11059
|
+
if (result.animationBatch !== void 0 === (result.opsFile !== void 0)) usage13("Batch requires exactly one operation source.");
|
|
10839
11060
|
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)
|
|
11061
|
+
if (result.input === "-" && result.opsFile === "-") usage13("Document and batch cannot both use stdin.");
|
|
11062
|
+
if (result.inPlace && result.input === "-") usage13("Stdin cannot be edited in place.");
|
|
11063
|
+
if (result.inPlace && result.output) usage13("Output and in-place cannot be combined.");
|
|
11064
|
+
if (result.animationBatch?.length && !result.dryRun && !result.inPlace && !result.output) usage13("Mutation requires a destination.");
|
|
11065
|
+
if (result.force && !result.output) usage13("Force requires an explicit output destination.");
|
|
11066
|
+
if (result.output === result.input && result.output !== "-") usage13("Replacing input requires --in-place.");
|
|
11067
|
+
if (result.output === "-" && result.json && !result.dryRun) usage13("Binary stdout cannot be combined with JSON.");
|
|
10847
11068
|
return result;
|
|
10848
11069
|
}
|
|
10849
11070
|
if (Object.hasOwn(animationSchemas, operation)) {
|
|
@@ -10859,21 +11080,21 @@ function parse(raw, maximum, output3) {
|
|
|
10859
11080
|
...mutation2 ? ["--all", "--allow-empty", "--output", "--in-place", "--force", "--dry-run"] : [],
|
|
10860
11081
|
...editing ? ["--kind", "--trigger", "--duration", "--delay", "--target"] : []
|
|
10861
11082
|
];
|
|
10862
|
-
if ([...seen].some((flag) => !allowed.includes(flag)))
|
|
10863
|
-
if (positionals.length !== 1 || !positionals[0])
|
|
11083
|
+
if ([...seen].some((flag) => !allowed.includes(flag))) usage13("Option does not apply to animations.");
|
|
11084
|
+
if (positionals.length !== 1 || !positionals[0]) usage13("Animations require one input.");
|
|
10864
11085
|
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)
|
|
11086
|
+
if (result.scope !== void 0 && result.scope !== "slides") usage13("Animations require slides scope.");
|
|
11087
|
+
if (result.token && ["--scope", "--slide", "--shape"].some((flag) => seen.has(flag))) usage13("Opaque and simple selectors cannot be combined.");
|
|
11088
|
+
if (result.shape !== void 0 && result.slide === void 0) usage13("Shape selection requires a slide.");
|
|
10868
11089
|
if (mutation2) {
|
|
10869
11090
|
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)
|
|
11091
|
+
if (operation !== "animations.add" && !result.token && result.slide === void 0 && !result.all) usage13("Animation mutation requires a selector or --all.");
|
|
11092
|
+
if (result.inPlace && result.input === "-") usage13("Stdin cannot be edited in place.");
|
|
11093
|
+
if (result.inPlace && result.output) usage13("Output and in-place cannot be combined.");
|
|
11094
|
+
if (!result.dryRun && !result.inPlace && !result.output) usage13("Mutation requires a destination.");
|
|
11095
|
+
if (result.force && !result.output) usage13("Force requires an explicit output destination.");
|
|
11096
|
+
if (result.output === result.input && result.output !== "-") usage13("Replacing input requires --in-place.");
|
|
11097
|
+
if (result.output === "-" && result.json && !result.dryRun) usage13("Binary stdout cannot be combined with JSON.");
|
|
10877
11098
|
}
|
|
10878
11099
|
return result;
|
|
10879
11100
|
}
|
|
@@ -10889,20 +11110,20 @@ function parse(raw, maximum, output3) {
|
|
|
10889
11110
|
...mutation2 ? ["--all", "--allow-empty", "--output", "--in-place", "--force", "--dry-run"] : [],
|
|
10890
11111
|
...editing ? ["--kind", "--direction", "--duration", "--advance-after", "--advance-on-click"] : []
|
|
10891
11112
|
];
|
|
10892
|
-
if ([...seen].some((flag) => !allowed.includes(flag)))
|
|
10893
|
-
if (positionals.length !== 1 || !positionals[0])
|
|
11113
|
+
if ([...seen].some((flag) => !allowed.includes(flag))) usage13("Option does not apply to transitions.");
|
|
11114
|
+
if (positionals.length !== 1 || !positionals[0]) usage13("Transitions require one input.");
|
|
10894
11115
|
result.input = positionals[0];
|
|
10895
|
-
if (result.scope !== void 0 && result.scope !== "slides")
|
|
10896
|
-
if (result.token && ["--scope", "--slide"].some((flag) => seen.has(flag)))
|
|
11116
|
+
if (result.scope !== void 0 && result.scope !== "slides") usage13("Transitions require slides scope.");
|
|
11117
|
+
if (result.token && ["--scope", "--slide"].some((flag) => seen.has(flag))) usage13("Opaque and simple selectors cannot be combined.");
|
|
10897
11118
|
if (mutation2) {
|
|
10898
11119
|
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)
|
|
11120
|
+
if (!result.token && result.slide === void 0 && !result.all) usage13("Transition mutation requires a selector or --all.");
|
|
11121
|
+
if (result.inPlace && result.input === "-") usage13("Stdin cannot be edited in place.");
|
|
11122
|
+
if (result.inPlace && result.output) usage13("Output and in-place cannot be combined.");
|
|
11123
|
+
if (!result.dryRun && !result.inPlace && !result.output) usage13("Mutation requires a destination.");
|
|
11124
|
+
if (result.force && !result.output) usage13("Force requires an explicit output destination.");
|
|
11125
|
+
if (result.output === result.input && result.output !== "-") usage13("Replacing input requires --in-place.");
|
|
11126
|
+
if (result.output === "-" && result.json && !result.dryRun) usage13("Binary stdout cannot be combined with JSON.");
|
|
10906
11127
|
}
|
|
10907
11128
|
return result;
|
|
10908
11129
|
}
|
|
@@ -10943,18 +11164,18 @@ function parse(raw, maximum, output3) {
|
|
|
10943
11164
|
if (formatting && [...seen].some(
|
|
10944
11165
|
(flag) => ["--style-json", "--find", "--with", "--first", "--occurrence"].includes(flag)
|
|
10945
11166
|
))
|
|
10946
|
-
|
|
11167
|
+
usage13("Match options do not apply to runs.");
|
|
10947
11168
|
if ([...seen].some((flag) => !allowed.includes(flag)))
|
|
10948
|
-
|
|
10949
|
-
if (positionals.length !== 1 || !positionals[0])
|
|
11169
|
+
usage13("Option does not apply to this text operation.");
|
|
11170
|
+
if (positionals.length !== 1 || !positionals[0]) usage13("Text operation requires one input.");
|
|
10950
11171
|
if (result.scope === "presentation" || result.scope === "shared")
|
|
10951
|
-
|
|
11172
|
+
usage13("Text operation requires a text-bearing scope.");
|
|
10952
11173
|
if (result.token && ["--scope", "--slide", "--shape", "--paragraph", "--run"].some((flag) => seen.has(flag)))
|
|
10953
|
-
|
|
11174
|
+
usage13("Opaque and simple selectors cannot be combined.");
|
|
10954
11175
|
if (result.slide !== void 0 && (result.scope === "notes-master" || result.scope === "handout-master"))
|
|
10955
|
-
|
|
11176
|
+
usage13("Deck-level text master scopes do not accept slide selection.");
|
|
10956
11177
|
if (result.shape && result.slide === void 0)
|
|
10957
|
-
|
|
11178
|
+
usage13("Shape selection requires an owning slide.");
|
|
10958
11179
|
result.input = positionals[0];
|
|
10959
11180
|
if (mutation2) {
|
|
10960
11181
|
if (fields2)
|
|
@@ -10963,7 +11184,7 @@ function parse(raw, maximum, output3) {
|
|
|
10963
11184
|
operation.slice(7)
|
|
10964
11185
|
);
|
|
10965
11186
|
if (fitting) {
|
|
10966
|
-
if (!result.fitEdit?.metrics)
|
|
11187
|
+
if (!result.fitEdit?.metrics) usage13("Text fit requires --metrics JSON.");
|
|
10967
11188
|
validateTextFitOptions(result.fitEdit);
|
|
10968
11189
|
}
|
|
10969
11190
|
if (frames)
|
|
@@ -10977,20 +11198,20 @@ function parse(raw, maximum, output3) {
|
|
|
10977
11198
|
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
11199
|
throw new SelectionError8("missing-selection");
|
|
10979
11200
|
if (!formatting && (result.find === void 0 || result.with === void 0))
|
|
10980
|
-
|
|
11201
|
+
usage13("Text replace requires find and with.");
|
|
10981
11202
|
if (!formatting && [result.first === true, result.all === true, result.occurrence !== void 0].filter(
|
|
10982
11203
|
Boolean
|
|
10983
11204
|
).length !== 1)
|
|
10984
|
-
|
|
10985
|
-
if (result.inPlace && result.input === "-")
|
|
10986
|
-
if (result.inPlace && result.output)
|
|
11205
|
+
usage13("Text replace requires exactly one of first, all or occurrence.");
|
|
11206
|
+
if (result.inPlace && result.input === "-") usage13("Stdin cannot be edited in place.");
|
|
11207
|
+
if (result.inPlace && result.output) usage13("Output and in-place cannot be combined.");
|
|
10987
11208
|
if (!result.dryRun && !result.inPlace && !result.output)
|
|
10988
|
-
|
|
10989
|
-
if (result.force && !result.output)
|
|
11209
|
+
usage13("Mutation requires a destination.");
|
|
11210
|
+
if (result.force && !result.output) usage13("Force requires an explicit output destination.");
|
|
10990
11211
|
if (result.output === result.input && result.output !== "-")
|
|
10991
|
-
|
|
11212
|
+
usage13("Replacing input requires --in-place.");
|
|
10992
11213
|
if (result.output === "-" && result.json && !result.dryRun)
|
|
10993
|
-
|
|
11214
|
+
usage13("Binary stdout cannot be combined with JSON.");
|
|
10994
11215
|
}
|
|
10995
11216
|
return result;
|
|
10996
11217
|
}
|
|
@@ -11010,11 +11231,11 @@ function parse(raw, maximum, output3) {
|
|
|
11010
11231
|
(key) => "--" + [...key].map((c) => c >= "A" && c <= "Z" ? "-" + c.toLowerCase() : c).join("")
|
|
11011
11232
|
);
|
|
11012
11233
|
if ([...seen].some((flag) => !flags.includes(flag)))
|
|
11013
|
-
|
|
11014
|
-
if (positionals.length !== 1 || !positionals[0])
|
|
11234
|
+
usage13("Option does not apply to this shape operation.");
|
|
11235
|
+
if (positionals.length !== 1 || !positionals[0]) usage13("Shape operations require one input.");
|
|
11015
11236
|
result.input = positionals[0];
|
|
11016
11237
|
if (result.token && (result.slide !== void 0 || result.part || result.shape || result.all))
|
|
11017
|
-
|
|
11238
|
+
usage13("Opaque and simple selectors cannot be combined.");
|
|
11018
11239
|
if (operation.startsWith("tables."))
|
|
11019
11240
|
validateTableSelection(
|
|
11020
11241
|
{
|
|
@@ -11032,28 +11253,28 @@ function parse(raw, maximum, output3) {
|
|
|
11032
11253
|
if (operation.startsWith("tables.")) {
|
|
11033
11254
|
if (operation === "tables.merge") {
|
|
11034
11255
|
if (!result.tableFrom || !result.tableTo)
|
|
11035
|
-
|
|
11256
|
+
usage13("Merge requires from and to coordinates.");
|
|
11036
11257
|
result.tableStructure = {
|
|
11037
11258
|
kind: "merge",
|
|
11038
11259
|
from: tableCell(result.tableFrom),
|
|
11039
11260
|
to: tableCell(result.tableTo)
|
|
11040
11261
|
};
|
|
11041
11262
|
} else if (operation === "tables.split") {
|
|
11042
|
-
if (!result.cell)
|
|
11263
|
+
if (!result.cell) usage13("Split requires one merge origin cell.");
|
|
11043
11264
|
result.tableStructure = { kind: "split", cell: tableCell(result.cell) };
|
|
11044
11265
|
} else if (operation.startsWith("tables.rows.") || operation.startsWith("tables.columns.")) {
|
|
11045
11266
|
const adding = operation.endsWith(".add");
|
|
11046
11267
|
if (!result.tablePosition || !(adding ? ["expand", "reject"] : ["shrink", "reject"]).includes(
|
|
11047
11268
|
result.tableSpanPolicy
|
|
11048
11269
|
))
|
|
11049
|
-
|
|
11270
|
+
usage13("A position and explicit span policy are required.");
|
|
11050
11271
|
result.tableStructure = {
|
|
11051
11272
|
kind: operation.slice(7).split(".").join("-"),
|
|
11052
11273
|
position: result.tablePosition - 1,
|
|
11053
11274
|
spanPolicy: result.tableSpanPolicy
|
|
11054
11275
|
};
|
|
11055
11276
|
} else {
|
|
11056
|
-
if (!result.tableEdit)
|
|
11277
|
+
if (!result.tableEdit) usage13("A table edit is required.");
|
|
11057
11278
|
validateTableUpdate(
|
|
11058
11279
|
{
|
|
11059
11280
|
...result.tableEdit,
|
|
@@ -11064,14 +11285,14 @@ function parse(raw, maximum, output3) {
|
|
|
11064
11285
|
}
|
|
11065
11286
|
} else if (operation === "shapes.remove") {
|
|
11066
11287
|
if (result.connectorEdit?.detachPolicy !== void 0 && !["detach", "remove"].includes(result.connectorEdit.detachPolicy))
|
|
11067
|
-
|
|
11288
|
+
usage13("Invalid detach policy.");
|
|
11068
11289
|
} else if (connector) {
|
|
11069
11290
|
if (operation !== "connectors.remove")
|
|
11070
11291
|
validateConnectorOptions(result.connectorEdit ?? {}, operation === "connectors.add");
|
|
11071
11292
|
} else if (operation === "shapes.effects.set" || operation === "shapes.drawing.set") {
|
|
11072
11293
|
if (operation === "shapes.effects.set") {
|
|
11073
11294
|
if (result.shadowEnabled === void 0 || result.shadowOpacity === void 0 || result.shadowBlur === void 0 || result.shadowColor === void 0)
|
|
11074
|
-
|
|
11295
|
+
usage13("Shadow requires explicit shadow, opacity, blur and color.");
|
|
11075
11296
|
result.drawingEdit = {
|
|
11076
11297
|
shadow: result.shadowEnabled ? {
|
|
11077
11298
|
blur: result.shadowBlur,
|
|
@@ -11082,7 +11303,7 @@ function parse(raw, maximum, output3) {
|
|
|
11082
11303
|
}
|
|
11083
11304
|
if (result.drawingFill) {
|
|
11084
11305
|
if (result.drawingEdit?.fill !== void 0)
|
|
11085
|
-
|
|
11306
|
+
usage13("Structured fill and simple fill flags cannot be mixed.");
|
|
11086
11307
|
result.drawingEdit = {
|
|
11087
11308
|
...result.drawingEdit,
|
|
11088
11309
|
fill: result.drawingFill
|
|
@@ -11090,9 +11311,9 @@ function parse(raw, maximum, output3) {
|
|
|
11090
11311
|
}
|
|
11091
11312
|
if (result.file !== void 0) {
|
|
11092
11313
|
if (result.input === "-" && result.file === "-")
|
|
11093
|
-
|
|
11314
|
+
usage13("Document and image cannot both use stdin.");
|
|
11094
11315
|
if (result.drawingEdit?.fill?.kind !== "picture" || result.drawingEdit.fill.relationshipId !== void 0)
|
|
11095
|
-
|
|
11316
|
+
usage13("File requires picture fill without a relationship ID.");
|
|
11096
11317
|
}
|
|
11097
11318
|
validateDrawingUpdate(
|
|
11098
11319
|
result.file !== void 0 && result.drawingEdit?.fill?.kind === "picture" ? {
|
|
@@ -11102,7 +11323,7 @@ function parse(raw, maximum, output3) {
|
|
|
11102
11323
|
);
|
|
11103
11324
|
} else if (selectionMutation) {
|
|
11104
11325
|
if (result.shapes && (result.slide !== void 0 || result.part || result.shape || result.token || result.all || result.allowEmpty))
|
|
11105
|
-
|
|
11326
|
+
usage13("Location arrays and simple or opaque selectors cannot be combined.");
|
|
11106
11327
|
result.selectionEdit = {
|
|
11107
11328
|
...result.selectionEdit,
|
|
11108
11329
|
action: operation.slice(7),
|
|
@@ -11117,9 +11338,9 @@ function parse(raw, maximum, output3) {
|
|
|
11117
11338
|
};
|
|
11118
11339
|
validateShapeSelectionOptions(result.selectionEdit);
|
|
11119
11340
|
} else if (grouping) {
|
|
11120
|
-
if (result.tolerance === void 0)
|
|
11341
|
+
if (result.tolerance === void 0) usage13("Grouping requires explicit tolerance.");
|
|
11121
11342
|
if (operation === "shapes.group" && result.shapes === void 0)
|
|
11122
|
-
|
|
11343
|
+
usage13("Grouping requires shape locations.");
|
|
11123
11344
|
validateGroupOptions(
|
|
11124
11345
|
{
|
|
11125
11346
|
tolerance: result.tolerance,
|
|
@@ -11136,30 +11357,30 @@ function parse(raw, maximum, output3) {
|
|
|
11136
11357
|
);
|
|
11137
11358
|
} else if (operation.startsWith("shapes.paths.")) {
|
|
11138
11359
|
if (result.path !== void 0 && (result.vertices !== void 0 || result.close !== void 0))
|
|
11139
|
-
|
|
11360
|
+
usage13("Path and vertices/close cannot be combined.");
|
|
11140
11361
|
if (result.vertices !== void 0) {
|
|
11141
|
-
if (result.close === void 0)
|
|
11362
|
+
if (result.close === void 0) usage13("Vertices require explicit --close true|false.");
|
|
11142
11363
|
if (!Array.isArray(result.vertices) || result.vertices.some((vertex) => Array.isArray(vertex)))
|
|
11143
|
-
|
|
11364
|
+
usage13("Vertices require objects with x and y coordinates.");
|
|
11144
11365
|
result.path = pathFromVertices(result.vertices, result.close);
|
|
11145
11366
|
}
|
|
11146
|
-
if (result.path === void 0)
|
|
11367
|
+
if (result.path === void 0) usage13("Path mutation requires --path or --vertices.");
|
|
11147
11368
|
validateShapePath(result.path);
|
|
11148
11369
|
if (operation.endsWith(".add"))
|
|
11149
11370
|
validateShapeOptions({ ...result.shapeEdit, kind: "text-box" }, true);
|
|
11150
11371
|
} else {
|
|
11151
|
-
if (!result.shapeEdit)
|
|
11372
|
+
if (!result.shapeEdit) usage13("Shape mutation requires update fields.");
|
|
11152
11373
|
validateShapeOptions(result.shapeEdit, operation === "shapes.add");
|
|
11153
11374
|
}
|
|
11154
|
-
if (result.inPlace && result.input === "-")
|
|
11155
|
-
if (result.inPlace && result.output)
|
|
11375
|
+
if (result.inPlace && result.input === "-") usage13("Stdin cannot be edited in place.");
|
|
11376
|
+
if (result.inPlace && result.output) usage13("Output and in-place cannot be combined.");
|
|
11156
11377
|
if (!result.dryRun && !result.inPlace && !result.output)
|
|
11157
|
-
|
|
11158
|
-
if (result.force && !result.output)
|
|
11378
|
+
usage13("Mutation requires a destination.");
|
|
11379
|
+
if (result.force && !result.output) usage13("Force requires an explicit output destination.");
|
|
11159
11380
|
if (result.output === result.input && result.output !== "-")
|
|
11160
|
-
|
|
11381
|
+
usage13("Replacing input requires --in-place.");
|
|
11161
11382
|
if (result.output === "-" && result.json && !result.dryRun)
|
|
11162
|
-
|
|
11383
|
+
usage13("Binary stdout cannot be combined with JSON.");
|
|
11163
11384
|
}
|
|
11164
11385
|
return result;
|
|
11165
11386
|
}
|
|
@@ -11174,53 +11395,53 @@ function parse(raw, maximum, output3) {
|
|
|
11174
11395
|
(key) => key === "placeholders" ? "--placeholders-json" : "--" + [...key].map((char) => char >= "A" && char <= "Z" ? "-" + char.toLowerCase() : char).join("")
|
|
11175
11396
|
);
|
|
11176
11397
|
if ([...seen].some((flag) => !flags.includes(flag)))
|
|
11177
|
-
|
|
11398
|
+
usage13("Option does not apply to this shared-content operation.");
|
|
11178
11399
|
if (positionals.length !== 1 || !positionals[0])
|
|
11179
|
-
|
|
11400
|
+
usage13("Shared-content operations require one input.");
|
|
11180
11401
|
result.input = positionals[0];
|
|
11181
11402
|
if (mutation2 && !applying && !background && result.scope === void 0)
|
|
11182
|
-
|
|
11403
|
+
usage13("Shared-content mutation requires explicit scope.");
|
|
11183
11404
|
if (result.scope !== void 0 && !(theme ? ["shared"] : background ? ["slides", "layouts", "masters", "shared"] : applying ? ["slides"] : layout ? ["layouts", "shared"] : ["masters", "shared"]).includes(result.scope))
|
|
11184
|
-
|
|
11405
|
+
usage13("Scope does not match this shared-content operation.");
|
|
11185
11406
|
if (applying && result.token && result.scope !== void 0)
|
|
11186
|
-
|
|
11407
|
+
usage13("Opaque selectors cannot be combined with scope.");
|
|
11187
11408
|
if (result.token && (result.part || result.slide !== void 0 || result.shape || result.all))
|
|
11188
|
-
|
|
11409
|
+
usage13("Opaque and simple selectors cannot be combined.");
|
|
11189
11410
|
if (result.part && result.slide !== void 0)
|
|
11190
|
-
|
|
11411
|
+
usage13("Part and slide selectors cannot be combined.");
|
|
11191
11412
|
const edit = result.masterEdit;
|
|
11192
|
-
if (operation === "masters.add" && !edit?.name)
|
|
11413
|
+
if (operation === "masters.add" && !edit?.name) usage13("Master creation requires a name.");
|
|
11193
11414
|
if (operation === "masters.set" && edit?.name === void 0 && edit?.text === void 0)
|
|
11194
|
-
|
|
11415
|
+
usage13("Master set requires name or text.");
|
|
11195
11416
|
if (operation === "masters.set" && edit?.text !== void 0 && !result.shape && !result.token)
|
|
11196
|
-
|
|
11417
|
+
usage13("Master text edits require a selected text shape.");
|
|
11197
11418
|
if (operation === "layouts.add" && (!edit?.name || !edit.master))
|
|
11198
|
-
|
|
11419
|
+
usage13("Layout creation requires name and master.");
|
|
11199
11420
|
if (operation === "layouts.set" && !edit && !result.layoutEdit)
|
|
11200
|
-
|
|
11421
|
+
usage13("Layout set requires update fields.");
|
|
11201
11422
|
if (operation === "layouts.set" && edit?.text !== void 0 && !result.shape && !result.token)
|
|
11202
|
-
|
|
11423
|
+
usage13("Layout text requires a selected shape.");
|
|
11203
11424
|
if (layout && mutation2 && operation !== "layouts.add" && !result.part && !result.token && result.slide === void 0 && !result.all)
|
|
11204
|
-
|
|
11425
|
+
usage13("Layout mutation requires an explicit selector.");
|
|
11205
11426
|
if (applying && (!result.layoutEdit?.layout || !["type-index", "reject-unmatched"].includes(result.layoutEdit.placeholderPolicy)))
|
|
11206
|
-
|
|
11427
|
+
usage13("Layout application requires layout and placeholder policy.");
|
|
11207
11428
|
if (operation === "shapes.add" && (edit?.kind !== "text-box" || [edit.x, edit.y, edit.width, edit.height].some((value) => value === void 0)))
|
|
11208
|
-
|
|
11429
|
+
usage13("Master shape creation requires text-box kind and explicit geometry.");
|
|
11209
11430
|
if (operation === "shapes.set" && (!edit || !result.shape && !result.token))
|
|
11210
|
-
|
|
11431
|
+
usage13("Shape edits require update fields and a selected shape.");
|
|
11211
11432
|
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
|
-
|
|
11433
|
+
usage13("Theme set requires paired palette or font values, or a name.");
|
|
11213
11434
|
if (result.themeEdit?.colorSlot !== void 0 && !themeColorSlots.includes(result.themeEdit.colorSlot))
|
|
11214
|
-
|
|
11435
|
+
usage13("Unknown theme color slot.");
|
|
11215
11436
|
if (result.themeEdit?.fontSlot !== void 0 && !themeFontSlots.includes(result.themeEdit.fontSlot))
|
|
11216
|
-
|
|
11437
|
+
usage13("Unknown theme font slot.");
|
|
11217
11438
|
if (background && result.scope === "shared" && !result.part && !result.token)
|
|
11218
|
-
|
|
11439
|
+
usage13("Shared background scope requires an exact part or selector.");
|
|
11219
11440
|
if (operation === "backgrounds.set") {
|
|
11220
11441
|
if (!result.part && !result.token && result.slide === void 0 && !result.all)
|
|
11221
|
-
|
|
11442
|
+
usage13("Background mutation requires a selector or all.");
|
|
11222
11443
|
if (result.file === "-" && result.input === "-")
|
|
11223
|
-
|
|
11444
|
+
usage13("Presentation and image cannot both read stdin.");
|
|
11224
11445
|
const edit2 = result.backgroundEdit;
|
|
11225
11446
|
const required = {
|
|
11226
11447
|
solid: ["color"],
|
|
@@ -11229,24 +11450,24 @@ function parse(raw, maximum, output3) {
|
|
|
11229
11450
|
inherit: [],
|
|
11230
11451
|
"style-reference": ["styleIndex", "styleColor"]
|
|
11231
11452
|
};
|
|
11232
|
-
if (!edit2?.kind || !Object.hasOwn(required, edit2.kind))
|
|
11453
|
+
if (!edit2?.kind || !Object.hasOwn(required, edit2.kind)) usage13("Background kind is required.");
|
|
11233
11454
|
const fields2 = { ...edit2, ...result.file === void 0 ? {} : { file: result.file } };
|
|
11234
11455
|
const keys = required[edit2.kind];
|
|
11235
11456
|
if (keys.some((key) => !Object.hasOwn(fields2, key)) || Object.keys(fields2).some(
|
|
11236
11457
|
(key) => key !== "kind" && !keys.includes(key) && !(edit2.kind === "gradient" && key === "angle")
|
|
11237
11458
|
))
|
|
11238
|
-
|
|
11459
|
+
usage13("Background payload does not match its kind.");
|
|
11239
11460
|
}
|
|
11240
11461
|
if (mutation2) {
|
|
11241
|
-
if (result.inPlace && result.input === "-")
|
|
11242
|
-
if (result.inPlace && result.output)
|
|
11462
|
+
if (result.inPlace && result.input === "-") usage13("Stdin cannot be edited in place.");
|
|
11463
|
+
if (result.inPlace && result.output) usage13("Output and in-place cannot be combined.");
|
|
11243
11464
|
if (!result.dryRun && !result.inPlace && !result.output)
|
|
11244
|
-
|
|
11245
|
-
if (result.force && !result.output)
|
|
11465
|
+
usage13("Mutation requires a destination.");
|
|
11466
|
+
if (result.force && !result.output) usage13("Force requires an explicit output destination.");
|
|
11246
11467
|
if (result.output === result.input && result.output !== "-")
|
|
11247
|
-
|
|
11468
|
+
usage13("Replacing input requires --in-place.");
|
|
11248
11469
|
if (result.output === "-" && result.json && !result.dryRun)
|
|
11249
|
-
|
|
11470
|
+
usage13("Binary stdout cannot be combined with JSON.");
|
|
11250
11471
|
}
|
|
11251
11472
|
return result;
|
|
11252
11473
|
}
|
|
@@ -11273,20 +11494,20 @@ function parse(raw, maximum, output3) {
|
|
|
11273
11494
|
] : []
|
|
11274
11495
|
];
|
|
11275
11496
|
if ([...seen].some((flag) => !allowed.includes(flag)))
|
|
11276
|
-
|
|
11277
|
-
if (positionals.length !== 1 || !positionals[0])
|
|
11497
|
+
usage13("Option does not apply to this settings operation.");
|
|
11498
|
+
if (positionals.length !== 1 || !positionals[0]) usage13("Settings require one input.");
|
|
11278
11499
|
result.input = positionals[0];
|
|
11279
11500
|
if (mutation2) {
|
|
11280
|
-
if (!result.settings)
|
|
11281
|
-
if (result.inPlace && result.input === "-")
|
|
11282
|
-
if (result.inPlace && result.output)
|
|
11501
|
+
if (!result.settings) usage13("Settings set requires update fields.");
|
|
11502
|
+
if (result.inPlace && result.input === "-") usage13("Stdin cannot be edited in place.");
|
|
11503
|
+
if (result.inPlace && result.output) usage13("Output and in-place cannot be combined.");
|
|
11283
11504
|
if (!result.dryRun && !result.inPlace && !result.output)
|
|
11284
|
-
|
|
11285
|
-
if (result.force && !result.output)
|
|
11505
|
+
usage13("Mutation requires a destination.");
|
|
11506
|
+
if (result.force && !result.output) usage13("Force requires an explicit output destination.");
|
|
11286
11507
|
if (result.output === result.input && result.output !== "-")
|
|
11287
|
-
|
|
11508
|
+
usage13("Replacing input requires --in-place.");
|
|
11288
11509
|
if (result.output === "-" && result.json && !result.dryRun)
|
|
11289
|
-
|
|
11510
|
+
usage13("Binary stdout cannot be combined with JSON.");
|
|
11290
11511
|
}
|
|
11291
11512
|
return result;
|
|
11292
11513
|
}
|
|
@@ -11303,32 +11524,32 @@ function parse(raw, maximum, output3) {
|
|
|
11303
11524
|
...["add", "set"].includes(action) ? ["--name", "--slides", "--position"] : []
|
|
11304
11525
|
];
|
|
11305
11526
|
if ([...seen].some((flag) => !allowed.includes(flag)))
|
|
11306
|
-
|
|
11527
|
+
usage13("Option does not apply to this membership operation.");
|
|
11307
11528
|
if (positionals.length !== 1 || !positionals[0])
|
|
11308
|
-
|
|
11529
|
+
usage13("Membership operations require one input.");
|
|
11309
11530
|
result.input = positionals[0];
|
|
11310
11531
|
if (result.scope !== void 0 && result.scope !== "presentation")
|
|
11311
|
-
|
|
11532
|
+
usage13("Membership operations require presentation scope.");
|
|
11312
11533
|
if (result.token && ["--slide", "--scope", "--all"].some((flag) => seen.has(flag)))
|
|
11313
|
-
|
|
11534
|
+
usage13("Opaque and simple selectors cannot be combined.");
|
|
11314
11535
|
if (action === "add" && (result.membership?.name === void 0 || !result.membership.slides))
|
|
11315
|
-
|
|
11316
|
-
if (action === "set" && !result.membership)
|
|
11536
|
+
usage13("Membership creation requires name and slides.");
|
|
11537
|
+
if (action === "set" && !result.membership) usage13("Membership set requires update fields.");
|
|
11317
11538
|
if (mutation2) {
|
|
11318
|
-
if (result.inPlace && result.input === "-")
|
|
11319
|
-
if (result.inPlace && result.output)
|
|
11539
|
+
if (result.inPlace && result.input === "-") usage13("Stdin cannot be edited in place.");
|
|
11540
|
+
if (result.inPlace && result.output) usage13("Output and in-place cannot be combined.");
|
|
11320
11541
|
if (!result.dryRun && !result.inPlace && !result.output)
|
|
11321
|
-
|
|
11322
|
-
if (result.force && !result.output)
|
|
11542
|
+
usage13("Mutation requires a destination.");
|
|
11543
|
+
if (result.force && !result.output) usage13("Force requires an explicit output destination.");
|
|
11323
11544
|
if (result.output === result.input && result.output !== "-")
|
|
11324
|
-
|
|
11545
|
+
usage13("Replacing input requires --in-place.");
|
|
11325
11546
|
if (result.output === "-" && result.json && !result.dryRun)
|
|
11326
|
-
|
|
11547
|
+
usage13("Binary stdout cannot be combined with JSON.");
|
|
11327
11548
|
}
|
|
11328
11549
|
return result;
|
|
11329
11550
|
}
|
|
11330
11551
|
if (result.allowEmpty && !slideMutation)
|
|
11331
|
-
|
|
11552
|
+
usage13("Allow-empty requires a supported slide mutation.");
|
|
11332
11553
|
if (operation === "slides.merge" || operation === "slides.split") {
|
|
11333
11554
|
const allowed = [
|
|
11334
11555
|
"--json",
|
|
@@ -11345,36 +11566,36 @@ function parse(raw, maximum, output3) {
|
|
|
11345
11566
|
] : ["--slides", "--output-dir", "--allow-partial-output"]
|
|
11346
11567
|
];
|
|
11347
11568
|
if ([...seen].some((option) => !allowed.includes(option)))
|
|
11348
|
-
|
|
11569
|
+
usage13("Option does not apply to this assembly operation.");
|
|
11349
11570
|
if (positionals.length !== 1 || !positionals[0])
|
|
11350
|
-
|
|
11571
|
+
usage13("Assembly requires one destination or source input.");
|
|
11351
11572
|
result.input = positionals[0];
|
|
11352
11573
|
if (operation === "slides.split") {
|
|
11353
|
-
if (!result.splitSlides)
|
|
11354
|
-
if (!result.outputDir && !result.dryRun)
|
|
11355
|
-
if (result.outputDir === "-")
|
|
11356
|
-
if (result.force && !result.outputDir)
|
|
11574
|
+
if (!result.splitSlides) usage13("Split requires --slides.");
|
|
11575
|
+
if (!result.outputDir && !result.dryRun) usage13("Split requires --output-dir.");
|
|
11576
|
+
if (result.outputDir === "-") usage13("Output directories cannot be stdout.");
|
|
11577
|
+
if (result.force && !result.outputDir) usage13("Force requires an output directory.");
|
|
11357
11578
|
} else {
|
|
11358
11579
|
if (!result.sources || !result.importing?.themePolicy)
|
|
11359
|
-
|
|
11580
|
+
usage13("Merge requires sources and an explicit theme policy.");
|
|
11360
11581
|
if ([result.input, ...result.sources].filter((path) => path === "-").length > 1)
|
|
11361
|
-
|
|
11362
|
-
if (result.inPlace && result.input === "-")
|
|
11363
|
-
if (result.inPlace && result.output)
|
|
11582
|
+
usage13("Only one input may consume stdin.");
|
|
11583
|
+
if (result.inPlace && result.input === "-") usage13("Stdin cannot be edited in place.");
|
|
11584
|
+
if (result.inPlace && result.output) usage13("Output and in-place cannot be combined.");
|
|
11364
11585
|
if (!result.dryRun && !result.inPlace && !result.output)
|
|
11365
|
-
|
|
11366
|
-
if (result.force && !result.output)
|
|
11586
|
+
usage13("Merge requires a destination.");
|
|
11587
|
+
if (result.force && !result.output) usage13("Force requires an explicit output destination.");
|
|
11367
11588
|
if (result.output === result.input && result.output !== "-")
|
|
11368
|
-
|
|
11589
|
+
usage13("Replacing input requires --in-place.");
|
|
11369
11590
|
if (result.sources.includes(result.inPlace ? result.input : result.output ?? "") && (result.inPlace || result.output !== "-"))
|
|
11370
|
-
|
|
11591
|
+
usage13("Merge output cannot replace a source.");
|
|
11371
11592
|
if (result.output === "-" && result.json && !result.dryRun)
|
|
11372
|
-
|
|
11593
|
+
usage13("Binary stdout cannot be combined with JSON.");
|
|
11373
11594
|
}
|
|
11374
11595
|
return result;
|
|
11375
11596
|
}
|
|
11376
11597
|
if (operation === "create") {
|
|
11377
|
-
if (positionals.length)
|
|
11598
|
+
if (positionals.length) usage13("Creation takes no input positional arguments.");
|
|
11378
11599
|
const allowed = [
|
|
11379
11600
|
"--width",
|
|
11380
11601
|
"--height",
|
|
@@ -11392,11 +11613,11 @@ function parse(raw, maximum, output3) {
|
|
|
11392
11613
|
"--dry-run"
|
|
11393
11614
|
];
|
|
11394
11615
|
if ([...seen].some((option) => !allowed.includes(option)))
|
|
11395
|
-
|
|
11396
|
-
if (!result.output && !result.dryRun)
|
|
11397
|
-
if (result.force && !result.output)
|
|
11616
|
+
usage13("Option does not apply to creation.");
|
|
11617
|
+
if (!result.output && !result.dryRun) usage13("Creation requires an output destination.");
|
|
11618
|
+
if (result.force && !result.output) usage13("Force requires an explicit output destination.");
|
|
11398
11619
|
if (result.output === "-" && result.json && !result.dryRun)
|
|
11399
|
-
|
|
11620
|
+
usage13("Binary stdout cannot be combined with JSON.");
|
|
11400
11621
|
return result;
|
|
11401
11622
|
}
|
|
11402
11623
|
if (operation === "slides.import") {
|
|
@@ -11414,14 +11635,14 @@ function parse(raw, maximum, output3) {
|
|
|
11414
11635
|
"--dry-run"
|
|
11415
11636
|
];
|
|
11416
11637
|
if ([...seen].some((option) => !allowed.includes(option)))
|
|
11417
|
-
|
|
11638
|
+
usage13("Option does not apply to slide import.");
|
|
11418
11639
|
if (!result.source || !result.importing?.sourceSlides)
|
|
11419
|
-
|
|
11420
|
-
if (positionals[0] === "-" && result.source === "-")
|
|
11640
|
+
usage13("Import requires source and source slides.");
|
|
11641
|
+
if (positionals[0] === "-" && result.source === "-") usage13("Only one input may consume stdin.");
|
|
11421
11642
|
if (result.output === result.source && result.output !== "-")
|
|
11422
|
-
|
|
11643
|
+
usage13("Import output cannot replace its source.");
|
|
11423
11644
|
if (result.inPlace && positionals[0] === result.source)
|
|
11424
|
-
|
|
11645
|
+
usage13("Import in-place destination must differ from source.");
|
|
11425
11646
|
} else if (operation === "slides.add") {
|
|
11426
11647
|
const allowed = [
|
|
11427
11648
|
"--layout",
|
|
@@ -11440,11 +11661,11 @@ function parse(raw, maximum, output3) {
|
|
|
11440
11661
|
"--dry-run"
|
|
11441
11662
|
];
|
|
11442
11663
|
if ([...seen].some((option) => !allowed.includes(option)))
|
|
11443
|
-
|
|
11664
|
+
usage13("Option does not apply to slide addition.");
|
|
11444
11665
|
if (positionals.length !== 1 || !positionals[0])
|
|
11445
|
-
|
|
11666
|
+
usage13("Slide addition requires exactly one input.");
|
|
11446
11667
|
result.input = positionals[0];
|
|
11447
|
-
if (!result.addition?.layout)
|
|
11668
|
+
if (!result.addition?.layout) usage13("Slide addition requires --layout.");
|
|
11448
11669
|
} else if (slideMutation) {
|
|
11449
11670
|
const allowed = [
|
|
11450
11671
|
"--selection-json",
|
|
@@ -11464,29 +11685,29 @@ function parse(raw, maximum, output3) {
|
|
|
11464
11685
|
...operation === "slides.set" ? ["--name", "--hidden"] : []
|
|
11465
11686
|
];
|
|
11466
11687
|
if ([...seen].some((option) => !allowed.includes(option)))
|
|
11467
|
-
|
|
11688
|
+
usage13("Option does not apply to this slide mutation.");
|
|
11468
11689
|
if (seen.has("--selection-json") && ["--slide", "--select", "--scope", "--all"].some((flag) => seen.has(flag)))
|
|
11469
|
-
|
|
11690
|
+
usage13("Structured and simple selectors cannot be combined.");
|
|
11470
11691
|
if (!seen.has("--selection-json") && result.slide === void 0 && !result.token && !result.all)
|
|
11471
|
-
|
|
11692
|
+
usage13("Slide mutation requires a selector or --all.");
|
|
11472
11693
|
if (operation !== "slides.remove" && (!result.mutation || (operation === "slides.move" || operation === "slides.duplicate") && result.mutation.position === void 0))
|
|
11473
|
-
|
|
11694
|
+
usage13("Slide mutation requires update fields; move/duplicate require --position.");
|
|
11474
11695
|
if (result.scope !== void 0 && result.scope !== "slides")
|
|
11475
|
-
|
|
11696
|
+
usage13("Slide mutations require slides scope.");
|
|
11476
11697
|
} else if (operation === "validate") {
|
|
11477
11698
|
if ([...seen].some((flag) => flag !== "--json" && flag !== "--limit"))
|
|
11478
|
-
|
|
11699
|
+
usage13("Option does not apply to validation.");
|
|
11479
11700
|
if (result.limits && ["maxOutputs", "maxOutputBytes"].some((name) => Object.hasOwn(result.limits, name)))
|
|
11480
|
-
|
|
11481
|
-
if (positionals.length !== 1 || !positionals[0])
|
|
11701
|
+
usage13("Output limits do not apply to validation.");
|
|
11702
|
+
if (positionals.length !== 1 || !positionals[0]) usage13("Validation requires exactly one nonempty input.");
|
|
11482
11703
|
result.input = positionals[0];
|
|
11483
11704
|
return result;
|
|
11484
11705
|
} else if (operation !== "inspect" && !xml) {
|
|
11485
11706
|
if ([...seen].some((option) => option !== "--json" && !(operation === "capabilities" && option === "--limit")))
|
|
11486
|
-
|
|
11707
|
+
usage13("Selection options require inspect.");
|
|
11487
11708
|
if (operation === "capabilities") {
|
|
11488
|
-
if (result.limits && Object.hasOwn(result.limits, "maxOutputs"))
|
|
11489
|
-
if (positionals.length > 1 || positionals[0] === "")
|
|
11709
|
+
if (result.limits && Object.hasOwn(result.limits, "maxOutputs")) usage13("Output-count limits do not apply to capabilities.");
|
|
11710
|
+
if (positionals.length > 1 || positionals[0] === "") usage13("Capabilities accepts at most one nonempty input.");
|
|
11490
11711
|
if (positionals[0] !== void 0) result.input = positionals[0];
|
|
11491
11712
|
return result;
|
|
11492
11713
|
}
|
|
@@ -11547,43 +11768,43 @@ function parse(raw, maximum, output3) {
|
|
|
11547
11768
|
result.schemaPath = positionals.join(".");
|
|
11548
11769
|
return result;
|
|
11549
11770
|
}
|
|
11550
|
-
if (positionals.length)
|
|
11771
|
+
if (positionals.length) usage13("Unexpected input.");
|
|
11551
11772
|
return result;
|
|
11552
11773
|
}
|
|
11553
|
-
if (positionals.length !== 1)
|
|
11774
|
+
if (positionals.length !== 1) usage13("Inspection requires exactly one input.");
|
|
11554
11775
|
result.input = positionals[0];
|
|
11555
|
-
if (result.input.length === 0)
|
|
11776
|
+
if (result.input.length === 0) usage13("Input path must not be empty.");
|
|
11556
11777
|
if (result.token && ["--slide", "--shape", "--part", "--scope", "--all"].some((option) => seen.has(option)))
|
|
11557
|
-
|
|
11778
|
+
usage13("Opaque and simple selectors cannot be combined.");
|
|
11558
11779
|
if (result.part && result.slide !== void 0)
|
|
11559
|
-
|
|
11780
|
+
usage13("Part and slide selectors cannot be combined.");
|
|
11560
11781
|
if (result.shape && result.slide === void 0 && !result.part)
|
|
11561
|
-
|
|
11782
|
+
usage13("Shape selection requires an owning slide or part.");
|
|
11562
11783
|
if (result.slide !== void 0 && result.scope !== void 0 && result.scope !== "slides")
|
|
11563
|
-
|
|
11784
|
+
usage13("Slide positions require slides scope.");
|
|
11564
11785
|
const mutationOptions = ["--file", "--output", "--in-place", "--force", "--dry-run"];
|
|
11565
11786
|
if (operation !== "xml.set" && operation !== "slides.add" && operation !== "slides.import" && !slideMutation && mutationOptions.some((option) => seen.has(option)))
|
|
11566
|
-
|
|
11787
|
+
usage13("Publication options require xml set.");
|
|
11567
11788
|
if (!xml && operation !== "inspect" && operation !== "slides.add" && operation !== "slides.import" && !slideMutation && result.limits)
|
|
11568
|
-
|
|
11569
|
-
if (operation !== "xml.get" && result.pretty)
|
|
11789
|
+
usage13("Limit overrides require inspect, XML operations or slides add.");
|
|
11790
|
+
if (operation !== "xml.get" && result.pretty) usage13("Pretty output requires xml get.");
|
|
11570
11791
|
if (xml) {
|
|
11571
11792
|
if (result.slide !== void 0 || result.shape || result.all)
|
|
11572
|
-
|
|
11573
|
-
if (!result.part && !result.token)
|
|
11793
|
+
usage13("XML operations require one part selector.");
|
|
11794
|
+
if (!result.part && !result.token) usage13("XML operations require a part or opaque selector.");
|
|
11574
11795
|
}
|
|
11575
11796
|
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)
|
|
11797
|
+
if (operation === "xml.set" && !result.file) usage13("XML replacement requires --file.");
|
|
11798
|
+
if (result.input === "-" && result.file === "-") usage13("Only one input may consume stdin.");
|
|
11799
|
+
if (result.inPlace && result.input === "-") usage13("Stdin cannot be edited in place.");
|
|
11800
|
+
if (result.inPlace && result.output) usage13("Output and in-place cannot be combined.");
|
|
11580
11801
|
if (!result.dryRun && !result.inPlace && !result.output)
|
|
11581
|
-
|
|
11582
|
-
if (result.force && !result.output)
|
|
11802
|
+
usage13("Mutation requires a destination.");
|
|
11803
|
+
if (result.force && !result.output) usage13("Force requires an explicit output destination.");
|
|
11583
11804
|
if (result.output === result.input && result.output !== "-")
|
|
11584
|
-
|
|
11805
|
+
usage13("Replacing input requires --in-place.");
|
|
11585
11806
|
if (result.output === "-" && result.json && !result.dryRun)
|
|
11586
|
-
|
|
11807
|
+
usage13("Binary stdout cannot be combined with JSON.");
|
|
11587
11808
|
}
|
|
11588
11809
|
return result;
|
|
11589
11810
|
}
|
|
@@ -11652,7 +11873,7 @@ async function transferLocations(bytes, budget) {
|
|
|
11652
11873
|
(edge) => relationshipNamespaces.some((namespace) => edge.type === `${namespace}/officeDocument`)
|
|
11653
11874
|
);
|
|
11654
11875
|
const root = roots.length === 1 ? roots[0].targetPart : void 0;
|
|
11655
|
-
if (!root) throw new
|
|
11876
|
+
if (!root) throw new OfficeError19("invalid-opc", "Presentation part is missing.", "index");
|
|
11656
11877
|
const relationshipNamespace = roots[0].type.slice(0, -"/officeDocument".length);
|
|
11657
11878
|
const xml = budget.xml(reader.get(root));
|
|
11658
11879
|
const fingerprint = Array.from(sha2564(bytes), (byte) => byte.toString(16).padStart(2, "0")).join(
|
|
@@ -11671,7 +11892,7 @@ async function transferLocations(bytes, budget) {
|
|
|
11671
11892
|
(edge) => edge.id === reference && edge.type === `${relationshipNamespace}/slide`
|
|
11672
11893
|
)?.targetPart;
|
|
11673
11894
|
if (!id || !owner || !reader.has(owner))
|
|
11674
|
-
throw new
|
|
11895
|
+
throw new OfficeError19("invalid-opc", "Referenced slide is missing.", "index");
|
|
11675
11896
|
return {
|
|
11676
11897
|
fingerprint,
|
|
11677
11898
|
scope: "slides",
|
|
@@ -11754,7 +11975,7 @@ async function executeRequest(request, options2, owned) {
|
|
|
11754
11975
|
let allowPartialOutput = false;
|
|
11755
11976
|
try {
|
|
11756
11977
|
request.signal.throwIfAborted();
|
|
11757
|
-
if (!Array.isArray(request.args))
|
|
11978
|
+
if (!Array.isArray(request.args)) usage13("Arguments must be byte arrays.");
|
|
11758
11979
|
const args = parse(request.args, options2.maxArgumentBytes, output3);
|
|
11759
11980
|
if (args.limits) {
|
|
11760
11981
|
const validation = options2.context.validationLimits;
|
|
@@ -11780,14 +12001,47 @@ async function executeRequest(request, options2, owned) {
|
|
|
11780
12001
|
output3.json = args.json;
|
|
11781
12002
|
output3.operation = args.operation;
|
|
11782
12003
|
const operation2 = args.operation;
|
|
11783
|
-
if (args.operation === "
|
|
12004
|
+
if (args.operation === "pack" && request.streaming) {
|
|
12005
|
+
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");
|
|
12006
|
+
const streaming = request.streaming, context = { ...options2.context, signal: request.signal, workingStorage: streaming.workingStorage };
|
|
12007
|
+
const input = await streaming.openInput(args.manifest, Math.min(context.limits.maxBytes, context.xmlLimits.maxBytes));
|
|
12008
|
+
const manifest = await openRetainedPackManifest(input.stream(), context, { manifest: args.manifest, ...args.output === void 0 ? {} : { output: args.output } });
|
|
12009
|
+
owned.push(manifest);
|
|
12010
|
+
let total = 0;
|
|
12011
|
+
const packed = await stageRetainedPackage(manifest.members(), async function* (part) {
|
|
12012
|
+
const source3 = await streaming.openInput(await manifest.path(part), Math.min(context.limits.maxBytes, context.archiveLimits.maxEntryBytes, context.archiveLimits.maxTotalBytes - total));
|
|
12013
|
+
total += source3.size;
|
|
12014
|
+
yield* source3.stream();
|
|
12015
|
+
}, context, args.creation?.kind ? { kind: args.creation.kind } : {});
|
|
12016
|
+
owned.push(packed);
|
|
12017
|
+
if (packed.size > options2.maxOutputBytes) throw new OfficeError19("resource-limit", "Packed output exceeds byte limit.", "validate-intent");
|
|
12018
|
+
const dryRun = args.dryRun ?? false;
|
|
12019
|
+
result = {
|
|
12020
|
+
version: 1,
|
|
12021
|
+
operation: operation2,
|
|
12022
|
+
ok: true,
|
|
12023
|
+
warnings: [],
|
|
12024
|
+
errors: [],
|
|
12025
|
+
locations: [],
|
|
12026
|
+
affected: packed.count,
|
|
12027
|
+
data: { effects: ["packed"], outputs: dryRun ? [] : [{ path: args.output, sha256: packed.fingerprint, bytes: packed.size }], fingerprint: dryRun ? null : packed.fingerprint, dryRun }
|
|
12028
|
+
};
|
|
12029
|
+
human = `${dryRun ? "Validated" : "Packed"} ${packed.count} package part(s)
|
|
12030
|
+
`;
|
|
12031
|
+
if (args.output && args.output !== "-") {
|
|
12032
|
+
if (!request.publishOutput) throw Object.assign(new Error("Output publication unavailable."), { code: "publication-unsupported" });
|
|
12033
|
+
publication = { outputPath: args.output, protectedInputPaths: manifest.paths(), bytes: packed.bytes(), originalBytes: input, inPlace: false, force: args.force ?? false, dryRun };
|
|
12034
|
+
} else if (args.output === "-" && !dryRun) stagedOutput = { close: packed.close, async write(sink) {
|
|
12035
|
+
for await (const bytes of packed.bytes()) await sink.write(bytes);
|
|
12036
|
+
} };
|
|
12037
|
+
} else if (args.operation === "extract" && request.streaming && (!request.publishOutputs || request.publishOutputStreams) && (!request.preflightOutput || request.preflightOutputStream)) {
|
|
11784
12038
|
retainedExtraction = await prepareRetainedExtraction(args, request, options2);
|
|
11785
12039
|
owned.push(retainedExtraction);
|
|
11786
12040
|
result = success(operation2, null);
|
|
11787
12041
|
} else if (args.operation === "xml.set" && request.streaming) {
|
|
11788
12042
|
if (args.token) decodeSelectionToken2(args.token);
|
|
11789
12043
|
const streaming = request.streaming, context = { ...options2.context, signal: request.signal, workingStorage: streaming.workingStorage };
|
|
11790
|
-
if (!context.validationLimits) throw new
|
|
12044
|
+
if (!context.validationLimits) throw new OfficeError19("invalid-value", "XML operations require explicit validation limits.", "usage");
|
|
11791
12045
|
const input = await streaming.openInput(args.input, Math.min(context.limits.maxBytes, context.archiveLimits.maxArchiveBytes));
|
|
11792
12046
|
const maxReplacementBytes = Math.min(context.validationLimits.maxBytes, context.archiveLimits.maxEntryBytes), file = args.file;
|
|
11793
12047
|
async function* replacement() {
|
|
@@ -11827,8 +12081,8 @@ async function executeRequest(request, options2, owned) {
|
|
|
11827
12081
|
publication = { inputPath: args.input, outputPath: destination, bytes: staged.bytes(), originalBytes: input, inPlace: args.inPlace ?? false, force: args.force ?? false, dryRun };
|
|
11828
12082
|
}
|
|
11829
12083
|
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) {
|
|
11831
|
-
if (args.token) decodeSelectionToken2(args.token);
|
|
12084
|
+
} 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 === "notes.list" || args.operation === "notes.get" || args.operation === "xml.get") && request.streaming) {
|
|
12085
|
+
if (args.token && args.operation !== "notes.list" && args.operation !== "notes.get") decodeSelectionToken2(args.token);
|
|
11832
12086
|
const input = await request.streaming.openInput(args.input, Math.min(options2.context.limits.maxBytes, options2.context.archiveLimits.maxArchiveBytes));
|
|
11833
12087
|
const hash = sha2564.create();
|
|
11834
12088
|
for await (const bytes of input.stream()) {
|
|
@@ -11840,8 +12094,13 @@ async function executeRequest(request, options2, owned) {
|
|
|
11840
12094
|
const archive = await openPackageArchive(input, context);
|
|
11841
12095
|
let failed = false;
|
|
11842
12096
|
try {
|
|
11843
|
-
const scope = args.token ? decodeSelectionToken2(args.token).scope : args.scope;
|
|
11844
|
-
stagedOutput = args.operation === "
|
|
12097
|
+
const scope = args.operation === "notes.list" || args.operation === "notes.get" ? void 0 : args.token ? decodeSelectionToken2(args.token).scope : args.scope;
|
|
12098
|
+
stagedOutput = args.operation === "notes.list" || args.operation === "notes.get" ? await stageRetainedNotes(archive, fingerprint, { selection: {
|
|
12099
|
+
kind: "slide",
|
|
12100
|
+
...args.token ? { token: args.token } : {},
|
|
12101
|
+
...args.slide === void 0 ? {} : { position: { coordinateSystem: "one-based", value: args.slide } },
|
|
12102
|
+
...!args.token && (args.all || args.operation === "notes.list") ? { all: true } : {}
|
|
12103
|
+
} }, context, { json: args.json, operation: args.operation, maxOutputBytes: options2.maxOutputBytes }) : args.operation === "xml.get" ? await stageRetainedXmlPart(archive, fingerprint, {
|
|
11845
12104
|
...args.token === void 0 ? {} : { token: args.token },
|
|
11846
12105
|
...args.slide === void 0 ? {} : { slide: args.slide },
|
|
11847
12106
|
...args.shape === void 0 ? {} : { shape: args.shape },
|
|
@@ -11862,7 +12121,7 @@ async function executeRequest(request, options2, owned) {
|
|
|
11862
12121
|
}, context, { json: args.json, maxOutputBytes: options2.maxOutputBytes });
|
|
11863
12122
|
} catch (error) {
|
|
11864
12123
|
failed = true;
|
|
11865
|
-
if (error instanceof
|
|
12124
|
+
if (error instanceof OfficeError19 && error.code === "resource-limit" && error.phase === "publish") return outputLimitFailure(operation2, args.json);
|
|
11866
12125
|
throw error;
|
|
11867
12126
|
} finally {
|
|
11868
12127
|
try {
|
|
@@ -11887,7 +12146,7 @@ async function executeRequest(request, options2, owned) {
|
|
|
11887
12146
|
let failed = false;
|
|
11888
12147
|
try {
|
|
11889
12148
|
validation = await openRetainedPresentationValidation(archive, context, limits);
|
|
11890
|
-
if (!validation.valid) throw new
|
|
12149
|
+
if (!validation.valid) throw new OfficeError19("invalid-opc", "Presentation semantic validation failed.", "index");
|
|
11891
12150
|
result = success(operation2, { valid: true, schema: validation.schema, rules: validation.rules, issues: [] });
|
|
11892
12151
|
} catch (error) {
|
|
11893
12152
|
failed = true;
|
|
@@ -11902,15 +12161,15 @@ async function executeRequest(request, options2, owned) {
|
|
|
11902
12161
|
const bytes = await request.readInput(args.input, maxBytes);
|
|
11903
12162
|
const reader = await readPackage3(bytes, { ...options2.context, signal: request.signal });
|
|
11904
12163
|
const validation = validatePresentation(reader, limits);
|
|
11905
|
-
if (!validation.valid) throw new
|
|
12164
|
+
if (!validation.valid) throw new OfficeError19("invalid-opc", "Presentation semantic validation failed.", "index");
|
|
11906
12165
|
result = success(operation2, validation);
|
|
11907
12166
|
}
|
|
11908
12167
|
human = "Presentation is semantically valid; XML schema validation not checked.\n";
|
|
11909
12168
|
} else if (args.operation === "help") {
|
|
11910
|
-
const
|
|
12169
|
+
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
12170
|
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
12171
|
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" :
|
|
12172
|
+
) ? "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
12173
|
if (args.schemaPath === "diff") resolvedUsage = diffUsage;
|
|
11915
12174
|
if (args.schemaPath?.startsWith("comments.")) resolvedUsage = commentsUsage;
|
|
11916
12175
|
if (args.schemaPath?.startsWith("notes.")) resolvedUsage = notesUsage;
|
|
@@ -12259,11 +12518,11 @@ ${JSON.stringify(result.data, null, 2)}
|
|
|
12259
12518
|
try {
|
|
12260
12519
|
text2 = new TextDecoder("utf-8", { fatal: true }).decode(encoded2);
|
|
12261
12520
|
} catch {
|
|
12262
|
-
|
|
12521
|
+
usage13("Batch JSON must be UTF-8.");
|
|
12263
12522
|
}
|
|
12264
12523
|
items = parseAnimationBatch(commandJson(text2));
|
|
12265
12524
|
}
|
|
12266
|
-
if (items.length && !args.dryRun && !args.inPlace && !args.output)
|
|
12525
|
+
if (items.length && !args.dryRun && !args.inPlace && !args.output) usage13("Mutation requires a destination.");
|
|
12267
12526
|
const bytes = await request.readInput(args.input, Math.min(context.limits.maxBytes, context.archiveLimits.maxArchiveBytes));
|
|
12268
12527
|
const index = await readSelectionIndex2(bytes, context);
|
|
12269
12528
|
const changed = await mutateAnimationsBatch(bytes, resolveAnimationBatch(items, index), context);
|
|
@@ -13498,13 +13757,13 @@ ${item.parts.map((part) => ` ${part}
|
|
|
13498
13757
|
const inputs = [];
|
|
13499
13758
|
for (const path of [args.input, ...args.sources ?? []]) {
|
|
13500
13759
|
if (remaining < 1)
|
|
13501
|
-
throw new
|
|
13760
|
+
throw new OfficeError19("resource-limit", "Combined input limit exceeded.", "admit");
|
|
13502
13761
|
const bytes = await request.readInput(
|
|
13503
13762
|
path,
|
|
13504
13763
|
Math.min(remaining, context.archiveLimits.maxArchiveBytes)
|
|
13505
13764
|
);
|
|
13506
13765
|
if (bytes.length > remaining || bytes.length > context.archiveLimits.maxArchiveBytes)
|
|
13507
|
-
throw new
|
|
13766
|
+
throw new OfficeError19("resource-limit", "Combined input limit exceeded.", "admit");
|
|
13508
13767
|
remaining -= bytes.length;
|
|
13509
13768
|
inputs.push(await budget.read(bytes));
|
|
13510
13769
|
}
|
|
@@ -13605,7 +13864,7 @@ ${JSON.stringify(result.data, null, 2)}
|
|
|
13605
13864
|
}
|
|
13606
13865
|
} else if (args.operation === "create") {
|
|
13607
13866
|
if (args.template)
|
|
13608
|
-
throw new
|
|
13867
|
+
throw new OfficeError19(
|
|
13609
13868
|
"unsupported-profile",
|
|
13610
13869
|
"Template-based creation is unavailable.",
|
|
13611
13870
|
"validate-intent"
|
|
@@ -13657,7 +13916,7 @@ ${JSON.stringify(result.data, null, 2)}
|
|
|
13657
13916
|
);
|
|
13658
13917
|
} catch (error) {
|
|
13659
13918
|
if (error && typeof error === "object" && "code" in error && error.code === "resource-limit")
|
|
13660
|
-
throw new
|
|
13919
|
+
throw new OfficeError19("resource-limit", "Input limit exceeded.", "admit");
|
|
13661
13920
|
throw error;
|
|
13662
13921
|
}
|
|
13663
13922
|
const index = await readSelectionIndex2(bytes, { ...options2.context, signal: request.signal });
|
|
@@ -13802,7 +14061,7 @@ ${JSON.stringify(result.data, null, 2)}
|
|
|
13802
14061
|
const part = metadata2 ?? records[0].part;
|
|
13803
14062
|
const validationLimits = options2.context.validationLimits;
|
|
13804
14063
|
if (!validationLimits)
|
|
13805
|
-
throw new
|
|
14064
|
+
throw new OfficeError19(
|
|
13806
14065
|
"invalid-value",
|
|
13807
14066
|
"XML operations require explicit validation limits.",
|
|
13808
14067
|
"usage"
|
|
@@ -13878,10 +14137,10 @@ ${xml.xml}
|
|
|
13878
14137
|
await stagedOutput?.close().catch(() => {
|
|
13879
14138
|
});
|
|
13880
14139
|
stagedOutput = void 0;
|
|
13881
|
-
if (error instanceof
|
|
14140
|
+
if (error instanceof OfficeError19 && error.code === "resource-limit" && error.phase === "publish") return outputLimitFailure(output3.operation, output3.json);
|
|
13882
14141
|
if (request.signal.aborted)
|
|
13883
14142
|
return { exitCode: 130, stdout: new Uint8Array(), stderr: new Uint8Array() };
|
|
13884
|
-
const office = error instanceof
|
|
14143
|
+
const office = error instanceof OfficeError19 ? error : void 0;
|
|
13885
14144
|
const capabilityCode = error && typeof error === "object" && "code" in error ? error.code : void 0;
|
|
13886
14145
|
const limit = office?.code === "resource-limit" || capabilityCode === "resource-limit";
|
|
13887
14146
|
const unsupported = capabilityCode === "publication-unsupported";
|
|
@@ -13984,7 +14243,7 @@ ${JSON.stringify(failure.data)}
|
|
|
13984
14243
|
} catch (error) {
|
|
13985
14244
|
if (request.signal.aborted)
|
|
13986
14245
|
return { exitCode: 130, stdout: new Uint8Array(), stderr: new Uint8Array() };
|
|
13987
|
-
const office = error instanceof
|
|
14246
|
+
const office = error instanceof OfficeError19 ? error : void 0;
|
|
13988
14247
|
const rawCode = error && typeof error === "object" && "code" in error ? error.code : void 0;
|
|
13989
14248
|
const code = typeof rawCode === "string" && [
|
|
13990
14249
|
"resource-limit",
|
|
@@ -14066,7 +14325,7 @@ async function execute(request, options2) {
|
|
|
14066
14325
|
}
|
|
14067
14326
|
}
|
|
14068
14327
|
function createPptxCommandEngine(settings = {}) {
|
|
14069
|
-
const context =
|
|
14328
|
+
const context = resourceContext2(settings.context);
|
|
14070
14329
|
const options2 = {
|
|
14071
14330
|
maxArgumentBytes: settings.maxArgumentBytes ?? Infinity,
|
|
14072
14331
|
maxOutputBytes: settings.maxOutputBytes ?? Infinity,
|