cf 0.11.0 → 0.12.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.
- package/dist/_meta/agent-context.json +3 -3
- package/dist/_meta/commands.json +149 -5
- package/dist/_meta/hand-written-commands.json +181 -5
- package/dist/{abuse-reports-sDBTV0qZ.mjs → abuse-reports-D40QFl-y.mjs} +1 -1
- package/dist/{access-DcNzuCue.mjs → access-Dl2IU1ID.mjs} +1 -1
- package/dist/{account-BX90zXn5.mjs → account-CPbieCZ4.mjs} +1 -1
- package/dist/{account-tags-Bz3JG5hI.mjs → account-tags-skfP7H8k.mjs} +1 -1
- package/dist/{accounts-DCuW3xyZ.mjs → accounts-CSgR6909.mjs} +1 -1
- package/dist/{acm-zjfShZLS.mjs → acm-CVvCTaNk.mjs} +1 -1
- package/dist/{addressing-DORQ64Ux.mjs → addressing-Uq5hEDDP.mjs} +1 -1
- package/dist/{agent-context-BgPR_aQr.mjs → agent-context-BvuDdaJb.mjs} +1 -1
- package/dist/{agent-memory-C0hAUMeC.mjs → agent-memory-BrHMIU0E.mjs} +1 -1
- package/dist/{ai-audit-DnU3vn3E.mjs → ai-audit-BoZuL84i.mjs} +1 -1
- package/dist/{ai-gateway-COOrr_Yw.mjs → ai-gateway-DE50Jem1.mjs} +1 -1
- package/dist/{ai-search-DKbN9Tyd.mjs → ai-search-Fx7NHCHB.mjs} +1 -1
- package/dist/{ai-security-C_I5lo58.mjs → ai-security-DyLbY9kv.mjs} +1 -1
- package/dist/{ai-BpEBGMT2.mjs → ai-v2fP1r0s.mjs} +1 -1
- package/dist/{alerting-4T8gmZs-.mjs → alerting-5mFZjTcD.mjs} +1 -1
- package/dist/{analytics-Bxh4TCP7.mjs → analytics-BygTfozw.mjs} +1 -1
- package/dist/{analytics_engine-fV56bjVN.mjs → analytics_engine-4L-q362P.mjs} +1 -1
- package/dist/{api-security-COk_i184.mjs → api-security-DjFsRYWx.mjs} +1 -1
- package/dist/{argo-DIRfvxvv.mjs → argo-TzXPN7tz.mjs} +1 -1
- package/dist/args-CDgWUP4J.mjs +2 -0
- package/dist/{artifacts-BBfXNfUg.mjs → artifacts-dEw2UUBV.mjs} +1 -1
- package/dist/{audit-logs-BlOrlAWe.mjs → audit-logs-CqY7zzwv.mjs} +1 -1
- package/dist/{auth-DPhNN3Ly.mjs → auth-CPLdkOC7.mjs} +1 -1
- package/dist/{auth-D3X9HYhD.mjs → auth-DY_Y2bXC.mjs} +2 -2
- package/dist/{billing-B9e4PnvN.mjs → billing-DHQuRT8S.mjs} +1 -1
- package/dist/{bot-management-D2JVeS-V.mjs → bot-management-CfqG79hF.mjs} +1 -1
- package/dist/{botnet-feed-BTzTYs5d.mjs → botnet-feed-BOeNnDoH.mjs} +1 -1
- package/dist/{brand-protection-C5Q6Gpw9.mjs → brand-protection-DYttrKIM.mjs} +1 -1
- package/dist/{browser-extension-u5uA0Lwk.mjs → browser-extension-CTUCdgfn.mjs} +1 -1
- package/dist/{browser-run-CHGOCTdG.mjs → browser-run-373D4e1i.mjs} +1 -1
- package/dist/build-D0ir_S70.mjs +2 -0
- package/dist/{cache-C6V7PbQM.mjs → cache-DJXBmc3w.mjs} +1 -1
- package/dist/{calls-Bye8Tyy-.mjs → calls-COO0Eoz1.mjs} +1 -1
- package/dist/{certificate-authorities-B-U_e6JJ.mjs → certificate-authorities-DbHLmKbd.mjs} +1 -1
- package/dist/{cf-Ds4JFovl.mjs → cf-yPz_IqW6.mjs} +11 -11
- package/dist/{chunk-LQW53VED-22IYZovK.mjs → chunk-LQW53VED-9MACsvSG.mjs} +25 -25
- package/dist/{chunk-QBZBEHZB-CKzQKcIp.mjs → chunk-QBZBEHZB-yeyhVUeD.mjs} +1 -1
- package/dist/{client-certificates-3RrC-6LG.mjs → client-certificates-RBRqYP3f.mjs} +1 -1
- package/dist/{client-side-security-DIdKvRMT.mjs → client-side-security-HOmA37et.mjs} +1 -1
- package/dist/{cloud-connector-CL1jPQud.mjs → cloud-connector-C7hw1c1f.mjs} +1 -1
- package/dist/{cloudforce-one-DULeqLkR.mjs → cloudforce-one-DLOj76q4.mjs} +1 -1
- package/dist/command-BV87D4tR.mjs +2 -0
- package/dist/{completions-CqgGKRAC.mjs → completions-BnD46cXe.mjs} +1 -1
- package/dist/config.d.mts +305 -332
- package/dist/config.mjs +1 -1
- package/dist/{connector-interrupts-CXlLObDv.mjs → connector-interrupts-DY-z_LrH.mjs} +1 -1
- package/dist/{connector-telemetry-events-BrYX4ig4.mjs → connector-telemetry-events-DCXmcAc9.mjs} +1 -1
- package/dist/{connector-telemetry-snapshots-BdeBQYcM.mjs → connector-telemetry-snapshots-D8GNuzx3.mjs} +1 -1
- package/dist/{connectors-BQwyBJ4_.mjs → connectors-fEOn-J_i.mjs} +1 -1
- package/dist/containers-BDBsEs7-.mjs +58 -0
- package/dist/{content-scan-DNzhXYkY.mjs → content-scan-Cmj9--XY.mjs} +1 -1
- package/dist/{csamScanner-CFq5s1Q3.mjs → csamScanner-BRXyMCyH.mjs} +1 -1
- package/dist/{ct-alerting-CH6UmsGQ.mjs → ct-alerting-9AvYys-f.mjs} +1 -1
- package/dist/{custom-certificates-DnG73Wg2.mjs → custom-certificates-C5qrlyhb.mjs} +1 -1
- package/dist/{custom-csrs-bhClr2SU.mjs → custom-csrs-BgOnTbBW.mjs} +1 -1
- package/dist/{custom-hostnames-C0eiGvG9.mjs → custom-hostnames-CbQD9aYo.mjs} +1 -1
- package/dist/{custom-nameservers-CVMhhLm6.mjs → custom-nameservers-2ZajBkRC.mjs} +1 -1
- package/dist/{custom-pages-DTINMR30.mjs → custom-pages-Buki_Cb8.mjs} +1 -1
- package/dist/{d1-sKdExJYF.mjs → d1-n2in0cSF.mjs} +1 -1
- package/dist/{data-security-mV3a6UfW.mjs → data-security-DzOQMkv3.mjs} +1 -1
- package/dist/{dcv-delegation-dBu3jdRw.mjs → dcv-delegation-BTP9LCOm.mjs} +1 -1
- package/dist/deploy-BUSz35vq.mjs +2 -0
- package/dist/deploy-input-BvD9aRP1.mjs +2 -0
- package/dist/dev-DY_DquQx.mjs +4 -0
- package/dist/{diagnostics-CJV6qWUA.mjs → diagnostics-BvHV8kQb.mjs} +1 -1
- package/dist/{directory-B5zCMusW.mjs → directory-BeiSyg8A.mjs} +1 -1
- package/dist/{dispatch-namespaces-Dg5lu5xX.mjs → dispatch-namespaces-Dp8Jjpwy.mjs} +1 -1
- package/dist/dist-BBx1io2f.mjs +2 -0
- package/dist/dist-Cb9TJ2VV.mjs +9 -0
- package/dist/dist-DV7LR38l.mjs +387 -0
- package/dist/dist-DvizctjW.mjs +48 -0
- package/dist/{dls-t0hnIe_P.mjs → dls-BwoU29mS.mjs} +1 -1
- package/dist/{dns-C8FC2hbh.mjs → dns-DISAfuzj.mjs} +1 -1
- package/dist/{dns-firewall-CuhhUm55.mjs → dns-firewall-wBcCx_ua.mjs} +1 -1
- package/dist/dry-run-ILZRVpnp.mjs +2 -0
- package/dist/{durable-objects-BLrgM3Cw.mjs → durable-objects-DhDL3San.mjs} +1 -1
- package/dist/{email-auth-BmYrl0pO.mjs → email-auth-BROqK6-C.mjs} +1 -1
- package/dist/{email-routing-CF3_Z957.mjs → email-routing-BZXHDAOO.mjs} +1 -1
- package/dist/{email-security-F7OYcMkZ.mjs → email-security-DVumybrk.mjs} +1 -1
- package/dist/{email-sending-EyU3WvGQ.mjs → email-sending-CDQ3_wyz.mjs} +1 -1
- package/dist/{fieldExtractors-Cno37T2m.mjs → fieldExtractors-Cy1rxHEF.mjs} +1 -1
- package/dist/{firewall-8YWWy4iB.mjs → firewall-C0g5X7Zd.mjs} +1 -1
- package/dist/{flagship-C4x0l-8J.mjs → flagship-fFBiZUz-.mjs} +1 -1
- package/dist/{fraud-HR_SdUx3.mjs → fraud-CjIETOaM.mjs} +1 -1
- package/dist/{google-tag-gateway-BdcS0WnX.mjs → google-tag-gateway-hPa5IHUx.mjs} +1 -1
- package/dist/{healthchecks-4qOvjrTN.mjs → healthchecks-CoycpTf9.mjs} +1 -1
- package/dist/{hostnames-DehdYOMz.mjs → hostnames-x_Yezxpr.mjs} +1 -1
- package/dist/{hyperdrive-3gD3hn70.mjs → hyperdrive-BlfrTwSq.mjs} +1 -1
- package/dist/{iam-DR72hmii.mjs → iam-Bk7K_PPO.mjs} +1 -1
- package/dist/{images-CeKc5JPh.mjs → images-BAEFb9q1.mjs} +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{intel-DtFix9WL.mjs → intel-DDkyJVaP.mjs} +1 -1
- package/dist/interactive-CRnq-B5I.mjs +11 -0
- package/dist/{interactive-C7M55Wxx.mjs → interactive-cytQzL94.mjs} +1 -1
- package/dist/{ips-CtWCjXAN.mjs → ips-DU0ti0i0.mjs} +1 -1
- package/dist/{keyless-certificates-Dk24yQFz.mjs → keyless-certificates-E1P9jBTb.mjs} +1 -1
- package/dist/{keys-BmhG6Kn1.mjs → keys-DqldTZqH.mjs} +1 -1
- package/dist/{kv-BuVPAuZP.mjs → kv-CcfCfnwq.mjs} +1 -1
- package/dist/{leaked-credential-checks-XcZmt1I-.mjs → leaked-credential-checks-CqmKaEbd.mjs} +1 -1
- package/dist/{load-balancers-CylN-l7n.mjs → load-balancers-Dg4pDad1.mjs} +1 -1
- package/dist/{local-Be3lg_9E.mjs → local-DGiIS1uM.mjs} +1 -1
- package/dist/local-runtime--IQr44qq.mjs +2 -0
- package/dist/{logexplorer-CvRPoKbj.mjs → logexplorer-Bu2mG5rh.mjs} +1 -1
- package/dist/{logo-matches-Heuft3yF.mjs → logo-matches-CWUzxY7G.mjs} +1 -1
- package/dist/{logos-DRYjGBDq.mjs → logos-BTfdkDPi.mjs} +1 -1
- package/dist/{logpush-Dve9jOMp.mjs → logpush-BZyay3h2.mjs} +1 -1
- package/dist/{logs-SC86FE89.mjs → logs-BqF7jjQO.mjs} +1 -1
- package/dist/{magic-cloud-networking-DXzeqwX-.mjs → magic-cloud-networking-Dhd8pTyM.mjs} +1 -1
- package/dist/{magic-network-monitoring-DW0Jl74i.mjs → magic-network-monitoring-D0FnkjuN.mjs} +1 -1
- package/dist/{magic-transit-BK_3asH2.mjs → magic-transit-B5skt0G7.mjs} +1 -1
- package/dist/{managed-transforms-B6TV4qoE.mjs → managed-transforms-B6X_crcJ.mjs} +1 -1
- package/dist/{matches-Iss9Fo4R.mjs → matches-DeYaB4I0.mjs} +1 -1
- package/dist/{mcp-8wxXT6JU.mjs → mcp-ChjBiMx2.mjs} +1 -1
- package/dist/{mesh-Bf9UAS4J.mjs → mesh-DRVAFLBX.mjs} +1 -1
- package/dist/{moq-ZKMFOeVz.mjs → moq-DE7VDEFS.mjs} +1 -1
- package/dist/{mtls-certificates-DoWm6GiE.mjs → mtls-certificates-Cbc3uAkN.mjs} +1 -1
- package/dist/{network-B1lBARU9.mjs → network-CDPZNFbn.mjs} +1 -1
- package/dist/{network-interconnects-CLYIFHfU.mjs → network-interconnects-CMRs_chR.mjs} +1 -1
- package/dist/{oauth-DuEONNgC.mjs → oauth-DAa7SwkM.mjs} +4 -4
- package/dist/{oauth-clients-DgiTzLzu.mjs → oauth-clients-DAI_gcuL.mjs} +1 -1
- package/dist/{oauth-scopes-BOBRMxjm.mjs → oauth-scopes-BE6xF4_h.mjs} +1 -1
- package/dist/{observability-Jya7-zkl.mjs → observability-DnyI8rPJ.mjs} +1 -1
- package/dist/{organization-CYxYV4e0.mjs → organization-yh0mSUdI.mjs} +1 -1
- package/dist/{organizations-SacGUW44.mjs → organizations-B3aU-RCG.mjs} +1 -1
- package/dist/{origin-ca-certificates-Ph1bJGQ1.mjs → origin-ca-certificates-BaNWfVqf.mjs} +1 -1
- package/dist/{origin-post-quantum-encryption-BBLiGAGB.mjs → origin-post-quantum-encryption-CIUtQgyv.mjs} +1 -1
- package/dist/{origin-tls-client-auth-DSDgTN2X.mjs → origin-tls-client-auth-CvEpbX2Q.mjs} +1 -1
- package/dist/{page-rules-BqEyFR2c.mjs → page-rules-CzbyXbt6.mjs} +1 -1
- package/dist/{pages-CQ7ZVWk1.mjs → pages-CX8yefTI.mjs} +1 -1
- package/dist/{pay-per-crawl-BMe_3_Qj.mjs → pay-per-crawl-v4vBOMWD.mjs} +1 -1
- package/dist/{pipelines-6De2Pe2C.mjs → pipelines-BZ1KGupx.mjs} +1 -1
- package/dist/{precursor-iwK-1P_d.mjs → precursor-D42A9ay5.mjs} +1 -1
- package/dist/{progress-BqQcF5QH.mjs → progress-jYW64HY7.mjs} +1 -1
- package/dist/{project-settings-C_1-JI6Y.mjs → project-settings-BN7tL0c7.mjs} +2 -2
- package/dist/{prompt-B0sWIs9c.mjs → prompt-CyATfGUu.mjs} +1 -1
- package/dist/{public-BYCVISMH-DnMJ5Jct.mjs → public-BMg6-Hxh-DgIH5obr.mjs} +1 -1
- package/dist/{queries-c7zvnfEQ.mjs → queries-xvETUjUE.mjs} +1 -1
- package/dist/{queues-BU6y16qS.mjs → queues-CpqHDtxF.mjs} +1 -1
- package/dist/{r2-data-catalog-B-tw-JdG.mjs → r2-data-catalog-DgKmlTKR.mjs} +1 -1
- package/dist/{r2-Jo3QMahK.mjs → r2-jhmLvD1z.mjs} +1 -1
- package/dist/{radar-DIYAMEof.mjs → radar-C2J16wpX.mjs} +1 -1
- package/dist/{rate-limits-DewOcznT.mjs → rate-limits-CoH9Xma0.mjs} +1 -1
- package/dist/{raw-fetch-Cc-MjHeL.mjs → raw-fetch-CNKIypJ7.mjs} +1 -1
- package/dist/{realtimekit-cnZEVNDn.mjs → realtimekit-CDs0Z5WW.mjs} +1 -1
- package/dist/{registrar-BsWr_aPM.mjs → registrar-BI5ewTAk.mjs} +1 -1
- package/dist/{registrar-sandbox-BlcpUyIH.mjs → registrar-sandbox-al1znWMc.mjs} +1 -1
- package/dist/{registry-jifR3_Y6.mjs → registry-5-I2XLwF.mjs} +1 -1
- package/dist/{reporting--1AyTV7k.mjs → reporting-CxsdHAH3.mjs} +1 -1
- package/dist/{request-tracers-C_VX7X6-.mjs → request-tracers-DJJCncft.mjs} +1 -1
- package/dist/{resource-sharing-Br5dqr3o.mjs → resource-sharing-qQGn8AEn.mjs} +1 -1
- package/dist/{resource-tagging-C33U6T74.mjs → resource-tagging-aTtpX5e5.mjs} +1 -1
- package/dist/{rules-BfjzALMi.mjs → rules-PpsDU89Q.mjs} +1 -1
- package/dist/{rulesets-3i_1Vwt-.mjs → rulesets-DP12Aqik.mjs} +1 -1
- package/dist/{rum-CjmIckiR.mjs → rum-DxvpzJYc.mjs} +1 -1
- package/dist/{schema-1mwmslUV.mjs → schema-DlLbiOJj.mjs} +1 -1
- package/dist/{schema-flags-llLJuFFw.mjs → schema-flags-CTfQVGCs.mjs} +1 -1
- package/dist/schemas-BFCBlp_W.mjs +65 -0
- package/dist/{scim-pApmzA5B.mjs → scim-DJ4AVU20.mjs} +1 -1
- package/dist/{secrets-store-DBC9WJau.mjs → secrets-store-D6KDNo_s.mjs} +1 -1
- package/dist/{security-center-Djm06dq-.mjs → security-center-008FMs_z.mjs} +1 -1
- package/dist/{security-txt-Ci7bP4zH.mjs → security-txt-CqcfrhlN.mjs} +1 -1
- package/dist/{share-Dj-MNXrw.mjs → share-D5fzsVAJ.mjs} +1 -1
- package/dist/{shared-BJvq4DkR.mjs → shared-DlKGNPiT.mjs} +92 -142
- package/dist/{smart-shield--8EpJjrF.mjs → smart-shield-DpFscIk8.mjs} +1 -1
- package/dist/{snippets-Dyz0PH60.mjs → snippets-CCKgI2ZX.mjs} +1 -1
- package/dist/spawn-C3_tJ3RB.mjs +526 -0
- package/dist/{spectrum-rAHWz8rH.mjs → spectrum-LmdqY3ki.mjs} +1 -1
- package/dist/{speed-BKepWBXj.mjs → speed-CEK36h3A.mjs} +1 -1
- package/dist/src-CEb2fgtT.mjs +108 -0
- package/dist/{ssl-KdFiY3ev.mjs → ssl-ChHUyaQm.mjs} +1 -1
- package/dist/{startup-profile-GLNPHQ9U.mjs → startup-profile-Dpxg-MjV.mjs} +3 -3
- package/dist/{state-Cu3cItUg.mjs → state-DeX23Kmg.mjs} +1 -1
- package/dist/{stream-CKJ6Tb0M.mjs → stream-DfUSELMX.mjs} +1 -1
- package/dist/{submit-BxbKKhBn.mjs → submit-DF2G5CIz.mjs} +1 -1
- package/dist/{tags-DA8dq9fx.mjs → tags-nFJJHlLJ.mjs} +1 -1
- package/dist/{tenant-DLXw48hS.mjs → tenant-CRLw1oRU.mjs} +1 -1
- package/dist/{tenant-custom-nameservers-9G93XuvU.mjs → tenant-custom-nameservers-BvBQRDcs.mjs} +1 -1
- package/dist/{tools-x8bj9E6b.mjs → tools-j8UGEtP1.mjs} +1 -1
- package/dist/{tunnel-CNQA5Flp.mjs → tunnel-CMQeBgmb.mjs} +1 -1
- package/dist/{tunnels-CC10EOsU.mjs → tunnels-iVA3MrdS.mjs} +1 -1
- package/dist/{turnstile-CH58hnf4.mjs → turnstile-DQHP6-_b.mjs} +1 -1
- package/dist/{ui-CmnnBm_O.mjs → ui-DJFcf61J.mjs} +1 -1
- package/dist/{url-info-BpCgdUtL.mjs → url-info-BVgdb_pf.mjs} +1 -1
- package/dist/{url-normalization-BzuynEy1.mjs → url-normalization-BTcxLxIQ.mjs} +1 -1
- package/dist/{url-scanner-APIZbhB7.mjs → url-scanner-DwuDZLPk.mjs} +1 -1
- package/dist/{user-2-NGebfI.mjs → user-I_MbB_KX.mjs} +1 -1
- package/dist/{values-S_bNv819.mjs → values-S-Q7-5o8.mjs} +1 -1
- package/dist/{vectorize-Bv7feLBC.mjs → vectorize-CNZdF_0A.mjs} +1 -1
- package/dist/{waiting-rooms-Dk4LIpvm.mjs → waiting-rooms-Bo-OSsxu.mjs} +1 -1
- package/dist/{web-assets-C1UmOyzD.mjs → web-assets-tlFzKdNL.mjs} +1 -1
- package/dist/{web3-GnUocVYH.mjs → web3-CdbfoZ2x.mjs} +1 -1
- package/dist/{workers-J1-PLwdl.mjs → workers-DQ9Q7czn.mjs} +2 -2
- package/dist/{workers-builds-DCHmWOMS.mjs → workers-builds-CGRhYx-x.mjs} +1 -1
- package/dist/{workflows-CArfEI2c.mjs → workflows-BhEy-crm.mjs} +1 -1
- package/dist/{zaraz-mg2YlR3_.mjs → zaraz-DbKvA_8C.mjs} +1 -1
- package/dist/{zero-trust-DVdUPtj1.mjs → zero-trust-DrHCPVOc.mjs} +1 -1
- package/dist/{zone-DMAfrDJX.mjs → zone-D2zrbJI2.mjs} +1 -1
- package/dist/{zones-CNwxUi7I.mjs → zones-DrpxQ_-A.mjs} +1 -1
- package/package.json +9 -8
- package/dist/args-DlUhyGU0.mjs +0 -2
- package/dist/build-D0FhOj40.mjs +0 -8
- package/dist/command-C9VP3xaA.mjs +0 -2
- package/dist/containers-BrQtGiNp.mjs +0 -58
- package/dist/deploy-BL59O1O1.mjs +0 -2
- package/dist/deploy-input-Dz6q-__n.mjs +0 -2
- package/dist/dev-BDaavgH1.mjs +0 -4
- package/dist/dist-BHi7UhXO.mjs +0 -72
- package/dist/dist-BWpErtDM.mjs +0 -384
- package/dist/dry-run-DL2V6yFm.mjs +0 -2
- package/dist/local-runtime-Ce7k598H.mjs +0 -2
- package/dist/spawn-C5Z7oWdp.mjs +0 -519
- package/dist/src-gJma71Ec.mjs +0 -108
- /package/dist/{alerts-15-IW4jE.mjs → alerts-9PR5sQ_z.mjs} +0 -0
- /package/dist/{autorag-CFwRkEKw.mjs → autorag-Bevo1kIH.mjs} +0 -0
- /package/dist/{body-parser-BshbixEq.mjs → body-parser-BGVbwPeM.mjs} +0 -0
- /package/dist/{brands-BgT1vu9B.mjs → brands-C4M04Man.mjs} +0 -0
- /package/dist/{clear-BlCK85Me.mjs → clear-DS0eRXOc.mjs} +0 -0
- /package/dist/{cli-types-DAYeL_Mj.mjs → cli-types-C3nVfpSG.mjs} +0 -0
- /package/dist/{connector-telemetry-events-latest-BbpcII3_.mjs → connector-telemetry-events-latest-CKKG6_pD.mjs} +0 -0
- /package/dist/{connector-telemetry-snapshots-latest-DuCiimXl.mjs → connector-telemetry-snapshots-latest-Bv5OddJr.mjs} +0 -0
- /package/dist/{domain-info-C7LBxPBt.mjs → domain-info-BUiaGCEq.mjs} +0 -0
- /package/dist/{health-DZFfafkX.mjs → health-vX6Ml2Na.mjs} +0 -0
- /package/dist/{input-validation-QDIYu7Vb.mjs → input-validation-1esLElok.mjs} +0 -0
- /package/dist/{internal-BKHC2D1Y.mjs → internal-ROz7anul.mjs} +0 -0
- /package/dist/{live-DwCvDmaH.mjs → live-CSxvigCS.mjs} +0 -0
- /package/dist/{metadata-B5yfL0ln.mjs → metadata-DEqBUaSv.mjs} +0 -0
- /package/dist/{open-PBXRGS4R-CX8K4WYl.mjs → open-PBXRGS4R-DIiYQyU9.mjs} +0 -0
- /package/dist/{output-Ccqw2WOb.mjs → output-BqDR9h74.mjs} +0 -0
- /package/dist/{rate-limit-analytics-B8Vuu1sU.mjs → rate-limit-analytics-CgHgKjmV.mjs} +0 -0
- /package/dist/{ready-D9H2zHHI.mjs → ready-6G9zVGPJ.mjs} +0 -0
- /package/dist/{recent-submissions-BPo0J80d.mjs → recent-submissions-B3Smh-QM.mjs} +0 -0
- /package/dist/{refute-2W8NLCN4.mjs → refute-DjkmLSNe.mjs} +0 -0
- /package/dist/{resolve-B8CyM1mi.mjs → resolve-DEvdeprv.mjs} +0 -0
- /package/dist/{scan-logo-D5x6F1Y0.mjs → scan-logo-545qLcGs.mjs} +0 -0
- /package/dist/{scan-page-CWhta3x7.mjs → scan-page-DRQiVufl.mjs} +0 -0
- /package/dist/{search-DZmBQJL9.mjs → search-CXbqFoqe.mjs} +0 -0
- /package/dist/{signed-url-CQrmWgz5.mjs → signed-url-rU_nvgFA.mjs} +0 -0
- /package/dist/{submission-info-C98A0bqq.mjs → submission-info-D6PgXNQP.mjs} +0 -0
- /package/dist/{total-queries-BZoaFoDE.mjs → total-queries-XkFyu8H5.mjs} +0 -0
- /package/dist/{tracked-domains-CNHogPHx.mjs → tracked-domains-CmcRXHj_.mjs} +0 -0
- /package/dist/{verify-4e4L9IRk.mjs → verify-CM1NakP0.mjs} +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{i as e,r as t,t as n}from"./chunk-vbHwaUoU.mjs";import{P as r,Tt as i}from"./dist-BWpErtDM.mjs";import{n as a,o}from"./chunk-QBZBEHZB-CKzQKcIp.mjs";import{gzipSync as s}from"node:zlib";import{randomUUID as c}from"node:crypto";import{readFile as l}from"node:fs/promises";import{clearTimeout as u,setTimeout as d}from"node:timers";import{Miniflare as f,convertV4MiniflareOptions as p}from"miniflare";var m=n(((e,t)=>{let n=[`nodebuffer`,`arraybuffer`,`fragments`],r=typeof Blob<`u`;r&&n.push(`blob`),t.exports={BINARY_TYPES:n,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:`258EAFA5-E914-47DA-95CA-C5AB0DC85B11`,hasBlob:r,kForOnEventAttribute:Symbol(`kIsForOnEventAttribute`),kListener:Symbol(`kListener`),kStatusCode:Symbol(`status-code`),kWebSocket:Symbol(`websocket`),NOOP:()=>{}}})),h=n(((e,n)=>{let{EMPTY_BUFFER:r}=m(),i=Buffer[Symbol.species];function a(e,t){if(e.length===0)return r;if(e.length===1)return e[0];let n=Buffer.allocUnsafe(t),a=0;for(let t=0;t<e.length;t++){let r=e[t];n.set(r,a),a+=r.length}return a<t?new i(n.buffer,n.byteOffset,a):n}function o(e,t,n,r,i){for(let a=0;a<i;a++)n[r+a]=e[a]^t[a&3]}function s(e,t){for(let n=0;n<e.length;n++)e[n]^=t[n&3]}function c(e){return e.length===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.length)}function l(e){if(l.readOnly=!0,Buffer.isBuffer(e))return e;let t;return e instanceof ArrayBuffer?t=new i(e):ArrayBuffer.isView(e)?t=new i(e.buffer,e.byteOffset,e.byteLength):(t=Buffer.from(e),l.readOnly=!1),t}if(n.exports={concat:a,mask:o,toArrayBuffer:c,toBuffer:l,unmask:s},!process.env.WS_NO_BUFFER_UTIL)try{let e=t(`bufferutil`);n.exports.mask=function(t,n,r,i,a){a<48?o(t,n,r,i,a):e.mask(t,n,r,i,a)},n.exports.unmask=function(t,n){t.length<32?s(t,n):e.unmask(t,n)}}catch{}})),g=n(((e,t)=>{let n=Symbol(`kDone`),r=Symbol(`kRun`);t.exports=class{constructor(e){this[n]=()=>{this.pending--,this[r]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[r]()}[r](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[n])}}}})),_=n(((e,n)=>{let r=t(`zlib`),i=h(),a=g(),{kStatusCode:o}=m(),s=Buffer[Symbol.species],c=Buffer.from([0,0,255,255]),l=Symbol(`permessage-deflate`),u=Symbol(`total-length`),d=Symbol(`callback`),f=Symbol(`buffers`),p=Symbol(`error`),_;n.exports=class{constructor(e){this._options=e||{},this._threshold=this._options.threshold===void 0?1024:this._options.threshold,this._maxPayload=this._options.maxPayload|0,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,_||=new a(this._options.concurrencyLimit===void 0?10:this._options.concurrencyLimit)}static get extensionName(){return`permessage-deflate`}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits??(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&=(this._inflate.close(),null),this._deflate){let e=this._deflate[d];this._deflate.close(),this._deflate=null,e&&e(Error(`The deflate stream was closed while data was being processed`))}}acceptAsServer(e){let t=this._options,n=e.find(e=>!(t.serverNoContextTakeover===!1&&e.server_no_context_takeover||e.server_max_window_bits&&(t.serverMaxWindowBits===!1||typeof t.serverMaxWindowBits==`number`&&t.serverMaxWindowBits>e.server_max_window_bits)||typeof t.clientMaxWindowBits==`number`&&!e.client_max_window_bits));if(!n)throw Error(`None of the extension offers can be accepted`);return t.serverNoContextTakeover&&(n.server_no_context_takeover=!0),t.clientNoContextTakeover&&(n.client_no_context_takeover=!0),typeof t.serverMaxWindowBits==`number`&&(n.server_max_window_bits=t.serverMaxWindowBits),typeof t.clientMaxWindowBits==`number`?n.client_max_window_bits=t.clientMaxWindowBits:(n.client_max_window_bits===!0||t.clientMaxWindowBits===!1)&&delete n.client_max_window_bits,n}acceptAsClient(e){let t=e[0];if(this._options.clientNoContextTakeover===!1&&t.client_no_context_takeover)throw Error(`Unexpected parameter "client_no_context_takeover"`);if(!t.client_max_window_bits)typeof this._options.clientMaxWindowBits==`number`&&(t.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits==`number`&&t.client_max_window_bits>this._options.clientMaxWindowBits)throw Error(`Unexpected or invalid parameter "client_max_window_bits"`);return t}normalizeParams(e){return e.forEach(e=>{Object.keys(e).forEach(t=>{let n=e[t];if(n.length>1)throw Error(`Parameter "${t}" must have only a single value`);if(n=n[0],t===`client_max_window_bits`){if(n!==!0){let e=+n;if(!Number.isInteger(e)||e<8||e>15)throw TypeError(`Invalid value for parameter "${t}": ${n}`);n=e}else if(!this._isServer)throw TypeError(`Invalid value for parameter "${t}": ${n}`)}else if(t===`server_max_window_bits`){let e=+n;if(!Number.isInteger(e)||e<8||e>15)throw TypeError(`Invalid value for parameter "${t}": ${n}`);n=e}else if(t===`client_no_context_takeover`||t===`server_no_context_takeover`){if(n!==!0)throw TypeError(`Invalid value for parameter "${t}": ${n}`)}else throw Error(`Unknown parameter "${t}"`);e[t]=n})}),e}decompress(e,t,n){_.add(r=>{this._decompress(e,t,(e,t)=>{r(),n(e,t)})})}compress(e,t,n){_.add(r=>{this._compress(e,t,(e,t)=>{r(),n(e,t)})})}_decompress(e,t,n){let a=this._isServer?`client`:`server`;if(!this._inflate){let e=`${a}_max_window_bits`,t=typeof this.params[e]==`number`?this.params[e]:r.Z_DEFAULT_WINDOWBITS;this._inflate=r.createInflateRaw({...this._options.zlibInflateOptions,windowBits:t}),this._inflate[l]=this,this._inflate[u]=0,this._inflate[f]=[],this._inflate.on(`error`,b),this._inflate.on(`data`,y)}this._inflate[d]=n,this._inflate.write(e),t&&this._inflate.write(c),this._inflate.flush(()=>{let e=this._inflate[p];if(e){this._inflate.close(),this._inflate=null,n(e);return}let r=i.concat(this._inflate[f],this._inflate[u]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[u]=0,this._inflate[f]=[],t&&this.params[`${a}_no_context_takeover`]&&this._inflate.reset()),n(null,r)})}_compress(e,t,n){let a=this._isServer?`server`:`client`;if(!this._deflate){let e=`${a}_max_window_bits`,t=typeof this.params[e]==`number`?this.params[e]:r.Z_DEFAULT_WINDOWBITS;this._deflate=r.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:t}),this._deflate[u]=0,this._deflate[f]=[],this._deflate.on(`data`,v)}this._deflate[d]=n,this._deflate.write(e),this._deflate.flush(r.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let e=i.concat(this._deflate[f],this._deflate[u]);t&&(e=new s(e.buffer,e.byteOffset,e.length-4)),this._deflate[d]=null,this._deflate[u]=0,this._deflate[f]=[],t&&this.params[`${a}_no_context_takeover`]&&this._deflate.reset(),n(null,e)})}};function v(e){this[f].push(e),this[u]+=e.length}function y(e){if(this[u]+=e.length,this[l]._maxPayload<1||this[u]<=this[l]._maxPayload){this[f].push(e);return}this[p]=RangeError(`Max payload size exceeded`),this[p].code=`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`,this[p][o]=1009,this.removeListener(`data`,y),this.reset()}function b(e){if(this[l]._inflate=null,this[p]){this[d](this[p]);return}e[o]=1007,this[d](e)}})),v=n(((e,n)=>{let{isUtf8:r}=t(`buffer`),{hasBlob:i}=m(),a=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function o(e){return e>=1e3&&e<=1014&&e!==1004&&e!==1005&&e!==1006||e>=3e3&&e<=4999}function s(e){let t=e.length,n=0;for(;n<t;)if(!(e[n]&128))n++;else if((e[n]&224)==192){if(n+1===t||(e[n+1]&192)!=128||(e[n]&254)==192)return!1;n+=2}else if((e[n]&240)==224){if(n+2>=t||(e[n+1]&192)!=128||(e[n+2]&192)!=128||e[n]===224&&(e[n+1]&224)==128||e[n]===237&&(e[n+1]&224)==160)return!1;n+=3}else if((e[n]&248)==240){if(n+3>=t||(e[n+1]&192)!=128||(e[n+2]&192)!=128||(e[n+3]&192)!=128||e[n]===240&&(e[n+1]&240)==128||e[n]===244&&e[n+1]>143||e[n]>244)return!1;n+=4}else return!1;return!0}function c(e){return i&&typeof e==`object`&&typeof e.arrayBuffer==`function`&&typeof e.type==`string`&&typeof e.stream==`function`&&(e[Symbol.toStringTag]===`Blob`||e[Symbol.toStringTag]===`File`)}if(n.exports={isBlob:c,isValidStatusCode:o,isValidUTF8:s,tokenChars:a},r)n.exports.isValidUTF8=function(e){return e.length<24?s(e):r(e)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let e=t(`utf-8-validate`);n.exports.isValidUTF8=function(t){return t.length<32?s(t):e(t)}}catch{}})),y=n(((e,n)=>{let{Writable:r}=t(`stream`),i=_(),{BINARY_TYPES:a,EMPTY_BUFFER:o,kStatusCode:s,kWebSocket:c}=m(),{concat:l,toArrayBuffer:u,unmask:d}=h(),{isValidStatusCode:f,isValidUTF8:p}=v(),g=Buffer[Symbol.species];n.exports=class extends r{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents===void 0?!0:e.allowSynchronousEvents,this._binaryType=e.binaryType||a[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxBufferedChunks=e.maxBufferedChunks|0,this._maxFragments=e.maxFragments|0,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[c]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=0}_write(e,t,n){if(this._opcode===8&&this._state==0)return n();if(this._maxBufferedChunks>0&&this._buffers.length>=this._maxBufferedChunks){n(this.createError(RangeError,`Too many buffered chunks`,!1,1008,`WS_ERR_TOO_MANY_BUFFERED_PARTS`));return}this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(n)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let t=this._buffers[0];return this._buffers[0]=new g(t.buffer,t.byteOffset+e,t.length-e),new g(t.buffer,t.byteOffset,e)}let t=Buffer.allocUnsafe(e);do{let n=this._buffers[0],r=t.length-e;e>=n.length?t.set(this._buffers.shift(),r):(t.set(new Uint8Array(n.buffer,n.byteOffset,e),r),this._buffers[0]=new g(n.buffer,n.byteOffset+e,n.length-e)),e-=n.length}while(e>0);return t}startLoop(e){this._loop=!0;do switch(this._state){case 0:this.getInfo(e);break;case 1:this.getPayloadLength16(e);break;case 2:this.getPayloadLength64(e);break;case 3:this.getMask();break;case 4:this.getData(e);break;case 5:case 6:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let t=this.consume(2);if(t[0]&48){e(this.createError(RangeError,`RSV2 and RSV3 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_2_3`));return}let n=(t[0]&64)==64;if(n&&!this._extensions[i.extensionName]){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(this._fin=(t[0]&128)==128,this._opcode=t[0]&15,this._payloadLength=t[1]&127,this._opcode===0){if(n){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(!this._fragmented){e(this.createError(RangeError,`invalid opcode 0`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}this._compressed=n}else if(this._opcode>7&&this._opcode<11){if(!this._fin){e(this.createError(RangeError,`FIN must be set`,!0,1002,`WS_ERR_EXPECTED_FIN`));return}if(n){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){e(this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,`WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH`));return}}else{e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(t[1]&128)==128,this._isServer){if(!this._masked){e(this.createError(RangeError,`MASK must be set`,!0,1002,`WS_ERR_EXPECTED_MASK`));return}}else if(this._masked){e(this.createError(RangeError,`MASK must be clear`,!0,1002,`WS_ERR_UNEXPECTED_MASK`));return}this._payloadLength===126?this._state=1:this._payloadLength===127?this._state=2:this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=!1;return}let t=this.consume(8),n=t.readUInt32BE(0);if(n>2**21-1){e(this.createError(RangeError,`Unsupported WebSocket frame: payload length > 2^53 - 1`,!1,1009,`WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH`));return}this._payloadLength=n*2**32+t.readUInt32BE(4),this.haveLength(e)}haveLength(e){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){e(this.createError(RangeError,`Max payload size exceeded`,!1,1009,`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`));return}this._masked?this._state=3:this._state=4}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=4}getData(e){let t=o;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}t=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&d(t,this._mask)}if(this._opcode>7){this.controlMessage(t,e);return}if(this._compressed){this._state=5,this.decompress(t,e);return}if(t.length){if(this._maxFragments>0&&this._fragments.length>=this._maxFragments){e(this.createError(RangeError,`Too many message fragments`,!1,1008,`WS_ERR_TOO_MANY_BUFFERED_PARTS`));return}this._messageLength=this._totalPayloadLength,this._fragments.push(t)}this.dataMessage(e)}decompress(e,t){this._extensions[i.extensionName].decompress(e,this._fin,(e,n)=>{if(e)return t(e);if(n.length){if(this._messageLength+=n.length,this._messageLength>this._maxPayload&&this._maxPayload>0){t(this.createError(RangeError,`Max payload size exceeded`,!1,1009,`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`));return}if(this._maxFragments>0&&this._fragments.length>=this._maxFragments){t(this.createError(RangeError,`Too many message fragments`,!1,1008,`WS_ERR_TOO_MANY_BUFFERED_PARTS`));return}this._fragments.push(n)}this.dataMessage(t),this._state===0&&this.startLoop(t)})}dataMessage(e){if(!this._fin){this._state=0;return}let t=this._messageLength,n=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let r;r=this._binaryType===`nodebuffer`?l(n,t):this._binaryType===`arraybuffer`?u(l(n,t)):this._binaryType===`blob`?new Blob(n):n,this._allowSynchronousEvents?(this.emit(`message`,r,!0),this._state=0):(this._state=6,setImmediate(()=>{this.emit(`message`,r,!0),this._state=0,this.startLoop(e)}))}else{let r=l(n,t);if(!this._skipUTF8Validation&&!p(r)){e(this.createError(Error,`invalid UTF-8 sequence`,!0,1007,`WS_ERR_INVALID_UTF8`));return}this._state===5||this._allowSynchronousEvents?(this.emit(`message`,r,!1),this._state=0):(this._state=6,setImmediate(()=>{this.emit(`message`,r,!1),this._state=0,this.startLoop(e)}))}}controlMessage(e,t){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit(`conclude`,1005,o),this.end();else{let n=e.readUInt16BE(0);if(!f(n)){t(this.createError(RangeError,`invalid status code ${n}`,!0,1002,`WS_ERR_INVALID_CLOSE_CODE`));return}let r=new g(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!p(r)){t(this.createError(Error,`invalid UTF-8 sequence`,!0,1007,`WS_ERR_INVALID_UTF8`));return}this._loop=!1,this.emit(`conclude`,n,r),this.end()}this._state=0;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?`ping`:`pong`,e),this._state=0):(this._state=6,setImmediate(()=>{this.emit(this._opcode===9?`ping`:`pong`,e),this._state=0,this.startLoop(t)}))}createError(e,t,n,r,i){this._loop=!1,this._errored=!0;let a=new e(n?`Invalid WebSocket frame: ${t}`:t);return Error.captureStackTrace(a,this.createError),a.code=i,a[s]=r,a}}})),b=n(((e,n)=>{let{Duplex:r}=t(`stream`),{randomFillSync:i}=t(`crypto`),{types:{isUint8Array:a}}=t(`util`),o=_(),{EMPTY_BUFFER:s,kWebSocket:c,NOOP:l}=m(),{isBlob:u,isValidStatusCode:d}=v(),{mask:f,toBuffer:p}=h(),g=Symbol(`kByteLength`),y=Buffer.alloc(4),b=8*1024,x,S=b;n.exports=class e{constructor(e,t,n){this._extensions=t||{},n&&(this._generateMask=n,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=0,this.onerror=l,this[c]=void 0}static frame(e,t){let n,r=!1,a=2,o=!1;t.mask&&(n=t.maskBuffer||y,t.generateMask?t.generateMask(n):(S===b&&(x===void 0&&(x=Buffer.alloc(b)),i(x,0,b),S=0),n[0]=x[S++],n[1]=x[S++],n[2]=x[S++],n[3]=x[S++]),o=(n[0]|n[1]|n[2]|n[3])===0,a=6);let s;typeof e==`string`?(!t.mask||o)&&t[g]!==void 0?s=t[g]:(e=Buffer.from(e),s=e.length):(s=e.length,r=t.mask&&t.readOnly&&!o);let c=s;s>=65536?(a+=8,c=127):s>125&&(a+=2,c=126);let l=Buffer.allocUnsafe(r?s+a:a);return l[0]=t.fin?t.opcode|128:t.opcode,t.rsv1&&(l[0]|=64),l[1]=c,c===126?l.writeUInt16BE(s,2):c===127&&(l[2]=l[3]=0,l.writeUIntBE(s,4,6)),!t.mask||(l[1]|=128,l[a-4]=n[0],l[a-3]=n[1],l[a-2]=n[2],l[a-1]=n[3],o)?[l,e]:r?(f(e,n,l,a,s),[l]):(f(e,n,e,0,s),[l,e])}close(t,n,r,i){let o;if(t===void 0)o=s;else if(typeof t!=`number`||!d(t))throw TypeError(`First argument must be a valid error code number`);else if(n===void 0||!n.length)o=Buffer.allocUnsafe(2),o.writeUInt16BE(t,0);else{let e=Buffer.byteLength(n);if(e>123)throw RangeError(`The message must not be greater than 123 bytes`);if(o=Buffer.allocUnsafe(2+e),o.writeUInt16BE(t,0),typeof n==`string`)o.write(n,2);else if(a(n))o.set(n,2);else throw TypeError(`Second argument must be a string or a Uint8Array`)}let c={[g]:o.length,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state===0?this.sendFrame(e.frame(o,c),i):this.enqueue([this.dispatch,o,!1,c,i])}ping(t,n,r){let i,a;if(typeof t==`string`?(i=Buffer.byteLength(t),a=!1):u(t)?(i=t.size,a=!1):(t=p(t),i=t.length,a=p.readOnly),i>125)throw RangeError(`The data size must not be greater than 125 bytes`);let o={[g]:i,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:9,readOnly:a,rsv1:!1};u(t)?this._state===0?this.getBlobData(t,!1,o,r):this.enqueue([this.getBlobData,t,!1,o,r]):this._state===0?this.sendFrame(e.frame(t,o),r):this.enqueue([this.dispatch,t,!1,o,r])}pong(t,n,r){let i,a;if(typeof t==`string`?(i=Buffer.byteLength(t),a=!1):u(t)?(i=t.size,a=!1):(t=p(t),i=t.length,a=p.readOnly),i>125)throw RangeError(`The data size must not be greater than 125 bytes`);let o={[g]:i,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:10,readOnly:a,rsv1:!1};u(t)?this._state===0?this.getBlobData(t,!1,o,r):this.enqueue([this.getBlobData,t,!1,o,r]):this._state===0?this.sendFrame(e.frame(t,o),r):this.enqueue([this.dispatch,t,!1,o,r])}send(e,t,n){let r=this._extensions[o.extensionName],i=t.binary?2:1,a=t.compress,s,c;typeof e==`string`?(s=Buffer.byteLength(e),c=!1):u(e)?(s=e.size,c=!1):(e=p(e),s=e.length,c=p.readOnly),this._firstFragment?(this._firstFragment=!1,a&&r&&r.params[r._isServer?`server_no_context_takeover`:`client_no_context_takeover`]&&(a=s>=r._threshold),this._compress=a):(a=!1,i=0),t.fin&&(this._firstFragment=!0);let l={[g]:s,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:i,readOnly:c,rsv1:a};u(e)?this._state===0?this.getBlobData(e,this._compress,l,n):this.enqueue([this.getBlobData,e,this._compress,l,n]):this._state===0?this.dispatch(e,this._compress,l,n):this.enqueue([this.dispatch,e,this._compress,l,n])}getBlobData(t,n,r,i){this._bufferedBytes+=r[g],this._state=2,t.arrayBuffer().then(t=>{if(this._socket.destroyed){let e=Error(`The socket was closed while the blob was being read`);process.nextTick(C,this,e,i);return}this._bufferedBytes-=r[g];let a=p(t);n?this.dispatch(a,n,r,i):(this._state=0,this.sendFrame(e.frame(a,r),i),this.dequeue())}).catch(e=>{process.nextTick(w,this,e,i)})}dispatch(t,n,r,i){if(!n){this.sendFrame(e.frame(t,r),i);return}let a=this._extensions[o.extensionName];this._bufferedBytes+=r[g],this._state=1,a.compress(t,r.fin,(t,n)=>{if(this._socket.destroyed){let e=Error(`The socket was closed while data was being compressed`);C(this,e,i);return}this._bufferedBytes-=r[g],this._state=0,r.readOnly=!1,this.sendFrame(e.frame(n,r),i),this.dequeue()})}dequeue(){for(;this._state===0&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][g],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][g],this._queue.push(e)}sendFrame(e,t){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],t),this._socket.uncork()):this._socket.write(e[0],t)}};function C(e,t,n){typeof n==`function`&&n(t);for(let n=0;n<e._queue.length;n++){let r=e._queue[n],i=r[r.length-1];typeof i==`function`&&i(t)}}function w(e,t,n){C(e,t,n),e.onerror(t)}})),x=n(((e,t)=>{let{kForOnEventAttribute:n,kListener:r}=m(),i=Symbol(`kCode`),a=Symbol(`kData`),o=Symbol(`kError`),s=Symbol(`kMessage`),c=Symbol(`kReason`),l=Symbol(`kTarget`),u=Symbol(`kType`),d=Symbol(`kWasClean`);var f=class{constructor(e){this[l]=null,this[u]=e}get target(){return this[l]}get type(){return this[u]}};Object.defineProperty(f.prototype,`target`,{enumerable:!0}),Object.defineProperty(f.prototype,`type`,{enumerable:!0});var p=class extends f{constructor(e,t={}){super(e),this[i]=t.code===void 0?0:t.code,this[c]=t.reason===void 0?``:t.reason,this[d]=t.wasClean===void 0?!1:t.wasClean}get code(){return this[i]}get reason(){return this[c]}get wasClean(){return this[d]}};Object.defineProperty(p.prototype,`code`,{enumerable:!0}),Object.defineProperty(p.prototype,`reason`,{enumerable:!0}),Object.defineProperty(p.prototype,`wasClean`,{enumerable:!0});var h=class extends f{constructor(e,t={}){super(e),this[o]=t.error===void 0?null:t.error,this[s]=t.message===void 0?``:t.message}get error(){return this[o]}get message(){return this[s]}};Object.defineProperty(h.prototype,`error`,{enumerable:!0}),Object.defineProperty(h.prototype,`message`,{enumerable:!0});var g=class extends f{constructor(e,t={}){super(e),this[a]=t.data===void 0?null:t.data}get data(){return this[a]}};Object.defineProperty(g.prototype,`data`,{enumerable:!0}),t.exports={CloseEvent:p,ErrorEvent:h,Event:f,EventTarget:{addEventListener(e,t,i={}){for(let a of this.listeners(e))if(!i[n]&&a[r]===t&&!a[n])return;let a;if(e===`message`)a=function(e,n){let r=new g(`message`,{data:n?e:e.toString()});r[l]=this,_(t,this,r)};else if(e===`close`)a=function(e,n){let r=new p(`close`,{code:e,reason:n.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});r[l]=this,_(t,this,r)};else if(e===`error`)a=function(e){let n=new h(`error`,{error:e,message:e.message});n[l]=this,_(t,this,n)};else if(e===`open`)a=function(){let e=new f(`open`);e[l]=this,_(t,this,e)};else return;a[n]=!!i[n],a[r]=t,i.once?this.once(e,a):this.on(e,a)},removeEventListener(e,t){for(let i of this.listeners(e))if(i[r]===t&&!i[n]){this.removeListener(e,i);break}}},MessageEvent:g};function _(e,t,n){typeof e==`object`&&e.handleEvent?e.handleEvent.call(e,n):e.call(t,n)}})),S=n(((e,t)=>{let{tokenChars:n}=v();function r(e,t,n){e[t]===void 0?e[t]=[n]:e[t].push(n)}function i(e){let t=Object.create(null),i=Object.create(null),a=!1,o=!1,s=!1,c,l,u=-1,d=-1,f=-1,p=0;for(;p<e.length;p++)if(d=e.charCodeAt(p),c===void 0)if(f===-1&&n[d]===1)u===-1&&(u=p);else if(p!==0&&(d===32||d===9))f===-1&&u!==-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p);let n=e.slice(u,f);d===44?(r(t,n,i),i=Object.create(null)):c=n,u=f=-1}else throw SyntaxError(`Unexpected character at index ${p}`);else if(l===void 0)if(f===-1&&n[d]===1)u===-1&&(u=p);else if(d===32||d===9)f===-1&&u!==-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p),r(i,e.slice(u,f),!0),d===44&&(r(t,c,i),i=Object.create(null),c=void 0),u=f=-1}else if(d===61&&u!==-1&&f===-1)l=e.slice(u,p),u=f=-1;else throw SyntaxError(`Unexpected character at index ${p}`);else if(o){if(n[d]!==1)throw SyntaxError(`Unexpected character at index ${p}`);u===-1?u=p:a||=!0,o=!1}else if(s)if(n[d]===1)u===-1&&(u=p);else if(d===34&&u!==-1)s=!1,f=p;else if(d===92)o=!0;else throw SyntaxError(`Unexpected character at index ${p}`);else if(d===34&&e.charCodeAt(p-1)===61)s=!0;else if(f===-1&&n[d]===1)u===-1&&(u=p);else if(u!==-1&&(d===32||d===9))f===-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p);let n=e.slice(u,f);a&&=(n=n.replace(/\\/g,``),!1),r(i,l,n),d===44&&(r(t,c,i),i=Object.create(null),c=void 0),l=void 0,u=f=-1}else throw SyntaxError(`Unexpected character at index ${p}`);if(u===-1||s||d===32||d===9)throw SyntaxError(`Unexpected end of input`);f===-1&&(f=p);let m=e.slice(u,f);return c===void 0?r(t,m,i):(l===void 0?r(i,m,!0):a?r(i,l,m.replace(/\\/g,``)):r(i,l,m),r(t,c,i)),t}function a(e){return Object.keys(e).map(t=>{let n=e[t];return Array.isArray(n)||(n=[n]),n.map(e=>[t].concat(Object.keys(e).map(t=>{let n=e[t];return Array.isArray(n)||(n=[n]),n.map(e=>e===!0?t:`${t}=${e}`).join(`; `)})).join(`; `)).join(`, `)}).join(`, `)}t.exports={format:a,parse:i}})),C=n(((e,n)=>{let r=t(`events`),i=t(`https`),a=t(`http`),o=t(`net`),s=t(`tls`),{randomBytes:c,createHash:l}=t(`crypto`),{Duplex:u,Readable:d}=t(`stream`),{URL:f}=t(`url`),p=_(),g=y(),C=b(),{isBlob:w}=v(),{BINARY_TYPES:T,CLOSE_TIMEOUT:E,EMPTY_BUFFER:D,GUID:O,kForOnEventAttribute:k,kListener:A,kStatusCode:j,kWebSocket:M,NOOP:N}=m(),{EventTarget:{addEventListener:P,removeEventListener:F}}=x(),{format:I,parse:L}=S(),{toBuffer:R}=h(),z=Symbol(`kAborted`),B=[8,13],V=[`CONNECTING`,`OPEN`,`CLOSING`,`CLOSED`],H=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;var U=class e extends r{constructor(t,n,r){super(),this._binaryType=T[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=D,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol=``,this._readyState=e.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,t===null?(this._autoPong=r.autoPong,this._closeTimeout=r.closeTimeout,this._isServer=!0):(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,n===void 0?n=[]:Array.isArray(n)||(typeof n==`object`&&n?(r=n,n=[]):n=[n]),W(this,t,n,r))}get binaryType(){return this._binaryType}set binaryType(e){T.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(t,n,r){let i=new g({allowSynchronousEvents:r.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxBufferedChunks:r.maxBufferedChunks,maxFragments:r.maxFragments,maxPayload:r.maxPayload,skipUTF8Validation:r.skipUTF8Validation}),a=new C(t,this._extensions,r.generateMask);this._receiver=i,this._sender=a,this._socket=t,i[M]=this,a[M]=this,t[M]=this,i.on(`conclude`,ee),i.on(`drain`,te),i.on(`error`,ne),i.on(`message`,re),i.on(`ping`,ie),i.on(`pong`,ae),a.onerror=oe,t.setTimeout&&t.setTimeout(0),t.setNoDelay&&t.setNoDelay(),n.length>0&&t.unshift(n),t.on(`close`,se),t.on(`data`,$),t.on(`end`,ce),t.on(`error`,le),this._readyState=e.OPEN,this.emit(`open`)}emitClose(){if(!this._socket){this._readyState=e.CLOSED,this.emit(`close`,this._closeCode,this._closeMessage);return}this._extensions[p.extensionName]&&this._extensions[p.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=e.CLOSED,this.emit(`close`,this._closeCode,this._closeMessage)}close(t,n){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){J(this,this._req,`WebSocket was closed before the connection was established`);return}if(this.readyState===e.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=e.CLOSING,this._sender.close(t,n,!this._isServer,e=>{e||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),Q(this)}}pause(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!0,this._socket.pause())}ping(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);if(typeof t==`function`?(r=t,t=n=void 0):typeof n==`function`&&(r=n,n=void 0),typeof t==`number`&&(t=t.toString()),this.readyState!==e.OPEN){Y(this,t,r);return}n===void 0&&(n=!this._isServer),this._sender.ping(t||D,n,r)}pong(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);if(typeof t==`function`?(r=t,t=n=void 0):typeof n==`function`&&(r=n,n=void 0),typeof t==`number`&&(t=t.toString()),this.readyState!==e.OPEN){Y(this,t,r);return}n===void 0&&(n=!this._isServer),this._sender.pong(t||D,n,r)}resume(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);if(typeof n==`function`&&(r=n,n={}),typeof t==`number`&&(t=t.toString()),this.readyState!==e.OPEN){Y(this,t,r);return}let i={binary:typeof t!=`string`,mask:!this._isServer,compress:!0,fin:!0,...n};this._extensions[p.extensionName]||(i.compress=!1),this._sender.send(t||D,i,r)}terminate(){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){J(this,this._req,`WebSocket was closed before the connection was established`);return}this._socket&&(this._readyState=e.CLOSING,this._socket.destroy())}}};Object.defineProperty(U,`CONNECTING`,{enumerable:!0,value:V.indexOf(`CONNECTING`)}),Object.defineProperty(U.prototype,`CONNECTING`,{enumerable:!0,value:V.indexOf(`CONNECTING`)}),Object.defineProperty(U,`OPEN`,{enumerable:!0,value:V.indexOf(`OPEN`)}),Object.defineProperty(U.prototype,`OPEN`,{enumerable:!0,value:V.indexOf(`OPEN`)}),Object.defineProperty(U,`CLOSING`,{enumerable:!0,value:V.indexOf(`CLOSING`)}),Object.defineProperty(U.prototype,`CLOSING`,{enumerable:!0,value:V.indexOf(`CLOSING`)}),Object.defineProperty(U,`CLOSED`,{enumerable:!0,value:V.indexOf(`CLOSED`)}),Object.defineProperty(U.prototype,`CLOSED`,{enumerable:!0,value:V.indexOf(`CLOSED`)}),[`binaryType`,`bufferedAmount`,`extensions`,`isPaused`,`protocol`,`readyState`,`url`].forEach(e=>{Object.defineProperty(U.prototype,e,{enumerable:!0})}),[`open`,`error`,`close`,`message`].forEach(e=>{Object.defineProperty(U.prototype,`on${e}`,{enumerable:!0,get(){for(let t of this.listeners(e))if(t[k])return t[A];return null},set(t){for(let t of this.listeners(e))if(t[k]){this.removeListener(e,t);break}typeof t==`function`&&this.addEventListener(e,t,{[k]:!0})}})}),U.prototype.addEventListener=P,U.prototype.removeEventListener=F,n.exports=U;function W(e,t,n,r){let o={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:E,protocolVersion:B[1],maxBufferedChunks:1024*1024,maxFragments:128*1024,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...r,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:`GET`,host:void 0,path:void 0,port:void 0};if(e._autoPong=o.autoPong,e._closeTimeout=o.closeTimeout,!B.includes(o.protocolVersion))throw RangeError(`Unsupported protocol version: ${o.protocolVersion} (supported versions: ${B.join(`, `)})`);let s;if(t instanceof f)s=t;else try{s=new f(t)}catch{throw SyntaxError(`Invalid URL: ${t}`)}s.protocol===`http:`?s.protocol=`ws:`:s.protocol===`https:`&&(s.protocol=`wss:`),e._url=s.href;let u=s.protocol===`wss:`,d=s.protocol===`ws+unix:`,m;if(s.protocol!==`ws:`&&!u&&!d?m=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:d&&!s.pathname?m=`The URL's pathname is empty`:s.hash&&(m=`The URL contains a fragment identifier`),m){let t=SyntaxError(m);if(e._redirects===0)throw t;G(e,t);return}let h=u?443:80,g=c(16).toString(`base64`),_=u?i.request:a.request,v=new Set,y;if(o.createConnection=o.createConnection||(u?q:K),o.defaultPort=o.defaultPort||h,o.port=s.port||h,o.host=s.hostname.startsWith(`[`)?s.hostname.slice(1,-1):s.hostname,o.headers={...o.headers,"Sec-WebSocket-Version":o.protocolVersion,"Sec-WebSocket-Key":g,Connection:`Upgrade`,Upgrade:`websocket`},o.path=s.pathname+s.search,o.timeout=o.handshakeTimeout,o.perMessageDeflate&&(y=new p({...o.perMessageDeflate,isServer:!1,maxPayload:o.maxPayload}),o.headers[`Sec-WebSocket-Extensions`]=I({[p.extensionName]:y.offer()})),n.length){for(let e of n){if(typeof e!=`string`||!H.test(e)||v.has(e))throw SyntaxError(`An invalid or duplicated subprotocol was specified`);v.add(e)}o.headers[`Sec-WebSocket-Protocol`]=n.join(`,`)}if(o.origin&&(o.protocolVersion<13?o.headers[`Sec-WebSocket-Origin`]=o.origin:o.headers.Origin=o.origin),(s.username||s.password)&&(o.auth=`${s.username}:${s.password}`),d){let e=o.path.split(`:`);o.socketPath=e[0],o.path=e[1]}let b;if(o.followRedirects){if(e._redirects===0){e._originalIpc=d,e._originalSecure=u,e._originalHostOrSocketPath=d?o.socketPath:s.host;let t=r&&r.headers;if(r={...r,headers:{}},t)for(let[e,n]of Object.entries(t))r.headers[e.toLowerCase()]=n}else if(e.listenerCount(`redirect`)===0){let t=d?e._originalIpc?o.socketPath===e._originalHostOrSocketPath:!1:e._originalIpc?!1:s.host===e._originalHostOrSocketPath;(!t||e._originalSecure&&!u)&&(delete o.headers.authorization,delete o.headers.cookie,t||delete o.headers.host,o.auth=void 0)}o.auth&&!r.headers.authorization&&(r.headers.authorization=`Basic `+Buffer.from(o.auth).toString(`base64`)),b=e._req=_(o),e._redirects&&e.emit(`redirect`,e.url,b)}else b=e._req=_(o);o.timeout&&b.on(`timeout`,()=>{J(e,b,`Opening handshake has timed out`)}),b.on(`error`,t=>{b===null||b[z]||(b=e._req=null,G(e,t))}),b.on(`response`,i=>{let a=i.headers.location,s=i.statusCode;if(a&&o.followRedirects&&s>=300&&s<400){if(++e._redirects>o.maxRedirects){J(e,b,`Maximum redirects exceeded`);return}b.abort();let i;try{i=new f(a,t)}catch{G(e,SyntaxError(`Invalid URL: ${a}`));return}W(e,i,n,r)}else e.emit(`unexpected-response`,b,i)||J(e,b,`Unexpected server response: ${i.statusCode}`)}),b.on(`upgrade`,(t,n,r)=>{if(e.emit(`upgrade`,t),e.readyState!==U.CONNECTING)return;b=e._req=null;let i=t.headers.upgrade;if(i===void 0||i.toLowerCase()!==`websocket`){J(e,n,`Invalid Upgrade header`);return}let a=l(`sha1`).update(g+O).digest(`base64`);if(t.headers[`sec-websocket-accept`]!==a){J(e,n,`Invalid Sec-WebSocket-Accept header`);return}let s=t.headers[`sec-websocket-protocol`],c;if(s===void 0?v.size&&(c=`Server sent no subprotocol`):v.size?v.has(s)||(c=`Server sent an invalid subprotocol`):c=`Server sent a subprotocol but none was requested`,c){J(e,n,c);return}s&&(e._protocol=s);let u=t.headers[`sec-websocket-extensions`];if(u!==void 0){if(!y){J(e,n,`Server sent a Sec-WebSocket-Extensions header but no extension was requested`);return}let t;try{t=L(u)}catch{J(e,n,`Invalid Sec-WebSocket-Extensions header`);return}let r=Object.keys(t);if(r.length!==1||r[0]!==p.extensionName){J(e,n,`Server indicated an extension that was not requested`);return}try{y.accept(t[p.extensionName])}catch{J(e,n,`Invalid Sec-WebSocket-Extensions header`);return}e._extensions[p.extensionName]=y}e.setSocket(n,r,{allowSynchronousEvents:o.allowSynchronousEvents,generateMask:o.generateMask,maxBufferedChunks:o.maxBufferedChunks,maxFragments:o.maxFragments,maxPayload:o.maxPayload,skipUTF8Validation:o.skipUTF8Validation})}),o.finishRequest?o.finishRequest(b,e):b.end()}function G(e,t){e._readyState=U.CLOSING,e._errorEmitted=!0,e.emit(`error`,t),e.emitClose()}function K(e){return e.path=e.socketPath,o.connect(e)}function q(e){return e.path=void 0,!e.servername&&e.servername!==``&&(e.servername=o.isIP(e.host)?``:e.host),s.connect(e)}function J(e,t,n){e._readyState=U.CLOSING;let r=Error(n);Error.captureStackTrace(r,J),t.setHeader?(t[z]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(G,e,r)):(t.destroy(r),t.once(`error`,e.emit.bind(e,`error`)),t.once(`close`,e.emitClose.bind(e)))}function Y(e,t,n){if(t){let n=w(t)?t.size:R(t).length;e._socket?e._sender._bufferedBytes+=n:e._bufferedAmount+=n}if(n){let t=Error(`WebSocket is not open: readyState ${e.readyState} (${V[e.readyState]})`);process.nextTick(n,t)}}function ee(e,t){let n=this[M];n._closeFrameReceived=!0,n._closeMessage=t,n._closeCode=e,n._socket[M]!==void 0&&(n._socket.removeListener(`data`,$),process.nextTick(Z,n._socket),e===1005?n.close():n.close(e,t))}function te(){let e=this[M];e.isPaused||e._socket.resume()}function ne(e){let t=this[M];t._socket[M]!==void 0&&(t._socket.removeListener(`data`,$),process.nextTick(Z,t._socket),t.close(e[j])),t._errorEmitted||(t._errorEmitted=!0,t.emit(`error`,e))}function X(){this[M].emitClose()}function re(e,t){this[M].emit(`message`,e,t)}function ie(e){let t=this[M];t._autoPong&&t.pong(e,!this._isServer,N),t.emit(`ping`,e)}function ae(e){this[M].emit(`pong`,e)}function Z(e){e.resume()}function oe(e){let t=this[M];t.readyState!==U.CLOSED&&(t.readyState===U.OPEN&&(t._readyState=U.CLOSING,Q(t)),this._socket.end(),t._errorEmitted||(t._errorEmitted=!0,t.emit(`error`,e)))}function Q(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),e._closeTimeout)}function se(){let e=this[M];if(this.removeListener(`close`,se),this.removeListener(`data`,$),this.removeListener(`end`,ce),e._readyState=U.CLOSING,!this._readableState.endEmitted&&!e._closeFrameReceived&&!e._receiver._writableState.errorEmitted&&this._readableState.length!==0){let t=this.read(this._readableState.length);e._receiver.write(t)}e._receiver.end(),this[M]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on(`error`,X),e._receiver.on(`finish`,X))}function $(e){this[M]._receiver.write(e)||this.pause()}function ce(){let e=this[M];e._readyState=U.CLOSING,e._receiver.end(),this.end()}function le(){let e=this[M];this.removeListener(`error`,le),this.on(`error`,N),e&&(e._readyState=U.CLOSING,this.destroy())}})),w=n(((e,n)=>{C();let{Duplex:r}=t(`stream`);function i(e){e.emit(`close`)}function a(){!this.destroyed&&this._writableState.finished&&this.destroy()}function o(e){this.removeListener(`error`,o),this.destroy(),this.listenerCount(`error`)===0&&this.emit(`error`,e)}function s(e,t){let n=!0,s=new r({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on(`message`,function(t,n){let r=!n&&s._readableState.objectMode?t.toString():t;s.push(r)||e.pause()}),e.once(`error`,function(e){s.destroyed||(n=!1,s.destroy(e))}),e.once(`close`,function(){s.destroyed||s.push(null)}),s._destroy=function(t,r){if(e.readyState===e.CLOSED){r(t),process.nextTick(i,s);return}let a=!1;e.once(`error`,function(e){a=!0,r(e)}),e.once(`close`,function(){a||r(t),process.nextTick(i,s)}),n&&e.terminate()},s._final=function(t){if(e.readyState===e.CONNECTING){e.once(`open`,function(){s._final(t)});return}e._socket!==null&&(e._socket._writableState.finished?(t(),s._readableState.endEmitted&&s.destroy()):(e._socket.once(`finish`,function(){t()}),e.close()))},s._read=function(){e.isPaused&&e.resume()},s._write=function(t,n,r){if(e.readyState===e.CONNECTING){e.once(`open`,function(){s._write(t,n,r)});return}e.send(t,r)},s.on(`end`,a),s.on(`error`,o),s}n.exports=s})),T=n(((e,t)=>{let{tokenChars:n}=v();function r(e){let t=new Set,r=-1,i=-1,a=0;for(;a<e.length;a++){let o=e.charCodeAt(a);if(i===-1&&n[o]===1)r===-1&&(r=a);else if(a!==0&&(o===32||o===9))i===-1&&r!==-1&&(i=a);else if(o===44){if(r===-1)throw SyntaxError(`Unexpected character at index ${a}`);i===-1&&(i=a);let n=e.slice(r,i);if(t.has(n))throw SyntaxError(`The "${n}" subprotocol is duplicated`);t.add(n),r=i=-1}else throw SyntaxError(`Unexpected character at index ${a}`)}if(r===-1||i!==-1)throw SyntaxError(`Unexpected end of input`);let o=e.slice(r,a);if(t.has(o))throw SyntaxError(`The "${o}" subprotocol is duplicated`);return t.add(o),t}t.exports={parse:r}})),E=n(((e,n)=>{let r=t(`events`),i=t(`http`),{Duplex:a}=t(`stream`),{createHash:o}=t(`crypto`),s=S(),c=_(),l=T(),u=C(),{CLOSE_TIMEOUT:d,GUID:f,kWebSocket:p}=m(),h=/^[+/0-9A-Za-z]{22}==$/;n.exports=class extends r{constructor(e,t){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxBufferedChunks:1024*1024,maxFragments:128*1024,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:d,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:u,...e},e.port==null&&!e.server&&!e.noServer||e.port!=null&&(e.server||e.noServer)||e.server&&e.noServer)throw TypeError(`One and only one of the "port", "server", or "noServer" options must be specified`);if(e.port==null?e.server&&(this._server=e.server):(this._server=i.createServer((e,t)=>{let n=i.STATUS_CODES[426];t.writeHead(426,{"Content-Length":n.length,"Content-Type":`text/plain`}),t.end(n)}),this._server.listen(e.port,e.host,e.backlog,t)),this._server){let e=this.emit.bind(this,`connection`);this._removeListeners=g(this._server,{listening:this.emit.bind(this,`listening`),error:this.emit.bind(this,`error`),upgrade:(t,n,r)=>{this.handleUpgrade(t,n,r,e)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=0}address(){if(this.options.noServer)throw Error(`The server is operating in "noServer" mode`);return this._server?this._server.address():null}close(e){if(this._state===2){e&&this.once(`close`,()=>{e(Error(`The server is not running`))}),process.nextTick(v,this);return}if(e&&this.once(`close`,e),this._state!==1)if(this._state=1,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients&&this.clients.size?this._shouldEmitClose=!0:process.nextTick(v,this);else{let e=this._server;this._removeListeners(),this._removeListeners=this._server=null,e.close(()=>{v(this)})}}shouldHandle(e){if(this.options.path){let t=e.url.indexOf(`?`);if((t===-1?e.url:e.url.slice(0,t))!==this.options.path)return!1}return!0}handleUpgrade(e,t,n,r){t.on(`error`,y);let i=e.headers[`sec-websocket-key`],a=e.headers.upgrade,o=+e.headers[`sec-websocket-version`];if(e.method!==`GET`){x(this,e,t,405,`Invalid HTTP method`);return}if(a===void 0||a.toLowerCase()!==`websocket`){x(this,e,t,400,`Invalid Upgrade header`);return}if(i===void 0||!h.test(i)){x(this,e,t,400,`Missing or invalid Sec-WebSocket-Key header`);return}if(o!==13&&o!==8){x(this,e,t,400,`Missing or invalid Sec-WebSocket-Version header`,{"Sec-WebSocket-Version":`13, 8`});return}if(!this.shouldHandle(e)){b(t,400);return}let u=e.headers[`sec-websocket-protocol`],d=new Set;if(u!==void 0)try{d=l.parse(u)}catch{x(this,e,t,400,`Invalid Sec-WebSocket-Protocol header`);return}let f=e.headers[`sec-websocket-extensions`],p={};if(this.options.perMessageDeflate&&f!==void 0){let n=new c({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let e=s.parse(f);e[c.extensionName]&&(n.accept(e[c.extensionName]),p[c.extensionName]=n)}catch{x(this,e,t,400,`Invalid or unacceptable Sec-WebSocket-Extensions header`);return}}if(this.options.verifyClient){let a={origin:e.headers[`${o===8?`sec-websocket-origin`:`origin`}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(a,(a,o,s,c)=>{if(!a)return b(t,o||401,s,c);this.completeUpgrade(p,i,d,e,t,n,r)});return}if(!this.options.verifyClient(a))return b(t,401)}this.completeUpgrade(p,i,d,e,t,n,r)}completeUpgrade(e,t,n,r,i,a,l){if(!i.readable||!i.writable)return i.destroy();if(i[p])throw Error(`server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration`);if(this._state>0)return b(i,503);let u=[`HTTP/1.1 101 Switching Protocols`,`Upgrade: websocket`,`Connection: Upgrade`,`Sec-WebSocket-Accept: ${o(`sha1`).update(t+f).digest(`base64`)}`],d=new this.options.WebSocket(null,void 0,this.options);if(n.size){let e=this.options.handleProtocols?this.options.handleProtocols(n,r):n.values().next().value;e&&(u.push(`Sec-WebSocket-Protocol: ${e}`),d._protocol=e)}if(e[c.extensionName]){let t=e[c.extensionName].params,n=s.format({[c.extensionName]:[t]});u.push(`Sec-WebSocket-Extensions: ${n}`),d._extensions=e}this.emit(`headers`,u,r),i.write(u.concat(`\r
|
|
2
|
+
import{i as e,r as t,t as n}from"./chunk-vbHwaUoU.mjs";import{Dt as r,I as i}from"./dist-DV7LR38l.mjs";import{n as a,o}from"./chunk-QBZBEHZB-yeyhVUeD.mjs";import{gzipSync as s}from"node:zlib";import{randomUUID as c}from"node:crypto";import{readFile as l}from"node:fs/promises";import{clearTimeout as u,setTimeout as d}from"node:timers";import{Miniflare as f,convertV4MiniflareOptions as p}from"miniflare";var m=n(((e,t)=>{let n=[`nodebuffer`,`arraybuffer`,`fragments`],r=typeof Blob<`u`;r&&n.push(`blob`),t.exports={BINARY_TYPES:n,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:`258EAFA5-E914-47DA-95CA-C5AB0DC85B11`,hasBlob:r,kForOnEventAttribute:Symbol(`kIsForOnEventAttribute`),kListener:Symbol(`kListener`),kStatusCode:Symbol(`status-code`),kWebSocket:Symbol(`websocket`),NOOP:()=>{}}})),h=n(((e,n)=>{let{EMPTY_BUFFER:r}=m(),i=Buffer[Symbol.species];function a(e,t){if(e.length===0)return r;if(e.length===1)return e[0];let n=Buffer.allocUnsafe(t),a=0;for(let t=0;t<e.length;t++){let r=e[t];n.set(r,a),a+=r.length}return a<t?new i(n.buffer,n.byteOffset,a):n}function o(e,t,n,r,i){for(let a=0;a<i;a++)n[r+a]=e[a]^t[a&3]}function s(e,t){for(let n=0;n<e.length;n++)e[n]^=t[n&3]}function c(e){return e.length===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.length)}function l(e){if(l.readOnly=!0,Buffer.isBuffer(e))return e;let t;return e instanceof ArrayBuffer?t=new i(e):ArrayBuffer.isView(e)?t=new i(e.buffer,e.byteOffset,e.byteLength):(t=Buffer.from(e),l.readOnly=!1),t}if(n.exports={concat:a,mask:o,toArrayBuffer:c,toBuffer:l,unmask:s},!process.env.WS_NO_BUFFER_UTIL)try{let e=t(`bufferutil`);n.exports.mask=function(t,n,r,i,a){a<48?o(t,n,r,i,a):e.mask(t,n,r,i,a)},n.exports.unmask=function(t,n){t.length<32?s(t,n):e.unmask(t,n)}}catch{}})),g=n(((e,t)=>{let n=Symbol(`kDone`),r=Symbol(`kRun`);t.exports=class{constructor(e){this[n]=()=>{this.pending--,this[r]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[r]()}[r](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[n])}}}})),_=n(((e,n)=>{let r=t(`zlib`),i=h(),a=g(),{kStatusCode:o}=m(),s=Buffer[Symbol.species],c=Buffer.from([0,0,255,255]),l=Symbol(`permessage-deflate`),u=Symbol(`total-length`),d=Symbol(`callback`),f=Symbol(`buffers`),p=Symbol(`error`),_;n.exports=class{constructor(e){this._options=e||{},this._threshold=this._options.threshold===void 0?1024:this._options.threshold,this._maxPayload=this._options.maxPayload|0,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,_||=new a(this._options.concurrencyLimit===void 0?10:this._options.concurrencyLimit)}static get extensionName(){return`permessage-deflate`}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits??(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&=(this._inflate.close(),null),this._deflate){let e=this._deflate[d];this._deflate.close(),this._deflate=null,e&&e(Error(`The deflate stream was closed while data was being processed`))}}acceptAsServer(e){let t=this._options,n=e.find(e=>!(t.serverNoContextTakeover===!1&&e.server_no_context_takeover||e.server_max_window_bits&&(t.serverMaxWindowBits===!1||typeof t.serverMaxWindowBits==`number`&&t.serverMaxWindowBits>e.server_max_window_bits)||typeof t.clientMaxWindowBits==`number`&&!e.client_max_window_bits));if(!n)throw Error(`None of the extension offers can be accepted`);return t.serverNoContextTakeover&&(n.server_no_context_takeover=!0),t.clientNoContextTakeover&&(n.client_no_context_takeover=!0),typeof t.serverMaxWindowBits==`number`&&(n.server_max_window_bits=t.serverMaxWindowBits),typeof t.clientMaxWindowBits==`number`?n.client_max_window_bits=t.clientMaxWindowBits:(n.client_max_window_bits===!0||t.clientMaxWindowBits===!1)&&delete n.client_max_window_bits,n}acceptAsClient(e){let t=e[0];if(this._options.clientNoContextTakeover===!1&&t.client_no_context_takeover)throw Error(`Unexpected parameter "client_no_context_takeover"`);if(!t.client_max_window_bits)typeof this._options.clientMaxWindowBits==`number`&&(t.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits==`number`&&t.client_max_window_bits>this._options.clientMaxWindowBits)throw Error(`Unexpected or invalid parameter "client_max_window_bits"`);return t}normalizeParams(e){return e.forEach(e=>{Object.keys(e).forEach(t=>{let n=e[t];if(n.length>1)throw Error(`Parameter "${t}" must have only a single value`);if(n=n[0],t===`client_max_window_bits`){if(n!==!0){let e=+n;if(!Number.isInteger(e)||e<8||e>15)throw TypeError(`Invalid value for parameter "${t}": ${n}`);n=e}else if(!this._isServer)throw TypeError(`Invalid value for parameter "${t}": ${n}`)}else if(t===`server_max_window_bits`){let e=+n;if(!Number.isInteger(e)||e<8||e>15)throw TypeError(`Invalid value for parameter "${t}": ${n}`);n=e}else if(t===`client_no_context_takeover`||t===`server_no_context_takeover`){if(n!==!0)throw TypeError(`Invalid value for parameter "${t}": ${n}`)}else throw Error(`Unknown parameter "${t}"`);e[t]=n})}),e}decompress(e,t,n){_.add(r=>{this._decompress(e,t,(e,t)=>{r(),n(e,t)})})}compress(e,t,n){_.add(r=>{this._compress(e,t,(e,t)=>{r(),n(e,t)})})}_decompress(e,t,n){let a=this._isServer?`client`:`server`;if(!this._inflate){let e=`${a}_max_window_bits`,t=typeof this.params[e]==`number`?this.params[e]:r.Z_DEFAULT_WINDOWBITS;this._inflate=r.createInflateRaw({...this._options.zlibInflateOptions,windowBits:t}),this._inflate[l]=this,this._inflate[u]=0,this._inflate[f]=[],this._inflate.on(`error`,b),this._inflate.on(`data`,y)}this._inflate[d]=n,this._inflate.write(e),t&&this._inflate.write(c),this._inflate.flush(()=>{let e=this._inflate[p];if(e){this._inflate.close(),this._inflate=null,n(e);return}let r=i.concat(this._inflate[f],this._inflate[u]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[u]=0,this._inflate[f]=[],t&&this.params[`${a}_no_context_takeover`]&&this._inflate.reset()),n(null,r)})}_compress(e,t,n){let a=this._isServer?`server`:`client`;if(!this._deflate){let e=`${a}_max_window_bits`,t=typeof this.params[e]==`number`?this.params[e]:r.Z_DEFAULT_WINDOWBITS;this._deflate=r.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:t}),this._deflate[u]=0,this._deflate[f]=[],this._deflate.on(`data`,v)}this._deflate[d]=n,this._deflate.write(e),this._deflate.flush(r.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let e=i.concat(this._deflate[f],this._deflate[u]);t&&(e=new s(e.buffer,e.byteOffset,e.length-4)),this._deflate[d]=null,this._deflate[u]=0,this._deflate[f]=[],t&&this.params[`${a}_no_context_takeover`]&&this._deflate.reset(),n(null,e)})}};function v(e){this[f].push(e),this[u]+=e.length}function y(e){if(this[u]+=e.length,this[l]._maxPayload<1||this[u]<=this[l]._maxPayload){this[f].push(e);return}this[p]=RangeError(`Max payload size exceeded`),this[p].code=`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`,this[p][o]=1009,this.removeListener(`data`,y),this.reset()}function b(e){if(this[l]._inflate=null,this[p]){this[d](this[p]);return}e[o]=1007,this[d](e)}})),v=n(((e,n)=>{let{isUtf8:r}=t(`buffer`),{hasBlob:i}=m(),a=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function o(e){return e>=1e3&&e<=1014&&e!==1004&&e!==1005&&e!==1006||e>=3e3&&e<=4999}function s(e){let t=e.length,n=0;for(;n<t;)if(!(e[n]&128))n++;else if((e[n]&224)==192){if(n+1===t||(e[n+1]&192)!=128||(e[n]&254)==192)return!1;n+=2}else if((e[n]&240)==224){if(n+2>=t||(e[n+1]&192)!=128||(e[n+2]&192)!=128||e[n]===224&&(e[n+1]&224)==128||e[n]===237&&(e[n+1]&224)==160)return!1;n+=3}else if((e[n]&248)==240){if(n+3>=t||(e[n+1]&192)!=128||(e[n+2]&192)!=128||(e[n+3]&192)!=128||e[n]===240&&(e[n+1]&240)==128||e[n]===244&&e[n+1]>143||e[n]>244)return!1;n+=4}else return!1;return!0}function c(e){return i&&typeof e==`object`&&typeof e.arrayBuffer==`function`&&typeof e.type==`string`&&typeof e.stream==`function`&&(e[Symbol.toStringTag]===`Blob`||e[Symbol.toStringTag]===`File`)}if(n.exports={isBlob:c,isValidStatusCode:o,isValidUTF8:s,tokenChars:a},r)n.exports.isValidUTF8=function(e){return e.length<24?s(e):r(e)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let e=t(`utf-8-validate`);n.exports.isValidUTF8=function(t){return t.length<32?s(t):e(t)}}catch{}})),y=n(((e,n)=>{let{Writable:r}=t(`stream`),i=_(),{BINARY_TYPES:a,EMPTY_BUFFER:o,kStatusCode:s,kWebSocket:c}=m(),{concat:l,toArrayBuffer:u,unmask:d}=h(),{isValidStatusCode:f,isValidUTF8:p}=v(),g=Buffer[Symbol.species];n.exports=class extends r{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents===void 0?!0:e.allowSynchronousEvents,this._binaryType=e.binaryType||a[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxBufferedChunks=e.maxBufferedChunks|0,this._maxFragments=e.maxFragments|0,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[c]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=0}_write(e,t,n){if(this._opcode===8&&this._state==0)return n();if(this._maxBufferedChunks>0&&this._buffers.length>=this._maxBufferedChunks){n(this.createError(RangeError,`Too many buffered chunks`,!1,1008,`WS_ERR_TOO_MANY_BUFFERED_PARTS`));return}this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(n)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let t=this._buffers[0];return this._buffers[0]=new g(t.buffer,t.byteOffset+e,t.length-e),new g(t.buffer,t.byteOffset,e)}let t=Buffer.allocUnsafe(e);do{let n=this._buffers[0],r=t.length-e;e>=n.length?t.set(this._buffers.shift(),r):(t.set(new Uint8Array(n.buffer,n.byteOffset,e),r),this._buffers[0]=new g(n.buffer,n.byteOffset+e,n.length-e)),e-=n.length}while(e>0);return t}startLoop(e){this._loop=!0;do switch(this._state){case 0:this.getInfo(e);break;case 1:this.getPayloadLength16(e);break;case 2:this.getPayloadLength64(e);break;case 3:this.getMask();break;case 4:this.getData(e);break;case 5:case 6:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let t=this.consume(2);if(t[0]&48){e(this.createError(RangeError,`RSV2 and RSV3 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_2_3`));return}let n=(t[0]&64)==64;if(n&&!this._extensions[i.extensionName]){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(this._fin=(t[0]&128)==128,this._opcode=t[0]&15,this._payloadLength=t[1]&127,this._opcode===0){if(n){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(!this._fragmented){e(this.createError(RangeError,`invalid opcode 0`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}this._compressed=n}else if(this._opcode>7&&this._opcode<11){if(!this._fin){e(this.createError(RangeError,`FIN must be set`,!0,1002,`WS_ERR_EXPECTED_FIN`));return}if(n){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){e(this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,`WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH`));return}}else{e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(t[1]&128)==128,this._isServer){if(!this._masked){e(this.createError(RangeError,`MASK must be set`,!0,1002,`WS_ERR_EXPECTED_MASK`));return}}else if(this._masked){e(this.createError(RangeError,`MASK must be clear`,!0,1002,`WS_ERR_UNEXPECTED_MASK`));return}this._payloadLength===126?this._state=1:this._payloadLength===127?this._state=2:this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=!1;return}let t=this.consume(8),n=t.readUInt32BE(0);if(n>2**21-1){e(this.createError(RangeError,`Unsupported WebSocket frame: payload length > 2^53 - 1`,!1,1009,`WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH`));return}this._payloadLength=n*2**32+t.readUInt32BE(4),this.haveLength(e)}haveLength(e){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){e(this.createError(RangeError,`Max payload size exceeded`,!1,1009,`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`));return}this._masked?this._state=3:this._state=4}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=4}getData(e){let t=o;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}t=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&d(t,this._mask)}if(this._opcode>7){this.controlMessage(t,e);return}if(this._compressed){this._state=5,this.decompress(t,e);return}if(t.length){if(this._maxFragments>0&&this._fragments.length>=this._maxFragments){e(this.createError(RangeError,`Too many message fragments`,!1,1008,`WS_ERR_TOO_MANY_BUFFERED_PARTS`));return}this._messageLength=this._totalPayloadLength,this._fragments.push(t)}this.dataMessage(e)}decompress(e,t){this._extensions[i.extensionName].decompress(e,this._fin,(e,n)=>{if(e)return t(e);if(n.length){if(this._messageLength+=n.length,this._messageLength>this._maxPayload&&this._maxPayload>0){t(this.createError(RangeError,`Max payload size exceeded`,!1,1009,`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`));return}if(this._maxFragments>0&&this._fragments.length>=this._maxFragments){t(this.createError(RangeError,`Too many message fragments`,!1,1008,`WS_ERR_TOO_MANY_BUFFERED_PARTS`));return}this._fragments.push(n)}this.dataMessage(t),this._state===0&&this.startLoop(t)})}dataMessage(e){if(!this._fin){this._state=0;return}let t=this._messageLength,n=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let r;r=this._binaryType===`nodebuffer`?l(n,t):this._binaryType===`arraybuffer`?u(l(n,t)):this._binaryType===`blob`?new Blob(n):n,this._allowSynchronousEvents?(this.emit(`message`,r,!0),this._state=0):(this._state=6,setImmediate(()=>{this.emit(`message`,r,!0),this._state=0,this.startLoop(e)}))}else{let r=l(n,t);if(!this._skipUTF8Validation&&!p(r)){e(this.createError(Error,`invalid UTF-8 sequence`,!0,1007,`WS_ERR_INVALID_UTF8`));return}this._state===5||this._allowSynchronousEvents?(this.emit(`message`,r,!1),this._state=0):(this._state=6,setImmediate(()=>{this.emit(`message`,r,!1),this._state=0,this.startLoop(e)}))}}controlMessage(e,t){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit(`conclude`,1005,o),this.end();else{let n=e.readUInt16BE(0);if(!f(n)){t(this.createError(RangeError,`invalid status code ${n}`,!0,1002,`WS_ERR_INVALID_CLOSE_CODE`));return}let r=new g(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!p(r)){t(this.createError(Error,`invalid UTF-8 sequence`,!0,1007,`WS_ERR_INVALID_UTF8`));return}this._loop=!1,this.emit(`conclude`,n,r),this.end()}this._state=0;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?`ping`:`pong`,e),this._state=0):(this._state=6,setImmediate(()=>{this.emit(this._opcode===9?`ping`:`pong`,e),this._state=0,this.startLoop(t)}))}createError(e,t,n,r,i){this._loop=!1,this._errored=!0;let a=new e(n?`Invalid WebSocket frame: ${t}`:t);return Error.captureStackTrace(a,this.createError),a.code=i,a[s]=r,a}}})),b=n(((e,n)=>{let{Duplex:r}=t(`stream`),{randomFillSync:i}=t(`crypto`),{types:{isUint8Array:a}}=t(`util`),o=_(),{EMPTY_BUFFER:s,kWebSocket:c,NOOP:l}=m(),{isBlob:u,isValidStatusCode:d}=v(),{mask:f,toBuffer:p}=h(),g=Symbol(`kByteLength`),y=Buffer.alloc(4),b=8*1024,x,S=b;n.exports=class e{constructor(e,t,n){this._extensions=t||{},n&&(this._generateMask=n,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=0,this.onerror=l,this[c]=void 0}static frame(e,t){let n,r=!1,a=2,o=!1;t.mask&&(n=t.maskBuffer||y,t.generateMask?t.generateMask(n):(S===b&&(x===void 0&&(x=Buffer.alloc(b)),i(x,0,b),S=0),n[0]=x[S++],n[1]=x[S++],n[2]=x[S++],n[3]=x[S++]),o=(n[0]|n[1]|n[2]|n[3])===0,a=6);let s;typeof e==`string`?(!t.mask||o)&&t[g]!==void 0?s=t[g]:(e=Buffer.from(e),s=e.length):(s=e.length,r=t.mask&&t.readOnly&&!o);let c=s;s>=65536?(a+=8,c=127):s>125&&(a+=2,c=126);let l=Buffer.allocUnsafe(r?s+a:a);return l[0]=t.fin?t.opcode|128:t.opcode,t.rsv1&&(l[0]|=64),l[1]=c,c===126?l.writeUInt16BE(s,2):c===127&&(l[2]=l[3]=0,l.writeUIntBE(s,4,6)),!t.mask||(l[1]|=128,l[a-4]=n[0],l[a-3]=n[1],l[a-2]=n[2],l[a-1]=n[3],o)?[l,e]:r?(f(e,n,l,a,s),[l]):(f(e,n,e,0,s),[l,e])}close(t,n,r,i){let o;if(t===void 0)o=s;else if(typeof t!=`number`||!d(t))throw TypeError(`First argument must be a valid error code number`);else if(n===void 0||!n.length)o=Buffer.allocUnsafe(2),o.writeUInt16BE(t,0);else{let e=Buffer.byteLength(n);if(e>123)throw RangeError(`The message must not be greater than 123 bytes`);if(o=Buffer.allocUnsafe(2+e),o.writeUInt16BE(t,0),typeof n==`string`)o.write(n,2);else if(a(n))o.set(n,2);else throw TypeError(`Second argument must be a string or a Uint8Array`)}let c={[g]:o.length,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state===0?this.sendFrame(e.frame(o,c),i):this.enqueue([this.dispatch,o,!1,c,i])}ping(t,n,r){let i,a;if(typeof t==`string`?(i=Buffer.byteLength(t),a=!1):u(t)?(i=t.size,a=!1):(t=p(t),i=t.length,a=p.readOnly),i>125)throw RangeError(`The data size must not be greater than 125 bytes`);let o={[g]:i,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:9,readOnly:a,rsv1:!1};u(t)?this._state===0?this.getBlobData(t,!1,o,r):this.enqueue([this.getBlobData,t,!1,o,r]):this._state===0?this.sendFrame(e.frame(t,o),r):this.enqueue([this.dispatch,t,!1,o,r])}pong(t,n,r){let i,a;if(typeof t==`string`?(i=Buffer.byteLength(t),a=!1):u(t)?(i=t.size,a=!1):(t=p(t),i=t.length,a=p.readOnly),i>125)throw RangeError(`The data size must not be greater than 125 bytes`);let o={[g]:i,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:10,readOnly:a,rsv1:!1};u(t)?this._state===0?this.getBlobData(t,!1,o,r):this.enqueue([this.getBlobData,t,!1,o,r]):this._state===0?this.sendFrame(e.frame(t,o),r):this.enqueue([this.dispatch,t,!1,o,r])}send(e,t,n){let r=this._extensions[o.extensionName],i=t.binary?2:1,a=t.compress,s,c;typeof e==`string`?(s=Buffer.byteLength(e),c=!1):u(e)?(s=e.size,c=!1):(e=p(e),s=e.length,c=p.readOnly),this._firstFragment?(this._firstFragment=!1,a&&r&&r.params[r._isServer?`server_no_context_takeover`:`client_no_context_takeover`]&&(a=s>=r._threshold),this._compress=a):(a=!1,i=0),t.fin&&(this._firstFragment=!0);let l={[g]:s,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:i,readOnly:c,rsv1:a};u(e)?this._state===0?this.getBlobData(e,this._compress,l,n):this.enqueue([this.getBlobData,e,this._compress,l,n]):this._state===0?this.dispatch(e,this._compress,l,n):this.enqueue([this.dispatch,e,this._compress,l,n])}getBlobData(t,n,r,i){this._bufferedBytes+=r[g],this._state=2,t.arrayBuffer().then(t=>{if(this._socket.destroyed){let e=Error(`The socket was closed while the blob was being read`);process.nextTick(C,this,e,i);return}this._bufferedBytes-=r[g];let a=p(t);n?this.dispatch(a,n,r,i):(this._state=0,this.sendFrame(e.frame(a,r),i),this.dequeue())}).catch(e=>{process.nextTick(w,this,e,i)})}dispatch(t,n,r,i){if(!n){this.sendFrame(e.frame(t,r),i);return}let a=this._extensions[o.extensionName];this._bufferedBytes+=r[g],this._state=1,a.compress(t,r.fin,(t,n)=>{if(this._socket.destroyed){let e=Error(`The socket was closed while data was being compressed`);C(this,e,i);return}this._bufferedBytes-=r[g],this._state=0,r.readOnly=!1,this.sendFrame(e.frame(n,r),i),this.dequeue()})}dequeue(){for(;this._state===0&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][g],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][g],this._queue.push(e)}sendFrame(e,t){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],t),this._socket.uncork()):this._socket.write(e[0],t)}};function C(e,t,n){typeof n==`function`&&n(t);for(let n=0;n<e._queue.length;n++){let r=e._queue[n],i=r[r.length-1];typeof i==`function`&&i(t)}}function w(e,t,n){C(e,t,n),e.onerror(t)}})),x=n(((e,t)=>{let{kForOnEventAttribute:n,kListener:r}=m(),i=Symbol(`kCode`),a=Symbol(`kData`),o=Symbol(`kError`),s=Symbol(`kMessage`),c=Symbol(`kReason`),l=Symbol(`kTarget`),u=Symbol(`kType`),d=Symbol(`kWasClean`);var f=class{constructor(e){this[l]=null,this[u]=e}get target(){return this[l]}get type(){return this[u]}};Object.defineProperty(f.prototype,`target`,{enumerable:!0}),Object.defineProperty(f.prototype,`type`,{enumerable:!0});var p=class extends f{constructor(e,t={}){super(e),this[i]=t.code===void 0?0:t.code,this[c]=t.reason===void 0?``:t.reason,this[d]=t.wasClean===void 0?!1:t.wasClean}get code(){return this[i]}get reason(){return this[c]}get wasClean(){return this[d]}};Object.defineProperty(p.prototype,`code`,{enumerable:!0}),Object.defineProperty(p.prototype,`reason`,{enumerable:!0}),Object.defineProperty(p.prototype,`wasClean`,{enumerable:!0});var h=class extends f{constructor(e,t={}){super(e),this[o]=t.error===void 0?null:t.error,this[s]=t.message===void 0?``:t.message}get error(){return this[o]}get message(){return this[s]}};Object.defineProperty(h.prototype,`error`,{enumerable:!0}),Object.defineProperty(h.prototype,`message`,{enumerable:!0});var g=class extends f{constructor(e,t={}){super(e),this[a]=t.data===void 0?null:t.data}get data(){return this[a]}};Object.defineProperty(g.prototype,`data`,{enumerable:!0}),t.exports={CloseEvent:p,ErrorEvent:h,Event:f,EventTarget:{addEventListener(e,t,i={}){for(let a of this.listeners(e))if(!i[n]&&a[r]===t&&!a[n])return;let a;if(e===`message`)a=function(e,n){let r=new g(`message`,{data:n?e:e.toString()});r[l]=this,_(t,this,r)};else if(e===`close`)a=function(e,n){let r=new p(`close`,{code:e,reason:n.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});r[l]=this,_(t,this,r)};else if(e===`error`)a=function(e){let n=new h(`error`,{error:e,message:e.message});n[l]=this,_(t,this,n)};else if(e===`open`)a=function(){let e=new f(`open`);e[l]=this,_(t,this,e)};else return;a[n]=!!i[n],a[r]=t,i.once?this.once(e,a):this.on(e,a)},removeEventListener(e,t){for(let i of this.listeners(e))if(i[r]===t&&!i[n]){this.removeListener(e,i);break}}},MessageEvent:g};function _(e,t,n){typeof e==`object`&&e.handleEvent?e.handleEvent.call(e,n):e.call(t,n)}})),S=n(((e,t)=>{let{tokenChars:n}=v();function r(e,t,n){e[t]===void 0?e[t]=[n]:e[t].push(n)}function i(e){let t=Object.create(null),i=Object.create(null),a=!1,o=!1,s=!1,c,l,u=-1,d=-1,f=-1,p=0;for(;p<e.length;p++)if(d=e.charCodeAt(p),c===void 0)if(f===-1&&n[d]===1)u===-1&&(u=p);else if(p!==0&&(d===32||d===9))f===-1&&u!==-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p);let n=e.slice(u,f);d===44?(r(t,n,i),i=Object.create(null)):c=n,u=f=-1}else throw SyntaxError(`Unexpected character at index ${p}`);else if(l===void 0)if(f===-1&&n[d]===1)u===-1&&(u=p);else if(d===32||d===9)f===-1&&u!==-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p),r(i,e.slice(u,f),!0),d===44&&(r(t,c,i),i=Object.create(null),c=void 0),u=f=-1}else if(d===61&&u!==-1&&f===-1)l=e.slice(u,p),u=f=-1;else throw SyntaxError(`Unexpected character at index ${p}`);else if(o){if(n[d]!==1)throw SyntaxError(`Unexpected character at index ${p}`);u===-1?u=p:a||=!0,o=!1}else if(s)if(n[d]===1)u===-1&&(u=p);else if(d===34&&u!==-1)s=!1,f=p;else if(d===92)o=!0;else throw SyntaxError(`Unexpected character at index ${p}`);else if(d===34&&e.charCodeAt(p-1)===61)s=!0;else if(f===-1&&n[d]===1)u===-1&&(u=p);else if(u!==-1&&(d===32||d===9))f===-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p);let n=e.slice(u,f);a&&=(n=n.replace(/\\/g,``),!1),r(i,l,n),d===44&&(r(t,c,i),i=Object.create(null),c=void 0),l=void 0,u=f=-1}else throw SyntaxError(`Unexpected character at index ${p}`);if(u===-1||s||d===32||d===9)throw SyntaxError(`Unexpected end of input`);f===-1&&(f=p);let m=e.slice(u,f);return c===void 0?r(t,m,i):(l===void 0?r(i,m,!0):a?r(i,l,m.replace(/\\/g,``)):r(i,l,m),r(t,c,i)),t}function a(e){return Object.keys(e).map(t=>{let n=e[t];return Array.isArray(n)||(n=[n]),n.map(e=>[t].concat(Object.keys(e).map(t=>{let n=e[t];return Array.isArray(n)||(n=[n]),n.map(e=>e===!0?t:`${t}=${e}`).join(`; `)})).join(`; `)).join(`, `)}).join(`, `)}t.exports={format:a,parse:i}})),C=n(((e,n)=>{let r=t(`events`),i=t(`https`),a=t(`http`),o=t(`net`),s=t(`tls`),{randomBytes:c,createHash:l}=t(`crypto`),{Duplex:u,Readable:d}=t(`stream`),{URL:f}=t(`url`),p=_(),g=y(),C=b(),{isBlob:w}=v(),{BINARY_TYPES:T,CLOSE_TIMEOUT:E,EMPTY_BUFFER:D,GUID:O,kForOnEventAttribute:k,kListener:A,kStatusCode:j,kWebSocket:M,NOOP:N}=m(),{EventTarget:{addEventListener:P,removeEventListener:F}}=x(),{format:I,parse:L}=S(),{toBuffer:R}=h(),z=Symbol(`kAborted`),B=[8,13],V=[`CONNECTING`,`OPEN`,`CLOSING`,`CLOSED`],H=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;var U=class e extends r{constructor(t,n,r){super(),this._binaryType=T[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=D,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol=``,this._readyState=e.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,t===null?(this._autoPong=r.autoPong,this._closeTimeout=r.closeTimeout,this._isServer=!0):(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,n===void 0?n=[]:Array.isArray(n)||(typeof n==`object`&&n?(r=n,n=[]):n=[n]),W(this,t,n,r))}get binaryType(){return this._binaryType}set binaryType(e){T.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(t,n,r){let i=new g({allowSynchronousEvents:r.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxBufferedChunks:r.maxBufferedChunks,maxFragments:r.maxFragments,maxPayload:r.maxPayload,skipUTF8Validation:r.skipUTF8Validation}),a=new C(t,this._extensions,r.generateMask);this._receiver=i,this._sender=a,this._socket=t,i[M]=this,a[M]=this,t[M]=this,i.on(`conclude`,ee),i.on(`drain`,te),i.on(`error`,ne),i.on(`message`,re),i.on(`ping`,ie),i.on(`pong`,ae),a.onerror=oe,t.setTimeout&&t.setTimeout(0),t.setNoDelay&&t.setNoDelay(),n.length>0&&t.unshift(n),t.on(`close`,se),t.on(`data`,$),t.on(`end`,ce),t.on(`error`,le),this._readyState=e.OPEN,this.emit(`open`)}emitClose(){if(!this._socket){this._readyState=e.CLOSED,this.emit(`close`,this._closeCode,this._closeMessage);return}this._extensions[p.extensionName]&&this._extensions[p.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=e.CLOSED,this.emit(`close`,this._closeCode,this._closeMessage)}close(t,n){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){J(this,this._req,`WebSocket was closed before the connection was established`);return}if(this.readyState===e.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=e.CLOSING,this._sender.close(t,n,!this._isServer,e=>{e||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),Q(this)}}pause(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!0,this._socket.pause())}ping(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);if(typeof t==`function`?(r=t,t=n=void 0):typeof n==`function`&&(r=n,n=void 0),typeof t==`number`&&(t=t.toString()),this.readyState!==e.OPEN){Y(this,t,r);return}n===void 0&&(n=!this._isServer),this._sender.ping(t||D,n,r)}pong(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);if(typeof t==`function`?(r=t,t=n=void 0):typeof n==`function`&&(r=n,n=void 0),typeof t==`number`&&(t=t.toString()),this.readyState!==e.OPEN){Y(this,t,r);return}n===void 0&&(n=!this._isServer),this._sender.pong(t||D,n,r)}resume(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);if(typeof n==`function`&&(r=n,n={}),typeof t==`number`&&(t=t.toString()),this.readyState!==e.OPEN){Y(this,t,r);return}let i={binary:typeof t!=`string`,mask:!this._isServer,compress:!0,fin:!0,...n};this._extensions[p.extensionName]||(i.compress=!1),this._sender.send(t||D,i,r)}terminate(){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){J(this,this._req,`WebSocket was closed before the connection was established`);return}this._socket&&(this._readyState=e.CLOSING,this._socket.destroy())}}};Object.defineProperty(U,`CONNECTING`,{enumerable:!0,value:V.indexOf(`CONNECTING`)}),Object.defineProperty(U.prototype,`CONNECTING`,{enumerable:!0,value:V.indexOf(`CONNECTING`)}),Object.defineProperty(U,`OPEN`,{enumerable:!0,value:V.indexOf(`OPEN`)}),Object.defineProperty(U.prototype,`OPEN`,{enumerable:!0,value:V.indexOf(`OPEN`)}),Object.defineProperty(U,`CLOSING`,{enumerable:!0,value:V.indexOf(`CLOSING`)}),Object.defineProperty(U.prototype,`CLOSING`,{enumerable:!0,value:V.indexOf(`CLOSING`)}),Object.defineProperty(U,`CLOSED`,{enumerable:!0,value:V.indexOf(`CLOSED`)}),Object.defineProperty(U.prototype,`CLOSED`,{enumerable:!0,value:V.indexOf(`CLOSED`)}),[`binaryType`,`bufferedAmount`,`extensions`,`isPaused`,`protocol`,`readyState`,`url`].forEach(e=>{Object.defineProperty(U.prototype,e,{enumerable:!0})}),[`open`,`error`,`close`,`message`].forEach(e=>{Object.defineProperty(U.prototype,`on${e}`,{enumerable:!0,get(){for(let t of this.listeners(e))if(t[k])return t[A];return null},set(t){for(let t of this.listeners(e))if(t[k]){this.removeListener(e,t);break}typeof t==`function`&&this.addEventListener(e,t,{[k]:!0})}})}),U.prototype.addEventListener=P,U.prototype.removeEventListener=F,n.exports=U;function W(e,t,n,r){let o={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:E,protocolVersion:B[1],maxBufferedChunks:1024*1024,maxFragments:128*1024,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...r,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:`GET`,host:void 0,path:void 0,port:void 0};if(e._autoPong=o.autoPong,e._closeTimeout=o.closeTimeout,!B.includes(o.protocolVersion))throw RangeError(`Unsupported protocol version: ${o.protocolVersion} (supported versions: ${B.join(`, `)})`);let s;if(t instanceof f)s=t;else try{s=new f(t)}catch{throw SyntaxError(`Invalid URL: ${t}`)}s.protocol===`http:`?s.protocol=`ws:`:s.protocol===`https:`&&(s.protocol=`wss:`),e._url=s.href;let u=s.protocol===`wss:`,d=s.protocol===`ws+unix:`,m;if(s.protocol!==`ws:`&&!u&&!d?m=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:d&&!s.pathname?m=`The URL's pathname is empty`:s.hash&&(m=`The URL contains a fragment identifier`),m){let t=SyntaxError(m);if(e._redirects===0)throw t;G(e,t);return}let h=u?443:80,g=c(16).toString(`base64`),_=u?i.request:a.request,v=new Set,y;if(o.createConnection=o.createConnection||(u?q:K),o.defaultPort=o.defaultPort||h,o.port=s.port||h,o.host=s.hostname.startsWith(`[`)?s.hostname.slice(1,-1):s.hostname,o.headers={...o.headers,"Sec-WebSocket-Version":o.protocolVersion,"Sec-WebSocket-Key":g,Connection:`Upgrade`,Upgrade:`websocket`},o.path=s.pathname+s.search,o.timeout=o.handshakeTimeout,o.perMessageDeflate&&(y=new p({...o.perMessageDeflate,isServer:!1,maxPayload:o.maxPayload}),o.headers[`Sec-WebSocket-Extensions`]=I({[p.extensionName]:y.offer()})),n.length){for(let e of n){if(typeof e!=`string`||!H.test(e)||v.has(e))throw SyntaxError(`An invalid or duplicated subprotocol was specified`);v.add(e)}o.headers[`Sec-WebSocket-Protocol`]=n.join(`,`)}if(o.origin&&(o.protocolVersion<13?o.headers[`Sec-WebSocket-Origin`]=o.origin:o.headers.Origin=o.origin),(s.username||s.password)&&(o.auth=`${s.username}:${s.password}`),d){let e=o.path.split(`:`);o.socketPath=e[0],o.path=e[1]}let b;if(o.followRedirects){if(e._redirects===0){e._originalIpc=d,e._originalSecure=u,e._originalHostOrSocketPath=d?o.socketPath:s.host;let t=r&&r.headers;if(r={...r,headers:{}},t)for(let[e,n]of Object.entries(t))r.headers[e.toLowerCase()]=n}else if(e.listenerCount(`redirect`)===0){let t=d?e._originalIpc?o.socketPath===e._originalHostOrSocketPath:!1:e._originalIpc?!1:s.host===e._originalHostOrSocketPath;(!t||e._originalSecure&&!u)&&(delete o.headers.authorization,delete o.headers.cookie,t||delete o.headers.host,o.auth=void 0)}o.auth&&!r.headers.authorization&&(r.headers.authorization=`Basic `+Buffer.from(o.auth).toString(`base64`)),b=e._req=_(o),e._redirects&&e.emit(`redirect`,e.url,b)}else b=e._req=_(o);o.timeout&&b.on(`timeout`,()=>{J(e,b,`Opening handshake has timed out`)}),b.on(`error`,t=>{b===null||b[z]||(b=e._req=null,G(e,t))}),b.on(`response`,i=>{let a=i.headers.location,s=i.statusCode;if(a&&o.followRedirects&&s>=300&&s<400){if(++e._redirects>o.maxRedirects){J(e,b,`Maximum redirects exceeded`);return}b.abort();let i;try{i=new f(a,t)}catch{G(e,SyntaxError(`Invalid URL: ${a}`));return}W(e,i,n,r)}else e.emit(`unexpected-response`,b,i)||J(e,b,`Unexpected server response: ${i.statusCode}`)}),b.on(`upgrade`,(t,n,r)=>{if(e.emit(`upgrade`,t),e.readyState!==U.CONNECTING)return;b=e._req=null;let i=t.headers.upgrade;if(i===void 0||i.toLowerCase()!==`websocket`){J(e,n,`Invalid Upgrade header`);return}let a=l(`sha1`).update(g+O).digest(`base64`);if(t.headers[`sec-websocket-accept`]!==a){J(e,n,`Invalid Sec-WebSocket-Accept header`);return}let s=t.headers[`sec-websocket-protocol`],c;if(s===void 0?v.size&&(c=`Server sent no subprotocol`):v.size?v.has(s)||(c=`Server sent an invalid subprotocol`):c=`Server sent a subprotocol but none was requested`,c){J(e,n,c);return}s&&(e._protocol=s);let u=t.headers[`sec-websocket-extensions`];if(u!==void 0){if(!y){J(e,n,`Server sent a Sec-WebSocket-Extensions header but no extension was requested`);return}let t;try{t=L(u)}catch{J(e,n,`Invalid Sec-WebSocket-Extensions header`);return}let r=Object.keys(t);if(r.length!==1||r[0]!==p.extensionName){J(e,n,`Server indicated an extension that was not requested`);return}try{y.accept(t[p.extensionName])}catch{J(e,n,`Invalid Sec-WebSocket-Extensions header`);return}e._extensions[p.extensionName]=y}e.setSocket(n,r,{allowSynchronousEvents:o.allowSynchronousEvents,generateMask:o.generateMask,maxBufferedChunks:o.maxBufferedChunks,maxFragments:o.maxFragments,maxPayload:o.maxPayload,skipUTF8Validation:o.skipUTF8Validation})}),o.finishRequest?o.finishRequest(b,e):b.end()}function G(e,t){e._readyState=U.CLOSING,e._errorEmitted=!0,e.emit(`error`,t),e.emitClose()}function K(e){return e.path=e.socketPath,o.connect(e)}function q(e){return e.path=void 0,!e.servername&&e.servername!==``&&(e.servername=o.isIP(e.host)?``:e.host),s.connect(e)}function J(e,t,n){e._readyState=U.CLOSING;let r=Error(n);Error.captureStackTrace(r,J),t.setHeader?(t[z]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(G,e,r)):(t.destroy(r),t.once(`error`,e.emit.bind(e,`error`)),t.once(`close`,e.emitClose.bind(e)))}function Y(e,t,n){if(t){let n=w(t)?t.size:R(t).length;e._socket?e._sender._bufferedBytes+=n:e._bufferedAmount+=n}if(n){let t=Error(`WebSocket is not open: readyState ${e.readyState} (${V[e.readyState]})`);process.nextTick(n,t)}}function ee(e,t){let n=this[M];n._closeFrameReceived=!0,n._closeMessage=t,n._closeCode=e,n._socket[M]!==void 0&&(n._socket.removeListener(`data`,$),process.nextTick(Z,n._socket),e===1005?n.close():n.close(e,t))}function te(){let e=this[M];e.isPaused||e._socket.resume()}function ne(e){let t=this[M];t._socket[M]!==void 0&&(t._socket.removeListener(`data`,$),process.nextTick(Z,t._socket),t.close(e[j])),t._errorEmitted||(t._errorEmitted=!0,t.emit(`error`,e))}function X(){this[M].emitClose()}function re(e,t){this[M].emit(`message`,e,t)}function ie(e){let t=this[M];t._autoPong&&t.pong(e,!this._isServer,N),t.emit(`ping`,e)}function ae(e){this[M].emit(`pong`,e)}function Z(e){e.resume()}function oe(e){let t=this[M];t.readyState!==U.CLOSED&&(t.readyState===U.OPEN&&(t._readyState=U.CLOSING,Q(t)),this._socket.end(),t._errorEmitted||(t._errorEmitted=!0,t.emit(`error`,e)))}function Q(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),e._closeTimeout)}function se(){let e=this[M];if(this.removeListener(`close`,se),this.removeListener(`data`,$),this.removeListener(`end`,ce),e._readyState=U.CLOSING,!this._readableState.endEmitted&&!e._closeFrameReceived&&!e._receiver._writableState.errorEmitted&&this._readableState.length!==0){let t=this.read(this._readableState.length);e._receiver.write(t)}e._receiver.end(),this[M]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on(`error`,X),e._receiver.on(`finish`,X))}function $(e){this[M]._receiver.write(e)||this.pause()}function ce(){let e=this[M];e._readyState=U.CLOSING,e._receiver.end(),this.end()}function le(){let e=this[M];this.removeListener(`error`,le),this.on(`error`,N),e&&(e._readyState=U.CLOSING,this.destroy())}})),w=n(((e,n)=>{C();let{Duplex:r}=t(`stream`);function i(e){e.emit(`close`)}function a(){!this.destroyed&&this._writableState.finished&&this.destroy()}function o(e){this.removeListener(`error`,o),this.destroy(),this.listenerCount(`error`)===0&&this.emit(`error`,e)}function s(e,t){let n=!0,s=new r({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on(`message`,function(t,n){let r=!n&&s._readableState.objectMode?t.toString():t;s.push(r)||e.pause()}),e.once(`error`,function(e){s.destroyed||(n=!1,s.destroy(e))}),e.once(`close`,function(){s.destroyed||s.push(null)}),s._destroy=function(t,r){if(e.readyState===e.CLOSED){r(t),process.nextTick(i,s);return}let a=!1;e.once(`error`,function(e){a=!0,r(e)}),e.once(`close`,function(){a||r(t),process.nextTick(i,s)}),n&&e.terminate()},s._final=function(t){if(e.readyState===e.CONNECTING){e.once(`open`,function(){s._final(t)});return}e._socket!==null&&(e._socket._writableState.finished?(t(),s._readableState.endEmitted&&s.destroy()):(e._socket.once(`finish`,function(){t()}),e.close()))},s._read=function(){e.isPaused&&e.resume()},s._write=function(t,n,r){if(e.readyState===e.CONNECTING){e.once(`open`,function(){s._write(t,n,r)});return}e.send(t,r)},s.on(`end`,a),s.on(`error`,o),s}n.exports=s})),T=n(((e,t)=>{let{tokenChars:n}=v();function r(e){let t=new Set,r=-1,i=-1,a=0;for(;a<e.length;a++){let o=e.charCodeAt(a);if(i===-1&&n[o]===1)r===-1&&(r=a);else if(a!==0&&(o===32||o===9))i===-1&&r!==-1&&(i=a);else if(o===44){if(r===-1)throw SyntaxError(`Unexpected character at index ${a}`);i===-1&&(i=a);let n=e.slice(r,i);if(t.has(n))throw SyntaxError(`The "${n}" subprotocol is duplicated`);t.add(n),r=i=-1}else throw SyntaxError(`Unexpected character at index ${a}`)}if(r===-1||i!==-1)throw SyntaxError(`Unexpected end of input`);let o=e.slice(r,a);if(t.has(o))throw SyntaxError(`The "${o}" subprotocol is duplicated`);return t.add(o),t}t.exports={parse:r}})),E=n(((e,n)=>{let r=t(`events`),i=t(`http`),{Duplex:a}=t(`stream`),{createHash:o}=t(`crypto`),s=S(),c=_(),l=T(),u=C(),{CLOSE_TIMEOUT:d,GUID:f,kWebSocket:p}=m(),h=/^[+/0-9A-Za-z]{22}==$/;n.exports=class extends r{constructor(e,t){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxBufferedChunks:1024*1024,maxFragments:128*1024,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:d,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:u,...e},e.port==null&&!e.server&&!e.noServer||e.port!=null&&(e.server||e.noServer)||e.server&&e.noServer)throw TypeError(`One and only one of the "port", "server", or "noServer" options must be specified`);if(e.port==null?e.server&&(this._server=e.server):(this._server=i.createServer((e,t)=>{let n=i.STATUS_CODES[426];t.writeHead(426,{"Content-Length":n.length,"Content-Type":`text/plain`}),t.end(n)}),this._server.listen(e.port,e.host,e.backlog,t)),this._server){let e=this.emit.bind(this,`connection`);this._removeListeners=g(this._server,{listening:this.emit.bind(this,`listening`),error:this.emit.bind(this,`error`),upgrade:(t,n,r)=>{this.handleUpgrade(t,n,r,e)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=0}address(){if(this.options.noServer)throw Error(`The server is operating in "noServer" mode`);return this._server?this._server.address():null}close(e){if(this._state===2){e&&this.once(`close`,()=>{e(Error(`The server is not running`))}),process.nextTick(v,this);return}if(e&&this.once(`close`,e),this._state!==1)if(this._state=1,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients&&this.clients.size?this._shouldEmitClose=!0:process.nextTick(v,this);else{let e=this._server;this._removeListeners(),this._removeListeners=this._server=null,e.close(()=>{v(this)})}}shouldHandle(e){if(this.options.path){let t=e.url.indexOf(`?`);if((t===-1?e.url:e.url.slice(0,t))!==this.options.path)return!1}return!0}handleUpgrade(e,t,n,r){t.on(`error`,y);let i=e.headers[`sec-websocket-key`],a=e.headers.upgrade,o=+e.headers[`sec-websocket-version`];if(e.method!==`GET`){x(this,e,t,405,`Invalid HTTP method`);return}if(a===void 0||a.toLowerCase()!==`websocket`){x(this,e,t,400,`Invalid Upgrade header`);return}if(i===void 0||!h.test(i)){x(this,e,t,400,`Missing or invalid Sec-WebSocket-Key header`);return}if(o!==13&&o!==8){x(this,e,t,400,`Missing or invalid Sec-WebSocket-Version header`,{"Sec-WebSocket-Version":`13, 8`});return}if(!this.shouldHandle(e)){b(t,400);return}let u=e.headers[`sec-websocket-protocol`],d=new Set;if(u!==void 0)try{d=l.parse(u)}catch{x(this,e,t,400,`Invalid Sec-WebSocket-Protocol header`);return}let f=e.headers[`sec-websocket-extensions`],p={};if(this.options.perMessageDeflate&&f!==void 0){let n=new c({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let e=s.parse(f);e[c.extensionName]&&(n.accept(e[c.extensionName]),p[c.extensionName]=n)}catch{x(this,e,t,400,`Invalid or unacceptable Sec-WebSocket-Extensions header`);return}}if(this.options.verifyClient){let a={origin:e.headers[`${o===8?`sec-websocket-origin`:`origin`}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(a,(a,o,s,c)=>{if(!a)return b(t,o||401,s,c);this.completeUpgrade(p,i,d,e,t,n,r)});return}if(!this.options.verifyClient(a))return b(t,401)}this.completeUpgrade(p,i,d,e,t,n,r)}completeUpgrade(e,t,n,r,i,a,l){if(!i.readable||!i.writable)return i.destroy();if(i[p])throw Error(`server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration`);if(this._state>0)return b(i,503);let u=[`HTTP/1.1 101 Switching Protocols`,`Upgrade: websocket`,`Connection: Upgrade`,`Sec-WebSocket-Accept: ${o(`sha1`).update(t+f).digest(`base64`)}`],d=new this.options.WebSocket(null,void 0,this.options);if(n.size){let e=this.options.handleProtocols?this.options.handleProtocols(n,r):n.values().next().value;e&&(u.push(`Sec-WebSocket-Protocol: ${e}`),d._protocol=e)}if(e[c.extensionName]){let t=e[c.extensionName].params,n=s.format({[c.extensionName]:[t]});u.push(`Sec-WebSocket-Extensions: ${n}`),d._extensions=e}this.emit(`headers`,u,r),i.write(u.concat(`\r
|
|
3
3
|
`).join(`\r
|
|
4
4
|
`)),i.removeListener(`error`,y),d.setSocket(i,a,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxBufferedChunks:this.options.maxBufferedChunks,maxFragments:this.options.maxFragments,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(d),d.on(`close`,()=>{this.clients.delete(d),this._shouldEmitClose&&!this.clients.size&&process.nextTick(v,this)})),l(d,r)}};function g(e,t){for(let n of Object.keys(t))e.on(n,t[n]);return function(){for(let n of Object.keys(t))e.removeListener(n,t[n])}}function v(e){e._state=2,e.emit(`close`)}function y(){this.destroy()}function b(e,t,n,r){n||=i.STATUS_CODES[t],r={Connection:`close`,"Content-Type":`text/html`,"Content-Length":Buffer.byteLength(n),...r},e.once(`finish`,e.destroy),e.end(`HTTP/1.1 ${t} ${i.STATUS_CODES[t]}\r\n`+Object.keys(r).map(e=>`${e}: ${r[e]}`).join(`\r
|
|
5
5
|
`)+`\r
|
|
6
6
|
\r
|
|
7
|
-
`+n)}function x(e,t,n,r,i,a){if(e.listenerCount(`wsClientError`)){let r=Error(i);Error.captureStackTrace(r,x),e.emit(`wsClientError`,r,n,t)}else b(n,r,i,a)}})),D=
|
|
7
|
+
`+n)}function x(e,t,n,r,i,a){if(e.listenerCount(`wsClientError`)){let r=Error(i);Error.captureStackTrace(r,x),e.emit(`wsClientError`,r,n,t)}else b(n,r,i,a)}})),D=i();w(),S(),_(),y(),b(),T();var O=e(C(),1);E();var k=1e4,A={esm:`ESModule`,commonjs:`CommonJS`,"compiled-wasm":`CompiledWasm`,buffer:`Data`,text:`Text`,python:`PythonModule`,"python-requirement":`PythonRequirement`};async function j(e){if(typeof e!=`string`)return e;let t=await l(e),n=t.findIndex(e=>e===10);return await new D.Response(t,{headers:{"Content-Type":`multipart/form-data; boundary=${Uint8Array.prototype.slice.call(t,2,n).toString()}`}}).formData()}o(j,`parseWorkerBundle`);async function M(e){let t=[];for(let n of e.values())n instanceof Blob&&n.type!==`application/source-map`&&t.push(n);let n=new Blob(t);return{size:n.size,gzipSize:s(await n.arrayBuffer()).byteLength}}o(M,`getBundleSize`);function N(e){let t=new Map(e.nodes.map(e=>[e.id,e])),n=e.samples??[],r=e.timeDeltas??[],i=0,a=0,o=0;for(let[e,s]of r.entries()){i+=s;let r=t.get(n[e]??0)?.callFrame.functionName;r===`(idle)`?a+=s:r===`(garbage collector)`&&(o+=s)}return{profileWindow:e.endTime-e.startTime,sampledTime:i,activeTime:i-a,garbageCollectionTime:o,idleTime:a,sampleCount:n.length}}o(N,`summarizeStartupProfile`);async function P(e){let t=await j(e),n=JSON.parse(t.get(`metadata`));if(typeof n.main_module!=`string`)throw new r(`Startup profiling does not support service-worker format Workers. Refer to https://developers.cloudflare.com/workers/reference/migrate-to-module-workers/ for migration guidance.`,{telemetryMessage:`startup profiling service worker format unsupported`});let i=await F(t,n.bindings),a=new f(p({name:`profiler`,compatibilityDate:typeof n.compatibility_date==`string`?n.compatibility_date:void 0,compatibilityFlags:Array.isArray(n.compatibility_flags)?n.compatibility_flags:void 0,...i.options,modulesRoot:`/`,modules:[{type:`ESModule`,path:c(),contents:`
|
|
8
8
|
async function startup() {
|
|
9
9
|
await import(${JSON.stringify(n.main_module)});
|
|
10
10
|
}
|
|
@@ -14,4 +14,4 @@ import{i as e,r as t,t as n}from"./chunk-vbHwaUoU.mjs";import{P as r,Tt as i}fro
|
|
|
14
14
|
return new Response("ok");
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
-
`},...await q(t)],inspectorPort:0,handleStructuredLogs:o(()=>void 0,`handleStructuredLogs`)})),s=new AbortController,l=d(()=>{s.abort(new
|
|
17
|
+
`},...await q(t)],inspectorPort:0,handleStructuredLogs:o(()=>void 0,`handleStructuredLogs`)})),s=new AbortController,l=d(()=>{s.abort(new r(`Worker startup profiling timed out after ${k/1e3} seconds.`,{telemetryMessage:`startup profiling timed out`}))},k),m,h=o(e=>s.abort(e instanceof Error?e:Error(`Worker startup profiler inspector error: ${String(e)}`)),`onInspectorError`),g=o(()=>s.abort(Error(`The Worker startup profiler inspector connection closed.`)),`onInspectorClose`);try{await H(a.ready,s.signal);let e=await H(a.getInspectorURL(),s.signal);m=new O.default(new URL(`/core:user:profiler`,e.href)),m.on(`error`,h),m.on(`close`,g),await U(m,s.signal),await W(m,1,`Profiler.enable`,s.signal),await W(m,2,`Profiler.start`,s.signal);let t=await H(a.dispatchFetch(`https://example.com`,{signal:s.signal}),s.signal);if(await H(t.text(),s.signal),!t.ok&&i.unsupportedBindings.length>0){let e=` The upload contains bindings that cannot be reproduced locally during startup profiling: ${i.unsupportedBindings.map(e=>`${JSON.stringify(e.name)} (${JSON.stringify(e.type)})`).join(`, `)}.`;throw new r(`Worker startup profiling failed during module evaluation (status ${t.status}).${e}`,{telemetryMessage:`startup profiling module evaluation failed`})}let n=await W(m,3,`Profiler.stop`,s.signal);if(n?.profile===void 0)throw Error(`Inspector command Profiler.stop returned no profile.`);return n.profile}finally{try{await a.dispose()}finally{try{m!==void 0&&(m.off(`error`,h),m.off(`close`,g),m.readyState!==O.default.CLOSED&&(m.once(`error`,()=>void 0),m.terminate()))}finally{u(l)}}}}o(P,`analyseBundle`);async function F(e,t){let n={},r,i={},a={},o={},s={},c={},l,u={},d={},f={},p=[],m={},h={},g,_={},v,y={},b={},x={},S={},C={},w={},T={},E,D={},O,k={},A={},j={},M=[];for(let N of Array.isArray(t)?t:[]){if(!L(N)){M.push({name:`<unknown>`,type:`unknown`});continue}let t=N;if(I(t)){T[t.name]=R();continue}switch(t.type){case`plain_text`:case`secret_text`:c[t.name]=t.text;break;case`json`:c[t.name]=t.json;break;case`text_blob`:c[t.name]=await B(e,t);break;case`data_blob`:u[t.name]=await z(e,t);break;case`kv_namespace`:_[t.name]={id:t.namespace_id};break;case`d1`:d[t.name]={id:t.id};break;case`r2_bucket`:S[t.name]={id:t.bucket_name};break;case`queue`:x[t.name]={queueName:t.queue_name,deliveryDelay:t.delivery_delay};break;case`service`:T[t.name]=R(),M.push(t);break;case`assets`:T[t.name]=R();break;case`browser`:l={binding:t.name};break;case`ai`:r={binding:t.name};break;case`images`:g={binding:t.name};break;case`stream`:E={binding:t.name};break;case`version_metadata`:O=t.name;break;case`ai_search_namespace`:a[t.name]={namespace:t.namespace};break;case`ai_search`:i[t.name]={instance_name:t.instance_name};break;case`agent_memory`:n[t.name]={namespace:t.namespace};break;case`media`:v={binding:t.name};break;case`send_email`:{let e={name:t.name,allowed_sender_addresses:t.allowed_sender_addresses};t.destination_address===void 0?t.allowed_destination_addresses===void 0?p.push(e):p.push({...e,allowed_destination_addresses:t.allowed_destination_addresses}):p.push({...e,destination_address:t.destination_address});break}case`durable_object_namespace`:case`workflow`:M.push(t);break;case`vectorize`:D[t.name]={index_name:t.index_name};break;case`analytics_engine`:o[t.name]={dataset:t.dataset??`dataset`};break;case`dispatch_namespace`:f[t.name]={namespace:t.namespace};break;case`mtls_certificate`:y[t.name]={certificate_id:t.certificate_id};break;case`pipelines`:t.stream===void 0?t.pipeline===void 0?M.push(t):b[t.name]={pipeline:t.pipeline}:b[t.name]={stream:t.stream};break;case`secrets_store_secret`:w[t.name]={store_id:t.store_id,secret_name:t.secret_name};break;case`artifacts`:s[t.name]={namespace:t.namespace};break;case`unsafe_hello_world`:h[t.name]={enable_timer:t.enable_timer};break;case`flagship`:m[t.name]={app_id:t.app_id};break;case`ratelimit`:C[t.name]={namespace_id:t.namespace_id,simple:t.simple};break;case`vpc_service`:A[t.name]={service_id:t.service_id};break;case`vpc_network`:t.tunnel_id===void 0?t.network_id===void 0?M.push(t):k[t.name]={network_id:t.network_id}:k[t.name]={tunnel_id:t.tunnel_id};break;case`worker_loader`:j[t.name]={};break;case`inherit`:M.push(t);break;case`wasm_module`:M.push(t);break;case`hyperdrive`:M.push(t);break;case`logfwdr`:M.push(t);break;default:{let e=t;M.push(e)}}}return{options:{agentMemory:n,ai:r,aiSearchInstances:i,aiSearchNamespaces:a,analyticsEngineDatasets:o,artifacts:s,bindings:c,browserRendering:l,dataBlobBindings:u,d1Databases:d,dispatchNamespaces:f,email:{send_email:p},flagship:m,helloWorld:h,images:g,kvNamespaces:_,media:v,mtlsCertificates:y,pipelines:b,queueProducers:x,r2Buckets:S,ratelimits:C,secretsStoreSecrets:w,serviceBindings:T,stream:E,vectorize:D,versionMetadata:O,vpcNetworks:k,vpcServices:A,workerLoaders:j},unsupportedBindings:M}}o(F,`convertWorkerBundleBindings`);function I(e){switch(e.type){case`browser`:case`ai`:case`images`:case`kv_namespace`:case`workflow`:case`queue`:case`r2_bucket`:case`d1`:case`vectorize`:return e.raw===!0;default:return!1}}o(I,`isRawWorkerBinding`);function L(e){return typeof e==`object`&&!!e&&`name`in e&&typeof e.name==`string`&&`type`in e&&typeof e.type==`string`}o(L,`isNamedWorkerBinding`);function R(){return()=>new D.Response(`Binding calls are unavailable during startup profiling.`,{status:503})}o(R,`createOfflineFetcherBinding`);async function z(e,t){let n=V(e,t);return n instanceof Blob?new Uint8Array(await n.arrayBuffer()):new TextEncoder().encode(n)}o(z,`getBinaryBindingPart`);async function B(e,t){let n=V(e,t);return n instanceof Blob?await n.text():n}o(B,`getTextBindingPart`);function V(e,t){let n=e.get(t.part);if(n===null)throw new r(`Startup profiling could not find multipart part ${JSON.stringify(t.part)} for binding ${JSON.stringify(t.name)}.`,{telemetryMessage:`startup profiling binding part missing`});return n}o(V,`getBindingPart`);async function H(e,t){if(t.aborted)throw t.reason;return await new Promise((n,r)=>{let i=o(()=>r(t.reason),`onAbort`);t.addEventListener(`abort`,i,{once:!0}),e.then(n,r).finally(()=>{t.removeEventListener(`abort`,i)})})}o(H,`waitForPromise`);async function U(e,t){if(t.aborted)throw t.reason;return await new Promise((n,r)=>{let i=o(()=>{e.off(`open`,a),e.off(`error`,s),e.off(`close`,c),t.removeEventListener(`abort`,l)},`cleanup`),a=o(()=>{i(),n()},`onOpen`),s=o(e=>{i(),r(e)},`onError`),c=o(()=>{i(),r(Error(`The Worker startup profiler inspector connection closed.`))},`onClose`),l=o(()=>{i(),r(t.reason)},`onAbort`);e.once(`open`,a),e.once(`error`,s),e.once(`close`,c),t.addEventListener(`abort`,l,{once:!0})})}o(U,`waitForInspectorOpen`);async function W(e,t,n,r){if(r.aborted)throw r.reason;return await new Promise((i,a)=>{let s=o(()=>{e.off(`message`,c),r.removeEventListener(`abort`,l)},`cleanup`),c=o(e=>{let r;try{r=JSON.parse(e.toString())}catch(e){s(),a(e);return}if(r.id===t){if(s(),r.error!=null){a(Error(`Inspector command ${n} failed: ${r.error.message??`error ${r.error.code??`unknown`}`}`));return}i(r.result)}},`onMessage`),l=o(()=>{s(),a(r.reason)},`onAbort`);e.on(`message`,c),r.addEventListener(`abort`,l,{once:!0});try{e.send(JSON.stringify({id:t,method:n,params:{}}),e=>{e&&(s(),a(e))})}catch(e){s(),a(e)}})}o(W,`sendInspectorCommand`);async function G(e){return e instanceof Blob?new Uint8Array(await e.arrayBuffer()):e}o(G,`getEntryValue`);function K(e){if(e instanceof Blob)try{return A[a(e.type)]}catch{throw Error(`Unable to determine module type for ${e.type} mime type`)}return`Text`}o(K,`getModuleType`);async function q(e){return await Promise.all([...e.entries()].filter(e=>e[1]instanceof Blob&&e[1].type!==`application/source-map`).map(async([e,t])=>({type:K(t),path:e,contents:await G(t)})))}o(q,`convertWorkerBundleToModules`);export{P as analyseBundle,M as getBundleSize,N as summarizeStartupProfile};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{i as e,r as t}from"./cf-
|
|
2
|
+
import{i as e,r as t}from"./cf-yPz_IqW6.mjs";import{join as n}from"node:path";const r=t(()=>n(e(),`state.json`));function i(){return r.read()??{}}function a(e){r.write({...i(),...e})}export{i as readState,a as updateState};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{t as e}from"./local-
|
|
2
|
+
import{t as e}from"./local-DGiIS1uM.mjs";import{f as t,g as n}from"./oauth-DAa7SwkM.mjs";import{a as r,r as i}from"./auth-DY_Y2bXC.mjs";import{t as a}from"./output-BqDR9h74.mjs";import{t as o}from"./dry-run-ILZRVpnp.mjs";import{t as s}from"./progress-jYW64HY7.mjs";import{i as c,n as l,r as u,t as d}from"./body-parser-BGVbwPeM.mjs";import{n as f,t as p}from"./input-validation-1esLElok.mjs";import{a as m,n as h}from"./prompt-CyATfGUu.mjs";import{t as g}from"./cli-types-C3nVfpSG.mjs";import{n as _,t as v}from"./raw-fetch-CNKIypJ7.mjs";function ee(e){return e.positional(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`label`,{type:`string`,description:`A string to uniquely identify the track amongst other audio track labels for the specified video.`}).option(`url`,{type:`string`,description:"An audio track URL. The server must be publicly routable and support `HTTP HEAD` requests and `HTTP GET` range requests. The server should respond to `HTTP HEAD` requests with a `content-range` header that includes the size of the file."}).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 te={command:`copy <identifier>`,describe:`Adds an additional audio track to a video using the provided audio track URL.`,builder:ee,handler:async r=>{if(r.dryRun){o({command:`cf stream audio-tracks copy`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/stream/${r.identifier==null?`<identifier>`:encodeURIComponent(String(r.identifier))}/audio/copy`,pathParams:{identifier:String(r.identifier??``)},bodyKind:`json`,body:r.body===void 0?d({label:f(r.label,`label`,`text`),url:f(r.url,`url`,`text`)}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Creating`,async()=>c.stream.audioTracks.copy({...e,account_id:u,identifier:r.identifier})),{successLabel:`Created`});return}r.label===void 0&&(r.label=await m(`label`,`A string to uniquely identify the track amongst other audio track labels for the specified video.`));let p=d({label:f(r.label,`label`,`text`),url:f(r.url,`url`,`text`)});a(await s(`Creating`,async()=>c.stream.audioTracks.copy({...p,account_id:u,identifier:r.identifier})),{successLabel:`Created`})}};function y(e){return e.positional(`audio-identifier`,{type:`string`,description:`The unique identifier for an additional audio track.`,demandOption:!0}).option(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,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 b={command:`delete <audio-identifier>`,describe:`Deletes additional audio tracks on a video. Deleting a default audio track is not allowed. You must assign another audio track as default prior to deletion.`,builder:y,handler:async r=>{if(r.dryRun){o({command:`cf stream audio-tracks delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/stream/${r.identifier==null?`<identifier>`:encodeURIComponent(String(r.identifier))}/audio/${r[`audio-identifier`]==null?`<audio-identifier>`:encodeURIComponent(String(r[`audio-identifier`]))}`,pathParams:{identifier:String(r.identifier??``),"audio-identifier":String(r[`audio-identifier`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await h({force:!!r.force})){process.stderr.write(`Aborted.
|
|
3
3
|
`);return}a(await s(`Deleting`,async()=>c.stream.audioTracks.delete({account_id:l,identifier:r.identifier,audio_identifier:r[`audio-identifier`]})),{successLabel:`Deleted`})}};function x(e){return e.positional(`audio-identifier`,{type:`string`,description:`The unique identifier for an additional audio track.`,demandOption:!0}).option(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`default`,{type:`boolean`,description:`Denotes whether the audio track will be played by default in a player.`}).option(`label`,{type:`string`,description:`A string to uniquely identify the track amongst other audio track labels for the specified video.`}).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 S={command:`edit <audio-identifier>`,describe:"Edits additional audio tracks on a video. Editing the default status of an audio track to `true` will mark all other audio tracks on the video default status to `false`.",builder:x,handler:async r=>{if(r.dryRun){o({command:`cf stream audio-tracks edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/stream/${r.identifier==null?`<identifier>`:encodeURIComponent(String(r.identifier))}/audio/${r[`audio-identifier`]==null?`<audio-identifier>`:encodeURIComponent(String(r[`audio-identifier`]))}`,pathParams:{identifier:String(r.identifier??``),"audio-identifier":String(r[`audio-identifier`]??``)},bodyKind:`json`,body:r.body===void 0?d({default:r.default,label:f(r.label,`label`,`text`)}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Updating`,async()=>c.stream.audioTracks.edit({...e,account_id:u,identifier:r.identifier,audio_identifier:r[`audio-identifier`]})),{successLabel:`Updated`});return}let p=d({default:r.default,label:f(r.label,`label`,`text`)});a(await s(`Updating`,async()=>c.stream.audioTracks.edit({...p,account_id:u,identifier:r.identifier,audio_identifier:r[`audio-identifier`]})),{successLabel:`Updated`})}};function C(e){return e.positional(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const w={command:`get <identifier>`,describe:`Lists additional audio tracks on a video. Note this API will not return information for audio attached to the video upload.`,builder:C,handler:async r=>{if(r.dryRun){o({command:`cf stream audio-tracks get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/stream/${r.identifier==null?`<identifier>`:encodeURIComponent(String(r.identifier))}/audio`,pathParams:{identifier:String(r.identifier??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.stream.audioTracks.get({account_id:l,identifier:r.identifier})),{successLabel:`Loaded`})}},T={command:`audio-tracks`,describe:`Add, edit, or remove additional audio tracks on a video`,builder:e=>e.command(te).command(b).command(S).command(w).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function E(e){return e.positional(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const D={command:`get <identifier>`,describe:`Lists the available captions or subtitles for a specific video.`,builder:E,handler:async r=>{if(r.dryRun){o({command:`cf stream captions get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/stream/${r.identifier==null?`<identifier>`:encodeURIComponent(String(r.identifier))}/captions`,pathParams:{identifier:String(r.identifier??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.stream.captions.get({account_id:l,identifier:r.identifier})),{successLabel:`Loaded`})}};function O(e){return e.positional(`language`,{type:`string`,description:`The language tag in BCP 47 format.`,demandOption:!0}).option(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const k={command:`create <language>`,describe:`Generate captions or subtitles for provided language via AI.`,builder:O,handler:async r=>{if(r.dryRun){o({command:`cf stream captions language create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/stream/${r.identifier==null?`<identifier>`:encodeURIComponent(String(r.identifier))}/captions/${r.language==null?`<language>`:encodeURIComponent(String(r.language))}/generate`,pathParams:{language:String(r.language??``),identifier:String(r.identifier??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Creating`,async()=>c.stream.captions.language.create({account_id:l,identifier:r.identifier,language:r.language})),{successLabel:`Created`})}};function A(e){return e.positional(`language`,{type:`string`,description:`The language tag in BCP 47 format.`,demandOption:!0}).option(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,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 j={command:`delete <language>`,describe:`Removes the captions or subtitles from a video.`,builder:A,handler:async r=>{if(r.dryRun){o({command:`cf stream captions language delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/stream/${r.identifier==null?`<identifier>`:encodeURIComponent(String(r.identifier))}/captions/${r.language==null?`<language>`:encodeURIComponent(String(r.language))}`,pathParams:{language:String(r.language??``),identifier:String(r.identifier??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await h({force:!!r.force})){process.stderr.write(`Aborted.
|
|
4
4
|
`);return}a(await s(`Deleting`,async()=>c.stream.captions.language.delete({account_id:l,identifier:r.identifier,language:r.language})),{successLabel:`Deleted`})}};function M(e){return e.positional(`language`,{type:`string`,description:`The language tag in BCP 47 format.`,demandOption:!0}).option(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const N={command:`get <language>`,describe:`Lists the captions or subtitles for provided language.`,builder:M,handler:async r=>{if(r.dryRun){o({command:`cf stream captions language get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/stream/${r.identifier==null?`<identifier>`:encodeURIComponent(String(r.identifier))}/captions/${r.language==null?`<language>`:encodeURIComponent(String(r.language))}`,pathParams:{language:String(r.language??``),identifier:String(r.identifier??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.stream.captions.language.get({account_id:l,identifier:r.identifier,language:r.language})),{successLabel:`Loaded`})}};function P(e){return e.positional(`language`,{type:`string`,description:`The language tag in BCP 47 format.`,demandOption:!0}).option(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).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(`file`,{type:`string`,description:`Path to a file to upload as the request body`})}const F={command:`update <language>`,describe:`Uploads the caption or subtitle file to the endpoint for a specific BCP47 language. One caption or subtitle file per language is allowed.`,builder:P,handler:async c=>{if(c.dryRun){o({command:`cf stream captions language update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/stream/${c.identifier==null?`<identifier>`:encodeURIComponent(String(c.identifier))}/captions/${c.language==null?`<language>`:encodeURIComponent(String(c.language))}`,pathParams:{language:String(c.language??``),identifier:String(c.identifier??``)},bodyKind:`multipart`,body:{body:c.body,file:c.file}});return}let l=await i(c),u=c.local?e:await t();if(c.accountId=u,c.file!==void 0||c.body!==void 0){let e=new FormData;if(c.file){let t=p(c.file);e.append(`file`,new Blob([t]),c.file.split(/[\\/]/).filter(Boolean).pop())}else c.body!==void 0&&e.append(`file`,c.body);a(await s(`Updating`,async()=>r(l,`PUT`,`/accounts/${u}/stream/${encodeURIComponent(String(c.identifier))}/captions/${encodeURIComponent(String(c.language))}`,{body:e})),{successLabel:`Updated`});return}if(c.body){let e=f(c.body,`body`,`binary`);a(await s(`Updating`,async()=>r(l,`PUT`,`/accounts/${u}/stream/${encodeURIComponent(String(c.identifier))}/captions/${encodeURIComponent(String(c.language))}`,{body:e,headers:{"Content-Type":`multipart/form-data`}})),{successLabel:`Updated`});return}if(c.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function I(e){return e.positional(`language`,{type:`string`,description:`The language tag in BCP 47 format.`,demandOption:!0}).option(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const L={command:`get <language>`,describe:`Return WebVTT captions for a provided language.`,builder:I,handler:async r=>{if(r.dryRun){o({command:`cf stream captions language vtt get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/stream/${r.identifier==null?`<identifier>`:encodeURIComponent(String(r.identifier))}/captions/${r.language==null?`<language>`:encodeURIComponent(String(r.language))}/vtt`,pathParams:{language:String(r.language??``),identifier:String(r.identifier??``)},bodyKind:`none`});return}await i(r);let a=r.local?e:await t();r.accountId=a,_((await s(`Loading`,async()=>v(`/accounts/${a}/stream/${encodeURIComponent(String(r.identifier))}/captions/${encodeURIComponent(String(r.language))}/vtt`,{method:`GET`,local:r.local===!0,persistTo:r.persistTo}))).toString(`utf-8`))}},R={command:`vtt`,describe:`Operations for captions.language.vtt`,builder:e=>e.command(L).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},z={command:`language`,describe:`Operations for captions.language`,builder:e=>e.command(k).command(j).command(N).command(F).command(R).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},B={command:`captions`,describe:`Upload, generate, or retrieve captions and subtitles for videos in multiple languages`,builder:e=>e.command(D).command(z).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function V(e){return e.option(`allowed-origins`,{type:`string`,array:!0,description:"Lists the origins allowed to display the video. Enter allowed origin domains in an array and use `*` for wildcard subdomains. Empty arrays allow the video to be viewed on any origin."}).option(`clipped-from-video-uid`,{type:`string`,description:`The unique video identifier (UID).`}).option(`creator`,{type:`string`,description:`A user-defined identifier for the media creator.`}).option(`end-time-seconds`,{type:`number`,description:`Specifies the end time for the video clip in seconds.`}).option(`input`,{type:`string`,description:`A video's URL. Preferred over 'url'.`}).option(`name`,{type:`string`,description:`A name for the video.`}).option(`require-signed-urls`,{type:`boolean`,description:"Indicates whether the video can be a accessed using the UID. When set to `true`, a signed token must be generated with a signing key to view the video.",default:!1}).option(`scheduled-deletion`,{type:`string`,description:"Indicates the date and time at which the video will be deleted. Omit the field to indicate no change, or include with a `null` value to remove an existing scheduled deletion. If specified, must be at least 30 days from upload time."}).option(`start-time-seconds`,{type:`number`,description:`Specifies the start time for the video clip in seconds.`}).option(`thumbnail-timestamp-pct`,{type:`number`,description:`The timestamp for a thumbnail image calculated as a percentage value of the video's duration. To convert from a second-wise timestamp to a percentage, divide the desired timestamp by the total duration of the video. If this value is not set, the default thumbnail image is taken from 0s of the video.`,default:0}).option(`url`,{type:`string`,description:`A video's URL (legacy field, use 'input' instead).`}).option(`watermark-uid`,{type:`string`,description:`The unique identifier for the watermark profile.`}).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 H={command:`create`,describe:`Clips a video based on the specified start and end times provided in seconds.`,builder:V,handler:async r=>{if(r.dryRun){o({command:`cf stream clip create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/stream/clip`,pathParams:{},bodyKind:`json`,body:r.body===void 0?d({allowedOrigins:r[`allowed-origins`],clippedFromVideoUID:f(r[`clipped-from-video-uid`],`clipped-from-video-uid`,`text`),creator:f(r.creator,`creator`,`text`),endTimeSeconds:r[`end-time-seconds`],input:f(r.input,`input`,`text`),name:f(r.name,`name`,`text`),requireSignedURLs:r[`require-signed-urls`],scheduledDeletion:f(r[`scheduled-deletion`],`scheduled-deletion`,`text`),startTimeSeconds:r[`start-time-seconds`],thumbnailTimestampPct:r[`thumbnail-timestamp-pct`],url:f(r.url,`url`,`text`),watermark:{uid:f(r[`watermark-uid`],`watermark-uid`,`text`)}}):l(r.body)});return}let c=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=l(r.body);a(await s(`Creating`,async()=>c.stream.clip.create({...e,account_id:u})),{successLabel:`Created`});return}if(r[`clipped-from-video-uid`]===void 0&&(r[`clipped-from-video-uid`]=await m(`clipped-from-video-uid`,`The unique video identifier (UID).`)),r[`end-time-seconds`]===void 0)throw Error(`--end-time-seconds is required (or pass --body with this field set).`);if(r[`start-time-seconds`]===void 0)throw Error(`--start-time-seconds is required (or pass --body with this field set).`);let p=d({allowedOrigins:r[`allowed-origins`],clippedFromVideoUID:f(r[`clipped-from-video-uid`],`clipped-from-video-uid`,`text`),creator:f(r.creator,`creator`,`text`),endTimeSeconds:r[`end-time-seconds`],input:f(r.input,`input`,`text`),name:f(r.name,`name`,`text`),requireSignedURLs:r[`require-signed-urls`],scheduledDeletion:f(r[`scheduled-deletion`],`scheduled-deletion`,`text`),startTimeSeconds:r[`start-time-seconds`],thumbnailTimestampPct:r[`thumbnail-timestamp-pct`],url:f(r.url,`url`,`text`),watermark:{uid:f(r[`watermark-uid`],`watermark-uid`,`text`)}});a(await s(`Creating`,async()=>c.stream.clip.create({...p,account_id:u})),{successLabel:`Created`})}},U={command:`clip`,describe:`Create a new video clip from an existing video by specifying start and end times`,builder:e=>e.command(H).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function W(e){return e.option(`upload-creator`,{type:`string`,description:`A user-defined identifier for the media creator.`}).option(`allowed-origins`,{type:`string`,array:!0,description:"Lists the origins allowed to display the video. Enter allowed origin domains in an array and use `*` for wildcard subdomains. Empty arrays allow the video to be viewed on any origin."}).option(`creator`,{type:`string`,description:`A user-defined identifier for the media creator.`}).option(`input`,{type:`string`,description:"A video's URL. The server must be publicly routable and support `HTTP HEAD` requests and `HTTP GET` range requests. The server should respond to `HTTP HEAD` requests with a `content-range` header that includes the size of the file. This is the preferred field over `url`."}).option(`name`,{type:`string`,description:`A video's name. Used for legacy compatibility.`}).option(`require-signed-urls`,{type:`boolean`,description:"Indicates whether the video can be a accessed using the UID. When set to `true`, a signed token must be generated with a signing key to view the video.",default:!1}).option(`scheduled-deletion`,{type:`string`,description:"Indicates the date and time at which the video will be deleted. Omit the field to indicate no change, or include with a `null` value to remove an existing scheduled deletion. If specified, must be at least 30 days from upload time."}).option(`thumbnail-timestamp-pct`,{type:`number`,description:`The timestamp for a thumbnail image calculated as a percentage value of the video's duration. To convert from a second-wise timestamp to a percentage, divide the desired timestamp by the total duration of the video. If this value is not set, the default thumbnail image is taken from 0s of the video.`,default:0}).option(`url`,{type:`string`,description:"A video's URL. The server must be publicly routable and support `HTTP HEAD` requests and `HTTP GET` range requests. The server should respond to `HTTP HEAD` requests with a `content-range` header that includes the size of the file. This field is deprecated in favor of `input`."}).option(`watermark-uid`,{type:`string`,description:`The unique identifier for the watermark profile.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:"Copy upload request. Provide `input` (preferred) or `url` (deprecated)."})}const G={command:`create`,describe:`Uploads a video to Stream from a provided URL.`,builder:W,handler:async u=>{let p={};if(u[`upload-creator`]!==void 0&&(p[`Upload-Creator`]=String(u[`upload-creator`])),u.dryRun){o({command:`cf stream copy create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/stream/copy`,pathParams:{},bodyKind:`json`,body:u.body===void 0?d({allowedOrigins:u[`allowed-origins`],creator:f(u.creator,`creator`,`text`),input:f(u.input,`input`,`text`),name:f(u.name,`name`,`text`),requireSignedURLs:u[`require-signed-urls`],scheduledDeletion:f(u[`scheduled-deletion`],`scheduled-deletion`,`text`),thumbnailTimestampPct:u[`thumbnail-timestamp-pct`],url:f(u.url,`url`,`text`),watermark:{uid:f(u[`watermark-uid`],`watermark-uid`,`text`)}}):l(u.body)});return}let m=await i(u),h=u.local?e:await t();if(u.accountId=h,u.body){let e=l(u.body);a(await s(`Creating`,async()=>r(m,`POST`,`/accounts/${h}/stream/copy`,{body:e,headers:Object.keys(p).length>0?p:void 0})),{successLabel:`Created`});return}let g={};u[`allowed-origins`]!==void 0&&c(g,[`allowedOrigins`],u[`allowed-origins`]),u.creator!==void 0&&c(g,[`creator`],f(u.creator,`creator`,`text`)),u.input!==void 0&&c(g,[`input`],f(u.input,`input`,`text`)),u.name!==void 0&&c(g,[`name`],f(u.name,`name`,`text`)),u[`require-signed-urls`]!==void 0&&c(g,[`requireSignedURLs`],u[`require-signed-urls`]),u[`scheduled-deletion`]!==void 0&&c(g,[`scheduledDeletion`],f(u[`scheduled-deletion`],`scheduled-deletion`,`text`)),u[`thumbnail-timestamp-pct`]!==void 0&&c(g,[`thumbnailTimestampPct`],u[`thumbnail-timestamp-pct`]),u.url!==void 0&&c(g,[`url`],f(u.url,`url`,`text`)),u[`watermark-uid`]!==void 0&&c(g,[`watermark`,`uid`],f(u[`watermark-uid`],`watermark-uid`,`text`)),a(await s(`Creating`,async()=>r(m,`POST`,`/accounts/${h}/stream/copy`,{body:Object.keys(g).length>0?g:void 0,headers:Object.keys(p).length>0?p:void 0})),{successLabel:`Created`})}},K={command:`copy`,describe:`Import a video from a URL into Stream for processing and delivery`,builder:e=>e.command(G).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function q(e){return e.option(`direct-user`,{type:`boolean`,description:`Provisions a URL to let your end users upload videos directly to Cloudflare Stream without exposing your API token to clients.`}).option(`tus-resumable`,{type:`string`,description:`Specifies the TUS protocol version. This value must be included in every upload request.
|
|
5
5
|
Notes: The only supported version of TUS protocol is 1.0.0.`,demandOption:!0}).option(`upload-creator`,{type:`string`,description:`A user-defined identifier for the media creator.`}).option(`upload-length`,{type:`string`,description:`Indicates the size of the entire upload in bytes. The value must be a non-negative integer.`,demandOption:!0}).option(`upload-metadata`,{type:`string`,description:"Comma-separated key-value pairs following the TUS protocol specification. Values are Base-64 encoded.\nSupported keys: `name`, `requiresignedurls`, `allowedorigins`, `thumbnailtimestamppct`, `watermark`, `scheduleddeletion`, `maxdurationseconds`."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const J={command:`create`,describe:"Initiates a video upload using the TUS protocol. On success, the server responds with a status code 201 (created) and includes a `location` header to indicate where the content should be uploaded. Refer to https://tus.io for protocol details.",builder:q,handler:async c=>{let l={direct_user:c[`direct-user`]},u={};if(c[`tus-resumable`]!==void 0&&(u[`Tus-Resumable`]=String(c[`tus-resumable`])),c[`upload-creator`]!==void 0&&(u[`Upload-Creator`]=String(c[`upload-creator`])),c[`upload-length`]!==void 0&&(u[`Upload-Length`]=String(c[`upload-length`])),c[`upload-metadata`]!==void 0&&(u[`Upload-Metadata`]=String(c[`upload-metadata`])),c.dryRun){o({command:`cf stream create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/stream`,pathParams:{},query:l,bodyKind:`none`});return}let d=await i(c),f=c.local?e:await t();c.accountId=f,a(await s(`Creating`,async()=>r(d,`POST`,`/accounts/${f}/stream`,{query:l,headers:Object.keys(u).length>0?u:void 0})),{successLabel:`Created`})}};function Y(e){return e.positional(`identifier`,{type:`string`,description:`A Cloudflare-generated unique identifier for a media item.`,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 X={command:`delete <identifier>`,describe:`Deletes a video and its copies from Cloudflare Stream.`,builder:Y,handler:async r=>{if(r.dryRun){o({command:`cf stream delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/stream/${r.identifier==null?`<identifier>`:encodeURIComponent(String(r.identifier))}`,pathParams:{identifier:String(r.identifier??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await h({force:!!r.force})){process.stderr.write(`Aborted.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{t as e}from"./local-
|
|
2
|
+
import{t as e}from"./local-DGiIS1uM.mjs";import{f as t,g as n}from"./oauth-DAa7SwkM.mjs";import{r}from"./auth-DY_Y2bXC.mjs";import{t as i}from"./output-BqDR9h74.mjs";import{t as a}from"./dry-run-ILZRVpnp.mjs";import{t as o}from"./progress-jYW64HY7.mjs";function s(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const c={command:`create`,describe:`Return new URL submissions`,builder:s,handler:async s=>{if(s.dryRun){a({command:`cf submit create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/brand-protection/submit`,pathParams:{},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Creating`,async()=>c.submit.create({account_id:l})),{successLabel:`Created`})}},l={command:`submit`,describe:`submit`,builder:e=>e.command(c).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{l as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{t as e}from"./local-
|
|
2
|
+
import{t as e}from"./local-DGiIS1uM.mjs";import{f as t,g as n}from"./oauth-DAa7SwkM.mjs";import{r}from"./auth-DY_Y2bXC.mjs";import{t as i}from"./output-BqDR9h74.mjs";import{t as a}from"./dry-run-ILZRVpnp.mjs";import{t as o}from"./progress-jYW64HY7.mjs";import{t as s}from"./cli-types-C3nVfpSG.mjs";function c(e){return e.option(`type`,{type:`string`,description:`Filter by resource type. Can be repeated to filter by multiple types (OR logic). Example: ?type=zone&type=worker`}).option(`name`,{type:`string`,description:`Filter by resource name. Performs a case-insensitive substring match. Example: ?name=my-zone`}).option(`id`,{type:`string`,description:`Filter by resource ID. Can be repeated up to 50 times to filter by multiple IDs. Example: ?id=abc&id=def`}).option(`case-insensitive`,{type:`boolean`,description:"Match `tag` keys and values case-insensitively. Stored casing is unchanged. Example: ?tag=environment=production&case_insensitive=true"}).option(`tag`,{type:`string`,description:"Filter resources by tag criteria. This parameter can be repeated multiple times, with AND logic between parameters.\n\nSupported syntax:\n- **Key-only**: `tag=<key>` - Resource must have the tag key (e.g., `tag=production`)\n- **Key-value**: `tag=<key>=<value>` - Resource must have the tag with specific value (e.g., `tag=env=prod`)\n- **Multiple values (OR)**: `tag=<key>=<v1>,<v2>` - Resource must have tag with any of the values (e.g., `tag=env=prod,staging`)\n- **Negate key-only**: `tag=!<key>` - Resource must not have the tag key (e.g., `tag=!archived`)\n- **Negate key-value**: `tag=<key>!=<value>` - Resource must not have the tag with specific value (e.g., `tag=region!=us-west-1`)\n\nMultiple tag parameters are combined with AND logic."}).option(`cursor`,{type:`string`,description:`Cursor for pagination.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const l={command:`list`,describe:`Lists all tagged resources for an account.`,builder:s(c),handler:async s=>{let c={type:s.type,name:s.name,id:s.id,case_insensitive:s[`case-insensitive`],tag:s.tag,cursor:s.cursor};if(s.dryRun){a({command:`cf tags resources list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/tags/resources`,pathParams:{},query:c,bodyKind:`none`});return}let l=await r(s),u=s.local?e:await t();s.accountId=u,i(await o(`Loading`,async()=>l.tags.resources.list({account_id:u,...c})),{successLabel:`Loaded`})}},u={command:`resources`,describe:`Operations for resources`,builder:e=>e.command(l).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},d={command:`tags`,describe:`tags`,builder:e=>e.command(u).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{d as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{r as e}from"./auth-
|
|
2
|
+
import{r as e}from"./auth-DY_Y2bXC.mjs";import{t}from"./output-BqDR9h74.mjs";import{t as n}from"./dry-run-ILZRVpnp.mjs";import{t as r}from"./progress-jYW64HY7.mjs";function i(e){return e.option(`tenant-id`,{type:`string`,description:`Tenant ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const a={command:`list`,describe:`List of account types available for the Tenant to provision accounts.`,builder:i,handler:async i=>{if(i.dryRun){n({command:`cf tenant account-type list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/tenants/${i[`tenant-id`]==null?`<tenant-id>`:encodeURIComponent(String(i[`tenant-id`]))}/account_types`,pathParams:{"tenant-id":String(i[`tenant-id`]??``)},bodyKind:`none`});return}let a=await e(i);t(await r(`Loading`,async()=>a.tenant.accountType.list({tenant_id:i[`tenant-id`]})),{successLabel:`Loaded`})}},o={command:`account-type`,describe:`Operations for account-type`,builder:e=>e.command(a).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function s(e){return e.option(`tenant-id`,{type:`string`,description:`Tenant ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const c={command:`list`,describe:`List of accounts for the Tenant.`,builder:s,handler:async i=>{if(i.dryRun){n({command:`cf tenant account list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/tenants/${i[`tenant-id`]==null?`<tenant-id>`:encodeURIComponent(String(i[`tenant-id`]))}/accounts`,pathParams:{"tenant-id":String(i[`tenant-id`]??``)},bodyKind:`none`});return}let a=await e(i);t(await r(`Loading`,async()=>a.tenant.account.list({tenant_id:i[`tenant-id`]})),{successLabel:`Loaded`})}},l={command:`account`,describe:`Operations for account`,builder:e=>e.command(c).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function u(e){return e.option(`tenant-id`,{type:`string`,description:`Tenant ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const d={command:`list`,describe:`List of innate entitlements available for the Tenant.`,builder:u,handler:async i=>{if(i.dryRun){n({command:`cf tenant entitlement list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/tenants/${i[`tenant-id`]==null?`<tenant-id>`:encodeURIComponent(String(i[`tenant-id`]))}/entitlements`,pathParams:{"tenant-id":String(i[`tenant-id`]??``)},bodyKind:`none`});return}let a=await e(i);t(await r(`Loading`,async()=>a.tenant.entitlement.list({tenant_id:i[`tenant-id`]})),{successLabel:`Loaded`})}},f={command:`entitlement`,describe:`Operations for entitlement`,builder:e=>e.command(d).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function p(e){return e.positional(`tenant-id`,{type:`string`,description:`Tenant ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const m={command:`get <tenant-id>`,describe:`Retrieves a Tenant by Tenant ID.`,builder:p,handler:async i=>{if(i.dryRun){n({command:`cf tenant get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/tenants/${i[`tenant-id`]==null?`<tenant-id>`:encodeURIComponent(String(i[`tenant-id`]))}`,pathParams:{"tenant-id":String(i[`tenant-id`]??``)},bodyKind:`none`});return}let a=await e(i);t(await r(`Loading`,async()=>a.tenant.get({tenant_id:i[`tenant-id`]})),{successLabel:`Loaded`})}};function h(e){return e.option(`tenant-id`,{type:`string`,description:`Tenant ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const g={command:`list`,describe:`List of active members (Cloudflare users) for the Tenant.`,builder:h,handler:async i=>{if(i.dryRun){n({command:`cf tenant membership list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/tenants/${i[`tenant-id`]==null?`<tenant-id>`:encodeURIComponent(String(i[`tenant-id`]))}/memberships`,pathParams:{"tenant-id":String(i[`tenant-id`]??``)},bodyKind:`none`});return}let a=await e(i);t(await r(`Loading`,async()=>a.tenant.membership.list({tenant_id:i[`tenant-id`]})),{successLabel:`Loaded`})}},_={command:`membership`,describe:`Operations for membership`,builder:e=>e.command(g).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},v={command:`tenant`,describe:`tenant`,builder:e=>e.command(m).command(l).command(o).command(f).command(_).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{v as default};
|
package/dist/{tenant-custom-nameservers-9G93XuvU.mjs → tenant-custom-nameservers-BvBQRDcs.mjs}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{r as e}from"./auth-
|
|
2
|
+
import{r as e}from"./auth-DY_Y2bXC.mjs";import{t}from"./output-BqDR9h74.mjs";import{t as n}from"./dry-run-ILZRVpnp.mjs";import{t as r}from"./progress-jYW64HY7.mjs";import{n as i,t as a}from"./body-parser-BGVbwPeM.mjs";import{n as o}from"./input-validation-1esLElok.mjs";import{a as s,n as c}from"./prompt-CyATfGUu.mjs";function l(e){return e.positional(`tenant-tag`,{type:`string`,description:`Tenant identifier tag.`,demandOption:!0}).option(`ns-name`,{type:`string`,description:`The FQDN of the name server.`}).option(`ns-set`,{type:`number`,description:`The number of the set that this name server belongs to.`,default:1}).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 u={command:`create <tenant-tag>`,describe:`Adds a custom nameserver for a tenant.`,builder:l,handler:async c=>{if(c.dryRun){n({command:`cf tenant-custom-nameservers create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/tenants/${c[`tenant-tag`]==null?`<tenant-tag>`:encodeURIComponent(String(c[`tenant-tag`]))}/custom_ns`,pathParams:{"tenant-tag":String(c[`tenant-tag`]??``)},bodyKind:`json`,body:c.body===void 0?a({ns_name:o(c[`ns-name`],`ns-name`,`text`),ns_set:c[`ns-set`]}):i(c.body)});return}let l=await e(c);if(c.body){let e=i(c.body);t(await r(`Creating`,async()=>l.tenantCustomNameservers.create({body:e,tenant_tag:c[`tenant-tag`]})),{successLabel:`Created`});return}c[`ns-name`]===void 0&&(c[`ns-name`]=await s(`ns-name`,`The FQDN of the name server.`));let u=a({ns_name:o(c[`ns-name`],`ns-name`,`text`),ns_set:c[`ns-set`]});t(await r(`Creating`,async()=>l.tenantCustomNameservers.create({body:u,tenant_tag:c[`tenant-tag`]})),{successLabel:`Created`})}};function d(e){return e.positional(`custom-ns-id`,{type:`string`,description:`The FQDN of the name server.`,demandOption:!0}).option(`tenant-tag`,{type:`string`,description:`Tenant identifier tag.`,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 f={command:`delete <custom-ns-id>`,describe:`Deletes a tenant's custom nameserver.`,builder:d,handler:async i=>{if(i.dryRun){n({command:`cf tenant-custom-nameservers delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/tenants/${i[`tenant-tag`]==null?`<tenant-tag>`:encodeURIComponent(String(i[`tenant-tag`]))}/custom_ns/${i[`custom-ns-id`]==null?`<custom-ns-id>`:encodeURIComponent(String(i[`custom-ns-id`]))}`,pathParams:{"custom-ns-id":String(i[`custom-ns-id`]??``),"tenant-tag":String(i[`tenant-tag`]??``)},bodyKind:`none`});return}let a=await e(i);if(!await c({force:!!i.force})){process.stderr.write(`Aborted.
|
|
3
3
|
`);return}t(await r(`Deleting`,async()=>a.tenantCustomNameservers.delete({tenant_tag:i[`tenant-tag`],custom_ns_id:i[`custom-ns-id`]})),{successLabel:`Deleted`})}};function p(e){return e.positional(`tenant-tag`,{type:`string`,description:`Tenant identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const m={command:`get <tenant-tag>`,describe:`Lists a tenant's custom nameservers.`,builder:p,handler:async i=>{if(i.dryRun){n({command:`cf tenant-custom-nameservers get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/tenants/${i[`tenant-tag`]==null?`<tenant-tag>`:encodeURIComponent(String(i[`tenant-tag`]))}/custom_ns`,pathParams:{"tenant-tag":String(i[`tenant-tag`]??``)},bodyKind:`none`});return}let a=await e(i);t(await r(`Loading`,async()=>a.tenantCustomNameservers.get({tenant_tag:i[`tenant-tag`]})),{successLabel:`Loaded`})}},h={command:`tenant-custom-nameservers`,describe:`tenant-custom-nameservers`,builder:e=>e.command(u).command(f).command(m).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{h as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{t as e}from"./output-
|
|
2
|
+
import{t as e}from"./output-BqDR9h74.mjs";import{n as t,t as n}from"./metadata-DEqBUaSv.mjs";function r(e){return e.replace(/[\s-]+/g,`_`)}function i(e){let t={type:e.type,description:e.description};return`default`in e&&e.default!==void 0&&(t.default=e.default),e.enum&&e.enum.length>0&&(t.enum=e.enum),t}function a(e){let t={},n=[];for(let r of e.arguments)t[r.name]=i(r),r.required&&n.push(r.name);for(let r of e.options)t[r.name]=i(r),r.required&&n.push(r.name);return{name:r(e.command),description:e.description,inputSchema:{type:`object`,properties:t,required:n}}}const o={command:`tools`,describe:!1,builder:e=>e,handler:async r=>{let i=t(import.meta.url,`commands.json`,n)?.commands??null;if(i===null){console.error(`Warning: Command metadata file not found. Run the build to generate it.`),e({version:`1.0`,tools:[]});return}e({version:`1.0`,tools:i.map(a)})}};export{o as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{t as e}from"./local-
|
|
2
|
+
import{t as e}from"./local-DGiIS1uM.mjs";import{f as t,g as n}from"./oauth-DAa7SwkM.mjs";import{r}from"./auth-DY_Y2bXC.mjs";import{t as i}from"./output-BqDR9h74.mjs";import{t as a}from"./dry-run-ILZRVpnp.mjs";import{t as o}from"./progress-jYW64HY7.mjs";import{n as s,t as c}from"./body-parser-BGVbwPeM.mjs";import{n as l}from"./input-validation-1esLElok.mjs";import{a as u,n as d}from"./prompt-CyATfGUu.mjs";import{t as f}from"./cli-types-C3nVfpSG.mjs";function p(e){return e.positional(`tunnel-id`,{type:`string`,description:`UUID of the tunnel.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const m={command:`get <tunnel-id>`,describe:`Retrieves the configuration for a remotely managed Cloudflare Tunnel.`,builder:p,handler:async s=>{if(s.dryRun){a({command:`cf tunnel config get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cfd_tunnel/${s[`tunnel-id`]==null?`<tunnel-id>`:encodeURIComponent(String(s[`tunnel-id`]))}/configurations`,pathParams:{"tunnel-id":String(s[`tunnel-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.tunnel.config.get({account_id:l,tunnel_id:s[`tunnel-id`]})),{successLabel:`Loaded`})}};function h(e){return e.positional(`tunnel-id`,{type:`string`,description:`UUID of the tunnel.`,demandOption:!0}).option(`config-origin-request-access-aud-tag`,{type:`string`,array:!0,description:`Access applications that are allowed to reach this hostname for this Tunnel. Audience tags can be identified in the dashboard or via the List Access policies API.`}).option(`config-origin-request-access-required`,{type:`boolean`,description:`Deny traffic that has not fulfilled Access authorization.`}).option(`config-origin-request-access-team-name`,{type:`string`,description:`The config.originRequest.access.teamName field`}).option(`config-origin-request-ca-pool`,{type:`string`,description:`Path to the certificate authority (CA) for the certificate of your origin. This option should be used only if your certificate is not signed by Cloudflare.`}).option(`config-origin-request-connect-timeout`,{type:`number`,description:`Timeout for establishing a new TCP connection to your origin server. This excludes the time taken to establish TLS, which is controlled by tlsTimeout.`}).option(`config-origin-request-disable-chunked-encoding`,{type:`boolean`,description:`Disables chunked transfer encoding. Useful if you are running a WSGI server.`}).option(`config-origin-request-http2origin`,{type:`boolean`,description:`Attempt to connect to origin using HTTP2. Origin must be configured as https.`}).option(`config-origin-request-http-host-header`,{type:`string`,description:`Sets the HTTP Host header on requests sent to the local service.`}).option(`config-origin-request-keep-alive-connections`,{type:`number`,description:`Maximum number of idle keepalive connections between Tunnel and your origin. This does not restrict the total number of concurrent connections.`}).option(`config-origin-request-keep-alive-timeout`,{type:`number`,description:`Timeout after which an idle keepalive connection can be discarded.`}).option(`config-origin-request-match-snito-host`,{type:`boolean`,description:`Auto configure the Hostname on the origin server certificate.`}).option(`config-origin-request-no-happy-eyeballs`,{type:`boolean`,description:`Disable the “happy eyeballs” algorithm for IPv4/IPv6 fallback if your local network has misconfigured one of the protocols.`}).option(`config-origin-request-no-tlsverify`,{type:`boolean`,description:`Disables TLS verification of the certificate presented by your origin. Will allow any certificate from the origin to be accepted.`}).option(`config-origin-request-origin-server-name`,{type:`string`,description:`Hostname that cloudflared should expect from your origin server certificate.`}).option(`config-origin-request-proxy-type`,{type:`string`,description:`cloudflared starts a proxy server to translate HTTP traffic into TCP when proxying, for example, SSH or RDP. This configures what type of proxy will be started. Valid options are: "" for the regular proxy and "socks" for a SOCKS5 proxy.
|
|
3
3
|
`}).option(`config-origin-request-tcp-keep-alive`,{type:`number`,description:`The timeout after which a TCP keepalive packet is sent on a connection between Tunnel and the origin server.`}).option(`config-origin-request-tls-timeout`,{type:`number`,description:`Timeout for completing a TLS handshake to your origin server, if you have chosen to connect Tunnel to an HTTPS server.`}).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([`config-origin-request-access-aud-tag`,`config-origin-request-access-required`,`config-origin-request-access-team-name`,`config-origin-request-ca-pool`,`config-origin-request-connect-timeout`,`config-origin-request-disable-chunked-encoding`,`config-origin-request-http2origin`,`config-origin-request-http-host-header`,`config-origin-request-keep-alive-connections`,`config-origin-request-keep-alive-timeout`,`config-origin-request-match-snito-host`,`config-origin-request-no-happy-eyeballs`,`config-origin-request-no-tlsverify`,`config-origin-request-origin-server-name`,`config-origin-request-proxy-type`,`config-origin-request-tcp-keep-alive`,`config-origin-request-tls-timeout`].some(t=>e[t]!==void 0)){let t=[`config-origin-request-access-aud-tag`,`config-origin-request-access-team-name`].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 --config-* flag is set`)}return!0})}const g={command:`update <tunnel-id>`,describe:`Replaces the configuration for a remotely managed Cloudflare Tunnel, including its ingress rules and origin request settings.`,builder:h,handler:async u=>{if(u.dryRun){a({command:`cf tunnel config update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cfd_tunnel/${u[`tunnel-id`]==null?`<tunnel-id>`:encodeURIComponent(String(u[`tunnel-id`]))}/configurations`,pathParams:{"tunnel-id":String(u[`tunnel-id`]??``)},bodyKind:`json`,body:u.body===void 0?c({config:{originRequest:{access:{audTag:u[`config-origin-request-access-aud-tag`],required:u[`config-origin-request-access-required`],teamName:l(u[`config-origin-request-access-team-name`],`config-origin-request-access-team-name`,`text`)},caPool:l(u[`config-origin-request-ca-pool`],`config-origin-request-ca-pool`,`text`),connectTimeout:u[`config-origin-request-connect-timeout`],disableChunkedEncoding:u[`config-origin-request-disable-chunked-encoding`],http2Origin:u[`config-origin-request-http2origin`],httpHostHeader:l(u[`config-origin-request-http-host-header`],`config-origin-request-http-host-header`,`text`),keepAliveConnections:u[`config-origin-request-keep-alive-connections`],keepAliveTimeout:u[`config-origin-request-keep-alive-timeout`],matchSNItoHost:u[`config-origin-request-match-snito-host`],noHappyEyeballs:u[`config-origin-request-no-happy-eyeballs`],noTLSVerify:u[`config-origin-request-no-tlsverify`],originServerName:l(u[`config-origin-request-origin-server-name`],`config-origin-request-origin-server-name`,`text`),proxyType:l(u[`config-origin-request-proxy-type`],`config-origin-request-proxy-type`,`text`),tcpKeepAlive:u[`config-origin-request-tcp-keep-alive`],tlsTimeout:u[`config-origin-request-tls-timeout`]}}}):s(u.body)});return}let d=await r(u),f=u.local?e:await t();if(u.accountId=f,u.body){let e=s(u.body);i(await o(`Updating`,async()=>d.tunnel.config.update({...e,account_id:f,tunnel_id:u[`tunnel-id`]})),{successLabel:`Updated`});return}let p=c({config:{originRequest:{access:{audTag:u[`config-origin-request-access-aud-tag`],required:u[`config-origin-request-access-required`],teamName:l(u[`config-origin-request-access-team-name`],`config-origin-request-access-team-name`,`text`)},caPool:l(u[`config-origin-request-ca-pool`],`config-origin-request-ca-pool`,`text`),connectTimeout:u[`config-origin-request-connect-timeout`],disableChunkedEncoding:u[`config-origin-request-disable-chunked-encoding`],http2Origin:u[`config-origin-request-http2origin`],httpHostHeader:l(u[`config-origin-request-http-host-header`],`config-origin-request-http-host-header`,`text`),keepAliveConnections:u[`config-origin-request-keep-alive-connections`],keepAliveTimeout:u[`config-origin-request-keep-alive-timeout`],matchSNItoHost:u[`config-origin-request-match-snito-host`],noHappyEyeballs:u[`config-origin-request-no-happy-eyeballs`],noTLSVerify:u[`config-origin-request-no-tlsverify`],originServerName:l(u[`config-origin-request-origin-server-name`],`config-origin-request-origin-server-name`,`text`),proxyType:l(u[`config-origin-request-proxy-type`],`config-origin-request-proxy-type`,`text`),tcpKeepAlive:u[`config-origin-request-tcp-keep-alive`],tlsTimeout:u[`config-origin-request-tls-timeout`]}}});i(await o(`Updating`,async()=>d.tunnel.config.update({...p,account_id:f,tunnel_id:u[`tunnel-id`]})),{successLabel:`Updated`})}},_={command:`config`,describe:`Operations for config`,builder:e=>e.command(m).command(g).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function v(e){return e.positional(`tunnel-id`,{type:`string`,description:`UUID of the tunnel.`,demandOption:!0}).option(`client-id`,{type:`string`,description:`UUID of the Cloudflare Tunnel connector.`}).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 y={command:`cleanup <tunnel-id>`,describe:`Removes a connection (aka Cloudflare Tunnel Connector) from a Cloudflare Tunnel independently of its current state. If no connector id (client_id) is provided all connectors will be removed. We recommend running this command after rotating tokens.`,builder:v,handler:async s=>{let c={client_id:s[`client-id`]};if(s.dryRun){a({command:`cf tunnel connections cleanup`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cfd_tunnel/${s[`tunnel-id`]==null?`<tunnel-id>`:encodeURIComponent(String(s[`tunnel-id`]))}/connections`,pathParams:{"tunnel-id":String(s[`tunnel-id`]??``)},query:c,bodyKind:`none`});return}let l=await r(s),u=s.local?e:await t();if(s.accountId=u,!await d({force:!!s.force,message:`This operation removes Cloudflare Tunnel connections.`})){process.stderr.write(`Aborted.
|
|
4
4
|
`);return}i(await o(`Deleting`,async()=>l.tunnel.connections.cleanup({account_id:u,tunnel_id:s[`tunnel-id`],...c})),{successLabel:`Deleted`})}};function b(e){return e.option(`tunnel-id`,{type:`string`,description:`UUID of the tunnel.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const x={command:`list`,describe:`Lists the connections for a Cloudflare Tunnel, including connector IDs, cloudflared versions, and Cloudflare locations.`,builder:b,handler:async s=>{if(s.dryRun){a({command:`cf tunnel connections list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cfd_tunnel/${s[`tunnel-id`]==null?`<tunnel-id>`:encodeURIComponent(String(s[`tunnel-id`]))}/connections`,pathParams:{"tunnel-id":String(s[`tunnel-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.tunnel.connections.list({account_id:l,tunnel_id:s[`tunnel-id`]})),{successLabel:`Loaded`})}},S={command:`connections`,describe:`Operations for connections`,builder:e=>e.command(y).command(x).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function C(e){return e.positional(`connector-id`,{type:`string`,description:`UUID of the Cloudflare Tunnel connector.`,demandOption:!0}).option(`tunnel-id`,{type:`string`,description:`UUID of the tunnel.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const w={command:`get <connector-id>`,describe:`Retrieves a connector and its connection details for a Cloudflare Tunnel, including its cloudflared version, architecture, and connected Cloudflare locations.`,builder:C,handler:async s=>{if(s.dryRun){a({command:`cf tunnel connectors get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cfd_tunnel/${s[`tunnel-id`]==null?`<tunnel-id>`:encodeURIComponent(String(s[`tunnel-id`]))}/connectors/${s[`connector-id`]==null?`<connector-id>`:encodeURIComponent(String(s[`connector-id`]))}`,pathParams:{"tunnel-id":String(s[`tunnel-id`]??``),"connector-id":String(s[`connector-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.tunnel.connectors.get({account_id:l,tunnel_id:s[`tunnel-id`],connector_id:s[`connector-id`]})),{successLabel:`Loaded`})}},T={command:`connectors`,describe:`Operations for connectors`,builder:e=>e.command(w).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function E(e){return e.option(`config-source`,{type:`string`,description:"Indicates if this is a locally or remotely configured tunnel. If `local`, manage the tunnel using a YAML file on the origin machine. If `cloudflare`, manage the tunnel on the Zero Trust dashboard.",choices:[`local`,`cloudflare`],default:`local`}).option(`name`,{type:`string`,description:`A user-friendly name for a tunnel.`}).option(`tunnel-secret`,{type:`string`,description:`Sets the password required to run a locally-managed tunnel. Must be at least 32 bytes and encoded as a base64 string.`}).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:`Creates a remotely or locally managed Cloudflare Tunnel in an account. After creation, retrieve its token and run cloudflared to establish the connector connection.`,builder:E,handler:async d=>{if(d.dryRun){a({command:`cf tunnel create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cfd_tunnel`,pathParams:{},bodyKind:`json`,body:d.body===void 0?c({config_src:l(d[`config-source`],`config-source`,`text`),name:l(d.name,`name`,`text`),tunnel_secret:l(d[`tunnel-secret`],`tunnel-secret`,`text`)}):s(d.body)});return}let f=await r(d),p=d.local?e:await t();if(d.accountId=p,d.body){let e=s(d.body);i(await o(`Creating`,async()=>f.tunnel.create({...e,account_id:p})),{successLabel:`Created`});return}d.name===void 0&&(d.name=await u(`name`,`A user-friendly name for a tunnel.`));let m=c({config_src:l(d[`config-source`],`config-source`,`text`),name:l(d.name,`name`,`text`),tunnel_secret:l(d[`tunnel-secret`],`tunnel-secret`,`text`)});i(await o(`Creating`,async()=>f.tunnel.create({...m,account_id:p})),{successLabel:`Created`})}};function O(e){return e.positional(`tunnel-id`,{type:`string`,description:`UUID of the tunnel.`,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 k={command:`delete <tunnel-id>`,describe:`Permanently deletes a Cloudflare Tunnel from an account. The tunnel must have no active connections.`,builder:O,handler:async s=>{if(s.dryRun){a({command:`cf tunnel delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cfd_tunnel/${s[`tunnel-id`]==null?`<tunnel-id>`:encodeURIComponent(String(s[`tunnel-id`]))}`,pathParams:{"tunnel-id":String(s[`tunnel-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();if(s.accountId=l,!await d({force:!!s.force,message:`This operation permanently deletes a Cloudflare Tunnel.`})){process.stderr.write(`Aborted.
|
|
5
5
|
`);return}i(await o(`Deleting`,async()=>c.tunnel.delete({account_id:l,tunnel_id:s[`tunnel-id`]})),{successLabel:`Deleted`})}};function A(e){return e.positional(`tunnel-id`,{type:`string`,description:`UUID of the tunnel.`,demandOption:!0}).option(`name`,{type:`string`,description:`A user-friendly name for a tunnel.`}).option(`tunnel-secret`,{type:`string`,description:`Sets the password required to run a locally-managed tunnel. Must be at least 32 bytes and encoded as a base64 string.`}).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 j={command:`edit <tunnel-id>`,describe:`Updates the name or secret of an existing Cloudflare Tunnel.`,builder:A,handler:async u=>{if(u.dryRun){a({command:`cf tunnel edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cfd_tunnel/${u[`tunnel-id`]==null?`<tunnel-id>`:encodeURIComponent(String(u[`tunnel-id`]))}`,pathParams:{"tunnel-id":String(u[`tunnel-id`]??``)},bodyKind:`json`,body:u.body===void 0?c({name:l(u.name,`name`,`text`),tunnel_secret:l(u[`tunnel-secret`],`tunnel-secret`,`text`)}):s(u.body)});return}let d=await r(u),f=u.local?e:await t();if(u.accountId=f,u.body){let e=s(u.body);i(await o(`Updating`,async()=>d.tunnel.edit({...e,account_id:f,tunnel_id:u[`tunnel-id`]})),{successLabel:`Updated`});return}let p=c({name:l(u.name,`name`,`text`),tunnel_secret:l(u[`tunnel-secret`],`tunnel-secret`,`text`)});i(await o(`Updating`,async()=>d.tunnel.edit({...p,account_id:f,tunnel_id:u[`tunnel-id`]})),{successLabel:`Updated`})}};function M(e){return e.positional(`tunnel-id`,{type:`string`,description:`UUID of the tunnel.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const N={command:`get <tunnel-id>`,describe:`Fetches a single Cloudflare Tunnel.`,builder:M,handler:async s=>{if(s.dryRun){a({command:`cf tunnel get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cfd_tunnel/${s[`tunnel-id`]==null?`<tunnel-id>`:encodeURIComponent(String(s[`tunnel-id`]))}`,pathParams:{"tunnel-id":String(s[`tunnel-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.tunnel.get({account_id:l,tunnel_id:s[`tunnel-id`]})),{successLabel:`Loaded`})}};function P(e){return e.option(`name`,{type:`string`,description:`A user-friendly name for a tunnel.`}).option(`is-deleted`,{type:`boolean`,description:"If `true`, only include deleted tunnels. If `false`, exclude deleted tunnels. If empty, all tunnels will be included."}).option(`existed-at`,{type:`string`,description:`If provided, include only resources that were created (and not deleted) before this time. URL encoded.`}).option(`uuid`,{type:`string`,description:`UUID of the tunnel.`}).option(`was-active-at`,{type:`string`,description:`Was active at`}).option(`was-inactive-at`,{type:`string`,description:`Was inactive at`}).option(`include-prefix`,{type:`string`,description:`Include prefix`}).option(`exclude-prefix`,{type:`string`,description:`Exclude prefix`}).option(`status`,{type:`string`,description:"The status of the tunnel. Valid values are `inactive` (tunnel has never been run), `degraded` (tunnel is active and able to serve traffic but in an unhealthy state), `healthy` (tunnel is active and able to serve traffic), or `down` (tunnel can not serve traffic as it has no connections to the Cloudflare Edge).",choices:[`inactive`,`degraded`,`healthy`,`down`]}).option(`per-page`,{type:`number`,description:`Number of results to display.`}).option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const F={command:`list`,describe:`Lists and filters Cloudflare Tunnels in an account.`,builder:f(P),handler:async s=>{let c={name:s.name,is_deleted:s[`is-deleted`],existed_at:s[`existed-at`],uuid:s.uuid,was_active_at:s[`was-active-at`],was_inactive_at:s[`was-inactive-at`],include_prefix:s[`include-prefix`],exclude_prefix:s[`exclude-prefix`],status:s.status,per_page:s[`per-page`],page:s.page};if(s.dryRun){a({command:`cf tunnel list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cfd_tunnel`,pathParams:{},query:c,bodyKind:`none`});return}let l=await r(s),u=s.local?e:await t();s.accountId=u,i(await o(`Loading`,async()=>l.tunnel.list({account_id:u,...c})),{successLabel:`Loaded`})}};function I(e){return e.positional(`tunnel-id`,{type:`string`,description:`UUID of the tunnel.`,demandOption:!0}).option(`resources`,{type:`string`,array:!0,description:`The resources field`}).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 L={command:`create <tunnel-id>`,describe:`Creates a short-lived management token for the requested Tunnel management resources, such as streaming logs. Treat the token as a secret.`,builder:I,handler:async l=>{if(l.dryRun){a({command:`cf tunnel management token create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cfd_tunnel/${l[`tunnel-id`]==null?`<tunnel-id>`:encodeURIComponent(String(l[`tunnel-id`]))}/management`,pathParams:{"tunnel-id":String(l[`tunnel-id`]??``)},bodyKind:`json`,body:l.body===void 0?c({resources:l.resources}):s(l.body)});return}let u=await r(l),d=l.local?e:await t();if(l.accountId=d,l.body){let e=s(l.body);i(await o(`Creating`,async()=>u.tunnel.management.token.create({...e,account_id:d,tunnel_id:l[`tunnel-id`]})),{successLabel:`Created`});return}if(l.resources===void 0)throw Error(`--resources is required (or pass --body with this field set).`);let f=c({resources:l.resources});i(await o(`Creating`,async()=>u.tunnel.management.token.create({...f,account_id:d,tunnel_id:l[`tunnel-id`]})),{successLabel:`Created`})}},R={command:`token`,describe:`Operations for management.token`,builder:e=>e.command(L).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},z={command:`management`,describe:`Operations for management`,builder:e=>e.command(R).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function B(e){return e.positional(`tunnel-id`,{type:`string`,description:`UUID of the tunnel.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const V={command:`get <tunnel-id>`,describe:`Retrieves the token used to run cloudflared and associate it with a specific Cloudflare Tunnel. Treat the token as a secret.`,builder:B,handler:async s=>{if(s.dryRun){a({command:`cf tunnel token get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/cfd_tunnel/${s[`tunnel-id`]==null?`<tunnel-id>`:encodeURIComponent(String(s[`tunnel-id`]))}/token`,pathParams:{"tunnel-id":String(s[`tunnel-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.tunnel.token.get({account_id:l,tunnel_id:s[`tunnel-id`]})),{successLabel:`Loaded`})}},H={command:`token`,describe:`Operations for token`,builder:e=>e.command(V).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},U={command:`tunnel`,describe:`tunnel`,builder:e=>e.command(D).command(k).command(j).command(N).command(F).command(_).command(S).command(T).command(z).command(H).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{U as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{t as e}from"./local-
|
|
2
|
+
import{t as e}from"./local-DGiIS1uM.mjs";import{f as t,g as n}from"./oauth-DAa7SwkM.mjs";import{r}from"./auth-DY_Y2bXC.mjs";import{t as i}from"./output-BqDR9h74.mjs";import{t as a}from"./dry-run-ILZRVpnp.mjs";import{t as o}from"./progress-jYW64HY7.mjs";import{t as s}from"./cli-types-C3nVfpSG.mjs";function c(e){return e.option(`name`,{type:`string`,description:`A user-friendly name for the tunnel.`}).option(`is-deleted`,{type:`boolean`,description:"If `true`, only include deleted tunnels. If `false`, exclude deleted tunnels. If empty, all tunnels will be included."}).option(`existed-at`,{type:`string`,description:`If provided, include only resources that were created (and not deleted) before this time. URL encoded.`}).option(`uuid`,{type:`string`,description:`UUID of the tunnel.`}).option(`was-active-at`,{type:`string`,description:`Was active at`}).option(`was-inactive-at`,{type:`string`,description:`Was inactive at`}).option(`include-prefix`,{type:`string`,description:`Include prefix`}).option(`exclude-prefix`,{type:`string`,description:`Exclude prefix`}).option(`tun-types`,{type:`string`,description:`The types of tunnels to filter by, separated by commas.`}).option(`status`,{type:`string`,description:"The status of the tunnel. Valid values are `inactive` (tunnel has never been run), `degraded` (tunnel is active and able to serve traffic but in an unhealthy state), `healthy` (tunnel is active and able to serve traffic), or `down` (tunnel can not serve traffic as it has no connections to the Cloudflare Edge).",choices:[`inactive`,`degraded`,`healthy`,`down`]}).option(`per-page`,{type:`number`,description:`Number of results to display.`}).option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const l={command:`list`,describe:`Lists and filters all types of Tunnels in an account.`,builder:s(c),handler:async s=>{let c={name:s.name,is_deleted:s[`is-deleted`],existed_at:s[`existed-at`],uuid:s.uuid,was_active_at:s[`was-active-at`],was_inactive_at:s[`was-inactive-at`],include_prefix:s[`include-prefix`],exclude_prefix:s[`exclude-prefix`],tun_types:s[`tun-types`],status:s.status,per_page:s[`per-page`],page:s.page};if(s.dryRun){a({command:`cf tunnels list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/tunnels`,pathParams:{},query:c,bodyKind:`none`});return}let l=await r(s),u=s.local?e:await t();s.accountId=u,i(await o(`Loading`,async()=>l.tunnels.list({account_id:u,...c})),{successLabel:`Loaded`})}},u={command:`tunnels`,describe:`tunnels`,builder:e=>e.command(l).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{u as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{t as e}from"./local-
|
|
2
|
+
import{t as e}from"./local-DGiIS1uM.mjs";import{f as t,g as n}from"./oauth-DAa7SwkM.mjs";import{r}from"./auth-DY_Y2bXC.mjs";import{t as i}from"./output-BqDR9h74.mjs";import{t as a}from"./dry-run-ILZRVpnp.mjs";import{t as o}from"./progress-jYW64HY7.mjs";import{n as s,t as c}from"./body-parser-BGVbwPeM.mjs";import{n as l}from"./input-validation-1esLElok.mjs";import{a as u,n as d}from"./prompt-CyATfGUu.mjs";import{t as f}from"./cli-types-C3nVfpSG.mjs";function p(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Number of items per page.`}).option(`order`,{type:`string`,description:`Field to order widgets by.`,choices:[`id`,`sitekey`,`name`,`created_on`,`modified_on`]}).option(`direction`,{type:`string`,description:`Direction to order widgets.`,choices:[`asc`,`desc`]}).option(`filter`,{type:`string`,description:"Filter widgets by field using case-insensitive substring matching.\nFormat: `field:value`\n\nSupported fields:\n- `name` - Filter by widget name (e.g., `filter=name:login-form`)\n- `sitekey` - Filter by sitekey (e.g., `filter=sitekey:0x4AAA`)\n\nReturns 400 Bad Request if the field is unsupported or format is invalid.\nAn empty filter value returns all results."}).option(`bot-fight-mode`,{type:`boolean`,description:`If bot_fight_mode is set to \`true\`, Cloudflare issues computationally
|
|
3
3
|
expensive challenges in response to malicious bots (ENT only).
|
|
4
4
|
`}).option(`clearance-level`,{type:`string`,description:`If Turnstile is embedded on a Cloudflare site and the widget should grant challenge clearance,
|
|
5
5
|
this setting can determine the clearance level to be set
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import"./project-settings-
|
|
2
|
+
import"./project-settings-BN7tL0c7.mjs";import{i as e,n as t,t as n}from"./theme-CrIBazAF.mjs";const r={bar:`│`,top:`┌`,bottom:`└`};function i(e,i,o){let s=o?.title??`Error`,c=t(),l=n.error,u=c.hex(l)(r.bar),d=c.hex(l)(r.top),f=c.hex(l)(r.bottom),p=Math.max(20,(process.stdout.columns||80)-2),m=[];if(m.push(``),m.push(`${d} ${c.hex(l).bold(s)}`),o?.rawMessage)for(let t of e.split(`
|
|
3
3
|
`))m.push(t.length>0?`${u} ${t}`:u);else for(let t of a(e,p))m.push(t.length>0?`${u} ${c.hex(l).bold(t)}`:u);if(i){m.push(u);for(let e of a(i,p))m.push(e.length>0?`${u} ${c.dim(e)}`:u)}return m.push(f),m.join(`
|
|
4
4
|
`)}function a(e,t){let n=[];for(let r of e.split(`
|
|
5
5
|
`)){if(r.length<=t){n.push(r);continue}let e=r.split(/\s+/),i=``;for(let r of e){if(!i){i=r;continue}i.length+1+r.length<=t?i+=` `+r:(n.push(i),i=r)}i&&n.push(i)}return n}function o(r){return`${t().hex(n.warning)(e.warning)} ${r}`}function s(r){return`${t().hex(n.info)(e.info)} ${r}`}function c(r){let i=t().hex(n.muted);return`${i(e.arrow)} ${i(r)}`}export{i,s as n,o as r,c as t};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{t as e}from"./local-
|
|
2
|
+
import{t as e}from"./local-DGiIS1uM.mjs";import{f as t,g as n}from"./oauth-DAa7SwkM.mjs";import{r}from"./auth-DY_Y2bXC.mjs";import{t as i}from"./output-BqDR9h74.mjs";import{t as a}from"./dry-run-ILZRVpnp.mjs";import{t as o}from"./progress-jYW64HY7.mjs";function s(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const c={command:`get`,describe:`Return submitted URLs based on ID`,builder:s,handler:async s=>{if(s.dryRun){a({command:`cf url-info get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/brand-protection/url-info`,pathParams:{},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.urlInfo.get({account_id:l})),{successLabel:`Loaded`})}},l={command:`url-info`,describe:`url-info`,builder:e=>e.command(c).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{l as default};
|