cf 0.6.0 → 0.7.0

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.
Files changed (299) hide show
  1. package/dist/_meta/agent-context.json +78 -41
  2. package/dist/_meta/commands.json +19888 -21071
  3. package/dist/_meta/schemas.json +14305 -15328
  4. package/dist/abuse-reports-BsF9JZPW.mjs +8 -0
  5. package/dist/account-D8mYiWxQ.mjs +2 -0
  6. package/dist/accounts-CJci1Oez.mjs +23 -0
  7. package/dist/acm-CmCd985Q.mjs +3 -0
  8. package/dist/addressing-R7p6TRBe.mjs +12 -0
  9. package/dist/{agent-context-CKb6w43K.mjs → agent-context-Bzl5PGW-.mjs} +1 -1
  10. package/dist/ai-BzJg0RIX.mjs +3 -0
  11. package/dist/ai-audit-B0vJNOZG.mjs +2 -0
  12. package/dist/ai-gateway-D3vJR3My.mjs +10 -0
  13. package/dist/ai-search-CNg7W7U4.mjs +7 -0
  14. package/dist/alerting-_sdM0B0S.mjs +6 -0
  15. package/dist/alerts-dpT6Qsdu.mjs +2 -0
  16. package/dist/{analytics-CwFrx-Dr.mjs → analytics-BFBJhDrP.mjs} +1 -1
  17. package/dist/analytics_engine-CWhFvyeK.mjs +2 -0
  18. package/dist/{api-gateway-D9PMVVqL.mjs → api-gateway-D4AIEtUq.mjs} +10 -10
  19. package/dist/argo-Bjk6nFfs.mjs +2 -0
  20. package/dist/artifacts-Ba4b3iOa.mjs +4 -0
  21. package/dist/{audit-logs-BvQ9uwuy.mjs → audit-logs-BE0T5All.mjs} +1 -1
  22. package/dist/{auth-DX9KnJ0P.mjs → auth-CZ0E51rF.mjs} +3 -3
  23. package/dist/auth-D_zyQbDR.mjs +5 -0
  24. package/dist/autorag-Cnpp8PAG.mjs +2 -0
  25. package/dist/billing-Dz6Zj8Eq.mjs +2 -0
  26. package/dist/bot-management-pFwIbFi-.mjs +5 -0
  27. package/dist/botnet-feed-BY9uGChY.mjs +3 -0
  28. package/dist/brand-protection-DkPAk2Cz.mjs +3 -0
  29. package/dist/brands-CGpk9nZB.mjs +2 -0
  30. package/dist/browser-extension-D9P6Yv8i.mjs +3 -0
  31. package/dist/browser-run-DhHtz4y3.mjs +4 -0
  32. package/dist/build-CWuStmDi.mjs +2 -0
  33. package/dist/{cache-CeN5t6_W.mjs → cache-DVhkiIGK.mjs} +4 -4
  34. package/dist/calls-95zjvIcO.mjs +4 -0
  35. package/dist/certificate-authorities-BowBqbVq.mjs +2 -0
  36. package/dist/cf-BLT7uKJF.mjs +18 -0
  37. package/dist/chunk-2SIGYDH3-qXx_zE6v.mjs +397 -0
  38. package/dist/clear-DXx8WBAN.mjs +2 -0
  39. package/dist/client-certificates-D6mE4vJu.mjs +3 -0
  40. package/dist/cloud-connector-DmwsjeFN.mjs +2 -0
  41. package/dist/cloudforce-one-CG3TT7IN.mjs +23 -0
  42. package/dist/{completions-Bvzav4Mj.mjs → completions-DMc_PlIw.mjs} +2 -2
  43. package/dist/connectivity-DJkE3crz.mjs +3 -0
  44. package/dist/connector-interrupts-DTgQ7onV.mjs +2 -0
  45. package/dist/connector-telemetry-events-D0rTHDou.mjs +2 -0
  46. package/dist/connector-telemetry-snapshots--0QmD3z6.mjs +2 -0
  47. package/dist/connectors-zWaZTi2A.mjs +3 -0
  48. package/dist/content-scanning-CGvGf04y.mjs +4 -0
  49. package/dist/ct-alerting-ebSPSWNC.mjs +3 -0
  50. package/dist/{custom-certificates-CfRj7QZb.mjs → custom-certificates-CWUrPYLP.mjs} +4 -4
  51. package/dist/custom-csrs-CRtdrF9R.mjs +4 -0
  52. package/dist/{custom-hostnames-CcK7_17e.mjs → custom-hostnames-CVQSksqq.mjs} +4 -4
  53. package/dist/custom-nameservers-BRwbIdsX.mjs +3 -0
  54. package/dist/custom-pages-Ci8sTQX7.mjs +4 -0
  55. package/dist/d1-78Ym1P6D.mjs +4 -0
  56. package/dist/data-security-zmFoMwRU.mjs +6 -0
  57. package/dist/{dcv-delegation-BYsNl3qc.mjs → dcv-delegation-Dd4FZ2IG.mjs} +1 -1
  58. package/dist/{deploy-BzlPv3ro.mjs → deploy-CVvkZFjR.mjs} +1 -1
  59. package/dist/{dev-IOg-_s5_.mjs → dev-DSslyDXx.mjs} +1 -1
  60. package/dist/diagnostics-B8Ev5m_o.mjs +3 -0
  61. package/dist/dispatch-namespaces-Dm5vGeEP.mjs +7 -0
  62. package/dist/dist-BH-4NQOV.mjs +134 -0
  63. package/dist/dns-D7VAaCyO.mjs +29 -0
  64. package/dist/dns-firewall-ByLCsf0q.mjs +57 -0
  65. package/dist/domain-info-CRvKc2Lg.mjs +2 -0
  66. package/dist/durable-objects-BIpvyu9m.mjs +2 -0
  67. package/dist/email-auth-Cx--s8W4.mjs +2 -0
  68. package/dist/email-routing-CiDbivcN.mjs +10 -0
  69. package/dist/email-security-BYeAuSc6.mjs +12 -0
  70. package/dist/email-sending-Dg2rSmHH.mjs +4 -0
  71. package/dist/{filters-DKs-wEzt.mjs → filters-DZ8YnQ90.mjs} +3 -3
  72. package/dist/firewall-DEd1hs_I.mjs +11 -0
  73. package/dist/flagship-DVw7xGoP.mjs +4 -0
  74. package/dist/{fraud-D8WmLKyH.mjs → fraud-BbGS3FZs.mjs} +2 -2
  75. package/dist/google-tag-gateway-CBnRGYQR.mjs +2 -0
  76. package/dist/{healthchecks-BBtW8vRh.mjs → healthchecks-Da9N3ix4.mjs} +3 -3
  77. package/dist/{hostnames-Bh2IFxIw.mjs → hostnames-mimZu2tB.mjs} +2 -2
  78. package/dist/hyperdrive-BNdvxOos.mjs +21 -0
  79. package/dist/iam-DGQ-OgRl.mjs +6 -0
  80. package/dist/images-CI6Iy9ho.mjs +7 -0
  81. package/dist/index.mjs +1 -1
  82. package/dist/intel-BDB-aRtU.mjs +3 -0
  83. package/dist/internal-Czlp5Ekb.mjs +2 -0
  84. package/dist/{ips-BE7JbAnc.mjs → ips-B9UuPvsY.mjs} +1 -1
  85. package/dist/keyless-certificates-Ua9uJgPt.mjs +3 -0
  86. package/dist/kv-BHerx4dZ.mjs +5 -0
  87. package/dist/leaked-credential-checks-B8Vunj9h.mjs +3 -0
  88. package/dist/live-Ce7dZW7p.mjs +2 -0
  89. package/dist/load-balancers-DSjS5WKw.mjs +6 -0
  90. package/dist/logexplorer-DBIfTlRP.mjs +24 -0
  91. package/dist/logo-matches-C00iGpzW.mjs +2 -0
  92. package/dist/logos-CJLhx1go.mjs +3 -0
  93. package/dist/logpush-Cr1U-eK-.mjs +5 -0
  94. package/dist/logs-DMvtchc6.mjs +3 -0
  95. package/dist/magic-cloud-networking-FQfO8QWH.mjs +5 -0
  96. package/dist/magic-network-monitoring-CDd70fJQ.mjs +4 -0
  97. package/dist/magic-transit-DiKiPUax.mjs +110 -0
  98. package/dist/managed-transforms-fPVUTrAv.mjs +3 -0
  99. package/dist/matches-B0yHbQ2I.mjs +2 -0
  100. package/dist/moq-UgBawOXe.mjs +13 -0
  101. package/dist/mtls-certificates-xKUbC5EL.mjs +3 -0
  102. package/dist/network-interconnects-BJzOE2ny.mjs +41 -0
  103. package/dist/oauth-DBJ5GSFk.mjs +40 -0
  104. package/dist/observability-B-1y36QS.mjs +4 -0
  105. package/dist/organization-Dq3PClZ7.mjs +41 -0
  106. package/dist/organizations-AhsQkHyX.mjs +2 -0
  107. package/dist/origin-ca-certificates-CRgF0UyU.mjs +3 -0
  108. package/dist/origin-post-quantum-encryption-BXTx7DPa.mjs +2 -0
  109. package/dist/{origin-tls-client-auth-B30_2_dO.mjs → origin-tls-client-auth-BDw5q-6G.mjs} +3 -3
  110. package/dist/{page-rules-zQJGmTCd.mjs → page-rules-DqYQ23eg.mjs} +5 -5
  111. package/dist/{page-shield-CxQk5k9X.mjs → page-shield-DKdlZOLO.mjs} +5 -5
  112. package/dist/pages-BsXF11Kv.mjs +11 -0
  113. package/dist/pay-per-crawl-BGAwuAP3.mjs +2 -0
  114. package/dist/pipelines-D_QhSnGW.mjs +6 -0
  115. package/dist/progress-O88q63Bk.mjs +2 -0
  116. package/dist/{prompt-q3B7sM2A.mjs → prompt-DTAWiEm2.mjs} +1 -1
  117. package/dist/queries-CAE95-OH.mjs +3 -0
  118. package/dist/queues-BBz35Mqd.mjs +6 -0
  119. package/dist/r2-Zp99S5xF.mjs +21 -0
  120. package/dist/r2-data-catalog-BeVLZwrE.mjs +16 -0
  121. package/dist/radar-Cij-XVQJ.mjs +2 -0
  122. package/dist/rate-limit-analytics-CGviSPnJ.mjs +2 -0
  123. package/dist/rate-limits-DSdToIWv.mjs +5 -0
  124. package/dist/raw-fetch-DgezeshQ.mjs +2 -0
  125. package/dist/ready-DMpJvyaz.mjs +2 -0
  126. package/dist/realtime-kit-9rJcapfM.mjs +18 -0
  127. package/dist/recent-submissions-LS5IM-bm.mjs +2 -0
  128. package/dist/refute-BGTpr5sy.mjs +2 -0
  129. package/dist/registrar-CXViZlah.mjs +83 -0
  130. package/dist/registrar-sandbox-CvQyjXLJ.mjs +83 -0
  131. package/dist/request-tracers-DATfBnE9.mjs +2 -0
  132. package/dist/{resolve-DGD57PFH.mjs → resolve-Bs2sMRYS.mjs} +1 -1
  133. package/dist/resource-sharing-Cmhn6ghR.mjs +3 -0
  134. package/dist/resource-tagging-BTn05AOj.mjs +16 -0
  135. package/dist/rules-ens3OHme.mjs +4 -0
  136. package/dist/rulesets-bkreZRao.mjs +8 -0
  137. package/dist/rum-CpgXFcwl.mjs +4 -0
  138. package/dist/scan-logo-DUDIZJ2A.mjs +2 -0
  139. package/dist/scan-page-BqoQTk3R.mjs +2 -0
  140. package/dist/{schema-D8o6HcCr.mjs → schema-DCF4yEp_.mjs} +1 -1
  141. package/dist/{schema-validation-BWNDnnIT.mjs → schema-validation-Ca6o94ts.mjs} +5 -5
  142. package/dist/scim-C4oT8TMc.mjs +4 -0
  143. package/dist/sdk-pQ5kaGUX.mjs +3 -0
  144. package/dist/search-C4T5riPh.mjs +2 -0
  145. package/dist/secrets-store-CWEuiDNo.mjs +7 -0
  146. package/dist/security-center-BOvm7xy6.mjs +2 -0
  147. package/dist/{security-txt-CVpmJo29.mjs → security-txt-BCAUBctN.mjs} +2 -2
  148. package/dist/session-B1ARgLG7.mjs +2 -0
  149. package/dist/share-DhmVspmL.mjs +5 -0
  150. package/dist/{shared-DQI8NGja.mjs → shared-Bod3-Exx.mjs} +332 -332
  151. package/dist/signed-url-DA509wgp.mjs +2 -0
  152. package/dist/{smart-shield-BreBC1Ap.mjs → smart-shield-DZm4fn6z.mjs} +2 -2
  153. package/dist/{snippets-BAJoWMSJ.mjs → snippets-oQ0u26-z.mjs} +3 -3
  154. package/dist/{spawn-pmGERpdB.mjs → spawn-ChG5Xi9Z.mjs} +1 -1
  155. package/dist/{spectrum-DnIRLY95.mjs → spectrum-Cnkee5Ww.mjs} +6 -6
  156. package/dist/speed-DqNnvLBD.mjs +4 -0
  157. package/dist/{src-BQ1dr9xR.mjs → src-By-zTCHz.mjs} +9 -9
  158. package/dist/ssl-tS3CYZsZ.mjs +15 -0
  159. package/dist/state-OsdDJvdj.mjs +2 -0
  160. package/dist/stream-Bud9Os5V.mjs +14 -0
  161. package/dist/submission-info-DfIXmu-M.mjs +2 -0
  162. package/dist/submit-BtP8she2.mjs +2 -0
  163. package/dist/tenant-CMwHa-tU.mjs +2 -0
  164. package/dist/{token-validation-DUvtXWur.mjs → token-validation-BYC7HTok.mjs} +5 -5
  165. package/dist/{tools-CQtA5-cr.mjs → tools-Dru4l8yh.mjs} +1 -1
  166. package/dist/total-queries-DdLBNJzd.mjs +2 -0
  167. package/dist/tracked-domains-BbaY-IuY.mjs +2 -0
  168. package/dist/turnstile-CP4nScaL.mjs +23 -0
  169. package/dist/{ui-BrNwNHX9.mjs → ui-BNoF0KpD.mjs} +2 -2
  170. package/dist/url-info-Chs9h7Y-.mjs +2 -0
  171. package/dist/url-normalization-XYxW5Gj0.mjs +3 -0
  172. package/dist/url-scanner-D4pYNlO-.mjs +2 -0
  173. package/dist/user-DtefniLc.mjs +11 -0
  174. package/dist/vectorize-BeAY2g-7.mjs +4 -0
  175. package/dist/verify-D7J3F_NZ.mjs +2 -0
  176. package/dist/{versions-NUXxCr0s.mjs → versions-dMW3bLVv.mjs} +1 -1
  177. package/dist/waiting-rooms-K78HeeTg.mjs +11 -0
  178. package/dist/{web3-n3GW50u-.mjs → web3-Dhw79l4S.mjs} +3 -3
  179. package/dist/workers-builds-CuOAB3u4.mjs +7 -0
  180. package/dist/workers-l3zMNOU6.mjs +20 -0
  181. package/dist/workflows-rb7RYBKP.mjs +6 -0
  182. package/dist/{zaraz-9l7KuLqh.mjs → zaraz-CHecMYuo.mjs} +1 -1
  183. package/dist/zero-trust-DAZoa-Aj.mjs +117 -0
  184. package/dist/zone-BnnqJwW-.mjs +2 -0
  185. package/dist/zones-DpI2YikF.mjs +21 -0
  186. package/package.json +1 -1
  187. package/dist/abuse-reports-DUs4SKVx.mjs +0 -8
  188. package/dist/accounts-BIY8wNGA.mjs +0 -22
  189. package/dist/acm-SqcV8o5o.mjs +0 -3
  190. package/dist/addressing-CygRm0pN.mjs +0 -12
  191. package/dist/ai-BAmEAjN3.mjs +0 -2
  192. package/dist/ai-gateway-BENwPvvB.mjs +0 -8
  193. package/dist/ai-search-Bv_Whw3E.mjs +0 -7
  194. package/dist/ai_gateway-C6WP9oBH.mjs +0 -4
  195. package/dist/alerting-D_qWrsoY.mjs +0 -6
  196. package/dist/analytics_engine-BjV6XLyG.mjs +0 -2
  197. package/dist/argo-DwYGbyld.mjs +0 -2
  198. package/dist/artifacts-DKAjY_n4.mjs +0 -4
  199. package/dist/auth-TYwGydWg.mjs +0 -5
  200. package/dist/billing-CRTlRU88.mjs +0 -2
  201. package/dist/bot-management-DgW--8wM.mjs +0 -5
  202. package/dist/botnet-feed-CIX6ZORT.mjs +0 -3
  203. package/dist/brand-protection-ZikBtl0y.mjs +0 -3
  204. package/dist/browser-rendering-D_ZQVWn8.mjs +0 -4
  205. package/dist/build-Bgw8TV1p.mjs +0 -134
  206. package/dist/calls-Cv0ieVg4.mjs +0 -4
  207. package/dist/certificate-authorities-BzZnWCac.mjs +0 -2
  208. package/dist/client-certificates-BFuzeBrj.mjs +0 -3
  209. package/dist/cloud-connector-D5h8Dzzg.mjs +0 -2
  210. package/dist/cloudforce-one-aqDCIBMp.mjs +0 -21
  211. package/dist/config-B5k-XbwS.mjs +0 -2
  212. package/dist/connectivity-CjkXmEhO.mjs +0 -3
  213. package/dist/connector-interrupts-B7eSface.mjs +0 -2
  214. package/dist/connector-telemetry-events-F3Co8HUf.mjs +0 -2
  215. package/dist/connector-telemetry-snapshots-CQY8XMUg.mjs +0 -2
  216. package/dist/connectors-YYu_Vx3H.mjs +0 -3
  217. package/dist/content-scanning-BorfRGKT.mjs +0 -4
  218. package/dist/context-C-WbewL6.mjs +0 -2
  219. package/dist/custom-nameservers-BkKx0THn.mjs +0 -3
  220. package/dist/custom-pages-DamGVA75.mjs +0 -4
  221. package/dist/d1-sK0O5THv.mjs +0 -4
  222. package/dist/data-security-DsWpoWiS.mjs +0 -6
  223. package/dist/diagnostics-CH7T2WR3.mjs +0 -3
  224. package/dist/dispatch-namespaces-Bgj9XCRx.mjs +0 -7
  225. package/dist/dist-C6zxsVdY.mjs +0 -306
  226. package/dist/dns-firewall-VmQf3UVP.mjs +0 -57
  227. package/dist/dns-o7hUPMCG.mjs +0 -29
  228. package/dist/durable-objects-DgrTbvoF.mjs +0 -2
  229. package/dist/email-routing-owCvAEpf.mjs +0 -10
  230. package/dist/email-security-Dng3DVuf.mjs +0 -8
  231. package/dist/email-sending-bExMH4lu.mjs +0 -3
  232. package/dist/firewall-BLaTtX3r.mjs +0 -11
  233. package/dist/google-tag-gateway-DyCY43k0.mjs +0 -2
  234. package/dist/hyperdrive-DJm1eD-M.mjs +0 -18
  235. package/dist/iam-apCCcy7R.mjs +0 -6
  236. package/dist/images-Cxe45OHm.mjs +0 -7
  237. package/dist/intel-8V4h6H46.mjs +0 -3
  238. package/dist/keyless-certificates-CfJmXccT.mjs +0 -3
  239. package/dist/kv-Dz6then8.mjs +0 -5
  240. package/dist/leaked-credential-checks-BJ-zQMlx.mjs +0 -3
  241. package/dist/load-balancers-ilsGgudX.mjs +0 -6
  242. package/dist/logpush-BH14TtuA.mjs +0 -4
  243. package/dist/logs-B8-mkf_I.mjs +0 -3
  244. package/dist/magic-cloud-networking-DylCXoG4.mjs +0 -5
  245. package/dist/magic-network-monitoring-DnyrZy77.mjs +0 -4
  246. package/dist/magic-transit-B-kU5e3s.mjs +0 -89
  247. package/dist/managed-transforms-GC9Pq5dg.mjs +0 -3
  248. package/dist/mtls-certificates-BRlhWw_G.mjs +0 -3
  249. package/dist/network-interconnects-DuyoFD9_.mjs +0 -36
  250. package/dist/oauth-B5k80sip.mjs +0 -61
  251. package/dist/observability-9APhqFHo.mjs +0 -4
  252. package/dist/organizations-Dy3kiV_z.mjs +0 -41
  253. package/dist/origin-ca-certificates-2rwPoQdG.mjs +0 -3
  254. package/dist/origin-post-quantum-encryption-BnBLTvEO.mjs +0 -2
  255. package/dist/pages-5DKLs7CQ.mjs +0 -11
  256. package/dist/pipelines-DfGE44xo.mjs +0 -6
  257. package/dist/progress-CL8I-7YK.mjs +0 -2
  258. package/dist/queues-BoenUGIw.mjs +0 -6
  259. package/dist/r2-Cq_JCjK0.mjs +0 -21
  260. package/dist/r2-data-catalog-eLxltWdO.mjs +0 -14
  261. package/dist/radar-YNOCio6T.mjs +0 -2
  262. package/dist/rate-limits-CcAF3tMl.mjs +0 -5
  263. package/dist/raw-fetch-bIXC9D1m.mjs +0 -2
  264. package/dist/realtime-kit-4bCGviO5.mjs +0 -18
  265. package/dist/registrar-CfHlaOOf.mjs +0 -46
  266. package/dist/request-tracers-DlHawg5l.mjs +0 -2
  267. package/dist/resource-sharing-7FhuboJE.mjs +0 -5
  268. package/dist/resource-tagging-divcugVb.mjs +0 -16
  269. package/dist/rules-CAXkege8.mjs +0 -4
  270. package/dist/rulesets-CBsdc8IV.mjs +0 -8
  271. package/dist/rum-D0hHPNl9.mjs +0 -4
  272. package/dist/scim-CWLli4fi.mjs +0 -3
  273. package/dist/sdk-DhIhH6GB.mjs +0 -5
  274. package/dist/secrets-store-B7_HkE8I.mjs +0 -25
  275. package/dist/security-center-BQT21oiM.mjs +0 -2
  276. package/dist/session-B8r8LNQN.mjs +0 -93
  277. package/dist/speed-UYEVue28.mjs +0 -4
  278. package/dist/ssl-D3Pixs8M.mjs +0 -15
  279. package/dist/stream-BUsuOfQh.mjs +0 -14
  280. package/dist/tenants-BdWJTtcg.mjs +0 -2
  281. package/dist/turnstile-CAKVnS1L.mjs +0 -23
  282. package/dist/url-normalization-DA-RAxs4.mjs +0 -3
  283. package/dist/url-scanner-DmYu43f7.mjs +0 -2
  284. package/dist/user-Bah4wGGN.mjs +0 -10
  285. package/dist/vectorize-DhvVG2By.mjs +0 -4
  286. package/dist/waiting-rooms-DoOkT4Mu.mjs +0 -11
  287. package/dist/workers-D6IaQ_F0.mjs +0 -18
  288. package/dist/workers-builds-DYi0OMMU.mjs +0 -7
  289. package/dist/workflows-DrdXUQ2g.mjs +0 -4
  290. package/dist/zero-trust-D6V9GH2W.mjs +0 -118
  291. package/dist/zero_trust-BzXKAX_x.mjs +0 -3
  292. package/dist/zones-0MTkuaFk.mjs +0 -21
  293. /package/dist/{body-parser-DWSy7uZ8.mjs → body-parser-BO6mfo_W.mjs} +0 -0
  294. /package/dist/{cli-types-DGgEbf8K.mjs → cli-types-CFw6Xygp.mjs} +0 -0
  295. /package/dist/{input-validation-_fMCApaH.mjs → input-validation-BwUR9z8e.mjs} +0 -0
  296. /package/dist/{lib-4PQI6yRW.mjs → lib-Og5sB51C.mjs} +0 -0
  297. /package/dist/{local-CYc9q7l2.mjs → local-C6TLPAT6.mjs} +0 -0
  298. /package/dist/{metadata-MPDDi08e.mjs → metadata-Cnyws6iO.mjs} +0 -0
  299. /package/dist/{open-YWOUIZ5Y-3jqSKAB1.mjs → open-YWOUIZ5Y-CFRcYALi.mjs} +0 -0
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{O as e,P as t}from"./oauth-B5k80sip.mjs";import{n}from"./auth-DX9KnJ0P.mjs";import{t as r}from"./output-B6fBFRqe.mjs";import{n as i,t as a}from"./progress-CL8I-7YK.mjs";import{t as o}from"./local-CYc9q7l2.mjs";import{t as s}from"./cli-types-DGgEbf8K.mjs";function c(e){return e.option(`id`,{type:`string`,description:`Finds a specific log by its ID.`}).option(`export`,{type:`boolean`,description:`Indicates that this request is an export of logs in CSV format.`}).option(`action-type`,{type:`string`,description:`Filters by the action type.`}).option(`actor-ip`,{type:`string`,description:`Filters by the IP address of the request that made the change by specific IP address or valid CIDR Range.`}).option(`actor-email`,{type:`string`,description:`Filters by the email address of the actor that made the change.`}).option(`since`,{type:`string`,description:"Limits the returned results to logs newer than the specified date. A `full-date` that conforms to RFC3339."}).option(`before`,{type:`string`,description:"Limits the returned results to logs older than the specified date. A `full-date` that conforms to RFC3339."}).option(`zone-name`,{type:`string`,description:`Filters by the name of the zone associated to the change.`}).option(`direction`,{type:`string`,description:`Changes the direction of the chronological sorting.`,choices:[`desc`,`asc`]}).option(`per-page`,{type:`number`,description:`Sets the number of results to return per page.`}).option(`page`,{type:`number`,description:`Defines which page of results to return.`}).option(`hide-user-logs`,{type:`boolean`,description:`Indicates whether or not to hide user level audit logs.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const l={command:`list`,describe:`Gets a list of audit logs for an account. Can be filtered by who made the change, on which zone, and the timeframe of the change.`,builder:s(c),handler:async s=>{let c={id:s.id,export:s.export,"action.type":s[`action-type`],"actor.ip":s[`actor-ip`],"actor.email":s[`actor-email`],since:s.since,before:s.before,"zone.name":s[`zone-name`],direction:s.direction,per_page:s[`per-page`],page:s.page,hide_user_logs:s[`hide-user-logs`]};if(s.dryRun){i({command:`cf audit-logs list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/audit_logs`,pathParams:{},query:c,bodyKind:`none`});return}let l=await n(s),u=s.local?o:await e();s.accountId=u,r(await a(`Loading`,async()=>l.auditLogs.list({account_id:u,...c})),{successLabel:`Loaded`})}},u={command:`audit-logs`,describe:`Immutable audit trail of actions taken by account members — who changed what and when`,builder:e=>e.command(l).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{u as default};
2
+ import{O as e,w as t}from"./oauth-DBJ5GSFk.mjs";import{n}from"./auth-CZ0E51rF.mjs";import{t as r}from"./output-B6fBFRqe.mjs";import{n as i,t as a}from"./progress-O88q63Bk.mjs";import{t as o}from"./local-C6TLPAT6.mjs";import{t as s}from"./cli-types-CFw6Xygp.mjs";function c(e){return e.option(`id`,{type:`string`,description:`Finds a specific log by its ID.`}).option(`export`,{type:`boolean`,description:`Indicates that this request is an export of logs in CSV format.`}).option(`action-type`,{type:`string`,description:`Filters by the action type.`}).option(`actor-ip`,{type:`string`,description:`Filters by the IP address of the request that made the change by specific IP address or valid CIDR Range.`}).option(`actor-email`,{type:`string`,description:`Filters by the email address of the actor that made the change.`}).option(`since`,{type:`string`,description:"Limits the returned results to logs newer than the specified date. A `full-date` that conforms to RFC3339."}).option(`before`,{type:`string`,description:"Limits the returned results to logs older than the specified date. A `full-date` that conforms to RFC3339."}).option(`zone-name`,{type:`string`,description:`Filters by the name of the zone associated to the change.`}).option(`direction`,{type:`string`,description:`Changes the direction of the chronological sorting.`,choices:[`desc`,`asc`]}).option(`per-page`,{type:`number`,description:`Sets the number of results to return per page.`}).option(`page`,{type:`number`,description:`Defines which page of results to return.`}).option(`hide-user-logs`,{type:`boolean`,description:`Indicates whether or not to hide user level audit logs.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const l={command:`list`,describe:`Gets a list of audit logs for an account. Can be filtered by who made the change, on which zone, and the timeframe of the change.`,builder:s(c),handler:async s=>{let c={id:s.id,export:s.export,"action.type":s[`action-type`],"actor.ip":s[`actor-ip`],"actor.email":s[`actor-email`],since:s.since,before:s.before,"zone.name":s[`zone-name`],direction:s.direction,per_page:s[`per-page`],page:s.page,hide_user_logs:s[`hide-user-logs`]};if(s.dryRun){i({command:`cf audit-logs list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/audit_logs`,pathParams:{},query:c,bodyKind:`none`});return}let l=await n(s),u=s.local?o:await t();s.accountId=u,r(await a(`Loading`,async()=>l.auditLogs.list({account_id:u,...c})),{successLabel:`Loaded`})}},u={command:`audit-logs`,describe:`Immutable audit trail of actions taken by account members — who changed what and when`,builder:e=>e.command(l).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{u as default};
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
- import{l as e,v as t}from"./session-B8r8LNQN.mjs";import{n,r,t as i}from"./sdk-DhIhH6GB.mjs";import{g as a}from"./dist-C6zxsVdY.mjs";import{d as o,i as s,k as c,p as l}from"./oauth-B5k80sip.mjs";import{execSync as u}from"child_process";import d from"os";function f(e){try{let t=u(`ps -p ${e} -o pid=,ppid=,command=`,{encoding:`utf8`,timeout:5e3}).trim();if(!t)return null;let[n,r,...i]=t.split(/\s+/),a=n?parseInt(n,10):NaN,o=r?parseInt(r,10):NaN;return isNaN(a)||isNaN(o)?null:{pid:a,ppid:o,command:i.join(` `)||void 0}}catch(t){return t instanceof Error&&t.message.includes(`timeout`)&&console.warn(`Process lookup timed out for PID ${e}`),null}}function p(e){let t=[],n=new Set,r=e,i=1e3;for(;r&&i>0;){if(n.has(r)){console.warn(`Detected cycle in process tree at PID ${r}`);break}n.add(r);let e=f(r);if(!e||e.ppid===0||e.ppid===1)break;t.push(e),r=e.ppid,i--}return i===0&&console.warn(`Reached maximum depth limit while traversing process tree from PID ${e}`),t}function m(e){try{let t=u(`wmic process where (ProcessId=${e}) get ProcessId,ParentProcessId,CommandLine /format:csv`,{encoding:`utf8`,timeout:1e4});if(!t)return null;let n=t.split(`
3
- `).filter(e=>e.trim()&&!e.startsWith(`Node`)).pop()?.split(`,`);if(!n||n.length<4)return null;let[r,i,a,o]=n,s=o?parseInt(o.trim(),10):NaN,c=a?parseInt(a.trim(),10):NaN;return isNaN(s)||isNaN(c)?null:{pid:s,ppid:c,command:i?.trim()||void 0}}catch(t){return t instanceof Error&&t.message.includes(`timeout`)&&console.warn(`Process lookup timed out for PID ${e}`),null}}function h(e){let t=[],n=new Set,r=e,i=1e3;for(;r&&i>0;){if(n.has(r)){console.warn(`Detected cycle in process tree at PID ${r}`);break}n.add(r);let e=m(r);if(!e||e.ppid===0||e.ppid===4)break;t.push(e),r=e.ppid,i--}return i===0&&console.warn(`Reached maximum depth limit while traversing process tree from PID ${e}`),t}function g(e=process.pid){if(typeof e!=`number`||!Number.isInteger(e)||e<=0)throw Error(`PID must be a positive integer`);return d.platform()===`win32`?h(e):p(e)}const _=[{id:`opencode`,name:`OpenCode`,type:`agent`,envVars:[{any:[`OPENCODE`,`OPENCODE_BIN_PATH`,`OPENCODE_SERVER`,`OPENCODE_APP_INFO`,`OPENCODE_MODES`]}]},{id:`jules`,name:`Jules`,type:`agent`,envVars:[{all:[[`HOME`,`/home/jules`],[`USER`,`swebot`]]}]},{id:`claude-code`,name:`Claude Code`,type:`agent`,envVars:[`CLAUDECODE`]},{id:`cursor-agent`,name:`Cursor Agent`,type:`agent`,envVars:[{all:[`CURSOR_TRACE_ID`,[`PAGER`,`head -n 10000 | cat`]]}]},{id:`cursor`,name:`Cursor`,type:`interactive`,envVars:[`CURSOR_TRACE_ID`]},{id:`gemini-agent`,name:`Gemini Agent`,type:`agent`,processChecks:[`gemini`]},{id:`codex`,name:`OpenAI Codex`,type:`agent`,processChecks:[`codex`]},{id:`replit`,name:`Replit`,type:`agent`,envVars:[`REPL_ID`]},{id:`aider`,name:`Aider`,type:`agent`,envVars:[`AIDER_API_KEY`],processChecks:[`aider`]},{id:`bolt-agent`,name:`Bolt.new Agent`,type:`agent`,envVars:[{all:[[`SHELL`,`/bin/jsh`],`npm_config_yes`]}]},{id:`bolt`,name:`Bolt.new`,type:`interactive`,envVars:[{all:[[`SHELL`,`/bin/jsh`]],none:[`npm_config_yes`]}]},{id:`zed-agent`,name:`Zed Agent`,type:`agent`,envVars:[{all:[[`TERM_PROGRAM`,`zed`],[`PAGER`,`cat`]]}]},{id:`zed`,name:`Zed`,type:`interactive`,envVars:[{all:[[`TERM_PROGRAM`,`zed`]],none:[[`PAGER`,`cat`]]}]},{id:`replit-assistant`,name:`Replit Assistant`,type:`agent`,envVars:[{all:[`REPL_ID`,[`REPLIT_MODE`,`assistant`]]}]},{id:`replit`,name:`Replit`,type:`interactive`,envVars:[{all:[`REPL_ID`],none:[[`REPLIT_MODE`,`assistant`]]}]},{id:`windsurf`,name:`Windsurf`,type:`agent`,envVars:[`CODEIUM_EDITOR_APP_ROOT`]},{id:`crush`,name:`Crush`,type:`agent`,processChecks:[`crush`]},{id:`vscode-copilot-agent`,name:`GitHub Copilot in VS Code`,type:`agent`,envVars:[{all:[[`TERM_PROGRAM`,`vscode`],[`GIT_PAGER`,`cat`]]}]},{id:`warp`,name:`Warp Terminal`,type:`hybrid`,envVars:[{all:[[`TERM_PROGRAM`,`WarpTerminal`]]}]},{id:`octofriend`,name:`Octofriend`,type:`agent`,processChecks:[`octofriend`]}];function v(e,t=process.env){let[n,r]=typeof e==`string`?[e,void 0]:e,i=t[n];return!!(i&&(!r||i===r))}function y(e,t){try{let n=t??g();for(let t of n)if(t.command?.includes(e))return!0}catch{}return!1}function b(e,t=process.env){if(typeof e==`string`||Array.isArray(e))return v(e,t);let{any:n,all:r,none:i}=e,a=!n?.length||n.some(e=>v(e,t)),o=!r?.length||r.every(e=>v(e,t)),s=!i?.length||!i.some(e=>v(e,t));return a&&o&&s}function x(e){return e.customDetectors?.some(e=>{try{return e()}catch{return!1}})??!1}function S(e){return{isAgentic:!0,id:e.id,name:e.name,type:e.type}}function C(e=process.env,t){for(let t of _)if(t.envVars?.some(t=>b(t,e)))return S(t);let n=t,r=()=>{if(n===void 0)try{n=g()}catch{n=[]}return n};for(let e of _)if(e.processChecks?.some(e=>y(e,r())))return S(e);for(let e of _)if(x(e))return S(e);return{isAgentic:!1,id:null,name:null,type:null}}function w(){return o?`ci`:l()?`interactive`:`non-interactive`}function T(){let e=C(),n=e.isAgentic&&e.id!==null?{"X-CF-CLI-Agent":e.id}:{};return{"User-Agent":t,"X-CF-CLI-Mode":w(),...n}}const E=3e4,D=n.Default;function O(e){return e instanceof FormData||e instanceof Blob||e instanceof ArrayBuffer||ArrayBuffer.isView(e)||e instanceof ReadableStream||e instanceof URLSearchParams}function k(e){return Object.keys(e).some(e=>e.toLowerCase()===`content-type`)}async function A(e){let t=e.headers.get(`content-type`)??``;try{return t.includes(`application/json`)?await e.json():await e.text()}catch{return null}}function j(e,t,n){if(!(n==null||n===``)){if(Array.isArray(n)){for(let r of n)j(e,t,r);return}e.append(t,String(n))}}function M(e){let t=new URLSearchParams;for(let[n,r]of Object.entries(e))j(t,n,r);return t.toString()}function N(e,t,n){let r=new URL(t.endsWith(`/`)?t:`${t}/`),i=new URL(e.startsWith(`/`)?e.slice(1):e,r);if(i.origin!==r.origin)throw Error(`Refusing to send an authenticated request to ${i.origin} (expected ${r.origin})`);let a=M(n??{});return a&&(i.search=a),i.toString()}const P=new WeakMap;async function F(e,t,n,i={}){let a=N(n,P.get(e)??D,i.query),o={...i.headers},s;i.body!==void 0&&(O(i.body)||typeof i.body==`string`&&k(o)?s=i.body:(o[`Content-Type`]??=`application/json`,s=JSON.stringify(i.body)));let c;try{c=await e.fetch(a,{method:t,headers:o,body:s,signal:i.signal},{timeoutInSeconds:i.timeout?i.timeout/1e3:void 0,abortSignal:i.signal})}catch(e){throw i.signal?.aborted?Error(`Request aborted`):e instanceof Error&&e.name===`AbortError`?Error(`Request timed out after ${i.timeout??E}ms`):e instanceof Error?Error(`Request failed: ${e.message}`):e}if(!c.ok)throw new r({statusCode:c.status,body:await A(c),rawResponse:{status:c.status,statusText:c.statusText,url:c.url||a,headers:c.headers,redirected:c.redirected,type:c.type}});if(c.status===204)return null;let l=await c.text();if(l===``)return null;if(!(c.headers.get(`content-type`)??``).includes(`application/json`))return l;let u=JSON.parse(l);if(u.success===!1)throw new r({message:`API error: ${u.errors?.map(e=>e.message).filter(Boolean).join(`, `)||`unknown error`}`,statusCode:c.status,body:u});return`result`in u?u.result:u}function I(e){let t=e.baseURL??D,n=new i({baseUrl:t,auth:async()=>({headers:{Authorization:`Bearer ${e.apiToken}`}}),headers:e.defaultHeaders,timeoutInSeconds:(e.timeout??E)/1e3,maxRetries:0,fetch:e.fetch??globalThis.fetch});return P.set(n,t),n}async function L(){let t=e({allowGlobalAuthKey:!1});if(t&&`apiToken`in t)return t.apiToken;let n=await s();if(n)return n;throw Error(`No authentication token found.
2
+ import{i as e}from"./session-B1ARgLG7.mjs";import{n as t,r as n,t as r}from"./sdk-pQ5kaGUX.mjs";import{O as i,o as a}from"./chunk-2SIGYDH3-qXx_zE6v.mjs";import{T as o,a as s,f as c,m as l}from"./oauth-DBJ5GSFk.mjs";import{execSync as u}from"child_process";import d from"os";function f(e){try{let t=u(`ps -p ${e} -o pid=,ppid=,command=`,{encoding:`utf8`,timeout:5e3}).trim();if(!t)return null;let[n,r,...i]=t.split(/\s+/),a=n?parseInt(n,10):NaN,o=r?parseInt(r,10):NaN;return isNaN(a)||isNaN(o)?null:{pid:a,ppid:o,command:i.join(` `)||void 0}}catch(t){return t instanceof Error&&t.message.includes(`timeout`)&&console.warn(`Process lookup timed out for PID ${e}`),null}}function p(e){let t=[],n=new Set,r=e,i=1e3;for(;r&&i>0;){if(n.has(r)){console.warn(`Detected cycle in process tree at PID ${r}`);break}n.add(r);let e=f(r);if(!e||e.ppid===0||e.ppid===1)break;t.push(e),r=e.ppid,i--}return i===0&&console.warn(`Reached maximum depth limit while traversing process tree from PID ${e}`),t}function m(e){try{let t=u(`wmic process where (ProcessId=${e}) get ProcessId,ParentProcessId,CommandLine /format:csv`,{encoding:`utf8`,timeout:1e4});if(!t)return null;let n=t.split(`
3
+ `).filter(e=>e.trim()&&!e.startsWith(`Node`)).pop()?.split(`,`);if(!n||n.length<4)return null;let[r,i,a,o]=n,s=o?parseInt(o.trim(),10):NaN,c=a?parseInt(a.trim(),10):NaN;return isNaN(s)||isNaN(c)?null:{pid:s,ppid:c,command:i?.trim()||void 0}}catch(t){return t instanceof Error&&t.message.includes(`timeout`)&&console.warn(`Process lookup timed out for PID ${e}`),null}}function h(e){let t=[],n=new Set,r=e,i=1e3;for(;r&&i>0;){if(n.has(r)){console.warn(`Detected cycle in process tree at PID ${r}`);break}n.add(r);let e=m(r);if(!e||e.ppid===0||e.ppid===4)break;t.push(e),r=e.ppid,i--}return i===0&&console.warn(`Reached maximum depth limit while traversing process tree from PID ${e}`),t}function g(e=process.pid){if(typeof e!=`number`||!Number.isInteger(e)||e<=0)throw Error(`PID must be a positive integer`);return d.platform()===`win32`?h(e):p(e)}const _=[{id:`opencode`,name:`OpenCode`,type:`agent`,envVars:[{any:[`OPENCODE`,`OPENCODE_BIN_PATH`,`OPENCODE_SERVER`,`OPENCODE_APP_INFO`,`OPENCODE_MODES`]}]},{id:`jules`,name:`Jules`,type:`agent`,envVars:[{all:[[`HOME`,`/home/jules`],[`USER`,`swebot`]]}]},{id:`claude-code`,name:`Claude Code`,type:`agent`,envVars:[`CLAUDECODE`]},{id:`cursor-agent`,name:`Cursor Agent`,type:`agent`,envVars:[{all:[`CURSOR_TRACE_ID`,[`PAGER`,`head -n 10000 | cat`]]}]},{id:`cursor`,name:`Cursor`,type:`interactive`,envVars:[`CURSOR_TRACE_ID`]},{id:`gemini-agent`,name:`Gemini Agent`,type:`agent`,processChecks:[`gemini`]},{id:`codex`,name:`OpenAI Codex`,type:`agent`,processChecks:[`codex`]},{id:`replit`,name:`Replit`,type:`agent`,envVars:[`REPL_ID`]},{id:`aider`,name:`Aider`,type:`agent`,envVars:[`AIDER_API_KEY`],processChecks:[`aider`]},{id:`bolt-agent`,name:`Bolt.new Agent`,type:`agent`,envVars:[{all:[[`SHELL`,`/bin/jsh`],`npm_config_yes`]}]},{id:`bolt`,name:`Bolt.new`,type:`interactive`,envVars:[{all:[[`SHELL`,`/bin/jsh`]],none:[`npm_config_yes`]}]},{id:`zed-agent`,name:`Zed Agent`,type:`agent`,envVars:[{all:[[`TERM_PROGRAM`,`zed`],[`PAGER`,`cat`]]}]},{id:`zed`,name:`Zed`,type:`interactive`,envVars:[{all:[[`TERM_PROGRAM`,`zed`]],none:[[`PAGER`,`cat`]]}]},{id:`replit-assistant`,name:`Replit Assistant`,type:`agent`,envVars:[{all:[`REPL_ID`,[`REPLIT_MODE`,`assistant`]]}]},{id:`replit`,name:`Replit`,type:`interactive`,envVars:[{all:[`REPL_ID`],none:[[`REPLIT_MODE`,`assistant`]]}]},{id:`windsurf`,name:`Windsurf`,type:`agent`,envVars:[`CODEIUM_EDITOR_APP_ROOT`]},{id:`crush`,name:`Crush`,type:`agent`,processChecks:[`crush`]},{id:`vscode-copilot-agent`,name:`GitHub Copilot in VS Code`,type:`agent`,envVars:[{all:[[`TERM_PROGRAM`,`vscode`],[`GIT_PAGER`,`cat`]]}]},{id:`warp`,name:`Warp Terminal`,type:`hybrid`,envVars:[{all:[[`TERM_PROGRAM`,`WarpTerminal`]]}]},{id:`octofriend`,name:`Octofriend`,type:`agent`,processChecks:[`octofriend`]}];function v(e,t=process.env){let[n,r]=typeof e==`string`?[e,void 0]:e,i=t[n];return!!(i&&(!r||i===r))}function y(e,t){try{let n=t??g();for(let t of n)if(t.command?.includes(e))return!0}catch{}return!1}function b(e,t=process.env){if(typeof e==`string`||Array.isArray(e))return v(e,t);let{any:n,all:r,none:i}=e,a=!n?.length||n.some(e=>v(e,t)),o=!r?.length||r.every(e=>v(e,t)),s=!i?.length||!i.some(e=>v(e,t));return a&&o&&s}function x(e){return e.customDetectors?.some(e=>{try{return e()}catch{return!1}})??!1}function S(e){return{isAgentic:!0,id:e.id,name:e.name,type:e.type}}function C(e=process.env,t){for(let t of _)if(t.envVars?.some(t=>b(t,e)))return S(t);let n=t,r=()=>{if(n===void 0)try{n=g()}catch{n=[]}return n};for(let e of _)if(e.processChecks?.some(e=>y(e,r())))return S(e);for(let e of _)if(x(e))return S(e);return{isAgentic:!1,id:null,name:null,type:null}}function w(){return c?`ci`:l()?`interactive`:`non-interactive`}function T(){let t=C(),n=t.isAgentic&&t.id!==null?{"X-CF-CLI-Agent":t.id}:{};return{"User-Agent":e,"X-CF-CLI-Mode":w(),...n}}const E=3e4,D=t.Default;function O(e){return e instanceof FormData||e instanceof Blob||e instanceof ArrayBuffer||ArrayBuffer.isView(e)||e instanceof ReadableStream||e instanceof URLSearchParams}function k(e){return Object.keys(e).some(e=>e.toLowerCase()===`content-type`)}async function A(e){let t=e.headers.get(`content-type`)??``;try{return t.includes(`application/json`)?await e.json():await e.text()}catch{return null}}function j(e,t,n){if(!(n==null||n===``)){if(Array.isArray(n)){for(let r of n)j(e,t,r);return}e.append(t,String(n))}}function M(e){let t=new URLSearchParams;for(let[n,r]of Object.entries(e))j(t,n,r);return t.toString()}function N(e,t,n){let r=new URL(t.endsWith(`/`)?t:`${t}/`),i=new URL(e.startsWith(`/`)?e.slice(1):e,r);if(i.origin!==r.origin)throw Error(`Refusing to send an authenticated request to ${i.origin} (expected ${r.origin})`);let a=M(n??{});return a&&(i.search=a),i.toString()}const P=new WeakMap;async function F(e,t,r,i={}){let a=N(r,P.get(e)??D,i.query),o={...i.headers},s;i.body!==void 0&&(O(i.body)||typeof i.body==`string`&&k(o)?s=i.body:(o[`Content-Type`]??=`application/json`,s=JSON.stringify(i.body)));let c;try{c=await e.fetch(a,{method:t,headers:o,body:s,signal:i.signal},{timeoutInSeconds:i.timeout?i.timeout/1e3:void 0,abortSignal:i.signal})}catch(e){throw i.signal?.aborted?Error(`Request aborted`):e instanceof Error&&e.name===`AbortError`?Error(`Request timed out after ${i.timeout??E}ms`):e instanceof Error?Error(`Request failed: ${e.message}`):e}if(!c.ok)throw new n({statusCode:c.status,body:await A(c),rawResponse:{status:c.status,statusText:c.statusText,url:c.url||a,headers:c.headers,redirected:c.redirected,type:c.type}});if(c.status===204)return null;let l=await c.text();if(l===``)return null;if(!(c.headers.get(`content-type`)??``).includes(`application/json`))return l;let u=JSON.parse(l);if(u.success===!1)throw new n({message:`API error: ${u.errors?.map(e=>e.message).filter(Boolean).join(`, `)||`unknown error`}`,statusCode:c.status,body:u});return`result`in u?u.result:u}function I(e){let t=e.baseURL??D,n=new r({baseUrl:t,auth:async()=>({headers:{Authorization:`Bearer ${e.apiToken}`}}),headers:e.defaultHeaders,timeoutInSeconds:(e.timeout??E)/1e3,maxRetries:0,fetch:e.fetch??globalThis.fetch});return P.set(n,t),n}async function L(){let e=a({allowGlobalAuthKey:!1});if(e&&`apiToken`in e)return e.apiToken;let t=await s();if(t)return t;throw Error(`No authentication token found.
4
4
 
5
5
  Please set one of the following:
6
6
  1. Set the CLOUDFLARE_API_TOKEN environment variable
7
7
  2. Run 'cf auth login' to authenticate via OAuth
8
8
 
9
- For API tokens, visit: https://dash.cloudflare.com/profile/api-tokens`)}async function R(e){let t=a({compliance_region:c()});if(e.local){if(!e.localEndpoint)throw Error(`--local requires --local-endpoint <url>; this should have been caught by the global middleware.`);let{createLocalFetch:n}=await import(`./local-CYc9q7l2.mjs`).then(e=>e.r);return I({apiToken:`cf-local-mode-no-auth`,baseURL:t,defaultHeaders:T(),fetch:n({endpoint:e.localEndpoint})})}return I({apiToken:await L(),baseURL:t,defaultHeaders:T()})}export{T as a,F as i,R as n,L as r,I as t};
9
+ For API tokens, visit: https://dash.cloudflare.com/profile/api-tokens`)}async function R(e){let t=i({compliance_region:await o()});if(e.local){if(!e.localEndpoint)throw Error(`--local requires --local-endpoint <url>; this should have been caught by the global middleware.`);let{createLocalFetch:n}=await import(`./local-C6TLPAT6.mjs`).then(e=>e.r);return I({apiToken:`cf-local-mode-no-auth`,baseURL:t,defaultHeaders:T(),fetch:n({endpoint:e.localEndpoint})})}return I({apiToken:await L(),baseURL:t,defaultHeaders:T()})}export{T as a,F as i,R as n,L as r,I as t};
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+ import{o as e,p as t}from"./chunk-2SIGYDH3-qXx_zE6v.mjs";import{a as n}from"./theme-DbNbIY4d.mjs";import{n as r,r as i,t as a}from"./ui-BNoF0KpD.mjs";import{a as o,c as s,d as c,i as l,n as u,o as d,r as f,s as p,t as m,u as h}from"./oauth-DBJ5GSFk.mjs";import{r as g,t as _}from"./auth-CZ0E51rF.mjs";import{t as v}from"./output-B6fBFRqe.mjs";import y from"node:path";function b(e,t,n){if(!e.profile)return;let r=n?` ${n}`:``;throw Error(`The --profile flag cannot be used with \`cf auth ${t}\`.${r}`)}function x(){if(e({allowGlobalAuthKey:!1})!==void 0)throw Error(`Cannot manage auth profiles while CLOUDFLARE_API_TOKEN is set. Unset CLOUDFLARE_API_TOKEN and try again.`)}const S={command:`create <name>`,describe:`Create or re-authenticate a named auth profile`,builder:e=>e.positional(`name`,{type:`string`,description:`Name for the auth profile`,demandOption:!0}).option(`browser`,{type:`boolean`,description:`Open a browser to complete login (use --no-browser to print the URL instead)`,default:!0}).option(`scopes`,{type:`string`,array:!0,description:`The set of OAuth scopes to request`}),handler:async e=>{b(e,`create`,"Pass the profile name as the command argument: `cf auth create <name>`."),x(),t(e.name);let i=l().configs.exists(e.name);await p({browser:e.browser,scopes:e.scopes,profile:e.name}),console.log(r(i?`Profile "${e.name}" re-authenticated.`:`Profile "${e.name}" created.`)),console.log(a(`Run ${n.code(`cf auth activate ${e.name}`)} to use this profile in a directory.`))}},C={command:`delete <name>`,describe:`Delete a named auth profile`,builder:e=>e.positional(`name`,{type:`string`,description:`Name of the auth profile to delete`,demandOption:!0}),handler:async e=>{b(e,`delete`),x(),t(e.name);let i=l();if(!i.configs.exists(e.name))throw Error(`Profile "${e.name}" does not exist.`);let o=i.bindings.removeAllBindingsForProfile(e.name);if(o.length>0){console.log(r(`Removed directory bindings:`));for(let e of o)console.log(` ${e}`)}await s(e.name),i.configs.delete(e.name),console.log(r(`Profile "${e.name}" deleted.`));let c=i.bindings.getProfileForDirectory(process.cwd());c?console.log(r(`Active profile for this directory: ${c}.`)):i.configs.exists(`default`)?console.log(r(`This directory now uses the default profile.`)):console.log(a(`No active profile for this directory. Run ${n.code(`cf auth login`)} to set up the default profile, or ${n.code(`cf auth create <name>`)} to create a named profile.`))}},w={command:`activate <name> [dir]`,describe:`Bind a named auth profile to a directory`,builder:e=>e.positional(`name`,{type:`string`,description:`Name of the auth profile to activate`,demandOption:!0}).positional(`dir`,{type:`string`,description:`Directory to bind the profile to (defaults to current directory)`}),handler:e=>{b(e,`activate`,"Pass the profile name as the command argument: `cf auth activate <name>`."),x(),t(e.name);let n=l();if(!n.configs.exists(e.name))throw Error(`Profile "${e.name}" does not exist. Run \`cf auth create ${e.name}\` first.`);let i=e.dir??process.cwd();n.bindings.activate(e.name,i),console.log(r(`Profile "${e.name}" activated for "${y.resolve(i)}".`))}},T={command:`deactivate [dir]`,describe:`Remove the auth profile binding from a directory`,builder:e=>e.positional(`dir`,{type:`string`,description:`Directory to unbind (defaults to current directory). Must be the exact directory the profile was bound to.`}),handler:e=>{b(e,`deactivate`),x();let t=l(),i=e.dir??process.cwd(),{removedProfile:o,newResolution:s}=t.bindings.deactivate(i);console.log(r(`Profile "${o}" deactivated from "${y.resolve(i)}".`)),s.profile===void 0?console.log(a(`Run ${n.code(`cf auth login`)} to set up the default profile, or ${n.code(`cf auth create <name>`)} to create a named profile.`)):s.profile===`default`?console.log(r(`This directory now uses the default profile.`)):console.log(r(`Now using: ${s.profile} (${s.source}).`))}},E={command:`list`,describe:`List all auth profiles`,handler:e=>{b(e,`list`);let t=l(),n=t.bindings.read(),r={};for(let[e,t]of Object.entries(n))(r[t]??=[]).push(e);v(t.configs.list().map(e=>({name:e,boundDirectories:r[e]??[]})))}},D={command:`login`,describe:`Authenticate with Cloudflare`,builder:e=>e.option(`force`,{type:`boolean`,alias:`f`,description:`Force re-authentication even if already logged in`,default:!1}).option(`browser`,{type:`boolean`,description:`Open a browser to complete login (use --no-browser to print the URL instead)`,default:!0}).option(`scopes`,{type:`string`,array:!0,description:`The set of OAuth scopes to request`}),handler:async e=>{b(e,`login`,"Run `cf auth create <name>` to authenticate a named profile.");let t=u();if(t!==`default`&&console.log(i(`This directory has profile "${t}" active. \`cf auth login\` updates the default profile, not "${t}".\nTo re-authenticate "${t}", run \`cf auth create ${t}\`.`)),c(`default`),!e.force&&d()){if(await o()){let e=h();console.log(r(`You are already logged in.`)),console.log(`${n.info(`Config file:`)} ${n.muted(f())}`),e?.expiration_time&&console.log(`${n.info(`Token expires:`)} ${new Date(e.expiration_time).toLocaleString()}`),console.log(a(`Run ${n.code(`cf auth login --force`)} to re-authenticate, or ${n.code(`cf auth logout`)} to log out.`));return}console.log(i(`Existing tokens are invalid or expired. Starting fresh login...
3
+ `))}else e.force&&d()&&console.log(r(`Re-authenticating...
4
+ `));if(console.log(r(`Starting OAuth login flow...
5
+ `)),!await p({browser:e.browser,scopes:e.scopes,profile:`default`})){console.log(i(`CLOUDFLARE_API_TOKEN is set and takes precedence. Unset it to log in via OAuth.`));return}let s=h();console.log(`${n.info(`Config file:`)} ${n.muted(f())}`),s?.scopes&&console.log(`${n.info(`Scopes:`)} ${s.scopes.join(`, `)}`),s?.expiration_time&&console.log(`${n.info(`Token expires:`)} ${new Date(s.expiration_time).toLocaleString()}`)}},O={command:`logout`,describe:`Log out and remove stored credentials`,handler:async e=>{b(e,`logout`,"Run `cf auth delete <name>` to remove a named profile.");let t=u();t!==`default`&&console.log(i(`This directory has profile "${t}" active. \`cf auth logout\` removes the default profile's token, not "${t}".\nTo delete "${t}", run \`cf auth delete ${t}\`.`)),c(`default`);let o=d(),l=!!process.env.CLOUDFLARE_API_TOKEN;if(!o){l?(console.log(r(`No cf OAuth credentials found, but CLOUDFLARE_API_TOKEN environment variable is set.`)),console.log(r(`Unset it with: unset CLOUDFLARE_API_TOKEN`))):(console.log(r(`You are not currently logged in.`)),console.log(a(`Run ${n.code(`cf auth login`)} to authenticate.`)));return}console.log(r(`Logging out...`)),await s(`default`),console.log(`${n.info(`Removed:`)} OAuth tokens from ${n.muted(f())}`),l&&(console.log(``),console.log(i(`CLOUDFLARE_API_TOKEN environment variable is still set.`)),console.log(r(`You will remain authenticated via the env var. Unset it with: unset CLOUDFLARE_API_TOKEN`)))}},k={command:`whoami`,describe:`Show current user and authentication status`,builder:e=>e,handler:async e=>{let t=process.env.CLOUDFLARE_API_TOKEN,n=h(),r;r=t?`CLOUDFLARE_API_TOKEN environment variable`:n?.oauth_token?`OAuth token from ${f()}`:`none`;let i;try{i=await g()}catch{v({authenticated:!1,error:`Not logged in`});return}let a=_({apiToken:i}),o,s=[],[c,l]=await Promise.allSettled([a.user.get(),m()]);if(c.status===`fulfilled`){let e=c.value;e&&`email`in e&&typeof e.email==`string`&&(o=e.email)}else process.env.DEBUG&&console.error(`User lookup error:`,c.reason);l.status===`fulfilled`?s=l.value:process.env.DEBUG&&console.error(`Account lookup error:`,l.reason);let u=c.status===`fulfilled`||l.status===`fulfilled`,d={authenticated:!0,authSource:r,tokenValid:u,...o&&{email:o},accounts:s};n?.oauth_token&&(d.scopes=n.scopes,d.expiresAt=n.expiration_time),v(d)}},A={command:`auth`,describe:`Manage authentication and profiles`,builder:e=>e.command(D).command(O).command(k).command(S).command(C).command(w).command(T).command(E).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{A as default};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ const e={command:`autorag`,describe:`autorag`,builder:e=>e.demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{e as default};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import{O as e,w as t}from"./oauth-DBJ5GSFk.mjs";import{n}from"./auth-CZ0E51rF.mjs";import{t as r}from"./output-B6fBFRqe.mjs";import{n as i,t as a}from"./progress-O88q63Bk.mjs";import{t as o}from"./local-C6TLPAT6.mjs";import{n as s,t as c}from"./body-parser-BO6mfo_W.mjs";import{n as l}from"./input-validation-BwUR9z8e.mjs";function u(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const d={command:`get`,describe:`Gets the current billing profile for the account.`,builder:u,handler:async s=>{if(s.dryRun){i({command:`cf billing profiles get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/billing/profile`,pathParams:{},bodyKind:`none`});return}let c=await n(s),l=s.local?o:await t();s.accountId=l,r(await a(`Loading`,async()=>c.billing.profiles.get({account_id:l})),{successLabel:`Loaded`})}},f={command:`profiles`,describe:`Billing profile with payment method, address, and invoice preferences`,builder:e=>e.command(d).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function p(e){return e.option(`from`,{type:`string`,description:"Start date for the usage query (ISO 8601). Required if `to` is set. When omitted along with `to`, defaults to the start of the current month. Filters by charge period (when consumption happened), not billing period. The maximum date range is 31 days."}).option(`to`,{type:`string`,description:"End date for the usage query (ISO 8601). Required if `from` is set. When omitted along with `from`, defaults to today. Filters by charge period (when consumption happened), not billing period. The maximum date range is 31 days."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const m={command:`get-account-usage-v2`,describe:"Returns cost and usage data for a single Cloudflare account, aligned with the [FinOps FOCUS v1.3](https://focus.finops.org/focus-specification/v1-3/) Cost and Usage dataset specification. Each record represents one billable metric for one account on one day. This includes all metered usage, including usage that falls within free-tier allowances and may result in zero cost. **Note:** Cost and pricing fields are not yet populated and will be absent from responses until billing integration is complete. When `from` and `to` are omitted, defaults to the start of the current month through today. The maximum date range is 31 days.",builder:p,handler:async s=>{let c={from:s.from,to:s.to};if(s.dryRun){i({command:`cf billing usage get-account-usage-v2`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/billable/usage`,pathParams:{},query:c,bodyKind:`none`});return}let l=await n(s),u=s.local?o:await t();s.accountId=u,r(await a(`Loading`,async()=>l.billing.usage.getAccountUsageV2({account_id:u,...c})),{successLabel:`Loaded`})}};function h(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const g={command:`get_info_v1`,describe:`Returns high-level usage information for the account, including coverage, and subscription metadata.`,builder:h,handler:async s=>{if(s.dryRun){i({command:`cf billing usage get_info_v1`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/billable-usage/info`,pathParams:{},bodyKind:`none`});return}let c=await n(s),l=s.local?o:await t();s.accountId=l,r(await a(`Loading`,async()=>c.billing.usage.getInfoV1({account_id:l})),{successLabel:`Loaded`})}};function _(e){return e.option(`from`,{type:`string`,description:`Start date for the usage query (ISO 8601). The provided time range must include the subscription billing cycle anchor day, otherwise no usage data is returned. Use the info endpoint to retrieve the subscription anchor day.`}).option(`to`,{type:`string`,description:`End date for the usage query (ISO 8601).`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={command:`get_v1`,describe:`Returns billable usage data for the account. When no query parameters are provided, returns usage for the current billing period.`,builder:_,handler:async s=>{let c={from:s.from,to:s.to};if(s.dryRun){i({command:`cf billing usage get_v1`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/billable-usage`,pathParams:{},query:c,bodyKind:`none`});return}let l=await n(s),u=s.local?o:await t();s.accountId=u,r(await a(`Loading`,async()=>l.billing.usage.getV1({account_id:u,...c})),{successLabel:`Loaded`})}};function y(e){return e.option(`filter-by-metric-ids`,{type:`string`,array:!0,description:"Restrict results to rows whose `x_BillableMetricId` matches one of these billable metric ids (e.g. `workers_standard_requests`). Values must be unique."}).option(`filter-by-product-family-ids`,{type:`string`,array:!0,description:`Restrict results to billable metrics belonging to these product families. Values must be unique UUIDs.`}).option(`time-period-from`,{type:`string`,description:"Start of the range (ISO 8601). Required if `To` is set."}).option(`time-period-to`,{type:`string`,description:"End of the range (ISO 8601). Required if `From` is set. Must be after `From` and no more than 31 days after it."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Filter criteria for a usage query. Every field is optional; an empty object is equivalent to omitting the body entirely. Unknown fields are rejected.`})}const b={command:`query`,describe:"Returns cost and usage data for a single Cloudflare account, aligned with the [FinOps FOCUS v1.3](https://focus.finops.org/focus-specification/v1-3/) Cost and Usage dataset specification. This is the filterable counterpart to `GET` on the same path. It is a read-only operation and requires only the `#billing:read` permission; `POST` is used so that filter criteria can be supplied in a request body rather than in the query string. Each record represents one billable metric for one account on one day. This includes all metered usage, including usage that falls within free-tier allowances and may result in zero cost. **Note:** Cost and pricing fields are not yet populated and will be absent from responses until billing integration is complete. The request body is optional. When it is omitted, or when `TimePeriod` is omitted, the range defaults to the start of the current month through today. The maximum date range is 31 days. Filters are combined with AND. Filter values that do not match a known billable metric or product family simply match no usage, and the response is an empty result set.",builder:y,handler:async u=>{if(u.dryRun){i({command:`cf billing usage query`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/billable/usage`,pathParams:{},bodyKind:`json`,body:u.body===void 0?c({FilterBy:{MetricIds:u[`filter-by-metric-ids`],ProductFamilyIds:u[`filter-by-product-family-ids`]},TimePeriod:{From:l(u[`time-period-from`],`time-period-from`,`text`),To:l(u[`time-period-to`],`time-period-to`,`text`)}}):s(u.body)});return}let d=await n(u),f=u.local?o:await t();if(u.accountId=f,u.body){let e=s(u.body);r(await a(`Loading`,async()=>d.billing.usage.query({...e,account_id:f})),{successLabel:`Loaded`});return}let p=c({FilterBy:{MetricIds:u[`filter-by-metric-ids`],ProductFamilyIds:u[`filter-by-product-family-ids`]},TimePeriod:{From:l(u[`time-period-from`],`time-period-from`,`text`),To:l(u[`time-period-to`],`time-period-to`,`text`)}});r(await a(`Loading`,async()=>d.billing.usage.query({...p,account_id:f})),{successLabel:`Loaded`})}},x={command:`usage`,describe:`Operations for usage`,builder:e=>e.command(m).command(g).command(v).command(b).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},S={command:`billing`,describe:`Account billing profiles and usage data for Cloudflare subscriptions and add-on services`,builder:e=>e.command(f).command(x).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{S as default};
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+ import{D as e}from"./oauth-DBJ5GSFk.mjs";import{n as t}from"./auth-CZ0E51rF.mjs";import{t as n}from"./output-B6fBFRqe.mjs";import{n as r,t as i}from"./progress-O88q63Bk.mjs";import{n as a,t as o}from"./body-parser-BO6mfo_W.mjs";import{n as s}from"./input-validation-BwUR9z8e.mjs";import{n as c,r as l}from"./prompt-DTAWiEm2.mjs";function u(e){return e.option(`description`,{type:`string`,description:`The description field`}).option(`expression`,{type:`string`,description:`Wirefilter expression describing the traffic being reported.`}).option(`first-request-seen-at`,{type:`string`,description:`The first_request_seen_at field`}).option(`last-request-seen-at`,{type:`string`,description:`The last_request_seen_at field`}).option(`requests`,{type:`number`,description:`The requests field`}).option(`subtype`,{type:`string`,description:`The subtype field`}).option(`type`,{type:`string`,description:`Type of feedback report.`,choices:[`false_positive`,`false_negative`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const d={command:`create`,describe:"Submit a feedback report for the specified zone. Use `type` to indicate whether the report is a false positive (good traffic flagged as bot) or a false negative (bot traffic missed). Furthermore, you can also use `expression` as a wirefilter to identify the affected traffic sample. See more accepted API fields and expression types at https://developers.cloudflare.com/bots/concepts/feedback-loop/#api-fields and https://developers.cloudflare.com/bots/concepts/feedback-loop/#expression-fields, respectively.",builder:u,handler:async u=>{if(u.dryRun){r({command:`cf bot-management feedback create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${u.zone??u.zoneId??`<zone>`}/bot_management/feedback`,pathParams:{"zone-id":String(u.zone??u[`zone-id`]??``)},bodyKind:`json`,body:u.body===void 0?o({description:s(u.description,`description`,`text`),expression:s(u.expression,`expression`,`text`),first_request_seen_at:s(u[`first-request-seen-at`],`first-request-seen-at`,`text`),last_request_seen_at:s(u[`last-request-seen-at`],`last-request-seen-at`,`text`),requests:u.requests,subtype:s(u.subtype,`subtype`,`text`),type:s(u.type,`type`,`text`)}):a(u.body)});return}let d=await t(u),f=await e({zone:u.zone},d,{quiet:u.quiet});if(u.zoneId=f,u.body){let e=a(u.body);n(await i(`Creating`,async()=>d.botManagement.feedback.create({body:e,zone_id:f})),{successLabel:`Created`});return}if(u.description===void 0&&(u.description=await l(`description`,`The description field`)),u.expression===void 0&&(u.expression=await l(`expression`,`Wirefilter expression describing the traffic being reported.`)),u[`first-request-seen-at`]===void 0&&(u[`first-request-seen-at`]=await l(`first-request-seen-at`,`The first_request_seen_at field`)),u[`last-request-seen-at`]===void 0&&(u[`last-request-seen-at`]=await l(`last-request-seen-at`,`The last_request_seen_at field`)),u.requests===void 0)throw Error(`--requests is required (or pass --body with this field set).`);u.type===void 0&&(u.type=await c(`type`,`Type of feedback report.`,[`false_positive`,`false_negative`]));let p=o({description:s(u.description,`description`,`text`),expression:s(u.expression,`expression`,`text`),first_request_seen_at:s(u[`first-request-seen-at`],`first-request-seen-at`,`text`),last_request_seen_at:s(u[`last-request-seen-at`],`last-request-seen-at`,`text`),requests:u.requests,subtype:s(u.subtype,`subtype`,`text`),type:s(u.type,`type`,`text`)});n(await i(`Creating`,async()=>d.botManagement.feedback.create({body:p,zone_id:f})),{successLabel:`Created`})}};function f(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const p={command:`list`,describe:`Returns all feedback reports previously submitted for the specified zone. Feedback reports help improve detection by sharing samples of traffic that were misclassified as bots or humans.`,builder:f,handler:async a=>{if(a.dryRun){r({command:`cf bot-management feedback list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${a.zone??a.zoneId??`<zone>`}/bot_management/feedback`,pathParams:{"zone-id":String(a.zone??a[`zone-id`]??``)},bodyKind:`none`});return}let o=await t(a),s=await e({zone:a.zone},o,{quiet:a.quiet});a.zoneId=s,n(await i(`Loading`,async()=>o.botManagement.feedback.list({zone_id:s})),{successLabel:`Loaded`})}},m={command:`feedback`,describe:`Feedback operations`,builder:e=>e.command(d).command(p).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function h(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const g={command:`get`,describe:`Retrieve a zone's Bot Management Config`,builder:h,handler:async a=>{if(a.dryRun){r({command:`cf bot-management get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${a.zone??a.zoneId??`<zone>`}/bot_management`,pathParams:{"zone-id":String(a.zone??a[`zone-id`]??``)},bodyKind:`none`});return}let o=await t(a),s=await e({zone:a.zone},o,{quiet:a.quiet});a.zoneId=s,n(await i(`Loading`,async()=>o.botManagement.get({zone_id:s})),{successLabel:`Loaded`})}};function _(e){return e.option(`ai-bots-protection`,{type:`string`,description:`Enable rule to block AI Scrapers and Crawlers.`,choices:[`block`,`disabled`,`only_on_ad_pages`]}).option(`cf-robots-variant`,{type:`string`,description:`Specifies the Robots Access Control License variant to use.`,choices:[`off`,`policy_only`]}).option(`content-bots-protection`,{type:`string`,description:`Enable rule to block content bots. When enabled, blocks automated traffic with low bot scores, excluding safe verified bot categories. Exceptions should be managed via skip rules.`,choices:[`block`,`disabled`]}).option(`crawler-protection`,{type:`string`,description:`Enable rule to punish AI Scrapers and Crawlers via a link maze.`,choices:[`enabled`,`disabled`]}).option(`enable-js`,{type:`boolean`,description:`Use lightweight, invisible JavaScript detections to improve Bot Management. [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/).`}).option(`is-robots-txt-managed`,{type:`boolean`,description:`Enable cloudflare managed robots.txt. If an existing robots.txt is detected, then managed robots.txt will be prepended to the existing robots.txt.`}).option(`fight-mode`,{type:`boolean`,description:`Whether to enable Bot Fight Mode.`}).option(`stale-zone-configuration-optimize-wordpress`,{type:`boolean`,description:`Indicates that the zone's wordpress optimization for SBFM is turned on.`}).option(`stale-zone-configuration-sbfm-definitely-automated`,{type:`string`,description:`Indicates that the zone's definitely automated requests are being blocked or challenged.`}).option(`stale-zone-configuration-sbfm-likely-automated`,{type:`string`,description:`Indicates that the zone's likely automated requests are being blocked or challenged.`}).option(`stale-zone-configuration-sbfm-static-resource-protection`,{type:`string`,description:`Indicates that the zone's static resource protection is turned on.`}).option(`stale-zone-configuration-sbfm-verified-bots`,{type:`string`,description:`Indicates that the zone's verified bot requests are being blocked.`}).option(`stale-zone-configuration-suppress-session-score`,{type:`boolean`,description:`Indicates that the zone's session score tracking is disabled.`}).option(`stale-zone-configuration-fight-mode`,{type:`boolean`,description:`Indicates that the zone's Bot Fight Mode is turned on.`}).option(`optimize-wordpress`,{type:`boolean`,description:`Whether to optimize Super Bot Fight Mode protections for Wordpress.`}).option(`sbfm-definitely-automated`,{type:`string`,description:`Super Bot Fight Mode (SBFM) action to take on definitely automated requests.`,choices:[`allow`,`block`,`managed_challenge`]}).option(`sbfm-static-resource-protection`,{type:`boolean`,description:`Super Bot Fight Mode (SBFM) to enable static resource protection.
3
+ Enable if static resources on your application need bot protection.
4
+ Note: Static resource protection can also result in legitimate traffic being blocked.
5
+ `}).option(`sbfm-verified-bots`,{type:`string`,description:`Super Bot Fight Mode (SBFM) action to take on verified bots requests.`,choices:[`allow`,`block`]}).option(`sbfm-likely-automated`,{type:`string`,description:`Super Bot Fight Mode (SBFM) action to take on likely automated requests.`,choices:[`allow`,`block`,`managed_challenge`]}).option(`auto-update-model`,{type:`boolean`,description:`Automatically update to the newest bot detection models created by Cloudflare as they are released. [Learn more.](https://developers.cloudflare.com/bots/reference/machine-learning-models#model-versions-and-release-notes)`}).option(`bm-cookie-enabled`,{type:`boolean`,description:`Indicates that the bot management cookie can be placed on end user devices accessing the site. Defaults to true`}).option(`suppress-session-score`,{type:`boolean`,description:`Whether to disable tracking the highest bot score for a session in the Bot Management cookie.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const v={command:`update`,describe:'Updates the Bot Management configuration for a zone. This API is used to update: - **Bot Fight Mode** - **Super Bot Fight Mode** - **Bot Management for Enterprise** See [Bot Plans](https://developers.cloudflare.com/bots/plans/) for more information on the different plans \\ If you recently upgraded or downgraded your plan, refer to the following examples to clean up old configurations. Copy and paste the example body to remove old zone configurations based on your current plan. #### Clean up configuration for Bot Fight Mode plan ```json { "sbfm_likely_automated": "allow", "sbfm_definitely_automated": "allow", "sbfm_verified_bots": "allow", "sbfm_static_resource_protection": false, "optimize_wordpress": false, "suppress_session_score": false } ``` #### Clean up configuration for SBFM Pro plan ```json { "sbfm_likely_automated": "allow", "fight_mode": false } ``` #### Clean up configuration for SBFM Biz plan ```json { "fight_mode": false } ``` #### Clean up configuration for BM Enterprise Subscription plan It is strongly recommended that you ensure you have [custom rules](https://developers.cloudflare.com/waf/custom-rules/) in place to protect your zone before disabling the SBFM rules. Without these protections, your zone is vulnerable to attacks. ```json { "sbfm_likely_automated": "allow", "sbfm_definitely_automated": "allow", "sbfm_verified_bots": "allow", "sbfm_static_resource_protection": false, "optimize_wordpress": false, "fight_mode": false } ```',builder:_,handler:async c=>{if(c.dryRun){r({command:`cf bot-management update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${c.zone??c.zoneId??`<zone>`}/bot_management`,pathParams:{"zone-id":String(c.zone??c[`zone-id`]??``)},bodyKind:`json`,body:c.body===void 0?o({ai_bots_protection:s(c[`ai-bots-protection`],`ai-bots-protection`,`text`),cf_robots_variant:s(c[`cf-robots-variant`],`cf-robots-variant`,`text`),content_bots_protection:s(c[`content-bots-protection`],`content-bots-protection`,`text`),crawler_protection:s(c[`crawler-protection`],`crawler-protection`,`text`),enable_js:c[`enable-js`],is_robots_txt_managed:c[`is-robots-txt-managed`],fight_mode:c[`fight-mode`],stale_zone_configuration:{optimize_wordpress:c[`stale-zone-configuration-optimize-wordpress`],sbfm_definitely_automated:s(c[`stale-zone-configuration-sbfm-definitely-automated`],`stale-zone-configuration-sbfm-definitely-automated`,`text`),sbfm_likely_automated:s(c[`stale-zone-configuration-sbfm-likely-automated`],`stale-zone-configuration-sbfm-likely-automated`,`text`),sbfm_static_resource_protection:s(c[`stale-zone-configuration-sbfm-static-resource-protection`],`stale-zone-configuration-sbfm-static-resource-protection`,`text`),sbfm_verified_bots:s(c[`stale-zone-configuration-sbfm-verified-bots`],`stale-zone-configuration-sbfm-verified-bots`,`text`),suppress_session_score:c[`stale-zone-configuration-suppress-session-score`],fight_mode:c[`stale-zone-configuration-fight-mode`]},optimize_wordpress:c[`optimize-wordpress`],sbfm_definitely_automated:s(c[`sbfm-definitely-automated`],`sbfm-definitely-automated`,`text`),sbfm_static_resource_protection:c[`sbfm-static-resource-protection`],sbfm_verified_bots:s(c[`sbfm-verified-bots`],`sbfm-verified-bots`,`text`),sbfm_likely_automated:s(c[`sbfm-likely-automated`],`sbfm-likely-automated`,`text`),auto_update_model:c[`auto-update-model`],bm_cookie_enabled:c[`bm-cookie-enabled`],suppress_session_score:c[`suppress-session-score`]}):a(c.body)});return}let l=await t(c),u=await e({zone:c.zone},l,{quiet:c.quiet});if(c.zoneId=u,c.body){let e=a(c.body);n(await i(`Updating`,async()=>l.botManagement.update({body:e,zone_id:u})),{successLabel:`Updated`});return}let d=o({ai_bots_protection:s(c[`ai-bots-protection`],`ai-bots-protection`,`text`),cf_robots_variant:s(c[`cf-robots-variant`],`cf-robots-variant`,`text`),content_bots_protection:s(c[`content-bots-protection`],`content-bots-protection`,`text`),crawler_protection:s(c[`crawler-protection`],`crawler-protection`,`text`),enable_js:c[`enable-js`],is_robots_txt_managed:c[`is-robots-txt-managed`],fight_mode:c[`fight-mode`],stale_zone_configuration:{optimize_wordpress:c[`stale-zone-configuration-optimize-wordpress`],sbfm_definitely_automated:s(c[`stale-zone-configuration-sbfm-definitely-automated`],`stale-zone-configuration-sbfm-definitely-automated`,`text`),sbfm_likely_automated:s(c[`stale-zone-configuration-sbfm-likely-automated`],`stale-zone-configuration-sbfm-likely-automated`,`text`),sbfm_static_resource_protection:s(c[`stale-zone-configuration-sbfm-static-resource-protection`],`stale-zone-configuration-sbfm-static-resource-protection`,`text`),sbfm_verified_bots:s(c[`stale-zone-configuration-sbfm-verified-bots`],`stale-zone-configuration-sbfm-verified-bots`,`text`),suppress_session_score:c[`stale-zone-configuration-suppress-session-score`],fight_mode:c[`stale-zone-configuration-fight-mode`]},optimize_wordpress:c[`optimize-wordpress`],sbfm_definitely_automated:s(c[`sbfm-definitely-automated`],`sbfm-definitely-automated`,`text`),sbfm_static_resource_protection:c[`sbfm-static-resource-protection`],sbfm_verified_bots:s(c[`sbfm-verified-bots`],`sbfm-verified-bots`,`text`),sbfm_likely_automated:s(c[`sbfm-likely-automated`],`sbfm-likely-automated`,`text`),auto_update_model:c[`auto-update-model`],bm_cookie_enabled:c[`bm-cookie-enabled`],suppress_session_score:c[`suppress-session-score`]});n(await i(`Updating`,async()=>l.botManagement.update({body:d,zone_id:u})),{successLabel:`Updated`})}},y={command:`bot-management`,describe:`Bot detection and mitigation settings — configure bot scores, JavaScript detections, and challenge behavior`,builder:e=>e.command(g).command(v).command(m).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{y as default};
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import{O as e,w as t}from"./oauth-DBJ5GSFk.mjs";import{n}from"./auth-CZ0E51rF.mjs";import{t as r}from"./output-B6fBFRqe.mjs";import{n as i,t as a}from"./progress-O88q63Bk.mjs";import{t as o}from"./local-C6TLPAT6.mjs";import{t as s}from"./prompt-DTAWiEm2.mjs";import{t as c}from"./cli-types-CFw6Xygp.mjs";function l(e){return e.positional(`asn-id`,{type:`string`,description:`Asn ID`,demandOption:!0}).option(`date`,{type:`string`,description:`Date`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const u={command:`day-report <asn-id>`,describe:`Gets all the data the botnet tracking database has for a given ASN registered to user account for given date. If no date is given, it will return results for the previous day.`,builder:c(l),handler:async s=>{let c={date:s.date};if(s.dryRun){i({command:`cf botnet-feed asn day-report`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/botnet_feed/asn/${s[`asn-id`]==null?`<asn-id>`:encodeURIComponent(String(s[`asn-id`]))}/day_report`,pathParams:{"asn-id":String(s[`asn-id`]??``)},query:c,bodyKind:`none`});return}let l=await n(s),u=s.local?o:await t();s.accountId=u,r(await a(`Loading`,async()=>l.botnetFeed.asn.dayReport({account_id:u,asn_id:s[`asn-id`],...c})),{successLabel:`Loaded`})}};function d(e){return e.positional(`asn-id`,{type:`string`,description:`Asn ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const f={command:`full-report <asn-id>`,describe:`Gets all the data the botnet threat feed tracking database has for a given ASN registered to user account.`,builder:c(d),handler:async s=>{if(s.dryRun){i({command:`cf botnet-feed asn full-report`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/botnet_feed/asn/${s[`asn-id`]==null?`<asn-id>`:encodeURIComponent(String(s[`asn-id`]))}/full_report`,pathParams:{"asn-id":String(s[`asn-id`]??``)},bodyKind:`none`});return}let c=await n(s),l=s.local?o:await t();s.accountId=l,r(await a(`Loading`,async()=>c.botnetFeed.asn.fullReport({account_id:l,asn_id:s[`asn-id`]})),{successLabel:`Loaded`})}},p={command:`asn`,describe:`ASN-level botnet activity data showing networks with known C2 infrastructure`,builder:e=>e.command(u).command(f).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function m(e){return e.positional(`asn-id`,{type:`string`,description:`Asn ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const h={command:`delete <asn-id>`,describe:`Delete an ASN from botnet threat feed for a given user.`,builder:c(m),handler:async c=>{if(c.dryRun){i({command:`cf botnet-feed configs asn delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/botnet_feed/configs/asn/${c[`asn-id`]==null?`<asn-id>`:encodeURIComponent(String(c[`asn-id`]))}`,pathParams:{"asn-id":String(c[`asn-id`]??``)},bodyKind:`none`});return}let l=await n(c),u=c.local?o:await t();if(c.accountId=u,!await s({force:!!c.force})){process.stderr.write(`Aborted.
3
+ `);return}r(await a(`Deleting`,async()=>l.botnetFeed.configs.asn.delete({account_id:u,asn_id:c[`asn-id`]})),{successLabel:`Deleted`})}};function g(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const _={command:`get`,describe:`Gets a list of all ASNs registered for a user for the DDoS Botnet Feed API.`,builder:g,handler:async s=>{if(s.dryRun){i({command:`cf botnet-feed configs asn get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/botnet_feed/configs/asn`,pathParams:{},bodyKind:`none`});return}let c=await n(s),l=s.local?o:await t();s.accountId=l,r(await a(`Loading`,async()=>c.botnetFeed.configs.asn.get({account_id:l})),{successLabel:`Loaded`})}},v={command:`asn`,describe:`Botnet feed subscription configuration and notification preferences`,builder:e=>e.command(h).command(_).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},y={command:`configs`,describe:`Operations for configs`,builder:e=>e.command(v).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},b={command:`botnet-feed`,describe:`Botnet threat intelligence feeds — IP and ASN-level data on known command-and-control infrastructure`,builder:e=>e.command(p).command(y).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{b as default};
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import{O as e,w as t}from"./oauth-DBJ5GSFk.mjs";import{n}from"./auth-CZ0E51rF.mjs";import{t as r}from"./output-B6fBFRqe.mjs";import{n as i,t as a}from"./progress-O88q63Bk.mjs";import{t as o}from"./local-C6TLPAT6.mjs";import{n as s,t as c}from"./body-parser-BO6mfo_W.mjs";import{n as l}from"./input-validation-BwUR9z8e.mjs";import{r as u,t as d}from"./prompt-DTAWiEm2.mjs";import{t as f}from"./cli-types-CFw6Xygp.mjs";function p(e){return e.option(`show-historic`,{type:`string`,description:`Include scanned images without domain metadata (historic data). Default: false (only show images with domain)`}).option(`download`,{type:`string`,description:`If true, include base64-encoded image data in the response`}).option(`image-data`,{type:`string`,description:`Base64 encoded image data. Can include data URI prefix (e.g., 'data:image/png;base64,...') or just the base64 string.`}).option(`score-threshold`,{type:`number`,description:`Minimum similarity score threshold for matches (0-1, default: 0)`,default:0}).option(`top-k`,{type:`number`,description:`Number of closest matches to return (1-100, default: 10)`,default:10}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const m={command:`submit`,describe:`Submit an image and find the n closest matches from the scanned images index without creating any match records. Returns similarity scores and metadata for each match.`,builder:p,handler:async d=>{let f={showHistoric:d[`show-historic`],download:d.download};if(d.dryRun){i({command:`cf brand-protection submit`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/cloudforce-one/v2/brand-protection/logo/search`,pathParams:{},query:f,bodyKind:`json`,body:d.body===void 0?c({image_data:l(d[`image-data`],`image-data`,`text`),score_threshold:d[`score-threshold`],top_k:d[`top-k`]}):s(d.body)});return}let p=await n(d),m=d.local?o:await t();if(d.accountId=m,d.body){let e=s(d.body);new URLSearchParams(Object.entries(f).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),r(await a(`Creating`,async()=>p.brandProtection.submit({...e,account_id:m,...f})),{successLabel:`Created`});return}d[`image-data`]===void 0&&(d[`image-data`]=await u(`image-data`,`Base64 encoded image data. Can include data URI prefix (e.g., 'data:image/png;base64,...') or just the base64 string.`));let h=c({image_data:l(d[`image-data`],`image-data`,`text`),score_threshold:d[`score-threshold`],top_k:d[`top-k`]});new URLSearchParams(Object.entries(f).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),r(await a(`Creating`,async()=>p.brandProtection.submit({...h,account_id:m,...f})),{successLabel:`Created`})}};function h(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const g={command:`url-info`,describe:`Get the total number of saved brand protection queries (domain + logo) for an account`,builder:h,handler:async s=>{if(s.dryRun){i({command:`cf brand-protection url-info`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/cloudforce-one/v2/brand-protection/total-queries`,pathParams:{},bodyKind:`none`});return}let c=await n(s),l=s.local?o:await t();s.accountId=l,r(await a(`Loading`,async()=>c.brandProtection.urlInfo({account_id:l})),{successLabel:`Loaded`})}};function _(e){return e.option(`offset`,{type:`string`,description:`Offset`}).option(`limit`,{type:`string`,description:`Limit`}).option(`query-id`,{type:`string`,description:`Query ID`,demandOption:!0}).option(`download`,{type:`string`,description:`Download`}).option(`order-by`,{type:`string`,description:`Column to sort by. Options: 'matchedAt', 'domain', 'similarityScore', or 'registrar'`,choices:[`matchedAt`,`domain`,`similarityScore`,`registrar`]}).option(`order`,{type:`string`,description:`Sort order. Options: 'asc' (ascending) or 'desc' (descending)`,choices:[`asc`,`desc`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={command:`get`,describe:`Get paginated list of logo matches for a specific brand protection logo query`,builder:f(_),handler:async s=>{let c={offset:s.offset,limit:s.limit,query_id:s[`query-id`],download:s.download,orderBy:s[`order-by`],order:s.order};if(s.dryRun){i({command:`cf brand-protection v2 logo-matches get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/cloudforce-one/v2/brand-protection/logo/matches`,pathParams:{},query:c,bodyKind:`none`});return}let l=await n(s),u=s.local?o:await t();s.accountId=u,r(await a(`Loading`,async()=>l.brandProtection.v2.logoMatches.get({account_id:u,...c})),{successLabel:`Loaded`})}},y={command:`logo-matches`,describe:`Detected visual logo matches found on potentially infringing websites`,builder:e=>e.command(v).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function b(e){return e.option(`image-data`,{type:`string`,description:`Base64 encoded image data. Can include data URI prefix (e.g., 'data:image/png;base64,...') or just the base64 string.`}).option(`search-lookback`,{type:`boolean`,description:`If true, search historic scanned images for matches above the similarity threshold`,default:!0}).option(`similarity-threshold`,{type:`number`,description:`Minimum similarity score (0-1) required for visual matches`}).option(`tag`,{type:`string`,description:`Unique identifier for the logo query`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const x={command:`create`,describe:`Create a new saved brand protection logo query for visual similarity matching`,builder:b,handler:async d=>{if(d.dryRun){i({command:`cf brand-protection v2 logos create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/cloudforce-one/v2/brand-protection/logo/queries`,pathParams:{},bodyKind:`json`,body:d.body===void 0?c({image_data:l(d[`image-data`],`image-data`,`text`),search_lookback:d[`search-lookback`],similarity_threshold:d[`similarity-threshold`],tag:l(d.tag,`tag`,`text`)}):s(d.body)});return}let f=await n(d),p=d.local?o:await t();if(d.accountId=p,d.body){let e=s(d.body);r(await a(`Creating`,async()=>f.brandProtection.v2.logos.create({...e,account_id:p})),{successLabel:`Created`});return}if(d[`image-data`]===void 0&&(d[`image-data`]=await u(`image-data`,`Base64 encoded image data. Can include data URI prefix (e.g., 'data:image/png;base64,...') or just the base64 string.`)),d[`similarity-threshold`]===void 0)throw Error(`--similarity-threshold is required (or pass --body with this field set).`);d.tag===void 0&&(d.tag=await u(`tag`,`Unique identifier for the logo query`));let m=c({image_data:l(d[`image-data`],`image-data`,`text`),search_lookback:d[`search-lookback`],similarity_threshold:d[`similarity-threshold`],tag:l(d.tag,`tag`,`text`)});r(await a(`Creating`,async()=>f.brandProtection.v2.logos.create({...m,account_id:p})),{successLabel:`Created`})}};function S(e){return e.positional(`query-id`,{type:`string`,description:`Query ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const C={command:`delete <query-id>`,describe:`Delete a saved brand protection logo query. Returns 404 if the query ID doesn't exist.`,builder:S,handler:async s=>{if(s.dryRun){i({command:`cf brand-protection v2 logos delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/cloudforce-one/v2/brand-protection/logo/queries/${s[`query-id`]==null?`<query-id>`:encodeURIComponent(String(s[`query-id`]))}`,pathParams:{"query-id":String(s[`query-id`]??``)},bodyKind:`none`});return}let c=await n(s),l=s.local?o:await t();if(s.accountId=l,!await d({force:!!s.force})){process.stderr.write(`Aborted.
3
+ `);return}r(await a(`Deleting`,async()=>c.brandProtection.v2.logos.delete({account_id:l,query_id:s[`query-id`]})),{successLabel:`Deleted`})}};function w(e){return e.option(`id`,{type:`string`,description:`Optional query ID to retrieve a specific logo query`}).option(`download`,{type:`string`,description:`If true, include base64-encoded image data in the response`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const T={command:`get`,describe:`Get all saved brand protection logo queries for an account. Optionally specify id to get a single query. Set download=true to include base64-encoded image data.`,builder:w,handler:async s=>{let c={id:s.id,download:s.download};if(s.dryRun){i({command:`cf brand-protection v2 logos get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/cloudforce-one/v2/brand-protection/logo/queries`,pathParams:{},query:c,bodyKind:`none`});return}let l=await n(s),u=s.local?o:await t();s.accountId=u,r(await a(`Loading`,async()=>l.brandProtection.v2.logos.get({account_id:u,...c})),{successLabel:`Loaded`})}},E={command:`logos`,describe:`Brand monitoring queries that define search patterns for detecting brand abuse`,builder:e=>e.command(x).command(C).command(T).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function D(e){return e.option(`offset`,{type:`string`,description:`Offset`}).option(`limit`,{type:`string`,description:`Limit`}).option(`query-id`,{type:`string`,description:`Query ID or comma-separated list of Query IDs. When multiple IDs are provided, matches are deduplicated across queries and each match includes a match_details array with per-match query metadata and dismissed state.`,demandOption:!0}).option(`include-domain-id`,{type:`string`,description:`Include domain ID`}).option(`include-dismissed`,{type:`string`,description:`Include dismissed`}).option(`domain-search`,{type:`string`,description:`Filter matches by domain name (substring match)`}).option(`order-by`,{type:`string`,description:`Column to sort by. Options: 'domain', 'first_seen', or 'registrar'`,choices:[`domain`,`first_seen`,`registrar`]}).option(`order`,{type:`string`,description:`Sort order. Options: 'asc' (ascending) or 'desc' (descending)`,choices:[`asc`,`desc`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const O={command:`get`,describe:`Get paginated list of domain matches for one or more brand protection queries. When multiple query_ids are provided (comma-separated), matches are deduplicated across queries and each match includes a match_details array with per-match query metadata and individual dismissed state.`,builder:f(D),handler:async s=>{let c={offset:s.offset,limit:s.limit,query_id:s[`query-id`],include_domain_id:s[`include-domain-id`],include_dismissed:s[`include-dismissed`],domain_search:s[`domain-search`],orderBy:s[`order-by`],order:s.order};if(s.dryRun){i({command:`cf brand-protection v2 matches get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/cloudforce-one/v2/brand-protection/domain/matches`,pathParams:{},query:c,bodyKind:`none`});return}let l=await n(s),u=s.local?o:await t();s.accountId=u,r(await a(`Loading`,async()=>l.brandProtection.v2.matches.get({account_id:u,...c})),{successLabel:`Loaded`})}},k={command:`matches`,describe:`Detected brand abuse matches from monitoring queries with evidence downloads`,builder:e=>e.command(O).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function A(e){return e.option(`id`,{type:`string`,description:`ID`}).option(`page`,{type:`number`,description:`Optional page number for paginated list requests. Defaults to 1 when only per_page is supplied. Omit page and per_page to preserve the legacy full-list response.`}).option(`per-page`,{type:`number`,description:`Optional number of queries per page for paginated list requests. Defaults to 100 when only page is supplied. Maximum 100. Omit page and per_page to preserve the legacy full-list response.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const j={command:`get`,describe:`Get all saved brand protection queries for an account`,builder:A,handler:async s=>{let c={id:s.id,page:s.page,per_page:s[`per-page`]};if(s.dryRun){i({command:`cf brand-protection v2 queries get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/cloudforce-one/v2/brand-protection/domain/queries`,pathParams:{},query:c,bodyKind:`none`});return}let l=await n(s),u=s.local?o:await t();s.accountId=u,r(await a(`Loading`,async()=>l.brandProtection.v2.queries.get({account_id:u,...c})),{successLabel:`Loaded`})}},M={command:`queries`,describe:`Brand monitoring queries that define search patterns for detecting brand abuse`,builder:e=>e.command(j).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},N={command:`v2`,describe:`Operations for v2`,builder:e=>e.command(y).command(E).command(k).command(M).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},P={command:`brand-protection`,describe:`Monitor the Internet for phishing sites, lookalike domains, and unauthorized use of your brand assets`,builder:e=>e.command(m).command(g).command(N).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{P as default};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ const e={command:`brands`,describe:`brands`,builder:e=>e.demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{e as default};
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import{O as e,w as t}from"./oauth-DBJ5GSFk.mjs";import{n}from"./auth-CZ0E51rF.mjs";import{t as r}from"./output-B6fBFRqe.mjs";import{n as i,t as a}from"./progress-O88q63Bk.mjs";import{t as o}from"./local-C6TLPAT6.mjs";import{n as s,t as c}from"./body-parser-BO6mfo_W.mjs";import{n as l}from"./input-validation-BwUR9z8e.mjs";import{r as u,t as d}from"./prompt-DTAWiEm2.mjs";function f(e){return e.option(`config-min-extension-version`,{type:`string`,description:`Minimum required browser extension version.`}).option(`config-mode`,{type:`string`,description:`The config.mode field`,choices:[`proxy`],default:`proxy`}).option(`config-proxy-url`,{type:`string`,description:`PAC script URL for proxy configuration.`}).option(`config-team-domain`,{type:`string`,description:`Team domain for the browser extension.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const p={command:`create`,describe:`Creates the browser extension configuration for an account.`,builder:f,handler:async d=>{if(d.dryRun){i({command:`cf browser-extension config create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/browser-extension/config`,pathParams:{},bodyKind:`json`,body:d.body===void 0?c({config:{min_extension_version:l(d[`config-min-extension-version`],`config-min-extension-version`,`text`),mode:l(d[`config-mode`],`config-mode`,`text`),proxy_url:l(d[`config-proxy-url`],`config-proxy-url`,`text`),team_domain:l(d[`config-team-domain`],`config-team-domain`,`text`)}}):s(d.body)});return}let f=await n(d),p=d.local?o:await t();if(d.accountId=p,d.body){let e=s(d.body);r(await a(`Creating`,async()=>f.browserExtension.config.create({...e,account_id:p})),{successLabel:`Created`});return}d[`config-proxy-url`]===void 0&&(d[`config-proxy-url`]=await u(`config-proxy-url`,`PAC script URL for proxy configuration.`)),d[`config-team-domain`]===void 0&&(d[`config-team-domain`]=await u(`config-team-domain`,`Team domain for the browser extension.`));let m=c({config:{min_extension_version:l(d[`config-min-extension-version`],`config-min-extension-version`,`text`),mode:l(d[`config-mode`],`config-mode`,`text`),proxy_url:l(d[`config-proxy-url`],`config-proxy-url`,`text`),team_domain:l(d[`config-team-domain`],`config-team-domain`,`text`)}});r(await a(`Creating`,async()=>f.browserExtension.config.create({...m,account_id:p})),{successLabel:`Created`})}};function m(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const h={command:`delete`,describe:`Deletes the browser extension configuration for an account. The shard mapping is preserved and not deleted.`,builder:m,handler:async s=>{if(s.dryRun){i({command:`cf browser-extension config delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/browser-extension/config`,pathParams:{},bodyKind:`none`});return}let c=await n(s),l=s.local?o:await t();if(s.accountId=l,!await d({force:!!s.force})){process.stderr.write(`Aborted.
3
+ `);return}r(await a(`Deleting`,async()=>c.browserExtension.config.delete({account_id:l})),{successLabel:`Deleted`})}};function g(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const _={command:`get`,describe:`Returns the browser extension configuration for an account.`,builder:g,handler:async s=>{if(s.dryRun){i({command:`cf browser-extension config get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/browser-extension/config`,pathParams:{},bodyKind:`none`});return}let c=await n(s),l=s.local?o:await t();s.accountId=l,r(await a(`Loading`,async()=>c.browserExtension.config.get({account_id:l})),{successLabel:`Loaded`})}};function v(e){return e.option(`config-min-extension-version`,{type:`string`,description:`Minimum required browser extension version.`}).option(`config-mode`,{type:`string`,description:`The config.mode field`,choices:[`proxy`]}).option(`config-proxy-url`,{type:`string`,description:`PAC script URL for proxy configuration.`}).option(`config-team-domain`,{type:`string`,description:`Team domain for the browser extension.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const y={command:`update`,describe:`Replaces the browser extension configuration for an account. The configuration must already exist. The shard mapping is immutable.`,builder:v,handler:async d=>{if(d.dryRun){i({command:`cf browser-extension config update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/browser-extension/config`,pathParams:{},bodyKind:`json`,body:d.body===void 0?c({config:{min_extension_version:l(d[`config-min-extension-version`],`config-min-extension-version`,`text`),mode:l(d[`config-mode`],`config-mode`,`text`),proxy_url:l(d[`config-proxy-url`],`config-proxy-url`,`text`),team_domain:l(d[`config-team-domain`],`config-team-domain`,`text`)}}):s(d.body)});return}let f=await n(d),p=d.local?o:await t();if(d.accountId=p,d.body){let e=s(d.body);r(await a(`Updating`,async()=>f.browserExtension.config.update({...e,account_id:p})),{successLabel:`Updated`});return}d[`config-proxy-url`]===void 0&&(d[`config-proxy-url`]=await u(`config-proxy-url`,`PAC script URL for proxy configuration.`)),d[`config-team-domain`]===void 0&&(d[`config-team-domain`]=await u(`config-team-domain`,`Team domain for the browser extension.`));let m=c({config:{min_extension_version:l(d[`config-min-extension-version`],`config-min-extension-version`,`text`),mode:l(d[`config-mode`],`config-mode`,`text`),proxy_url:l(d[`config-proxy-url`],`config-proxy-url`,`text`),team_domain:l(d[`config-team-domain`],`config-team-domain`,`text`)}});r(await a(`Updating`,async()=>f.browserExtension.config.update({...m,account_id:p})),{successLabel:`Updated`})}},b={command:`config`,describe:`Operations for config`,builder:e=>e.command(p).command(h).command(_).command(y).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},x={command:`browser-extension`,describe:`browser-extension`,builder:e=>e.command(b).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{x as default};
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import{O as e,w as t}from"./oauth-DBJ5GSFk.mjs";import{i as n,n as r}from"./auth-CZ0E51rF.mjs";import{t as i}from"./output-B6fBFRqe.mjs";import{n as a,t as o}from"./progress-O88q63Bk.mjs";import{t as s}from"./local-C6TLPAT6.mjs";import{n as c,r as l,t as u}from"./body-parser-BO6mfo_W.mjs";import{n as d}from"./input-validation-BwUR9z8e.mjs";import{t as f}from"./prompt-DTAWiEm2.mjs";import{t as p}from"./cli-types-CFw6Xygp.mjs";import{n as m,t as h}from"./raw-fetch-DgezeshQ.mjs";function g(e){return e.option(`cache-ttl`,{type:`number`,description:`Cache TTL default is 5s. Set to 0 to disable.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const _={command:`create`,describe:"Starts a crawl job for the provided URL and its children. Check available options like `gotoOptions` and `waitFor*` to control page load behaviour.",builder:g,handler:async l=>{let u={cacheTTL:l[`cache-ttl`]};if(l.dryRun){a({command:`cf browser-run crawl create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/browser-rendering/crawl`,pathParams:{},query:u,bodyKind:`json`,body:l.body===void 0?void 0:c(l.body)});return}let d=await r(l),f=l.local?s:await t();if(l.accountId=f,l.body){let e=c(l.body);new URLSearchParams(Object.entries(u).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),i(await o(`Creating`,async()=>d.browserRun.crawl.create({body:e,account_id:f,...u})),{successLabel:`Created`});return}i(await o(`Creating`,async()=>n(d,`POST`,`/accounts/${f}/browser-rendering/crawl`,{query:u})),{successLabel:`Created`})}};function ee(e){return e.positional(`job-id`,{type:`string`,description:`The ID of the crawl job to cancel.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const v={command:`delete <job-id>`,describe:`Cancels an ongoing crawl job by setting its status to cancelled and stopping all queued URLs.`,builder:ee,handler:async n=>{if(n.dryRun){a({command:`cf browser-run crawl delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/browser-rendering/crawl/${n[`job-id`]==null?`<job-id>`:encodeURIComponent(String(n[`job-id`]))}`,pathParams:{"job-id":String(n[`job-id`]??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();if(n.accountId=l,!await f({force:!!n.force})){process.stderr.write(`Aborted.
3
+ `);return}i(await o(`Deleting`,async()=>c.browserRun.crawl.delete({account_id:l,job_id:n[`job-id`]})),{successLabel:`Deleted`})}};function y(e){return e.positional(`job-id`,{type:`string`,description:`Crawl job ID.`,demandOption:!0}).option(`cache-ttl`,{type:`number`,description:`Cache TTL default is 5s. Set to 0 to disable.`}).option(`status`,{type:`string`,description:`Filter by URL status.`,choices:[`queued`,`errored`,`completed`,`disallowed`,`skipped`,`cancelled`]}).option(`cursor`,{type:`number`,description:`Cursor for pagination.`}).option(`limit`,{type:`number`,description:`Limit for pagination.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const b={command:`get <job-id>`,describe:`Returns the result of a crawl job.`,builder:p(y),handler:async n=>{let c={cacheTTL:n[`cache-ttl`],status:n.status,cursor:n.cursor,limit:n.limit};if(n.dryRun){a({command:`cf browser-run crawl get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/browser-rendering/crawl/${n[`job-id`]==null?`<job-id>`:encodeURIComponent(String(n[`job-id`]))}`,pathParams:{"job-id":String(n[`job-id`]??``)},query:c,bodyKind:`none`});return}let l=await r(n),u=n.local?s:await t();n.accountId=u,i(await o(`Loading`,async()=>l.browserRun.crawl.get({account_id:u,job_id:n[`job-id`],...c})),{successLabel:`Loaded`})}},x={command:`crawl`,describe:`Operations for crawl`,builder:e=>e.command(_).command(v).command(b).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function S(e){return e.positional(`session-id`,{type:`string`,description:`Browser session ID to connect to.`,demandOption:!0}).option(`keep-alive`,{type:`number`,description:`Keep-alive time in ms (only valid when acquiring new session).`}).option(`lab`,{type:`boolean`,description:`Use experimental browser.`}).option(`recording`,{type:`boolean`,description:`Recording`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const C={command:`connect <session-id>`,describe:`Establishes a WebSocket connection to an existing browser session.`,builder:S,handler:async n=>{let c={keep_alive:n[`keep-alive`],lab:n.lab,recording:n.recording};if(n.dryRun){a({command:`cf browser-run devtools browser connect`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/browser-rendering/devtools/browser/${n[`session-id`]==null?`<session-id>`:encodeURIComponent(String(n[`session-id`]))}`,pathParams:{"session-id":String(n[`session-id`]??``)},query:c,bodyKind:`none`});return}let l=await r(n),u=n.local?s:await t();n.accountId=u,i(await o(`Loading`,async()=>l.browserRun.devtools.browser.connect({account_id:u,session_id:n[`session-id`],...c})),{successLabel:`Loaded`})}};function w(e){return e.option(`keep-alive`,{type:`number`,description:`Keep-alive time in milliseconds.`}).option(`lab`,{type:`boolean`,description:`Use experimental browser.`}).option(`targets`,{type:`boolean`,description:`Include browser targets in response.`}).option(`live-view-url-expires-in-ms`,{type:`number`,description:`How long the live view URL remains valid, in milliseconds (max 60 minutes). Only used when targets is true.`}).option(`recording`,{type:`boolean`,description:`Recording`}).option(`guardrails-allowed-domain-sets`,{type:`string`,array:!0,description:`Max 4 entries: curated preset names (common-cdns) and/or https URLs of newline-separated hostname lists.`}).option(`guardrails-allowed-domains`,{type:`string`,array:!0,description:`Hostname patterns, max 50. Supports exact hosts (example.com) or a single * wildcard anywhere. Prefer *.example.com (subdomain wildcard) over *example.com (prefix wildcard) to avoid matching overbroad lookalikes like evilexample.com.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const T={command:`create`,describe:`Acquires a browser and returns its session ID and websocket URL. Optionally accepts a JSON body with session guardrails to restrict outbound HTTP/S traffic.`,builder:w,handler:async n=>{let l={keep_alive:n[`keep-alive`],lab:n.lab,targets:n.targets,liveViewUrlExpiresInMs:n[`live-view-url-expires-in-ms`],recording:n.recording};if(n.dryRun){a({command:`cf browser-run devtools browser create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/browser-rendering/devtools/browser`,pathParams:{},query:l,bodyKind:`json`,body:n.body===void 0?u({guardrails:{allowedDomainSets:n[`guardrails-allowed-domain-sets`],allowedDomains:n[`guardrails-allowed-domains`]}}):c(n.body)});return}let d=await r(n),f=n.local?s:await t();if(n.accountId=f,n.body){let e=c(n.body);new URLSearchParams(Object.entries(l).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),i(await o(`Creating`,async()=>d.browserRun.devtools.browser.create({...e,account_id:f,...l})),{successLabel:`Created`});return}let p=u({guardrails:{allowedDomainSets:n[`guardrails-allowed-domain-sets`],allowedDomains:n[`guardrails-allowed-domains`]}});new URLSearchParams(Object.entries(l).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),i(await o(`Creating`,async()=>d.browserRun.devtools.browser.create({...p,account_id:f,...l})),{successLabel:`Created`})}};function E(e){return e.positional(`session-id`,{type:`string`,description:`Browser session ID to close.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const D={command:`delete <session-id>`,describe:`Closes an existing browser session.`,builder:E,handler:async n=>{if(n.dryRun){a({command:`cf browser-run devtools browser delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/browser-rendering/devtools/browser/${n[`session-id`]==null?`<session-id>`:encodeURIComponent(String(n[`session-id`]))}`,pathParams:{"session-id":String(n[`session-id`]??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();if(n.accountId=l,!await f({force:!!n.force})){process.stderr.write(`Aborted.
4
+ `);return}i(await o(`Deleting`,async()=>c.browserRun.devtools.browser.delete({account_id:l,session_id:n[`session-id`]})),{successLabel:`Deleted`})}};function O(e){return e.option(`keep-alive`,{type:`number`,description:`Keep-alive time in ms (only valid when acquiring new session).`}).option(`lab`,{type:`boolean`,description:`Use experimental browser.`}).option(`recording`,{type:`boolean`,description:`Recording`}).option(`cf-brapi-guardrails`,{type:`string`,description:`Optional base64url-encoded JSON session guardrails (allowedDomains and allowedDomainSets)`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const k={command:`launch`,describe:'Acquires and establishes a WebSocket connection to a browser session. Session guardrails may be supplied in the `cf-brapi-guardrails` header as base64url-encoded JSON of the same `guardrails` object the POST body accepts (for example `{"allowedDomains":["*.example.com"]}`).',builder:O,handler:async c=>{let l={keep_alive:c[`keep-alive`],lab:c.lab,recording:c.recording},u={};if(c[`cf-brapi-guardrails`]!==void 0&&(u[`cf-brapi-guardrails`]=String(c[`cf-brapi-guardrails`])),c.dryRun){a({command:`cf browser-run devtools browser launch`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/browser-rendering/devtools/browser`,pathParams:{},query:l,bodyKind:`none`});return}let d=await r(c),f=c.local?s:await t();c.accountId=f,i(await o(`Loading`,async()=>n(d,`GET`,`/accounts/${f}/browser-rendering/devtools/browser`,{query:l,headers:Object.keys(u).length>0?u:void 0})),{successLabel:`Loaded`})}};function A(e){return e.positional(`target-id`,{type:`string`,description:`Target ID, e.g. page ID.`,demandOption:!0}).option(`session-id`,{type:`string`,description:`Browser session ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const j={command:`get <target-id>`,describe:`Establishes a WebSocket connection to a specific Chrome DevTools target or page.`,builder:A,handler:async n=>{if(n.dryRun){a({command:`cf browser-run devtools browser page get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/browser-rendering/devtools/browser/${n[`session-id`]==null?`<session-id>`:encodeURIComponent(String(n[`session-id`]))}/page/${n[`target-id`]==null?`<target-id>`:encodeURIComponent(String(n[`target-id`]))}`,pathParams:{"session-id":String(n[`session-id`]??``),"target-id":String(n[`target-id`]??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();n.accountId=l,i(await o(`Loading`,async()=>c.browserRun.devtools.browser.page.get({account_id:l,session_id:n[`session-id`],target_id:n[`target-id`]})),{successLabel:`Loaded`})}},M={command:`page`,describe:`Operations for devtools.browser.page`,builder:e=>e.command(j).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function N(e){return e.positional(`session-id`,{type:`string`,description:`Browser session ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const P={command:`protocol <session-id>`,describe:`Returns the complete Chrome DevTools Protocol schema including all domains, commands, events, and types. This schema describes the entire CDP API surface.`,builder:N,handler:async n=>{if(n.dryRun){a({command:`cf browser-run devtools browser protocol`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/browser-rendering/devtools/browser/${n[`session-id`]==null?`<session-id>`:encodeURIComponent(String(n[`session-id`]))}/json/protocol`,pathParams:{"session-id":String(n[`session-id`]??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();n.accountId=l,i(await o(`Loading`,async()=>c.browserRun.devtools.browser.protocol({account_id:l,session_id:n[`session-id`]})),{successLabel:`Loaded`})}};function F(e){return e.positional(`target-id`,{type:`string`,description:`Target ID to activate.`,demandOption:!0}).option(`session-id`,{type:`string`,description:`Browser session ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const I={command:`activate <target-id>`,describe:`Activates (brings to front) a specific browser target by its ID.`,builder:F,handler:async n=>{if(n.dryRun){a({command:`cf browser-run devtools browser targets activate`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/browser-rendering/devtools/browser/${n[`session-id`]==null?`<session-id>`:encodeURIComponent(String(n[`session-id`]))}/json/activate/${n[`target-id`]==null?`<target-id>`:encodeURIComponent(String(n[`target-id`]))}`,pathParams:{"session-id":String(n[`session-id`]??``),"target-id":String(n[`target-id`]??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();n.accountId=l,i(await o(`Loading`,async()=>c.browserRun.devtools.browser.targets.activate({account_id:l,session_id:n[`session-id`],target_id:n[`target-id`]})),{successLabel:`Loaded`})}};function L(e){return e.positional(`target-id`,{type:`string`,description:`Target ID to close.`,demandOption:!0}).option(`session-id`,{type:`string`,description:`Browser session ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const R={command:`close <target-id>`,describe:`Closes a specific browser target (tab, page, etc.) by its ID. Returns 'Target is closing' on success or an error if the target is not found.`,builder:L,handler:async n=>{if(n.dryRun){a({command:`cf browser-run devtools browser targets close`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/browser-rendering/devtools/browser/${n[`session-id`]==null?`<session-id>`:encodeURIComponent(String(n[`session-id`]))}/json/close/${n[`target-id`]==null?`<target-id>`:encodeURIComponent(String(n[`target-id`]))}`,pathParams:{"session-id":String(n[`session-id`]??``),"target-id":String(n[`target-id`]??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();n.accountId=l,i(await o(`Loading`,async()=>c.browserRun.devtools.browser.targets.close({account_id:l,session_id:n[`session-id`],target_id:n[`target-id`]})),{successLabel:`Loaded`})}};function z(e){return e.positional(`session-id`,{type:`string`,description:`Browser session ID.`,demandOption:!0}).option(`url`,{type:`string`,description:`Url`}).option(`live-view-url-expires-in-ms`,{type:`number`,description:`How long the live view URL remains valid, in milliseconds (max 60 minutes)`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const B={command:`create <session-id>`,describe:`Opens a new tab in the browser. Optionally specify a URL to navigate to.`,builder:z,handler:async n=>{let c={url:n.url,liveViewUrlExpiresInMs:n[`live-view-url-expires-in-ms`]};if(n.dryRun){a({command:`cf browser-run devtools browser targets create`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/browser-rendering/devtools/browser/${n[`session-id`]==null?`<session-id>`:encodeURIComponent(String(n[`session-id`]))}/json/new`,pathParams:{"session-id":String(n[`session-id`]??``)},query:c,bodyKind:`none`});return}let l=await r(n),u=n.local?s:await t();n.accountId=u,i(await o(`Updating`,async()=>l.browserRun.devtools.browser.targets.create({account_id:u,session_id:n[`session-id`],...c})),{successLabel:`Updated`})}};function V(e){return e.positional(`target-id`,{type:`string`,description:`Target ID.`,demandOption:!0}).option(`session-id`,{type:`string`,description:`Browser session ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const H={command:`get <target-id>`,describe:`Returns the debuggable target with the given ID.`,builder:V,handler:async n=>{if(n.dryRun){a({command:`cf browser-run devtools browser targets get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/browser-rendering/devtools/browser/${n[`session-id`]==null?`<session-id>`:encodeURIComponent(String(n[`session-id`]))}/json/list/${n[`target-id`]==null?`<target-id>`:encodeURIComponent(String(n[`target-id`]))}`,pathParams:{"session-id":String(n[`session-id`]??``),"target-id":String(n[`target-id`]??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();n.accountId=l,i(await o(`Loading`,async()=>c.browserRun.devtools.browser.targets.get({account_id:l,session_id:n[`session-id`],target_id:n[`target-id`]})),{successLabel:`Loaded`})}};function U(e){return e.option(`session-id`,{type:`string`,description:`Browser session ID.`,demandOption:!0}).option(`live-view-url-expires-in-ms`,{type:`number`,description:`How long the live view URLs remain valid, in milliseconds (max 60 minutes)`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const W={command:`list`,describe:`Returns a list of all debuggable targets including tabs, pages, service workers, and other browser contexts.`,builder:U,handler:async n=>{let c={liveViewUrlExpiresInMs:n[`live-view-url-expires-in-ms`]};if(n.dryRun){a({command:`cf browser-run devtools browser targets list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/browser-rendering/devtools/browser/${n[`session-id`]==null?`<session-id>`:encodeURIComponent(String(n[`session-id`]))}/json/list`,pathParams:{"session-id":String(n[`session-id`]??``)},query:c,bodyKind:`none`});return}let l=await r(n),u=n.local?s:await t();n.accountId=u,i(await o(`Loading`,async()=>l.browserRun.devtools.browser.targets.list({account_id:u,session_id:n[`session-id`],...c})),{successLabel:`Loaded`})}},G={command:`targets`,describe:`Operations for devtools.browser.targets`,builder:e=>e.command(I).command(R).command(B).command(H).command(W).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function te(e){return e.positional(`session-id`,{type:`string`,description:`Browser session ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const K={command:`version <session-id>`,describe:`Get browser version metadata.`,builder:te,handler:async n=>{if(n.dryRun){a({command:`cf browser-run devtools browser version`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/browser-rendering/devtools/browser/${n[`session-id`]==null?`<session-id>`:encodeURIComponent(String(n[`session-id`]))}/json/version`,pathParams:{"session-id":String(n[`session-id`]??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();n.accountId=l,i(await o(`Loading`,async()=>c.browserRun.devtools.browser.version({account_id:l,session_id:n[`session-id`]})),{successLabel:`Loaded`})}},q={command:`browser`,describe:`Operations for devtools.browser`,builder:e=>e.command(C).command(T).command(D).command(k).command(P).command(K).command(M).command(G).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function J(e){return e.positional(`session-id`,{type:`string`,description:`Browser session ID.`,demandOption:!0}).option(`live-view-url-expires-in-ms`,{type:`number`,description:`How long the live view URLs remain valid, in milliseconds (max 60 minutes)`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Y={command:`get <session-id>`,describe:`Returns a list of all debuggable targets including tabs, pages, service workers, and other browser contexts.`,builder:J,handler:async n=>{let c={liveViewUrlExpiresInMs:n[`live-view-url-expires-in-ms`]};if(n.dryRun){a({command:`cf browser-run devtools json get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/browser-rendering/devtools/browser/${n[`session-id`]==null?`<session-id>`:encodeURIComponent(String(n[`session-id`]))}/json`,pathParams:{"session-id":String(n[`session-id`]??``)},query:c,bodyKind:`none`});return}let l=await r(n),u=n.local?s:await t();n.accountId=u,i(await o(`Loading`,async()=>l.browserRun.devtools.json.get({account_id:u,session_id:n[`session-id`],...c})),{successLabel:`Loaded`})}},X={command:`json`,describe:`Operations for devtools.json`,builder:e=>e.command(Y).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Z(e){return e.positional(`session-id`,{type:`string`,description:`Session ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Q={command:`get <session-id>`,describe:`Get details for a specific browser session.`,builder:Z,handler:async n=>{if(n.dryRun){a({command:`cf browser-run devtools session get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/browser-rendering/devtools/session/${n[`session-id`]==null?`<session-id>`:encodeURIComponent(String(n[`session-id`]))}`,pathParams:{"session-id":String(n[`session-id`]??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();n.accountId=l,i(await o(`Loading`,async()=>c.browserRun.devtools.session.get({account_id:l,session_id:n[`session-id`]})),{successLabel:`Loaded`})}};function ne(e){return e.option(`limit`,{type:`number`,description:`Limit`}).option(`offset`,{type:`number`,description:`Offset`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const re={command:`list`,describe:`List active browser sessions.`,builder:ne,handler:async n=>{let c={limit:n.limit,offset:n.offset};if(n.dryRun){a({command:`cf browser-run devtools session list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/browser-rendering/devtools/session`,pathParams:{},query:c,bodyKind:`none`});return}let l=await r(n),u=n.local?s:await t();n.accountId=u,i(await o(`Loading`,async()=>l.browserRun.devtools.session.list({account_id:u,...c})),{successLabel:`Loaded`})}},ie={command:`session`,describe:`Operations for devtools.session`,builder:e=>e.command(Q).command(re).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},ae={command:`devtools`,describe:`Operations for devtools`,builder:e=>e.command(q).command(X).command(ie).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function oe(e){return e.option(`cache-ttl`,{type:`number`,description:`Cache TTL default is 5s. Set to 0 to disable.`}).option(`action-timeout`,{type:`number`,description:`The maximum duration allowed for the browser action to complete after the page has loaded (such as taking screenshots, extracting content, or generating PDFs). If this time limit is exceeded, the action stops and returns a timeout error.`}).option(`allow-request-pattern`,{type:`string`,array:!0,description:`Only allow requests that match the provided regex patterns, eg. '/^.*\\.(css)'. Reject rules are applied first.`}).option(`authenticate-password`,{type:`string`,description:`The authenticate.password field`}).option(`authenticate-username`,{type:`string`,description:`The authenticate.username field`}).option(`best-attempt`,{type:`boolean`,description:`Attempt to proceed when 'awaited' events fail or timeout.`}).option(`emulate-media-type`,{type:`string`,description:`The emulateMediaType field`}).option(`goto-options-referer`,{type:`string`,description:`The gotoOptions.referer field`}).option(`goto-options-referrer-policy`,{type:`string`,description:`The gotoOptions.referrerPolicy field`}).option(`goto-options-timeout`,{type:`number`,description:`The gotoOptions.timeout field`,default:3e4}).option(`html`,{type:`string`,description:"Set the content of the page, eg: `<h1>Hello World!!</h1>`. Either `html` or `url` must be set."}).option(`interesting-only`,{type:`boolean`,description:`The interestingOnly field`}).option(`reject-request-pattern`,{type:`string`,array:!0,description:`Block undesired requests that match the provided regex patterns, eg. '/^.*\\.(css)'.`}).option(`root`,{type:`string`,description:`The root field`}).option(`set-java-script-enabled`,{type:`boolean`,description:`The setJavaScriptEnabled field`}).option(`url`,{type:`string`,description:"URL to navigate to, eg. `https://example.com`."}).option(`user-agent`,{type:`string`,description:`The userAgent field`,default:`Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36`}).option(`viewport-device-scale-factor`,{type:`number`,description:`The viewport.deviceScaleFactor field`}).option(`viewport-has-touch`,{type:`boolean`,description:`The viewport.hasTouch field`}).option(`viewport-height`,{type:`number`,description:`The viewport.height field`}).option(`viewport-is-landscape`,{type:`boolean`,description:`The viewport.isLandscape field`}).option(`viewport-is-mobile`,{type:`boolean`,description:`The viewport.isMobile field`}).option(`viewport-width`,{type:`number`,description:`The viewport.width field`}).option(`wait-for-selector-hidden`,{type:`boolean`,description:`The waitForSelector.hidden field`}).option(`wait-for-selector-selector`,{type:`string`,description:`The waitForSelector.selector field`}).option(`wait-for-selector-timeout`,{type:`number`,description:`The waitForSelector.timeout field`}).option(`wait-for-selector-visible`,{type:`boolean`,description:`The waitForSelector.visible field`}).option(`wait-for-timeout`,{type:`number`,description:`Waits for a specified timeout before continuing.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).check(e=>{if([`authenticate-password`,`authenticate-username`].some(t=>e[t]!==void 0)){let t=[`authenticate-password`,`authenticate-username`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --authenticate-* flag is set`)}return!0}).check(e=>{if([`viewport-device-scale-factor`,`viewport-has-touch`,`viewport-height`,`viewport-is-landscape`,`viewport-is-mobile`,`viewport-width`].some(t=>e[t]!==void 0)){let t=[`viewport-height`,`viewport-width`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --viewport-* flag is set`)}return!0}).check(e=>{if([`wait-for-selector-hidden`,`wait-for-selector-selector`,`wait-for-selector-timeout`,`wait-for-selector-visible`].some(t=>e[t]!==void 0)){let t=[`wait-for-selector-selector`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --waitForSelector-* flag is set`)}return!0})}const se={command:`accessibility-tree`,describe:"Returns the page's accessibility tree. Use `interestingOnly` to only return semantically meaningful nodes; use `root` to scope the tree to a CSS-selector-anchored subtree. Control page loading with `gotoOptions` and `waitFor*` options.",builder:oe,handler:async n=>{let l={cacheTTL:n[`cache-ttl`]};if(n.dryRun){a({command:`cf browser-run quick-action accessibility-tree`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/browser-rendering/accessibilityTree`,pathParams:{},query:l,bodyKind:`json`,body:n.body===void 0?u({actionTimeout:n[`action-timeout`],allowRequestPattern:n[`allow-request-pattern`],authenticate:{password:d(n[`authenticate-password`],`authenticate-password`,`text`),username:d(n[`authenticate-username`],`authenticate-username`,`text`)},bestAttempt:n[`best-attempt`],emulateMediaType:d(n[`emulate-media-type`],`emulate-media-type`,`text`),gotoOptions:{referer:d(n[`goto-options-referer`],`goto-options-referer`,`text`),referrerPolicy:d(n[`goto-options-referrer-policy`],`goto-options-referrer-policy`,`text`),timeout:n[`goto-options-timeout`]},html:d(n.html,`html`,`text`),interestingOnly:n[`interesting-only`],rejectRequestPattern:n[`reject-request-pattern`],root:d(n.root,`root`,`text`),setJavaScriptEnabled:n[`set-java-script-enabled`],url:d(n.url,`url`,`text`),userAgent:d(n[`user-agent`],`user-agent`,`text`),viewport:{deviceScaleFactor:n[`viewport-device-scale-factor`],hasTouch:n[`viewport-has-touch`],height:n[`viewport-height`],isLandscape:n[`viewport-is-landscape`],isMobile:n[`viewport-is-mobile`],width:n[`viewport-width`]},waitForSelector:{hidden:n[`wait-for-selector-hidden`],selector:d(n[`wait-for-selector-selector`],`wait-for-selector-selector`,`text`),timeout:n[`wait-for-selector-timeout`],visible:n[`wait-for-selector-visible`]},waitForTimeout:n[`wait-for-timeout`]}):c(n.body)});return}let f=await r(n),p=n.local?s:await t();if(n.accountId=p,n.body){let e=c(n.body);new URLSearchParams(Object.entries(l).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),i(await o(`Creating`,async()=>f.browserRun.quickAction.accessibilityTree({...e,account_id:p,...l})),{successLabel:`Created`});return}let m=u({actionTimeout:n[`action-timeout`],allowRequestPattern:n[`allow-request-pattern`],authenticate:{password:d(n[`authenticate-password`],`authenticate-password`,`text`),username:d(n[`authenticate-username`],`authenticate-username`,`text`)},bestAttempt:n[`best-attempt`],emulateMediaType:d(n[`emulate-media-type`],`emulate-media-type`,`text`),gotoOptions:{referer:d(n[`goto-options-referer`],`goto-options-referer`,`text`),referrerPolicy:d(n[`goto-options-referrer-policy`],`goto-options-referrer-policy`,`text`),timeout:n[`goto-options-timeout`]},html:d(n.html,`html`,`text`),interestingOnly:n[`interesting-only`],rejectRequestPattern:n[`reject-request-pattern`],root:d(n.root,`root`,`text`),setJavaScriptEnabled:n[`set-java-script-enabled`],url:d(n.url,`url`,`text`),userAgent:d(n[`user-agent`],`user-agent`,`text`),viewport:{deviceScaleFactor:n[`viewport-device-scale-factor`],hasTouch:n[`viewport-has-touch`],height:n[`viewport-height`],isLandscape:n[`viewport-is-landscape`],isMobile:n[`viewport-is-mobile`],width:n[`viewport-width`]},waitForSelector:{hidden:n[`wait-for-selector-hidden`],selector:d(n[`wait-for-selector-selector`],`wait-for-selector-selector`,`text`),timeout:n[`wait-for-selector-timeout`],visible:n[`wait-for-selector-visible`]},waitForTimeout:n[`wait-for-timeout`]});new URLSearchParams(Object.entries(l).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),i(await o(`Creating`,async()=>f.browserRun.quickAction.accessibilityTree({...m,account_id:p,...l})),{successLabel:`Created`})}};function ce(e){return e.option(`cache-ttl`,{type:`number`,description:`Cache TTL default is 5s. Set to 0 to disable.`}).option(`action-timeout`,{type:`number`,description:`The maximum duration allowed for the browser action to complete after the page has loaded (such as taking screenshots, extracting content, or generating PDFs). If this time limit is exceeded, the action stops and returns a timeout error.`}).option(`allow-request-pattern`,{type:`string`,array:!0,description:`Only allow requests that match the provided regex patterns, eg. '/^.*\\.(css)'. Reject rules are applied first.`}).option(`authenticate-password`,{type:`string`,description:`The authenticate.password field`}).option(`authenticate-username`,{type:`string`,description:`The authenticate.username field`}).option(`best-attempt`,{type:`boolean`,description:`Attempt to proceed when 'awaited' events fail or timeout.`}).option(`emulate-media-type`,{type:`string`,description:`The emulateMediaType field`}).option(`goto-options-referer`,{type:`string`,description:`The gotoOptions.referer field`}).option(`goto-options-referrer-policy`,{type:`string`,description:`The gotoOptions.referrerPolicy field`}).option(`goto-options-timeout`,{type:`number`,description:`The gotoOptions.timeout field`,default:3e4}).option(`html`,{type:`string`,description:"Set the content of the page, eg: `<h1>Hello World!!</h1>`. Either `html` or `url` must be set."}).option(`reject-request-pattern`,{type:`string`,array:!0,description:`Block undesired requests that match the provided regex patterns, eg. '/^.*\\.(css)'.`}).option(`set-java-script-enabled`,{type:`boolean`,description:`The setJavaScriptEnabled field`}).option(`url`,{type:`string`,description:"URL to navigate to, eg. `https://example.com`."}).option(`user-agent`,{type:`string`,description:`The userAgent field`,default:`Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36`}).option(`viewport-device-scale-factor`,{type:`number`,description:`The viewport.deviceScaleFactor field`}).option(`viewport-has-touch`,{type:`boolean`,description:`The viewport.hasTouch field`}).option(`viewport-height`,{type:`number`,description:`The viewport.height field`}).option(`viewport-is-landscape`,{type:`boolean`,description:`The viewport.isLandscape field`}).option(`viewport-is-mobile`,{type:`boolean`,description:`The viewport.isMobile field`}).option(`viewport-width`,{type:`number`,description:`The viewport.width field`}).option(`wait-for-selector-hidden`,{type:`boolean`,description:`The waitForSelector.hidden field`}).option(`wait-for-selector-selector`,{type:`string`,description:`The waitForSelector.selector field`}).option(`wait-for-selector-timeout`,{type:`number`,description:`The waitForSelector.timeout field`}).option(`wait-for-selector-visible`,{type:`boolean`,description:`The waitForSelector.visible field`}).option(`wait-for-timeout`,{type:`number`,description:`Waits for a specified timeout before continuing.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).check(e=>{if([`authenticate-password`,`authenticate-username`].some(t=>e[t]!==void 0)){let t=[`authenticate-password`,`authenticate-username`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --authenticate-* flag is set`)}return!0}).check(e=>{if([`viewport-device-scale-factor`,`viewport-has-touch`,`viewport-height`,`viewport-is-landscape`,`viewport-is-mobile`,`viewport-width`].some(t=>e[t]!==void 0)){let t=[`viewport-height`,`viewport-width`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --viewport-* flag is set`)}return!0}).check(e=>{if([`wait-for-selector-hidden`,`wait-for-selector-selector`,`wait-for-selector-timeout`,`wait-for-selector-visible`].some(t=>e[t]!==void 0)){let t=[`wait-for-selector-selector`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --waitForSelector-* flag is set`)}return!0})}const le={command:`content`,describe:"Fetches rendered HTML content from provided URL or HTML. Check available options like `gotoOptions` and `waitFor*` to control page load behaviour.",builder:ce,handler:async n=>{let l={cacheTTL:n[`cache-ttl`]};if(n.dryRun){a({command:`cf browser-run quick-action content`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/browser-rendering/content`,pathParams:{},query:l,bodyKind:`json`,body:n.body===void 0?u({actionTimeout:n[`action-timeout`],allowRequestPattern:n[`allow-request-pattern`],authenticate:{password:d(n[`authenticate-password`],`authenticate-password`,`text`),username:d(n[`authenticate-username`],`authenticate-username`,`text`)},bestAttempt:n[`best-attempt`],emulateMediaType:d(n[`emulate-media-type`],`emulate-media-type`,`text`),gotoOptions:{referer:d(n[`goto-options-referer`],`goto-options-referer`,`text`),referrerPolicy:d(n[`goto-options-referrer-policy`],`goto-options-referrer-policy`,`text`),timeout:n[`goto-options-timeout`]},html:d(n.html,`html`,`text`),rejectRequestPattern:n[`reject-request-pattern`],setJavaScriptEnabled:n[`set-java-script-enabled`],url:d(n.url,`url`,`text`),userAgent:d(n[`user-agent`],`user-agent`,`text`),viewport:{deviceScaleFactor:n[`viewport-device-scale-factor`],hasTouch:n[`viewport-has-touch`],height:n[`viewport-height`],isLandscape:n[`viewport-is-landscape`],isMobile:n[`viewport-is-mobile`],width:n[`viewport-width`]},waitForSelector:{hidden:n[`wait-for-selector-hidden`],selector:d(n[`wait-for-selector-selector`],`wait-for-selector-selector`,`text`),timeout:n[`wait-for-selector-timeout`],visible:n[`wait-for-selector-visible`]},waitForTimeout:n[`wait-for-timeout`]}):c(n.body)});return}let f=await r(n),p=n.local?s:await t();if(n.accountId=p,n.body){let e=c(n.body);new URLSearchParams(Object.entries(l).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),i(await o(`Creating`,async()=>f.browserRun.quickAction.content({...e,account_id:p,...l})),{successLabel:`Created`});return}let m=u({actionTimeout:n[`action-timeout`],allowRequestPattern:n[`allow-request-pattern`],authenticate:{password:d(n[`authenticate-password`],`authenticate-password`,`text`),username:d(n[`authenticate-username`],`authenticate-username`,`text`)},bestAttempt:n[`best-attempt`],emulateMediaType:d(n[`emulate-media-type`],`emulate-media-type`,`text`),gotoOptions:{referer:d(n[`goto-options-referer`],`goto-options-referer`,`text`),referrerPolicy:d(n[`goto-options-referrer-policy`],`goto-options-referrer-policy`,`text`),timeout:n[`goto-options-timeout`]},html:d(n.html,`html`,`text`),rejectRequestPattern:n[`reject-request-pattern`],setJavaScriptEnabled:n[`set-java-script-enabled`],url:d(n.url,`url`,`text`),userAgent:d(n[`user-agent`],`user-agent`,`text`),viewport:{deviceScaleFactor:n[`viewport-device-scale-factor`],hasTouch:n[`viewport-has-touch`],height:n[`viewport-height`],isLandscape:n[`viewport-is-landscape`],isMobile:n[`viewport-is-mobile`],width:n[`viewport-width`]},waitForSelector:{hidden:n[`wait-for-selector-hidden`],selector:d(n[`wait-for-selector-selector`],`wait-for-selector-selector`,`text`),timeout:n[`wait-for-selector-timeout`],visible:n[`wait-for-selector-visible`]},waitForTimeout:n[`wait-for-timeout`]});new URLSearchParams(Object.entries(l).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),i(await o(`Creating`,async()=>f.browserRun.quickAction.content({...m,account_id:p,...l})),{successLabel:`Created`})}};function ue(e){return e.option(`cache-ttl`,{type:`number`,description:`Cache TTL default is 5s. Set to 0 to disable.`}).option(`action-timeout`,{type:`number`,description:`The maximum duration allowed for the browser action to complete after the page has loaded (such as taking screenshots, extracting content, or generating PDFs). If this time limit is exceeded, the action stops and returns a timeout error.`}).option(`allow-request-pattern`,{type:`string`,array:!0,description:`Only allow requests that match the provided regex patterns, eg. '/^.*\\.(css)'. Reject rules are applied first.`}).option(`authenticate-password`,{type:`string`,description:`The authenticate.password field`}).option(`authenticate-username`,{type:`string`,description:`The authenticate.username field`}).option(`best-attempt`,{type:`boolean`,description:`Attempt to proceed when 'awaited' events fail or timeout.`}).option(`emulate-media-type`,{type:`string`,description:`The emulateMediaType field`}).option(`goto-options-referer`,{type:`string`,description:`The gotoOptions.referer field`}).option(`goto-options-referrer-policy`,{type:`string`,description:`The gotoOptions.referrerPolicy field`}).option(`goto-options-timeout`,{type:`number`,description:`The gotoOptions.timeout field`,default:3e4}).option(`html`,{type:`string`,description:"Set the content of the page, eg: `<h1>Hello World!!</h1>`. Either `html` or `url` must be set."}).option(`prompt`,{type:`string`,description:`The prompt field`}).option(`reject-request-pattern`,{type:`string`,array:!0,description:`Block undesired requests that match the provided regex patterns, eg. '/^.*\\.(css)'.`}).option(`response-format-type`,{type:`string`,description:`The response_format.type field`}).option(`set-java-script-enabled`,{type:`boolean`,description:`The setJavaScriptEnabled field`}).option(`url`,{type:`string`,description:"URL to navigate to, eg. `https://example.com`."}).option(`user-agent`,{type:`string`,description:`The userAgent field`,default:`Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36`}).option(`viewport-device-scale-factor`,{type:`number`,description:`The viewport.deviceScaleFactor field`}).option(`viewport-has-touch`,{type:`boolean`,description:`The viewport.hasTouch field`}).option(`viewport-height`,{type:`number`,description:`The viewport.height field`}).option(`viewport-is-landscape`,{type:`boolean`,description:`The viewport.isLandscape field`}).option(`viewport-is-mobile`,{type:`boolean`,description:`The viewport.isMobile field`}).option(`viewport-width`,{type:`number`,description:`The viewport.width field`}).option(`wait-for-selector-hidden`,{type:`boolean`,description:`The waitForSelector.hidden field`}).option(`wait-for-selector-selector`,{type:`string`,description:`The waitForSelector.selector field`}).option(`wait-for-selector-timeout`,{type:`number`,description:`The waitForSelector.timeout field`}).option(`wait-for-selector-visible`,{type:`boolean`,description:`The waitForSelector.visible field`}).option(`wait-for-timeout`,{type:`number`,description:`Waits for a specified timeout before continuing.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).check(e=>{if([`authenticate-password`,`authenticate-username`].some(t=>e[t]!==void 0)){let t=[`authenticate-password`,`authenticate-username`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --authenticate-* flag is set`)}return!0}).check(e=>{if([`response-format-type`].some(t=>e[t]!==void 0)){let t=[`response-format-type`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --response_format-* flag is set`)}return!0}).check(e=>{if([`viewport-device-scale-factor`,`viewport-has-touch`,`viewport-height`,`viewport-is-landscape`,`viewport-is-mobile`,`viewport-width`].some(t=>e[t]!==void 0)){let t=[`viewport-height`,`viewport-width`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --viewport-* flag is set`)}return!0}).check(e=>{if([`wait-for-selector-hidden`,`wait-for-selector-selector`,`wait-for-selector-timeout`,`wait-for-selector-visible`].some(t=>e[t]!==void 0)){let t=[`wait-for-selector-selector`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --waitForSelector-* flag is set`)}return!0})}const de={command:`json`,describe:"Gets json from a webpage from a provided URL or HTML. Pass `prompt` or `schema` in the body. Control page loading with `gotoOptions` and `waitFor*` options.",builder:ue,handler:async n=>{let l={cacheTTL:n[`cache-ttl`]};if(n.dryRun){a({command:`cf browser-run quick-action json`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/browser-rendering/json`,pathParams:{},query:l,bodyKind:`json`,body:n.body===void 0?u({actionTimeout:n[`action-timeout`],allowRequestPattern:n[`allow-request-pattern`],authenticate:{password:d(n[`authenticate-password`],`authenticate-password`,`text`),username:d(n[`authenticate-username`],`authenticate-username`,`text`)},bestAttempt:n[`best-attempt`],emulateMediaType:d(n[`emulate-media-type`],`emulate-media-type`,`text`),gotoOptions:{referer:d(n[`goto-options-referer`],`goto-options-referer`,`text`),referrerPolicy:d(n[`goto-options-referrer-policy`],`goto-options-referrer-policy`,`text`),timeout:n[`goto-options-timeout`]},html:d(n.html,`html`,`text`),prompt:d(n.prompt,`prompt`,`text`),rejectRequestPattern:n[`reject-request-pattern`],response_format:{type:d(n[`response-format-type`],`response-format-type`,`text`)},setJavaScriptEnabled:n[`set-java-script-enabled`],url:d(n.url,`url`,`text`),userAgent:d(n[`user-agent`],`user-agent`,`text`),viewport:{deviceScaleFactor:n[`viewport-device-scale-factor`],hasTouch:n[`viewport-has-touch`],height:n[`viewport-height`],isLandscape:n[`viewport-is-landscape`],isMobile:n[`viewport-is-mobile`],width:n[`viewport-width`]},waitForSelector:{hidden:n[`wait-for-selector-hidden`],selector:d(n[`wait-for-selector-selector`],`wait-for-selector-selector`,`text`),timeout:n[`wait-for-selector-timeout`],visible:n[`wait-for-selector-visible`]},waitForTimeout:n[`wait-for-timeout`]}):c(n.body)});return}let f=await r(n),p=n.local?s:await t();if(n.accountId=p,n.body){let e=c(n.body);new URLSearchParams(Object.entries(l).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),i(await o(`Creating`,async()=>f.browserRun.quickAction.json({...e,account_id:p,...l})),{successLabel:`Created`});return}let m=u({actionTimeout:n[`action-timeout`],allowRequestPattern:n[`allow-request-pattern`],authenticate:{password:d(n[`authenticate-password`],`authenticate-password`,`text`),username:d(n[`authenticate-username`],`authenticate-username`,`text`)},bestAttempt:n[`best-attempt`],emulateMediaType:d(n[`emulate-media-type`],`emulate-media-type`,`text`),gotoOptions:{referer:d(n[`goto-options-referer`],`goto-options-referer`,`text`),referrerPolicy:d(n[`goto-options-referrer-policy`],`goto-options-referrer-policy`,`text`),timeout:n[`goto-options-timeout`]},html:d(n.html,`html`,`text`),prompt:d(n.prompt,`prompt`,`text`),rejectRequestPattern:n[`reject-request-pattern`],response_format:{type:d(n[`response-format-type`],`response-format-type`,`text`)},setJavaScriptEnabled:n[`set-java-script-enabled`],url:d(n.url,`url`,`text`),userAgent:d(n[`user-agent`],`user-agent`,`text`),viewport:{deviceScaleFactor:n[`viewport-device-scale-factor`],hasTouch:n[`viewport-has-touch`],height:n[`viewport-height`],isLandscape:n[`viewport-is-landscape`],isMobile:n[`viewport-is-mobile`],width:n[`viewport-width`]},waitForSelector:{hidden:n[`wait-for-selector-hidden`],selector:d(n[`wait-for-selector-selector`],`wait-for-selector-selector`,`text`),timeout:n[`wait-for-selector-timeout`],visible:n[`wait-for-selector-visible`]},waitForTimeout:n[`wait-for-timeout`]});new URLSearchParams(Object.entries(l).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),i(await o(`Creating`,async()=>f.browserRun.quickAction.json({...m,account_id:p,...l})),{successLabel:`Created`})}};function fe(e){return e.option(`cache-ttl`,{type:`number`,description:`Cache TTL default is 5s. Set to 0 to disable.`}).option(`action-timeout`,{type:`number`,description:`The maximum duration allowed for the browser action to complete after the page has loaded (such as taking screenshots, extracting content, or generating PDFs). If this time limit is exceeded, the action stops and returns a timeout error.`}).option(`allow-request-pattern`,{type:`string`,array:!0,description:`Only allow requests that match the provided regex patterns, eg. '/^.*\\.(css)'. Reject rules are applied first.`}).option(`authenticate-password`,{type:`string`,description:`The authenticate.password field`}).option(`authenticate-username`,{type:`string`,description:`The authenticate.username field`}).option(`best-attempt`,{type:`boolean`,description:`Attempt to proceed when 'awaited' events fail or timeout.`}).option(`emulate-media-type`,{type:`string`,description:`The emulateMediaType field`}).option(`exclude-external-links`,{type:`boolean`,description:`The excludeExternalLinks field`,default:!1}).option(`goto-options-referer`,{type:`string`,description:`The gotoOptions.referer field`}).option(`goto-options-referrer-policy`,{type:`string`,description:`The gotoOptions.referrerPolicy field`}).option(`goto-options-timeout`,{type:`number`,description:`The gotoOptions.timeout field`,default:3e4}).option(`html`,{type:`string`,description:"Set the content of the page, eg: `<h1>Hello World!!</h1>`. Either `html` or `url` must be set."}).option(`reject-request-pattern`,{type:`string`,array:!0,description:`Block undesired requests that match the provided regex patterns, eg. '/^.*\\.(css)'.`}).option(`set-java-script-enabled`,{type:`boolean`,description:`The setJavaScriptEnabled field`}).option(`url`,{type:`string`,description:"URL to navigate to, eg. `https://example.com`."}).option(`user-agent`,{type:`string`,description:`The userAgent field`,default:`Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36`}).option(`viewport-device-scale-factor`,{type:`number`,description:`The viewport.deviceScaleFactor field`}).option(`viewport-has-touch`,{type:`boolean`,description:`The viewport.hasTouch field`}).option(`viewport-height`,{type:`number`,description:`The viewport.height field`}).option(`viewport-is-landscape`,{type:`boolean`,description:`The viewport.isLandscape field`}).option(`viewport-is-mobile`,{type:`boolean`,description:`The viewport.isMobile field`}).option(`viewport-width`,{type:`number`,description:`The viewport.width field`}).option(`visible-links-only`,{type:`boolean`,description:`The visibleLinksOnly field`,default:!1}).option(`wait-for-selector-hidden`,{type:`boolean`,description:`The waitForSelector.hidden field`}).option(`wait-for-selector-selector`,{type:`string`,description:`The waitForSelector.selector field`}).option(`wait-for-selector-timeout`,{type:`number`,description:`The waitForSelector.timeout field`}).option(`wait-for-selector-visible`,{type:`boolean`,description:`The waitForSelector.visible field`}).option(`wait-for-timeout`,{type:`number`,description:`Waits for a specified timeout before continuing.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).check(e=>{if([`authenticate-password`,`authenticate-username`].some(t=>e[t]!==void 0)){let t=[`authenticate-password`,`authenticate-username`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --authenticate-* flag is set`)}return!0}).check(e=>{if([`viewport-device-scale-factor`,`viewport-has-touch`,`viewport-height`,`viewport-is-landscape`,`viewport-is-mobile`,`viewport-width`].some(t=>e[t]!==void 0)){let t=[`viewport-height`,`viewport-width`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --viewport-* flag is set`)}return!0}).check(e=>{if([`wait-for-selector-hidden`,`wait-for-selector-selector`,`wait-for-selector-timeout`,`wait-for-selector-visible`].some(t=>e[t]!==void 0)){let t=[`wait-for-selector-selector`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --waitForSelector-* flag is set`)}return!0})}const pe={command:`links`,describe:`Get links from a web page.`,builder:fe,handler:async n=>{let l={cacheTTL:n[`cache-ttl`]};if(n.dryRun){a({command:`cf browser-run quick-action links`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/browser-rendering/links`,pathParams:{},query:l,bodyKind:`json`,body:n.body===void 0?u({actionTimeout:n[`action-timeout`],allowRequestPattern:n[`allow-request-pattern`],authenticate:{password:d(n[`authenticate-password`],`authenticate-password`,`text`),username:d(n[`authenticate-username`],`authenticate-username`,`text`)},bestAttempt:n[`best-attempt`],emulateMediaType:d(n[`emulate-media-type`],`emulate-media-type`,`text`),excludeExternalLinks:n[`exclude-external-links`],gotoOptions:{referer:d(n[`goto-options-referer`],`goto-options-referer`,`text`),referrerPolicy:d(n[`goto-options-referrer-policy`],`goto-options-referrer-policy`,`text`),timeout:n[`goto-options-timeout`]},html:d(n.html,`html`,`text`),rejectRequestPattern:n[`reject-request-pattern`],setJavaScriptEnabled:n[`set-java-script-enabled`],url:d(n.url,`url`,`text`),userAgent:d(n[`user-agent`],`user-agent`,`text`),viewport:{deviceScaleFactor:n[`viewport-device-scale-factor`],hasTouch:n[`viewport-has-touch`],height:n[`viewport-height`],isLandscape:n[`viewport-is-landscape`],isMobile:n[`viewport-is-mobile`],width:n[`viewport-width`]},visibleLinksOnly:n[`visible-links-only`],waitForSelector:{hidden:n[`wait-for-selector-hidden`],selector:d(n[`wait-for-selector-selector`],`wait-for-selector-selector`,`text`),timeout:n[`wait-for-selector-timeout`],visible:n[`wait-for-selector-visible`]},waitForTimeout:n[`wait-for-timeout`]}):c(n.body)});return}let f=await r(n),p=n.local?s:await t();if(n.accountId=p,n.body){let e=c(n.body);new URLSearchParams(Object.entries(l).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),i(await o(`Creating`,async()=>f.browserRun.quickAction.links({...e,account_id:p,...l})),{successLabel:`Created`});return}let m=u({actionTimeout:n[`action-timeout`],allowRequestPattern:n[`allow-request-pattern`],authenticate:{password:d(n[`authenticate-password`],`authenticate-password`,`text`),username:d(n[`authenticate-username`],`authenticate-username`,`text`)},bestAttempt:n[`best-attempt`],emulateMediaType:d(n[`emulate-media-type`],`emulate-media-type`,`text`),excludeExternalLinks:n[`exclude-external-links`],gotoOptions:{referer:d(n[`goto-options-referer`],`goto-options-referer`,`text`),referrerPolicy:d(n[`goto-options-referrer-policy`],`goto-options-referrer-policy`,`text`),timeout:n[`goto-options-timeout`]},html:d(n.html,`html`,`text`),rejectRequestPattern:n[`reject-request-pattern`],setJavaScriptEnabled:n[`set-java-script-enabled`],url:d(n.url,`url`,`text`),userAgent:d(n[`user-agent`],`user-agent`,`text`),viewport:{deviceScaleFactor:n[`viewport-device-scale-factor`],hasTouch:n[`viewport-has-touch`],height:n[`viewport-height`],isLandscape:n[`viewport-is-landscape`],isMobile:n[`viewport-is-mobile`],width:n[`viewport-width`]},visibleLinksOnly:n[`visible-links-only`],waitForSelector:{hidden:n[`wait-for-selector-hidden`],selector:d(n[`wait-for-selector-selector`],`wait-for-selector-selector`,`text`),timeout:n[`wait-for-selector-timeout`],visible:n[`wait-for-selector-visible`]},waitForTimeout:n[`wait-for-timeout`]});new URLSearchParams(Object.entries(l).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),i(await o(`Creating`,async()=>f.browserRun.quickAction.links({...m,account_id:p,...l})),{successLabel:`Created`})}};function $(e){return e.option(`cache-ttl`,{type:`number`,description:`Cache TTL default is 5s. Set to 0 to disable.`}).option(`action-timeout`,{type:`number`,description:`The maximum duration allowed for the browser action to complete after the page has loaded (such as taking screenshots, extracting content, or generating PDFs). If this time limit is exceeded, the action stops and returns a timeout error.`}).option(`allow-request-pattern`,{type:`string`,array:!0,description:`Only allow requests that match the provided regex patterns, eg. '/^.*\\.(css)'. Reject rules are applied first.`}).option(`authenticate-password`,{type:`string`,description:`The authenticate.password field`}).option(`authenticate-username`,{type:`string`,description:`The authenticate.username field`}).option(`best-attempt`,{type:`boolean`,description:`Attempt to proceed when 'awaited' events fail or timeout.`}).option(`emulate-media-type`,{type:`string`,description:`The emulateMediaType field`}).option(`goto-options-referer`,{type:`string`,description:`The gotoOptions.referer field`}).option(`goto-options-referrer-policy`,{type:`string`,description:`The gotoOptions.referrerPolicy field`}).option(`goto-options-timeout`,{type:`number`,description:`The gotoOptions.timeout field`,default:3e4}).option(`html`,{type:`string`,description:"Set the content of the page, eg: `<h1>Hello World!!</h1>`. Either `html` or `url` must be set."}).option(`reject-request-pattern`,{type:`string`,array:!0,description:`Block undesired requests that match the provided regex patterns, eg. '/^.*\\.(css)'.`}).option(`set-java-script-enabled`,{type:`boolean`,description:`The setJavaScriptEnabled field`}).option(`url`,{type:`string`,description:"URL to navigate to, eg. `https://example.com`."}).option(`user-agent`,{type:`string`,description:`The userAgent field`,default:`Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36`}).option(`viewport-device-scale-factor`,{type:`number`,description:`The viewport.deviceScaleFactor field`}).option(`viewport-has-touch`,{type:`boolean`,description:`The viewport.hasTouch field`}).option(`viewport-height`,{type:`number`,description:`The viewport.height field`}).option(`viewport-is-landscape`,{type:`boolean`,description:`The viewport.isLandscape field`}).option(`viewport-is-mobile`,{type:`boolean`,description:`The viewport.isMobile field`}).option(`viewport-width`,{type:`number`,description:`The viewport.width field`}).option(`wait-for-selector-hidden`,{type:`boolean`,description:`The waitForSelector.hidden field`}).option(`wait-for-selector-selector`,{type:`string`,description:`The waitForSelector.selector field`}).option(`wait-for-selector-timeout`,{type:`number`,description:`The waitForSelector.timeout field`}).option(`wait-for-selector-visible`,{type:`boolean`,description:`The waitForSelector.visible field`}).option(`wait-for-timeout`,{type:`number`,description:`Waits for a specified timeout before continuing.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).check(e=>{if([`authenticate-password`,`authenticate-username`].some(t=>e[t]!==void 0)){let t=[`authenticate-password`,`authenticate-username`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --authenticate-* flag is set`)}return!0}).check(e=>{if([`viewport-device-scale-factor`,`viewport-has-touch`,`viewport-height`,`viewport-is-landscape`,`viewport-is-mobile`,`viewport-width`].some(t=>e[t]!==void 0)){let t=[`viewport-height`,`viewport-width`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --viewport-* flag is set`)}return!0}).check(e=>{if([`wait-for-selector-hidden`,`wait-for-selector-selector`,`wait-for-selector-timeout`,`wait-for-selector-visible`].some(t=>e[t]!==void 0)){let t=[`wait-for-selector-selector`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --waitForSelector-* flag is set`)}return!0})}const me={command:`markdown`,describe:"Gets markdown of a webpage from provided URL or HTML. Control page loading with `gotoOptions` and `waitFor*` options.",builder:$,handler:async n=>{let l={cacheTTL:n[`cache-ttl`]};if(n.dryRun){a({command:`cf browser-run quick-action markdown`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/browser-rendering/markdown`,pathParams:{},query:l,bodyKind:`json`,body:n.body===void 0?u({actionTimeout:n[`action-timeout`],allowRequestPattern:n[`allow-request-pattern`],authenticate:{password:d(n[`authenticate-password`],`authenticate-password`,`text`),username:d(n[`authenticate-username`],`authenticate-username`,`text`)},bestAttempt:n[`best-attempt`],emulateMediaType:d(n[`emulate-media-type`],`emulate-media-type`,`text`),gotoOptions:{referer:d(n[`goto-options-referer`],`goto-options-referer`,`text`),referrerPolicy:d(n[`goto-options-referrer-policy`],`goto-options-referrer-policy`,`text`),timeout:n[`goto-options-timeout`]},html:d(n.html,`html`,`text`),rejectRequestPattern:n[`reject-request-pattern`],setJavaScriptEnabled:n[`set-java-script-enabled`],url:d(n.url,`url`,`text`),userAgent:d(n[`user-agent`],`user-agent`,`text`),viewport:{deviceScaleFactor:n[`viewport-device-scale-factor`],hasTouch:n[`viewport-has-touch`],height:n[`viewport-height`],isLandscape:n[`viewport-is-landscape`],isMobile:n[`viewport-is-mobile`],width:n[`viewport-width`]},waitForSelector:{hidden:n[`wait-for-selector-hidden`],selector:d(n[`wait-for-selector-selector`],`wait-for-selector-selector`,`text`),timeout:n[`wait-for-selector-timeout`],visible:n[`wait-for-selector-visible`]},waitForTimeout:n[`wait-for-timeout`]}):c(n.body)});return}let f=await r(n),p=n.local?s:await t();if(n.accountId=p,n.body){let e=c(n.body);new URLSearchParams(Object.entries(l).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),i(await o(`Creating`,async()=>f.browserRun.quickAction.markdown({...e,account_id:p,...l})),{successLabel:`Created`});return}let m=u({actionTimeout:n[`action-timeout`],allowRequestPattern:n[`allow-request-pattern`],authenticate:{password:d(n[`authenticate-password`],`authenticate-password`,`text`),username:d(n[`authenticate-username`],`authenticate-username`,`text`)},bestAttempt:n[`best-attempt`],emulateMediaType:d(n[`emulate-media-type`],`emulate-media-type`,`text`),gotoOptions:{referer:d(n[`goto-options-referer`],`goto-options-referer`,`text`),referrerPolicy:d(n[`goto-options-referrer-policy`],`goto-options-referrer-policy`,`text`),timeout:n[`goto-options-timeout`]},html:d(n.html,`html`,`text`),rejectRequestPattern:n[`reject-request-pattern`],setJavaScriptEnabled:n[`set-java-script-enabled`],url:d(n.url,`url`,`text`),userAgent:d(n[`user-agent`],`user-agent`,`text`),viewport:{deviceScaleFactor:n[`viewport-device-scale-factor`],hasTouch:n[`viewport-has-touch`],height:n[`viewport-height`],isLandscape:n[`viewport-is-landscape`],isMobile:n[`viewport-is-mobile`],width:n[`viewport-width`]},waitForSelector:{hidden:n[`wait-for-selector-hidden`],selector:d(n[`wait-for-selector-selector`],`wait-for-selector-selector`,`text`),timeout:n[`wait-for-selector-timeout`],visible:n[`wait-for-selector-visible`]},waitForTimeout:n[`wait-for-timeout`]});new URLSearchParams(Object.entries(l).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),i(await o(`Creating`,async()=>f.browserRun.quickAction.markdown({...m,account_id:p,...l})),{successLabel:`Created`})}};function he(e){return e.option(`cache-ttl`,{type:`number`,description:`Cache TTL default is 5s. Set to 0 to disable.`}).option(`action-timeout`,{type:`number`,description:`The maximum duration allowed for the browser action to complete after the page has loaded (such as taking screenshots, extracting content, or generating PDFs). If this time limit is exceeded, the action stops and returns a timeout error.`}).option(`allow-request-pattern`,{type:`string`,array:!0,description:`Only allow requests that match the provided regex patterns, eg. '/^.*\\.(css)'. Reject rules are applied first.`}).option(`authenticate-password`,{type:`string`,description:`The authenticate.password field`}).option(`authenticate-username`,{type:`string`,description:`The authenticate.username field`}).option(`best-attempt`,{type:`boolean`,description:`Attempt to proceed when 'awaited' events fail or timeout.`}).option(`emulate-media-type`,{type:`string`,description:`The emulateMediaType field`}).option(`goto-options-referer`,{type:`string`,description:`The gotoOptions.referer field`}).option(`goto-options-referrer-policy`,{type:`string`,description:`The gotoOptions.referrerPolicy field`}).option(`goto-options-timeout`,{type:`number`,description:`The gotoOptions.timeout field`,default:3e4}).option(`html`,{type:`string`,description:"Set the content of the page, eg: `<h1>Hello World!!</h1>`. Either `html` or `url` must be set."}).option(`pdf-options-display-header-footer`,{type:`boolean`,description:`Whether to show the header and footer.`,default:!1}).option(`pdf-options-footer-template`,{type:`string`,description:`HTML template for the print footer.`}).option(`pdf-options-format`,{type:`string`,description:`Paper format. Takes priority over width and height if set.`,choices:[`letter`,`legal`,`tabloid`,`ledger`,`a0`,`a1`,`a2`,`a3`,`a4`,`a5`,`a6`],default:`letter`}).option(`pdf-options-header-template`,{type:`string`,description:`HTML template for the print header.`}).option(`pdf-options-landscape`,{type:`boolean`,description:`Whether to print in landscape orientation.`,default:!1}).option(`pdf-options-omit-background`,{type:`boolean`,description:`Hides default white background and allows generating pdfs with transparency.`,default:!1}).option(`pdf-options-outline`,{type:`boolean`,description:`Generate document outline.`,default:!1}).option(`pdf-options-page-ranges`,{type:`string`,description:`Paper ranges to print, e.g. '1-5, 8, 11-13'.`}).option(`pdf-options-prefer-csspage-size`,{type:`boolean`,description:`Give CSS @page size priority over other size declarations.`,default:!1}).option(`pdf-options-print-background`,{type:`boolean`,description:`Set to true to print background graphics.`,default:!1}).option(`pdf-options-scale`,{type:`number`,description:`Scales the rendering of the web page. Amount must be between 0.1 and 2.`,default:1}).option(`pdf-options-tagged`,{type:`boolean`,description:`Generate tagged (accessible) PDF.`,default:!0}).option(`pdf-options-timeout`,{type:`number`,description:`Timeout in milliseconds.`,default:3e4}).option(`reject-request-pattern`,{type:`string`,array:!0,description:`Block undesired requests that match the provided regex patterns, eg. '/^.*\\.(css)'.`}).option(`set-java-script-enabled`,{type:`boolean`,description:`The setJavaScriptEnabled field`}).option(`url`,{type:`string`,description:"URL to navigate to, eg. `https://example.com`."}).option(`user-agent`,{type:`string`,description:`The userAgent field`,default:`Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36`}).option(`viewport-device-scale-factor`,{type:`number`,description:`The viewport.deviceScaleFactor field`}).option(`viewport-has-touch`,{type:`boolean`,description:`The viewport.hasTouch field`}).option(`viewport-height`,{type:`number`,description:`The viewport.height field`}).option(`viewport-is-landscape`,{type:`boolean`,description:`The viewport.isLandscape field`}).option(`viewport-is-mobile`,{type:`boolean`,description:`The viewport.isMobile field`}).option(`viewport-width`,{type:`number`,description:`The viewport.width field`}).option(`wait-for-selector-hidden`,{type:`boolean`,description:`The waitForSelector.hidden field`}).option(`wait-for-selector-selector`,{type:`string`,description:`The waitForSelector.selector field`}).option(`wait-for-selector-timeout`,{type:`number`,description:`The waitForSelector.timeout field`}).option(`wait-for-selector-visible`,{type:`boolean`,description:`The waitForSelector.visible field`}).option(`wait-for-timeout`,{type:`number`,description:`Waits for a specified timeout before continuing.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).option(`text`,{type:`boolean`,description:`Decode the response body as UTF-8 text instead of writing raw bytes`,default:!1}).check(e=>{if([`authenticate-password`,`authenticate-username`].some(t=>e[t]!==void 0)){let t=[`authenticate-password`,`authenticate-username`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --authenticate-* flag is set`)}return!0}).check(e=>{if([`viewport-device-scale-factor`,`viewport-has-touch`,`viewport-height`,`viewport-is-landscape`,`viewport-is-mobile`,`viewport-width`].some(t=>e[t]!==void 0)){let t=[`viewport-height`,`viewport-width`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --viewport-* flag is set`)}return!0}).check(e=>{if([`wait-for-selector-hidden`,`wait-for-selector-selector`,`wait-for-selector-timeout`,`wait-for-selector-visible`].some(t=>e[t]!==void 0)){let t=[`wait-for-selector-selector`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --waitForSelector-* flag is set`)}return!0})}const ge={command:`pdf`,describe:"Fetches rendered PDF from provided URL or HTML. Check available options like `gotoOptions` and `waitFor*` to control page load behaviour.",builder:he,handler:async n=>{let i={cacheTTL:n[`cache-ttl`]};if(n.dryRun){a({command:`cf browser-run quick-action pdf`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/browser-rendering/pdf`,pathParams:{},query:i,bodyKind:`json`,body:n.body===void 0?u({actionTimeout:n[`action-timeout`],allowRequestPattern:n[`allow-request-pattern`],authenticate:{password:d(n[`authenticate-password`],`authenticate-password`,`text`),username:d(n[`authenticate-username`],`authenticate-username`,`text`)},bestAttempt:n[`best-attempt`],emulateMediaType:d(n[`emulate-media-type`],`emulate-media-type`,`text`),gotoOptions:{referer:d(n[`goto-options-referer`],`goto-options-referer`,`text`),referrerPolicy:d(n[`goto-options-referrer-policy`],`goto-options-referrer-policy`,`text`),timeout:n[`goto-options-timeout`]},html:d(n.html,`html`,`text`),pdfOptions:{displayHeaderFooter:n[`pdf-options-display-header-footer`],footerTemplate:d(n[`pdf-options-footer-template`],`pdf-options-footer-template`,`text`),format:d(n[`pdf-options-format`],`pdf-options-format`,`text`),headerTemplate:d(n[`pdf-options-header-template`],`pdf-options-header-template`,`text`),landscape:n[`pdf-options-landscape`],omitBackground:n[`pdf-options-omit-background`],outline:n[`pdf-options-outline`],pageRanges:d(n[`pdf-options-page-ranges`],`pdf-options-page-ranges`,`text`),preferCSSPageSize:n[`pdf-options-prefer-csspage-size`],printBackground:n[`pdf-options-print-background`],scale:n[`pdf-options-scale`],tagged:n[`pdf-options-tagged`],timeout:n[`pdf-options-timeout`]},rejectRequestPattern:n[`reject-request-pattern`],setJavaScriptEnabled:n[`set-java-script-enabled`],url:d(n.url,`url`,`text`),userAgent:d(n[`user-agent`],`user-agent`,`text`),viewport:{deviceScaleFactor:n[`viewport-device-scale-factor`],hasTouch:n[`viewport-has-touch`],height:n[`viewport-height`],isLandscape:n[`viewport-is-landscape`],isMobile:n[`viewport-is-mobile`],width:n[`viewport-width`]},waitForSelector:{hidden:n[`wait-for-selector-hidden`],selector:d(n[`wait-for-selector-selector`],`wait-for-selector-selector`,`text`),timeout:n[`wait-for-selector-timeout`],visible:n[`wait-for-selector-visible`]},waitForTimeout:n[`wait-for-timeout`]}):c(n.body)});return}await r(n);let f=n.local?s:await t();if(n.accountId=f,n.body){let e=c(n.body),t=new URLSearchParams(Object.entries(i).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),r=await o(`Creating`,async()=>h(`/accounts/${f}/browser-rendering/pdf${t?`?`+t:``}`,{method:`POST`,localEndpoint:n.local?n.localEndpoint:void 0,body:JSON.stringify(e),contentType:`application/json`}));m(n.text===!0?r.toString(`utf-8`):r);return}let p={};n[`action-timeout`]!==void 0&&l(p,[`actionTimeout`],n[`action-timeout`]),n[`allow-request-pattern`]!==void 0&&l(p,[`allowRequestPattern`],n[`allow-request-pattern`]),n[`authenticate-password`]!==void 0&&l(p,[`authenticate`,`password`],d(n[`authenticate-password`],`authenticate-password`,`text`)),n[`authenticate-username`]!==void 0&&l(p,[`authenticate`,`username`],d(n[`authenticate-username`],`authenticate-username`,`text`)),n[`best-attempt`]!==void 0&&l(p,[`bestAttempt`],n[`best-attempt`]),n[`emulate-media-type`]!==void 0&&l(p,[`emulateMediaType`],d(n[`emulate-media-type`],`emulate-media-type`,`text`)),n[`goto-options-referer`]!==void 0&&l(p,[`gotoOptions`,`referer`],d(n[`goto-options-referer`],`goto-options-referer`,`text`)),n[`goto-options-referrer-policy`]!==void 0&&l(p,[`gotoOptions`,`referrerPolicy`],d(n[`goto-options-referrer-policy`],`goto-options-referrer-policy`,`text`)),n[`goto-options-timeout`]!==void 0&&l(p,[`gotoOptions`,`timeout`],n[`goto-options-timeout`]),n.html!==void 0&&l(p,[`html`],d(n.html,`html`,`text`)),n[`pdf-options-display-header-footer`]!==void 0&&l(p,[`pdfOptions`,`displayHeaderFooter`],n[`pdf-options-display-header-footer`]),n[`pdf-options-footer-template`]!==void 0&&l(p,[`pdfOptions`,`footerTemplate`],d(n[`pdf-options-footer-template`],`pdf-options-footer-template`,`text`)),n[`pdf-options-format`]!==void 0&&l(p,[`pdfOptions`,`format`],d(n[`pdf-options-format`],`pdf-options-format`,`text`)),n[`pdf-options-header-template`]!==void 0&&l(p,[`pdfOptions`,`headerTemplate`],d(n[`pdf-options-header-template`],`pdf-options-header-template`,`text`)),n[`pdf-options-landscape`]!==void 0&&l(p,[`pdfOptions`,`landscape`],n[`pdf-options-landscape`]),n[`pdf-options-omit-background`]!==void 0&&l(p,[`pdfOptions`,`omitBackground`],n[`pdf-options-omit-background`]),n[`pdf-options-outline`]!==void 0&&l(p,[`pdfOptions`,`outline`],n[`pdf-options-outline`]),n[`pdf-options-page-ranges`]!==void 0&&l(p,[`pdfOptions`,`pageRanges`],d(n[`pdf-options-page-ranges`],`pdf-options-page-ranges`,`text`)),n[`pdf-options-prefer-csspage-size`]!==void 0&&l(p,[`pdfOptions`,`preferCSSPageSize`],n[`pdf-options-prefer-csspage-size`]),n[`pdf-options-print-background`]!==void 0&&l(p,[`pdfOptions`,`printBackground`],n[`pdf-options-print-background`]),n[`pdf-options-scale`]!==void 0&&l(p,[`pdfOptions`,`scale`],n[`pdf-options-scale`]),n[`pdf-options-tagged`]!==void 0&&l(p,[`pdfOptions`,`tagged`],n[`pdf-options-tagged`]),n[`pdf-options-timeout`]!==void 0&&l(p,[`pdfOptions`,`timeout`],n[`pdf-options-timeout`]),n[`reject-request-pattern`]!==void 0&&l(p,[`rejectRequestPattern`],n[`reject-request-pattern`]),n[`set-java-script-enabled`]!==void 0&&l(p,[`setJavaScriptEnabled`],n[`set-java-script-enabled`]),n.url!==void 0&&l(p,[`url`],d(n.url,`url`,`text`)),n[`user-agent`]!==void 0&&l(p,[`userAgent`],d(n[`user-agent`],`user-agent`,`text`)),n[`viewport-device-scale-factor`]!==void 0&&l(p,[`viewport`,`deviceScaleFactor`],n[`viewport-device-scale-factor`]),n[`viewport-has-touch`]!==void 0&&l(p,[`viewport`,`hasTouch`],n[`viewport-has-touch`]),n[`viewport-height`]!==void 0&&l(p,[`viewport`,`height`],n[`viewport-height`]),n[`viewport-is-landscape`]!==void 0&&l(p,[`viewport`,`isLandscape`],n[`viewport-is-landscape`]),n[`viewport-is-mobile`]!==void 0&&l(p,[`viewport`,`isMobile`],n[`viewport-is-mobile`]),n[`viewport-width`]!==void 0&&l(p,[`viewport`,`width`],n[`viewport-width`]),n[`wait-for-selector-hidden`]!==void 0&&l(p,[`waitForSelector`,`hidden`],n[`wait-for-selector-hidden`]),n[`wait-for-selector-selector`]!==void 0&&l(p,[`waitForSelector`,`selector`],d(n[`wait-for-selector-selector`],`wait-for-selector-selector`,`text`)),n[`wait-for-selector-timeout`]!==void 0&&l(p,[`waitForSelector`,`timeout`],n[`wait-for-selector-timeout`]),n[`wait-for-selector-visible`]!==void 0&&l(p,[`waitForSelector`,`visible`],n[`wait-for-selector-visible`]),n[`wait-for-timeout`]!==void 0&&l(p,[`waitForTimeout`],n[`wait-for-timeout`]);let g=new URLSearchParams(Object.entries(i).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),_=await o(`Creating`,async()=>h(`/accounts/${f}/browser-rendering/pdf${g?`?`+g:``}`,{method:`POST`,localEndpoint:n.local?n.localEndpoint:void 0,body:Object.keys(p).length>0?p:void 0}));m(n.text===!0?_.toString(`utf-8`):_)}};function _e(e){return e.option(`cache-ttl`,{type:`number`,description:`Cache TTL default is 5s. Set to 0 to disable.`}).option(`action-timeout`,{type:`number`,description:`The maximum duration allowed for the browser action to complete after the page has loaded (such as taking screenshots, extracting content, or generating PDFs). If this time limit is exceeded, the action stops and returns a timeout error.`}).option(`allow-request-pattern`,{type:`string`,array:!0,description:`Only allow requests that match the provided regex patterns, eg. '/^.*\\.(css)'. Reject rules are applied first.`}).option(`authenticate-password`,{type:`string`,description:`The authenticate.password field`}).option(`authenticate-username`,{type:`string`,description:`The authenticate.username field`}).option(`best-attempt`,{type:`boolean`,description:`Attempt to proceed when 'awaited' events fail or timeout.`}).option(`emulate-media-type`,{type:`string`,description:`The emulateMediaType field`}).option(`goto-options-referer`,{type:`string`,description:`The gotoOptions.referer field`}).option(`goto-options-referrer-policy`,{type:`string`,description:`The gotoOptions.referrerPolicy field`}).option(`goto-options-timeout`,{type:`number`,description:`The gotoOptions.timeout field`,default:3e4}).option(`html`,{type:`string`,description:"Set the content of the page, eg: `<h1>Hello World!!</h1>`. Either `html` or `url` must be set."}).option(`reject-request-pattern`,{type:`string`,array:!0,description:`Block undesired requests that match the provided regex patterns, eg. '/^.*\\.(css)'.`}).option(`set-java-script-enabled`,{type:`boolean`,description:`The setJavaScriptEnabled field`}).option(`url`,{type:`string`,description:"URL to navigate to, eg. `https://example.com`."}).option(`user-agent`,{type:`string`,description:`The userAgent field`,default:`Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36`}).option(`viewport-device-scale-factor`,{type:`number`,description:`The viewport.deviceScaleFactor field`}).option(`viewport-has-touch`,{type:`boolean`,description:`The viewport.hasTouch field`}).option(`viewport-height`,{type:`number`,description:`The viewport.height field`}).option(`viewport-is-landscape`,{type:`boolean`,description:`The viewport.isLandscape field`}).option(`viewport-is-mobile`,{type:`boolean`,description:`The viewport.isMobile field`}).option(`viewport-width`,{type:`number`,description:`The viewport.width field`}).option(`wait-for-selector-hidden`,{type:`boolean`,description:`The waitForSelector.hidden field`}).option(`wait-for-selector-selector`,{type:`string`,description:`The waitForSelector.selector field`}).option(`wait-for-selector-timeout`,{type:`number`,description:`The waitForSelector.timeout field`}).option(`wait-for-selector-visible`,{type:`boolean`,description:`The waitForSelector.visible field`}).option(`wait-for-timeout`,{type:`number`,description:`Waits for a specified timeout before continuing.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).check(e=>{if([`authenticate-password`,`authenticate-username`].some(t=>e[t]!==void 0)){let t=[`authenticate-password`,`authenticate-username`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --authenticate-* flag is set`)}return!0}).check(e=>{if([`viewport-device-scale-factor`,`viewport-has-touch`,`viewport-height`,`viewport-is-landscape`,`viewport-is-mobile`,`viewport-width`].some(t=>e[t]!==void 0)){let t=[`viewport-height`,`viewport-width`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --viewport-* flag is set`)}return!0}).check(e=>{if([`wait-for-selector-hidden`,`wait-for-selector-selector`,`wait-for-selector-timeout`,`wait-for-selector-visible`].some(t=>e[t]!==void 0)){let t=[`wait-for-selector-selector`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --waitForSelector-* flag is set`)}return!0})}const ve={command:`scrape`,describe:`Get meta attributes like height, width, text and others of selected elements.`,builder:_e,handler:async n=>{let l={cacheTTL:n[`cache-ttl`]};if(n.dryRun){a({command:`cf browser-run quick-action scrape`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/browser-rendering/scrape`,pathParams:{},query:l,bodyKind:`json`,body:n.body===void 0?u({actionTimeout:n[`action-timeout`],allowRequestPattern:n[`allow-request-pattern`],authenticate:{password:d(n[`authenticate-password`],`authenticate-password`,`text`),username:d(n[`authenticate-username`],`authenticate-username`,`text`)},bestAttempt:n[`best-attempt`],emulateMediaType:d(n[`emulate-media-type`],`emulate-media-type`,`text`),gotoOptions:{referer:d(n[`goto-options-referer`],`goto-options-referer`,`text`),referrerPolicy:d(n[`goto-options-referrer-policy`],`goto-options-referrer-policy`,`text`),timeout:n[`goto-options-timeout`]},html:d(n.html,`html`,`text`),rejectRequestPattern:n[`reject-request-pattern`],setJavaScriptEnabled:n[`set-java-script-enabled`],url:d(n.url,`url`,`text`),userAgent:d(n[`user-agent`],`user-agent`,`text`),viewport:{deviceScaleFactor:n[`viewport-device-scale-factor`],hasTouch:n[`viewport-has-touch`],height:n[`viewport-height`],isLandscape:n[`viewport-is-landscape`],isMobile:n[`viewport-is-mobile`],width:n[`viewport-width`]},waitForSelector:{hidden:n[`wait-for-selector-hidden`],selector:d(n[`wait-for-selector-selector`],`wait-for-selector-selector`,`text`),timeout:n[`wait-for-selector-timeout`],visible:n[`wait-for-selector-visible`]},waitForTimeout:n[`wait-for-timeout`]}):c(n.body)});return}let f=await r(n),p=n.local?s:await t();if(n.accountId=p,n.body){let e=c(n.body);new URLSearchParams(Object.entries(l).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),i(await o(`Creating`,async()=>f.browserRun.quickAction.scrape({...e,account_id:p,...l})),{successLabel:`Created`});return}let m=u({actionTimeout:n[`action-timeout`],allowRequestPattern:n[`allow-request-pattern`],authenticate:{password:d(n[`authenticate-password`],`authenticate-password`,`text`),username:d(n[`authenticate-username`],`authenticate-username`,`text`)},bestAttempt:n[`best-attempt`],emulateMediaType:d(n[`emulate-media-type`],`emulate-media-type`,`text`),gotoOptions:{referer:d(n[`goto-options-referer`],`goto-options-referer`,`text`),referrerPolicy:d(n[`goto-options-referrer-policy`],`goto-options-referrer-policy`,`text`),timeout:n[`goto-options-timeout`]},html:d(n.html,`html`,`text`),rejectRequestPattern:n[`reject-request-pattern`],setJavaScriptEnabled:n[`set-java-script-enabled`],url:d(n.url,`url`,`text`),userAgent:d(n[`user-agent`],`user-agent`,`text`),viewport:{deviceScaleFactor:n[`viewport-device-scale-factor`],hasTouch:n[`viewport-has-touch`],height:n[`viewport-height`],isLandscape:n[`viewport-is-landscape`],isMobile:n[`viewport-is-mobile`],width:n[`viewport-width`]},waitForSelector:{hidden:n[`wait-for-selector-hidden`],selector:d(n[`wait-for-selector-selector`],`wait-for-selector-selector`,`text`),timeout:n[`wait-for-selector-timeout`],visible:n[`wait-for-selector-visible`]},waitForTimeout:n[`wait-for-timeout`]});new URLSearchParams(Object.entries(l).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),i(await o(`Creating`,async()=>f.browserRun.quickAction.scrape({...m,account_id:p,...l})),{successLabel:`Created`})}};function ye(e){return e.option(`cache-ttl`,{type:`number`,description:`Cache TTL default is 5s. Set to 0 to disable.`}).option(`action-timeout`,{type:`number`,description:`The maximum duration allowed for the browser action to complete after the page has loaded (such as taking screenshots, extracting content, or generating PDFs). If this time limit is exceeded, the action stops and returns a timeout error.`}).option(`allow-request-pattern`,{type:`string`,array:!0,description:`Only allow requests that match the provided regex patterns, eg. '/^.*\\.(css)'. Reject rules are applied first.`}).option(`authenticate-password`,{type:`string`,description:`The authenticate.password field`}).option(`authenticate-username`,{type:`string`,description:`The authenticate.username field`}).option(`best-attempt`,{type:`boolean`,description:`Attempt to proceed when 'awaited' events fail or timeout.`}).option(`emulate-media-type`,{type:`string`,description:`The emulateMediaType field`}).option(`goto-options-referer`,{type:`string`,description:`The gotoOptions.referer field`}).option(`goto-options-referrer-policy`,{type:`string`,description:`The gotoOptions.referrerPolicy field`}).option(`goto-options-timeout`,{type:`number`,description:`The gotoOptions.timeout field`,default:3e4}).option(`html`,{type:`string`,description:"Set the content of the page, eg: `<h1>Hello World!!</h1>`. Either `html` or `url` must be set."}).option(`reject-request-pattern`,{type:`string`,array:!0,description:`Block undesired requests that match the provided regex patterns, eg. '/^.*\\.(css)'.`}).option(`screenshot-options-capture-beyond-viewport`,{type:`boolean`,description:`The screenshotOptions.captureBeyondViewport field`}).option(`screenshot-options-clip-height`,{type:`number`,description:`The screenshotOptions.clip.height field`}).option(`screenshot-options-clip-scale`,{type:`number`,description:`The screenshotOptions.clip.scale field`}).option(`screenshot-options-clip-width`,{type:`number`,description:`The screenshotOptions.clip.width field`}).option(`screenshot-options-clip-x`,{type:`number`,description:`The screenshotOptions.clip.x field`}).option(`screenshot-options-clip-y`,{type:`number`,description:`The screenshotOptions.clip.y field`}).option(`screenshot-options-from-surface`,{type:`boolean`,description:`The screenshotOptions.fromSurface field`}).option(`screenshot-options-full-page`,{type:`boolean`,description:`The screenshotOptions.fullPage field`}).option(`screenshot-options-omit-background`,{type:`boolean`,description:`The screenshotOptions.omitBackground field`}).option(`screenshot-options-optimize-for-speed`,{type:`boolean`,description:`The screenshotOptions.optimizeForSpeed field`}).option(`screenshot-options-quality`,{type:`number`,description:`The screenshotOptions.quality field`}).option(`scroll-page`,{type:`boolean`,description:`The scrollPage field`}).option(`selector`,{type:`string`,description:`The selector field`}).option(`set-java-script-enabled`,{type:`boolean`,description:`The setJavaScriptEnabled field`}).option(`url`,{type:`string`,description:"URL to navigate to, eg. `https://example.com`."}).option(`user-agent`,{type:`string`,description:`The userAgent field`,default:`Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36`}).option(`viewport-device-scale-factor`,{type:`number`,description:`The viewport.deviceScaleFactor field`}).option(`viewport-has-touch`,{type:`boolean`,description:`The viewport.hasTouch field`}).option(`viewport-height`,{type:`number`,description:`The viewport.height field`}).option(`viewport-is-landscape`,{type:`boolean`,description:`The viewport.isLandscape field`}).option(`viewport-is-mobile`,{type:`boolean`,description:`The viewport.isMobile field`}).option(`viewport-width`,{type:`number`,description:`The viewport.width field`}).option(`wait-for-selector-hidden`,{type:`boolean`,description:`The waitForSelector.hidden field`}).option(`wait-for-selector-selector`,{type:`string`,description:`The waitForSelector.selector field`}).option(`wait-for-selector-timeout`,{type:`number`,description:`The waitForSelector.timeout field`}).option(`wait-for-selector-visible`,{type:`boolean`,description:`The waitForSelector.visible field`}).option(`wait-for-timeout`,{type:`number`,description:`Waits for a specified timeout before continuing.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).option(`text`,{type:`boolean`,description:`Decode the response body as UTF-8 text instead of writing raw bytes`,default:!1}).check(e=>{if([`authenticate-password`,`authenticate-username`].some(t=>e[t]!==void 0)){let t=[`authenticate-password`,`authenticate-username`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --authenticate-* flag is set`)}return!0}).check(e=>{if([`screenshot-options-capture-beyond-viewport`,`screenshot-options-clip-height`,`screenshot-options-clip-scale`,`screenshot-options-clip-width`,`screenshot-options-clip-x`,`screenshot-options-clip-y`,`screenshot-options-from-surface`,`screenshot-options-full-page`,`screenshot-options-omit-background`,`screenshot-options-optimize-for-speed`,`screenshot-options-quality`].some(t=>e[t]!==void 0)){let t=[`screenshot-options-clip-height`,`screenshot-options-clip-width`,`screenshot-options-clip-x`,`screenshot-options-clip-y`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --screenshotOptions-* flag is set`)}return!0}).check(e=>{if([`viewport-device-scale-factor`,`viewport-has-touch`,`viewport-height`,`viewport-is-landscape`,`viewport-is-mobile`,`viewport-width`].some(t=>e[t]!==void 0)){let t=[`viewport-height`,`viewport-width`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --viewport-* flag is set`)}return!0}).check(e=>{if([`wait-for-selector-hidden`,`wait-for-selector-selector`,`wait-for-selector-timeout`,`wait-for-selector-visible`].some(t=>e[t]!==void 0)){let t=[`wait-for-selector-selector`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --waitForSelector-* flag is set`)}return!0})}const be={command:`screenshot`,describe:"Takes a screenshot of a webpage from provided URL or HTML. Control page loading with `gotoOptions` and `waitFor*` options. Customize screenshots with `viewport`, `fullPage`, `clip` and others.",builder:ye,handler:async n=>{let i={cacheTTL:n[`cache-ttl`]};if(n.dryRun){a({command:`cf browser-run quick-action screenshot`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/browser-rendering/screenshot`,pathParams:{},query:i,bodyKind:`json`,body:n.body===void 0?u({actionTimeout:n[`action-timeout`],allowRequestPattern:n[`allow-request-pattern`],authenticate:{password:d(n[`authenticate-password`],`authenticate-password`,`text`),username:d(n[`authenticate-username`],`authenticate-username`,`text`)},bestAttempt:n[`best-attempt`],emulateMediaType:d(n[`emulate-media-type`],`emulate-media-type`,`text`),gotoOptions:{referer:d(n[`goto-options-referer`],`goto-options-referer`,`text`),referrerPolicy:d(n[`goto-options-referrer-policy`],`goto-options-referrer-policy`,`text`),timeout:n[`goto-options-timeout`]},html:d(n.html,`html`,`text`),rejectRequestPattern:n[`reject-request-pattern`],screenshotOptions:{captureBeyondViewport:n[`screenshot-options-capture-beyond-viewport`],clip:{height:n[`screenshot-options-clip-height`],scale:n[`screenshot-options-clip-scale`],width:n[`screenshot-options-clip-width`],x:n[`screenshot-options-clip-x`],y:n[`screenshot-options-clip-y`]},fromSurface:n[`screenshot-options-from-surface`],fullPage:n[`screenshot-options-full-page`],omitBackground:n[`screenshot-options-omit-background`],optimizeForSpeed:n[`screenshot-options-optimize-for-speed`],quality:n[`screenshot-options-quality`]},scrollPage:n[`scroll-page`],selector:d(n.selector,`selector`,`text`),setJavaScriptEnabled:n[`set-java-script-enabled`],url:d(n.url,`url`,`text`),userAgent:d(n[`user-agent`],`user-agent`,`text`),viewport:{deviceScaleFactor:n[`viewport-device-scale-factor`],hasTouch:n[`viewport-has-touch`],height:n[`viewport-height`],isLandscape:n[`viewport-is-landscape`],isMobile:n[`viewport-is-mobile`],width:n[`viewport-width`]},waitForSelector:{hidden:n[`wait-for-selector-hidden`],selector:d(n[`wait-for-selector-selector`],`wait-for-selector-selector`,`text`),timeout:n[`wait-for-selector-timeout`],visible:n[`wait-for-selector-visible`]},waitForTimeout:n[`wait-for-timeout`]}):c(n.body)});return}await r(n);let f=n.local?s:await t();if(n.accountId=f,n.body){let e=c(n.body),t=new URLSearchParams(Object.entries(i).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),r=await o(`Creating`,async()=>h(`/accounts/${f}/browser-rendering/screenshot${t?`?`+t:``}`,{method:`POST`,localEndpoint:n.local?n.localEndpoint:void 0,body:JSON.stringify(e),contentType:`application/json`}));m(n.text===!0?r.toString(`utf-8`):r);return}let p={};n[`action-timeout`]!==void 0&&l(p,[`actionTimeout`],n[`action-timeout`]),n[`allow-request-pattern`]!==void 0&&l(p,[`allowRequestPattern`],n[`allow-request-pattern`]),n[`authenticate-password`]!==void 0&&l(p,[`authenticate`,`password`],d(n[`authenticate-password`],`authenticate-password`,`text`)),n[`authenticate-username`]!==void 0&&l(p,[`authenticate`,`username`],d(n[`authenticate-username`],`authenticate-username`,`text`)),n[`best-attempt`]!==void 0&&l(p,[`bestAttempt`],n[`best-attempt`]),n[`emulate-media-type`]!==void 0&&l(p,[`emulateMediaType`],d(n[`emulate-media-type`],`emulate-media-type`,`text`)),n[`goto-options-referer`]!==void 0&&l(p,[`gotoOptions`,`referer`],d(n[`goto-options-referer`],`goto-options-referer`,`text`)),n[`goto-options-referrer-policy`]!==void 0&&l(p,[`gotoOptions`,`referrerPolicy`],d(n[`goto-options-referrer-policy`],`goto-options-referrer-policy`,`text`)),n[`goto-options-timeout`]!==void 0&&l(p,[`gotoOptions`,`timeout`],n[`goto-options-timeout`]),n.html!==void 0&&l(p,[`html`],d(n.html,`html`,`text`)),n[`reject-request-pattern`]!==void 0&&l(p,[`rejectRequestPattern`],n[`reject-request-pattern`]),n[`screenshot-options-capture-beyond-viewport`]!==void 0&&l(p,[`screenshotOptions`,`captureBeyondViewport`],n[`screenshot-options-capture-beyond-viewport`]),n[`screenshot-options-clip-height`]!==void 0&&l(p,[`screenshotOptions`,`clip`,`height`],n[`screenshot-options-clip-height`]),n[`screenshot-options-clip-scale`]!==void 0&&l(p,[`screenshotOptions`,`clip`,`scale`],n[`screenshot-options-clip-scale`]),n[`screenshot-options-clip-width`]!==void 0&&l(p,[`screenshotOptions`,`clip`,`width`],n[`screenshot-options-clip-width`]),n[`screenshot-options-clip-x`]!==void 0&&l(p,[`screenshotOptions`,`clip`,`x`],n[`screenshot-options-clip-x`]),n[`screenshot-options-clip-y`]!==void 0&&l(p,[`screenshotOptions`,`clip`,`y`],n[`screenshot-options-clip-y`]),n[`screenshot-options-from-surface`]!==void 0&&l(p,[`screenshotOptions`,`fromSurface`],n[`screenshot-options-from-surface`]),n[`screenshot-options-full-page`]!==void 0&&l(p,[`screenshotOptions`,`fullPage`],n[`screenshot-options-full-page`]),n[`screenshot-options-omit-background`]!==void 0&&l(p,[`screenshotOptions`,`omitBackground`],n[`screenshot-options-omit-background`]),n[`screenshot-options-optimize-for-speed`]!==void 0&&l(p,[`screenshotOptions`,`optimizeForSpeed`],n[`screenshot-options-optimize-for-speed`]),n[`screenshot-options-quality`]!==void 0&&l(p,[`screenshotOptions`,`quality`],n[`screenshot-options-quality`]),n[`scroll-page`]!==void 0&&l(p,[`scrollPage`],n[`scroll-page`]),n.selector!==void 0&&l(p,[`selector`],d(n.selector,`selector`,`text`)),n[`set-java-script-enabled`]!==void 0&&l(p,[`setJavaScriptEnabled`],n[`set-java-script-enabled`]),n.url!==void 0&&l(p,[`url`],d(n.url,`url`,`text`)),n[`user-agent`]!==void 0&&l(p,[`userAgent`],d(n[`user-agent`],`user-agent`,`text`)),n[`viewport-device-scale-factor`]!==void 0&&l(p,[`viewport`,`deviceScaleFactor`],n[`viewport-device-scale-factor`]),n[`viewport-has-touch`]!==void 0&&l(p,[`viewport`,`hasTouch`],n[`viewport-has-touch`]),n[`viewport-height`]!==void 0&&l(p,[`viewport`,`height`],n[`viewport-height`]),n[`viewport-is-landscape`]!==void 0&&l(p,[`viewport`,`isLandscape`],n[`viewport-is-landscape`]),n[`viewport-is-mobile`]!==void 0&&l(p,[`viewport`,`isMobile`],n[`viewport-is-mobile`]),n[`viewport-width`]!==void 0&&l(p,[`viewport`,`width`],n[`viewport-width`]),n[`wait-for-selector-hidden`]!==void 0&&l(p,[`waitForSelector`,`hidden`],n[`wait-for-selector-hidden`]),n[`wait-for-selector-selector`]!==void 0&&l(p,[`waitForSelector`,`selector`],d(n[`wait-for-selector-selector`],`wait-for-selector-selector`,`text`)),n[`wait-for-selector-timeout`]!==void 0&&l(p,[`waitForSelector`,`timeout`],n[`wait-for-selector-timeout`]),n[`wait-for-selector-visible`]!==void 0&&l(p,[`waitForSelector`,`visible`],n[`wait-for-selector-visible`]),n[`wait-for-timeout`]!==void 0&&l(p,[`waitForTimeout`],n[`wait-for-timeout`]);let g=new URLSearchParams(Object.entries(i).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),_=await o(`Creating`,async()=>h(`/accounts/${f}/browser-rendering/screenshot${g?`?`+g:``}`,{method:`POST`,localEndpoint:n.local?n.localEndpoint:void 0,body:Object.keys(p).length>0?p:void 0}));m(n.text===!0?_.toString(`utf-8`):_)}};function xe(e){return e.option(`cache-ttl`,{type:`number`,description:`Cache TTL default is 5s. Set to 0 to disable.`}).option(`action-timeout`,{type:`number`,description:`The maximum duration allowed for the browser action to complete after the page has loaded (such as taking screenshots, extracting content, or generating PDFs). If this time limit is exceeded, the action stops and returns a timeout error.`}).option(`allow-request-pattern`,{type:`string`,array:!0,description:`Only allow requests that match the provided regex patterns, eg. '/^.*\\.(css)'. Reject rules are applied first.`}).option(`authenticate-password`,{type:`string`,description:`The authenticate.password field`}).option(`authenticate-username`,{type:`string`,description:`The authenticate.username field`}).option(`best-attempt`,{type:`boolean`,description:`Attempt to proceed when 'awaited' events fail or timeout.`}).option(`emulate-media-type`,{type:`string`,description:`The emulateMediaType field`}).option(`formats`,{type:`string`,array:!0,description:`The formats field`}).option(`goto-options-referer`,{type:`string`,description:`The gotoOptions.referer field`}).option(`goto-options-referrer-policy`,{type:`string`,description:`The gotoOptions.referrerPolicy field`}).option(`goto-options-timeout`,{type:`number`,description:`The gotoOptions.timeout field`,default:3e4}).option(`html`,{type:`string`,description:"Set the content of the page, eg: `<h1>Hello World!!</h1>`. Either `html` or `url` must be set."}).option(`reject-request-pattern`,{type:`string`,array:!0,description:`Block undesired requests that match the provided regex patterns, eg. '/^.*\\.(css)'.`}).option(`screenshot-options-capture-beyond-viewport`,{type:`boolean`,description:`The screenshotOptions.captureBeyondViewport field`}).option(`screenshot-options-clip-height`,{type:`number`,description:`The screenshotOptions.clip.height field`}).option(`screenshot-options-clip-scale`,{type:`number`,description:`The screenshotOptions.clip.scale field`}).option(`screenshot-options-clip-width`,{type:`number`,description:`The screenshotOptions.clip.width field`}).option(`screenshot-options-clip-x`,{type:`number`,description:`The screenshotOptions.clip.x field`}).option(`screenshot-options-clip-y`,{type:`number`,description:`The screenshotOptions.clip.y field`}).option(`screenshot-options-from-surface`,{type:`boolean`,description:`The screenshotOptions.fromSurface field`}).option(`screenshot-options-full-page`,{type:`boolean`,description:`The screenshotOptions.fullPage field`}).option(`screenshot-options-omit-background`,{type:`boolean`,description:`The screenshotOptions.omitBackground field`}).option(`screenshot-options-optimize-for-speed`,{type:`boolean`,description:`The screenshotOptions.optimizeForSpeed field`}).option(`screenshot-options-quality`,{type:`number`,description:`The screenshotOptions.quality field`}).option(`set-java-script-enabled`,{type:`boolean`,description:`The setJavaScriptEnabled field`}).option(`url`,{type:`string`,description:"URL to navigate to, eg. `https://example.com`."}).option(`user-agent`,{type:`string`,description:`The userAgent field`,default:`Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36`}).option(`viewport-device-scale-factor`,{type:`number`,description:`The viewport.deviceScaleFactor field`}).option(`viewport-has-touch`,{type:`boolean`,description:`The viewport.hasTouch field`}).option(`viewport-height`,{type:`number`,description:`The viewport.height field`}).option(`viewport-is-landscape`,{type:`boolean`,description:`The viewport.isLandscape field`}).option(`viewport-is-mobile`,{type:`boolean`,description:`The viewport.isMobile field`}).option(`viewport-width`,{type:`number`,description:`The viewport.width field`}).option(`wait-for-selector-hidden`,{type:`boolean`,description:`The waitForSelector.hidden field`}).option(`wait-for-selector-selector`,{type:`string`,description:`The waitForSelector.selector field`}).option(`wait-for-selector-timeout`,{type:`number`,description:`The waitForSelector.timeout field`}).option(`wait-for-selector-visible`,{type:`boolean`,description:`The waitForSelector.visible field`}).option(`wait-for-timeout`,{type:`number`,description:`Waits for a specified timeout before continuing.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).check(e=>{if([`authenticate-password`,`authenticate-username`].some(t=>e[t]!==void 0)){let t=[`authenticate-password`,`authenticate-username`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --authenticate-* flag is set`)}return!0}).check(e=>{if([`screenshot-options-capture-beyond-viewport`,`screenshot-options-clip-height`,`screenshot-options-clip-scale`,`screenshot-options-clip-width`,`screenshot-options-clip-x`,`screenshot-options-clip-y`,`screenshot-options-from-surface`,`screenshot-options-full-page`,`screenshot-options-omit-background`,`screenshot-options-optimize-for-speed`,`screenshot-options-quality`].some(t=>e[t]!==void 0)){let t=[`screenshot-options-clip-height`,`screenshot-options-clip-width`,`screenshot-options-clip-x`,`screenshot-options-clip-y`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --screenshotOptions-* flag is set`)}return!0}).check(e=>{if([`viewport-device-scale-factor`,`viewport-has-touch`,`viewport-height`,`viewport-is-landscape`,`viewport-is-mobile`,`viewport-width`].some(t=>e[t]!==void 0)){let t=[`viewport-height`,`viewport-width`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --viewport-* flag is set`)}return!0}).check(e=>{if([`wait-for-selector-hidden`,`wait-for-selector-selector`,`wait-for-selector-timeout`,`wait-for-selector-visible`].some(t=>e[t]!==void 0)){let t=[`wait-for-selector-selector`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --waitForSelector-* flag is set`)}return!0})}const Se={command:`snapshot`,describe:"Returns the page's HTML content and screenshot. Control page loading with `gotoOptions` and `waitFor*` options. Customize screenshots with `viewport`, `fullPage`, `clip` and others.",builder:xe,handler:async n=>{let l={cacheTTL:n[`cache-ttl`]};if(n.dryRun){a({command:`cf browser-run quick-action snapshot`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/browser-rendering/snapshot`,pathParams:{},query:l,bodyKind:`json`,body:n.body===void 0?u({actionTimeout:n[`action-timeout`],allowRequestPattern:n[`allow-request-pattern`],authenticate:{password:d(n[`authenticate-password`],`authenticate-password`,`text`),username:d(n[`authenticate-username`],`authenticate-username`,`text`)},bestAttempt:n[`best-attempt`],emulateMediaType:d(n[`emulate-media-type`],`emulate-media-type`,`text`),formats:n.formats,gotoOptions:{referer:d(n[`goto-options-referer`],`goto-options-referer`,`text`),referrerPolicy:d(n[`goto-options-referrer-policy`],`goto-options-referrer-policy`,`text`),timeout:n[`goto-options-timeout`]},html:d(n.html,`html`,`text`),rejectRequestPattern:n[`reject-request-pattern`],screenshotOptions:{captureBeyondViewport:n[`screenshot-options-capture-beyond-viewport`],clip:{height:n[`screenshot-options-clip-height`],scale:n[`screenshot-options-clip-scale`],width:n[`screenshot-options-clip-width`],x:n[`screenshot-options-clip-x`],y:n[`screenshot-options-clip-y`]},fromSurface:n[`screenshot-options-from-surface`],fullPage:n[`screenshot-options-full-page`],omitBackground:n[`screenshot-options-omit-background`],optimizeForSpeed:n[`screenshot-options-optimize-for-speed`],quality:n[`screenshot-options-quality`]},setJavaScriptEnabled:n[`set-java-script-enabled`],url:d(n.url,`url`,`text`),userAgent:d(n[`user-agent`],`user-agent`,`text`),viewport:{deviceScaleFactor:n[`viewport-device-scale-factor`],hasTouch:n[`viewport-has-touch`],height:n[`viewport-height`],isLandscape:n[`viewport-is-landscape`],isMobile:n[`viewport-is-mobile`],width:n[`viewport-width`]},waitForSelector:{hidden:n[`wait-for-selector-hidden`],selector:d(n[`wait-for-selector-selector`],`wait-for-selector-selector`,`text`),timeout:n[`wait-for-selector-timeout`],visible:n[`wait-for-selector-visible`]},waitForTimeout:n[`wait-for-timeout`]}):c(n.body)});return}let f=await r(n),p=n.local?s:await t();if(n.accountId=p,n.body){let e=c(n.body);new URLSearchParams(Object.entries(l).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),i(await o(`Creating`,async()=>f.browserRun.quickAction.snapshot({...e,account_id:p,...l})),{successLabel:`Created`});return}let m=u({actionTimeout:n[`action-timeout`],allowRequestPattern:n[`allow-request-pattern`],authenticate:{password:d(n[`authenticate-password`],`authenticate-password`,`text`),username:d(n[`authenticate-username`],`authenticate-username`,`text`)},bestAttempt:n[`best-attempt`],emulateMediaType:d(n[`emulate-media-type`],`emulate-media-type`,`text`),formats:n.formats,gotoOptions:{referer:d(n[`goto-options-referer`],`goto-options-referer`,`text`),referrerPolicy:d(n[`goto-options-referrer-policy`],`goto-options-referrer-policy`,`text`),timeout:n[`goto-options-timeout`]},html:d(n.html,`html`,`text`),rejectRequestPattern:n[`reject-request-pattern`],screenshotOptions:{captureBeyondViewport:n[`screenshot-options-capture-beyond-viewport`],clip:{height:n[`screenshot-options-clip-height`],scale:n[`screenshot-options-clip-scale`],width:n[`screenshot-options-clip-width`],x:n[`screenshot-options-clip-x`],y:n[`screenshot-options-clip-y`]},fromSurface:n[`screenshot-options-from-surface`],fullPage:n[`screenshot-options-full-page`],omitBackground:n[`screenshot-options-omit-background`],optimizeForSpeed:n[`screenshot-options-optimize-for-speed`],quality:n[`screenshot-options-quality`]},setJavaScriptEnabled:n[`set-java-script-enabled`],url:d(n.url,`url`,`text`),userAgent:d(n[`user-agent`],`user-agent`,`text`),viewport:{deviceScaleFactor:n[`viewport-device-scale-factor`],hasTouch:n[`viewport-has-touch`],height:n[`viewport-height`],isLandscape:n[`viewport-is-landscape`],isMobile:n[`viewport-is-mobile`],width:n[`viewport-width`]},waitForSelector:{hidden:n[`wait-for-selector-hidden`],selector:d(n[`wait-for-selector-selector`],`wait-for-selector-selector`,`text`),timeout:n[`wait-for-selector-timeout`],visible:n[`wait-for-selector-visible`]},waitForTimeout:n[`wait-for-timeout`]});new URLSearchParams(Object.entries(l).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),i(await o(`Creating`,async()=>f.browserRun.quickAction.snapshot({...m,account_id:p,...l})),{successLabel:`Created`})}},Ce={command:`quick-action`,describe:`Operations for quick-action`,builder:e=>e.command(se).command(le).command(de).command(pe).command(me).command(ge).command(ve).command(be).command(Se).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},we={command:`browser-run`,describe:`browser-run`,builder:e=>e.command(x).command(ae).command(Ce).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{we as default};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import{r as e}from"./chunk-DH-VkVmc.mjs";import{t}from"./src-By-zTCHz.mjs";import{G as n}from"./chunk-2SIGYDH3-qXx_zE6v.mjs";import{a as r,o as i}from"./theme-DbNbIY4d.mjs";import"./ui-BNoF0KpD.mjs";import{n as a,r as o,t as s}from"./dist-BH-4NQOV.mjs";import{n as c}from"./dist-B7hsuvbF.mjs";import{n as l,t as u}from"./spawn-ChG5Xi9Z.mjs";import*as d from"node:fs";import f from"node:fs";import*as p from"node:path";import m from"node:path";import*as h from"node:fs/promises";const g=`config.json`;function _(e){return p.resolve(e,`.cloudflare/output`)}function v(e){return p.join(_(e),`v0`,g)}function y(e){return p.join(_(e),`v0`,`workers`)}function b(e){return p.join(y(e),`default`)}function x(e){return p.join(b(e),g)}function S(e){return p.join(b(e),`bundle`)}function C(e){return p.join(b(e),`assets`)}var w=Object.defineProperty,T=(e,t)=>w(e,`name`,{value:t,configurable:!0});function E(e){return f.statSync(e,{throwIfNoEntry:!1})?.isDirectory()??!1}T(E,`isDirectory`);function D(e,{fireAndForget:t=!1}={}){let n=f.promises.rm(e,{recursive:!0,force:!0,maxRetries:5,retryDelay:100});if(t)n.catch(()=>{});else return n}T(D,`removeDir`);function O(e){f.rmSync(e,{recursive:!0,force:!0,maxRetries:5,retryDelay:100})}T(O,`removeDirSync`);var k=class extends Error{constructor(e){super(`Build Output Specification: ${e}`),this.name=`BuildOutputError`}};async function A(e){return{root:e,version:`v0`,settings:await M(e),workers:[await j(e)]}}async function j(e){let t=x(e);if(!d.existsSync(t))throw new k(`No Worker config found at ${t}.`);let n=await h.readFile(t,`utf-8`),r=s.safeParse(N(n,t));if(!r.success)throw new k(`invalid Worker config at ${t}.\n${r.error.message}`);let i=S(e),a=C(e),o=d.existsSync(i),c=d.existsSync(a);if(r.data.manifest&&!o)throw new k(`Worker config at ${t} contains a manifest, but no bundle directory exists at ${i}.`);if(o)return{configPath:t,config:r.data,bundleDir:i,assetsDir:c?a:void 0};if(c)return{configPath:t,config:r.data,bundleDir:void 0,assetsDir:a};throw new k(`Worker config at ${t} has neither a bundle directory (${i}) nor an assets directory (${a}).`)}async function M(e){let t=v(e);if(!d.existsSync(t))return;let n=await h.readFile(t,`utf-8`),r=a.safeParse(N(n,t));if(!r.success)throw new k(`invalid root config at ${t}.\n${r.error.message}`);return r.data}function N(e,t){try{return JSON.parse(e)}catch(e){throw new k(`could not parse JSON at ${t}.\n${e instanceof Error?e.message:String(e)}`)}}var P=class extends Error{constructor(e){super(e),this.name=`BuildOutputConfigError`}};function F(e,t){let n=e.config,r=o(n,t);n.manifest?.mainModule&&e.bundleDir&&(r.main=m.join(e.bundleDir,n.manifest.mainModule));let i=m.resolve(`cloudflare.config.ts`);return{wranglerConfig:I(r,e.configPath,i),builtConfig:n}}function I(e,t,r){let{config:i,diagnostics:a}=n(e,t,r,{});if(a.hasErrors())throw new P(a.renderErrors());return a.hasWarnings()&&console.warn(a.renderWarnings()),i}var L=e({default:()=>V,runBuild:()=>z});function R(e){return e.option(`mode`,{type:`string`,alias:`m`,description:`Build mode (e.g. production, staging, preview)`})}async function z(e){let n=l(process.cwd()),a=e?[`--mode`,e]:[];c.message(r.bold(`Build`),{symbol:i.dim(`├`),spacing:0}),c.message(`Delegating to ${B(n)}`,{spacing:0});let o=await u(n,`build`,a);if(o!==0)throw new t(o);let{workers:[s],settings:d}=await A(process.cwd());F(s,d),c.success(`Build complete`,{spacing:0})}function B(e){switch(e.impl.pkg){case`@cloudflare/vite-plugin`:return`Vite`;case`wrangler`:return`Wrangler`;case`cloudflare-py-dev-server`:return`the Python dev server`;case`cloudflare-rs-dev-server`:return`the Rust dev server`;default:return e.impl.pkg}}const V={command:`build`,describe:`Build a project for Cloudflare`,builder:R,handler:async e=>{await z(e.mode)}};export{A as a,F as i,z as n,P as r,L as t};