@vercel/cli-support 68.0.0 → 68.1.0-snapshot-f8c293166d1f
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/chunks/{add-RH3RQPGP.js → add-56T4ON6W.js} +1 -1
- package/dist/chunks/{add-4ZXS4RRN.js → add-CDHMIDYR.js} +1 -1
- package/dist/chunks/{add-G2LGF4HL.js → add-JC2KSFHX.js} +1 -1
- package/dist/chunks/{alerts-3352VWDL.js → alerts-TMFON3SU.js} +1 -1
- package/dist/chunks/{api-endpoints-2IYXPLEG.js → api-endpoints-EY2DO75S.js} +1 -1
- package/dist/chunks/auth-4A5CXZOA.js +7 -0
- package/dist/chunks/auth-ZJV6OHMS.js +7 -0
- package/dist/chunks/{build-3UFKTTS5.js → build-ALEGEJFV.js} +1 -1
- package/dist/chunks/{chunk-JDDPCL3K.js → chunk-245QYIHU.js} +1 -1
- package/dist/chunks/{chunk-SGNDE4YS.js → chunk-2ACABADL.js} +1 -1
- package/dist/chunks/{chunk-D6REP5QQ.js → chunk-2GXP676X.js} +1 -1
- package/dist/chunks/{chunk-MXTC4ZAQ.js → chunk-2ILZM77F.js} +1 -1
- package/dist/chunks/{chunk-OFDTADPQ.js → chunk-2K7U64CN.js} +1 -1
- package/dist/chunks/{chunk-DTCQWGHE.js → chunk-2KJIWBJQ.js} +2 -2
- package/dist/chunks/{chunk-T4DOV5S4.js → chunk-2V5IP6A5.js} +1 -1
- package/dist/chunks/{chunk-L46V6VL3.js → chunk-37SWAKIV.js} +1 -1
- package/dist/chunks/{chunk-ZXSZH7N5.js → chunk-3GKXXGSO.js} +1 -1
- package/dist/chunks/{chunk-QSL6AG2B.js → chunk-3HP6FOOL.js} +1 -1
- package/dist/chunks/{chunk-M32HBBPK.js → chunk-3WXQHKSS.js} +1 -1
- package/dist/chunks/{chunk-JELLVPCM.js → chunk-3XMKTJ5T.js} +1 -1
- package/dist/chunks/{chunk-KLBSCTLL.js → chunk-3YD5WA5R.js} +1 -1
- package/dist/chunks/{chunk-KIDGOY4F.js → chunk-3YNMC7FF.js} +1 -1
- package/dist/chunks/{chunk-YLXXGQQQ.js → chunk-42D3CPWB.js} +1 -1
- package/dist/chunks/{chunk-HRR57QNP.js → chunk-46R47IE5.js} +1 -1
- package/dist/chunks/{chunk-ZRFDZO7Y.js → chunk-4D4IP557.js} +1 -1
- package/dist/chunks/{chunk-OOPF73RV.js → chunk-4FPYV37P.js} +1 -1
- package/dist/chunks/{chunk-HR4ID3MU.js → chunk-4HNNFJLO.js} +1 -1
- package/dist/chunks/{chunk-5WYJSLCF.js → chunk-4HYZZASG.js} +1 -1
- package/dist/chunks/{chunk-AMZ7AUYX.js → chunk-4JPDCF2O.js} +1 -1
- package/dist/chunks/{chunk-CAJ2OUSR.js → chunk-4L7AKIX7.js} +1 -1
- package/dist/chunks/chunk-4SI66IFC.js +7 -0
- package/dist/chunks/{chunk-MCYG7CCE.js → chunk-4SIQE2W4.js} +1 -1
- package/dist/chunks/chunk-4WEKKDOL.js +8 -0
- package/dist/chunks/{chunk-Q6YPC3GK.js → chunk-57H5KQGN.js} +1 -1
- package/dist/chunks/{chunk-NWGBDBZI.js → chunk-5F4RJ32E.js} +1 -1
- package/dist/chunks/{chunk-GXWBL6YV.js → chunk-5KGALAC2.js} +1 -1
- package/dist/chunks/{chunk-KRPY5FHJ.js → chunk-5QC4IKRZ.js} +1 -1
- package/dist/chunks/{chunk-VBANKZWM.js → chunk-5RRSLENO.js} +1 -1
- package/dist/chunks/{chunk-2AMO2VMV.js → chunk-64GNDWWX.js} +1 -1
- package/dist/chunks/{chunk-J24BABG4.js → chunk-6G2AZBW5.js} +1 -1
- package/dist/chunks/{chunk-DY643UZ7.js → chunk-6JBKQ5LR.js} +2 -3
- package/dist/chunks/{chunk-X755TPX6.js → chunk-6O2LDFGJ.js} +1 -1
- package/dist/chunks/chunk-6OOJFAF5.js +20 -0
- package/dist/chunks/{chunk-T44RB754.js → chunk-6SX4TE7Y.js} +1 -1
- package/dist/chunks/{chunk-AW5KOUD7.js → chunk-6SYKGWTJ.js} +1 -1
- package/dist/chunks/chunk-6ZD6IARJ.js +33 -0
- package/dist/chunks/{chunk-O3YZLVC6.js → chunk-72CSJCJX.js} +3 -3
- package/dist/chunks/chunk-75TGTOZQ.js +8 -0
- package/dist/chunks/{chunk-GRRVPFSB.js → chunk-7JQBC2HB.js} +1 -1
- package/dist/chunks/{chunk-Y3V4JYK6.js → chunk-7MBJ4YIK.js} +1 -1
- package/dist/chunks/{chunk-PSOVLGHP.js → chunk-7O3D3XED.js} +1 -1
- package/dist/chunks/{chunk-FXLZM6Q7.js → chunk-7PK2JFEH.js} +1 -1
- package/dist/chunks/chunk-7Q5I3L37.js +68 -0
- package/dist/chunks/{chunk-24SIHFEW.js → chunk-7QHUMMBA.js} +1 -1
- package/dist/chunks/{chunk-4HR3I3ML.js → chunk-7TRHPXCG.js} +1 -1
- package/dist/chunks/{chunk-BLUPZPAS.js → chunk-7Y572CPZ.js} +1 -1
- package/dist/chunks/{chunk-ATSAMHUZ.js → chunk-A3WRF4AB.js} +1 -1
- package/dist/chunks/{chunk-6DBLXAJI.js → chunk-AGFG7WHE.js} +1 -1
- package/dist/chunks/{chunk-YFOBGEOW.js → chunk-AI32LWRL.js} +1 -1
- package/dist/chunks/chunk-AJ3KPZLM.js +18 -0
- package/dist/chunks/{chunk-MYVALJ4D.js → chunk-AJJIPBAG.js} +1 -1
- package/dist/chunks/{chunk-TGIIE2L3.js → chunk-AP2JY545.js} +1 -1
- package/dist/chunks/{chunk-Z73UJVGD.js → chunk-AU54JBLF.js} +1 -1
- package/dist/chunks/{chunk-SQ62IODX.js → chunk-AUCQKYL2.js} +1 -1
- package/dist/chunks/{chunk-ZBOTJT5S.js → chunk-AULX6RDR.js} +1 -1
- package/dist/chunks/{chunk-37P7O3AQ.js → chunk-AWB4IKVC.js} +1 -1
- package/dist/chunks/{chunk-SCV7XEEO.js → chunk-AX6UCTOC.js} +1 -1
- package/dist/chunks/{chunk-MDXG7T7M.js → chunk-B4IOZL3K.js} +1 -1
- package/dist/chunks/{chunk-Y4YBQUQM.js → chunk-B6QW2OXJ.js} +1 -1
- package/dist/chunks/{chunk-YBAGKQXC.js → chunk-BCD4TRQF.js} +1 -1
- package/dist/chunks/{chunk-OQXHBPPS.js → chunk-BCRZI5IM.js} +1 -1
- package/dist/chunks/chunk-BFS4K2RF.js +7 -0
- package/dist/chunks/chunk-BKJ4H6KK.js +8 -0
- package/dist/chunks/{chunk-O3GQG2ML.js → chunk-BLA6V5UN.js} +2 -2
- package/dist/chunks/{chunk-COD3WAUI.js → chunk-BNWEJZAC.js} +1 -1
- package/dist/chunks/{chunk-5MDNVAE6.js → chunk-BVFFSUG3.js} +1 -1
- package/dist/chunks/{chunk-X6JQI64G.js → chunk-C6AOL5RF.js} +1 -1
- package/dist/chunks/{chunk-F7L5SXJM.js → chunk-CDO5IECP.js} +1 -1
- package/dist/chunks/{chunk-XOETL6DB.js → chunk-CHY2NJU4.js} +1 -1
- package/dist/chunks/{chunk-H24KFNPB.js → chunk-CKPY7TAQ.js} +1 -1
- package/dist/chunks/chunk-COOA33HY.js +7 -0
- package/dist/chunks/{chunk-PVASGBEF.js → chunk-CSU46B7Q.js} +1 -1
- package/dist/chunks/{chunk-DDZEKNQR.js → chunk-CX4WJVNY.js} +1 -1
- package/dist/chunks/{chunk-AVCLYJNC.js → chunk-CX6QYE3Y.js} +1 -1
- package/dist/chunks/{chunk-4SAVH3H7.js → chunk-DCFCPAFQ.js} +1 -1
- package/dist/chunks/{chunk-2FUGD6J7.js → chunk-DTEWQLNP.js} +1 -1
- package/dist/chunks/chunk-DXFFWNK4.js +8 -0
- package/dist/chunks/{chunk-F4KY2TOK.js → chunk-EAQLOKZX.js} +1 -1
- package/dist/chunks/{chunk-ZGM4K3B5.js → chunk-ECQW2R5M.js} +1 -1
- package/dist/chunks/{chunk-B4KA3ZH2.js → chunk-EFGZK6OY.js} +1 -1
- package/dist/chunks/{chunk-N3ZNAMGR.js → chunk-EFQCGYZF.js} +1 -1
- package/dist/chunks/{chunk-ID663OJ7.js → chunk-EL65DTVZ.js} +1 -1
- package/dist/chunks/{chunk-PAHYNO73.js → chunk-ELQO7254.js} +1 -1
- package/dist/chunks/{chunk-3G3FQYMW.js → chunk-ERMHTPO4.js} +1 -1
- package/dist/chunks/chunk-EV2VKG2V.js +8 -0
- package/dist/chunks/{chunk-LDDXXDN5.js → chunk-EYCKXHL4.js} +1 -1
- package/dist/chunks/{chunk-5727HGA6.js → chunk-F2VXECRT.js} +1 -1
- package/dist/chunks/{chunk-NMY2YZ6M.js → chunk-F5FBLRH3.js} +1 -1
- package/dist/chunks/{chunk-TU54LHNW.js → chunk-F6BUBFV2.js} +1 -1
- package/dist/chunks/{chunk-VWKA6RKB.js → chunk-FHNHVEOX.js} +1 -1
- package/dist/chunks/{chunk-D3M2JG5C.js → chunk-FIICEEXO.js} +1 -1
- package/dist/chunks/{chunk-QPNTR3PA.js → chunk-FVMRKUWL.js} +1 -1
- package/dist/chunks/{chunk-H3ZSF2P3.js → chunk-FWYKEEQK.js} +1 -1
- package/dist/chunks/{chunk-ZHGKJCQ2.js → chunk-G7RQVFID.js} +5 -5
- package/dist/chunks/chunk-GB77JTTX.js +8 -0
- package/dist/chunks/{chunk-FTNLCQC6.js → chunk-GHZ4YQCI.js} +1 -1
- package/dist/chunks/{chunk-7RABG6HV.js → chunk-GOH7QCG3.js} +1 -1
- package/dist/chunks/{chunk-4NTBYNFR.js → chunk-GOXGA37R.js} +1 -1
- package/dist/chunks/{chunk-23FY4PR3.js → chunk-GTBPHJRJ.js} +1 -1
- package/dist/chunks/{chunk-YTSGFU5T.js → chunk-GUFRGEM5.js} +1 -1
- package/dist/chunks/{chunk-U43WXZBP.js → chunk-H2O53DAZ.js} +1 -1
- package/dist/chunks/chunk-HAM7ZPEC.js +7 -0
- package/dist/chunks/{chunk-4SWS7RKX.js → chunk-HG7NRFC5.js} +1 -1
- package/dist/chunks/{chunk-BTI5TG6Q.js → chunk-HGXM4UBQ.js} +1 -1
- package/dist/chunks/{chunk-PX3V7X3Q.js → chunk-HI5PLVKM.js} +1 -1
- package/dist/chunks/chunk-HIEFNLLO.js +7 -0
- package/dist/chunks/{chunk-NMIB4JYP.js → chunk-HJCMNBDK.js} +1 -1
- package/dist/chunks/{chunk-6WBEU34Y.js → chunk-HLJ2UIG6.js} +1 -1
- package/dist/chunks/{chunk-DH4A4QMD.js → chunk-HMNIFPU2.js} +1 -1
- package/dist/chunks/{chunk-2KXLL3DX.js → chunk-HSQPQ5RV.js} +1 -1
- package/dist/chunks/{chunk-6NC2JFUQ.js → chunk-I254SHTL.js} +1 -1
- package/dist/chunks/{chunk-YN3HZJXW.js → chunk-I3NEZRVW.js} +1 -1
- package/dist/chunks/{chunk-WHEA5VLX.js → chunk-ICPRMAKB.js} +1 -1
- package/dist/chunks/{chunk-OPORM35X.js → chunk-IFMPBA4K.js} +1 -1
- package/dist/chunks/{chunk-MCRKBVZA.js → chunk-IMLHRJ4K.js} +1 -1
- package/dist/chunks/{chunk-KA2KG3SY.js → chunk-IR3E37HD.js} +1 -1
- package/dist/chunks/chunk-IVJEYHF5.js +8 -0
- package/dist/chunks/{chunk-BPUANOGW.js → chunk-IZV6K7RR.js} +1 -1
- package/dist/chunks/{chunk-OZKP3WKT.js → chunk-J4WXRM2Y.js} +1 -1
- package/dist/chunks/chunk-J5MGMWRV.js +9 -0
- package/dist/chunks/{chunk-4FBOQLPZ.js → chunk-J7DIPT7M.js} +1 -1
- package/dist/chunks/{chunk-BOJDM3O7.js → chunk-JCDPMWKO.js} +1 -1
- package/dist/chunks/{chunk-FB37TFVF.js → chunk-JEACGNHI.js} +1 -1
- package/dist/chunks/{chunk-MGKNSTU4.js → chunk-JJNTYM7J.js} +1 -1
- package/dist/chunks/{chunk-76NL3ZRJ.js → chunk-K45TGFUJ.js} +1 -1
- package/dist/chunks/{chunk-LUX4PBJL.js → chunk-K5GE24PG.js} +1 -1
- package/dist/chunks/{chunk-25565AGS.js → chunk-K7YK4PZP.js} +1 -1
- package/dist/chunks/{chunk-D6NVKMRP.js → chunk-KEFF3BL3.js} +1 -1
- package/dist/chunks/{chunk-FBYA6LLM.js → chunk-KHJWQ4WP.js} +1 -1
- package/dist/chunks/{chunk-EHAS6SQB.js → chunk-KMTQYFJF.js} +1 -1
- package/dist/chunks/{chunk-JCHZRW4N.js → chunk-KVZR24QI.js} +1 -1
- package/dist/chunks/{chunk-BRQUZ5NC.js → chunk-L4CSJDG7.js} +1 -1
- package/dist/chunks/{chunk-ISWW3DKF.js → chunk-L6MWUMWZ.js} +1 -1
- package/dist/chunks/{chunk-KKYNEEM7.js → chunk-LKXPJLOP.js} +1 -1
- package/dist/chunks/{chunk-Q7D7RGXM.js → chunk-LLHXL3SV.js} +1 -1
- package/dist/chunks/{chunk-EYRBV6RM.js → chunk-LNRKGW7S.js} +1 -1
- package/dist/chunks/{chunk-BS32OUOC.js → chunk-LPYHYTYI.js} +1 -1
- package/dist/chunks/{chunk-A2RZZQEP.js → chunk-LY3EY2VG.js} +1 -1
- package/dist/chunks/chunk-M2XLLWK7.js +7 -0
- package/dist/chunks/{chunk-7WDSOKOY.js → chunk-MAAJGMXM.js} +1 -1
- package/dist/chunks/{chunk-DWZBL4NK.js → chunk-MAIZY5BV.js} +1 -1
- package/dist/chunks/{chunk-BUBVZ6SQ.js → chunk-MDWUJ7TA.js} +1 -1
- package/dist/chunks/{chunk-YHPPP3SF.js → chunk-MF43WTDT.js} +1 -1
- package/dist/chunks/{chunk-V3YNYCRV.js → chunk-MHVM4VKT.js} +2 -2
- package/dist/chunks/chunk-MJ2HLVVL.js +13 -0
- package/dist/chunks/{chunk-6Z5REGCM.js → chunk-MMMX3KE2.js} +1 -1
- package/dist/chunks/{chunk-ISSNEDG5.js → chunk-MN2F4NPH.js} +1 -1
- package/dist/chunks/{chunk-QFE3RPMA.js → chunk-MTPHHAPR.js} +1 -1
- package/dist/chunks/{slugify-NMMUASYK.js → chunk-N3COHC7T.js} +1 -1
- package/dist/chunks/{chunk-27FVSW45.js → chunk-N7IBUNFY.js} +1 -1
- package/dist/chunks/{chunk-BZENIQ7N.js → chunk-NBPLUP7C.js} +1 -1
- package/dist/chunks/chunk-NE5RTEMC.js +7 -0
- package/dist/chunks/{chunk-CTBSRTJW.js → chunk-NFPO75IP.js} +1 -1
- package/dist/chunks/{chunk-XE4SLG5H.js → chunk-NNPXYFMY.js} +1 -1
- package/dist/chunks/{chunk-D6O5O3CW.js → chunk-NQPQRYHS.js} +1 -1
- package/dist/chunks/{chunk-3SF3ILIT.js → chunk-NUS3WWST.js} +1 -1
- package/dist/chunks/chunk-NVU7XTNI.js +11 -0
- package/dist/chunks/{chunk-ZBZQEDZY.js → chunk-NXFYKZVZ.js} +1 -1
- package/dist/chunks/chunk-NXUDP37D.js +7 -0
- package/dist/chunks/chunk-O7AF7CLE.js +8 -0
- package/dist/chunks/{chunk-MWFHS4HV.js → chunk-O7FAYZU6.js} +1 -1
- package/dist/chunks/{chunk-MDRI27KN.js → chunk-OCX4QZ3X.js} +1 -1
- package/dist/chunks/{chunk-YOKTRWQX.js → chunk-OD4RCBDD.js} +1 -1
- package/dist/chunks/{chunk-OAM5NJCU.js → chunk-OK52DDU5.js} +1 -1
- package/dist/chunks/{chunk-PFD7LETF.js → chunk-OM6NML7C.js} +1 -1
- package/dist/chunks/{chunk-HYAIA5YC.js → chunk-OVIWCH3S.js} +2 -2
- package/dist/chunks/chunk-OVVHONX7.js +8 -0
- package/dist/chunks/{chunk-J5SINMVO.js → chunk-P5IKPNRJ.js} +1 -1
- package/dist/chunks/chunk-PG3WQGEK.js +181 -0
- package/dist/chunks/{chunk-AW33SRYY.js → chunk-PH2MLBQO.js} +1 -1
- package/dist/chunks/{chunk-XHBZITV4.js → chunk-PKECY4JZ.js} +1 -1
- package/dist/chunks/{chunk-DGLE44KA.js → chunk-PKWSWWVW.js} +1 -1
- package/dist/chunks/{chunk-RHFNVIFD.js → chunk-PNN2Y2ZQ.js} +1 -1
- package/dist/chunks/{chunk-5A3DDLQR.js → chunk-PNTKMD3A.js} +1 -1
- package/dist/chunks/{chunk-XC25DYA7.js → chunk-PQQRSUUG.js} +2 -2
- package/dist/chunks/{chunk-BKFRN6C2.js → chunk-PR4NNS3O.js} +1 -1
- package/dist/chunks/{chunk-QHGPFYWQ.js → chunk-PROENC6V.js} +1 -1
- package/dist/chunks/chunk-PW67ZNDU.js +8 -0
- package/dist/chunks/{chunk-Z436ZYLV.js → chunk-Q2FGBONA.js} +1 -1
- package/dist/chunks/{chunk-U5SZQUYO.js → chunk-QCYCLWNG.js} +1 -1
- package/dist/chunks/{chunk-6TEYSBCT.js → chunk-QDSDYOMV.js} +1 -1
- package/dist/chunks/{chunk-S3L2OHPO.js → chunk-QNMWYJQW.js} +1 -1
- package/dist/chunks/{chunk-MMMJO2M3.js → chunk-QOIG2FJP.js} +1 -1
- package/dist/chunks/{chunk-MTZYPCZ7.js → chunk-QRPBDCDH.js} +1 -1
- package/dist/chunks/{chunk-INIZJZ3O.js → chunk-RDTWDVFO.js} +1 -1
- package/dist/chunks/{chunk-GD7AV7BO.js → chunk-RFD7CEL6.js} +1 -1
- package/dist/chunks/{chunk-TSIKSHYG.js → chunk-RIVRPVTH.js} +1 -1
- package/dist/chunks/{chunk-RYSO5U3E.js → chunk-RIXTYUYN.js} +1 -1
- package/dist/chunks/{chunk-7HQZRU25.js → chunk-RRX2AMWY.js} +1 -1
- package/dist/chunks/{chunk-CEA5NDJC.js → chunk-RTIVLPN7.js} +1 -1
- package/dist/chunks/chunk-RWVYBRVF.js +13 -0
- package/dist/chunks/chunk-S4ARHJGW.js +9 -0
- package/dist/chunks/chunk-S7FMMAST.js +7 -0
- package/dist/chunks/{chunk-Q4R34AVE.js → chunk-SHLKM7EZ.js} +1 -1
- package/dist/chunks/chunk-SIWT2MBT.js +8 -0
- package/dist/chunks/{chunk-7SLMNM55.js → chunk-SPPOQ54P.js} +1 -1
- package/dist/chunks/{chunk-BIABM3FB.js → chunk-SSOWIDKG.js} +1 -1
- package/dist/chunks/{chunk-AZVSMIPP.js → chunk-STDRVWDW.js} +1 -1
- package/dist/chunks/{chunk-M2Q2DUHO.js → chunk-SUD5V67L.js} +1 -1
- package/dist/chunks/{chunk-7EJQLVWX.js → chunk-SUT2PTL3.js} +1 -1
- package/dist/chunks/chunk-SWWLPWX7.js +17 -0
- package/dist/chunks/chunk-SX2JJDHM.js +17 -0
- package/dist/chunks/{chunk-3RFQ2NXZ.js → chunk-T4257EDB.js} +1 -1
- package/dist/chunks/{chunk-G24EKATW.js → chunk-T5DQCNBC.js} +1 -1
- package/dist/chunks/chunk-TASNZYJU.js +14 -0
- package/dist/chunks/{chunk-YTSUDTAK.js → chunk-TNNCGRBK.js} +1 -1
- package/dist/chunks/{chunk-D5JQZXL7.js → chunk-TR3M42DX.js} +1 -1
- package/dist/chunks/chunk-TTM4VQ4T.js +7 -0
- package/dist/chunks/{chunk-BYBELFCP.js → chunk-UAPEASRH.js} +1 -1
- package/dist/chunks/{chunk-DXFP22OK.js → chunk-UE6M2VKP.js} +1 -1
- package/dist/chunks/chunk-UGJRAFRA.js +8 -0
- package/dist/chunks/{chunk-3AFEVHHY.js → chunk-UGVOMXYR.js} +1 -1
- package/dist/chunks/{chunk-NB2WLB3J.js → chunk-UJ7YUIEJ.js} +1 -1
- package/dist/chunks/{chunk-7OZ7OKPS.js → chunk-UJINL7VK.js} +1 -1
- package/dist/chunks/{chunk-6KNWKZR4.js → chunk-UVBRWYYJ.js} +1 -1
- package/dist/chunks/{chunk-KNNIA3PS.js → chunk-UXAPG6IX.js} +1 -1
- package/dist/chunks/{chunk-6FEMU5YF.js → chunk-V45KKYNK.js} +1 -1
- package/dist/chunks/{chunk-A6CMQOL7.js → chunk-V7EJ7O6E.js} +1 -1
- package/dist/chunks/chunk-VB6SQWSB.js +9 -0
- package/dist/chunks/{chunk-E5A7E7X6.js → chunk-VBCWRNS4.js} +1 -1
- package/dist/chunks/{chunk-5U2YLD56.js → chunk-VG44VJB5.js} +1 -1
- package/dist/chunks/{chunk-DOOBZO4W.js → chunk-VJM3WCEC.js} +1 -1
- package/dist/chunks/{chunk-BYYNR34Q.js → chunk-VNS4Z72T.js} +1 -1
- package/dist/chunks/{chunk-CTMTO2W4.js → chunk-VQAIH2X5.js} +1 -1
- package/dist/chunks/{chunk-D2JNI6UB.js → chunk-VSDLCOK3.js} +1 -1
- package/dist/chunks/chunk-VUB4NBD4.js +15 -0
- package/dist/chunks/{chunk-KXMFGDO4.js → chunk-VV5TYUAT.js} +1 -1
- package/dist/chunks/chunk-W2YAOE3Z.js +7 -0
- package/dist/chunks/{chunk-JALVF3C2.js → chunk-WMIZ6Y4E.js} +1 -1
- package/dist/chunks/{chunk-R43H4T4L.js → chunk-WPWGH5CA.js} +1 -1
- package/dist/chunks/{chunk-22ZRVWYP.js → chunk-WU22X5RO.js} +2 -2
- package/dist/chunks/{chunk-TLKBGAOL.js → chunk-WWEUGL6W.js} +1 -1
- package/dist/chunks/{chunk-S6TAO4MD.js → chunk-X3A324UF.js} +1 -1
- package/dist/chunks/{chunk-JUAHDOL6.js → chunk-X5YKQ2RJ.js} +1 -1
- package/dist/chunks/{chunk-VJNTVPUV.js → chunk-X5ZBXCCY.js} +1 -1
- package/dist/chunks/{chunk-J3U2QD2L.js → chunk-X72FHJ6W.js} +1 -1
- package/dist/chunks/{chunk-E3AML3VR.js → chunk-XBT7X2Q4.js} +1 -1
- package/dist/chunks/{chunk-CDJ25IKC.js → chunk-XGCCTSBW.js} +1 -1
- package/dist/chunks/chunk-XHXWUAJE.js +32 -0
- package/dist/chunks/{chunk-U4Z2MMOF.js → chunk-XKVKG7CW.js} +1 -1
- package/dist/chunks/{chunk-4F73GVJZ.js → chunk-XO2CZXGA.js} +1 -1
- package/dist/chunks/{chunk-E3WP42P2.js → chunk-XPEWDJV6.js} +1 -1
- package/dist/chunks/{chunk-DNONVY2L.js → chunk-XXPUBGJZ.js} +2 -2
- package/dist/chunks/{chunk-UPDIZCP3.js → chunk-Y2J2ESAE.js} +1 -1
- package/dist/chunks/chunk-Y2KAVMM4.js +10 -0
- package/dist/chunks/{chunk-46ISU3XI.js → chunk-Y3ETQZSK.js} +2 -2
- package/dist/chunks/{chunk-5RMIM4S2.js → chunk-Y7SZI3JV.js} +1 -1
- package/dist/chunks/chunk-YBWLW6SW.js +7 -0
- package/dist/chunks/{chunk-B7IUFV5P.js → chunk-YDCILYRC.js} +1 -1
- package/dist/chunks/{chunk-67GZ5REA.js → chunk-YHZXIBS7.js} +1 -1
- package/dist/chunks/{chunk-5CVEW3HD.js → chunk-YLQCB6XY.js} +1 -1
- package/dist/chunks/{chunk-47E5IB3C.js → chunk-YNNU3GPR.js} +1 -1
- package/dist/chunks/{chunk-IVZNPSHU.js → chunk-YTBNOSND.js} +1 -1
- package/dist/chunks/{chunk-WAOS5OCB.js → chunk-YU33PPKX.js} +1 -1
- package/dist/chunks/{chunk-7JU5RJ3H.js → chunk-ZEBOIM34.js} +1 -1
- package/dist/chunks/{chunk-E7IN2DGU.js → chunk-ZEGUFI44.js} +1 -1
- package/dist/chunks/{chunk-NZ2TFADV.js → chunk-ZOJI7HYA.js} +1 -1
- package/dist/chunks/{clear-GL4SZ2XR.js → clear-FQ4L2ACT.js} +1 -1
- package/dist/chunks/{cli-embedded-NR5F35LW.js → cli-embedded-CZYKFQ6U.js} +2 -2
- package/dist/chunks/cli-truncate-CylqKOGj-WE5OLB6Q.js +7 -0
- package/dist/chunks/commands-Bx-lrmie-KJI5MSFW.js +10 -0
- package/dist/chunks/compile-vercel-config-GUTXMJOP.js +7 -0
- package/dist/chunks/{config-U4GLPYDY.js → config-4KECSIYK.js} +1 -1
- package/dist/chunks/{config-KSQQQMQQ.js → config-EEYAOPDR.js} +1 -1
- package/dist/chunks/config-HiWLfXRQ-G4JC3PIR.js +43 -0
- package/dist/chunks/connect-U3yG4EtI-KWEUMGCU.js +7 -0
- package/dist/chunks/connect-git-provider-MPYSAOTH.js +7 -0
- package/dist/chunks/cp-aFe-HVrK-JGQPCT5R.js +12 -0
- package/dist/chunks/create-ilHWvzSk-MPW7HE43.js +7 -0
- package/dist/chunks/create-project-FMUOSSNP.js +7 -0
- package/dist/chunks/{delete-D2WLQHVB.js → delete-JRMGVHFJ.js} +1 -1
- package/dist/chunks/{delete-O2VWRQC3.js → delete-LP4N4BXX.js} +1 -1
- package/dist/chunks/{describe-N36SISDN.js → describe-5M3XKRMV.js} +1 -1
- package/dist/chunks/detect-projects-DHS2E3N4.js +7 -0
- package/dist/chunks/detect-services-HCUFI3RJ.js +7 -0
- package/dist/chunks/{disable-EHRVY24G.js → disable-ZFDARZAF.js} +1 -1
- package/dist/chunks/{discard-QW5TMTXX.js → discard-PE5SSIDJ.js} +1 -1
- package/dist/chunks/dist-BGUQ47VG.js +7 -0
- package/dist/chunks/{dist-33WTJLVQ.js → dist-E4BMK7BO.js} +1 -1
- package/dist/chunks/{dist-RXYNZPEA.js → dist-S7GEJ656.js} +1 -1
- package/dist/chunks/domain-DGvr_U55-AZYOJW3J.js +8 -0
- package/dist/chunks/drives-Bi-Mnt2z-JAGBYE6W.js +14 -0
- package/dist/chunks/{edit-WM6KJPSI.js → edit-7S67WBSE.js} +1 -1
- package/dist/chunks/{edit-IZR537PS.js → edit-BATH6ETJ.js} +1 -1
- package/dist/chunks/{enable-5Z72O3NI.js → enable-JWLWXAZP.js} +1 -1
- package/dist/chunks/{engine-C8wCzkw--PYVABGU4.js → engine-C8wCzkw--72P7UD6T.js} +1 -1
- package/dist/chunks/{esm-IYH32MTQ.js → esm-B3P7PUFJ.js} +1 -1
- package/dist/chunks/{esm-5GQXHN7C.js → esm-CMSQLK7G.js} +1 -1
- package/dist/chunks/{esm-LEQXRLFV.js → esm-KWMRMP74.js} +1 -1
- package/dist/chunks/{esm-NHCCFW7Z.js → esm-LRBNA4QO.js} +1 -1
- package/dist/chunks/{esm-FJCIOBBV.js → esm-NVIK2MSG.js} +1 -1
- package/dist/chunks/{esm-T655CG6O.js → esm-RAS56M3I.js} +1 -1
- package/dist/chunks/{esm-QQ3MUOW4.js → esm-WU2ZS2IW.js} +1 -1
- package/dist/chunks/{exec-PCSP64LR.js → exec-6WGVP2E2.js} +1 -1
- package/dist/chunks/exec-Bwv4MDyN-SMCC4JHS.js +7 -0
- package/dist/chunks/{export-IWVMWM2H.js → export-DASZMUUD.js} +1 -1
- package/dist/chunks/extend-D9tq9Cot-Z4ORB3B2.js +8 -0
- package/dist/chunks/{fetch-proxy-MOKBS56A.js → fetch-proxy-ZIHXTNFP.js} +1 -1
- package/dist/chunks/fork-DQ6qfKqB-AJCZOGQR.js +9 -0
- package/dist/chunks/future-CNLTCF2D.js +7 -0
- package/dist/chunks/generate-cert-for-deploy-TCH3OY6G.js +7 -0
- package/dist/chunks/groups-B8JVEeKk-J5CCQYWU.js +10 -0
- package/dist/chunks/image-CDRXKTJG.js +7 -0
- package/dist/chunks/import-builders-XI6CYID6.js +7 -0
- package/dist/chunks/{inspect-6Y672OQ3.js → inspect-DSTHAT43.js} +1 -1
- package/dist/chunks/{inspect-SW2I7D6E.js → inspect-FCJC7XCN.js} +1 -1
- package/dist/chunks/{inspect-QT3QEFBW.js → inspect-FODCPYHT.js} +1 -1
- package/dist/chunks/{inspect-6J5DGZZ4.js → inspect-I7NZH44Z.js} +1 -1
- package/dist/chunks/{inspect-ALC2J4BF.js → inspect-JFRSCAAW.js} +1 -1
- package/dist/chunks/{inspect-47FM3OWG.js → inspect-RSSQ5YKF.js} +1 -1
- package/dist/chunks/{list-CXXDI5UV.js → list-7K3LEJXV.js} +1 -1
- package/dist/chunks/{list-BIFH4KO5.js → list-HWDVPR4V.js} +1 -1
- package/dist/chunks/{list-TGDHJKDT.js → list-NT2RHNIB.js} +1 -1
- package/dist/chunks/{list-2CMCXXP4.js → list-QDBAXYKL.js} +1 -1
- package/dist/chunks/list-iqQFvOHx-EWWTMITV.js +7 -0
- package/dist/chunks/log-update-DsqoChS1-DG7F5XJ4.js +11 -0
- package/dist/chunks/login-DGxA9ez--ZRIJ24TS.js +13 -0
- package/dist/chunks/login-RWXYD2CO.js +7 -0
- package/dist/chunks/{login-IUQDG334.js → login-WHXNCPDU.js} +1 -1
- package/dist/chunks/logout-OEbPJLu2-7NPM6ALK.js +8 -0
- package/dist/chunks/logs-RDOQVAER.js +7 -0
- package/dist/chunks/{ls-YTKJRKD3.js → ls-2OYMFZIB.js} +1 -1
- package/dist/chunks/{ls-7D73WVOF.js → ls-2PCKZKR7.js} +1 -1
- package/dist/chunks/{ls-GC5MX2HZ.js → ls-7DUE3OKC.js} +1 -1
- package/dist/chunks/{ls-C75Z5FBX.js → ls-ASWAYYAI.js} +1 -1
- package/dist/chunks/{ls-ERDQLUT2.js → ls-PEFQHSG3.js} +1 -1
- package/dist/chunks/{ls-4DNFF35I.js → ls-UQZB42CA.js} +1 -1
- package/dist/chunks/{ls-IQUZ6GWG.js → ls-XJZFHHWA.js} +1 -1
- package/dist/chunks/migrate-experimental-services-2E5TRQU6.js +7 -0
- package/dist/chunks/{mutate-YJNE2733.js → mutate-QXTPOGVD.js} +1 -1
- package/dist/chunks/{native-self-update-Q3EN6NZK.js → native-self-update-T75AUBHJ.js} +1 -1
- package/dist/chunks/{notifications-2HU4L7WA.js → notifications-F2BUWHH4.js} +1 -1
- package/dist/chunks/{open-MA7QGJKO.js → open-5FUW57NF.js} +1 -1
- package/dist/chunks/{openapi-POBVCXS3.js → openapi-NZLMBOMR.js} +1 -1
- package/dist/chunks/{permissions-AU5M5A6G.js → permissions-ABXSL4I4.js} +1 -1
- package/dist/chunks/{plugin-offer-E53UQXXX.js → plugin-offer-IMTYE365.js} +1 -1
- package/dist/chunks/prompt-missing-credentials-3MKVB7HN.js +7 -0
- package/dist/chunks/{publish-G7NQESCE.js → publish-5AE7VXIO.js} +1 -1
- package/dist/chunks/pull-MGQ2TMA3.js +7 -0
- package/dist/chunks/purchase-domain-if-available-MU5TGXLG.js +7 -0
- package/dist/chunks/{push-BG7UEIKY.js → push-SBTMPRZE.js} +1 -1
- package/dist/chunks/query-5Q6ZV2TP.js +7 -0
- package/dist/chunks/{raw-query-QHFSKN55.js → raw-query-OAYC3OTN.js} +1 -1
- package/dist/chunks/read-BTA5slYO-TGRGDUB5.js +8 -0
- package/dist/chunks/{reauthenticate-U2LOFDFP.js → reauthenticate-PXEYMV7G.js} +1 -1
- package/dist/chunks/remove-CCa99nz9-52C5X3OV.js +7 -0
- package/dist/chunks/{remove-IB7C6LII.js → remove-WSK5OYNV.js} +1 -1
- package/dist/chunks/{reorder-E5UYNMML.js → reorder-DT32UBAI.js} +1 -1
- package/dist/chunks/{reply-DSDFBUAX.js → reply-AMZ3Y3U5.js} +1 -1
- package/dist/chunks/{repo-info-to-url-XQSULSEO.js → repo-info-to-url-S2YOQIRM.js} +1 -1
- package/dist/chunks/{repo-root-DZ6WFHMP.js → repo-root-STNOAHCH.js} +1 -1
- package/dist/chunks/{resolve-VK5QTUII.js → resolve-NPE5HKCT.js} +1 -1
- package/dist/chunks/{resolve-agent-team-D7RFR6WL.js → resolve-agent-team-75WZ2VDR.js} +1 -1
- package/dist/chunks/{resolve-deployment-framework-preset-BLMQLCIN.js → resolve-deployment-framework-preset-SCQCWANF.js} +1 -1
- package/dist/chunks/{restore-IVNZOVU3.js → restore-IZHGW3NV.js} +1 -1
- package/dist/chunks/{rm-LWEITUDD.js → rm-G4U54YJT.js} +1 -1
- package/dist/chunks/{rm-GYS4DS2Z.js → rm-HVDZJXME.js} +1 -1
- package/dist/chunks/{rm-L2KCHMLS.js → rm-ILDCA66K.js} +1 -1
- package/dist/chunks/{rm-PDJE63VV.js → rm-JWMYMOKD.js} +1 -1
- package/dist/chunks/{rm-PAI3WZXJ.js → rm-MBWOLQZJ.js} +1 -1
- package/dist/chunks/routes-GTTTHCOL.js +7 -0
- package/dist/chunks/rule-inspect-KZ7FNV26.js +8 -0
- package/dist/chunks/run-D8obqfKw-VBME5UHC.js +7 -0
- package/dist/chunks/{schema-ZIK2W4AX.js → schema-5FNNQEU5.js} +1 -1
- package/dist/chunks/{schema-ZOPJJLJC.js → schema-SKHPOMD7.js} +1 -1
- package/dist/chunks/select-org-YRCPH5Z5.js +7 -0
- package/dist/chunks/{serving-C1mhZQqH-73TMEGEB.js → serving-C1mhZQqH-XEQUVQZK.js} +1 -1
- package/dist/chunks/sessions-cvWvPgzc-XIYLOGFI.js +7 -0
- package/dist/chunks/{set-MC2CLSA2.js → set-V6QX5AZQ.js} +1 -1
- package/dist/chunks/{set-B5MPNYXG.js → set-WWREM57F.js} +1 -1
- package/dist/chunks/setup-and-link-STBOP67J.js +7 -0
- package/dist/chunks/sh-7olsIyJh-PKP4FF4F.js +7 -0
- package/dist/chunks/{skills-X5MN3OH2.js → skills-5TXXGKN5.js} +1 -1
- package/dist/chunks/slugify-OEOEYGDL.js +7 -0
- package/dist/chunks/snapshot-D9MAspub-SROFKNVE.js +9 -0
- package/dist/chunks/snapshots-DQjvm6St-4DTYO2IQ.js +9 -0
- package/dist/chunks/stamp-THWCZ5IQ.js +7 -0
- package/dist/chunks/{statuspage-K5SC7KAQ.js → statuspage-NCYXH7DR.js} +1 -1
- package/dist/chunks/stop-SQX-uC-Q-MCMKSJVQ.js +10 -0
- package/dist/chunks/table-3DCL552W.js +7 -0
- package/dist/chunks/{tags-WRVKKRN7.js → tags-SVOY7QEN.js} +1 -1
- package/dist/chunks/telemetry-KLbte3YE-OAFHJTWE.js +13 -0
- package/dist/chunks/token-DGNBXqnR-37H4S563.js +7 -0
- package/dist/chunks/token-EYEJQ7AP.js +7 -0
- package/dist/chunks/token-LNLX4V5J.js +7 -0
- package/dist/chunks/token-MZBD3R2S.js +7 -0
- package/dist/chunks/token-util-4P4GUSTT.js +7 -0
- package/dist/chunks/token-util-DAhLJ1X4-NJBLJROT.js +7 -0
- package/dist/chunks/token-util-XC5K3DNT.js +7 -0
- package/dist/chunks/token-util-XO4H5VLL.js +7 -0
- package/dist/chunks/{types-PC3JIYPX.js → types-NX7G6YBW.js} +1 -1
- package/dist/chunks/{update-QDIZFM4T.js → update-AVWVPYK5.js} +1 -1
- package/dist/chunks/{update-route-version-KWK5S4UW.js → update-route-version-MKFTZPKQ.js} +1 -1
- package/dist/chunks/{usage-JUP36KHN.js → usage-RUCM3AMF.js} +1 -1
- package/dist/chunks/users-CGEsQ4G8-BEKXN56N.js +9 -0
- package/dist/chunks/{utils-IQZEE4DT.js → utils-XXR7KIRB.js} +1 -1
- package/dist/chunks/validate-config-MJQI5EMD.js +7 -0
- package/dist/chunks/{vercel-cli-3UQLDU2S.js → vercel-cli-RW4WHHOS.js} +1 -1
- package/dist/chunks/{vlt-builder-graph-XL2XRO4V.js → vlt-builder-graph-EU5EX7KY.js} +1 -1
- package/dist/chunks/{vlt-builder-importer-RBUPAB6J.js → vlt-builder-importer-2YSRGPFC.js} +1 -1
- package/dist/chunks/wrap-ansi-CaN_P_HT-MAPHF26X.js +7 -0
- package/dist/chunks/write-DixEhGqz-D34NI34B.js +10 -0
- package/dist/chunks/{zod-Y3ZBY67C.js → zod-H7KW2D5Z.js} +1 -1
- package/dist/commands/build/index.js +1 -1
- package/dist/commands/deploy/index.js +11 -11
- package/dist/commands/dev/index.js +5 -9
- package/dist/commands/env/index.js +1 -1
- package/dist/commands/link/index.js +1 -1
- package/dist/commands/list/index.js +1 -1
- package/dist/commands/project/index.js +102 -80
- package/dist/commands/tunnel/index.js +1 -1
- package/dist/commands-account.js +5 -5
- package/dist/commands-ai.js +6 -6
- package/dist/commands-blob.js +3 -3
- package/dist/commands-core.js +9 -9
- package/dist/commands-deployments.js +1 -1
- package/dist/commands-flags.js +1 -1
- package/dist/commands-integrations.js +11 -11
- package/dist/commands-observability.js +2 -2
- package/dist/commands-routing.js +9 -9
- package/dist/help.js +1 -1
- package/dist/index.js +5 -5
- package/dist/internal-build-worker.js +1 -1
- package/dist/internal-build.js +2 -2
- package/dist/package.json +8 -8
- package/dist/version.mjs +1 -1
- package/package.json +16 -16
- package/dist/chunks/chunk-3ARTWVQV.js +0 -11
- package/dist/chunks/chunk-6UJIJLQC.js +0 -13
- package/dist/chunks/chunk-EMTZZXMH.js +0 -13
- package/dist/chunks/chunk-XKPB27SC.js +0 -8
- package/dist/chunks/chunk-Z3XKNZDP.js +0 -9
- package/dist/chunks/compile-vercel-config-HMKEDWC4.js +0 -7
- package/dist/chunks/connect-git-provider-WGKVFXW2.js +0 -7
- package/dist/chunks/create-project-BTOHPKZB.js +0 -7
- package/dist/chunks/detect-projects-I7NEHWSM.js +0 -7
- package/dist/chunks/detect-services-4ONC2DH3.js +0 -7
- package/dist/chunks/future-3AUPMPY7.js +0 -7
- package/dist/chunks/generate-cert-for-deploy-OZWVIWOO.js +0 -7
- package/dist/chunks/image-EFBQXTAP.js +0 -7
- package/dist/chunks/import-builders-2G4KVI4T.js +0 -7
- package/dist/chunks/login-WYDX5KZN.js +0 -7
- package/dist/chunks/logs-E3RZLAT2.js +0 -7
- package/dist/chunks/migrate-experimental-services-GPGYPN66.js +0 -7
- package/dist/chunks/prompt-missing-credentials-7F7MUAWK.js +0 -7
- package/dist/chunks/pull-4LISUHDN.js +0 -7
- package/dist/chunks/purchase-domain-if-available-QH2OHRLZ.js +0 -7
- package/dist/chunks/query-QCIU5IB4.js +0 -7
- package/dist/chunks/routes-SBMN6SDF.js +0 -7
- package/dist/chunks/rule-inspect-LQISNCBT.js +0 -8
- package/dist/chunks/select-org-EKDOS2CQ.js +0 -7
- package/dist/chunks/setup-and-link-FHHZAU65.js +0 -7
- package/dist/chunks/stamp-TKONNIJ5.js +0 -7
- package/dist/chunks/table-SCLK33K7.js +0 -7
- package/dist/chunks/token-MYYNOUIT.js +0 -7
- package/dist/chunks/token-util-OJHS52JP.js +0 -7
- package/dist/chunks/validate-config-K42CVRCZ.js +0 -7
|
@@ -4,4 +4,4 @@ import { dirname as __dirname_ } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
|
-
import{__export}from"./chunk-BZENIQ7N.js";import{Buffer as Buffer2}from"node:buffer";import{createHash}from"node:crypto";var digest=(algorithm,data)=>createHash(algorithm).update(data).digest(),digest_default=digest;var encoder=new TextEncoder,decoder=new TextDecoder,MAX_INT32=2**32;function concat(...buffers){let size=buffers.reduce((acc,{length})=>acc+length,0),buf=new Uint8Array(size),i=0;for(let buffer of buffers)buf.set(buffer,i),i+=buffer.length;return buf}function p2s(alg,p2sInput){return concat(encoder.encode(alg),new Uint8Array([0]),p2sInput)}function writeUInt32BE(buf,value,offset){if(value<0||value>=MAX_INT32)throw new RangeError(`value must be >= 0 and <= ${MAX_INT32-1}. Received ${value}`);buf.set([value>>>24,value>>>16,value>>>8,value&255],offset)}function uint64be(value){let high=Math.floor(value/MAX_INT32),low=value%MAX_INT32,buf=new Uint8Array(8);return writeUInt32BE(buf,high,0),writeUInt32BE(buf,low,4),buf}function uint32be(value){let buf=new Uint8Array(4);return writeUInt32BE(buf,value),buf}function lengthAndInput(input){return concat(uint32be(input.length),input)}async function concatKdf(secret,bits,value){let iterations=Math.ceil((bits>>3)/32),res=new Uint8Array(iterations*32);for(let iter=0;iter<iterations;iter++){let buf=new Uint8Array(4+secret.length+value.length);buf.set(uint32be(iter+1)),buf.set(secret,4),buf.set(value,4+secret.length),res.set(await digest_default("sha256",buf),iter*32)}return res.slice(0,bits>>3)}function normalize(input){let encoded=input;return encoded instanceof Uint8Array&&(encoded=decoder.decode(encoded)),encoded}var encode=input=>Buffer2.from(input).toString("base64url");var decode=input=>new Uint8Array(Buffer2.from(normalize(input),"base64url"));import{createDecipheriv,KeyObject}from"node:crypto";var JOSEError=class extends Error{static code="ERR_JOSE_GENERIC";code="ERR_JOSE_GENERIC";constructor(message2,options){super(message2,options),this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}},JWTClaimValidationFailed=class extends JOSEError{static code="ERR_JWT_CLAIM_VALIDATION_FAILED";code="ERR_JWT_CLAIM_VALIDATION_FAILED";claim;reason;payload;constructor(message2,payload,claim="unspecified",reason="unspecified"){super(message2,{cause:{claim,reason,payload}}),this.claim=claim,this.reason=reason,this.payload=payload}},JWTExpired=class extends JOSEError{static code="ERR_JWT_EXPIRED";code="ERR_JWT_EXPIRED";claim;reason;payload;constructor(message2,payload,claim="unspecified",reason="unspecified"){super(message2,{cause:{claim,reason,payload}}),this.claim=claim,this.reason=reason,this.payload=payload}},JOSEAlgNotAllowed=class extends JOSEError{static code="ERR_JOSE_ALG_NOT_ALLOWED";code="ERR_JOSE_ALG_NOT_ALLOWED"},JOSENotSupported=class extends JOSEError{static code="ERR_JOSE_NOT_SUPPORTED";code="ERR_JOSE_NOT_SUPPORTED"},JWEDecryptionFailed=class extends JOSEError{static code="ERR_JWE_DECRYPTION_FAILED";code="ERR_JWE_DECRYPTION_FAILED";constructor(message2="decryption operation failed",options){super(message2,options)}},JWEInvalid=class extends JOSEError{static code="ERR_JWE_INVALID";code="ERR_JWE_INVALID"};var JWTInvalid=class extends JOSEError{static code="ERR_JWT_INVALID";code="ERR_JWT_INVALID"};var JWKSMultipleMatchingKeys=class extends JOSEError{[Symbol.asyncIterator];static code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";constructor(message2="multiple matching keys found in the JSON Web Key Set",options){super(message2,options)}};import{randomFillSync}from"node:crypto";function bitLength(alg){switch(alg){case"A128GCM":case"A128GCMKW":case"A192GCM":case"A192GCMKW":case"A256GCM":case"A256GCMKW":return 96;case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return 128;default:throw new JOSENotSupported(`Unsupported JWE Algorithm: ${alg}`)}}var iv_default=alg=>randomFillSync(new Uint8Array(bitLength(alg)>>3));var checkIvLength=(enc,iv)=>{if(iv.length<<3!==bitLength(enc))throw new JWEInvalid("Invalid Initialization Vector length")},check_iv_length_default=checkIvLength;import*as util from"node:util";var is_key_object_default=obj=>util.types.isKeyObject(obj);var checkCekLength=(enc,cek)=>{let expected;switch(enc){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":expected=parseInt(enc.slice(-3),10);break;case"A128GCM":case"A192GCM":case"A256GCM":expected=parseInt(enc.slice(1,4),10);break;default:throw new JOSENotSupported(`Content Encryption Algorithm ${enc} is not supported either by JOSE or your javascript runtime`)}if(cek instanceof Uint8Array){let actual=cek.byteLength<<3;if(actual!==expected)throw new JWEInvalid(`Invalid Content Encryption Key length. Expected ${expected} bits, got ${actual} bits`);return}if(is_key_object_default(cek)&&cek.type==="secret"){let actual=cek.symmetricKeySize<<3;if(actual!==expected)throw new JWEInvalid(`Invalid Content Encryption Key length. Expected ${expected} bits, got ${actual} bits`);return}throw new TypeError("Invalid Content Encryption Key type")},check_cek_length_default=checkCekLength;import{timingSafeEqual as impl}from"node:crypto";var timingSafeEqual=impl,timing_safe_equal_default=timingSafeEqual;import{createHmac}from"node:crypto";function cbcTag(aad,iv,ciphertext,macSize,macKey,keySize){let macData=concat(aad,iv,ciphertext,uint64be(aad.length<<3)),hmac=createHmac(`sha${macSize}`,macKey);return hmac.update(macData),hmac.digest().slice(0,keySize>>3)}import*as crypto from"node:crypto";import*as util2 from"node:util";var webcrypto2=crypto.webcrypto,webcrypto_default=webcrypto2,isCryptoKey=key=>util2.types.isCryptoKey(key);function unusable(name,prop="algorithm.name"){return new TypeError(`CryptoKey does not support this operation, its ${prop} must be ${name}`)}function isAlgorithm(algorithm,name){return algorithm.name===name}function getHashLength(hash){return parseInt(hash.name.slice(4),10)}function checkUsage(key,usages){if(usages.length&&!usages.some(expected=>key.usages.includes(expected))){let msg="CryptoKey does not support this operation, its usages must include ";if(usages.length>2){let last=usages.pop();msg+=`one of ${usages.join(", ")}, or ${last}.`}else usages.length===2?msg+=`one of ${usages[0]} or ${usages[1]}.`:msg+=`${usages[0]}.`;throw new TypeError(msg)}}function checkEncCryptoKey(key,alg,...usages){switch(alg){case"A128GCM":case"A192GCM":case"A256GCM":{if(!isAlgorithm(key.algorithm,"AES-GCM"))throw unusable("AES-GCM");let expected=parseInt(alg.slice(1,4),10);if(key.algorithm.length!==expected)throw unusable(expected,"algorithm.length");break}case"A128KW":case"A192KW":case"A256KW":{if(!isAlgorithm(key.algorithm,"AES-KW"))throw unusable("AES-KW");let expected=parseInt(alg.slice(1,4),10);if(key.algorithm.length!==expected)throw unusable(expected,"algorithm.length");break}case"ECDH":{switch(key.algorithm.name){case"ECDH":case"X25519":case"X448":break;default:throw unusable("ECDH, X25519, or X448")}break}case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":if(!isAlgorithm(key.algorithm,"PBKDF2"))throw unusable("PBKDF2");break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":{if(!isAlgorithm(key.algorithm,"RSA-OAEP"))throw unusable("RSA-OAEP");let expected=parseInt(alg.slice(9),10)||1;if(getHashLength(key.algorithm.hash)!==expected)throw unusable(`SHA-${expected}`,"algorithm.hash");break}default:throw new TypeError("CryptoKey does not support this operation")}checkUsage(key,usages)}function message(msg,actual,...types4){if(types4=types4.filter(Boolean),types4.length>2){let last=types4.pop();msg+=`one of type ${types4.join(", ")}, or ${last}.`}else types4.length===2?msg+=`one of type ${types4[0]} or ${types4[1]}.`:msg+=`of type ${types4[0]}.`;return actual==null?msg+=` Received ${actual}`:typeof actual=="function"&&actual.name?msg+=` Received function ${actual.name}`:typeof actual=="object"&&actual!=null&&actual.constructor?.name&&(msg+=` Received an instance of ${actual.constructor.name}`),msg}var invalid_key_input_default=(actual,...types4)=>message("Key must be ",actual,...types4);function withAlg(alg,actual,...types4){return message(`Key for the ${alg} algorithm must be `,actual,...types4)}import{getCiphers}from"node:crypto";var ciphers,ciphers_default=algorithm=>(ciphers||=new Set(getCiphers()),ciphers.has(algorithm));var is_key_like_default=key=>is_key_object_default(key)||isCryptoKey(key),types3=["KeyObject"];(globalThis.CryptoKey||webcrypto_default?.CryptoKey)&&types3.push("CryptoKey");function cbcDecrypt(enc,cek,ciphertext,iv,tag2,aad){let keySize=parseInt(enc.slice(1,4),10);is_key_object_default(cek)&&(cek=cek.export());let encKey=cek.subarray(keySize>>3),macKey=cek.subarray(0,keySize>>3),macSize=parseInt(enc.slice(-3),10),algorithm=`aes-${keySize}-cbc`;if(!ciphers_default(algorithm))throw new JOSENotSupported(`alg ${enc} is not supported by your javascript runtime`);let expectedTag=cbcTag(aad,iv,ciphertext,macSize,macKey,keySize),macCheckPassed;try{macCheckPassed=timing_safe_equal_default(tag2,expectedTag)}catch{}if(!macCheckPassed)throw new JWEDecryptionFailed;let plaintext;try{let decipher=createDecipheriv(algorithm,encKey,iv);plaintext=concat(decipher.update(ciphertext),decipher.final())}catch{}if(!plaintext)throw new JWEDecryptionFailed;return plaintext}function gcmDecrypt(enc,cek,ciphertext,iv,tag2,aad){let algorithm=`aes-${parseInt(enc.slice(1,4),10)}-gcm`;if(!ciphers_default(algorithm))throw new JOSENotSupported(`alg ${enc} is not supported by your javascript runtime`);try{let decipher=createDecipheriv(algorithm,cek,iv,{authTagLength:16});decipher.setAuthTag(tag2),aad.byteLength&&decipher.setAAD(aad,{plaintextLength:ciphertext.length});let plaintext=decipher.update(ciphertext);return decipher.final(),plaintext}catch{throw new JWEDecryptionFailed}}var decrypt=(enc,cek,ciphertext,iv,tag2,aad)=>{let key;if(isCryptoKey(cek))checkEncCryptoKey(cek,enc,"decrypt"),key=KeyObject.from(cek);else if(cek instanceof Uint8Array||is_key_object_default(cek))key=cek;else throw new TypeError(invalid_key_input_default(cek,...types3,"Uint8Array"));if(!iv)throw new JWEInvalid("JWE Initialization Vector missing");if(!tag2)throw new JWEInvalid("JWE Authentication Tag missing");switch(check_cek_length_default(enc,key),check_iv_length_default(enc,iv),enc){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return cbcDecrypt(enc,key,ciphertext,iv,tag2,aad);case"A128GCM":case"A192GCM":case"A256GCM":return gcmDecrypt(enc,key,ciphertext,iv,tag2,aad);default:throw new JOSENotSupported("Unsupported JWE Content Encryption Algorithm")}},decrypt_default=decrypt;var isDisjoint=(...headers)=>{let sources=headers.filter(Boolean);if(sources.length===0||sources.length===1)return!0;let acc;for(let header of sources){let parameters=Object.keys(header);if(!acc||acc.size===0){acc=new Set(parameters);continue}for(let parameter of parameters){if(acc.has(parameter))return!1;acc.add(parameter)}}return!0},is_disjoint_default=isDisjoint;function isObjectLike(value){return typeof value=="object"&&value!==null}function isObject(input){if(!isObjectLike(input)||Object.prototype.toString.call(input)!=="[object Object]")return!1;if(Object.getPrototypeOf(input)===null)return!0;let proto=input;for(;Object.getPrototypeOf(proto)!==null;)proto=Object.getPrototypeOf(proto);return Object.getPrototypeOf(input)===proto}import{Buffer as Buffer3}from"node:buffer";import{KeyObject as KeyObject2,createDecipheriv as createDecipheriv2,createCipheriv,createSecretKey}from"node:crypto";function checkKeySize(key,alg){if(key.symmetricKeySize<<3!==parseInt(alg.slice(1,4),10))throw new TypeError(`Invalid key size for alg: ${alg}`)}function ensureKeyObject(key,alg,usage){if(is_key_object_default(key))return key;if(key instanceof Uint8Array)return createSecretKey(key);if(isCryptoKey(key))return checkEncCryptoKey(key,alg,usage),KeyObject2.from(key);throw new TypeError(invalid_key_input_default(key,...types3,"Uint8Array"))}var wrap=(alg,key,cek)=>{let algorithm=`aes${parseInt(alg.slice(1,4),10)}-wrap`;if(!ciphers_default(algorithm))throw new JOSENotSupported(`alg ${alg} is not supported either by JOSE or your javascript runtime`);let keyObject=ensureKeyObject(key,alg,"wrapKey");checkKeySize(keyObject,alg);let cipher=createCipheriv(algorithm,keyObject,Buffer3.alloc(8,166));return concat(cipher.update(cek),cipher.final())},unwrap=(alg,key,encryptedKey)=>{let algorithm=`aes${parseInt(alg.slice(1,4),10)}-wrap`;if(!ciphers_default(algorithm))throw new JOSENotSupported(`alg ${alg} is not supported either by JOSE or your javascript runtime`);let keyObject=ensureKeyObject(key,alg,"unwrapKey");checkKeySize(keyObject,alg);let cipher=createDecipheriv2(algorithm,keyObject,Buffer3.alloc(8,166));return concat(cipher.update(encryptedKey),cipher.final())};import{diffieHellman,generateKeyPair as generateKeyPairCb,KeyObject as KeyObject4}from"node:crypto";import{promisify}from"node:util";import{KeyObject as KeyObject3}from"node:crypto";function isJWK(key){return isObject(key)&&typeof key.kty=="string"}function isPrivateJWK(key){return key.kty!=="oct"&&typeof key.d=="string"}function isPublicJWK(key){return key.kty!=="oct"&&typeof key.d>"u"}function isSecretJWK(key){return isJWK(key)&&key.kty==="oct"&&typeof key.k=="string"}var namedCurveToJOSE=namedCurve=>{switch(namedCurve){case"prime256v1":return"P-256";case"secp384r1":return"P-384";case"secp521r1":return"P-521";case"secp256k1":return"secp256k1";default:throw new JOSENotSupported("Unsupported key curve for this operation")}},getNamedCurve=(kee,raw)=>{let key;if(isCryptoKey(kee))key=KeyObject3.from(kee);else if(is_key_object_default(kee))key=kee;else{if(isJWK(kee))return kee.crv;throw new TypeError(invalid_key_input_default(kee,...types3))}if(key.type==="secret")throw new TypeError('only "private" or "public" type keys can be used for this operation');switch(key.asymmetricKeyType){case"ed25519":case"ed448":return`Ed${key.asymmetricKeyType.slice(2)}`;case"x25519":case"x448":return`X${key.asymmetricKeyType.slice(1)}`;case"ec":{let namedCurve=key.asymmetricKeyDetails.namedCurve;return raw?namedCurve:namedCurveToJOSE(namedCurve)}default:throw new TypeError("Invalid asymmetric key type for this operation")}},get_named_curve_default=getNamedCurve;var generateKeyPair=promisify(generateKeyPairCb);async function deriveKey(publicKee,privateKee,algorithm,keyLength,apu=new Uint8Array(0),apv=new Uint8Array(0)){let publicKey;if(isCryptoKey(publicKee))checkEncCryptoKey(publicKee,"ECDH"),publicKey=KeyObject4.from(publicKee);else if(is_key_object_default(publicKee))publicKey=publicKee;else throw new TypeError(invalid_key_input_default(publicKee,...types3));let privateKey;if(isCryptoKey(privateKee))checkEncCryptoKey(privateKee,"ECDH","deriveBits"),privateKey=KeyObject4.from(privateKee);else if(is_key_object_default(privateKee))privateKey=privateKee;else throw new TypeError(invalid_key_input_default(privateKee,...types3));let value=concat(lengthAndInput(encoder.encode(algorithm)),lengthAndInput(apu),lengthAndInput(apv),uint32be(keyLength)),sharedSecret=diffieHellman({privateKey,publicKey});return concatKdf(sharedSecret,keyLength,value)}async function generateEpk(kee){let key;if(isCryptoKey(kee))key=KeyObject4.from(kee);else if(is_key_object_default(kee))key=kee;else throw new TypeError(invalid_key_input_default(kee,...types3));switch(key.asymmetricKeyType){case"x25519":return generateKeyPair("x25519");case"x448":return generateKeyPair("x448");case"ec":{let namedCurve=get_named_curve_default(key);return generateKeyPair("ec",{namedCurve})}default:throw new JOSENotSupported("Invalid or unsupported EPK")}}var ecdhAllowed=key=>["P-256","P-384","P-521","X25519","X448"].includes(get_named_curve_default(key));import{promisify as promisify2}from"node:util";import{KeyObject as KeyObject5,pbkdf2 as pbkdf2cb}from"node:crypto";function checkP2s(p2s2){if(!(p2s2 instanceof Uint8Array)||p2s2.length<8)throw new JWEInvalid("PBES2 Salt Input must be 8 or more octets")}var pbkdf2=promisify2(pbkdf2cb);function getPassword(key,alg){if(is_key_object_default(key))return key.export();if(key instanceof Uint8Array)return key;if(isCryptoKey(key))return checkEncCryptoKey(key,alg,"deriveBits","deriveKey"),KeyObject5.from(key).export();throw new TypeError(invalid_key_input_default(key,...types3,"Uint8Array"))}var encrypt=async(alg,key,cek,p2c=2048,p2s2=randomFillSync(new Uint8Array(16)))=>{checkP2s(p2s2);let salt=p2s(alg,p2s2),keylen=parseInt(alg.slice(13,16),10)>>3,password=getPassword(key,alg),derivedKey=await pbkdf2(password,salt,p2c,keylen,`sha${alg.slice(8,11)}`);return{encryptedKey:await wrap(alg.slice(-6),derivedKey,cek),p2c,p2s:encode(p2s2)}},decrypt2=async(alg,key,encryptedKey,p2c,p2s2)=>{checkP2s(p2s2);let salt=p2s(alg,p2s2),keylen=parseInt(alg.slice(13,16),10)>>3,password=getPassword(key,alg),derivedKey=await pbkdf2(password,salt,p2c,keylen,`sha${alg.slice(8,11)}`);return unwrap(alg.slice(-6),derivedKey,encryptedKey)};import{KeyObject as KeyObject7,publicEncrypt,constants,privateDecrypt}from"node:crypto";import{deprecate}from"node:util";import{KeyObject as KeyObject6}from"node:crypto";var check_key_length_default=(key,alg)=>{let modulusLength;try{key instanceof KeyObject6?modulusLength=key.asymmetricKeyDetails?.modulusLength:modulusLength=Buffer.from(key.n,"base64url").byteLength<<3}catch{}if(typeof modulusLength!="number"||modulusLength<2048)throw new TypeError(`${alg} requires key modulusLength to be 2048 bits or larger`)};var checkKey=(key,alg)=>{if(key.asymmetricKeyType!=="rsa")throw new TypeError("Invalid key for this operation, its asymmetricKeyType must be rsa");check_key_length_default(key,alg)},RSA1_5=deprecate(()=>constants.RSA_PKCS1_PADDING,'The RSA1_5 "alg" (JWE Algorithm) is deprecated and will be removed in the next major revision.'),resolvePadding=alg=>{switch(alg){case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":return constants.RSA_PKCS1_OAEP_PADDING;case"RSA1_5":return RSA1_5();default:return}},resolveOaepHash=alg=>{switch(alg){case"RSA-OAEP":return"sha1";case"RSA-OAEP-256":return"sha256";case"RSA-OAEP-384":return"sha384";case"RSA-OAEP-512":return"sha512";default:return}};function ensureKeyObject2(key,alg,...usages){if(is_key_object_default(key))return key;if(isCryptoKey(key))return checkEncCryptoKey(key,alg,...usages),KeyObject7.from(key);throw new TypeError(invalid_key_input_default(key,...types3))}var encrypt2=(alg,key,cek)=>{let padding=resolvePadding(alg),oaepHash=resolveOaepHash(alg),keyObject=ensureKeyObject2(key,alg,"wrapKey","encrypt");return checkKey(keyObject,alg),publicEncrypt({key:keyObject,oaepHash,padding},cek)},decrypt3=(alg,key,encryptedKey)=>{let padding=resolvePadding(alg),oaepHash=resolveOaepHash(alg),keyObject=ensureKeyObject2(key,alg,"unwrapKey","decrypt");return checkKey(keyObject,alg),privateDecrypt({key:keyObject,oaepHash,padding},encryptedKey)};var normalize_key_default={};function bitLength2(alg){switch(alg){case"A128GCM":return 128;case"A192GCM":return 192;case"A256GCM":case"A128CBC-HS256":return 256;case"A192CBC-HS384":return 384;case"A256CBC-HS512":return 512;default:throw new JOSENotSupported(`Unsupported JWE Algorithm: ${alg}`)}}var cek_default=alg=>randomFillSync(new Uint8Array(bitLength2(alg)>>3));import{createPrivateKey,createPublicKey}from"node:crypto";var parse=key=>key.d?createPrivateKey({format:"jwk",key}):createPublicKey({format:"jwk",key}),jwk_to_key_default=parse;async function importJWK(jwk,alg){if(!isObject(jwk))throw new TypeError("JWK must be an object");switch(alg||=jwk.alg,jwk.kty){case"oct":if(typeof jwk.k!="string"||!jwk.k)throw new TypeError('missing "k" (Key Value) Parameter value');return decode(jwk.k);case"RSA":if(jwk.oth!==void 0)throw new JOSENotSupported('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');case"EC":case"OKP":return jwk_to_key_default({...jwk,alg});default:throw new JOSENotSupported('Unsupported "kty" (Key Type) Parameter value')}}var tag=key=>key?.[Symbol.toStringTag],jwkMatchesOp=(alg,key,usage)=>{if(key.use!==void 0&&key.use!=="sig")throw new TypeError("Invalid key for this operation, when present its use must be sig");if(key.key_ops!==void 0&&key.key_ops.includes?.(usage)!==!0)throw new TypeError(`Invalid key for this operation, when present its key_ops must include ${usage}`);if(key.alg!==void 0&&key.alg!==alg)throw new TypeError(`Invalid key for this operation, when present its alg must be ${alg}`);return!0},symmetricTypeCheck=(alg,key,usage,allowJwk)=>{if(!(key instanceof Uint8Array)){if(allowJwk&&isJWK(key)){if(isSecretJWK(key)&&jwkMatchesOp(alg,key,usage))return;throw new TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present')}if(!is_key_like_default(key))throw new TypeError(withAlg(alg,key,...types3,"Uint8Array",allowJwk?"JSON Web Key":null));if(key.type!=="secret")throw new TypeError(`${tag(key)} instances for symmetric algorithms must be of type "secret"`)}},asymmetricTypeCheck=(alg,key,usage,allowJwk)=>{if(allowJwk&&isJWK(key))switch(usage){case"sign":if(isPrivateJWK(key)&&jwkMatchesOp(alg,key,usage))return;throw new TypeError("JSON Web Key for this operation be a private JWK");case"verify":if(isPublicJWK(key)&&jwkMatchesOp(alg,key,usage))return;throw new TypeError("JSON Web Key for this operation be a public JWK")}if(!is_key_like_default(key))throw new TypeError(withAlg(alg,key,...types3,allowJwk?"JSON Web Key":null));if(key.type==="secret")throw new TypeError(`${tag(key)} instances for asymmetric algorithms must not be of type "secret"`);if(usage==="sign"&&key.type==="public")throw new TypeError(`${tag(key)} instances for asymmetric algorithm signing must be of type "private"`);if(usage==="decrypt"&&key.type==="public")throw new TypeError(`${tag(key)} instances for asymmetric algorithm decryption must be of type "private"`);if(key.algorithm&&usage==="verify"&&key.type==="private")throw new TypeError(`${tag(key)} instances for asymmetric algorithm verifying must be of type "public"`);if(key.algorithm&&usage==="encrypt"&&key.type==="private")throw new TypeError(`${tag(key)} instances for asymmetric algorithm encryption must be of type "public"`)};function checkKeyType(allowJwk,alg,key,usage){alg.startsWith("HS")||alg==="dir"||alg.startsWith("PBES2")||/^A\d{3}(?:GCM)?KW$/.test(alg)?symmetricTypeCheck(alg,key,usage,allowJwk):asymmetricTypeCheck(alg,key,usage,allowJwk)}var check_key_type_default=checkKeyType.bind(void 0,!1),checkKeyTypeWithJwk=checkKeyType.bind(void 0,!0);import{createCipheriv as createCipheriv2,KeyObject as KeyObject8}from"node:crypto";function cbcEncrypt(enc,plaintext,cek,iv,aad){let keySize=parseInt(enc.slice(1,4),10);is_key_object_default(cek)&&(cek=cek.export());let encKey=cek.subarray(keySize>>3),macKey=cek.subarray(0,keySize>>3),algorithm=`aes-${keySize}-cbc`;if(!ciphers_default(algorithm))throw new JOSENotSupported(`alg ${enc} is not supported by your javascript runtime`);let cipher=createCipheriv2(algorithm,encKey,iv),ciphertext=concat(cipher.update(plaintext),cipher.final()),macSize=parseInt(enc.slice(-3),10),tag2=cbcTag(aad,iv,ciphertext,macSize,macKey,keySize);return{ciphertext,tag:tag2,iv}}function gcmEncrypt(enc,plaintext,cek,iv,aad){let algorithm=`aes-${parseInt(enc.slice(1,4),10)}-gcm`;if(!ciphers_default(algorithm))throw new JOSENotSupported(`alg ${enc} is not supported by your javascript runtime`);let cipher=createCipheriv2(algorithm,cek,iv,{authTagLength:16});aad.byteLength&&cipher.setAAD(aad,{plaintextLength:plaintext.length});let ciphertext=cipher.update(plaintext);cipher.final();let tag2=cipher.getAuthTag();return{ciphertext,tag:tag2,iv}}var encrypt3=(enc,plaintext,cek,iv,aad)=>{let key;if(isCryptoKey(cek))checkEncCryptoKey(cek,enc,"encrypt"),key=KeyObject8.from(cek);else if(cek instanceof Uint8Array||is_key_object_default(cek))key=cek;else throw new TypeError(invalid_key_input_default(cek,...types3,"Uint8Array"));switch(check_cek_length_default(enc,key),iv?check_iv_length_default(enc,iv):iv=iv_default(enc),enc){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return cbcEncrypt(enc,plaintext,key,iv,aad);case"A128GCM":case"A192GCM":case"A256GCM":return gcmEncrypt(enc,plaintext,key,iv,aad);default:throw new JOSENotSupported("Unsupported JWE Content Encryption Algorithm")}},encrypt_default=encrypt3;async function wrap2(alg,key,cek,iv){let jweAlgorithm=alg.slice(0,7),wrapped=await encrypt_default(jweAlgorithm,cek,key,iv,new Uint8Array(0));return{encryptedKey:wrapped.ciphertext,iv:encode(wrapped.iv),tag:encode(wrapped.tag)}}async function unwrap2(alg,key,encryptedKey,iv,tag2){let jweAlgorithm=alg.slice(0,7);return decrypt_default(jweAlgorithm,key,encryptedKey,iv,tag2,new Uint8Array(0))}async function decryptKeyManagement(alg,key,encryptedKey,joseHeader,options){switch(check_key_type_default(alg,key,"decrypt"),key=await normalize_key_default.normalizePrivateKey?.(key,alg)||key,alg){case"dir":{if(encryptedKey!==void 0)throw new JWEInvalid("Encountered unexpected JWE Encrypted Key");return key}case"ECDH-ES":if(encryptedKey!==void 0)throw new JWEInvalid("Encountered unexpected JWE Encrypted Key");case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{if(!isObject(joseHeader.epk))throw new JWEInvalid('JOSE Header "epk" (Ephemeral Public Key) missing or invalid');if(!ecdhAllowed(key))throw new JOSENotSupported("ECDH with the provided key is not allowed or not supported by your javascript runtime");let epk=await importJWK(joseHeader.epk,alg),partyUInfo,partyVInfo;if(joseHeader.apu!==void 0){if(typeof joseHeader.apu!="string")throw new JWEInvalid('JOSE Header "apu" (Agreement PartyUInfo) invalid');try{partyUInfo=decode(joseHeader.apu)}catch{throw new JWEInvalid("Failed to base64url decode the apu")}}if(joseHeader.apv!==void 0){if(typeof joseHeader.apv!="string")throw new JWEInvalid('JOSE Header "apv" (Agreement PartyVInfo) invalid');try{partyVInfo=decode(joseHeader.apv)}catch{throw new JWEInvalid("Failed to base64url decode the apv")}}let sharedSecret=await deriveKey(epk,key,alg==="ECDH-ES"?joseHeader.enc:alg,alg==="ECDH-ES"?bitLength2(joseHeader.enc):parseInt(alg.slice(-5,-2),10),partyUInfo,partyVInfo);if(alg==="ECDH-ES")return sharedSecret;if(encryptedKey===void 0)throw new JWEInvalid("JWE Encrypted Key missing");return unwrap(alg.slice(-6),sharedSecret,encryptedKey)}case"RSA1_5":case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":{if(encryptedKey===void 0)throw new JWEInvalid("JWE Encrypted Key missing");return decrypt3(alg,key,encryptedKey)}case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":{if(encryptedKey===void 0)throw new JWEInvalid("JWE Encrypted Key missing");if(typeof joseHeader.p2c!="number")throw new JWEInvalid('JOSE Header "p2c" (PBES2 Count) missing or invalid');let p2cLimit=options?.maxPBES2Count||1e4;if(joseHeader.p2c>p2cLimit)throw new JWEInvalid('JOSE Header "p2c" (PBES2 Count) out is of acceptable bounds');if(typeof joseHeader.p2s!="string")throw new JWEInvalid('JOSE Header "p2s" (PBES2 Salt) missing or invalid');let p2s2;try{p2s2=decode(joseHeader.p2s)}catch{throw new JWEInvalid("Failed to base64url decode the p2s")}return decrypt2(alg,key,encryptedKey,joseHeader.p2c,p2s2)}case"A128KW":case"A192KW":case"A256KW":{if(encryptedKey===void 0)throw new JWEInvalid("JWE Encrypted Key missing");return unwrap(alg,key,encryptedKey)}case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":{if(encryptedKey===void 0)throw new JWEInvalid("JWE Encrypted Key missing");if(typeof joseHeader.iv!="string")throw new JWEInvalid('JOSE Header "iv" (Initialization Vector) missing or invalid');if(typeof joseHeader.tag!="string")throw new JWEInvalid('JOSE Header "tag" (Authentication Tag) missing or invalid');let iv;try{iv=decode(joseHeader.iv)}catch{throw new JWEInvalid("Failed to base64url decode the iv")}let tag2;try{tag2=decode(joseHeader.tag)}catch{throw new JWEInvalid("Failed to base64url decode the tag")}return unwrap2(alg,key,encryptedKey,iv,tag2)}default:throw new JOSENotSupported('Invalid or unsupported "alg" (JWE Algorithm) header value')}}var decrypt_key_management_default=decryptKeyManagement;function validateCrit(Err,recognizedDefault,recognizedOption,protectedHeader,joseHeader){if(joseHeader.crit!==void 0&&protectedHeader?.crit===void 0)throw new Err('"crit" (Critical) Header Parameter MUST be integrity protected');if(!protectedHeader||protectedHeader.crit===void 0)return new Set;if(!Array.isArray(protectedHeader.crit)||protectedHeader.crit.length===0||protectedHeader.crit.some(input=>typeof input!="string"||input.length===0))throw new Err('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let recognized;recognizedOption!==void 0?recognized=new Map([...Object.entries(recognizedOption),...recognizedDefault.entries()]):recognized=recognizedDefault;for(let parameter of protectedHeader.crit){if(!recognized.has(parameter))throw new JOSENotSupported(`Extension Header Parameter "${parameter}" is not recognized`);if(joseHeader[parameter]===void 0)throw new Err(`Extension Header Parameter "${parameter}" is missing`);if(recognized.get(parameter)&&protectedHeader[parameter]===void 0)throw new Err(`Extension Header Parameter "${parameter}" MUST be integrity protected`)}return new Set(protectedHeader.crit)}var validate_crit_default=validateCrit;var validateAlgorithms=(option,algorithms)=>{if(algorithms!==void 0&&(!Array.isArray(algorithms)||algorithms.some(s=>typeof s!="string")))throw new TypeError(`"${option}" option must be an array of strings`);if(algorithms)return new Set(algorithms)},validate_algorithms_default=validateAlgorithms;async function flattenedDecrypt(jwe,key,options){if(!isObject(jwe))throw new JWEInvalid("Flattened JWE must be an object");if(jwe.protected===void 0&&jwe.header===void 0&&jwe.unprotected===void 0)throw new JWEInvalid("JOSE Header missing");if(jwe.iv!==void 0&&typeof jwe.iv!="string")throw new JWEInvalid("JWE Initialization Vector incorrect type");if(typeof jwe.ciphertext!="string")throw new JWEInvalid("JWE Ciphertext missing or incorrect type");if(jwe.tag!==void 0&&typeof jwe.tag!="string")throw new JWEInvalid("JWE Authentication Tag incorrect type");if(jwe.protected!==void 0&&typeof jwe.protected!="string")throw new JWEInvalid("JWE Protected Header incorrect type");if(jwe.encrypted_key!==void 0&&typeof jwe.encrypted_key!="string")throw new JWEInvalid("JWE Encrypted Key incorrect type");if(jwe.aad!==void 0&&typeof jwe.aad!="string")throw new JWEInvalid("JWE AAD incorrect type");if(jwe.header!==void 0&&!isObject(jwe.header))throw new JWEInvalid("JWE Shared Unprotected Header incorrect type");if(jwe.unprotected!==void 0&&!isObject(jwe.unprotected))throw new JWEInvalid("JWE Per-Recipient Unprotected Header incorrect type");let parsedProt;if(jwe.protected)try{let protectedHeader2=decode(jwe.protected);parsedProt=JSON.parse(decoder.decode(protectedHeader2))}catch{throw new JWEInvalid("JWE Protected Header is invalid")}if(!is_disjoint_default(parsedProt,jwe.header,jwe.unprotected))throw new JWEInvalid("JWE Protected, JWE Unprotected Header, and JWE Per-Recipient Unprotected Header Parameter names must be disjoint");let joseHeader={...parsedProt,...jwe.header,...jwe.unprotected};if(validate_crit_default(JWEInvalid,new Map,options?.crit,parsedProt,joseHeader),joseHeader.zip!==void 0)throw new JOSENotSupported('JWE "zip" (Compression Algorithm) Header Parameter is not supported.');let{alg,enc}=joseHeader;if(typeof alg!="string"||!alg)throw new JWEInvalid("missing JWE Algorithm (alg) in JWE Header");if(typeof enc!="string"||!enc)throw new JWEInvalid("missing JWE Encryption Algorithm (enc) in JWE Header");let keyManagementAlgorithms=options&&validate_algorithms_default("keyManagementAlgorithms",options.keyManagementAlgorithms),contentEncryptionAlgorithms=options&&validate_algorithms_default("contentEncryptionAlgorithms",options.contentEncryptionAlgorithms);if(keyManagementAlgorithms&&!keyManagementAlgorithms.has(alg)||!keyManagementAlgorithms&&alg.startsWith("PBES2"))throw new JOSEAlgNotAllowed('"alg" (Algorithm) Header Parameter value not allowed');if(contentEncryptionAlgorithms&&!contentEncryptionAlgorithms.has(enc))throw new JOSEAlgNotAllowed('"enc" (Encryption Algorithm) Header Parameter value not allowed');let encryptedKey;if(jwe.encrypted_key!==void 0)try{encryptedKey=decode(jwe.encrypted_key)}catch{throw new JWEInvalid("Failed to base64url decode the encrypted_key")}let resolvedKey=!1;typeof key=="function"&&(key=await key(parsedProt,jwe),resolvedKey=!0);let cek;try{cek=await decrypt_key_management_default(alg,key,encryptedKey,joseHeader,options)}catch(err){if(err instanceof TypeError||err instanceof JWEInvalid||err instanceof JOSENotSupported)throw err;cek=cek_default(enc)}let iv,tag2;if(jwe.iv!==void 0)try{iv=decode(jwe.iv)}catch{throw new JWEInvalid("Failed to base64url decode the iv")}if(jwe.tag!==void 0)try{tag2=decode(jwe.tag)}catch{throw new JWEInvalid("Failed to base64url decode the tag")}let protectedHeader=encoder.encode(jwe.protected??""),additionalData;jwe.aad!==void 0?additionalData=concat(protectedHeader,encoder.encode("."),encoder.encode(jwe.aad)):additionalData=protectedHeader;let ciphertext;try{ciphertext=decode(jwe.ciphertext)}catch{throw new JWEInvalid("Failed to base64url decode the ciphertext")}let result={plaintext:await decrypt_default(enc,cek,ciphertext,iv,tag2,additionalData)};if(jwe.protected!==void 0&&(result.protectedHeader=parsedProt),jwe.aad!==void 0)try{result.additionalAuthenticatedData=decode(jwe.aad)}catch{throw new JWEInvalid("Failed to base64url decode the aad")}return jwe.unprotected!==void 0&&(result.sharedUnprotectedHeader=jwe.unprotected),jwe.header!==void 0&&(result.unprotectedHeader=jwe.header),resolvedKey?{...result,key}:result}async function compactDecrypt(jwe,key,options){if(jwe instanceof Uint8Array&&(jwe=decoder.decode(jwe)),typeof jwe!="string")throw new JWEInvalid("Compact JWE must be a string or Uint8Array");let{0:protectedHeader,1:encryptedKey,2:iv,3:ciphertext,4:tag2,length}=jwe.split(".");if(length!==5)throw new JWEInvalid("Invalid Compact JWE");let decrypted=await flattenedDecrypt({ciphertext,iv:iv||void 0,protected:protectedHeader,tag:tag2||void 0,encrypted_key:encryptedKey||void 0},key,options),result={plaintext:decrypted.plaintext,protectedHeader:decrypted.protectedHeader};return typeof key=="function"?{...result,key:decrypted.key}:result}var epoch_default=date=>Math.floor(date.getTime()/1e3);var REGEX=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i,secs_default=str=>{let matched=REGEX.exec(str);if(!matched||matched[4]&&matched[1])throw new TypeError("Invalid time period format");let value=parseFloat(matched[2]),unit=matched[3].toLowerCase(),numericDate;switch(unit){case"sec":case"secs":case"second":case"seconds":case"s":numericDate=Math.round(value);break;case"minute":case"minutes":case"min":case"mins":case"m":numericDate=Math.round(value*60);break;case"hour":case"hours":case"hr":case"hrs":case"h":numericDate=Math.round(value*3600);break;case"day":case"days":case"d":numericDate=Math.round(value*86400);break;case"week":case"weeks":case"w":numericDate=Math.round(value*604800);break;default:numericDate=Math.round(value*31557600);break}return matched[1]==="-"||matched[4]==="ago"?-numericDate:numericDate};var normalizeTyp=value=>value.toLowerCase().replace(/^application\//,""),checkAudiencePresence=(audPayload,audOption)=>typeof audPayload=="string"?audOption.includes(audPayload):Array.isArray(audPayload)?audOption.some(Set.prototype.has.bind(new Set(audPayload))):!1,jwt_claims_set_default=(protectedHeader,encodedPayload,options={})=>{let payload;try{payload=JSON.parse(decoder.decode(encodedPayload))}catch{}if(!isObject(payload))throw new JWTInvalid("JWT Claims Set must be a top-level JSON object");let{typ}=options;if(typ&&(typeof protectedHeader.typ!="string"||normalizeTyp(protectedHeader.typ)!==normalizeTyp(typ)))throw new JWTClaimValidationFailed('unexpected "typ" JWT header value',payload,"typ","check_failed");let{requiredClaims=[],issuer,subject,audience,maxTokenAge}=options,presenceCheck=[...requiredClaims];maxTokenAge!==void 0&&presenceCheck.push("iat"),audience!==void 0&&presenceCheck.push("aud"),subject!==void 0&&presenceCheck.push("sub"),issuer!==void 0&&presenceCheck.push("iss");for(let claim of new Set(presenceCheck.reverse()))if(!(claim in payload))throw new JWTClaimValidationFailed(`missing required "${claim}" claim`,payload,claim,"missing");if(issuer&&!(Array.isArray(issuer)?issuer:[issuer]).includes(payload.iss))throw new JWTClaimValidationFailed('unexpected "iss" claim value',payload,"iss","check_failed");if(subject&&payload.sub!==subject)throw new JWTClaimValidationFailed('unexpected "sub" claim value',payload,"sub","check_failed");if(audience&&!checkAudiencePresence(payload.aud,typeof audience=="string"?[audience]:audience))throw new JWTClaimValidationFailed('unexpected "aud" claim value',payload,"aud","check_failed");let tolerance;switch(typeof options.clockTolerance){case"string":tolerance=secs_default(options.clockTolerance);break;case"number":tolerance=options.clockTolerance;break;case"undefined":tolerance=0;break;default:throw new TypeError("Invalid clockTolerance option type")}let{currentDate}=options,now=epoch_default(currentDate||new Date);if((payload.iat!==void 0||maxTokenAge)&&typeof payload.iat!="number")throw new JWTClaimValidationFailed('"iat" claim must be a number',payload,"iat","invalid");if(payload.nbf!==void 0){if(typeof payload.nbf!="number")throw new JWTClaimValidationFailed('"nbf" claim must be a number',payload,"nbf","invalid");if(payload.nbf>now+tolerance)throw new JWTClaimValidationFailed('"nbf" claim timestamp check failed',payload,"nbf","check_failed")}if(payload.exp!==void 0){if(typeof payload.exp!="number")throw new JWTClaimValidationFailed('"exp" claim must be a number',payload,"exp","invalid");if(payload.exp<=now-tolerance)throw new JWTExpired('"exp" claim timestamp check failed',payload,"exp","check_failed")}if(maxTokenAge){let age=now-payload.iat,max=typeof maxTokenAge=="number"?maxTokenAge:secs_default(maxTokenAge);if(age-tolerance>max)throw new JWTExpired('"iat" claim timestamp check failed (too far in the past)',payload,"iat","check_failed");if(age<0-tolerance)throw new JWTClaimValidationFailed('"iat" claim timestamp check failed (it should be in the past)',payload,"iat","check_failed")}return payload};async function jwtDecrypt(jwt,key,options){let decrypted=await compactDecrypt(jwt,key,options),payload=jwt_claims_set_default(decrypted.protectedHeader,decrypted.plaintext,options),{protectedHeader}=decrypted;if(protectedHeader.iss!==void 0&&protectedHeader.iss!==payload.iss)throw new JWTClaimValidationFailed('replicated "iss" claim header parameter mismatch',payload,"iss","mismatch");if(protectedHeader.sub!==void 0&&protectedHeader.sub!==payload.sub)throw new JWTClaimValidationFailed('replicated "sub" claim header parameter mismatch',payload,"sub","mismatch");if(protectedHeader.aud!==void 0&&JSON.stringify(protectedHeader.aud)!==JSON.stringify(payload.aud))throw new JWTClaimValidationFailed('replicated "aud" claim header parameter mismatch',payload,"aud","mismatch");let result={payload,protectedHeader};return typeof key=="function"?{...result,key:decrypted.key}:result}var unprotected=Symbol();import{KeyObject as KeyObject9}from"node:crypto";var keyToJWK=key=>{let keyObject;if(isCryptoKey(key)){if(!key.extractable)throw new TypeError("CryptoKey is not extractable");keyObject=KeyObject9.from(key)}else if(is_key_object_default(key))keyObject=key;else{if(key instanceof Uint8Array)return{kty:"oct",k:encode(key)};throw new TypeError(invalid_key_input_default(key,...types3,"Uint8Array"))}if(keyObject.type!=="secret"&&!["rsa","ec","ed25519","x25519","ed448","x448"].includes(keyObject.asymmetricKeyType))throw new JOSENotSupported("Unsupported key asymmetricKeyType");return keyObject.export({format:"jwk"})},key_to_jwk_default=keyToJWK;async function exportJWK(key){return key_to_jwk_default(key)}async function encryptKeyManagement(alg,enc,key,providedCek,providedParameters={}){let encryptedKey,parameters,cek;switch(check_key_type_default(alg,key,"encrypt"),key=await normalize_key_default.normalizePublicKey?.(key,alg)||key,alg){case"dir":{cek=key;break}case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{if(!ecdhAllowed(key))throw new JOSENotSupported("ECDH with the provided key is not allowed or not supported by your javascript runtime");let{apu,apv}=providedParameters,{epk:ephemeralKey}=providedParameters;ephemeralKey||=(await generateEpk(key)).privateKey;let{x,y,crv,kty}=await exportJWK(ephemeralKey),sharedSecret=await deriveKey(key,ephemeralKey,alg==="ECDH-ES"?enc:alg,alg==="ECDH-ES"?bitLength2(enc):parseInt(alg.slice(-5,-2),10),apu,apv);if(parameters={epk:{x,crv,kty}},kty==="EC"&&(parameters.epk.y=y),apu&&(parameters.apu=encode(apu)),apv&&(parameters.apv=encode(apv)),alg==="ECDH-ES"){cek=sharedSecret;break}cek=providedCek||cek_default(enc);let kwAlg=alg.slice(-6);encryptedKey=await wrap(kwAlg,sharedSecret,cek);break}case"RSA1_5":case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":{cek=providedCek||cek_default(enc),encryptedKey=await encrypt2(alg,key,cek);break}case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":{cek=providedCek||cek_default(enc);let{p2c,p2s:p2s2}=providedParameters;({encryptedKey,...parameters}=await encrypt(alg,key,cek,p2c,p2s2));break}case"A128KW":case"A192KW":case"A256KW":{cek=providedCek||cek_default(enc),encryptedKey=await wrap(alg,key,cek);break}case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":{cek=providedCek||cek_default(enc);let{iv}=providedParameters;({encryptedKey,...parameters}=await wrap2(alg,key,cek,iv));break}default:throw new JOSENotSupported('Invalid or unsupported "alg" (JWE Algorithm) header value')}return{cek,encryptedKey,parameters}}var encrypt_key_management_default=encryptKeyManagement;var FlattenedEncrypt=class{_plaintext;_protectedHeader;_sharedUnprotectedHeader;_unprotectedHeader;_aad;_cek;_iv;_keyManagementParameters;constructor(plaintext){if(!(plaintext instanceof Uint8Array))throw new TypeError("plaintext must be an instance of Uint8Array");this._plaintext=plaintext}setKeyManagementParameters(parameters){if(this._keyManagementParameters)throw new TypeError("setKeyManagementParameters can only be called once");return this._keyManagementParameters=parameters,this}setProtectedHeader(protectedHeader){if(this._protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this._protectedHeader=protectedHeader,this}setSharedUnprotectedHeader(sharedUnprotectedHeader){if(this._sharedUnprotectedHeader)throw new TypeError("setSharedUnprotectedHeader can only be called once");return this._sharedUnprotectedHeader=sharedUnprotectedHeader,this}setUnprotectedHeader(unprotectedHeader){if(this._unprotectedHeader)throw new TypeError("setUnprotectedHeader can only be called once");return this._unprotectedHeader=unprotectedHeader,this}setAdditionalAuthenticatedData(aad){return this._aad=aad,this}setContentEncryptionKey(cek){if(this._cek)throw new TypeError("setContentEncryptionKey can only be called once");return this._cek=cek,this}setInitializationVector(iv){if(this._iv)throw new TypeError("setInitializationVector can only be called once");return this._iv=iv,this}async encrypt(key,options){if(!this._protectedHeader&&!this._unprotectedHeader&&!this._sharedUnprotectedHeader)throw new JWEInvalid("either setProtectedHeader, setUnprotectedHeader, or sharedUnprotectedHeader must be called before #encrypt()");if(!is_disjoint_default(this._protectedHeader,this._unprotectedHeader,this._sharedUnprotectedHeader))throw new JWEInvalid("JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint");let joseHeader={...this._protectedHeader,...this._unprotectedHeader,...this._sharedUnprotectedHeader};if(validate_crit_default(JWEInvalid,new Map,options?.crit,this._protectedHeader,joseHeader),joseHeader.zip!==void 0)throw new JOSENotSupported('JWE "zip" (Compression Algorithm) Header Parameter is not supported.');let{alg,enc}=joseHeader;if(typeof alg!="string"||!alg)throw new JWEInvalid('JWE "alg" (Algorithm) Header Parameter missing or invalid');if(typeof enc!="string"||!enc)throw new JWEInvalid('JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid');let encryptedKey;if(this._cek&&(alg==="dir"||alg==="ECDH-ES"))throw new TypeError(`setContentEncryptionKey cannot be called with JWE "alg" (Algorithm) Header ${alg}`);let cek;{let parameters;({cek,encryptedKey,parameters}=await encrypt_key_management_default(alg,enc,key,this._cek,this._keyManagementParameters)),parameters&&(options&&unprotected in options?this._unprotectedHeader?this._unprotectedHeader={...this._unprotectedHeader,...parameters}:this.setUnprotectedHeader(parameters):this._protectedHeader?this._protectedHeader={...this._protectedHeader,...parameters}:this.setProtectedHeader(parameters))}let additionalData,protectedHeader,aadMember;this._protectedHeader?protectedHeader=encoder.encode(encode(JSON.stringify(this._protectedHeader))):protectedHeader=encoder.encode(""),this._aad?(aadMember=encode(this._aad),additionalData=concat(protectedHeader,encoder.encode("."),encoder.encode(aadMember))):additionalData=protectedHeader;let{ciphertext,tag:tag2,iv}=await encrypt_default(enc,this._plaintext,cek,this._iv,additionalData),jwe={ciphertext:encode(ciphertext)};return iv&&(jwe.iv=encode(iv)),tag2&&(jwe.tag=encode(tag2)),encryptedKey&&(jwe.encrypted_key=encode(encryptedKey)),aadMember&&(jwe.aad=aadMember),this._protectedHeader&&(jwe.protected=decoder.decode(protectedHeader)),this._sharedUnprotectedHeader&&(jwe.unprotected=this._sharedUnprotectedHeader),this._unprotectedHeader&&(jwe.header=this._unprotectedHeader),jwe}};var CompactEncrypt=class{_flattened;constructor(plaintext){this._flattened=new FlattenedEncrypt(plaintext)}setContentEncryptionKey(cek){return this._flattened.setContentEncryptionKey(cek),this}setInitializationVector(iv){return this._flattened.setInitializationVector(iv),this}setProtectedHeader(protectedHeader){return this._flattened.setProtectedHeader(protectedHeader),this}setKeyManagementParameters(parameters){return this._flattened.setKeyManagementParameters(parameters),this}async encrypt(key,options){let jwe=await this._flattened.encrypt(key,options);return[jwe.protected,jwe.encrypted_key,jwe.iv,jwe.ciphertext,jwe.tag].join(".")}};function validateInput(label,input){if(!Number.isFinite(input))throw new TypeError(`Invalid ${label} input`);return input}var ProduceJWT=class{_payload;constructor(payload={}){if(!isObject(payload))throw new TypeError("JWT Claims Set MUST be an object");this._payload=payload}setIssuer(issuer){return this._payload={...this._payload,iss:issuer},this}setSubject(subject){return this._payload={...this._payload,sub:subject},this}setAudience(audience){return this._payload={...this._payload,aud:audience},this}setJti(jwtId){return this._payload={...this._payload,jti:jwtId},this}setNotBefore(input){return typeof input=="number"?this._payload={...this._payload,nbf:validateInput("setNotBefore",input)}:input instanceof Date?this._payload={...this._payload,nbf:validateInput("setNotBefore",epoch_default(input))}:this._payload={...this._payload,nbf:epoch_default(new Date)+secs_default(input)},this}setExpirationTime(input){return typeof input=="number"?this._payload={...this._payload,exp:validateInput("setExpirationTime",input)}:input instanceof Date?this._payload={...this._payload,exp:validateInput("setExpirationTime",epoch_default(input))}:this._payload={...this._payload,exp:epoch_default(new Date)+secs_default(input)},this}setIssuedAt(input){return typeof input>"u"?this._payload={...this._payload,iat:epoch_default(new Date)}:input instanceof Date?this._payload={...this._payload,iat:validateInput("setIssuedAt",epoch_default(input))}:typeof input=="string"?this._payload={...this._payload,iat:validateInput("setIssuedAt",epoch_default(new Date)+secs_default(input))}:this._payload={...this._payload,iat:validateInput("setIssuedAt",input)},this}};var EncryptJWT=class extends ProduceJWT{_cek;_iv;_keyManagementParameters;_protectedHeader;_replicateIssuerAsHeader;_replicateSubjectAsHeader;_replicateAudienceAsHeader;setProtectedHeader(protectedHeader){if(this._protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this._protectedHeader=protectedHeader,this}setKeyManagementParameters(parameters){if(this._keyManagementParameters)throw new TypeError("setKeyManagementParameters can only be called once");return this._keyManagementParameters=parameters,this}setContentEncryptionKey(cek){if(this._cek)throw new TypeError("setContentEncryptionKey can only be called once");return this._cek=cek,this}setInitializationVector(iv){if(this._iv)throw new TypeError("setInitializationVector can only be called once");return this._iv=iv,this}replicateIssuerAsHeader(){return this._replicateIssuerAsHeader=!0,this}replicateSubjectAsHeader(){return this._replicateSubjectAsHeader=!0,this}replicateAudienceAsHeader(){return this._replicateAudienceAsHeader=!0,this}async encrypt(key,options){let enc=new CompactEncrypt(encoder.encode(JSON.stringify(this._payload)));return this._replicateIssuerAsHeader&&(this._protectedHeader={...this._protectedHeader,iss:this._payload.iss}),this._replicateSubjectAsHeader&&(this._protectedHeader={...this._protectedHeader,sub:this._payload.sub}),this._replicateAudienceAsHeader&&(this._protectedHeader={...this._protectedHeader,aud:this._payload.aud}),enc.setProtectedHeader(this._protectedHeader),this._iv&&enc.setInitializationVector(this._iv),this._cek&&enc.setContentEncryptionKey(this._cek),this._keyManagementParameters&&enc.setKeyManagementParameters(this._keyManagementParameters),enc.encrypt(key,options)}};var base64url_exports={};__export(base64url_exports,{decode:()=>decode2,encode:()=>encode2});var encode2=encode,decode2=decode;function decodeJwt(jwt){if(typeof jwt!="string")throw new JWTInvalid("JWTs must use Compact JWS serialization, JWT must be a string");let{1:payload,length}=jwt.split(".");if(length===5)throw new JWTInvalid("Only JWTs using Compact JWS serialization can be decoded");if(length!==3)throw new JWTInvalid("Invalid JWT");if(!payload)throw new JWTInvalid("JWTs must contain a payload");let decoded;try{decoded=decode2(payload)}catch{throw new JWTInvalid("Failed to base64url decode the payload")}let result;try{result=JSON.parse(decoder.decode(decoded))}catch{throw new JWTInvalid("Failed to parse the decoded payload as JSON")}if(!isObject(result))throw new JWTInvalid("Invalid JWT Claims Set");return result}export{jwtDecrypt,EncryptJWT,base64url_exports,decodeJwt};
|
|
7
|
+
import{__export}from"./chunk-NBPLUP7C.js";import{Buffer as Buffer2}from"node:buffer";import{createHash}from"node:crypto";var digest=(algorithm,data)=>createHash(algorithm).update(data).digest(),digest_default=digest;var encoder=new TextEncoder,decoder=new TextDecoder,MAX_INT32=2**32;function concat(...buffers){let size=buffers.reduce((acc,{length})=>acc+length,0),buf=new Uint8Array(size),i=0;for(let buffer of buffers)buf.set(buffer,i),i+=buffer.length;return buf}function p2s(alg,p2sInput){return concat(encoder.encode(alg),new Uint8Array([0]),p2sInput)}function writeUInt32BE(buf,value,offset){if(value<0||value>=MAX_INT32)throw new RangeError(`value must be >= 0 and <= ${MAX_INT32-1}. Received ${value}`);buf.set([value>>>24,value>>>16,value>>>8,value&255],offset)}function uint64be(value){let high=Math.floor(value/MAX_INT32),low=value%MAX_INT32,buf=new Uint8Array(8);return writeUInt32BE(buf,high,0),writeUInt32BE(buf,low,4),buf}function uint32be(value){let buf=new Uint8Array(4);return writeUInt32BE(buf,value),buf}function lengthAndInput(input){return concat(uint32be(input.length),input)}async function concatKdf(secret,bits,value){let iterations=Math.ceil((bits>>3)/32),res=new Uint8Array(iterations*32);for(let iter=0;iter<iterations;iter++){let buf=new Uint8Array(4+secret.length+value.length);buf.set(uint32be(iter+1)),buf.set(secret,4),buf.set(value,4+secret.length),res.set(await digest_default("sha256",buf),iter*32)}return res.slice(0,bits>>3)}function normalize(input){let encoded=input;return encoded instanceof Uint8Array&&(encoded=decoder.decode(encoded)),encoded}var encode=input=>Buffer2.from(input).toString("base64url");var decode=input=>new Uint8Array(Buffer2.from(normalize(input),"base64url"));import{createDecipheriv,KeyObject}from"node:crypto";var JOSEError=class extends Error{static code="ERR_JOSE_GENERIC";code="ERR_JOSE_GENERIC";constructor(message2,options){super(message2,options),this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}},JWTClaimValidationFailed=class extends JOSEError{static code="ERR_JWT_CLAIM_VALIDATION_FAILED";code="ERR_JWT_CLAIM_VALIDATION_FAILED";claim;reason;payload;constructor(message2,payload,claim="unspecified",reason="unspecified"){super(message2,{cause:{claim,reason,payload}}),this.claim=claim,this.reason=reason,this.payload=payload}},JWTExpired=class extends JOSEError{static code="ERR_JWT_EXPIRED";code="ERR_JWT_EXPIRED";claim;reason;payload;constructor(message2,payload,claim="unspecified",reason="unspecified"){super(message2,{cause:{claim,reason,payload}}),this.claim=claim,this.reason=reason,this.payload=payload}},JOSEAlgNotAllowed=class extends JOSEError{static code="ERR_JOSE_ALG_NOT_ALLOWED";code="ERR_JOSE_ALG_NOT_ALLOWED"},JOSENotSupported=class extends JOSEError{static code="ERR_JOSE_NOT_SUPPORTED";code="ERR_JOSE_NOT_SUPPORTED"},JWEDecryptionFailed=class extends JOSEError{static code="ERR_JWE_DECRYPTION_FAILED";code="ERR_JWE_DECRYPTION_FAILED";constructor(message2="decryption operation failed",options){super(message2,options)}},JWEInvalid=class extends JOSEError{static code="ERR_JWE_INVALID";code="ERR_JWE_INVALID"};var JWTInvalid=class extends JOSEError{static code="ERR_JWT_INVALID";code="ERR_JWT_INVALID"};var JWKSMultipleMatchingKeys=class extends JOSEError{[Symbol.asyncIterator];static code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";constructor(message2="multiple matching keys found in the JSON Web Key Set",options){super(message2,options)}};import{randomFillSync}from"node:crypto";function bitLength(alg){switch(alg){case"A128GCM":case"A128GCMKW":case"A192GCM":case"A192GCMKW":case"A256GCM":case"A256GCMKW":return 96;case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return 128;default:throw new JOSENotSupported(`Unsupported JWE Algorithm: ${alg}`)}}var iv_default=alg=>randomFillSync(new Uint8Array(bitLength(alg)>>3));var checkIvLength=(enc,iv)=>{if(iv.length<<3!==bitLength(enc))throw new JWEInvalid("Invalid Initialization Vector length")},check_iv_length_default=checkIvLength;import*as util from"node:util";var is_key_object_default=obj=>util.types.isKeyObject(obj);var checkCekLength=(enc,cek)=>{let expected;switch(enc){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":expected=parseInt(enc.slice(-3),10);break;case"A128GCM":case"A192GCM":case"A256GCM":expected=parseInt(enc.slice(1,4),10);break;default:throw new JOSENotSupported(`Content Encryption Algorithm ${enc} is not supported either by JOSE or your javascript runtime`)}if(cek instanceof Uint8Array){let actual=cek.byteLength<<3;if(actual!==expected)throw new JWEInvalid(`Invalid Content Encryption Key length. Expected ${expected} bits, got ${actual} bits`);return}if(is_key_object_default(cek)&&cek.type==="secret"){let actual=cek.symmetricKeySize<<3;if(actual!==expected)throw new JWEInvalid(`Invalid Content Encryption Key length. Expected ${expected} bits, got ${actual} bits`);return}throw new TypeError("Invalid Content Encryption Key type")},check_cek_length_default=checkCekLength;import{timingSafeEqual as impl}from"node:crypto";var timingSafeEqual=impl,timing_safe_equal_default=timingSafeEqual;import{createHmac}from"node:crypto";function cbcTag(aad,iv,ciphertext,macSize,macKey,keySize){let macData=concat(aad,iv,ciphertext,uint64be(aad.length<<3)),hmac=createHmac(`sha${macSize}`,macKey);return hmac.update(macData),hmac.digest().slice(0,keySize>>3)}import*as crypto from"node:crypto";import*as util2 from"node:util";var webcrypto2=crypto.webcrypto,webcrypto_default=webcrypto2,isCryptoKey=key=>util2.types.isCryptoKey(key);function unusable(name,prop="algorithm.name"){return new TypeError(`CryptoKey does not support this operation, its ${prop} must be ${name}`)}function isAlgorithm(algorithm,name){return algorithm.name===name}function getHashLength(hash){return parseInt(hash.name.slice(4),10)}function checkUsage(key,usages){if(usages.length&&!usages.some(expected=>key.usages.includes(expected))){let msg="CryptoKey does not support this operation, its usages must include ";if(usages.length>2){let last=usages.pop();msg+=`one of ${usages.join(", ")}, or ${last}.`}else usages.length===2?msg+=`one of ${usages[0]} or ${usages[1]}.`:msg+=`${usages[0]}.`;throw new TypeError(msg)}}function checkEncCryptoKey(key,alg,...usages){switch(alg){case"A128GCM":case"A192GCM":case"A256GCM":{if(!isAlgorithm(key.algorithm,"AES-GCM"))throw unusable("AES-GCM");let expected=parseInt(alg.slice(1,4),10);if(key.algorithm.length!==expected)throw unusable(expected,"algorithm.length");break}case"A128KW":case"A192KW":case"A256KW":{if(!isAlgorithm(key.algorithm,"AES-KW"))throw unusable("AES-KW");let expected=parseInt(alg.slice(1,4),10);if(key.algorithm.length!==expected)throw unusable(expected,"algorithm.length");break}case"ECDH":{switch(key.algorithm.name){case"ECDH":case"X25519":case"X448":break;default:throw unusable("ECDH, X25519, or X448")}break}case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":if(!isAlgorithm(key.algorithm,"PBKDF2"))throw unusable("PBKDF2");break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":{if(!isAlgorithm(key.algorithm,"RSA-OAEP"))throw unusable("RSA-OAEP");let expected=parseInt(alg.slice(9),10)||1;if(getHashLength(key.algorithm.hash)!==expected)throw unusable(`SHA-${expected}`,"algorithm.hash");break}default:throw new TypeError("CryptoKey does not support this operation")}checkUsage(key,usages)}function message(msg,actual,...types4){if(types4=types4.filter(Boolean),types4.length>2){let last=types4.pop();msg+=`one of type ${types4.join(", ")}, or ${last}.`}else types4.length===2?msg+=`one of type ${types4[0]} or ${types4[1]}.`:msg+=`of type ${types4[0]}.`;return actual==null?msg+=` Received ${actual}`:typeof actual=="function"&&actual.name?msg+=` Received function ${actual.name}`:typeof actual=="object"&&actual!=null&&actual.constructor?.name&&(msg+=` Received an instance of ${actual.constructor.name}`),msg}var invalid_key_input_default=(actual,...types4)=>message("Key must be ",actual,...types4);function withAlg(alg,actual,...types4){return message(`Key for the ${alg} algorithm must be `,actual,...types4)}import{getCiphers}from"node:crypto";var ciphers,ciphers_default=algorithm=>(ciphers||=new Set(getCiphers()),ciphers.has(algorithm));var is_key_like_default=key=>is_key_object_default(key)||isCryptoKey(key),types3=["KeyObject"];(globalThis.CryptoKey||webcrypto_default?.CryptoKey)&&types3.push("CryptoKey");function cbcDecrypt(enc,cek,ciphertext,iv,tag2,aad){let keySize=parseInt(enc.slice(1,4),10);is_key_object_default(cek)&&(cek=cek.export());let encKey=cek.subarray(keySize>>3),macKey=cek.subarray(0,keySize>>3),macSize=parseInt(enc.slice(-3),10),algorithm=`aes-${keySize}-cbc`;if(!ciphers_default(algorithm))throw new JOSENotSupported(`alg ${enc} is not supported by your javascript runtime`);let expectedTag=cbcTag(aad,iv,ciphertext,macSize,macKey,keySize),macCheckPassed;try{macCheckPassed=timing_safe_equal_default(tag2,expectedTag)}catch{}if(!macCheckPassed)throw new JWEDecryptionFailed;let plaintext;try{let decipher=createDecipheriv(algorithm,encKey,iv);plaintext=concat(decipher.update(ciphertext),decipher.final())}catch{}if(!plaintext)throw new JWEDecryptionFailed;return plaintext}function gcmDecrypt(enc,cek,ciphertext,iv,tag2,aad){let algorithm=`aes-${parseInt(enc.slice(1,4),10)}-gcm`;if(!ciphers_default(algorithm))throw new JOSENotSupported(`alg ${enc} is not supported by your javascript runtime`);try{let decipher=createDecipheriv(algorithm,cek,iv,{authTagLength:16});decipher.setAuthTag(tag2),aad.byteLength&&decipher.setAAD(aad,{plaintextLength:ciphertext.length});let plaintext=decipher.update(ciphertext);return decipher.final(),plaintext}catch{throw new JWEDecryptionFailed}}var decrypt=(enc,cek,ciphertext,iv,tag2,aad)=>{let key;if(isCryptoKey(cek))checkEncCryptoKey(cek,enc,"decrypt"),key=KeyObject.from(cek);else if(cek instanceof Uint8Array||is_key_object_default(cek))key=cek;else throw new TypeError(invalid_key_input_default(cek,...types3,"Uint8Array"));if(!iv)throw new JWEInvalid("JWE Initialization Vector missing");if(!tag2)throw new JWEInvalid("JWE Authentication Tag missing");switch(check_cek_length_default(enc,key),check_iv_length_default(enc,iv),enc){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return cbcDecrypt(enc,key,ciphertext,iv,tag2,aad);case"A128GCM":case"A192GCM":case"A256GCM":return gcmDecrypt(enc,key,ciphertext,iv,tag2,aad);default:throw new JOSENotSupported("Unsupported JWE Content Encryption Algorithm")}},decrypt_default=decrypt;var isDisjoint=(...headers)=>{let sources=headers.filter(Boolean);if(sources.length===0||sources.length===1)return!0;let acc;for(let header of sources){let parameters=Object.keys(header);if(!acc||acc.size===0){acc=new Set(parameters);continue}for(let parameter of parameters){if(acc.has(parameter))return!1;acc.add(parameter)}}return!0},is_disjoint_default=isDisjoint;function isObjectLike(value){return typeof value=="object"&&value!==null}function isObject(input){if(!isObjectLike(input)||Object.prototype.toString.call(input)!=="[object Object]")return!1;if(Object.getPrototypeOf(input)===null)return!0;let proto=input;for(;Object.getPrototypeOf(proto)!==null;)proto=Object.getPrototypeOf(proto);return Object.getPrototypeOf(input)===proto}import{Buffer as Buffer3}from"node:buffer";import{KeyObject as KeyObject2,createDecipheriv as createDecipheriv2,createCipheriv,createSecretKey}from"node:crypto";function checkKeySize(key,alg){if(key.symmetricKeySize<<3!==parseInt(alg.slice(1,4),10))throw new TypeError(`Invalid key size for alg: ${alg}`)}function ensureKeyObject(key,alg,usage){if(is_key_object_default(key))return key;if(key instanceof Uint8Array)return createSecretKey(key);if(isCryptoKey(key))return checkEncCryptoKey(key,alg,usage),KeyObject2.from(key);throw new TypeError(invalid_key_input_default(key,...types3,"Uint8Array"))}var wrap=(alg,key,cek)=>{let algorithm=`aes${parseInt(alg.slice(1,4),10)}-wrap`;if(!ciphers_default(algorithm))throw new JOSENotSupported(`alg ${alg} is not supported either by JOSE or your javascript runtime`);let keyObject=ensureKeyObject(key,alg,"wrapKey");checkKeySize(keyObject,alg);let cipher=createCipheriv(algorithm,keyObject,Buffer3.alloc(8,166));return concat(cipher.update(cek),cipher.final())},unwrap=(alg,key,encryptedKey)=>{let algorithm=`aes${parseInt(alg.slice(1,4),10)}-wrap`;if(!ciphers_default(algorithm))throw new JOSENotSupported(`alg ${alg} is not supported either by JOSE or your javascript runtime`);let keyObject=ensureKeyObject(key,alg,"unwrapKey");checkKeySize(keyObject,alg);let cipher=createDecipheriv2(algorithm,keyObject,Buffer3.alloc(8,166));return concat(cipher.update(encryptedKey),cipher.final())};import{diffieHellman,generateKeyPair as generateKeyPairCb,KeyObject as KeyObject4}from"node:crypto";import{promisify}from"node:util";import{KeyObject as KeyObject3}from"node:crypto";function isJWK(key){return isObject(key)&&typeof key.kty=="string"}function isPrivateJWK(key){return key.kty!=="oct"&&typeof key.d=="string"}function isPublicJWK(key){return key.kty!=="oct"&&typeof key.d>"u"}function isSecretJWK(key){return isJWK(key)&&key.kty==="oct"&&typeof key.k=="string"}var namedCurveToJOSE=namedCurve=>{switch(namedCurve){case"prime256v1":return"P-256";case"secp384r1":return"P-384";case"secp521r1":return"P-521";case"secp256k1":return"secp256k1";default:throw new JOSENotSupported("Unsupported key curve for this operation")}},getNamedCurve=(kee,raw)=>{let key;if(isCryptoKey(kee))key=KeyObject3.from(kee);else if(is_key_object_default(kee))key=kee;else{if(isJWK(kee))return kee.crv;throw new TypeError(invalid_key_input_default(kee,...types3))}if(key.type==="secret")throw new TypeError('only "private" or "public" type keys can be used for this operation');switch(key.asymmetricKeyType){case"ed25519":case"ed448":return`Ed${key.asymmetricKeyType.slice(2)}`;case"x25519":case"x448":return`X${key.asymmetricKeyType.slice(1)}`;case"ec":{let namedCurve=key.asymmetricKeyDetails.namedCurve;return raw?namedCurve:namedCurveToJOSE(namedCurve)}default:throw new TypeError("Invalid asymmetric key type for this operation")}},get_named_curve_default=getNamedCurve;var generateKeyPair=promisify(generateKeyPairCb);async function deriveKey(publicKee,privateKee,algorithm,keyLength,apu=new Uint8Array(0),apv=new Uint8Array(0)){let publicKey;if(isCryptoKey(publicKee))checkEncCryptoKey(publicKee,"ECDH"),publicKey=KeyObject4.from(publicKee);else if(is_key_object_default(publicKee))publicKey=publicKee;else throw new TypeError(invalid_key_input_default(publicKee,...types3));let privateKey;if(isCryptoKey(privateKee))checkEncCryptoKey(privateKee,"ECDH","deriveBits"),privateKey=KeyObject4.from(privateKee);else if(is_key_object_default(privateKee))privateKey=privateKee;else throw new TypeError(invalid_key_input_default(privateKee,...types3));let value=concat(lengthAndInput(encoder.encode(algorithm)),lengthAndInput(apu),lengthAndInput(apv),uint32be(keyLength)),sharedSecret=diffieHellman({privateKey,publicKey});return concatKdf(sharedSecret,keyLength,value)}async function generateEpk(kee){let key;if(isCryptoKey(kee))key=KeyObject4.from(kee);else if(is_key_object_default(kee))key=kee;else throw new TypeError(invalid_key_input_default(kee,...types3));switch(key.asymmetricKeyType){case"x25519":return generateKeyPair("x25519");case"x448":return generateKeyPair("x448");case"ec":{let namedCurve=get_named_curve_default(key);return generateKeyPair("ec",{namedCurve})}default:throw new JOSENotSupported("Invalid or unsupported EPK")}}var ecdhAllowed=key=>["P-256","P-384","P-521","X25519","X448"].includes(get_named_curve_default(key));import{promisify as promisify2}from"node:util";import{KeyObject as KeyObject5,pbkdf2 as pbkdf2cb}from"node:crypto";function checkP2s(p2s2){if(!(p2s2 instanceof Uint8Array)||p2s2.length<8)throw new JWEInvalid("PBES2 Salt Input must be 8 or more octets")}var pbkdf2=promisify2(pbkdf2cb);function getPassword(key,alg){if(is_key_object_default(key))return key.export();if(key instanceof Uint8Array)return key;if(isCryptoKey(key))return checkEncCryptoKey(key,alg,"deriveBits","deriveKey"),KeyObject5.from(key).export();throw new TypeError(invalid_key_input_default(key,...types3,"Uint8Array"))}var encrypt=async(alg,key,cek,p2c=2048,p2s2=randomFillSync(new Uint8Array(16)))=>{checkP2s(p2s2);let salt=p2s(alg,p2s2),keylen=parseInt(alg.slice(13,16),10)>>3,password=getPassword(key,alg),derivedKey=await pbkdf2(password,salt,p2c,keylen,`sha${alg.slice(8,11)}`);return{encryptedKey:await wrap(alg.slice(-6),derivedKey,cek),p2c,p2s:encode(p2s2)}},decrypt2=async(alg,key,encryptedKey,p2c,p2s2)=>{checkP2s(p2s2);let salt=p2s(alg,p2s2),keylen=parseInt(alg.slice(13,16),10)>>3,password=getPassword(key,alg),derivedKey=await pbkdf2(password,salt,p2c,keylen,`sha${alg.slice(8,11)}`);return unwrap(alg.slice(-6),derivedKey,encryptedKey)};import{KeyObject as KeyObject7,publicEncrypt,constants,privateDecrypt}from"node:crypto";import{deprecate}from"node:util";import{KeyObject as KeyObject6}from"node:crypto";var check_key_length_default=(key,alg)=>{let modulusLength;try{key instanceof KeyObject6?modulusLength=key.asymmetricKeyDetails?.modulusLength:modulusLength=Buffer.from(key.n,"base64url").byteLength<<3}catch{}if(typeof modulusLength!="number"||modulusLength<2048)throw new TypeError(`${alg} requires key modulusLength to be 2048 bits or larger`)};var checkKey=(key,alg)=>{if(key.asymmetricKeyType!=="rsa")throw new TypeError("Invalid key for this operation, its asymmetricKeyType must be rsa");check_key_length_default(key,alg)},RSA1_5=deprecate(()=>constants.RSA_PKCS1_PADDING,'The RSA1_5 "alg" (JWE Algorithm) is deprecated and will be removed in the next major revision.'),resolvePadding=alg=>{switch(alg){case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":return constants.RSA_PKCS1_OAEP_PADDING;case"RSA1_5":return RSA1_5();default:return}},resolveOaepHash=alg=>{switch(alg){case"RSA-OAEP":return"sha1";case"RSA-OAEP-256":return"sha256";case"RSA-OAEP-384":return"sha384";case"RSA-OAEP-512":return"sha512";default:return}};function ensureKeyObject2(key,alg,...usages){if(is_key_object_default(key))return key;if(isCryptoKey(key))return checkEncCryptoKey(key,alg,...usages),KeyObject7.from(key);throw new TypeError(invalid_key_input_default(key,...types3))}var encrypt2=(alg,key,cek)=>{let padding=resolvePadding(alg),oaepHash=resolveOaepHash(alg),keyObject=ensureKeyObject2(key,alg,"wrapKey","encrypt");return checkKey(keyObject,alg),publicEncrypt({key:keyObject,oaepHash,padding},cek)},decrypt3=(alg,key,encryptedKey)=>{let padding=resolvePadding(alg),oaepHash=resolveOaepHash(alg),keyObject=ensureKeyObject2(key,alg,"unwrapKey","decrypt");return checkKey(keyObject,alg),privateDecrypt({key:keyObject,oaepHash,padding},encryptedKey)};var normalize_key_default={};function bitLength2(alg){switch(alg){case"A128GCM":return 128;case"A192GCM":return 192;case"A256GCM":case"A128CBC-HS256":return 256;case"A192CBC-HS384":return 384;case"A256CBC-HS512":return 512;default:throw new JOSENotSupported(`Unsupported JWE Algorithm: ${alg}`)}}var cek_default=alg=>randomFillSync(new Uint8Array(bitLength2(alg)>>3));import{createPrivateKey,createPublicKey}from"node:crypto";var parse=key=>key.d?createPrivateKey({format:"jwk",key}):createPublicKey({format:"jwk",key}),jwk_to_key_default=parse;async function importJWK(jwk,alg){if(!isObject(jwk))throw new TypeError("JWK must be an object");switch(alg||=jwk.alg,jwk.kty){case"oct":if(typeof jwk.k!="string"||!jwk.k)throw new TypeError('missing "k" (Key Value) Parameter value');return decode(jwk.k);case"RSA":if(jwk.oth!==void 0)throw new JOSENotSupported('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');case"EC":case"OKP":return jwk_to_key_default({...jwk,alg});default:throw new JOSENotSupported('Unsupported "kty" (Key Type) Parameter value')}}var tag=key=>key?.[Symbol.toStringTag],jwkMatchesOp=(alg,key,usage)=>{if(key.use!==void 0&&key.use!=="sig")throw new TypeError("Invalid key for this operation, when present its use must be sig");if(key.key_ops!==void 0&&key.key_ops.includes?.(usage)!==!0)throw new TypeError(`Invalid key for this operation, when present its key_ops must include ${usage}`);if(key.alg!==void 0&&key.alg!==alg)throw new TypeError(`Invalid key for this operation, when present its alg must be ${alg}`);return!0},symmetricTypeCheck=(alg,key,usage,allowJwk)=>{if(!(key instanceof Uint8Array)){if(allowJwk&&isJWK(key)){if(isSecretJWK(key)&&jwkMatchesOp(alg,key,usage))return;throw new TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present')}if(!is_key_like_default(key))throw new TypeError(withAlg(alg,key,...types3,"Uint8Array",allowJwk?"JSON Web Key":null));if(key.type!=="secret")throw new TypeError(`${tag(key)} instances for symmetric algorithms must be of type "secret"`)}},asymmetricTypeCheck=(alg,key,usage,allowJwk)=>{if(allowJwk&&isJWK(key))switch(usage){case"sign":if(isPrivateJWK(key)&&jwkMatchesOp(alg,key,usage))return;throw new TypeError("JSON Web Key for this operation be a private JWK");case"verify":if(isPublicJWK(key)&&jwkMatchesOp(alg,key,usage))return;throw new TypeError("JSON Web Key for this operation be a public JWK")}if(!is_key_like_default(key))throw new TypeError(withAlg(alg,key,...types3,allowJwk?"JSON Web Key":null));if(key.type==="secret")throw new TypeError(`${tag(key)} instances for asymmetric algorithms must not be of type "secret"`);if(usage==="sign"&&key.type==="public")throw new TypeError(`${tag(key)} instances for asymmetric algorithm signing must be of type "private"`);if(usage==="decrypt"&&key.type==="public")throw new TypeError(`${tag(key)} instances for asymmetric algorithm decryption must be of type "private"`);if(key.algorithm&&usage==="verify"&&key.type==="private")throw new TypeError(`${tag(key)} instances for asymmetric algorithm verifying must be of type "public"`);if(key.algorithm&&usage==="encrypt"&&key.type==="private")throw new TypeError(`${tag(key)} instances for asymmetric algorithm encryption must be of type "public"`)};function checkKeyType(allowJwk,alg,key,usage){alg.startsWith("HS")||alg==="dir"||alg.startsWith("PBES2")||/^A\d{3}(?:GCM)?KW$/.test(alg)?symmetricTypeCheck(alg,key,usage,allowJwk):asymmetricTypeCheck(alg,key,usage,allowJwk)}var check_key_type_default=checkKeyType.bind(void 0,!1),checkKeyTypeWithJwk=checkKeyType.bind(void 0,!0);import{createCipheriv as createCipheriv2,KeyObject as KeyObject8}from"node:crypto";function cbcEncrypt(enc,plaintext,cek,iv,aad){let keySize=parseInt(enc.slice(1,4),10);is_key_object_default(cek)&&(cek=cek.export());let encKey=cek.subarray(keySize>>3),macKey=cek.subarray(0,keySize>>3),algorithm=`aes-${keySize}-cbc`;if(!ciphers_default(algorithm))throw new JOSENotSupported(`alg ${enc} is not supported by your javascript runtime`);let cipher=createCipheriv2(algorithm,encKey,iv),ciphertext=concat(cipher.update(plaintext),cipher.final()),macSize=parseInt(enc.slice(-3),10),tag2=cbcTag(aad,iv,ciphertext,macSize,macKey,keySize);return{ciphertext,tag:tag2,iv}}function gcmEncrypt(enc,plaintext,cek,iv,aad){let algorithm=`aes-${parseInt(enc.slice(1,4),10)}-gcm`;if(!ciphers_default(algorithm))throw new JOSENotSupported(`alg ${enc} is not supported by your javascript runtime`);let cipher=createCipheriv2(algorithm,cek,iv,{authTagLength:16});aad.byteLength&&cipher.setAAD(aad,{plaintextLength:plaintext.length});let ciphertext=cipher.update(plaintext);cipher.final();let tag2=cipher.getAuthTag();return{ciphertext,tag:tag2,iv}}var encrypt3=(enc,plaintext,cek,iv,aad)=>{let key;if(isCryptoKey(cek))checkEncCryptoKey(cek,enc,"encrypt"),key=KeyObject8.from(cek);else if(cek instanceof Uint8Array||is_key_object_default(cek))key=cek;else throw new TypeError(invalid_key_input_default(cek,...types3,"Uint8Array"));switch(check_cek_length_default(enc,key),iv?check_iv_length_default(enc,iv):iv=iv_default(enc),enc){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return cbcEncrypt(enc,plaintext,key,iv,aad);case"A128GCM":case"A192GCM":case"A256GCM":return gcmEncrypt(enc,plaintext,key,iv,aad);default:throw new JOSENotSupported("Unsupported JWE Content Encryption Algorithm")}},encrypt_default=encrypt3;async function wrap2(alg,key,cek,iv){let jweAlgorithm=alg.slice(0,7),wrapped=await encrypt_default(jweAlgorithm,cek,key,iv,new Uint8Array(0));return{encryptedKey:wrapped.ciphertext,iv:encode(wrapped.iv),tag:encode(wrapped.tag)}}async function unwrap2(alg,key,encryptedKey,iv,tag2){let jweAlgorithm=alg.slice(0,7);return decrypt_default(jweAlgorithm,key,encryptedKey,iv,tag2,new Uint8Array(0))}async function decryptKeyManagement(alg,key,encryptedKey,joseHeader,options){switch(check_key_type_default(alg,key,"decrypt"),key=await normalize_key_default.normalizePrivateKey?.(key,alg)||key,alg){case"dir":{if(encryptedKey!==void 0)throw new JWEInvalid("Encountered unexpected JWE Encrypted Key");return key}case"ECDH-ES":if(encryptedKey!==void 0)throw new JWEInvalid("Encountered unexpected JWE Encrypted Key");case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{if(!isObject(joseHeader.epk))throw new JWEInvalid('JOSE Header "epk" (Ephemeral Public Key) missing or invalid');if(!ecdhAllowed(key))throw new JOSENotSupported("ECDH with the provided key is not allowed or not supported by your javascript runtime");let epk=await importJWK(joseHeader.epk,alg),partyUInfo,partyVInfo;if(joseHeader.apu!==void 0){if(typeof joseHeader.apu!="string")throw new JWEInvalid('JOSE Header "apu" (Agreement PartyUInfo) invalid');try{partyUInfo=decode(joseHeader.apu)}catch{throw new JWEInvalid("Failed to base64url decode the apu")}}if(joseHeader.apv!==void 0){if(typeof joseHeader.apv!="string")throw new JWEInvalid('JOSE Header "apv" (Agreement PartyVInfo) invalid');try{partyVInfo=decode(joseHeader.apv)}catch{throw new JWEInvalid("Failed to base64url decode the apv")}}let sharedSecret=await deriveKey(epk,key,alg==="ECDH-ES"?joseHeader.enc:alg,alg==="ECDH-ES"?bitLength2(joseHeader.enc):parseInt(alg.slice(-5,-2),10),partyUInfo,partyVInfo);if(alg==="ECDH-ES")return sharedSecret;if(encryptedKey===void 0)throw new JWEInvalid("JWE Encrypted Key missing");return unwrap(alg.slice(-6),sharedSecret,encryptedKey)}case"RSA1_5":case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":{if(encryptedKey===void 0)throw new JWEInvalid("JWE Encrypted Key missing");return decrypt3(alg,key,encryptedKey)}case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":{if(encryptedKey===void 0)throw new JWEInvalid("JWE Encrypted Key missing");if(typeof joseHeader.p2c!="number")throw new JWEInvalid('JOSE Header "p2c" (PBES2 Count) missing or invalid');let p2cLimit=options?.maxPBES2Count||1e4;if(joseHeader.p2c>p2cLimit)throw new JWEInvalid('JOSE Header "p2c" (PBES2 Count) out is of acceptable bounds');if(typeof joseHeader.p2s!="string")throw new JWEInvalid('JOSE Header "p2s" (PBES2 Salt) missing or invalid');let p2s2;try{p2s2=decode(joseHeader.p2s)}catch{throw new JWEInvalid("Failed to base64url decode the p2s")}return decrypt2(alg,key,encryptedKey,joseHeader.p2c,p2s2)}case"A128KW":case"A192KW":case"A256KW":{if(encryptedKey===void 0)throw new JWEInvalid("JWE Encrypted Key missing");return unwrap(alg,key,encryptedKey)}case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":{if(encryptedKey===void 0)throw new JWEInvalid("JWE Encrypted Key missing");if(typeof joseHeader.iv!="string")throw new JWEInvalid('JOSE Header "iv" (Initialization Vector) missing or invalid');if(typeof joseHeader.tag!="string")throw new JWEInvalid('JOSE Header "tag" (Authentication Tag) missing or invalid');let iv;try{iv=decode(joseHeader.iv)}catch{throw new JWEInvalid("Failed to base64url decode the iv")}let tag2;try{tag2=decode(joseHeader.tag)}catch{throw new JWEInvalid("Failed to base64url decode the tag")}return unwrap2(alg,key,encryptedKey,iv,tag2)}default:throw new JOSENotSupported('Invalid or unsupported "alg" (JWE Algorithm) header value')}}var decrypt_key_management_default=decryptKeyManagement;function validateCrit(Err,recognizedDefault,recognizedOption,protectedHeader,joseHeader){if(joseHeader.crit!==void 0&&protectedHeader?.crit===void 0)throw new Err('"crit" (Critical) Header Parameter MUST be integrity protected');if(!protectedHeader||protectedHeader.crit===void 0)return new Set;if(!Array.isArray(protectedHeader.crit)||protectedHeader.crit.length===0||protectedHeader.crit.some(input=>typeof input!="string"||input.length===0))throw new Err('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let recognized;recognizedOption!==void 0?recognized=new Map([...Object.entries(recognizedOption),...recognizedDefault.entries()]):recognized=recognizedDefault;for(let parameter of protectedHeader.crit){if(!recognized.has(parameter))throw new JOSENotSupported(`Extension Header Parameter "${parameter}" is not recognized`);if(joseHeader[parameter]===void 0)throw new Err(`Extension Header Parameter "${parameter}" is missing`);if(recognized.get(parameter)&&protectedHeader[parameter]===void 0)throw new Err(`Extension Header Parameter "${parameter}" MUST be integrity protected`)}return new Set(protectedHeader.crit)}var validate_crit_default=validateCrit;var validateAlgorithms=(option,algorithms)=>{if(algorithms!==void 0&&(!Array.isArray(algorithms)||algorithms.some(s=>typeof s!="string")))throw new TypeError(`"${option}" option must be an array of strings`);if(algorithms)return new Set(algorithms)},validate_algorithms_default=validateAlgorithms;async function flattenedDecrypt(jwe,key,options){if(!isObject(jwe))throw new JWEInvalid("Flattened JWE must be an object");if(jwe.protected===void 0&&jwe.header===void 0&&jwe.unprotected===void 0)throw new JWEInvalid("JOSE Header missing");if(jwe.iv!==void 0&&typeof jwe.iv!="string")throw new JWEInvalid("JWE Initialization Vector incorrect type");if(typeof jwe.ciphertext!="string")throw new JWEInvalid("JWE Ciphertext missing or incorrect type");if(jwe.tag!==void 0&&typeof jwe.tag!="string")throw new JWEInvalid("JWE Authentication Tag incorrect type");if(jwe.protected!==void 0&&typeof jwe.protected!="string")throw new JWEInvalid("JWE Protected Header incorrect type");if(jwe.encrypted_key!==void 0&&typeof jwe.encrypted_key!="string")throw new JWEInvalid("JWE Encrypted Key incorrect type");if(jwe.aad!==void 0&&typeof jwe.aad!="string")throw new JWEInvalid("JWE AAD incorrect type");if(jwe.header!==void 0&&!isObject(jwe.header))throw new JWEInvalid("JWE Shared Unprotected Header incorrect type");if(jwe.unprotected!==void 0&&!isObject(jwe.unprotected))throw new JWEInvalid("JWE Per-Recipient Unprotected Header incorrect type");let parsedProt;if(jwe.protected)try{let protectedHeader2=decode(jwe.protected);parsedProt=JSON.parse(decoder.decode(protectedHeader2))}catch{throw new JWEInvalid("JWE Protected Header is invalid")}if(!is_disjoint_default(parsedProt,jwe.header,jwe.unprotected))throw new JWEInvalid("JWE Protected, JWE Unprotected Header, and JWE Per-Recipient Unprotected Header Parameter names must be disjoint");let joseHeader={...parsedProt,...jwe.header,...jwe.unprotected};if(validate_crit_default(JWEInvalid,new Map,options?.crit,parsedProt,joseHeader),joseHeader.zip!==void 0)throw new JOSENotSupported('JWE "zip" (Compression Algorithm) Header Parameter is not supported.');let{alg,enc}=joseHeader;if(typeof alg!="string"||!alg)throw new JWEInvalid("missing JWE Algorithm (alg) in JWE Header");if(typeof enc!="string"||!enc)throw new JWEInvalid("missing JWE Encryption Algorithm (enc) in JWE Header");let keyManagementAlgorithms=options&&validate_algorithms_default("keyManagementAlgorithms",options.keyManagementAlgorithms),contentEncryptionAlgorithms=options&&validate_algorithms_default("contentEncryptionAlgorithms",options.contentEncryptionAlgorithms);if(keyManagementAlgorithms&&!keyManagementAlgorithms.has(alg)||!keyManagementAlgorithms&&alg.startsWith("PBES2"))throw new JOSEAlgNotAllowed('"alg" (Algorithm) Header Parameter value not allowed');if(contentEncryptionAlgorithms&&!contentEncryptionAlgorithms.has(enc))throw new JOSEAlgNotAllowed('"enc" (Encryption Algorithm) Header Parameter value not allowed');let encryptedKey;if(jwe.encrypted_key!==void 0)try{encryptedKey=decode(jwe.encrypted_key)}catch{throw new JWEInvalid("Failed to base64url decode the encrypted_key")}let resolvedKey=!1;typeof key=="function"&&(key=await key(parsedProt,jwe),resolvedKey=!0);let cek;try{cek=await decrypt_key_management_default(alg,key,encryptedKey,joseHeader,options)}catch(err){if(err instanceof TypeError||err instanceof JWEInvalid||err instanceof JOSENotSupported)throw err;cek=cek_default(enc)}let iv,tag2;if(jwe.iv!==void 0)try{iv=decode(jwe.iv)}catch{throw new JWEInvalid("Failed to base64url decode the iv")}if(jwe.tag!==void 0)try{tag2=decode(jwe.tag)}catch{throw new JWEInvalid("Failed to base64url decode the tag")}let protectedHeader=encoder.encode(jwe.protected??""),additionalData;jwe.aad!==void 0?additionalData=concat(protectedHeader,encoder.encode("."),encoder.encode(jwe.aad)):additionalData=protectedHeader;let ciphertext;try{ciphertext=decode(jwe.ciphertext)}catch{throw new JWEInvalid("Failed to base64url decode the ciphertext")}let result={plaintext:await decrypt_default(enc,cek,ciphertext,iv,tag2,additionalData)};if(jwe.protected!==void 0&&(result.protectedHeader=parsedProt),jwe.aad!==void 0)try{result.additionalAuthenticatedData=decode(jwe.aad)}catch{throw new JWEInvalid("Failed to base64url decode the aad")}return jwe.unprotected!==void 0&&(result.sharedUnprotectedHeader=jwe.unprotected),jwe.header!==void 0&&(result.unprotectedHeader=jwe.header),resolvedKey?{...result,key}:result}async function compactDecrypt(jwe,key,options){if(jwe instanceof Uint8Array&&(jwe=decoder.decode(jwe)),typeof jwe!="string")throw new JWEInvalid("Compact JWE must be a string or Uint8Array");let{0:protectedHeader,1:encryptedKey,2:iv,3:ciphertext,4:tag2,length}=jwe.split(".");if(length!==5)throw new JWEInvalid("Invalid Compact JWE");let decrypted=await flattenedDecrypt({ciphertext,iv:iv||void 0,protected:protectedHeader,tag:tag2||void 0,encrypted_key:encryptedKey||void 0},key,options),result={plaintext:decrypted.plaintext,protectedHeader:decrypted.protectedHeader};return typeof key=="function"?{...result,key:decrypted.key}:result}var epoch_default=date=>Math.floor(date.getTime()/1e3);var REGEX=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i,secs_default=str=>{let matched=REGEX.exec(str);if(!matched||matched[4]&&matched[1])throw new TypeError("Invalid time period format");let value=parseFloat(matched[2]),unit=matched[3].toLowerCase(),numericDate;switch(unit){case"sec":case"secs":case"second":case"seconds":case"s":numericDate=Math.round(value);break;case"minute":case"minutes":case"min":case"mins":case"m":numericDate=Math.round(value*60);break;case"hour":case"hours":case"hr":case"hrs":case"h":numericDate=Math.round(value*3600);break;case"day":case"days":case"d":numericDate=Math.round(value*86400);break;case"week":case"weeks":case"w":numericDate=Math.round(value*604800);break;default:numericDate=Math.round(value*31557600);break}return matched[1]==="-"||matched[4]==="ago"?-numericDate:numericDate};var normalizeTyp=value=>value.toLowerCase().replace(/^application\//,""),checkAudiencePresence=(audPayload,audOption)=>typeof audPayload=="string"?audOption.includes(audPayload):Array.isArray(audPayload)?audOption.some(Set.prototype.has.bind(new Set(audPayload))):!1,jwt_claims_set_default=(protectedHeader,encodedPayload,options={})=>{let payload;try{payload=JSON.parse(decoder.decode(encodedPayload))}catch{}if(!isObject(payload))throw new JWTInvalid("JWT Claims Set must be a top-level JSON object");let{typ}=options;if(typ&&(typeof protectedHeader.typ!="string"||normalizeTyp(protectedHeader.typ)!==normalizeTyp(typ)))throw new JWTClaimValidationFailed('unexpected "typ" JWT header value',payload,"typ","check_failed");let{requiredClaims=[],issuer,subject,audience,maxTokenAge}=options,presenceCheck=[...requiredClaims];maxTokenAge!==void 0&&presenceCheck.push("iat"),audience!==void 0&&presenceCheck.push("aud"),subject!==void 0&&presenceCheck.push("sub"),issuer!==void 0&&presenceCheck.push("iss");for(let claim of new Set(presenceCheck.reverse()))if(!(claim in payload))throw new JWTClaimValidationFailed(`missing required "${claim}" claim`,payload,claim,"missing");if(issuer&&!(Array.isArray(issuer)?issuer:[issuer]).includes(payload.iss))throw new JWTClaimValidationFailed('unexpected "iss" claim value',payload,"iss","check_failed");if(subject&&payload.sub!==subject)throw new JWTClaimValidationFailed('unexpected "sub" claim value',payload,"sub","check_failed");if(audience&&!checkAudiencePresence(payload.aud,typeof audience=="string"?[audience]:audience))throw new JWTClaimValidationFailed('unexpected "aud" claim value',payload,"aud","check_failed");let tolerance;switch(typeof options.clockTolerance){case"string":tolerance=secs_default(options.clockTolerance);break;case"number":tolerance=options.clockTolerance;break;case"undefined":tolerance=0;break;default:throw new TypeError("Invalid clockTolerance option type")}let{currentDate}=options,now=epoch_default(currentDate||new Date);if((payload.iat!==void 0||maxTokenAge)&&typeof payload.iat!="number")throw new JWTClaimValidationFailed('"iat" claim must be a number',payload,"iat","invalid");if(payload.nbf!==void 0){if(typeof payload.nbf!="number")throw new JWTClaimValidationFailed('"nbf" claim must be a number',payload,"nbf","invalid");if(payload.nbf>now+tolerance)throw new JWTClaimValidationFailed('"nbf" claim timestamp check failed',payload,"nbf","check_failed")}if(payload.exp!==void 0){if(typeof payload.exp!="number")throw new JWTClaimValidationFailed('"exp" claim must be a number',payload,"exp","invalid");if(payload.exp<=now-tolerance)throw new JWTExpired('"exp" claim timestamp check failed',payload,"exp","check_failed")}if(maxTokenAge){let age=now-payload.iat,max=typeof maxTokenAge=="number"?maxTokenAge:secs_default(maxTokenAge);if(age-tolerance>max)throw new JWTExpired('"iat" claim timestamp check failed (too far in the past)',payload,"iat","check_failed");if(age<0-tolerance)throw new JWTClaimValidationFailed('"iat" claim timestamp check failed (it should be in the past)',payload,"iat","check_failed")}return payload};async function jwtDecrypt(jwt,key,options){let decrypted=await compactDecrypt(jwt,key,options),payload=jwt_claims_set_default(decrypted.protectedHeader,decrypted.plaintext,options),{protectedHeader}=decrypted;if(protectedHeader.iss!==void 0&&protectedHeader.iss!==payload.iss)throw new JWTClaimValidationFailed('replicated "iss" claim header parameter mismatch',payload,"iss","mismatch");if(protectedHeader.sub!==void 0&&protectedHeader.sub!==payload.sub)throw new JWTClaimValidationFailed('replicated "sub" claim header parameter mismatch',payload,"sub","mismatch");if(protectedHeader.aud!==void 0&&JSON.stringify(protectedHeader.aud)!==JSON.stringify(payload.aud))throw new JWTClaimValidationFailed('replicated "aud" claim header parameter mismatch',payload,"aud","mismatch");let result={payload,protectedHeader};return typeof key=="function"?{...result,key:decrypted.key}:result}var unprotected=Symbol();import{KeyObject as KeyObject9}from"node:crypto";var keyToJWK=key=>{let keyObject;if(isCryptoKey(key)){if(!key.extractable)throw new TypeError("CryptoKey is not extractable");keyObject=KeyObject9.from(key)}else if(is_key_object_default(key))keyObject=key;else{if(key instanceof Uint8Array)return{kty:"oct",k:encode(key)};throw new TypeError(invalid_key_input_default(key,...types3,"Uint8Array"))}if(keyObject.type!=="secret"&&!["rsa","ec","ed25519","x25519","ed448","x448"].includes(keyObject.asymmetricKeyType))throw new JOSENotSupported("Unsupported key asymmetricKeyType");return keyObject.export({format:"jwk"})},key_to_jwk_default=keyToJWK;async function exportJWK(key){return key_to_jwk_default(key)}async function encryptKeyManagement(alg,enc,key,providedCek,providedParameters={}){let encryptedKey,parameters,cek;switch(check_key_type_default(alg,key,"encrypt"),key=await normalize_key_default.normalizePublicKey?.(key,alg)||key,alg){case"dir":{cek=key;break}case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{if(!ecdhAllowed(key))throw new JOSENotSupported("ECDH with the provided key is not allowed or not supported by your javascript runtime");let{apu,apv}=providedParameters,{epk:ephemeralKey}=providedParameters;ephemeralKey||=(await generateEpk(key)).privateKey;let{x,y,crv,kty}=await exportJWK(ephemeralKey),sharedSecret=await deriveKey(key,ephemeralKey,alg==="ECDH-ES"?enc:alg,alg==="ECDH-ES"?bitLength2(enc):parseInt(alg.slice(-5,-2),10),apu,apv);if(parameters={epk:{x,crv,kty}},kty==="EC"&&(parameters.epk.y=y),apu&&(parameters.apu=encode(apu)),apv&&(parameters.apv=encode(apv)),alg==="ECDH-ES"){cek=sharedSecret;break}cek=providedCek||cek_default(enc);let kwAlg=alg.slice(-6);encryptedKey=await wrap(kwAlg,sharedSecret,cek);break}case"RSA1_5":case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":{cek=providedCek||cek_default(enc),encryptedKey=await encrypt2(alg,key,cek);break}case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":{cek=providedCek||cek_default(enc);let{p2c,p2s:p2s2}=providedParameters;({encryptedKey,...parameters}=await encrypt(alg,key,cek,p2c,p2s2));break}case"A128KW":case"A192KW":case"A256KW":{cek=providedCek||cek_default(enc),encryptedKey=await wrap(alg,key,cek);break}case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":{cek=providedCek||cek_default(enc);let{iv}=providedParameters;({encryptedKey,...parameters}=await wrap2(alg,key,cek,iv));break}default:throw new JOSENotSupported('Invalid or unsupported "alg" (JWE Algorithm) header value')}return{cek,encryptedKey,parameters}}var encrypt_key_management_default=encryptKeyManagement;var FlattenedEncrypt=class{_plaintext;_protectedHeader;_sharedUnprotectedHeader;_unprotectedHeader;_aad;_cek;_iv;_keyManagementParameters;constructor(plaintext){if(!(plaintext instanceof Uint8Array))throw new TypeError("plaintext must be an instance of Uint8Array");this._plaintext=plaintext}setKeyManagementParameters(parameters){if(this._keyManagementParameters)throw new TypeError("setKeyManagementParameters can only be called once");return this._keyManagementParameters=parameters,this}setProtectedHeader(protectedHeader){if(this._protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this._protectedHeader=protectedHeader,this}setSharedUnprotectedHeader(sharedUnprotectedHeader){if(this._sharedUnprotectedHeader)throw new TypeError("setSharedUnprotectedHeader can only be called once");return this._sharedUnprotectedHeader=sharedUnprotectedHeader,this}setUnprotectedHeader(unprotectedHeader){if(this._unprotectedHeader)throw new TypeError("setUnprotectedHeader can only be called once");return this._unprotectedHeader=unprotectedHeader,this}setAdditionalAuthenticatedData(aad){return this._aad=aad,this}setContentEncryptionKey(cek){if(this._cek)throw new TypeError("setContentEncryptionKey can only be called once");return this._cek=cek,this}setInitializationVector(iv){if(this._iv)throw new TypeError("setInitializationVector can only be called once");return this._iv=iv,this}async encrypt(key,options){if(!this._protectedHeader&&!this._unprotectedHeader&&!this._sharedUnprotectedHeader)throw new JWEInvalid("either setProtectedHeader, setUnprotectedHeader, or sharedUnprotectedHeader must be called before #encrypt()");if(!is_disjoint_default(this._protectedHeader,this._unprotectedHeader,this._sharedUnprotectedHeader))throw new JWEInvalid("JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint");let joseHeader={...this._protectedHeader,...this._unprotectedHeader,...this._sharedUnprotectedHeader};if(validate_crit_default(JWEInvalid,new Map,options?.crit,this._protectedHeader,joseHeader),joseHeader.zip!==void 0)throw new JOSENotSupported('JWE "zip" (Compression Algorithm) Header Parameter is not supported.');let{alg,enc}=joseHeader;if(typeof alg!="string"||!alg)throw new JWEInvalid('JWE "alg" (Algorithm) Header Parameter missing or invalid');if(typeof enc!="string"||!enc)throw new JWEInvalid('JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid');let encryptedKey;if(this._cek&&(alg==="dir"||alg==="ECDH-ES"))throw new TypeError(`setContentEncryptionKey cannot be called with JWE "alg" (Algorithm) Header ${alg}`);let cek;{let parameters;({cek,encryptedKey,parameters}=await encrypt_key_management_default(alg,enc,key,this._cek,this._keyManagementParameters)),parameters&&(options&&unprotected in options?this._unprotectedHeader?this._unprotectedHeader={...this._unprotectedHeader,...parameters}:this.setUnprotectedHeader(parameters):this._protectedHeader?this._protectedHeader={...this._protectedHeader,...parameters}:this.setProtectedHeader(parameters))}let additionalData,protectedHeader,aadMember;this._protectedHeader?protectedHeader=encoder.encode(encode(JSON.stringify(this._protectedHeader))):protectedHeader=encoder.encode(""),this._aad?(aadMember=encode(this._aad),additionalData=concat(protectedHeader,encoder.encode("."),encoder.encode(aadMember))):additionalData=protectedHeader;let{ciphertext,tag:tag2,iv}=await encrypt_default(enc,this._plaintext,cek,this._iv,additionalData),jwe={ciphertext:encode(ciphertext)};return iv&&(jwe.iv=encode(iv)),tag2&&(jwe.tag=encode(tag2)),encryptedKey&&(jwe.encrypted_key=encode(encryptedKey)),aadMember&&(jwe.aad=aadMember),this._protectedHeader&&(jwe.protected=decoder.decode(protectedHeader)),this._sharedUnprotectedHeader&&(jwe.unprotected=this._sharedUnprotectedHeader),this._unprotectedHeader&&(jwe.header=this._unprotectedHeader),jwe}};var CompactEncrypt=class{_flattened;constructor(plaintext){this._flattened=new FlattenedEncrypt(plaintext)}setContentEncryptionKey(cek){return this._flattened.setContentEncryptionKey(cek),this}setInitializationVector(iv){return this._flattened.setInitializationVector(iv),this}setProtectedHeader(protectedHeader){return this._flattened.setProtectedHeader(protectedHeader),this}setKeyManagementParameters(parameters){return this._flattened.setKeyManagementParameters(parameters),this}async encrypt(key,options){let jwe=await this._flattened.encrypt(key,options);return[jwe.protected,jwe.encrypted_key,jwe.iv,jwe.ciphertext,jwe.tag].join(".")}};function validateInput(label,input){if(!Number.isFinite(input))throw new TypeError(`Invalid ${label} input`);return input}var ProduceJWT=class{_payload;constructor(payload={}){if(!isObject(payload))throw new TypeError("JWT Claims Set MUST be an object");this._payload=payload}setIssuer(issuer){return this._payload={...this._payload,iss:issuer},this}setSubject(subject){return this._payload={...this._payload,sub:subject},this}setAudience(audience){return this._payload={...this._payload,aud:audience},this}setJti(jwtId){return this._payload={...this._payload,jti:jwtId},this}setNotBefore(input){return typeof input=="number"?this._payload={...this._payload,nbf:validateInput("setNotBefore",input)}:input instanceof Date?this._payload={...this._payload,nbf:validateInput("setNotBefore",epoch_default(input))}:this._payload={...this._payload,nbf:epoch_default(new Date)+secs_default(input)},this}setExpirationTime(input){return typeof input=="number"?this._payload={...this._payload,exp:validateInput("setExpirationTime",input)}:input instanceof Date?this._payload={...this._payload,exp:validateInput("setExpirationTime",epoch_default(input))}:this._payload={...this._payload,exp:epoch_default(new Date)+secs_default(input)},this}setIssuedAt(input){return typeof input>"u"?this._payload={...this._payload,iat:epoch_default(new Date)}:input instanceof Date?this._payload={...this._payload,iat:validateInput("setIssuedAt",epoch_default(input))}:typeof input=="string"?this._payload={...this._payload,iat:validateInput("setIssuedAt",epoch_default(new Date)+secs_default(input))}:this._payload={...this._payload,iat:validateInput("setIssuedAt",input)},this}};var EncryptJWT=class extends ProduceJWT{_cek;_iv;_keyManagementParameters;_protectedHeader;_replicateIssuerAsHeader;_replicateSubjectAsHeader;_replicateAudienceAsHeader;setProtectedHeader(protectedHeader){if(this._protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this._protectedHeader=protectedHeader,this}setKeyManagementParameters(parameters){if(this._keyManagementParameters)throw new TypeError("setKeyManagementParameters can only be called once");return this._keyManagementParameters=parameters,this}setContentEncryptionKey(cek){if(this._cek)throw new TypeError("setContentEncryptionKey can only be called once");return this._cek=cek,this}setInitializationVector(iv){if(this._iv)throw new TypeError("setInitializationVector can only be called once");return this._iv=iv,this}replicateIssuerAsHeader(){return this._replicateIssuerAsHeader=!0,this}replicateSubjectAsHeader(){return this._replicateSubjectAsHeader=!0,this}replicateAudienceAsHeader(){return this._replicateAudienceAsHeader=!0,this}async encrypt(key,options){let enc=new CompactEncrypt(encoder.encode(JSON.stringify(this._payload)));return this._replicateIssuerAsHeader&&(this._protectedHeader={...this._protectedHeader,iss:this._payload.iss}),this._replicateSubjectAsHeader&&(this._protectedHeader={...this._protectedHeader,sub:this._payload.sub}),this._replicateAudienceAsHeader&&(this._protectedHeader={...this._protectedHeader,aud:this._payload.aud}),enc.setProtectedHeader(this._protectedHeader),this._iv&&enc.setInitializationVector(this._iv),this._cek&&enc.setContentEncryptionKey(this._cek),this._keyManagementParameters&&enc.setKeyManagementParameters(this._keyManagementParameters),enc.encrypt(key,options)}};var base64url_exports={};__export(base64url_exports,{decode:()=>decode2,encode:()=>encode2});var encode2=encode,decode2=decode;function decodeJwt(jwt){if(typeof jwt!="string")throw new JWTInvalid("JWTs must use Compact JWS serialization, JWT must be a string");let{1:payload,length}=jwt.split(".");if(length===5)throw new JWTInvalid("Only JWTs using Compact JWS serialization can be decoded");if(length!==3)throw new JWTInvalid("Invalid JWT");if(!payload)throw new JWTInvalid("JWTs must contain a payload");let decoded;try{decoded=decode2(payload)}catch{throw new JWTInvalid("Failed to base64url decode the payload")}let result;try{result=JSON.parse(decoder.decode(decoded))}catch{throw new JWTInvalid("Failed to parse the decoded payload as JSON")}if(!isObject(result))throw new JWTInvalid("Invalid JWT Claims Set");return result}export{jwtDecrypt,EncryptJWT,base64url_exports,decodeJwt};
|
|
@@ -4,6 +4,6 @@ import { dirname as __dirname_ } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
|
-
import{humanizeIdentifier}from"./chunk-GHAY4PSD.js";import{indent_default}from"./chunk-GZNDA6SV.js";import{table}from"./chunk-
|
|
7
|
+
import{humanizeIdentifier}from"./chunk-GHAY4PSD.js";import{indent_default}from"./chunk-GZNDA6SV.js";import{table}from"./chunk-QCYCLWNG.js";function renderAlertTable(rows,hsep=3){return indent_default(table(rows,{hsep}).split(`
|
|
8
8
|
`).map(line=>line.trimEnd()).join(`
|
|
9
9
|
`),2)}function normalizeTimestamp(value){if(!(value===void 0||!Number.isFinite(value)))return Math.abs(value)<1e12?value*1e3:value}function getPrimaryAlert(group){return group.alerts?.[0]}function getGroupTitle(group){return group.ai?.title||group.title||getPrimaryAlert(group)?.title||"Alert group"}function getGroupType(group){return group.type||getPrimaryAlert(group)?.type||"-"}function getGroupStartedAt(group){let primaryAlert=getPrimaryAlert(group);return normalizeTimestamp(group.recordedStartedAt??primaryAlert?.recordedStartedAt??primaryAlert?.startedAt)}function formatTriggerOperator(value){switch(value){case"gt":return">";case"gte":return">=";case"lt":return"<";case"lte":return"<=";default:return}}function humanizeReference(value,opts={}){return value.split("/").map(part=>{let label=humanizeIdentifier(part);return opts.case==="title"?label:label.toLowerCase()}).join(" / ")}export{renderAlertTable,normalizeTimestamp,getGroupTitle,getGroupType,getGroupStartedAt,formatTriggerOperator,humanizeReference};
|
|
@@ -4,4 +4,4 @@ import { dirname as __dirname_ } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
|
-
import{pkg_default}from"./chunk-
|
|
7
|
+
import{pkg_default}from"./chunk-JCDPMWKO.js";import os from"os";var ua_default=`${pkg_default.name} ${pkg_default.version} node-${process.version} ${os.platform()} (${os.arch()})`;export{ua_default};
|
|
@@ -4,4 +4,4 @@ import { dirname as __dirname_ } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
|
-
import{warnDeprecatedOption}from"./chunk-KA2KG3SY.js";import{packageName}from"./chunk-B4KA3ZH2.js";import{DEPRECATED_SHORTHANDS,arg_common_default,getShortFlagLongName,quoteArg,setCommandFlagsSpecification,stripSensitiveAuthArgs}from"./chunk-DORCX7UB.js";import{__commonJS,__toESM}from"./chunk-BZENIQ7N.js";var require_arg=__commonJS({"../../node_modules/.pnpm/arg@5.0.0/node_modules/arg/index.js"(exports,module){var flagSymbol=Symbol("arg flag"),ArgError=class _ArgError extends Error{constructor(msg,code){super(msg),this.name="ArgError",this.code=code,Object.setPrototypeOf(this,_ArgError.prototype)}};function arg2(opts,{argv=process.argv.slice(2),permissive=!1,stopAtPositional=!1}={}){if(!opts)throw new ArgError("argument specification object is required","ARG_CONFIG_NO_SPEC");let result={_:[]},aliases={},handlers={};for(let key of Object.keys(opts)){if(!key)throw new ArgError("argument key cannot be an empty string","ARG_CONFIG_EMPTY_KEY");if(key[0]!=="-")throw new ArgError(`argument key must start with '-' but found: '${key}'`,"ARG_CONFIG_NONOPT_KEY");if(key.length===1)throw new ArgError(`argument key must have a name; singular '-' keys are not allowed: ${key}`,"ARG_CONFIG_NONAME_KEY");if(typeof opts[key]=="string"){aliases[key]=opts[key];continue}let type=opts[key],isFlag=!1;if(Array.isArray(type)&&type.length===1&&typeof type[0]=="function"){let[fn]=type;type=(value,name,prev=[])=>(prev.push(fn(value,name,prev[prev.length-1])),prev),isFlag=fn===Boolean||fn[flagSymbol]===!0}else if(typeof type=="function")isFlag=type===Boolean||type[flagSymbol]===!0;else throw new ArgError(`type missing or not a function or valid array type: ${key}`,"ARG_CONFIG_VAD_TYPE");if(key[1]!=="-"&&key.length>2)throw new ArgError(`short argument keys (with a single hyphen) must have only one character: ${key}`,"ARG_CONFIG_SHORTOPT_TOOLONG");handlers[key]=[type,isFlag]}for(let i=0,len=argv.length;i<len;i++){let wholeArg=argv[i];if(stopAtPositional&&result._.length>0){result._=result._.concat(argv.slice(i));break}if(wholeArg==="--"){result._=result._.concat(argv.slice(i+1));break}if(wholeArg.length>1&&wholeArg[0]==="-"){let separatedArguments=wholeArg[1]==="-"||wholeArg.length===2?[wholeArg]:wholeArg.slice(1).split("").map(a=>`-${a}`);for(let j=0;j<separatedArguments.length;j++){let arg3=separatedArguments[j],[originalArgName,argStr]=arg3[1]==="-"?arg3.split(/=(.*)/,2):[arg3,void 0],argName=originalArgName;for(;argName in aliases;)argName=aliases[argName];if(!(argName in handlers))if(permissive){result._.push(arg3);continue}else throw new ArgError(`unknown or unexpected option: ${originalArgName}`,"ARG_UNKNOWN_OPTION");let[type,isFlag]=handlers[argName];if(!isFlag&&j+1<separatedArguments.length)throw new ArgError(`option requires argument (but was followed by another short argument): ${originalArgName}`,"ARG_MISSING_REQUIRED_SHORTARG");if(isFlag)result[argName]=type(!0,argName,result[argName]);else if(argStr===void 0){if(argv.length<i+2||argv[i+1].length>1&&argv[i+1][0]==="-"&&!(argv[i+1].match(/^-?\d*(\.(?=\d))?\d*$/)&&(type===Number||typeof BigInt<"u"&&type===BigInt))){let extended=originalArgName===argName?"":` (alias for ${argName})`;throw new ArgError(`option requires argument: ${originalArgName}${extended}`,"ARG_MISSING_REQUIRED_LONGARG")}result[argName]=type(argv[i+1],argName,result[argName]),++i}else result[argName]=type(argStr,argName,result[argName])}}else result._.push(wholeArg)}return result}arg2.flag=fn=>(fn[flagSymbol]=!0,fn);arg2.COUNT=arg2.flag((v,name,existingCount)=>(existingCount||0)+1);arg2.ArgError=ArgError;module.exports=arg2}});var import_arg=__toESM(require_arg(),1);function suggestCorrection(input,choices){if(input.replace(/^-+/,"").length<3||choices.includes(input))return;let matches=[...new Set(choices)].filter(choice=>{if(Math.abs(input.length-choice.length)>1)return!1;let i=0;for(;i<input.length&&input[i]===choice[i];)i++;return input.length===choice.length?input.slice(i+1)===choice.slice(i+1)||input[i]===choice[i+1]&&input[i+1]===choice[i]&&input.slice(i+2)===choice.slice(i+2):input.length>choice.length?input.slice(i+1)===choice.slice(i):input.slice(i)===choice.slice(i+1)});return matches.length===1?matches[0]:void 0}var SAFE_VALUE_FLAGS=new Set(["--cwd","--scope","--team","-S","-T","--project","-p","--format","--environment","--since","--until","--limit"]),READ_COMMANDS=new Set(["inspect","list","ls","schema","whoami"]);function buildCorrectedCommand(argv,from,to,flagsSpecification={}){let corrected=argv.slice(2),spec={...arg_common_default(),...flagsSpecification},isSafeValueFlag=name=>SAFE_VALUE_FLAGS.has(getShortFlagLongName(name,spec)??name),valuelessFlags=new Set,takesValue=new Set;for(let[name,value]of Object.entries(spec))((typeof value=="string"?spec[value]:value)===Boolean?valuelessFlags:takesValue).add(name);for(let i=0;i<corrected.length;i++){let value=corrected[i];if(value==="--")break;if(value===from||value.startsWith(`${from}=`)){corrected[i]=to+value.slice(from.length);break}takesValue.has(value)&&i++}let args=stripSensitiveAuthArgs(corrected).filter(arg2=>!/^-t[^-=]/.test(arg2)),out=[],positionals=0,readCommand=!1;for(let i=0;i<args.length;i++){let value=args[i];if(value==="--"){out.push("--","<argument>");break}if(value.startsWith("-")){if(/^-[A-Za-z][^=].+/.test(value)&&!value.startsWith("--")){let name2=value.slice(0,2);out.push(name2,isSafeValueFlag(name2)?value.slice(2):"<value>");continue}let equals=value.indexOf("="),name=equals<0?value:value.slice(0,equals);equals>=0?out.push(`${name}=${isSafeValueFlag(name)||valuelessFlags.has(name)&&/^(true|false)$/.test(value.slice(equals+1))?value.slice(equals+1):"<value>"}`):(out.push(name),!valuelessFlags.has(name)&&i+1<args.length&&(takesValue.has(name)||!args[i+1].startsWith("-"))&&(i++,out.push(isSafeValueFlag(name)?args[i]:"<value>")))}else positionals++,positionals<=2&&(readCommand||=READ_COMMANDS.has(value)),out.push(positionals<=2||readCommand?value:"<argument>")}return[packageName,...out].map(quoteArg).join(" ")}var argumentErrors=new WeakSet;function isArgumentError(error){return error instanceof Error&&argumentErrors.has(error)}function getNegations(spec){let negations=new Map;for(let[name,type]of Object.entries(spec)){if(type!==Boolean||!name.startsWith("--")||name.startsWith("--no-"))continue;let negation=`--no-${name.slice(2)}`;negation in spec||negations.set(negation,name)}return negations}function conflictingOptionsError(name,negation){let error=new Error(`Can't use ${name} with ${negation}.`);return error.code="ARG_CONFLICTING_OPTIONS",argumentErrors.add(error),error}function parseWithSuggestions(args,spec,options){let negations=options.keepNegations?new Map:getNegations(spec);try{let negationSpec={};for(let negation of negations.keys())negationSpec[negation]=Boolean;let result=(0,import_arg.default)({...spec,...negationSpec},{...options,argv:args});for(let[negation,name]of negations)if(result[negation]!==void 0&&(delete result[negation],result[name]!==void 0&&!options.permissive))throw conflictingOptionsError(name,negation);return result}catch(error){if(error instanceof Error&&"code"in error&&["ARG_UNKNOWN_OPTION","ARG_MISSING_REQUIRED_LONGARG","ARG_MISSING_REQUIRED_SHORTARG"].includes(String(error.code))){let err=error,option=/(?:unknown or unexpected option|option requires argument(?: \([^)]*\))?): (--?[A-Za-z0-9-]+)(?: \(alias for --?[A-Za-z0-9-]+\))?$/.exec(err.message)?.[1];option&&(argumentErrors.add(err),err.invalidOption=option,err.allowedOptions=Object.keys(spec).filter(name=>name.startsWith("--")).sort(),err.code==="ARG_UNKNOWN_OPTION"&&(err.suggestedOption=suggestCorrection(option,err.allowedOptions)),err.flagsSpecification=spec)}throw error}}function getArgs(argv,argsOptions,argOptions={}){return parseWithSuggestions(argv,Object.assign({},arg_common_default(),argsOptions),argOptions)}var COMMAND_SHORTHAND_PLACEHOLDER="--\0command-shorthand-";function parseArguments(args,flagsSpecification,parserOptions={}){let spec=Object.assign({},arg_common_default(),flagsSpecification),{commandShorthands}=parserOptions,keepForCommand=!!(parserOptions.permissive&&commandShorthands?.size),{_:parsed,...rest}=parseWithSuggestions(keepForCommand?args.map((arg2,index)=>commandShorthands.has(index)?`${COMMAND_SHORTHAND_PLACEHOLDER}${index}`:arg2):args,spec,parserOptions),positional=keepForCommand?parsed.map(arg2=>arg2.startsWith(COMMAND_SHORTHAND_PLACEHOLDER)?args[Number(arg2.slice(COMMAND_SHORTHAND_PLACEHOLDER.length))]:arg2):parsed;return!parserOptions.permissive&&parserOptions.warnDeprecated!==!1&&(setCommandFlagsSpecification(spec),warnDeprecatedShorthands(args,spec,parserOptions)),{args:positional,flags:rest}}var usedShorthands=new Set,warnedShorthands=new Set;function getUsedDeprecatedShorthands(){return[...usedShorthands]}function warnDeprecatedShorthands(args,spec,parserOptions){let shorthands=spec[DEPRECATED_SHORTHANDS];if(!shorthands?.length)return;let names=new Map,splitSpec={...spec};for(let shorthand of shorthands){let name=spec[shorthand];if(typeof name!="string")continue;let handler=resolveHandler(spec,name);handler!==void 0&&(names.set(shorthand,name),splitSpec[shorthand]=handler)}let flags;try{flags=parseWithSuggestions(args,splitSpec,parserOptions)}catch{return}for(let[shorthand,name]of names){if(flags[shorthand]===void 0)continue;usedShorthands.add(shorthand);let warning=`${shorthand} ${name}`;warnedShorthands.has(warning)||(warnedShorthands.add(warning),warnDeprecatedOption(args,shorthand,name))}}function resolveHandler(spec,name){let handler=spec[name];for(;typeof handler=="string";)handler=spec[handler];return handler}function parseWithShortFlag(args,spec,shortFlag,handler=resolveHandler(spec,shortFlag)){if(handler===void 0)return{};try{return parseArguments(args,{...spec,[shortFlag]:handler},{permissive:!0,warnDeprecated:!1}).flags}catch{return{}}}function getTypedOptionName(args,spec,name){for(let[key,target]of Object.entries(spec))if(target===name&&/^-[^-]$/.test(key)&&parseWithShortFlag(args,spec,key)[key]!==void 0)return usedShorthands.add(key),key;return name}function takeCommand(argv,flagsSpecification){let{_:positional}=parseWithSuggestions(argv,Object.assign({},arg_common_default(),flagsSpecification),{stopAtPositional:!0}),index=argv.length-positional.length;return{command:positional[0],index,args:[...argv.slice(0,index),...argv.slice(index+1)]}}export{require_arg,suggestCorrection,buildCorrectedCommand,isArgumentError,getArgs,parseArguments,getUsedDeprecatedShorthands,parseWithShortFlag,getTypedOptionName,takeCommand};
|
|
7
|
+
import{warnDeprecatedOption}from"./chunk-IR3E37HD.js";import{packageName}from"./chunk-EFGZK6OY.js";import{DEPRECATED_SHORTHANDS,arg_common_default,getShortFlagLongName,quoteArg,setCommandFlagsSpecification,stripSensitiveAuthArgs}from"./chunk-DORCX7UB.js";import{__commonJS,__toESM}from"./chunk-NBPLUP7C.js";var require_arg=__commonJS({"../../node_modules/.pnpm/arg@5.0.0/node_modules/arg/index.js"(exports,module){var flagSymbol=Symbol("arg flag"),ArgError=class _ArgError extends Error{constructor(msg,code){super(msg),this.name="ArgError",this.code=code,Object.setPrototypeOf(this,_ArgError.prototype)}};function arg2(opts,{argv=process.argv.slice(2),permissive=!1,stopAtPositional=!1}={}){if(!opts)throw new ArgError("argument specification object is required","ARG_CONFIG_NO_SPEC");let result={_:[]},aliases={},handlers={};for(let key of Object.keys(opts)){if(!key)throw new ArgError("argument key cannot be an empty string","ARG_CONFIG_EMPTY_KEY");if(key[0]!=="-")throw new ArgError(`argument key must start with '-' but found: '${key}'`,"ARG_CONFIG_NONOPT_KEY");if(key.length===1)throw new ArgError(`argument key must have a name; singular '-' keys are not allowed: ${key}`,"ARG_CONFIG_NONAME_KEY");if(typeof opts[key]=="string"){aliases[key]=opts[key];continue}let type=opts[key],isFlag=!1;if(Array.isArray(type)&&type.length===1&&typeof type[0]=="function"){let[fn]=type;type=(value,name,prev=[])=>(prev.push(fn(value,name,prev[prev.length-1])),prev),isFlag=fn===Boolean||fn[flagSymbol]===!0}else if(typeof type=="function")isFlag=type===Boolean||type[flagSymbol]===!0;else throw new ArgError(`type missing or not a function or valid array type: ${key}`,"ARG_CONFIG_VAD_TYPE");if(key[1]!=="-"&&key.length>2)throw new ArgError(`short argument keys (with a single hyphen) must have only one character: ${key}`,"ARG_CONFIG_SHORTOPT_TOOLONG");handlers[key]=[type,isFlag]}for(let i=0,len=argv.length;i<len;i++){let wholeArg=argv[i];if(stopAtPositional&&result._.length>0){result._=result._.concat(argv.slice(i));break}if(wholeArg==="--"){result._=result._.concat(argv.slice(i+1));break}if(wholeArg.length>1&&wholeArg[0]==="-"){let separatedArguments=wholeArg[1]==="-"||wholeArg.length===2?[wholeArg]:wholeArg.slice(1).split("").map(a=>`-${a}`);for(let j=0;j<separatedArguments.length;j++){let arg3=separatedArguments[j],[originalArgName,argStr]=arg3[1]==="-"?arg3.split(/=(.*)/,2):[arg3,void 0],argName=originalArgName;for(;argName in aliases;)argName=aliases[argName];if(!(argName in handlers))if(permissive){result._.push(arg3);continue}else throw new ArgError(`unknown or unexpected option: ${originalArgName}`,"ARG_UNKNOWN_OPTION");let[type,isFlag]=handlers[argName];if(!isFlag&&j+1<separatedArguments.length)throw new ArgError(`option requires argument (but was followed by another short argument): ${originalArgName}`,"ARG_MISSING_REQUIRED_SHORTARG");if(isFlag)result[argName]=type(!0,argName,result[argName]);else if(argStr===void 0){if(argv.length<i+2||argv[i+1].length>1&&argv[i+1][0]==="-"&&!(argv[i+1].match(/^-?\d*(\.(?=\d))?\d*$/)&&(type===Number||typeof BigInt<"u"&&type===BigInt))){let extended=originalArgName===argName?"":` (alias for ${argName})`;throw new ArgError(`option requires argument: ${originalArgName}${extended}`,"ARG_MISSING_REQUIRED_LONGARG")}result[argName]=type(argv[i+1],argName,result[argName]),++i}else result[argName]=type(argStr,argName,result[argName])}}else result._.push(wholeArg)}return result}arg2.flag=fn=>(fn[flagSymbol]=!0,fn);arg2.COUNT=arg2.flag((v,name,existingCount)=>(existingCount||0)+1);arg2.ArgError=ArgError;module.exports=arg2}});var import_arg=__toESM(require_arg(),1);function suggestCorrection(input,choices){if(input.replace(/^-+/,"").length<3||choices.includes(input))return;let matches=[...new Set(choices)].filter(choice=>{if(Math.abs(input.length-choice.length)>1)return!1;let i=0;for(;i<input.length&&input[i]===choice[i];)i++;return input.length===choice.length?input.slice(i+1)===choice.slice(i+1)||input[i]===choice[i+1]&&input[i+1]===choice[i]&&input.slice(i+2)===choice.slice(i+2):input.length>choice.length?input.slice(i+1)===choice.slice(i):input.slice(i)===choice.slice(i+1)});return matches.length===1?matches[0]:void 0}var SAFE_VALUE_FLAGS=new Set(["--cwd","--scope","--team","-S","-T","--project","-p","--format","--environment","--since","--until","--limit"]),READ_COMMANDS=new Set(["inspect","list","ls","schema","whoami"]);function buildCorrectedCommand(argv,from,to,flagsSpecification={}){let corrected=argv.slice(2),spec={...arg_common_default(),...flagsSpecification},isSafeValueFlag=name=>SAFE_VALUE_FLAGS.has(getShortFlagLongName(name,spec)??name),valuelessFlags=new Set,takesValue=new Set;for(let[name,value]of Object.entries(spec))((typeof value=="string"?spec[value]:value)===Boolean?valuelessFlags:takesValue).add(name);for(let i=0;i<corrected.length;i++){let value=corrected[i];if(value==="--")break;if(value===from||value.startsWith(`${from}=`)){corrected[i]=to+value.slice(from.length);break}takesValue.has(value)&&i++}let args=stripSensitiveAuthArgs(corrected).filter(arg2=>!/^-t[^-=]/.test(arg2)),out=[],positionals=0,readCommand=!1;for(let i=0;i<args.length;i++){let value=args[i];if(value==="--"){out.push("--","<argument>");break}if(value.startsWith("-")){if(/^-[A-Za-z][^=].+/.test(value)&&!value.startsWith("--")){let name2=value.slice(0,2);out.push(name2,isSafeValueFlag(name2)?value.slice(2):"<value>");continue}let equals=value.indexOf("="),name=equals<0?value:value.slice(0,equals);equals>=0?out.push(`${name}=${isSafeValueFlag(name)||valuelessFlags.has(name)&&/^(true|false)$/.test(value.slice(equals+1))?value.slice(equals+1):"<value>"}`):(out.push(name),!valuelessFlags.has(name)&&i+1<args.length&&(takesValue.has(name)||!args[i+1].startsWith("-"))&&(i++,out.push(isSafeValueFlag(name)?args[i]:"<value>")))}else positionals++,positionals<=2&&(readCommand||=READ_COMMANDS.has(value)),out.push(positionals<=2||readCommand?value:"<argument>")}return[packageName,...out].map(quoteArg).join(" ")}var argumentErrors=new WeakSet;function isArgumentError(error){return error instanceof Error&&argumentErrors.has(error)}function getNegations(spec){let negations=new Map;for(let[name,type]of Object.entries(spec)){if(type!==Boolean||!name.startsWith("--")||name.startsWith("--no-"))continue;let negation=`--no-${name.slice(2)}`;negation in spec||negations.set(negation,name)}return negations}function conflictingOptionsError(name,negation){let error=new Error(`Can't use ${name} with ${negation}.`);return error.code="ARG_CONFLICTING_OPTIONS",argumentErrors.add(error),error}function parseWithSuggestions(args,spec,options){let negations=options.keepNegations?new Map:getNegations(spec);try{let negationSpec={};for(let negation of negations.keys())negationSpec[negation]=Boolean;let result=(0,import_arg.default)({...spec,...negationSpec},{...options,argv:args});for(let[negation,name]of negations)if(result[negation]!==void 0&&(delete result[negation],result[name]!==void 0&&!options.permissive))throw conflictingOptionsError(name,negation);return result}catch(error){if(error instanceof Error&&"code"in error&&["ARG_UNKNOWN_OPTION","ARG_MISSING_REQUIRED_LONGARG","ARG_MISSING_REQUIRED_SHORTARG"].includes(String(error.code))){let err=error,option=/(?:unknown or unexpected option|option requires argument(?: \([^)]*\))?): (--?[A-Za-z0-9-]+)(?: \(alias for --?[A-Za-z0-9-]+\))?$/.exec(err.message)?.[1];option&&(argumentErrors.add(err),err.invalidOption=option,err.allowedOptions=Object.keys(spec).filter(name=>name.startsWith("--")).sort(),err.code==="ARG_UNKNOWN_OPTION"&&(err.suggestedOption=suggestCorrection(option,err.allowedOptions)),err.flagsSpecification=spec)}throw error}}function getArgs(argv,argsOptions,argOptions={}){return parseWithSuggestions(argv,Object.assign({},arg_common_default(),argsOptions),argOptions)}var COMMAND_SHORTHAND_PLACEHOLDER="--\0command-shorthand-";function parseArguments(args,flagsSpecification,parserOptions={}){let spec=Object.assign({},arg_common_default(),flagsSpecification),{commandShorthands}=parserOptions,keepForCommand=!!(parserOptions.permissive&&commandShorthands?.size),{_:parsed,...rest}=parseWithSuggestions(keepForCommand?args.map((arg2,index)=>commandShorthands.has(index)?`${COMMAND_SHORTHAND_PLACEHOLDER}${index}`:arg2):args,spec,parserOptions),positional=keepForCommand?parsed.map(arg2=>arg2.startsWith(COMMAND_SHORTHAND_PLACEHOLDER)?args[Number(arg2.slice(COMMAND_SHORTHAND_PLACEHOLDER.length))]:arg2):parsed;return!parserOptions.permissive&&parserOptions.warnDeprecated!==!1&&(setCommandFlagsSpecification(spec),warnDeprecatedShorthands(args,spec,parserOptions)),{args:positional,flags:rest}}var usedShorthands=new Set,warnedShorthands=new Set;function getUsedDeprecatedShorthands(){return[...usedShorthands]}function warnDeprecatedShorthands(args,spec,parserOptions){let shorthands=spec[DEPRECATED_SHORTHANDS];if(!shorthands?.length)return;let names=new Map,splitSpec={...spec};for(let shorthand of shorthands){let name=spec[shorthand];if(typeof name!="string")continue;let handler=resolveHandler(spec,name);handler!==void 0&&(names.set(shorthand,name),splitSpec[shorthand]=handler)}let flags;try{flags=parseWithSuggestions(args,splitSpec,parserOptions)}catch{return}for(let[shorthand,name]of names){if(flags[shorthand]===void 0)continue;usedShorthands.add(shorthand);let warning=`${shorthand} ${name}`;warnedShorthands.has(warning)||(warnedShorthands.add(warning),warnDeprecatedOption(args,shorthand,name))}}function resolveHandler(spec,name){let handler=spec[name];for(;typeof handler=="string";)handler=spec[handler];return handler}function parseWithShortFlag(args,spec,shortFlag,handler=resolveHandler(spec,shortFlag)){if(handler===void 0)return{};try{return parseArguments(args,{...spec,[shortFlag]:handler},{permissive:!0,warnDeprecated:!1}).flags}catch{return{}}}function getTypedOptionName(args,spec,name){for(let[key,target]of Object.entries(spec))if(target===name&&/^-[^-]$/.test(key)&&parseWithShortFlag(args,spec,key)[key]!==void 0)return usedShorthands.add(key),key;return name}function takeCommand(argv,flagsSpecification){let{_:positional}=parseWithSuggestions(argv,Object.assign({},arg_common_default(),flagsSpecification),{stopAtPositional:!0}),index=argv.length-positional.length;return{command:positional[0],index,args:[...argv.slice(0,index),...argv.slice(index+1)]}}export{require_arg,suggestCorrection,buildCorrectedCommand,isArgumentError,getArgs,parseArguments,getUsedDeprecatedShorthands,parseWithShortFlag,getTypedOptionName,takeCommand};
|
|
@@ -4,6 +4,6 @@ import { dirname as __dirname_ } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
|
-
import{require_isexe}from"./chunk-
|
|
7
|
+
import{require_isexe}from"./chunk-IFMPBA4K.js";import{__commonJS,__require}from"./chunk-NBPLUP7C.js";var require_which=__commonJS({"../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js"(exports,module){var isWindows=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",path=__require("path"),COLON=isWindows?";":":",isexe=require_isexe(),getNotFoundError=cmd=>Object.assign(new Error(`not found: ${cmd}`),{code:"ENOENT"}),getPathInfo=(cmd,opt)=>{let colon=opt.colon||COLON,pathEnv=cmd.match(/\//)||isWindows&&cmd.match(/\\/)?[""]:[...isWindows?[process.cwd()]:[],...(opt.path||process.env.PATH||"").split(colon)],pathExtExe=isWindows?opt.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",pathExt=isWindows?pathExtExe.split(colon):[""];return isWindows&&cmd.indexOf(".")!==-1&&pathExt[0]!==""&&pathExt.unshift(""),{pathEnv,pathExt,pathExtExe}},which=(cmd,opt,cb)=>{typeof opt=="function"&&(cb=opt,opt={}),opt||(opt={});let{pathEnv,pathExt,pathExtExe}=getPathInfo(cmd,opt),found=[],step=i=>new Promise((resolve,reject)=>{if(i===pathEnv.length)return opt.all&&found.length?resolve(found):reject(getNotFoundError(cmd));let ppRaw=pathEnv[i],pathPart=/^".*"$/.test(ppRaw)?ppRaw.slice(1,-1):ppRaw,pCmd=path.join(pathPart,cmd),p=!pathPart&&/^\.[\\\/]/.test(cmd)?cmd.slice(0,2)+pCmd:pCmd;resolve(subStep(p,i,0))}),subStep=(p,i,ii)=>new Promise((resolve,reject)=>{if(ii===pathExt.length)return resolve(step(i+1));let ext=pathExt[ii];isexe(p+ext,{pathExt:pathExtExe},(er,is)=>{if(!er&&is)if(opt.all)found.push(p+ext);else return resolve(p+ext);return resolve(subStep(p,i,ii+1))})});return cb?step(0).then(res=>cb(null,res),cb):step(0)},whichSync=(cmd,opt)=>{opt=opt||{};let{pathEnv,pathExt,pathExtExe}=getPathInfo(cmd,opt),found=[];for(let i=0;i<pathEnv.length;i++){let ppRaw=pathEnv[i],pathPart=/^".*"$/.test(ppRaw)?ppRaw.slice(1,-1):ppRaw,pCmd=path.join(pathPart,cmd),p=!pathPart&&/^\.[\\\/]/.test(cmd)?cmd.slice(0,2)+pCmd:pCmd;for(let j=0;j<pathExt.length;j++){let cur=p+pathExt[j];try{if(isexe.sync(cur,{pathExt:pathExtExe}))if(opt.all)found.push(cur);else return cur}catch{}}}if(opt.all&&found.length)return found;if(opt.nothrow)return null;throw getNotFoundError(cmd)};module.exports=which;which.sync=whichSync}});var require_path_key=__commonJS({"../../node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js"(exports,module){"use strict";var pathKey=(options={})=>{let environment=options.env||process.env;return(options.platform||process.platform)!=="win32"?"PATH":Object.keys(environment).reverse().find(key=>key.toUpperCase()==="PATH")||"Path"};module.exports=pathKey;module.exports.default=pathKey}});var require_resolveCommand=__commonJS({"../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js"(exports,module){"use strict";var path=__require("path"),which=require_which(),getPathKey=require_path_key();function resolveCommandAttempt(parsed,withoutPathExt){let env=parsed.options.env||process.env,cwd=process.cwd(),hasCustomCwd=parsed.options.cwd!=null,shouldSwitchCwd=hasCustomCwd&&process.chdir!==void 0&&!process.chdir.disabled;if(shouldSwitchCwd)try{process.chdir(parsed.options.cwd)}catch{}let resolved;try{resolved=which.sync(parsed.command,{path:env[getPathKey({env})],pathExt:withoutPathExt?path.delimiter:void 0})}catch{}finally{shouldSwitchCwd&&process.chdir(cwd)}return resolved&&(resolved=path.resolve(hasCustomCwd?parsed.options.cwd:"",resolved)),resolved}function resolveCommand(parsed){return resolveCommandAttempt(parsed)||resolveCommandAttempt(parsed,!0)}module.exports=resolveCommand}});var require_escape=__commonJS({"../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js"(exports,module){"use strict";var metaCharsRegExp=/([()\][%!^"`<>&|;, *?])/g;function escapeCommand(arg){return arg=arg.replace(metaCharsRegExp,"^$1"),arg}function escapeArgument(arg,doubleEscapeMetaChars){return arg=`${arg}`,arg=arg.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),arg=arg.replace(/(?=(\\+?)?)\1$/,"$1$1"),arg=`"${arg}"`,arg=arg.replace(metaCharsRegExp,"^$1"),doubleEscapeMetaChars&&(arg=arg.replace(metaCharsRegExp,"^$1")),arg}module.exports.command=escapeCommand;module.exports.argument=escapeArgument}});var require_shebang_regex=__commonJS({"../../node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js"(exports,module){"use strict";module.exports=/^#!(.*)/}});var require_shebang_command=__commonJS({"../../node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js"(exports,module){"use strict";var shebangRegex=require_shebang_regex();module.exports=(string="")=>{let match=string.match(shebangRegex);if(!match)return null;let[path,argument]=match[0].replace(/#! ?/,"").split(" "),binary=path.split("/").pop();return binary==="env"?argument:argument?`${binary} ${argument}`:binary}}});var require_readShebang=__commonJS({"../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js"(exports,module){"use strict";var fs=__require("fs"),shebangCommand=require_shebang_command();function readShebang(command){let buffer=Buffer.alloc(150),fd;try{fd=fs.openSync(command,"r"),fs.readSync(fd,buffer,0,150,0),fs.closeSync(fd)}catch{}return shebangCommand(buffer.toString())}module.exports=readShebang}});var require_parse=__commonJS({"../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js"(exports,module){"use strict";var path=__require("path"),resolveCommand=require_resolveCommand(),escape=require_escape(),readShebang=require_readShebang(),isWin=process.platform==="win32",isExecutableRegExp=/\.(?:com|exe)$/i,isCmdShimRegExp=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function detectShebang(parsed){parsed.file=resolveCommand(parsed);let shebang=parsed.file&&readShebang(parsed.file);return shebang?(parsed.args.unshift(parsed.file),parsed.command=shebang,resolveCommand(parsed)):parsed.file}function parseNonShell(parsed){if(!isWin)return parsed;let commandFile=detectShebang(parsed),needsShell=!isExecutableRegExp.test(commandFile);if(parsed.options.forceShell||needsShell){let needsDoubleEscapeMetaChars=isCmdShimRegExp.test(commandFile);parsed.command=path.normalize(parsed.command),parsed.command=escape.command(parsed.command),parsed.args=parsed.args.map(arg=>escape.argument(arg,needsDoubleEscapeMetaChars));let shellCommand=[parsed.command].concat(parsed.args).join(" ");parsed.args=["/d","/s","/c",`"${shellCommand}"`],parsed.command=process.env.comspec||"cmd.exe",parsed.options.windowsVerbatimArguments=!0}return parsed}function parse(command,args,options){args&&!Array.isArray(args)&&(options=args,args=null),args=args?args.slice(0):[],options=Object.assign({},options);let parsed={command,args,options,file:void 0,original:{command,args}};return options.shell?parsed:parseNonShell(parsed)}module.exports=parse}});var require_enoent=__commonJS({"../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js"(exports,module){"use strict";var isWin=process.platform==="win32";function notFoundError(original,syscall){return Object.assign(new Error(`${syscall} ${original.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${syscall} ${original.command}`,path:original.command,spawnargs:original.args})}function hookChildProcess(cp,parsed){if(!isWin)return;let originalEmit=cp.emit;cp.emit=function(name,arg1){if(name==="exit"){let err=verifyENOENT(arg1,parsed);if(err)return originalEmit.call(cp,"error",err)}return originalEmit.apply(cp,arguments)}}function verifyENOENT(status,parsed){return isWin&&status===1&&!parsed.file?notFoundError(parsed.original,"spawn"):null}function verifyENOENTSync(status,parsed){return isWin&&status===1&&!parsed.file?notFoundError(parsed.original,"spawnSync"):null}module.exports={hookChildProcess,verifyENOENT,verifyENOENTSync,notFoundError}}});var require_cross_spawn=__commonJS({"../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js"(exports,module){"use strict";var cp=__require("child_process"),parse=require_parse(),enoent=require_enoent();function spawn(command,args,options){let parsed=parse(command,args,options),spawned=cp.spawn(parsed.command,parsed.args,parsed.options);return enoent.hookChildProcess(spawned,parsed),spawned}function spawnSync(command,args,options){let parsed=parse(command,args,options),result=cp.spawnSync(parsed.command,parsed.args,parsed.options);return result.error=result.error||enoent.verifyENOENTSync(result.status,parsed),result}module.exports=spawn;module.exports.spawn=spawn;module.exports.sync=spawnSync;module.exports._parse=parse;module.exports._enoent=enoent}});var require_strip_final_newline=__commonJS({"../../node_modules/.pnpm/strip-final-newline@2.0.0/node_modules/strip-final-newline/index.js"(exports,module){"use strict";module.exports=input=>{let LF=typeof input=="string"?`
|
|
8
8
|
`:`
|
|
9
9
|
`.charCodeAt(),CR=typeof input=="string"?"\r":"\r".charCodeAt();return input[input.length-1]===LF&&(input=input.slice(0,input.length-1)),input[input.length-1]===CR&&(input=input.slice(0,input.length-1)),input}}});var require_npm_run_path=__commonJS({"../../node_modules/.pnpm/npm-run-path@4.0.1/node_modules/npm-run-path/index.js"(exports,module){"use strict";var path=__require("path"),pathKey=require_path_key(),npmRunPath=options=>{options={cwd:process.cwd(),path:process.env[pathKey()],execPath:process.execPath,...options};let previous,cwdPath=path.resolve(options.cwd),result=[];for(;previous!==cwdPath;)result.push(path.join(cwdPath,"node_modules/.bin")),previous=cwdPath,cwdPath=path.resolve(cwdPath,"..");let execPathDir=path.resolve(options.cwd,options.execPath,"..");return result.push(execPathDir),result.concat(options.path).join(path.delimiter)};module.exports=npmRunPath;module.exports.default=npmRunPath;module.exports.env=options=>{options={env:process.env,...options};let env={...options.env},path2=pathKey({env});return options.path=env[path2],env[path2]=module.exports(options),env}}});var require_mimic_fn=__commonJS({"../../node_modules/.pnpm/mimic-fn@2.1.0/node_modules/mimic-fn/index.js"(exports,module){"use strict";var mimicFn=(to,from)=>{for(let prop of Reflect.ownKeys(from))Object.defineProperty(to,prop,Object.getOwnPropertyDescriptor(from,prop));return to};module.exports=mimicFn;module.exports.default=mimicFn}});var require_onetime=__commonJS({"../../node_modules/.pnpm/onetime@5.1.2/node_modules/onetime/index.js"(exports,module){"use strict";var mimicFn=require_mimic_fn(),calledFunctions=new WeakMap,onetime=(function_,options={})=>{if(typeof function_!="function")throw new TypeError("Expected a function");let returnValue,callCount=0,functionName=function_.displayName||function_.name||"<anonymous>",onetime2=function(...arguments_){if(calledFunctions.set(onetime2,++callCount),callCount===1)returnValue=function_.apply(this,arguments_),function_=null;else if(options.throw===!0)throw new Error(`Function \`${functionName}\` can only be called once`);return returnValue};return mimicFn(onetime2,function_),calledFunctions.set(onetime2,callCount),onetime2};module.exports=onetime;module.exports.default=onetime;module.exports.callCount=function_=>{if(!calledFunctions.has(function_))throw new Error(`The given function \`${function_.name}\` is not wrapped by the \`onetime\` package`);return calledFunctions.get(function_)}}});var require_is_stream=__commonJS({"../../node_modules/.pnpm/is-stream@2.0.1/node_modules/is-stream/index.js"(exports,module){"use strict";var isStream=stream=>stream!==null&&typeof stream=="object"&&typeof stream.pipe=="function";isStream.writable=stream=>isStream(stream)&&stream.writable!==!1&&typeof stream._write=="function"&&typeof stream._writableState=="object";isStream.readable=stream=>isStream(stream)&&stream.readable!==!1&&typeof stream._read=="function"&&typeof stream._readableState=="object";isStream.duplex=stream=>isStream.writable(stream)&&isStream.readable(stream);isStream.transform=stream=>isStream.duplex(stream)&&typeof stream._transform=="function";module.exports=isStream}});var require_merge_stream=__commonJS({"../../node_modules/.pnpm/merge-stream@2.0.0/node_modules/merge-stream/index.js"(exports,module){"use strict";var{PassThrough}=__require("stream");module.exports=function(){var sources=[],output=new PassThrough({objectMode:!0});return output.setMaxListeners(0),output.add=add,output.isEmpty=isEmpty,output.on("unpipe",remove),Array.prototype.slice.call(arguments).forEach(add),output;function add(source){return Array.isArray(source)?(source.forEach(add),this):(sources.push(source),source.once("end",remove.bind(null,source)),source.once("error",output.emit.bind(output,"error")),source.pipe(output,{end:!1}),this)}function isEmpty(){return sources.length==0}function remove(source){sources=sources.filter(function(it){return it!==source}),!sources.length&&output.readable&&output.end()}}}});export{require_cross_spawn,require_strip_final_newline,require_npm_run_path,require_onetime,require_is_stream,require_merge_stream};
|
|
@@ -4,4 +4,4 @@ import { dirname as __dirname_ } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
|
-
import{DEFAULT_ORDER_WAIT_MS,ORDER_READ_TIMING,getOrderOutcome,pollForOrder,remainingWait}from"./chunk-
|
|
7
|
+
import{DEFAULT_ORDER_WAIT_MS,ORDER_READ_TIMING,getOrderOutcome,pollForOrder,remainingWait}from"./chunk-UE6M2VKP.js";import{trackCreatedId}from"./chunk-MDWUJ7TA.js";import{getScope}from"./chunk-HG7NRFC5.js";import{sleep}from"./chunk-G7RQVFID.js";import{buildCommandWithGlobalFlags}from"./chunk-NVU7XTNI.js";import{DomainChargeOutcomeUnknown,DomainNotAvailable,DomainPaymentAuthenticationRequired,DomainPaymentError,DomainPriceChanged,DomainPurchaseInProgress,DomainPurchaseRefundFailed,DomainPurchaseRefunded,InvalidDomain,TLDNotSupportedViaCLI,UnexpectedDomainPurchaseError,UnsupportedTLD,isAPIError}from"./chunk-MTPHHAPR.js";import{output_manager_default}from"./chunk-RIXTYUYN.js";async function getDomainPrice(client,name){try{return await client.fetch(`/v1/registrar/domains/${name}/price`)}catch(err){if(isAPIError(err)){if(err.code==="tld_not_supported")return new UnsupportedTLD(name);if(err.status<500)return err}throw err}}async function getDomainStatus(client,domain){return client.fetch(`/v1/registrar/domains/${encodeURIComponent(domain)}/availability`)}var PURCHASE_TIMING={lostOrderReconcileMs:10*1e3},BOUGHT_AT_SKEW_MS=5*60*1e3;async function findPurchasedSince(client,name,since,{timeoutMs}={}){try{let{domain}=await client.fetch(`/v5/domains/${encodeURIComponent(name)}`,{bailOn429:!0,...timeoutMs!==void 0&&{retry:{retries:0},signal:AbortSignal.timeout(timeoutMs)}}),{boughtAt,expiresAt}=domain;return typeof boughtAt=="number"&&boughtAt>=since-BOUGHT_AT_SKEW_MS&&(typeof expiresAt!="number"||expiresAt>Date.now())?domain:null}catch{return null}}async function isPurchasedSince(client,name,since,opts={}){return await findPurchasedSince(client,name,since,opts)!==null}async function waitForPurchase(client,name,since,timeoutMs){let startTime=Date.now(),intervalMs=1e3,lookup=()=>findPurchasedSince(client,name,since,{timeoutMs:Math.max(timeoutMs-(Date.now()-startTime),1e3)});for(;Date.now()-startTime<timeoutMs;){let domain=await lookup();if(domain)return domain;await sleep(Math.min(intervalMs,timeoutMs-(Date.now()-startTime))),intervalMs=Math.min(intervalMs*2,5e3)}return lookup()}async function purchaseDomain(client,name,expectedPrice,years,autoRenew=!0,contactInformation,{waitMs=DEFAULT_ORDER_WAIT_MS,onOrderAccepted}={}){let{team}=await getScope(client),teamParam=team?`?teamId=${team.slug}`:"",startedAt=Date.now(),orderId;try{({orderId}=await client.fetch(`/v1/registrar/domains/${name}/buy${teamParam}`,{body:{expectedPrice,autoRenew,years,contactInformation},method:"POST",retry:{retries:0},bailOn429:!0}))}catch(err){if(isAPIError(err)&&err.status<500){if(err.code==="invalid_domain")return new InvalidDomain(name);if(err.code==="domain_not_available")return new DomainNotAvailable(name);if(err.code==="tld_not_supported")return new UnsupportedTLD(name);if(err.code==="additional_contact_info_required")return new TLDNotSupportedViaCLI(name);if(err.code==="expected_price_mismatch")return new DomainPriceChanged(name);if(err.code==="purchase_in_progress"){let otherOrderId=typeof err.orderId=="string"?err.orderId:void 0;return new DomainPurchaseInProgress(name,otherOrderId,otherOrderId&&buildCommandWithGlobalFlags(client.argv,`api /v1/registrar/orders/${otherOrderId}`))}throw err}let bought=await waitForPurchase(client,name,startedAt,PURCHASE_TIMING.lostOrderReconcileMs);return bought?(trackCreatedId(client,"domain",bought.id),{status:"completed",orderId:null}):new DomainChargeOutcomeUnknown(name,"buy")}trackCreatedId(client,"domain-order",orderId),onOrderAccepted?.(orderId);let ownedSince=since=>isPurchasedSince(client,name,since,{timeoutMs:Math.max(startedAt+waitMs+ORDER_READ_TIMING.minReadMs-Date.now(),1e3)});if(waitMs<=0)return{status:"pending",orderId,lastStatus:null};let poll=await pollForOrder(client,orderId,remainingWait(waitMs,startedAt));if(poll.order===null)return await ownedSince(startedAt)?{status:"completed",orderId}:{status:"pending",orderId,lastStatus:poll.lastStatus,...poll.readError&&{readError:poll.readError}};let outcome=getOrderOutcome(poll.order,name);switch(outcome){case"completed":return{status:"completed",orderId};case"payment_failed":return new DomainPaymentError;case"payment_authentication_required":return new DomainPaymentAuthenticationRequired(name,team?.slug);case"refund_failed":return new DomainPurchaseRefundFailed(name);case"refunded":case"failed":return await ownedSince(0)?{status:"already_owned",orderId,orderOutcome:outcome}:outcome==="refunded"?new DomainPurchaseRefunded(name):new UnexpectedDomainPurchaseError(name);case"unknown":return await ownedSince(startedAt)?{status:"completed",orderId}:new DomainChargeOutcomeUnknown(name,"buy",orderId)}}var CONTACT_FIELDS=[{field:"firstName",flag:"--first-name",label:"First name",prompt:"First name:",validate:val=>val.length>0||"First name is required"},{field:"lastName",flag:"--last-name",label:"Last name",prompt:"Last name:",validate:val=>val.length>0||"Last name is required"},{field:"email",flag:"--email",label:"Email",prompt:"Email:",validate:val=>val.length===0?"Email is required":/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(val)?!0:"Invalid email format"},{field:"phone",flag:"--phone",label:"Phone",prompt:"Phone (include country code, e.g., +15551234567):",validate:val=>val.length===0?"Phone is required":/^\+\d{10,15}$/.test(val)?!0:"Phone must start with + and contain 10-15 digits"},{field:"address1",flag:"--address",label:"Address",prompt:"Address:",validate:val=>val.length>0||"Address is required"},{field:"city",flag:"--city",label:"City",prompt:"City:",validate:val=>val.length>0||"City is required"},{field:"state",flag:"--state",label:"State",prompt:"State/Province:",validate:val=>val.length>0||"State/Province is required"},{field:"zip",flag:"--zip",label:"ZIP",prompt:"Postal/ZIP code:",validate:val=>val.length>0||"Postal/ZIP code is required"},{field:"country",flag:"--country",label:"Country",prompt:"Country code (2 letters, e.g., US):",validate:val=>val.length===0?"Country code is required":/^[A-Z]{2}$/i.test(val)?!0:"Country code must be 2 letters"},{field:"companyName",flag:"--company",label:"Company",prompt:"Company name (optional):"}],ADDRESS_FIELDS=new Set(["address1","city","state","zip","country"]);function readContactFlags(flags){let contact={};for(let{field,flag,validate}of CONTACT_FIELDS){let raw=flags[flag];if(typeof raw!="string")continue;let value=raw.trim(),result=validate?validate(value):!0;if(result!==!0)return`Invalid ${flag}. ${result}.`;contact[field]=field==="country"?value.toUpperCase():value}return contact}function getBillingContact(team){let billing=team?.billing;if(!billing)return{};let address=billing.address,line1=address?.line1?.trim(),line2=address?.line2?.trim(),country=address?.country?.trim().toUpperCase(),rawState=address?.state?.trim(),state=country&&rawState?.toUpperCase().startsWith(`${country}-`)?rawState.slice(country.length+1):rawState,candidates={email:billing.email,address1:line1&&line2?`${line1}, ${line2}`:line1,city:address?.city,state:country==="US"&&!/^[A-Z]{2}$/i.test(state??"")?"":state,zip:address?.postalCode,country},contact={};for(let{field,validate}of CONTACT_FIELDS){let value=candidates[field]?.trim();value&&(!validate||validate(value)===!0)&&(contact[field]=value)}return contact}function mergeContact(fromFlags,billing){let ownAddress=[...ADDRESS_FIELDS].some(field=>fromFlags[field]!==void 0&&billing[field]!==void 0),merged={};for(let{field}of CONTACT_FIELDS){let fallback=ownAddress&&ADDRESS_FIELDS.has(field)?void 0:billing[field],value=fromFlags[field]??fallback;value!==void 0&&(merged[field]=value)}return merged}function billingFieldsUsed(fromFlags,billing){let merged=mergeContact(fromFlags,billing),used={};for(let{field}of CONTACT_FIELDS)fromFlags[field]===void 0&&merged[field]!==void 0&&(used[field]=merged[field]);return used}function missingContactFields(contact){return CONTACT_FIELDS.filter(({field,validate})=>validate&&!contact[field]).map(({field})=>field)}async function collectContactInformation(client,{provided={},defaults={}}={}){let contact={...provided},pending=CONTACT_FIELDS.filter(({field})=>!(field in provided));pending.length>0&&(output_manager_default.log(""),output_manager_default.log("Please provide contact information for domain registration:"));for(let{field,prompt,validate}of pending){let value=await client.input.text({message:prompt,default:defaults[field],validate});value&&(contact[field]=value)}return{...contact,country:contact.country.toUpperCase(),companyName:contact.companyName||void 0}}export{getDomainPrice,getDomainStatus,isPurchasedSince,purchaseDomain,CONTACT_FIELDS,readContactFlags,getBillingContact,mergeContact,billingFieldsUsed,missingContactFields,collectContactInformation};
|
|
@@ -4,7 +4,7 @@ import { dirname as __dirname_ } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
|
-
import{require_signal_exit}from"./chunk-
|
|
7
|
+
import{require_signal_exit}from"./chunk-7Y572CPZ.js";import{require_dist}from"./chunk-4SIQE2W4.js";import{require_ansi_escapes}from"./chunk-MF43WTDT.js";import{chars_default}from"./chunk-2BKALEOP.js";import{require_source}from"./chunk-UJ7YUIEJ.js";import{require_has_flag,require_supports_color}from"./chunk-L6MWUMWZ.js";import{require_string_width}from"./chunk-YHZXIBS7.js";import{require_strip_ansi}from"./chunk-LPYHYTYI.js";import{__commonJS,__esm,__export,__toESM}from"./chunk-NBPLUP7C.js";var dist_exports={};__export(dist_exports,{Diagnostic:()=>Diagnostic,createConsoleReporter:()=>createConsoleReporter,defineDiagnostics:()=>defineDiagnostics,defineProdDiagnostics:()=>defineProdDiagnostics,formatDiagnostic:()=>formatDiagnostic});function formatDiagnostic(diagnostic){let header=`[${diagnostic.name}] ${diagnostic.message}`,details=[];return diagnostic.fix&&details.push(`fix: ${diagnostic.fix}`),diagnostic.sources?.length&&details.push(`sources: ${diagnostic.sources.join(", ")}`),diagnostic.docs&&details.push(`see: ${diagnostic.docs}`),details.length===0?header:[header,...details.map((detail,i)=>`${i<details.length-1?"\u251C\u25B6":"\u2570\u25B6"} ${detail}`)].join(`
|
|
8
8
|
`)}function toValueWithArgs(valFn,...args){return typeof valFn=="function"?valFn(...args):valFn}function createConsoleReporter({method:defaultMethod="warn",formatter=formatDiagnostic}={}){return(diagnostic,{method=defaultMethod}={})=>{console[method](formatter(diagnostic))}}function deriveDocs(docsBase,code){return typeof docsBase=="string"?`${docsBase}/${code.toLowerCase()}`:docsBase?.(code)}function defineDiagnostics(options){let reporters=options.reporters??[],result={},{docsBase}=options;for(let code of Object.keys(options.codes)){let def=options.codes[code],docs=def.docs===!1?void 0:def.docs||deriveDocs(docsBase,code),handle=(params={},reporterOptions={})=>{let diagnostic=new Diagnostic({why:toValueWithArgs(def.why,params),fix:toValueWithArgs(def.fix,params),docs,cause:params.cause,sources:params.sources},handle);diagnostic.name=code;for(let reporter of reporters)reporter(diagnostic,reporterOptions);return diagnostic};result[code]=handle}return result}function defineProdDiagnostics(options={}){let{docsBase,reporters=[]}=options;return new Proxy({},{get(_target,code){if(typeof code!="string")return;let handle=(params={},reporterOptions={})=>{let diagnostic=new Diagnostic({why:code,docs:deriveDocs(docsBase,code),cause:params.cause,sources:params.sources},handle);diagnostic.name=code;for(let reporter of reporters)reporter(diagnostic,reporterOptions);return diagnostic};return handle}})}var captureStackTrace,Diagnostic,init_dist=__esm({"../../node_modules/.pnpm/nostics@1.1.4/node_modules/nostics/dist/index.mjs"(){captureStackTrace=Error.captureStackTrace,Diagnostic=class Diagnostic2 extends Error{name="Diagnostic";docs;fix;sources;get why(){return this.message}constructor(init,captureFrom=Diagnostic2){super(init.why,{cause:init.cause}),this.fix=init.fix,this.docs=init.docs,this.sources=init.sources,captureStackTrace?.(this,captureFrom)}toJSON(){return{name:this.name,why:this.why,fix:this.fix,docs:this.docs,sources:this.sources,cause:this.cause,stack:this.stack}}}}});var require_supports_hyperlinks=__commonJS({"../../node_modules/.pnpm/supports-hyperlinks@3.0.0/node_modules/supports-hyperlinks/index.js"(exports,module){"use strict";var supportsColor=require_supports_color(),hasFlag=require_has_flag();function parseVersion(versionString){if(/^\d{3,4}$/.test(versionString)){let m=/(\d{1,2})(\d{2})/.exec(versionString)||[];return{major:0,minor:parseInt(m[1],10),patch:parseInt(m[2],10)}}let versions=(versionString||"").split(".").map(n=>parseInt(n,10));return{major:versions[0],minor:versions[1],patch:versions[2]}}function supportsHyperlink(stream){let{CI,FORCE_HYPERLINK,NETLIFY,TEAMCITY_VERSION,TERM_PROGRAM,TERM_PROGRAM_VERSION,VTE_VERSION}=process.env;if(FORCE_HYPERLINK)return!(FORCE_HYPERLINK.length>0&&parseInt(FORCE_HYPERLINK,10)===0);if(hasFlag("no-hyperlink")||hasFlag("no-hyperlinks")||hasFlag("hyperlink=false")||hasFlag("hyperlink=never"))return!1;if(hasFlag("hyperlink=true")||hasFlag("hyperlink=always")||NETLIFY)return!0;if(!supportsColor.supportsColor(stream)||stream&&!stream.isTTY||process.platform==="win32"||CI||TEAMCITY_VERSION)return!1;if(TERM_PROGRAM){let version=parseVersion(TERM_PROGRAM_VERSION||"");switch(TERM_PROGRAM){case"iTerm.app":return version.major===3?version.minor>=1:version.major>3;case"WezTerm":return version.major>=20200620;case"vscode":return version.major>1||version.major===1&&version.minor>=72}}if(VTE_VERSION){if(VTE_VERSION==="0.50.0")return!1;let version=parseVersion(VTE_VERSION);return version.major>0||version.minor>=50}return!1}module.exports={supportsHyperlink,stdout:supportsHyperlink(process.stdout),stderr:supportsHyperlink(process.stderr)}}});var import_chalk=__toESM(require_source(),1),link=import_chalk.default.cyan.underline,link_default=link;var import_ansi_escapes=__toESM(require_ansi_escapes(),1);function eraseLines(numberOfLines){return import_ansi_escapes.default.eraseLines(numberOfLines)}var emojiLabels={notice:"\u{1F4DD}",tip:"\u{1F4A1}",warning:"\u2757\uFE0F",link:"\u{1F517}",inspect:"\u{1F50D}",success:"\u2705",locked:"\u{1F512}",loading:"\u23F3"},stripEmojiRegex=new RegExp(Object.values(emojiLabels).join("|"),"gi");function emoji(label){return emojiLabels[label]}function prependEmoji(message,emoji2){return emoji2&&process.stdout.isTTY?`${emoji2} ${message}`:message}function removeEmoji(message){let result=message.replace(stripEmojiRegex,"");return result.startsWith(`
|
|
9
9
|
`)?result:result.trimStart()}init_dist();var UNCLASSIFIED_ERROR_CODE="UNCLASSIFIED_ERROR",MAX_SCANNED_OUTPUT_LENGTH=64*1024,recorded;function stringProperty(value,key){if(typeof value=="object"&&value!==null&&key in value){let property=value[key];if(typeof property=="string")return property}}function numberProperty(value,key){if(typeof value=="object"&&value!==null&&key in value){let property=value[key];if(typeof property=="number")return property}}function cliErrorFromUnknown(err,{includeMessage=!1}={}){let code=err instanceof Diagnostic&&err.name!=="Diagnostic"?err.name:stringProperty(err,"code");return{status:numberProperty(err,"status"),code:code??(err instanceof Error&&err.name!=="Error"&&err.name!=="Diagnostic"?err.name:void 0),slug:stringProperty(err,"slug"),action:stringProperty(err,"action"),serverMessage:includeMessage?stringProperty(err,"serverMessage")??stringProperty(err,"message"):void 0}}function recordCliError(details,{override=!1}={}){recorded&&!override&&(recorded.code||!details.code)||(recorded=details)}function recordCliErrorFromOutput(chunk){if(typeof chunk!="string"||chunk.length>MAX_SCANNED_OUTPUT_LENGTH||!chunk.includes('"reason"'))return;let text=chunk.trim();if(!text.startsWith("{"))return;let payload;try{payload=JSON.parse(text)}catch{return}let status=stringProperty(payload,"status"),reason=stringProperty(payload,"reason");(status==="error"||status==="action_required")&&reason&&recordCliError({code:reason})}function peekCliError(){return recorded}function takeCliError(){let details=recorded;return recorded=void 0,details}var import_chalk3=__toESM(require_source(),1),ansiEscapes2=__toESM(require_ansi_escapes(),1),import_supports_hyperlinks=__toESM(require_supports_hyperlinks(),1);var import_chalk2=__toESM(require_source(),1),import_signal_exit=__toESM(require_signal_exit(),1),import_string_width=__toESM(require_string_width(),1),import_strip_ansi=__toESM(require_strip_ansi(),1);var SPINNER=process.platform==="win32"?{frames:["-","\\","|","/"],interval:130}:{frames:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],interval:80},BEGIN_SYNC="\x1B[?2026h",END_SYNC="\x1B[?2026l",HIDE_CURSOR="\x1B[?25l",SHOW_CURSOR="\x1B[?25h",SAVE_CURSOR="\x1B7",RESTORE_CURSOR="\x1B8";function sync(data){return BEGIN_SYNC+data+END_SYNC}function countRows(line,columns){return(0,import_strip_ansi.default)(line).split(`
|
|
10
10
|
`).reduce((rows,part)=>rows+Math.max(1,Math.ceil((0,import_string_width.default)(part)/columns)),0)}var Spinner=class{constructor(text,stream){this.frameIndex=0;this.interval=null;this.removeExitHandler=null;this.renderedText=null;this.renderedColumns=0;this.renderedRows=0;this.text=text,this.stream=stream}setText(text){this.text=text}start(){this.removeExitHandler=(0,import_signal_exit.default)(()=>{this.stream.write(SHOW_CURSOR)}),this.stream.write(HIDE_CURSOR),this.render(),this.interval=setInterval(()=>this.render(),SPINNER.interval)}stop(){this.interval&&(clearInterval(this.interval),this.interval=null),this.removeExitHandler?.(),this.removeExitHandler=null,this.stream.write(sync(this.erase())+SHOW_CURSOR)}render(){let glyph=import_chalk2.default.gray(SPINNER.frames[this.frameIndex]);this.frameIndex=(this.frameIndex+1)%SPINNER.frames.length;let columns=this.stream.columns||80;if(this.text===this.renderedText&&columns===this.renderedColumns){let up=this.renderedRows-1;this.stream.write(sync(SAVE_CURSOR+(up>0?`\x1B[${up}A`:"")+"\r"+glyph+RESTORE_CURSOR));return}let line=`${glyph} ${import_chalk2.default.gray(this.text)}`;this.stream.write(sync(this.erase()+line)),this.renderedText=this.text,this.renderedColumns=columns,this.renderedRows=countRows(line,columns)}erase(){let rows=this.renderedRows;return this.renderedText=null,this.renderedRows=0,rows>0?eraseLines(rows):""}};function wait(opts,delay=300){let text=opts.text,stream=opts.stream??process.stderr,spinner=null;if(typeof text!="string")throw new Error('"text" is required for spinner');let timeout=setTimeout(()=>{if(!stream.isTTY||process.env.CI){stream.write(`- ${text}
|
|
@@ -4,7 +4,7 @@ import { dirname as __dirname_ } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
|
-
import{require_balanced_match}from"./chunk-
|
|
7
|
+
import{require_balanced_match}from"./chunk-GUFRGEM5.js";import{__commonJS}from"./chunk-NBPLUP7C.js";var require_path=__commonJS({"../../node_modules/.pnpm/minimatch@5.0.1/node_modules/minimatch/lib/path.js"(exports,module){var isWindows=typeof process=="object"&&process&&process.platform==="win32";module.exports=isWindows?{sep:"\\"}:{sep:"/"}}});var require_brace_expansion=__commonJS({"../../node_modules/.pnpm/brace-expansion@2.1.1/node_modules/brace-expansion/index.js"(exports,module){var balanced=require_balanced_match();module.exports=expandTop;var escSlash="\0SLASH"+Math.random()+"\0",escOpen="\0OPEN"+Math.random()+"\0",escClose="\0CLOSE"+Math.random()+"\0",escComma="\0COMMA"+Math.random()+"\0",escPeriod="\0PERIOD"+Math.random()+"\0";function numeric(str){return parseInt(str,10)==str?parseInt(str,10):str.charCodeAt(0)}function escapeBraces(str){return str.split("\\\\").join(escSlash).split("\\{").join(escOpen).split("\\}").join(escClose).split("\\,").join(escComma).split("\\.").join(escPeriod)}function unescapeBraces(str){return str.split(escSlash).join("\\").split(escOpen).join("{").split(escClose).join("}").split(escComma).join(",").split(escPeriod).join(".")}function parseCommaParts(str){if(!str)return[""];var parts=[],m=balanced("{","}",str);if(!m)return str.split(",");var pre=m.pre,body=m.body,post=m.post,p=pre.split(",");p[p.length-1]+="{"+body+"}";var postParts=parseCommaParts(post);return post.length&&(p[p.length-1]+=postParts.shift(),p.push.apply(p,postParts)),parts.push.apply(parts,p),parts}function expandTop(str,options){if(!str)return[];options=options||{};var max=options.max==null?1/0:options.max;return str.substr(0,2)==="{}"&&(str="\\{\\}"+str.substr(2)),expand(escapeBraces(str),max,!0).map(unescapeBraces)}function embrace(str){return"{"+str+"}"}function isPadded(el){return/^-?0\d/.test(el)}function lte(i,y){return i<=y}function gte(i,y){return i>=y}function expand(str,max,isTop){var expansions=[],m=balanced("{","}",str);if(!m)return[str];var pre=m.pre,post=m.post.length?expand(m.post,max,!1):[""];if(/\$$/.test(m.pre))for(var k=0;k<post.length&&k<max;k++){var expansion=pre+"{"+m.body+"}"+post[k];expansions.push(expansion)}else{var isNumericSequence=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body),isAlphaSequence=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body),isSequence=isNumericSequence||isAlphaSequence,isOptions=m.body.indexOf(",")>=0;if(!isSequence&&!isOptions)return m.post.match(/,(?!,).*\}/)?(str=m.pre+"{"+m.body+escClose+m.post,expand(str,max,!0)):[str];var n;if(isSequence)n=m.body.split(/\.\./);else if(n=parseCommaParts(m.body),n.length===1&&(n=expand(n[0],max,!1).map(embrace),n.length===1))return post.map(function(p){return m.pre+n[0]+p});var N;if(isSequence){var x=numeric(n[0]),y=numeric(n[1]),width=Math.max(n[0].length,n[1].length),incr=n.length==3?Math.max(Math.abs(numeric(n[2])),1):1,test=lte,reverse=y<x;reverse&&(incr*=-1,test=gte);var pad=n.some(isPadded);N=[];for(var i=x;test(i,y)&&N.length<max;i+=incr){var c;if(isAlphaSequence)c=String.fromCharCode(i),c==="\\"&&(c="");else if(c=String(i),pad){var need=width-c.length;if(need>0){var z=new Array(need+1).join("0");i<0?c="-"+z+c.slice(1):c=z+c}}N.push(c)}}else{N=[];for(var j=0;j<n.length;j++)N.push.apply(N,expand(n[j],max,!1))}for(var j=0;j<N.length;j++)for(var k=0;k<post.length&&expansions.length<max;k++){var expansion=pre+N[j]+post[k];(!isTop||isSequence||expansion)&&expansions.push(expansion)}}return expansions}}});var require_minimatch=__commonJS({"../../node_modules/.pnpm/minimatch@5.0.1/node_modules/minimatch/minimatch.js"(exports,module){var minimatch=module.exports=(p,pattern,options={})=>(assertValidPattern(pattern),!options.nocomment&&pattern.charAt(0)==="#"?!1:new Minimatch(pattern,options).match(p));module.exports=minimatch;var path=require_path();minimatch.sep=path.sep;var GLOBSTAR=Symbol("globstar **");minimatch.GLOBSTAR=GLOBSTAR;var expand=require_brace_expansion(),plTypes={"!":{open:"(?:(?!(?:",close:"))[^/]*?)"},"?":{open:"(?:",close:")?"},"+":{open:"(?:",close:")+"},"*":{open:"(?:",close:")*"},"@":{open:"(?:",close:")"}},qmark="[^/]",star=qmark+"*?",twoStarDot="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",twoStarNoDot="(?:(?!(?:\\/|^)\\.).)*?",charSet=s=>s.split("").reduce((set,c)=>(set[c]=!0,set),{}),reSpecials=charSet("().*{}+?[]^$\\!"),addPatternStartSet=charSet("[.("),slashSplit=/\/+/;minimatch.filter=(pattern,options={})=>(p,i,list)=>minimatch(p,pattern,options);var ext=(a,b={})=>{let t={};return Object.keys(a).forEach(k=>t[k]=a[k]),Object.keys(b).forEach(k=>t[k]=b[k]),t};minimatch.defaults=def=>{if(!def||typeof def!="object"||!Object.keys(def).length)return minimatch;let orig=minimatch,m=(p,pattern,options)=>orig(p,pattern,ext(def,options));return m.Minimatch=class extends orig.Minimatch{constructor(pattern,options){super(pattern,ext(def,options))}},m.Minimatch.defaults=options=>orig.defaults(ext(def,options)).Minimatch,m.filter=(pattern,options)=>orig.filter(pattern,ext(def,options)),m.defaults=options=>orig.defaults(ext(def,options)),m.makeRe=(pattern,options)=>orig.makeRe(pattern,ext(def,options)),m.braceExpand=(pattern,options)=>orig.braceExpand(pattern,ext(def,options)),m.match=(list,pattern,options)=>orig.match(list,pattern,ext(def,options)),m};minimatch.braceExpand=(pattern,options)=>braceExpand(pattern,options);var braceExpand=(pattern,options={})=>(assertValidPattern(pattern),options.nobrace||!/\{(?:(?!\{).)*\}/.test(pattern)?[pattern]:expand(pattern)),MAX_PATTERN_LENGTH=1024*64,assertValidPattern=pattern=>{if(typeof pattern!="string")throw new TypeError("invalid pattern");if(pattern.length>MAX_PATTERN_LENGTH)throw new TypeError("pattern is too long")},SUBPARSE=Symbol("subparse");minimatch.makeRe=(pattern,options)=>new Minimatch(pattern,options||{}).makeRe();minimatch.match=(list,pattern,options={})=>{let mm=new Minimatch(pattern,options);return list=list.filter(f=>mm.match(f)),mm.options.nonull&&!list.length&&list.push(pattern),list};var globUnescape=s=>s.replace(/\\(.)/g,"$1"),regExpEscape=s=>s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Minimatch=class{constructor(pattern,options){assertValidPattern(pattern),options||(options={}),this.options=options,this.set=[],this.pattern=pattern,this.regexp=null,this.negate=!1,this.comment=!1,this.empty=!1,this.partial=!!options.partial,this.make()}debug(){}make(){let pattern=this.pattern,options=this.options;if(!options.nocomment&&pattern.charAt(0)==="#"){this.comment=!0;return}if(!pattern){this.empty=!0;return}this.parseNegate();let set=this.globSet=this.braceExpand();options.debug&&(this.debug=(...args)=>console.error(...args)),this.debug(this.pattern,set),set=this.globParts=set.map(s=>s.split(slashSplit)),this.debug(this.pattern,set),set=set.map((s,si,set2)=>s.map(this.parse,this)),this.debug(this.pattern,set),set=set.filter(s=>s.indexOf(!1)===-1),this.debug(this.pattern,set),this.set=set}parseNegate(){if(this.options.nonegate)return;let pattern=this.pattern,negate=!1,negateOffset=0;for(let i=0;i<pattern.length&&pattern.charAt(i)==="!";i++)negate=!negate,negateOffset++;negateOffset&&(this.pattern=pattern.substr(negateOffset)),this.negate=negate}matchOne(file,pattern,partial){var options=this.options;this.debug("matchOne",{this:this,file,pattern}),this.debug("matchOne",file.length,pattern.length);for(var fi=0,pi=0,fl=file.length,pl=pattern.length;fi<fl&&pi<pl;fi++,pi++){this.debug("matchOne loop");var p=pattern[pi],f=file[fi];if(this.debug(pattern,p,f),p===!1)return!1;if(p===GLOBSTAR){this.debug("GLOBSTAR",[pattern,p,f]);var fr=fi,pr=pi+1;if(pr===pl){for(this.debug("** at the end");fi<fl;fi++)if(file[fi]==="."||file[fi]===".."||!options.dot&&file[fi].charAt(0)===".")return!1;return!0}for(;fr<fl;){var swallowee=file[fr];if(this.debug(`
|
|
8
8
|
globstar while`,file,fr,pattern,pr,swallowee),this.matchOne(file.slice(fr),pattern.slice(pr),partial))return this.debug("globstar found match!",fr,fl,swallowee),!0;if(swallowee==="."||swallowee===".."||!options.dot&&swallowee.charAt(0)==="."){this.debug("dot detected!",file,fr,pattern,pr);break}this.debug("globstar swallow a segment, and continue"),fr++}return!!(partial&&(this.debug(`
|
|
9
9
|
>>> no match, partial?`,file,fr,pattern,pr),fr===fl))}var hit;if(typeof p=="string"?(hit=f===p,this.debug("string match",p,f,hit)):(hit=f.match(p),this.debug("pattern match",p,f,hit)),!hit)return!1}if(fi===fl&&pi===pl)return!0;if(fi===fl)return partial;if(pi===pl)return fi===fl-1&&file[fi]==="";throw new Error("wtf?")}braceExpand(){return braceExpand(this.pattern,this.options)}parse(pattern,isSub){assertValidPattern(pattern);let options=this.options;if(pattern==="**")if(options.noglobstar)pattern="*";else return GLOBSTAR;if(pattern==="")return"";let re="",hasMagic=!!options.nocase,escaping=!1,patternListStack=[],negativeLists=[],stateChar,inClass=!1,reClassStart=-1,classStart=-1,cs,pl,sp,patternStart=pattern.charAt(0)==="."?"":options.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",clearStateChar=()=>{if(stateChar){switch(stateChar){case"*":re+=star,hasMagic=!0;break;case"?":re+=qmark,hasMagic=!0;break;default:re+="\\"+stateChar;break}this.debug("clearStateChar %j %j",stateChar,re),stateChar=!1}};for(let i=0,c;i<pattern.length&&(c=pattern.charAt(i));i++){if(this.debug("%s %s %s %j",pattern,i,re,c),escaping){if(c==="/")return!1;reSpecials[c]&&(re+="\\"),re+=c,escaping=!1;continue}switch(c){case"/":return!1;case"\\":clearStateChar(),escaping=!0;continue;case"?":case"*":case"+":case"@":case"!":if(this.debug("%s %s %s %j <-- stateChar",pattern,i,re,c),inClass){this.debug(" in class"),c==="!"&&i===classStart+1&&(c="^"),re+=c;continue}this.debug("call clearStateChar %j",stateChar),clearStateChar(),stateChar=c,options.noext&&clearStateChar();continue;case"(":if(inClass){re+="(";continue}if(!stateChar){re+="\\(";continue}patternListStack.push({type:stateChar,start:i-1,reStart:re.length,open:plTypes[stateChar].open,close:plTypes[stateChar].close}),re+=stateChar==="!"?"(?:(?!(?:":"(?:",this.debug("plType %j %j",stateChar,re),stateChar=!1;continue;case")":if(inClass||!patternListStack.length){re+="\\)";continue}clearStateChar(),hasMagic=!0,pl=patternListStack.pop(),re+=pl.close,pl.type==="!"&&negativeLists.push(pl),pl.reEnd=re.length;continue;case"|":if(inClass||!patternListStack.length){re+="\\|";continue}clearStateChar(),re+="|";continue;case"[":if(clearStateChar(),inClass){re+="\\"+c;continue}inClass=!0,classStart=i,reClassStart=re.length,re+=c;continue;case"]":if(i===classStart+1||!inClass){re+="\\"+c;continue}cs=pattern.substring(classStart+1,i);try{RegExp("["+cs+"]")}catch{sp=this.parse(cs,SUBPARSE),re=re.substr(0,reClassStart)+"\\["+sp[0]+"\\]",hasMagic=hasMagic||sp[1],inClass=!1;continue}hasMagic=!0,inClass=!1,re+=c;continue;default:clearStateChar(),reSpecials[c]&&!(c==="^"&&inClass)&&(re+="\\"),re+=c;break}}for(inClass&&(cs=pattern.substr(classStart+1),sp=this.parse(cs,SUBPARSE),re=re.substr(0,reClassStart)+"\\["+sp[0],hasMagic=hasMagic||sp[1]),pl=patternListStack.pop();pl;pl=patternListStack.pop()){let tail;tail=re.slice(pl.reStart+pl.open.length),this.debug("setting tail",re,pl),tail=tail.replace(/((?:\\{2}){0,64})(\\?)\|/g,(_,$1,$2)=>($2||($2="\\"),$1+$1+$2+"|")),this.debug(`tail=%j
|
|
10
10
|
%s`,tail,tail,pl,re);let t=pl.type==="*"?star:pl.type==="?"?qmark:"\\"+pl.type;hasMagic=!0,re=re.slice(0,pl.reStart)+t+"\\("+tail}clearStateChar(),escaping&&(re+="\\\\");let addPatternStart=addPatternStartSet[re.charAt(0)];for(let n=negativeLists.length-1;n>-1;n--){let nl=negativeLists[n],nlBefore=re.slice(0,nl.reStart),nlFirst=re.slice(nl.reStart,nl.reEnd-8),nlAfter=re.slice(nl.reEnd),nlLast=re.slice(nl.reEnd-8,nl.reEnd)+nlAfter,openParensBefore=nlBefore.split("(").length-1,cleanAfter=nlAfter;for(let i=0;i<openParensBefore;i++)cleanAfter=cleanAfter.replace(/\)[+*?]?/,"");nlAfter=cleanAfter;let dollar=nlAfter===""&&isSub!==SUBPARSE?"$":"";re=nlBefore+nlFirst+nlAfter+dollar+nlLast}if(re!==""&&hasMagic&&(re="(?=.)"+re),addPatternStart&&(re=patternStart+re),isSub===SUBPARSE)return[re,hasMagic];if(!hasMagic)return globUnescape(pattern);let flags=options.nocase?"i":"";try{return Object.assign(new RegExp("^"+re+"$",flags),{_glob:pattern,_src:re})}catch{return new RegExp("$.")}}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let set=this.set;if(!set.length)return this.regexp=!1,this.regexp;let options=this.options,twoStar=options.noglobstar?star:options.dot?twoStarDot:twoStarNoDot,flags=options.nocase?"i":"",re=set.map(pattern=>(pattern=pattern.map(p=>typeof p=="string"?regExpEscape(p):p===GLOBSTAR?GLOBSTAR:p._src).reduce((set2,p)=>(set2[set2.length-1]===GLOBSTAR&&p===GLOBSTAR||set2.push(p),set2),[]),pattern.forEach((p,i)=>{p!==GLOBSTAR||pattern[i-1]===GLOBSTAR||(i===0?pattern.length>1?pattern[i+1]="(?:\\/|"+twoStar+"\\/)?"+pattern[i+1]:pattern[i]=twoStar:i===pattern.length-1?pattern[i-1]+="(?:\\/|"+twoStar+")?":(pattern[i-1]+="(?:\\/|\\/"+twoStar+"\\/)"+pattern[i+1],pattern[i+1]=GLOBSTAR))}),pattern.filter(p=>p!==GLOBSTAR).join("/"))).join("|");re="^(?:"+re+")$",this.negate&&(re="^(?!"+re+").*$");try{this.regexp=new RegExp(re,flags)}catch{this.regexp=!1}return this.regexp}match(f,partial=this.partial){if(this.debug("match",f,this.pattern),this.comment)return!1;if(this.empty)return f==="";if(f==="/"&&partial)return!0;let options=this.options;path.sep!=="/"&&(f=f.split(path.sep).join("/")),f=f.split(slashSplit),this.debug(this.pattern,"split",f);let set=this.set;this.debug(this.pattern,"set",set);let filename;for(let i=f.length-1;i>=0&&(filename=f[i],!filename);i--);for(let i=0;i<set.length;i++){let pattern=set[i],file=f;if(options.matchBase&&pattern.length===1&&(file=[filename]),this.matchOne(file,pattern,partial))return options.flipNegate?!0:!this.negate}return options.flipNegate?!1:this.negate}static defaults(def){return minimatch.defaults(def).Minimatch}};minimatch.Minimatch=Minimatch}});export{require_minimatch};
|
|
@@ -4,6 +4,6 @@ import { dirname as __dirname_ } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
|
-
import{RULE_ENVIRONMENTS}from"./chunk-
|
|
7
|
+
import{RULE_ENVIRONMENTS}from"./chunk-6SX4TE7Y.js";import{AGENT_STATUS}from"./chunk-NVU7XTNI.js";import{warnDeprecatedInput}from"./chunk-IR3E37HD.js";function writeConfigJson(client,{project,bare,envelope,message,next}){if(!client.nonInteractive){client.stdout.write(`${JSON.stringify(bare,null,2)}
|
|
8
8
|
`);return}client.stdout.write(`${JSON.stringify({status:AGENT_STATUS.OK,projectId:project.id,projectName:project.name,...envelope,message,next},null,2)}
|
|
9
9
|
`)}var RULE_LIMIT=10,MIN_SAMPLE_RATE=1,MAX_SAMPLE_RATE=100;function isRuleEnvironment(value){return RULE_ENVIRONMENTS.includes(value)}var ENVIRONMENT_ERROR=`\`environment\` must be one of: ${RULE_ENVIRONMENTS.join(", ")}.`,RATE_ERROR=`\`rate\` must be a whole number from ${MIN_SAMPLE_RATE} to ${MAX_SAMPLE_RATE}.`,EMPTY_PATH_ERROR="`requestPath` cannot be empty.";function parseSampleRate(value){if(!/^\d+$/.test(value.trim()))return;let rate=Number(value);return rate>=MIN_SAMPLE_RATE&&rate<=MAX_SAMPLE_RATE?rate:void 0}function toRow(rule){return{environment:rule.env??"any",requestPath:rule.requestPath??null,sampleRate:Math.round(rule.rate*100)}}function toApiRate(sampleRate){return sampleRate/100}function toRule(row){return{type:"head_sampling",rate:toApiRate(row.sampleRate),...row.environment==="any"?{}:{env:row.environment},...row.requestPath===null?{}:{requestPath:row.requestPath}}}var ALL_PATHS_LABEL="(all paths)";function formatPath(requestPath){return requestPath??ALL_PATHS_LABEL}function formatRate(sampleRate){return`${sampleRate}%`}function formatRuleTarget(environment,requestPath){return`${environment} ${formatPath(requestPath)}`}function formatRuleLine(row){return`${formatRuleTarget(row.environment,row.requestPath)} ${formatRate(row.sampleRate)}`}var COMMAND_WORD_COUNT=3;function subcommandArguments(positional){return positional.slice(COMMAND_WORD_COUNT)}function resolveRuleEnvironment(client,environmentFlag,args){if(environmentFlag===void 0){let[environment,...rest]=args;return environment!==void 0&&isRuleEnvironment(environment)?(warnDeprecatedInput(client,"The environment argument","--environment"),{environment,args:rest}):{environment:void 0,args}}return args[0]!==void 0&&isRuleEnvironment(args[0])?{error:"Can't use an environment argument with --environment. Use --environment."}:{environment:environmentFlag,args}}function hasSameKey(a,b){return a.environment===b.environment&&a.requestPath===b.requestPath}async function readTracingConfig({client,teamId,projectId,projectName}){let config=await client.fetch(`/v1/drains/tracing/config?${new URLSearchParams({projectId})}`,{accountId:teamId}),sampling=config.enabled&&config.sampling.length===0?[{type:"head_sampling",rate:1}]:config.sampling;return{project:{id:projectId,name:projectName},enabled:config.enabled,entries:sampling.map(rule=>({rule,row:toRow(rule)}))}}async function writeSamplingRules({client,teamId,projectId,rules}){await client.fetch(`/v1/drains/tracing/config?${new URLSearchParams({projectId})}`,{accountId:teamId,method:"PUT",body:{enabled:rules.length>0,...rules.length>0?{sampling:rules}:{}}})}export{writeConfigJson,RULE_LIMIT,isRuleEnvironment,ENVIRONMENT_ERROR,RATE_ERROR,EMPTY_PATH_ERROR,parseSampleRate,toApiRate,toRule,formatPath,formatRate,formatRuleTarget,formatRuleLine,subcommandArguments,resolveRuleEnvironment,hasSameKey,readTracingConfig,writeSamplingRules};
|