cf 0.4.0 → 0.6.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/README.md +7 -1
- package/dist/{abuse-reports-Dy76QPNP.mjs → abuse-reports-DUs4SKVx.mjs} +2 -2
- package/dist/accounts-BIY8wNGA.mjs +22 -0
- package/dist/{acm-C2lYIWs1.mjs → acm-SqcV8o5o.mjs} +2 -2
- package/dist/addressing-CygRm0pN.mjs +12 -0
- package/dist/{agent-context-CgGCT0xU.mjs → agent-context-CKb6w43K.mjs} +1 -1
- package/dist/ai-BAmEAjN3.mjs +2 -0
- package/dist/ai-gateway-BENwPvvB.mjs +8 -0
- package/dist/ai-search-Bv_Whw3E.mjs +7 -0
- package/dist/ai_gateway-C6WP9oBH.mjs +4 -0
- package/dist/alerting-D_qWrsoY.mjs +6 -0
- package/dist/{analytics-CkhhhZWZ.mjs → analytics-CwFrx-Dr.mjs} +1 -1
- package/dist/analytics_engine-BjV6XLyG.mjs +2 -0
- package/dist/api-gateway-D9PMVVqL.mjs +33 -0
- package/dist/argo-DwYGbyld.mjs +2 -0
- package/dist/artifacts-DKAjY_n4.mjs +4 -0
- package/dist/audit-logs-BvQ9uwuy.mjs +2 -0
- package/dist/auth-DX9KnJ0P.mjs +9 -0
- package/dist/auth-TYwGydWg.mjs +5 -0
- package/dist/billing-CRTlRU88.mjs +2 -0
- package/dist/{bot-management-CJxD1pqi.mjs → bot-management-DgW--8wM.mjs} +2 -2
- package/dist/botnet-feed-CIX6ZORT.mjs +3 -0
- package/dist/brand-protection-ZikBtl0y.mjs +3 -0
- package/dist/browser-rendering-D_ZQVWn8.mjs +4 -0
- package/dist/build-Bgw8TV1p.mjs +134 -0
- package/dist/{cache-B7pRbpTy.mjs → cache-CeN5t6_W.mjs} +4 -4
- package/dist/calls-Cv0ieVg4.mjs +4 -0
- package/dist/certificate-authorities-BzZnWCac.mjs +2 -0
- package/dist/client-certificates-BFuzeBrj.mjs +3 -0
- package/dist/cloud-connector-D5h8Dzzg.mjs +2 -0
- package/dist/cloudforce-one-aqDCIBMp.mjs +21 -0
- package/dist/{completions-D_9WsLG7.mjs → completions-Bvzav4Mj.mjs} +2 -2
- package/dist/{config-7CBz8Xm0.mjs → config-B5k-XbwS.mjs} +1 -1
- package/dist/connectivity-CjkXmEhO.mjs +3 -0
- package/dist/connector-interrupts-B7eSface.mjs +2 -0
- package/dist/connector-telemetry-events-F3Co8HUf.mjs +2 -0
- package/dist/connector-telemetry-snapshots-CQY8XMUg.mjs +2 -0
- package/dist/connectors-YYu_Vx3H.mjs +3 -0
- package/dist/content-scanning-BorfRGKT.mjs +4 -0
- package/dist/context-C-WbewL6.mjs +2 -0
- package/dist/{custom-certificates-CnYh6Yi-.mjs → custom-certificates-CfRj7QZb.mjs} +4 -4
- package/dist/{custom-hostnames-C2upqZso.mjs → custom-hostnames-CcK7_17e.mjs} +4 -4
- package/dist/custom-nameservers-BkKx0THn.mjs +3 -0
- package/dist/custom-pages-DamGVA75.mjs +4 -0
- package/dist/d1-sK0O5THv.mjs +4 -0
- package/dist/data-security-DsWpoWiS.mjs +6 -0
- package/dist/dcv-delegation-BYsNl3qc.mjs +2 -0
- package/dist/{deploy-KBRFIatG.mjs → deploy-BzlPv3ro.mjs} +1 -1
- package/dist/{dev-pPazzZvt.mjs → dev-IOg-_s5_.mjs} +1 -1
- package/dist/diagnostics-CH7T2WR3.mjs +3 -0
- package/dist/dispatch-namespaces-Bgj9XCRx.mjs +7 -0
- package/dist/dist-B7hsuvbF.mjs +57 -0
- package/dist/{dist-DpDjsWWn.mjs → dist-C6zxsVdY.mjs} +2 -2
- package/dist/dns-firewall-VmQf3UVP.mjs +57 -0
- package/dist/dns-o7hUPMCG.mjs +29 -0
- package/dist/durable-objects-DgrTbvoF.mjs +2 -0
- package/dist/email-routing-owCvAEpf.mjs +10 -0
- package/dist/email-security-Dng3DVuf.mjs +8 -0
- package/dist/email-sending-bExMH4lu.mjs +3 -0
- package/dist/filters-DKs-wEzt.mjs +4 -0
- package/dist/{firewall-C3DDwfwh.mjs → firewall-BLaTtX3r.mjs} +10 -10
- package/dist/{fraud-DY3YXFVf.mjs → fraud-D8WmLKyH.mjs} +1 -1
- package/dist/google-tag-gateway-DyCY43k0.mjs +2 -0
- package/dist/{healthchecks-Drvb79v0.mjs → healthchecks-BBtW8vRh.mjs} +3 -3
- package/dist/{hostnames-BdAQo1Mr.mjs → hostnames-Bh2IFxIw.mjs} +2 -2
- package/dist/hyperdrive-DJm1eD-M.mjs +18 -0
- package/dist/iam-apCCcy7R.mjs +6 -0
- package/dist/images-Cxe45OHm.mjs +7 -0
- package/dist/index.mjs +1 -1
- package/dist/intel-8V4h6H46.mjs +3 -0
- package/dist/{ips-B6JETVOY.mjs → ips-BE7JbAnc.mjs} +1 -1
- package/dist/{keyless-certificates-C4MZ4xnf.mjs → keyless-certificates-CfJmXccT.mjs} +2 -2
- package/dist/kv-Dz6then8.mjs +5 -0
- package/dist/leaked-credential-checks-BJ-zQMlx.mjs +3 -0
- package/dist/load-balancers-ilsGgudX.mjs +6 -0
- package/dist/logpush-BH14TtuA.mjs +4 -0
- package/dist/logs-B8-mkf_I.mjs +3 -0
- package/dist/magic-cloud-networking-DylCXoG4.mjs +5 -0
- package/dist/magic-network-monitoring-DnyrZy77.mjs +4 -0
- package/dist/magic-transit-B-kU5e3s.mjs +89 -0
- package/dist/managed-transforms-GC9Pq5dg.mjs +3 -0
- package/dist/mtls-certificates-BRlhWw_G.mjs +3 -0
- package/dist/network-interconnects-DuyoFD9_.mjs +36 -0
- package/dist/oauth-B5k80sip.mjs +61 -0
- package/dist/observability-9APhqFHo.mjs +4 -0
- package/dist/{open-YWOUIZ5Y-BpqIuBsR.mjs → open-YWOUIZ5Y-3jqSKAB1.mjs} +1 -1
- package/dist/{organizations-aRi1bhFC.mjs → organizations-Dy3kiV_z.mjs} +6 -6
- package/dist/origin-ca-certificates-2rwPoQdG.mjs +3 -0
- package/dist/origin-post-quantum-encryption-BnBLTvEO.mjs +2 -0
- package/dist/{origin-tls-client-auth-CnQNy9-l.mjs → origin-tls-client-auth-B30_2_dO.mjs} +3 -3
- package/dist/{output-CUxZRM5A.mjs → output-B6fBFRqe.mjs} +1 -1
- package/dist/{page-rules-CYqtPU1p.mjs → page-rules-zQJGmTCd.mjs} +5 -5
- package/dist/{page-shield-D8l9ZMUl.mjs → page-shield-CxQk5k9X.mjs} +5 -5
- package/dist/pages-5DKLs7CQ.mjs +11 -0
- package/dist/pipelines-DfGE44xo.mjs +6 -0
- package/dist/progress-CL8I-7YK.mjs +2 -0
- package/dist/prompt-q3B7sM2A.mjs +3 -0
- package/dist/queues-BoenUGIw.mjs +6 -0
- package/dist/r2-Cq_JCjK0.mjs +21 -0
- package/dist/r2-data-catalog-eLxltWdO.mjs +14 -0
- package/dist/{radar-CzGM92uM.mjs → radar-YNOCio6T.mjs} +1 -1
- package/dist/rate-limits-CcAF3tMl.mjs +5 -0
- package/dist/raw-fetch-bIXC9D1m.mjs +2 -0
- package/dist/realtime-kit-4bCGviO5.mjs +18 -0
- package/dist/{registrar-8IeA5DKd.mjs → registrar-CfHlaOOf.mjs} +6 -6
- package/dist/request-tracers-DlHawg5l.mjs +2 -0
- package/dist/resource-sharing-7FhuboJE.mjs +5 -0
- package/dist/resource-tagging-divcugVb.mjs +16 -0
- package/dist/rules-CAXkege8.mjs +4 -0
- package/dist/rulesets-CBsdc8IV.mjs +8 -0
- package/dist/rum-D0hHPNl9.mjs +4 -0
- package/dist/{schema-hefO-tzo.mjs → schema-D8o6HcCr.mjs} +1 -1
- package/dist/schema-validation-BWNDnnIT.mjs +24 -0
- package/dist/scim-CWLli4fi.mjs +3 -0
- package/dist/{session-CsvPYFj8.mjs → sdk-DhIhH6GB.mjs} +4 -4
- package/dist/{secrets-store-CBX0dvHL.mjs → secrets-store-B7_HkE8I.mjs} +19 -19
- package/dist/security-center-BQT21oiM.mjs +2 -0
- package/dist/security-txt-CVpmJo29.mjs +3 -0
- package/dist/session-B8r8LNQN.mjs +93 -0
- package/dist/{build-BE4o4imx.mjs → shared-DQI8NGja.mjs} +324 -388
- package/dist/{smart-shield-DblHIce0.mjs → smart-shield-BreBC1Ap.mjs} +2 -2
- package/dist/{snippets-DrpqSXYC.mjs → snippets-BAJoWMSJ.mjs} +3 -3
- package/dist/{spawn-DK7pott_.mjs → spawn-pmGERpdB.mjs} +1 -1
- package/dist/{spectrum-CnrG0jIC.mjs → spectrum-DnIRLY95.mjs} +6 -6
- package/dist/speed-UYEVue28.mjs +4 -0
- package/dist/src-BQ1dr9xR.mjs +108 -0
- package/dist/{ssl-Cp6tQkZH.mjs → ssl-D3Pixs8M.mjs} +3 -3
- package/dist/stream-BUsuOfQh.mjs +14 -0
- package/dist/{tenants-o_M62Y1n.mjs → tenants-BdWJTtcg.mjs} +1 -1
- package/dist/{token-validation-Ca5AGEns.mjs → token-validation-DUvtXWur.mjs} +5 -5
- package/dist/{tools-DtNNmO6l.mjs → tools-CQtA5-cr.mjs} +1 -1
- package/dist/turnstile-CAKVnS1L.mjs +23 -0
- package/dist/{ui-B97lRnOv.mjs → ui-BrNwNHX9.mjs} +1 -1
- package/dist/url-normalization-DA-RAxs4.mjs +3 -0
- package/dist/url-scanner-DmYu43f7.mjs +2 -0
- package/dist/user-Bah4wGGN.mjs +10 -0
- package/dist/vectorize-DhvVG2By.mjs +4 -0
- package/dist/{versions-B6E8WQyA.mjs → versions-NUXxCr0s.mjs} +1 -1
- package/dist/{waiting-rooms-Bhy_nuV3.mjs → waiting-rooms-DoOkT4Mu.mjs} +6 -6
- package/dist/web3-n3GW50u-.mjs +4 -0
- package/dist/workers-D6IaQ_F0.mjs +18 -0
- package/dist/workers-builds-DYi0OMMU.mjs +7 -0
- package/dist/workflows-DrdXUQ2g.mjs +4 -0
- package/dist/{zaraz-CyzfYOEU.mjs → zaraz-9l7KuLqh.mjs} +1 -1
- package/dist/zero-trust-D6V9GH2W.mjs +118 -0
- package/dist/zero_trust-BzXKAX_x.mjs +3 -0
- package/dist/{zones-MSULnDwW.mjs → zones-0MTkuaFk.mjs} +8 -8
- package/package.json +3 -1
- package/dist/accounts-CjtZ8x1z.mjs +0 -22
- package/dist/addressing-CHFK6uxW.mjs +0 -12
- package/dist/ai-DS3i-I1a.mjs +0 -2
- package/dist/ai-gateway-RIsegO2x.mjs +0 -8
- package/dist/ai-search-Dcj4BauG.mjs +0 -7
- package/dist/ai_gateway-w7YwfcPE.mjs +0 -4
- package/dist/alerting-Bk85NNf5.mjs +0 -6
- package/dist/analytics_engine-B7qgDJCA.mjs +0 -2
- package/dist/api-gateway-CWdR4Ne7.mjs +0 -33
- package/dist/argo-DnJRVnGX.mjs +0 -2
- package/dist/artifacts-BVWKiJUl.mjs +0 -4
- package/dist/audit-logs-DjTstbzL.mjs +0 -2
- package/dist/auth-BqDOIrKX.mjs +0 -150
- package/dist/auth-DKkSwnxh.mjs +0 -5
- package/dist/billing-3rEqF83h.mjs +0 -2
- package/dist/botnet-feed-MG91D7BR.mjs +0 -3
- package/dist/brand-protection-CK7gJi06.mjs +0 -3
- package/dist/browser-rendering-Rae0AUt0.mjs +0 -4
- package/dist/calls-DXRWsZ8n.mjs +0 -4
- package/dist/certificate-authorities-BR3gXBLs.mjs +0 -2
- package/dist/client-certificates-B0ebLJdk.mjs +0 -3
- package/dist/cloud-connector-BOjaggJk.mjs +0 -2
- package/dist/cloudforce-one-B6HYfk5Z.mjs +0 -21
- package/dist/connectivity-welFvZ7X.mjs +0 -3
- package/dist/connector-interrupts-DTV3F-50.mjs +0 -2
- package/dist/connector-telemetry-events-kDqb_AGm.mjs +0 -2
- package/dist/connector-telemetry-snapshots-DC-wD75E.mjs +0 -2
- package/dist/connectors-3vjrdFLB.mjs +0 -3
- package/dist/content-scanning-CnW2A0pv.mjs +0 -4
- package/dist/context-CONbNKO-.mjs +0 -2
- package/dist/custom-nameservers-BGkAD_PZ.mjs +0 -3
- package/dist/custom-pages-5fCSP8in.mjs +0 -4
- package/dist/d1-CyiRbZZn.mjs +0 -4
- package/dist/data-security-Casx4OS_.mjs +0 -6
- package/dist/dcv-delegation-DVYO10oA.mjs +0 -2
- package/dist/diagnostics-BqYDoDfw.mjs +0 -3
- package/dist/dispatch-namespaces-Cz2rajnP.mjs +0 -7
- package/dist/dist-DA54ZQu0.mjs +0 -82
- package/dist/dns-62t95Xif.mjs +0 -29
- package/dist/dns-firewall-Coy8d47t.mjs +0 -57
- package/dist/durable-objects-BSuRERkw.mjs +0 -2
- package/dist/email-routing-BDUYYeV3.mjs +0 -10
- package/dist/email-security-ChHA6eqQ.mjs +0 -8
- package/dist/email-sending-CVrRqn6S.mjs +0 -3
- package/dist/filters-qJpU9uAS.mjs +0 -4
- package/dist/google-tag-gateway-B00MHDfB.mjs +0 -2
- package/dist/hyperdrive-99OJV9nl.mjs +0 -18
- package/dist/iam-BRbpg3lN.mjs +0 -6
- package/dist/images-D1jI3r3O.mjs +0 -7
- package/dist/intel-C3ajLpXd.mjs +0 -3
- package/dist/kv-CSWoD9ks.mjs +0 -5
- package/dist/leaked-credential-checks-Dgs2oKm9.mjs +0 -3
- package/dist/load-balancers-Du1tNuUt.mjs +0 -6
- package/dist/logpush-SuJyO-uX.mjs +0 -4
- package/dist/logs-DcDNRPRl.mjs +0 -3
- package/dist/magic-cloud-networking-D-T0RCvi.mjs +0 -5
- package/dist/magic-network-monitoring-CqtvOePQ.mjs +0 -4
- package/dist/magic-transit-BTbkhBtF.mjs +0 -89
- package/dist/managed-transforms-CfUBSz9p.mjs +0 -3
- package/dist/mtls-certificates-Cf1O8c2E.mjs +0 -3
- package/dist/network-interconnects-DsiNytOU.mjs +0 -36
- package/dist/observability-CLqZ7OSi.mjs +0 -4
- package/dist/origin-ca-certificates-BB4H89a_.mjs +0 -3
- package/dist/origin-post-quantum-encryption-DurP3PXG.mjs +0 -2
- package/dist/pages-ChurJ2H7.mjs +0 -11
- package/dist/pipelines-CeyujvRf.mjs +0 -6
- package/dist/progress-Cent9Lsg.mjs +0 -2
- package/dist/queues-Rf_n11Cx.mjs +0 -6
- package/dist/r2-BtuTO3vQ.mjs +0 -21
- package/dist/r2-data-catalog-Debz38kv.mjs +0 -14
- package/dist/rate-limits-Bbk7HxP7.mjs +0 -5
- package/dist/raw-fetch-DnbAMFBp.mjs +0 -2
- package/dist/realtime-kit-CivLpkpg.mjs +0 -18
- package/dist/request-tracers-D1aH4NmL.mjs +0 -2
- package/dist/resource-sharing-B-Pcto7-.mjs +0 -5
- package/dist/resource-tagging-Bpb6Qq1M.mjs +0 -16
- package/dist/rules-B10XWY10.mjs +0 -4
- package/dist/rulesets-lYczEcJp.mjs +0 -8
- package/dist/rum-B5GUKa4I.mjs +0 -4
- package/dist/schema-validation-DTq517Em.mjs +0 -24
- package/dist/scim-BiLfOQ89.mjs +0 -3
- package/dist/security-center-AVpTOBK3.mjs +0 -2
- package/dist/security-txt-DVlh8y9l.mjs +0 -3
- package/dist/shared-0bwWVDLo.mjs +0 -2
- package/dist/speed-BzRY3Xlh.mjs +0 -4
- package/dist/src-D9_Gq68b.mjs +0 -108
- package/dist/stream-CGTRN4ZN.mjs +0 -14
- package/dist/turnstile-l7mo9BWL.mjs +0 -23
- package/dist/url-normalization-D1CogSIG.mjs +0 -3
- package/dist/url-scanner-BnJHJqcz.mjs +0 -2
- package/dist/user-CiyYZ69X.mjs +0 -10
- package/dist/vectorize-D3LgMLOn.mjs +0 -4
- package/dist/web3-DlHE0CZc.mjs +0 -4
- package/dist/workers-DRAkU6YR.mjs +0 -18
- package/dist/workers-builds-BmNjiHDZ.mjs +0 -7
- package/dist/workflows-z6oapEJs.mjs +0 -4
- package/dist/zero-trust-fyyIelWx.mjs +0 -118
- package/dist/zero_trust-BAhlNkjo.mjs +0 -3
- /package/dist/{body-parser-CBpeIUns.mjs → body-parser-DWSy7uZ8.mjs} +0 -0
- /package/dist/{chunk-6IEM75FG-U3L9fKgi.mjs → chunk-6IEM75FG-BEjRFMGh.mjs} +0 -0
- /package/dist/{cli-types-CMNMD1V7.mjs → cli-types-DGgEbf8K.mjs} +0 -0
- /package/dist/{input-validation-CTqtyiY9.mjs → input-validation-_fMCApaH.mjs} +0 -0
- /package/dist/{lib-B6xvCJjc.mjs → lib-4PQI6yRW.mjs} +0 -0
- /package/dist/{local-D8bhHUMK.mjs → local-CYc9q7l2.mjs} +0 -0
- /package/dist/{metadata-jh2EIan8.mjs → metadata-MPDDi08e.mjs} +0 -0
- /package/dist/{resolve-D1mG0REg.mjs → resolve-DGD57PFH.mjs} +0 -0
- /package/dist/{theme-CFHr0Dh9.mjs → theme-DbNbIY4d.mjs} +0 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{r as e}from"./chunk-DH-VkVmc.mjs";import{t}from"./src-BQ1dr9xR.mjs";import{N as n}from"./dist-C6zxsVdY.mjs";import{a as r,o as i}from"./theme-DbNbIY4d.mjs";import"./ui-BrNwNHX9.mjs";import{n as a}from"./dist-B7hsuvbF.mjs";import{n as o,t as s}from"./spawn-pmGERpdB.mjs";import*as c from"node:fs";import l,{existsSync as u,readFileSync as d,statSync as f}from"node:fs";import*as p from"node:path";import m,{dirname as h,isAbsolute as g,join as _,resolve as v}from"node:path";import"node:url";import{AsyncLocalStorage as ee}from"node:async_hooks";import*as y from"node:fs/promises";var b;const x=Object.freeze({status:`aborted`});function S(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,`_zod`,{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,`name`,{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,`init`,{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,`name`,{value:e}),o}var C=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},te=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(b=globalThis).__zod_globalConfig??(b.__zod_globalConfig={});const w=globalThis.__zod_globalConfig;function T(e){return e&&Object.assign(w,e),w}function ne(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function re(e,t){return typeof t==`bigint`?t.toString():t}function E(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function ie(e){return e==null}function ae(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function oe(e,t){let n=e/t,r=Math.round(n),i=2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}const se=Symbol(`evaluating`);function D(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==se)return r===void 0&&(r=se,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function ce(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function O(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function le(e){return JSON.stringify(e)}function ue(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}const de=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function fe(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const pe=E(()=>{if(w.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function me(e){if(fe(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(fe(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function he(e){return me(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const ge=new Set([`string`,`number`,`symbol`]),_e=new Set([`string`,`number`,`bigint`,`boolean`,`symbol`,`undefined`]);function ve(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function k(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function A(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function ye(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}const be={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function xe(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return k(e,O(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return ce(this,`shape`,e),e},checks:[]}))}function Se(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return k(e,O(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return ce(this,`shape`,r),r},checks:[]}))}function Ce(e,t){if(!me(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return k(e,O(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return ce(this,`shape`,n),n}}))}function we(e,t){if(!me(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return k(e,O(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return ce(this,`shape`,n),n}}))}function Te(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return k(e,O(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return ce(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function Ee(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return k(t,O(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return ce(this,`shape`,i),i},checks:[]}))}function De(e,t,n){return k(t,O(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return ce(this,`shape`,i),i}}))}function Oe(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function ke(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function Ae(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function je(e){return typeof e==`string`?e:e?.message}function j(e,t,n){let r=e.message?e.message:je(e.inst?._zod.def?.error?.(e))??je(t?.error?.(e))??je(n.customError?.(e))??je(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function Me(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Ne(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}const Pe=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,`_zod`,{value:e._zod,enumerable:!1}),Object.defineProperty(e,`issues`,{value:t,enumerable:!1}),e.message=JSON.stringify(t,re,2),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},Fe=S(`$ZodError`,Pe),Ie=S(`$ZodError`,Pe,{Parent:Error});function Le(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Re(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i];i===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(a))):r[n]=r[n]||{_errors:[]},r=r[n],i++}}}};return r(e),n}const ze=e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new C;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>j(e,a,T())));throw de(t,i?.callee),t}return o.value},Be=e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>j(e,a,T())));throw de(t,i?.callee),t}return o.value},Ve=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new C;return a.issues.length?{success:!1,error:new(e??Fe)(a.issues.map(e=>j(e,i,T())))}:{success:!0,data:a.value}},He=Ve(Ie),Ue=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>j(e,i,T())))}:{success:!0,data:a.value}},We=Ue(Ie),Ge=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return ze(e)(t,n,i)},Ke=e=>(t,n,r)=>ze(e)(t,n,r),qe=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Be(e)(t,n,i)},Je=e=>async(t,n,r)=>Be(e)(t,n,r),Ye=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ve(e)(t,n,i)},Xe=e=>(t,n,r)=>Ve(e)(t,n,r),Ze=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ue(e)(t,n,i)},Qe=e=>async(t,n,r)=>Ue(e)(t,n,r),$e=/^[cC][0-9a-z]{6,}$/,et=/^[0-9a-z]+$/,tt=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,nt=/^[0-9a-vA-V]{20}$/,rt=/^[A-Za-z0-9]{27}$/,it=/^[a-zA-Z0-9_-]{21}$/,at=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ot=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,st=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,ct=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function lt(){return RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`)}const ut=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,dt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,ft=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,pt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,mt=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ht=/^[A-Za-z0-9_-]*$/,gt=/^https?$/,_t=/^\+[1-9]\d{6,14}$/,vt=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,yt=RegExp(`^${vt}$`);function bt(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function xt(e){return RegExp(`^${bt(e)}$`)}function St(e){let t=bt({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${vt}T(?:${r})$`)}const Ct=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},wt=/^-?\d+$/,Tt=/^-?\d+(?:\.\d+)?$/,Et=/^(?:true|false)$/i,Dt=/^null$/i,Ot=/^[^A-Z]*$/,kt=/^[^a-z]*$/,M=S(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),At={number:`number`,bigint:`bigint`,object:`date`},jt=S(`$ZodCheckLessThan`,(e,t)=>{M.init(e,t);let n=At[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Mt=S(`$ZodCheckGreaterThan`,(e,t)=>{M.init(e,t);let n=At[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Nt=S(`$ZodCheckMultipleOf`,(e,t)=>{M.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):oe(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Pt=S(`$ZodCheckNumberFormat`,(e,t)=>{M.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=be[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=wt)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),Ft=S(`$ZodCheckMaxLength`,(e,t)=>{var n;M.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!ie(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=Me(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),It=S(`$ZodCheckMinLength`,(e,t)=>{var n;M.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!ie(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=Me(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Lt=S(`$ZodCheckLengthEquals`,(e,t)=>{var n;M.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!ie(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=Me(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Rt=S(`$ZodCheckStringFormat`,(e,t)=>{var n,r;M.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),zt=S(`$ZodCheckRegex`,(e,t)=>{Rt.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Bt=S(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Ot,Rt.init(e,t)}),Vt=S(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=kt,Rt.init(e,t)}),Ht=S(`$ZodCheckIncludes`,(e,t)=>{M.init(e,t);let n=ve(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Ut=S(`$ZodCheckStartsWith`,(e,t)=>{M.init(e,t);let n=RegExp(`^${ve(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Wt=S(`$ZodCheckEndsWith`,(e,t)=>{M.init(e,t);let n=RegExp(`.*${ve(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Gt=S(`$ZodCheckOverwrite`,(e,t)=>{M.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});var Kt=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
3
|
+
`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
|
|
4
|
+
`))}};const qt={major:4,minor:4,patch:3},N=S(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=qt;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=Oe(e),i;for(let a of t){if(a._zod.def.when){if(ke(e)||!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new C;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=Oe(e,t))});else{if(e.issues.length===t)continue;r||=Oe(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(Oe(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new C;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new C;return o.then(e=>t(e,r,a))}return t(o,r,a)}}D(e,`~standard`,()=>({validate:t=>{try{let n=He(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return We(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),Jt=S(`$ZodString`,(e,t)=>{N.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Ct(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),P=S(`$ZodStringFormat`,(e,t)=>{Rt.init(e,t),Jt.init(e,t)}),Yt=S(`$ZodGUID`,(e,t)=>{t.pattern??=ot,P.init(e,t)}),Xt=S(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=st(e)}else t.pattern??=st();P.init(e,t)}),Zt=S(`$ZodEmail`,(e,t)=>{t.pattern??=ct,P.init(e,t)}),Qt=S(`$ZodURL`,(e,t)=>{P.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===gt.source&&!/^https?:\/\//i.test(r)){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}let i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),$t=S(`$ZodEmoji`,(e,t)=>{t.pattern??=lt(),P.init(e,t)}),en=S(`$ZodNanoID`,(e,t)=>{t.pattern??=it,P.init(e,t)}),tn=S(`$ZodCUID`,(e,t)=>{t.pattern??=$e,P.init(e,t)}),nn=S(`$ZodCUID2`,(e,t)=>{t.pattern??=et,P.init(e,t)}),rn=S(`$ZodULID`,(e,t)=>{t.pattern??=tt,P.init(e,t)}),an=S(`$ZodXID`,(e,t)=>{t.pattern??=nt,P.init(e,t)}),on=S(`$ZodKSUID`,(e,t)=>{t.pattern??=rt,P.init(e,t)}),sn=S(`$ZodISODateTime`,(e,t)=>{t.pattern??=St(t),P.init(e,t)}),cn=S(`$ZodISODate`,(e,t)=>{t.pattern??=yt,P.init(e,t)}),ln=S(`$ZodISOTime`,(e,t)=>{t.pattern??=xt(t),P.init(e,t)}),un=S(`$ZodISODuration`,(e,t)=>{t.pattern??=at,P.init(e,t)}),dn=S(`$ZodIPv4`,(e,t)=>{t.pattern??=ut,P.init(e,t),e._zod.bag.format=`ipv4`}),fn=S(`$ZodIPv6`,(e,t)=>{t.pattern??=dt,P.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),pn=S(`$ZodCIDRv4`,(e,t)=>{t.pattern??=ft,P.init(e,t)}),mn=S(`$ZodCIDRv6`,(e,t)=>{t.pattern??=pt,P.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function hn(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const gn=S(`$ZodBase64`,(e,t)=>{t.pattern??=mt,P.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{hn(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function _n(e){if(!ht.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return hn(t.padEnd(Math.ceil(t.length/4)*4,`=`))}const vn=S(`$ZodBase64URL`,(e,t)=>{t.pattern??=ht,P.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{_n(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),yn=S(`$ZodE164`,(e,t)=>{t.pattern??=_t,P.init(e,t)});function bn(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}const xn=S(`$ZodJWT`,(e,t)=>{P.init(e,t),e._zod.check=n=>{bn(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Sn=S(`$ZodNumber`,(e,t)=>{N.init(e,t),e._zod.pattern=e._zod.bag.pattern??Tt,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),Cn=S(`$ZodNumberFormat`,(e,t)=>{Pt.init(e,t),Sn.init(e,t)}),wn=S(`$ZodBoolean`,(e,t)=>{N.init(e,t),e._zod.pattern=Et,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),Tn=S(`$ZodNull`,(e,t)=>{N.init(e,t),e._zod.pattern=Dt,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),En=S(`$ZodUnknown`,(e,t)=>{N.init(e,t),e._zod.parse=e=>e}),Dn=S(`$ZodNever`,(e,t)=>{N.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function On(e,t,n){e.issues.length&&t.issues.push(...Ae(n,e.issues)),t.value[n]=e.value}const kn=S(`$ZodArray`,(e,t)=>{N.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>On(t,n,e))):On(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function An(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...Ae(n,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function jn(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=ye(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Mn(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin===`optional`,d=c.optout===`optional`;for(let i in t){if(i===`__proto__`||s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>An(e,n,i,t,u,d))):An(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}const Nn=S(`$ZodObject`,(e,t)=>{if(N.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,`shape`,{get:()=>{let n={...e};return Object.defineProperty(t,`shape`,{value:n}),n}})}let n=E(()=>jn(t));D(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=fe,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optin===`optional`,i=n._zod.optout===`optional`,a=n._zod.run({value:s[e],issues:[]},o);a instanceof Promise?c.push(a.then(n=>An(n,t,e,s,r,i))):An(a,t,e,s,r,i)}return i?Mn(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),Pn=S(`$ZodObjectJIT`,(e,t)=>{Nn.init(e,t);let n=e._zod.parse,r=E(()=>jn(t)),i=e=>{let t=new Kt([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=le(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=le(r),s=e[r],c=s?._zod?.optin===`optional`,l=s?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),c&&l?t.write(`
|
|
5
|
+
if (${n}.issues.length) {
|
|
6
|
+
if (${o} in input) {
|
|
7
|
+
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
8
|
+
...iss,
|
|
9
|
+
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
10
|
+
})));
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
if (${n}.value === undefined) {
|
|
15
|
+
if (${o} in input) {
|
|
16
|
+
newResult[${o}] = undefined;
|
|
17
|
+
}
|
|
18
|
+
} else {
|
|
19
|
+
newResult[${o}] = ${n}.value;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
`):c?t.write(`
|
|
23
|
+
if (${n}.issues.length) {
|
|
24
|
+
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
25
|
+
...iss,
|
|
26
|
+
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
27
|
+
})));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (${n}.value === undefined) {
|
|
31
|
+
if (${o} in input) {
|
|
32
|
+
newResult[${o}] = undefined;
|
|
33
|
+
}
|
|
34
|
+
} else {
|
|
35
|
+
newResult[${o}] = ${n}.value;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
`):t.write(`
|
|
39
|
+
const ${n}_present = ${o} in input;
|
|
40
|
+
if (${n}.issues.length) {
|
|
41
|
+
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
42
|
+
...iss,
|
|
43
|
+
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
44
|
+
})));
|
|
45
|
+
}
|
|
46
|
+
if (!${n}_present && !${n}.issues.length) {
|
|
47
|
+
payload.issues.push({
|
|
48
|
+
code: "invalid_type",
|
|
49
|
+
expected: "nonoptional",
|
|
50
|
+
input: undefined,
|
|
51
|
+
path: [${o}]
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (${n}_present) {
|
|
56
|
+
if (${n}.value === undefined) {
|
|
57
|
+
newResult[${o}] = undefined;
|
|
58
|
+
} else {
|
|
59
|
+
newResult[${o}] = ${n}.value;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
`)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=fe,s=!w.jitless,c=s&&pe.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?Mn([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function Fn(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!Oe(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>j(e,r,T())))}),t)}const In=S(`$ZodUnion`,(e,t)=>{N.init(e,t),D(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),D(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),D(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),D(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>ae(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>Fn(t,r,e,i)):Fn(o,r,e,i)}}),Ln=S(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,In.init(e,t);let n=e._zod.parse;D(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=E(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!fe(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()),input:o,path:[t.discriminator],inst:e}),i)}}),Rn=S(`$ZodIntersection`,(e,t)=>{N.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>Bn(e,t,n)):Bn(e,i,a)}});function zn(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(me(e)&&me(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=zn(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=zn(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Bn(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),Oe(e))return e;let o=zn(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}const Vn=S(`$ZodRecord`,(e,t)=>{N.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!me(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let s=new Set;for(let c of o)if(typeof c==`string`||typeof c==`number`||typeof c==`symbol`){s.add(typeof c==`number`?c.toString():c);let o=t.keyType._zod.run({value:c,issues:[]},r);if(o instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(o.issues.length){n.issues.push({code:`invalid_key`,origin:`record`,issues:o.issues.map(e=>j(e,r,T())),input:c,path:[c],inst:e});continue}let l=o.value,u=t.valueType._zod.run({value:i[c],issues:[]},r);u instanceof Promise?a.push(u.then(e=>{e.issues.length&&n.issues.push(...Ae(c,e.issues)),n.value[l]=e.value})):(u.issues.length&&n.issues.push(...Ae(c,u.issues)),n.value[l]=u.value)}let c;for(let e in i)s.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`||!Object.prototype.propertyIsEnumerable.call(i,o))continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&Tt.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>j(e,r,T())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...Ae(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...Ae(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),Hn=S(`$ZodEnum`,(e,t)=>{N.init(e,t);let n=ne(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>ge.has(typeof e)).map(e=>typeof e==`string`?ve(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),Un=S(`$ZodLiteral`,(e,t)=>{if(N.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?ve(e):e?ve(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),Wn=S(`$ZodTransform`,(e,t)=>{N.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new te(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new C;return n.value=i,n.fallback=!0,n}});function Gn(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}const Kn=S(`$ZodOptional`,(e,t)=>{N.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,D(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),D(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${ae(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>Gn(e,r)):Gn(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),qn=S(`$ZodExactOptional`,(e,t)=>{Kn.init(e,t),D(e._zod,`values`,()=>t.innerType._zod.values),D(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Jn=S(`$ZodNullable`,(e,t)=>{N.init(e,t),D(e._zod,`optin`,()=>t.innerType._zod.optin),D(e._zod,`optout`,()=>t.innerType._zod.optout),D(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${ae(e.source)}|null)$`):void 0}),D(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Yn=S(`$ZodDefault`,(e,t)=>{N.init(e,t),e._zod.optin=`optional`,D(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Xn(e,t)):Xn(r,t)}});function Xn(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Zn=S(`$ZodPrefault`,(e,t)=>{N.init(e,t),e._zod.optin=`optional`,D(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Qn=S(`$ZodNonOptional`,(e,t)=>{N.init(e,t),D(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>$n(t,e)):$n(i,e)}});function $n(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}const er=S(`$ZodCatch`,(e,t)=>{N.init(e,t),e._zod.optin=`optional`,D(e._zod,`optout`,()=>t.innerType._zod.optout),D(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>j(e,n,T()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>j(e,n,T()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),tr=S(`$ZodPipe`,(e,t)=>{N.init(e,t),D(e._zod,`values`,()=>t.in._zod.values),D(e._zod,`optin`,()=>t.in._zod.optin),D(e._zod,`optout`,()=>t.out._zod.optout),D(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>nr(e,t.in,n)):nr(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>nr(e,t.out,n)):nr(r,t.out,n)}});function nr(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}const rr=S(`$ZodReadonly`,(e,t)=>{N.init(e,t),D(e._zod,`propValues`,()=>t.innerType._zod.propValues),D(e._zod,`values`,()=>t.innerType._zod.values),D(e._zod,`optin`,()=>t.innerType?._zod?.optin),D(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(ir):ir(r)}});function ir(e){return e.value=Object.freeze(e.value),e}const ar=S(`$ZodTemplateLiteral`,(e,t)=>{N.init(e,t);let n=[];for(let e of t.parts)if(typeof e==`object`&&e){if(!e._zod.pattern)throw Error(`Invalid template literal part, no pattern found: ${[...e._zod.traits].shift()}`);let t=e._zod.pattern instanceof RegExp?e._zod.pattern.source:e._zod.pattern;if(!t)throw Error(`Invalid template literal part: ${e._zod.traits}`);let r=+!!t.startsWith(`^`),i=t.endsWith(`$`)?t.length-1:t.length;n.push(t.slice(r,i))}else if(e===null||_e.has(typeof e))n.push(ve(`${e}`));else throw Error(`Invalid template literal part: ${e}`);e._zod.pattern=RegExp(`^${n.join(``)}$`),e._zod.parse=(n,r)=>typeof n.value==`string`?(e._zod.pattern.lastIndex=0,e._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:e,code:`invalid_format`,format:t.format??`template_literal`,pattern:e._zod.pattern.source}),n):(n.issues.push({input:n.value,inst:e,expected:`string`,code:`invalid_type`}),n)}),or=S(`$ZodLazy`,(e,t)=>{N.init(e,t),D(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),D(e._zod,`pattern`,()=>e._zod.innerType?._zod?.pattern),D(e._zod,`propValues`,()=>e._zod.innerType?._zod?.propValues),D(e._zod,`optin`,()=>e._zod.innerType?._zod?.optin??void 0),D(e._zod,`optout`,()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),sr=S(`$ZodCustom`,(e,t)=>{M.init(e,t),N.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>cr(t,n,r,e));cr(i,n,r,e)}});function cr(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Ne(e))}}var lr,ur=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function dr(){return new ur}(lr=globalThis).__zod_globalRegistry??(lr.__zod_globalRegistry=dr());const fr=globalThis.__zod_globalRegistry;function pr(e,t){return new e({type:`string`,...A(t)})}function mr(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...A(t)})}function hr(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...A(t)})}function gr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...A(t)})}function _r(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...A(t)})}function vr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...A(t)})}function yr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...A(t)})}function br(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...A(t)})}function xr(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...A(t)})}function Sr(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...A(t)})}function Cr(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...A(t)})}function wr(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...A(t)})}function Tr(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...A(t)})}function Er(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...A(t)})}function Dr(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...A(t)})}function Or(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...A(t)})}function kr(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...A(t)})}function Ar(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...A(t)})}function jr(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...A(t)})}function Mr(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...A(t)})}function Nr(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...A(t)})}function Pr(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...A(t)})}function Fr(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...A(t)})}function Ir(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...A(t)})}function Lr(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...A(t)})}function Rr(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...A(t)})}function zr(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...A(t)})}function Br(e,t){return new e({type:`number`,checks:[],...A(t)})}function Vr(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...A(t)})}function Hr(e,t){return new e({type:`boolean`,...A(t)})}function Ur(e,t){return new e({type:`null`,...A(t)})}function Wr(e){return new e({type:`unknown`})}function Gr(e,t){return new e({type:`never`,...A(t)})}function Kr(e,t){return new jt({check:`less_than`,...A(t),value:e,inclusive:!1})}function qr(e,t){return new jt({check:`less_than`,...A(t),value:e,inclusive:!0})}function Jr(e,t){return new Mt({check:`greater_than`,...A(t),value:e,inclusive:!1})}function Yr(e,t){return new Mt({check:`greater_than`,...A(t),value:e,inclusive:!0})}function Xr(e,t){return new Nt({check:`multiple_of`,...A(t),value:e})}function Zr(e,t){return new Ft({check:`max_length`,...A(t),maximum:e})}function Qr(e,t){return new It({check:`min_length`,...A(t),minimum:e})}function $r(e,t){return new Lt({check:`length_equals`,...A(t),length:e})}function ei(e,t){return new zt({check:`string_format`,format:`regex`,...A(t),pattern:e})}function ti(e){return new Bt({check:`string_format`,format:`lowercase`,...A(e)})}function ni(e){return new Vt({check:`string_format`,format:`uppercase`,...A(e)})}function ri(e,t){return new Ht({check:`string_format`,format:`includes`,...A(t),includes:e})}function ii(e,t){return new Ut({check:`string_format`,format:`starts_with`,...A(t),prefix:e})}function ai(e,t){return new Wt({check:`string_format`,format:`ends_with`,...A(t),suffix:e})}function oi(e){return new Gt({check:`overwrite`,tx:e})}function si(e){return oi(t=>t.normalize(e))}function ci(){return oi(e=>e.trim())}function li(){return oi(e=>e.toLowerCase())}function ui(){return oi(e=>e.toUpperCase())}function di(){return oi(e=>ue(e))}function fi(e,t,n){return new e({type:`array`,element:t,...A(n)})}function pi(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...A(n)})}function mi(e,t){let n=hi(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Ne(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=t.value,r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(Ne(r))}},e(t.value,t)),t);return n}function hi(e,t){let n=new M({check:`custom`,...A(t)});return n._zod.check=e,n}function gi(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??fr,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function F(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,F(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&I(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function _i(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
64
|
+
|
|
65
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function vi(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:bi(t,`input`,e.processors),output:bi(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function I(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return I(r.element,n);if(r.type===`set`)return I(r.valueType,n);if(r.type===`lazy`)return I(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type===`default`||r.type===`prefault`)return I(r.innerType,n);if(r.type===`intersection`)return I(r.left,n)||I(r.right,n);if(r.type===`record`||r.type===`map`)return I(r.keyType,n)||I(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:I(r.in,n)||I(r.out,n);if(r.type===`object`){for(let e in r.shape)if(I(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(I(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(I(e,n))return!0;return!!(r.rest&&I(r.rest,n))}return!1}const yi=(e,t={})=>n=>{let r=gi({...n,processors:t});return F(e,r),_i(r,e),vi(r,e)},bi=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=gi({...i??{},target:a,io:t,processors:n});return F(e,o),_i(o,e),vi(o,e)},xi={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Si=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=xi[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Ci=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},wi=(e,t,n,r)=>{n.type=`boolean`},Ti=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},Ei=(e,t,n,r)=>{n.not={}},Di=(e,t,n,r)=>{let i=e._zod.def,a=ne(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Oi=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},ki=(e,t,n,r)=>{let i=n,a=e._zod.pattern;if(!a)throw Error(`Pattern not found in template literal`);i.type=`string`,i.pattern=a.source},Ai=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},ji=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Mi=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=F(a.element,t,{...r,path:[...r.path,`items`]})},Ni=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=F(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=F(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Pi=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>F(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Fi=(e,t,n,r)=>{let i=e._zod.def,a=F(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=F(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},Ii=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=F(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else (t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=F(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=F(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},Li=(e,t,n,r)=>{let i=e._zod.def,a=F(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Ri=(e,t,n,r)=>{let i=e._zod.def;F(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},zi=(e,t,n,r)=>{let i=e._zod.def;F(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Bi=(e,t,n,r)=>{let i=e._zod.def;F(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Vi=(e,t,n,r)=>{let i=e._zod.def;F(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},Hi=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;F(o,t,r);let s=t.seen.get(e);s.ref=o},Ui=(e,t,n,r)=>{let i=e._zod.def;F(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Wi=(e,t,n,r)=>{let i=e._zod.def;F(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Gi=(e,t,n,r)=>{let i=e._zod.innerType;F(i,t,r);let a=t.seen.get(e);a.ref=i},Ki=S(`ZodISODateTime`,(e,t)=>{sn.init(e,t),B.init(e,t)});function qi(e){return Ir(Ki,e)}const Ji=S(`ZodISODate`,(e,t)=>{cn.init(e,t),B.init(e,t)});function Yi(e){return Lr(Ji,e)}const Xi=S(`ZodISOTime`,(e,t)=>{ln.init(e,t),B.init(e,t)});function Zi(e){return Rr(Xi,e)}const Qi=S(`ZodISODuration`,(e,t)=>{un.init(e,t),B.init(e,t)});function $i(e){return zr(Qi,e)}const L=S(`ZodError`,(e,t)=>{Fe.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Re(e,t)},flatten:{value:t=>Le(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,re,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,re,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),ea=ze(L),ta=Be(L),na=Ve(L),ra=Ue(L),ia=Ge(L),aa=Ke(L),oa=qe(L),sa=Je(L),ca=Ye(L),la=Xe(L),ua=Ze(L),da=Qe(L),fa=new WeakMap;function pa(e,t,n){let r=Object.getPrototypeOf(e),i=fa.get(r);if(i||(i=new Set,fa.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}const R=S(`ZodType`,(e,t)=>(N.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:bi(e,`input`),output:bi(e,`output`)}}),e.toJSONSchema=yi(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.parse=(t,n)=>ea(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>na(e,t,n),e.parseAsync=async(t,n)=>ta(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>ra(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>ia(e,t,n),e.decode=(t,n)=>aa(e,t,n),e.encodeAsync=async(t,n)=>oa(e,t,n),e.decodeAsync=async(t,n)=>sa(e,t,n),e.safeEncode=(t,n)=>ca(e,t,n),e.safeDecode=(t,n)=>la(e,t,n),e.safeEncodeAsync=async(t,n)=>ua(e,t,n),e.safeDecodeAsync=async(t,n)=>da(e,t,n),pa(e,`ZodType`,{check(...e){let t=this.def;return this.clone(O(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return k(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(ko(e,t))},superRefine(e,t){return this.check(Ao(e,t))},overwrite(e){return this.check(oi(e))},optional(){return oo(this)},exactOptional(){return co(this)},nullable(){return uo(this)},nullish(){return oo(uo(this))},nonoptional(e){return _o(this,e)},array(){return U(this)},or(e){return G([this,e])},and(e){return $a(this,e)},transform(e){return xo(this,io(e))},default(e){return po(this,e)},prefault(e){return ho(this,e)},catch(e){return yo(this,e)},pipe(e){return xo(this,e)},readonly(){return Co(this)},describe(e){let t=this.clone();return fr.add(t,{description:e}),t},meta(...e){if(e.length===0)return fr.get(this);let t=this.clone();return fr.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,`description`,{get(){return fr.get(e)?.description},configurable:!0}),e)),ma=S(`_ZodString`,(e,t)=>{Jt.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Si(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,pa(e,`_ZodString`,{regex(...e){return this.check(ei(...e))},includes(...e){return this.check(ri(...e))},startsWith(...e){return this.check(ii(...e))},endsWith(...e){return this.check(ai(...e))},min(...e){return this.check(Qr(...e))},max(...e){return this.check(Zr(...e))},length(...e){return this.check($r(...e))},nonempty(...e){return this.check(Qr(1,...e))},lowercase(e){return this.check(ti(e))},uppercase(e){return this.check(ni(e))},trim(){return this.check(ci())},normalize(...e){return this.check(si(...e))},toLowerCase(){return this.check(li())},toUpperCase(){return this.check(ui())},slugify(){return this.check(di())}})}),ha=S(`ZodString`,(e,t)=>{Jt.init(e,t),ma.init(e,t),e.email=t=>e.check(mr(ga,t)),e.url=t=>e.check(br(ya,t)),e.jwt=t=>e.check(Fr(Pa,t)),e.emoji=t=>e.check(xr(ba,t)),e.guid=t=>e.check(hr(_a,t)),e.uuid=t=>e.check(gr(va,t)),e.uuidv4=t=>e.check(_r(va,t)),e.uuidv6=t=>e.check(vr(va,t)),e.uuidv7=t=>e.check(yr(va,t)),e.nanoid=t=>e.check(Sr(xa,t)),e.guid=t=>e.check(hr(_a,t)),e.cuid=t=>e.check(Cr(Sa,t)),e.cuid2=t=>e.check(wr(Ca,t)),e.ulid=t=>e.check(Tr(wa,t)),e.base64=t=>e.check(Mr(ja,t)),e.base64url=t=>e.check(Nr(Ma,t)),e.xid=t=>e.check(Er(Ta,t)),e.ksuid=t=>e.check(Dr(Ea,t)),e.ipv4=t=>e.check(Or(Da,t)),e.ipv6=t=>e.check(kr(Oa,t)),e.cidrv4=t=>e.check(Ar(ka,t)),e.cidrv6=t=>e.check(jr(Aa,t)),e.e164=t=>e.check(Pr(Na,t)),e.datetime=t=>e.check(qi(t)),e.date=t=>e.check(Yi(t)),e.time=t=>e.check(Zi(t)),e.duration=t=>e.check($i(t))});function z(e){return pr(ha,e)}const B=S(`ZodStringFormat`,(e,t)=>{P.init(e,t),ma.init(e,t)}),ga=S(`ZodEmail`,(e,t)=>{Zt.init(e,t),B.init(e,t)}),_a=S(`ZodGUID`,(e,t)=>{Yt.init(e,t),B.init(e,t)}),va=S(`ZodUUID`,(e,t)=>{Xt.init(e,t),B.init(e,t)}),ya=S(`ZodURL`,(e,t)=>{Qt.init(e,t),B.init(e,t)}),ba=S(`ZodEmoji`,(e,t)=>{$t.init(e,t),B.init(e,t)}),xa=S(`ZodNanoID`,(e,t)=>{en.init(e,t),B.init(e,t)}),Sa=S(`ZodCUID`,(e,t)=>{tn.init(e,t),B.init(e,t)}),Ca=S(`ZodCUID2`,(e,t)=>{nn.init(e,t),B.init(e,t)}),wa=S(`ZodULID`,(e,t)=>{rn.init(e,t),B.init(e,t)}),Ta=S(`ZodXID`,(e,t)=>{an.init(e,t),B.init(e,t)}),Ea=S(`ZodKSUID`,(e,t)=>{on.init(e,t),B.init(e,t)}),Da=S(`ZodIPv4`,(e,t)=>{dn.init(e,t),B.init(e,t)}),Oa=S(`ZodIPv6`,(e,t)=>{fn.init(e,t),B.init(e,t)}),ka=S(`ZodCIDRv4`,(e,t)=>{pn.init(e,t),B.init(e,t)}),Aa=S(`ZodCIDRv6`,(e,t)=>{mn.init(e,t),B.init(e,t)}),ja=S(`ZodBase64`,(e,t)=>{gn.init(e,t),B.init(e,t)}),Ma=S(`ZodBase64URL`,(e,t)=>{vn.init(e,t),B.init(e,t)}),Na=S(`ZodE164`,(e,t)=>{yn.init(e,t),B.init(e,t)}),Pa=S(`ZodJWT`,(e,t)=>{xn.init(e,t),B.init(e,t)}),Fa=S(`ZodNumber`,(e,t)=>{Sn.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ci(e,t,n,r),pa(e,`ZodNumber`,{gt(e,t){return this.check(Jr(e,t))},gte(e,t){return this.check(Yr(e,t))},min(e,t){return this.check(Yr(e,t))},lt(e,t){return this.check(Kr(e,t))},lte(e,t){return this.check(qr(e,t))},max(e,t){return this.check(qr(e,t))},int(e){return this.check(La(e))},safe(e){return this.check(La(e))},positive(e){return this.check(Jr(0,e))},nonnegative(e){return this.check(Yr(0,e))},negative(e){return this.check(Kr(0,e))},nonpositive(e){return this.check(qr(0,e))},multipleOf(e,t){return this.check(Xr(e,t))},step(e,t){return this.check(Xr(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function V(e){return Br(Fa,e)}const Ia=S(`ZodNumberFormat`,(e,t)=>{Cn.init(e,t),Fa.init(e,t)});function La(e){return Vr(Ia,e)}const Ra=S(`ZodBoolean`,(e,t)=>{wn.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wi(e,t,n,r)});function H(e){return Hr(Ra,e)}const za=S(`ZodNull`,(e,t)=>{Tn.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ti(e,t,n,r)});function Ba(e){return Ur(za,e)}const Va=S(`ZodUnknown`,(e,t)=>{En.init(e,t),R.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Ha(){return Wr(Va)}const Ua=S(`ZodNever`,(e,t)=>{Dn.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ei(e,t,n,r)});function Wa(e){return Gr(Ua,e)}const Ga=S(`ZodArray`,(e,t)=>{kn.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mi(e,t,n,r),e.element=t.element,pa(e,`ZodArray`,{min(e,t){return this.check(Qr(e,t))},nonempty(e){return this.check(Qr(1,e))},max(e,t){return this.check(Zr(e,t))},length(e,t){return this.check($r(e,t))},unwrap(){return this.element}})});function U(e,t){return fi(Ga,e,t)}const Ka=S(`ZodObject`,(e,t)=>{Pn.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ni(e,t,n,r),D(e,`shape`,()=>t.shape),pa(e,`ZodObject`,{keyof(){return q(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:Ha()})},loose(){return this.clone({...this._zod.def,catchall:Ha()})},strict(){return this.clone({...this._zod.def,catchall:Wa()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return Ce(this,e)},safeExtend(e){return we(this,e)},merge(e){return Te(this,e)},pick(e){return xe(this,e)},omit(e){return Se(this,e)},partial(...e){return Ee(ao,this,e[0])},required(...e){return De(go,this,e[0])}})});function qa(e,t){return new Ka({type:`object`,shape:e??{},...A(t)})}function W(e,t){return new Ka({type:`object`,shape:e,catchall:Wa(),...A(t)})}function Ja(e,t){return new Ka({type:`object`,shape:e,catchall:Ha(),...A(t)})}const Ya=S(`ZodUnion`,(e,t)=>{In.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pi(e,t,n,r),e.options=t.options});function G(e,t){return new Ya({type:`union`,options:e,...A(t)})}const Xa=S(`ZodDiscriminatedUnion`,(e,t)=>{Ya.init(e,t),Ln.init(e,t)});function Za(e,t,n){return new Xa({type:`union`,options:t,discriminator:e,...A(n)})}const Qa=S(`ZodIntersection`,(e,t)=>{Rn.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fi(e,t,n,r)});function $a(e,t){return new Qa({type:`intersection`,left:e,right:t})}const eo=S(`ZodRecord`,(e,t)=>{Vn.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ii(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function K(e,t,n){return!t||!t._zod?new eo({type:`record`,keyType:z(),valueType:e,...A(t)}):new eo({type:`record`,keyType:e,valueType:t,...A(n)})}const to=S(`ZodEnum`,(e,t)=>{Hn.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Di(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new to({...t,checks:[],...A(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new to({...t,checks:[],...A(r),entries:i})}});function q(e,t){return new to({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...A(t)})}const no=S(`ZodLiteral`,(e,t)=>{Un.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oi(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,`value`,{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function J(e,t){return new no({type:`literal`,values:Array.isArray(e)?e:[e],...A(t)})}const ro=S(`ZodTransform`,(e,t)=>{Wn.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ji(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new te(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Ne(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(Ne(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function io(e){return new ro({type:`transform`,transform:e})}const ao=S(`ZodOptional`,(e,t)=>{Kn.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function oo(e){return new ao({type:`optional`,innerType:e})}const so=S(`ZodExactOptional`,(e,t)=>{qn.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function co(e){return new so({type:`optional`,innerType:e})}const lo=S(`ZodNullable`,(e,t)=>{Jn.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Li(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function uo(e){return new lo({type:`nullable`,innerType:e})}const fo=S(`ZodDefault`,(e,t)=>{Yn.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function po(e,t){return new fo({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():he(t)}})}const mo=S(`ZodPrefault`,(e,t)=>{Zn.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ho(e,t){return new mo({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():he(t)}})}const go=S(`ZodNonOptional`,(e,t)=>{Qn.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ri(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function _o(e,t){return new go({type:`nonoptional`,innerType:e,...A(t)})}const vo=S(`ZodCatch`,(e,t)=>{er.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function yo(e,t){return new vo({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}const bo=S(`ZodPipe`,(e,t)=>{tr.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hi(e,t,n,r),e.in=t.in,e.out=t.out});function xo(e,t){return new bo({type:`pipe`,in:e,out:t})}const So=S(`ZodReadonly`,(e,t)=>{rr.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ui(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Co(e){return new So({type:`readonly`,innerType:e})}const wo=S(`ZodTemplateLiteral`,(e,t)=>{ar.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ki(e,t,n,r)});function To(e,t){return new wo({type:`template_literal`,parts:e,...A(t)})}const Eo=S(`ZodLazy`,(e,t)=>{or.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gi(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function Do(e){return new Eo({type:`lazy`,getter:e})}const Oo=S(`ZodCustom`,(e,t)=>{sr.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ai(e,t,n,r)});function ko(e,t={}){return pi(Oo,e,t)}function Ao(e,t){return mi(e,t)}function jo(e){let t=Do(()=>G([z(e),V(),H(),Ba(),U(t),K(z(),t)]));return t}var Mo=Object.getOwnPropertyNames,No=(e,t)=>function(){return t||(0,e[Mo(e)[0]])((t={exports:{}}).exports,t),t.exports};const Po=W({htmlHandling:q([`auto-trailing-slash`,`drop-trailing-slash`,`force-trailing-slash`,`none`]).optional(),notFoundHandling:q([`single-page-application`,`404-page`,`none`]).optional(),runWorkerFirst:G([U(z()),H()]).optional()}),Fo=Za(`type`,[W({type:J(`agent-memory`),namespace:z(),remote:H().optional()}),W({type:J(`ai`),remote:H().optional()}),W({type:J(`ai-search`),name:z(),remote:H().optional()}),W({type:J(`ai-search-namespace`),namespace:z(),remote:H().optional()}),W({type:J(`analytics-engine-dataset`),name:z().optional()}),W({type:J(`artifacts`),namespace:z(),remote:H().optional()}),W({type:J(`assets`)}),W({type:J(`browser`),remote:H().optional()}),W({type:J(`d1`),name:z().optional(),id:z().optional(),remote:H().optional()}),W({type:J(`dispatch-namespace`),namespace:z().optional(),outbound:W({workerName:z(),parameters:U(z()).optional()}).optional(),remote:H().optional()}),W({type:J(`durable-object`),workerName:z(),exportName:z()}),W({type:J(`flagship`),id:z().optional(),remote:H().optional()}),W({type:J(`hyperdrive`),id:z(),localConnectionString:z().optional()}),W({type:J(`images`),remote:H().optional()}),W({type:J(`json`),value:jo()}),W({type:J(`kv`),id:z().optional(),remote:H().optional()}),W({type:J(`logfwdr`),destination:z()}),W({type:J(`media`),remote:H().optional()}),W({type:J(`mtls-certificate`),id:z(),remote:H().optional()}),W({type:J(`pipeline`),name:z(),remote:H().optional()}),W({type:J(`queue`),name:z().optional(),deliveryDelay:V().optional(),remote:H().optional()}),W({type:J(`rate-limit`),namespace:z(),simple:W({limit:V(),period:G([J(10),J(60)])})}),W({type:J(`r2`),name:z().optional(),jurisdiction:z().optional(),remote:H().optional()}),W({type:J(`secret`)}),W({type:J(`secrets-store-secret`),storeId:z(),secretName:z()}),W({type:J(`send-email`),destinationAddress:z().optional(),allowedDestinationAddresses:U(z()).optional(),allowedSenderAddresses:U(z()).optional(),remote:H().optional()}),W({type:J(`stream`),remote:H().optional()}),W({type:J(`text`),value:z()}),W({type:J(`vectorize`),name:z(),remote:H().optional()}),W({type:J(`version-metadata`)}),W({type:J(`vpc-service`),id:z(),remote:H().optional()}),W({type:J(`vpc-network`),tunnelId:z().optional(),networkId:z().optional(),remote:H().optional()}).superRefine((e,t)=>{let n=e.tunnelId!==void 0;n===(e.networkId!==void 0)&&t.addIssue({code:`custom`,message:n?`"vpc-network" bindings must specify exactly one of "tunnelId" or "networkId", not both`:`"vpc-network" bindings must specify either "tunnelId" or "networkId"`})}),W({type:J(`web-search`),remote:H().optional()}),W({type:J(`worker`),workerName:z(),exportName:z().optional(),props:K(z(),Ha()).optional(),remote:H().optional()}),W({type:J(`worker-loader`)})]),Io=Ja({type:To([`unsafe:`,z().min(1)]),dev:W({plugin:W({package:z(),name:z()}),options:K(z(),Ha()).optional()}).optional()}),Lo=Ha().transform((e,t)=>{let n=(typeof e==`object`&&e&&`type`in e&&typeof e.type==`string`&&e.type.startsWith(`unsafe:`)?Io:Fo).safeParse(e);return n.success?n.data:(t.issues.push(...n.error.issues),x)});function Ro(e){return e.type.startsWith(`unsafe:`)}const zo=W({enabled:H(),crossVersionCache:H().optional()}),Bo=new Set([`ai`,`assets`,`browser`,`images`,`media`,`stream`,`version-metadata`,`web-search`]),Vo=new Intl.ListFormat(`en-US`),Ho=K(z(),Lo).superRefine((e,t)=>{let n=new Set,r=new Set;for(let t of Object.values(e)){let e=t.type;Bo.has(e)&&(n.has(e)&&r.add(e),n.add(e))}r.size>0&&t.addIssue({code:`custom`,message:`${Vo.format([...r].sort())} bindings can only be defined once`})}).optional(),Uo=G([W({type:J(`durable-object`),state:J(`created`).optional(),storage:q([`sqlite`,`legacy-kv`])}),W({type:J(`durable-object`),state:J(`deleted`)}),W({type:J(`durable-object`),state:J(`renamed`),renamedTo:z()}),W({type:J(`durable-object`),state:J(`transferred`),transferredTo:z()}),W({type:J(`durable-object`),state:J(`expecting-transfer`),storage:q([`sqlite`,`legacy-kv`]),transferFrom:z()}),W({type:J(`worker`),cache:W({enabled:H()}).optional()})]),Wo=W({cpuMs:V().optional(),subrequests:V().optional()}),Go=W({enabled:H().optional(),headSamplingRate:V().optional(),logs:W({enabled:H().optional(),headSamplingRate:V().optional(),invocationLogs:H().optional(),persist:H().optional(),destinations:U(z()).optional()}).optional(),traces:W({enabled:H().optional(),headSamplingRate:V().optional(),persist:H().optional(),destinations:U(z()).optional()}).optional()}),Ko=G([W({mode:q([`off`,`smart`]),hint:z().optional()}),W({mode:J(`targeted`).optional(),region:z()}),W({mode:J(`targeted`).optional(),host:z()}),W({mode:J(`targeted`).optional(),hostname:z()})]),qo=W({workerName:z(),streaming:H().optional()}),Jo=Za(`type`,[W({type:J(`email`),addresses:U(z())}),W({type:J(`fetch`),pattern:z(),zone:z().optional()}),W({type:J(`queue`),name:z(),deadLetterQueue:z().optional(),maxBatchSize:V().optional(),maxBatchTimeout:V().optional(),maxConcurrency:V().nullable().optional(),maxRetries:V().optional(),retryDelay:V().optional(),visibilityTimeoutMs:V().optional()}),W({type:J(`scheduled`),schedule:z()})]),Yo=W({metadata:K(z(),Ha()).optional(),capnp:G([W({basePath:z(),sourceSchemas:U(z()),compiledSchema:Wa().optional()}),W({basePath:Wa().optional(),sourceSchemas:Wa().optional(),compiledSchema:z()})]).optional()}),Xo=W({type:J(`worker`),name:z(),compatibilityDate:z(),compatibilityFlags:U(z()).optional(),assets:Po.optional(),domains:U(z()).optional(),triggers:U(Jo).optional(),tailConsumers:U(qo).optional(),cache:zo.optional(),placement:Ko.optional(),limits:Wo.optional(),logpush:H().optional(),observability:Go.optional(),workersDev:H().optional(),previewUrls:H().optional(),firstPartyWorker:H().optional(),unsafe:Yo.optional(),env:Ho,exports:K(z(),Uo).optional()}),Zo=Xo.extend({entrypoint:G([z(),W({default:z()})]).transform(e=>typeof e==`string`?e:e.default).optional()}),Qo=W({type:J(`settings`),accountId:z().optional(),complianceRegion:q([`public`,`fedramp-high`]).optional()}),$o=Za(`type`,[Zo,Qo]),es=`settings`;K(z(),$o).check(e=>{for(let[t,n]of Object.entries(e.value)){let r=t===es,i=n.type===`settings`;i&&!r?e.issues.push({code:`custom`,input:n,path:[t],message:`A \`settings\` config is only allowed on the \`${es}\` export; found one on the \`${t}\` export.`}):r&&!i&&e.issues.push({code:`custom`,input:n,path:[t],message:`The \`${es}\` export is reserved for a \`settings\` config; found a \`${n.type}\` config.`})}});const ts=q([`esm`,`cjs`,`python`,`python-requirement`,`wasm`,`text`,`data`,`json`,`sourcemap`]),ns=W({mainModule:z(),modules:K(z(),W({type:ts}))}),rs=Xo.extend({manifest:ns.optional()});No({"../../node_modules/.pnpm/ts-dedent@2.2.0/node_modules/ts-dedent/dist/index.js":(e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.dedent=void 0;function t(e){var t=[...arguments].slice(1),n=Array.from(typeof e==`string`?[e]:e);n[n.length-1]=n[n.length-1].replace(/\r?\n([\t ]*)$/,``);var r=n.reduce(function(e,t){var n=t.match(/\n([\t ]+|(?!\s).)/g);return n?e.concat(n.map(function(e){return e.match(/[\t ]/g)?.length??0})):e},[]);if(r.length){var i=RegExp(`
|
|
66
|
+
[ ]{`+Math.min.apply(Math,r)+`}`,`g`);n=n.map(function(e){return e.replace(i,`
|
|
67
|
+
`)})}n[0]=n[0].replace(/^\r?\n/,``);var a=n[0];return t.forEach(function(e,t){var r=a.match(/(?:^|\n)( *)$/),i=r?r[1]:``,o=e;typeof e==`string`&&e.includes(`
|
|
68
|
+
`)&&(o=String(e).split(`
|
|
69
|
+
`).map(function(e,t){return t===0?e:``+i+e}).join(`
|
|
70
|
+
`)),a+=o+n[t+1]}),a}e.dedent=t})})();var is=Object.defineProperty,Y=(e,t)=>is(e,`name`,{value:t,configurable:!0});function as(e){let t={"durable-object":{},worker:{}};if(e===void 0)return t;for(let[n,r]of Object.entries(e))t[r.type][n]=r;return t}Y(as,`partitionExports`);var X=class extends Error{static{Y(this,`UserError`)}telemetryMessage;constructor(e,t){super(e,t),Object.setPrototypeOf(this,new.target.prototype),this.telemetryMessage=typeof t?.telemetryMessage==`string`?t.telemetryMessage:t?.telemetryMessage?e:void 0}};(class extends X{static{Y(this,`DeprecationError`)}constructor(e,t){super(`Deprecation:
|
|
71
|
+
${e}`,t)}});var os=class extends X{static{Y(this,`FatalError`)}code;constructor(e,t){super(e,t),this.code=t.code}};(class extends X{static{Y(this,`CommandLineArgsError`)}});var ss=class extends os{static{Y(this,`JsonFriendlyFatalError`)}};(class extends Error{static{Y(this,`MissingConfigError`)}telemetryMessage;constructor(e){super(`Missing config value for ${e}`),this.telemetryMessage=`Missing config value for ${e}`}});function cs(e,t,n){return t?new ss(JSON.stringify(e),n):new os(`${e}`,n)}Y(cs,`createFatalError`);function ls(e,t=!1){let n=e.length,r=0,i=``,a=0,o=16,s=0,c=0,l=0,u=0,d=0;function f(t,n){let i=0,a=0;for(;i<t||!n;){let t=e.charCodeAt(r);if(t>=48&&t<=57)a=a*16+t-48;else if(t>=65&&t<=70)a=a*16+t-65+10;else if(t>=97&&t<=102)a=a*16+t-97+10;else break;r++,i++}return i<t&&(a=-1),a}Y(f,`scanHexDigits`);function p(e){r=e,i=``,a=0,o=16,d=0}Y(p,`setPosition`);function m(){let t=r;if(e.charCodeAt(r)===48)r++;else for(r++;r<e.length&&fs(e.charCodeAt(r));)r++;if(r<e.length&&e.charCodeAt(r)===46)if(r++,r<e.length&&fs(e.charCodeAt(r)))for(r++;r<e.length&&fs(e.charCodeAt(r));)r++;else return d=3,e.substring(t,r);let n=r;if(r<e.length&&(e.charCodeAt(r)===69||e.charCodeAt(r)===101))if(r++,(r<e.length&&e.charCodeAt(r)===43||e.charCodeAt(r)===45)&&r++,r<e.length&&fs(e.charCodeAt(r))){for(r++;r<e.length&&fs(e.charCodeAt(r));)r++;n=r}else d=3;return e.substring(t,n)}Y(m,`scanNumber`);function h(){let t=``,i=r;for(;;){if(r>=n){t+=e.substring(i,r),d=2;break}let a=e.charCodeAt(r);if(a===34){t+=e.substring(i,r),r++;break}if(a===92){if(t+=e.substring(i,r),r++,r>=n){d=2;break}switch(e.charCodeAt(r++)){case 34:t+=`"`;break;case 92:t+=`\\`;break;case 47:t+=`/`;break;case 98:t+=`\b`;break;case 102:t+=`\f`;break;case 110:t+=`
|
|
72
|
+
`;break;case 114:t+=`\r`;break;case 116:t+=` `;break;case 117:let e=f(4,!0);e>=0?t+=String.fromCharCode(e):d=4;break;default:d=5}i=r;continue}if(a>=0&&a<=31)if(ds(a)){t+=e.substring(i,r),d=2;break}else d=6;r++}return t}Y(h,`scanString`);function g(){if(i=``,d=0,a=r,c=s,u=l,r>=n)return a=n,o=17;let t=e.charCodeAt(r);if(us(t)){do r++,i+=String.fromCharCode(t),t=e.charCodeAt(r);while(us(t));return o=15}if(ds(t))return r++,i+=String.fromCharCode(t),t===13&&e.charCodeAt(r)===10&&(r++,i+=`
|
|
73
|
+
`),s++,l=r,o=14;switch(t){case 123:return r++,o=1;case 125:return r++,o=2;case 91:return r++,o=3;case 93:return r++,o=4;case 58:return r++,o=6;case 44:return r++,o=5;case 34:return r++,i=h(),o=10;case 47:let c=r-1;if(e.charCodeAt(r+1)===47){for(r+=2;r<n&&!ds(e.charCodeAt(r));)r++;return i=e.substring(c,r),o=12}if(e.charCodeAt(r+1)===42){r+=2;let t=n-1,a=!1;for(;r<t;){let t=e.charCodeAt(r);if(t===42&&e.charCodeAt(r+1)===47){r+=2,a=!0;break}r++,ds(t)&&(t===13&&e.charCodeAt(r)===10&&r++,s++,l=r)}return a||(r++,d=1),i=e.substring(c,r),o=13}return i+=String.fromCharCode(t),r++,o=16;case 45:if(i+=String.fromCharCode(t),r++,r===n||!fs(e.charCodeAt(r)))return o=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return i+=m(),o=11;default:for(;r<n&&_(t);)r++,t=e.charCodeAt(r);if(a!==r){switch(i=e.substring(a,r),i){case`true`:return o=8;case`false`:return o=9;case`null`:return o=7}return o=16}return i+=String.fromCharCode(t),r++,o=16}}Y(g,`scanNext`);function _(e){if(us(e)||ds(e))return!1;switch(e){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}Y(_,`isUnknownContentCharacter`);function v(){let e;do e=g();while(e>=12&&e<=15);return e}return Y(v,`scanNextNonTrivia`),{setPosition:p,getPosition:Y(()=>r,`getPosition`),scan:t?v:g,getToken:Y(()=>o,`getToken`),getTokenValue:Y(()=>i,`getTokenValue`),getTokenOffset:Y(()=>a,`getTokenOffset`),getTokenLength:Y(()=>r-a,`getTokenLength`),getTokenStartLine:Y(()=>c,`getTokenStartLine`),getTokenStartCharacter:Y(()=>a-u,`getTokenStartCharacter`),getTokenError:Y(()=>d,`getTokenError`)}}Y(ls,`createScanner`);function us(e){return e===32||e===9}Y(us,`isWhiteSpace`);function ds(e){return e===10||e===13}Y(ds,`isLineBreak`);function fs(e){return e>=48&&e<=57}Y(fs,`isDigit`);var ps;(function(e){e[e.lineFeed=10]=`lineFeed`,e[e.carriageReturn=13]=`carriageReturn`,e[e.space=32]=`space`,e[e._0=48]=`_0`,e[e._1=49]=`_1`,e[e._2=50]=`_2`,e[e._3=51]=`_3`,e[e._4=52]=`_4`,e[e._5=53]=`_5`,e[e._6=54]=`_6`,e[e._7=55]=`_7`,e[e._8=56]=`_8`,e[e._9=57]=`_9`,e[e.a=97]=`a`,e[e.b=98]=`b`,e[e.c=99]=`c`,e[e.d=100]=`d`,e[e.e=101]=`e`,e[e.f=102]=`f`,e[e.g=103]=`g`,e[e.h=104]=`h`,e[e.i=105]=`i`,e[e.j=106]=`j`,e[e.k=107]=`k`,e[e.l=108]=`l`,e[e.m=109]=`m`,e[e.n=110]=`n`,e[e.o=111]=`o`,e[e.p=112]=`p`,e[e.q=113]=`q`,e[e.r=114]=`r`,e[e.s=115]=`s`,e[e.t=116]=`t`,e[e.u=117]=`u`,e[e.v=118]=`v`,e[e.w=119]=`w`,e[e.x=120]=`x`,e[e.y=121]=`y`,e[e.z=122]=`z`,e[e.A=65]=`A`,e[e.B=66]=`B`,e[e.C=67]=`C`,e[e.D=68]=`D`,e[e.E=69]=`E`,e[e.F=70]=`F`,e[e.G=71]=`G`,e[e.H=72]=`H`,e[e.I=73]=`I`,e[e.J=74]=`J`,e[e.K=75]=`K`,e[e.L=76]=`L`,e[e.M=77]=`M`,e[e.N=78]=`N`,e[e.O=79]=`O`,e[e.P=80]=`P`,e[e.Q=81]=`Q`,e[e.R=82]=`R`,e[e.S=83]=`S`,e[e.T=84]=`T`,e[e.U=85]=`U`,e[e.V=86]=`V`,e[e.W=87]=`W`,e[e.X=88]=`X`,e[e.Y=89]=`Y`,e[e.Z=90]=`Z`,e[e.asterisk=42]=`asterisk`,e[e.backslash=92]=`backslash`,e[e.closeBrace=125]=`closeBrace`,e[e.closeBracket=93]=`closeBracket`,e[e.colon=58]=`colon`,e[e.comma=44]=`comma`,e[e.dot=46]=`dot`,e[e.doubleQuote=34]=`doubleQuote`,e[e.minus=45]=`minus`,e[e.openBrace=123]=`openBrace`,e[e.openBracket=91]=`openBracket`,e[e.plus=43]=`plus`,e[e.slash=47]=`slash`,e[e.formFeed=12]=`formFeed`,e[e.tab=9]=`tab`})(ps||={});function ms(e,t,n){let r,i,a,o,s;if(t){for(o=t.offset,s=o+t.length,a=o;a>0&&!vs(e,a-1);)a--;let c=s;for(;c<e.length&&!vs(e,c);)c++;i=e.substring(a,c),r=gs(i,n)}else i=e,r=0,a=0,o=0,s=e.length;let c=_s(n,e),l=0,u=0,d;d=n.insertSpaces?hs(` `,n.tabSize||4):` `;let f=ls(i,!1),p=!1;function m(){return l>1?hs(c,l)+hs(d,r+u):c+hs(d,r+u)}Y(m,`newLinesAndIndent`);function h(){let e=f.scan();for(l=0;e===15||e===14;)e===14&&n.keepLines?l+=1:e===14&&(l=1),e=f.scan();return p=e===16||f.getTokenError()!==0,e}Y(h,`scanNext`);let g=[];function _(n,r,i){!p&&(!t||r<s&&i>o)&&e.substring(r,i)!==n&&g.push({offset:r,length:i-r,content:n})}Y(_,`addEdit`);let v=h();if(n.keepLines&&l>0&&_(hs(c,l),0,0),v!==17){let e=f.getTokenOffset()+a;_(hs(d,r),a,e)}for(;v!==17;){let e=f.getTokenOffset()+f.getTokenLength()+a,t=h(),r=``,i=!1;for(;l===0&&(t===12||t===13);){let n=f.getTokenOffset()+a;_(` `,e,n),e=f.getTokenOffset()+f.getTokenLength()+a,i=t===12,r=i?m():``,t=h()}if(t===2)v!==1&&u--,n.keepLines&&l>0||!n.keepLines&&v!==1?r=m():n.keepLines&&(r=` `);else if(t===4)v!==3&&u--,n.keepLines&&l>0||!n.keepLines&&v!==3?r=m():n.keepLines&&(r=` `);else{switch(v){case 3:case 1:u++,r=n.keepLines&&l>0||!n.keepLines?m():` `;break;case 5:r=n.keepLines&&l>0||!n.keepLines?m():` `;break;case 12:r=m();break;case 13:l>0?r=m():i||(r=` `);break;case 6:n.keepLines&&l>0?r=m():i||(r=` `);break;case 10:n.keepLines&&l>0?r=m():t===6&&!i&&(r=``);break;case 7:case 8:case 9:case 11:case 2:case 4:n.keepLines&&l>0?r=m():(t===12||t===13)&&!i?r=` `:t!==5&&t!==17&&(p=!0);break;case 16:p=!0;break}l>0&&(t===12||t===13)&&(r=m())}t===17&&(r=n.keepLines&&l>0?m():n.insertFinalNewline?c:``);let o=f.getTokenOffset()+a;_(r,e,o),v=t}return g}Y(ms,`format`);function hs(e,t){let n=``;for(let r=0;r<t;r++)n+=e;return n}Y(hs,`repeat`);function gs(e,t){let n=0,r=0,i=t.tabSize||4;for(;n<e.length;){let t=e.charAt(n);if(t===` `)r++;else if(t===` `)r+=i;else break;n++}return Math.floor(r/i)}Y(gs,`computeIndentLevel`);function _s(e,t){for(let e=0;e<t.length;e++){let n=t.charAt(e);if(n===`\r`)return e+1<t.length&&t.charAt(e+1)===`
|
|
74
|
+
`?`\r
|
|
75
|
+
`:`\r`;if(n===`
|
|
76
|
+
`)return`
|
|
77
|
+
`}return e&&e.eol||`
|
|
78
|
+
`}Y(_s,`getEOL`);function vs(e,t){return`\r
|
|
79
|
+
`.indexOf(e.charAt(t))!==-1}Y(vs,`isEOL`);var ys;(function(e){e.DEFAULT={allowTrailingComma:!1}})(ys||={});function bs(e,t=[],n=ys.DEFAULT){let r=null,i=[],a=[];function o(e){Array.isArray(i)?i.push(e):r!==null&&(i[r]=e)}return Y(o,`onValue`),Cs(e,{onObjectBegin:Y(()=>{let e={};o(e),a.push(i),i=e,r=null},`onObjectBegin`),onObjectProperty:Y(e=>{r=e},`onObjectProperty`),onObjectEnd:Y(()=>{i=a.pop()},`onObjectEnd`),onArrayBegin:Y(()=>{let e=[];o(e),a.push(i),i=e,r=null},`onArrayBegin`),onArrayEnd:Y(()=>{i=a.pop()},`onArrayEnd`),onLiteralValue:o,onError:Y((e,n,r)=>{t.push({error:e,offset:n,length:r})},`onError`)},n),i[0]}Y(bs,`parse`);function xs(e,t=[],n=ys.DEFAULT){let r={type:`array`,offset:-1,length:-1,children:[],parent:void 0};function i(e){r.type===`property`&&(r.length=e-r.offset,r=r.parent)}Y(i,`ensurePropertyComplete`);function a(e){return r.children.push(e),e}Y(a,`onValue`),Cs(e,{onObjectBegin:Y(e=>{r=a({type:`object`,offset:e,length:-1,parent:r,children:[]})},`onObjectBegin`),onObjectProperty:Y((e,t,n)=>{r=a({type:`property`,offset:t,length:-1,parent:r,children:[]}),r.children.push({type:`string`,value:e,offset:t,length:n,parent:r})},`onObjectProperty`),onObjectEnd:Y((e,t)=>{i(e+t),r.length=e+t-r.offset,r=r.parent,i(e+t)},`onObjectEnd`),onArrayBegin:Y((e,t)=>{r=a({type:`array`,offset:e,length:-1,parent:r,children:[]})},`onArrayBegin`),onArrayEnd:Y((e,t)=>{r.length=e+t-r.offset,r=r.parent,i(e+t)},`onArrayEnd`),onLiteralValue:Y((e,t,n)=>{a({type:ws(e),offset:t,length:n,parent:r,value:e}),i(t+n)},`onLiteralValue`),onSeparator:Y((e,t,n)=>{r.type===`property`&&(e===`:`?r.colonOffset=t:e===`,`&&i(t))},`onSeparator`),onError:Y((e,n,r)=>{t.push({error:e,offset:n,length:r})},`onError`)},n);let o=r.children[0];return o&&delete o.parent,o}Y(xs,`parseTree`);function Ss(e,t){if(!e)return;let n=e;for(let e of t)if(typeof e==`string`){if(n.type!==`object`||!Array.isArray(n.children))return;let t=!1;for(let r of n.children)if(Array.isArray(r.children)&&r.children[0].value===e&&r.children.length===2){n=r.children[1],t=!0;break}if(!t)return}else{let t=e;if(n.type!==`array`||t<0||!Array.isArray(n.children)||t>=n.children.length)return;n=n.children[t]}return n}Y(Ss,`findNodeAtLocation`);function Cs(e,t,n=ys.DEFAULT){let r=ls(e,!1),i=[];function a(e){return e?()=>e(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter()):()=>!0}Y(a,`toNoArgVisit`);function o(e){return e?()=>e(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>i.slice()):()=>!0}Y(o,`toNoArgVisitWithPath`);function s(e){return e?t=>e(t,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter()):()=>!0}Y(s,`toOneArgVisit`);function c(e){return e?t=>e(t,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>i.slice()):()=>!0}Y(c,`toOneArgVisitWithPath`);let l=o(t.onObjectBegin),u=c(t.onObjectProperty),d=a(t.onObjectEnd),f=o(t.onArrayBegin),p=a(t.onArrayEnd),m=c(t.onLiteralValue),h=s(t.onSeparator),g=a(t.onComment),_=s(t.onError),v=n&&n.disallowComments,ee=n&&n.allowTrailingComma;function y(){for(;;){let e=r.scan();switch(r.getTokenError()){case 4:b(14);break;case 5:b(15);break;case 3:b(13);break;case 1:v||b(11);break;case 2:b(12);break;case 6:b(16);break}switch(e){case 12:case 13:v?b(10):g();break;case 16:b(1);break;case 15:case 14:break;default:return e}}}Y(y,`scanNext`);function b(e,t=[],n=[]){if(_(e),t.length+n.length>0){let e=r.getToken();for(;e!==17;){if(t.indexOf(e)!==-1){y();break}else if(n.indexOf(e)!==-1)break;e=y()}}}Y(b,`handleError`);function x(e){let t=r.getTokenValue();return e?m(t):(u(t),i.push(t)),y(),!0}Y(x,`parseString`);function S(){switch(r.getToken()){case 11:let e=r.getTokenValue(),t=Number(e);isNaN(t)&&(b(2),t=0),m(t);break;case 7:m(null);break;case 8:m(!0);break;case 9:m(!1);break;default:return!1}return y(),!0}Y(S,`parseLiteral`);function C(){return r.getToken()===10?(x(!1),r.getToken()===6?(h(`:`),y(),T()||b(4,[],[2,5])):b(5,[],[2,5]),i.pop(),!0):(b(3,[],[2,5]),!1)}Y(C,`parseProperty`);function te(){l(),y();let e=!1;for(;r.getToken()!==2&&r.getToken()!==17;){if(r.getToken()===5){if(e||b(4,[],[]),h(`,`),y(),r.getToken()===2&&ee)break}else e&&b(6,[],[]);C()||b(4,[],[2,5]),e=!0}return d(),r.getToken()===2?y():b(7,[2],[]),!0}Y(te,`parseObject`);function w(){f(),y();let e=!0,t=!1;for(;r.getToken()!==4&&r.getToken()!==17;){if(r.getToken()===5){if(t||b(4,[],[]),h(`,`),y(),r.getToken()===4&&ee)break}else t&&b(6,[],[]);e?(i.push(0),e=!1):i[i.length-1]++,T()||b(4,[],[4,5]),t=!0}return p(),e||i.pop(),r.getToken()===4?y():b(8,[4],[]),!0}Y(w,`parseArray`);function T(){switch(r.getToken()){case 3:return w();case 1:return te();case 10:return x(!0);default:return S()}}return Y(T,`parseValue`),y(),r.getToken()===17?n.allowEmptyContent?!0:(b(4,[],[]),!1):T()?(r.getToken()!==17&&b(9,[],[]),!0):(b(4,[],[]),!1)}Y(Cs,`visit`);function ws(e){switch(typeof e){case`boolean`:return`boolean`;case`number`:return`number`;case`string`:return`string`;case`object`:return e?Array.isArray(e)?`array`:`object`:`null`;default:return`null`}}Y(ws,`getNodeType`);function Ts(e,t,n,r){let i=t.slice(),a=xs(e,[]),o,s;for(;i.length>0&&(s=i.pop(),o=Ss(a,i),o===void 0&&n!==void 0);)n=typeof s==`string`?{[s]:n}:[n];if(!o){if(n===void 0)throw Error(`Can not delete in empty document`);return Es(e,{offset:a?a.offset:0,length:a?a.length:0,content:JSON.stringify(n)},r)}else if(o.type===`object`&&typeof s==`string`&&Array.isArray(o.children)){let t=Ss(o,[s]);if(t!==void 0)if(n===void 0){if(!t.parent)throw Error(`Malformed AST`);let n=o.children.indexOf(t.parent),i,a=t.parent.offset+t.parent.length;if(n>0){let e=o.children[n-1];i=e.offset+e.length}else i=o.offset+1,o.children.length>1&&(a=o.children[1].offset);return Es(e,{offset:i,length:a-i,content:``},r)}else return Es(e,{offset:t.offset,length:t.length,content:JSON.stringify(n)},r);else{if(n===void 0)return[];let t=`${JSON.stringify(s)}: ${JSON.stringify(n)}`,i=r.getInsertionIndex?r.getInsertionIndex(o.children.map(e=>e.children[0].value)):o.children.length,a;if(i>0){let e=o.children[i-1];a={offset:e.offset+e.length,length:0,content:`,`+t}}else a=o.children.length===0?{offset:o.offset+1,length:0,content:t}:{offset:o.offset+1,length:0,content:t+`,`};return Es(e,a,r)}}else if(o.type===`array`&&typeof s==`number`&&Array.isArray(o.children)){let t=s;if(t===-1){let t=`${JSON.stringify(n)}`,i;if(o.children.length===0)i={offset:o.offset+1,length:0,content:t};else{let e=o.children[o.children.length-1];i={offset:e.offset+e.length,length:0,content:`,`+t}}return Es(e,i,r)}else if(n===void 0&&o.children.length>=0){let t=s,n=o.children[t],i;if(o.children.length===1)i={offset:o.offset+1,length:o.length-2,content:``};else if(o.children.length-1===t){let e=o.children[t-1],n=e.offset+e.length;i={offset:n,length:o.offset+o.length-2-n,content:``}}else i={offset:n.offset,length:o.children[t+1].offset-n.offset,content:``};return Es(e,i,r)}else if(n!==void 0){let t,i=`${JSON.stringify(n)}`;if(!r.isArrayInsertion&&o.children.length>s){let e=o.children[s];t={offset:e.offset,length:e.length,content:i}}else if(o.children.length===0||s===0)t={offset:o.offset+1,length:0,content:o.children.length===0?i:i+`,`};else{let e=s>o.children.length?o.children.length:s,n=o.children[e-1];t={offset:n.offset+n.length,length:0,content:`,`+i}}return Es(e,t,r)}else throw Error(`Can not ${n===void 0?`remove`:r.isArrayInsertion?`insert`:`modify`} Array index ${t} as length is not sufficient`)}else throw Error(`Can not add ${typeof s==`number`?`property`:`index`} to parent of type ${o.type}`)}Y(Ts,`setProperty`);function Es(e,t,n){if(!n.formattingOptions)return[t];let r=Ds(e,t),i=t.offset,a=t.offset+t.content.length;if(t.length===0||t.content.length===0){for(;i>0&&!vs(r,i-1);)i--;for(;a<r.length&&!vs(r,a);)a++}let o=ms(r,{offset:i,length:a-i},{...n.formattingOptions,keepLines:!1});for(let e=o.length-1;e>=0;e--){let t=o[e];r=Ds(r,t),i=Math.min(i,t.offset),a=Math.max(a,t.offset+t.length),a+=t.content.length-t.length}let s=e.length-(r.length-a)-i;return[{offset:i,length:s,content:r.substring(i,a)}]}Y(Es,`withFormatting`);function Ds(e,t){return e.substring(0,t.offset)+t.content+e.substring(t.offset+t.length)}Y(Ds,`applyEdit`);var Os;(function(e){e[e.None=0]=`None`,e[e.UnexpectedEndOfComment=1]=`UnexpectedEndOfComment`,e[e.UnexpectedEndOfString=2]=`UnexpectedEndOfString`,e[e.UnexpectedEndOfNumber=3]=`UnexpectedEndOfNumber`,e[e.InvalidUnicode=4]=`InvalidUnicode`,e[e.InvalidEscapeCharacter=5]=`InvalidEscapeCharacter`,e[e.InvalidCharacter=6]=`InvalidCharacter`})(Os||={});var ks;(function(e){e[e.OpenBraceToken=1]=`OpenBraceToken`,e[e.CloseBraceToken=2]=`CloseBraceToken`,e[e.OpenBracketToken=3]=`OpenBracketToken`,e[e.CloseBracketToken=4]=`CloseBracketToken`,e[e.CommaToken=5]=`CommaToken`,e[e.ColonToken=6]=`ColonToken`,e[e.NullKeyword=7]=`NullKeyword`,e[e.TrueKeyword=8]=`TrueKeyword`,e[e.FalseKeyword=9]=`FalseKeyword`,e[e.StringLiteral=10]=`StringLiteral`,e[e.NumericLiteral=11]=`NumericLiteral`,e[e.LineCommentTrivia=12]=`LineCommentTrivia`,e[e.BlockCommentTrivia=13]=`BlockCommentTrivia`,e[e.LineBreakTrivia=14]=`LineBreakTrivia`,e[e.Trivia=15]=`Trivia`,e[e.Unknown=16]=`Unknown`,e[e.EOF=17]=`EOF`})(ks||={});var As=bs,js;(function(e){e[e.InvalidSymbol=1]=`InvalidSymbol`,e[e.InvalidNumberFormat=2]=`InvalidNumberFormat`,e[e.PropertyNameExpected=3]=`PropertyNameExpected`,e[e.ValueExpected=4]=`ValueExpected`,e[e.ColonExpected=5]=`ColonExpected`,e[e.CommaExpected=6]=`CommaExpected`,e[e.CloseBraceExpected=7]=`CloseBraceExpected`,e[e.CloseBracketExpected=8]=`CloseBracketExpected`,e[e.EndOfFileExpected=9]=`EndOfFileExpected`,e[e.InvalidCommentToken=10]=`InvalidCommentToken`,e[e.UnexpectedEndOfComment=11]=`UnexpectedEndOfComment`,e[e.UnexpectedEndOfString=12]=`UnexpectedEndOfString`,e[e.UnexpectedEndOfNumber=13]=`UnexpectedEndOfNumber`,e[e.InvalidUnicode=14]=`InvalidUnicode`,e[e.InvalidEscapeCharacter=15]=`InvalidEscapeCharacter`,e[e.InvalidCharacter=16]=`InvalidCharacter`})(js||={});function Ms(e){switch(e){case 1:return`InvalidSymbol`;case 2:return`InvalidNumberFormat`;case 3:return`PropertyNameExpected`;case 4:return`ValueExpected`;case 5:return`ColonExpected`;case 6:return`CommaExpected`;case 7:return`CloseBraceExpected`;case 8:return`CloseBracketExpected`;case 9:return`EndOfFileExpected`;case 10:return`InvalidCommentToken`;case 11:return`UnexpectedEndOfComment`;case 12:return`UnexpectedEndOfString`;case 13:return`UnexpectedEndOfNumber`;case 14:return`InvalidUnicode`;case 15:return`InvalidEscapeCharacter`;case 16:return`InvalidCharacter`}return`<unknown ParseErrorCode>`}Y(Ms,`printParseErrorCode`);function Ns(e,t,n){return ms(e,t,n)}Y(Ns,`format`);function Ps(e,t,n,r){return Ts(e,t,n,r)}Y(Ps,`modify`);function Fs(e,t){let n=t.slice(0).sort((e,t)=>{let n=e.offset-t.offset;return n===0?e.length-t.length:n}),r=e.length;for(let t=n.length-1;t>=0;t--){let i=n[t];if(i.offset+i.length<=r)e=Ds(e,i);else throw Error(`Overlapping edit`);r=i.offset}return e}Y(Fs,`applyEdits`);function Is(e,t){let n=e.slice(0,t).split(/\r\n|\n|\r/g);return[n.length,n.pop().length+1]}Y(Is,`getLineColFromPtr`);function Ls(e,t,n){let r=e.split(/\r\n|\n|\r/g),i=``,a=(Math.log10(t+1)|0)+1;for(let e=t-1;e<=t+1;e++){let o=r[e-1];o&&(i+=e.toString().padEnd(a,` `),i+=`: `,i+=o,i+=`
|
|
80
|
+
`,e===t&&(i+=` `.repeat(a+n+2),i+=`^
|
|
81
|
+
`))}return i}Y(Ls,`makeCodeBlock`);var Z=class extends Error{static{Y(this,`TomlError`)}line;column;codeblock;constructor(e,t){let[n,r]=Is(t.toml,t.ptr),i=Ls(t.toml,n,r);super(`Invalid TOML document: ${e}
|
|
82
|
+
|
|
83
|
+
${i}`,t),this.line=n,this.column=r,this.codeblock=i}};function Rs(e,t){let n=0;for(;e[t-++n]===`\\`;);return--n&&n%2}Y(Rs,`isEscaped`);function zs(e,t=0,n=e.length){let r=e.indexOf(`
|
|
84
|
+
`,t);return e[r-1]===`\r`&&r--,r<=n?r:-1}Y(zs,`indexOfNewline`);function Bs(e,t){for(let n=t;n<e.length;n++){let r=e[n];if(r===`
|
|
85
|
+
`)return n;if(r===`\r`&&e[n+1]===`
|
|
86
|
+
`)return n+1;if(r<` `&&r!==` `||r===``)throw new Z(`control characters are not allowed in comments`,{toml:e,ptr:t})}return e.length}Y(Bs,`skipComment`);function Q(e,t,n,r){let i;for(;(i=e[t])===` `||i===` `||!n&&(i===`
|
|
87
|
+
`||i===`\r`&&e[t+1]===`
|
|
88
|
+
`);)t++;return r||i!==`#`?t:Q(e,Bs(e,t),n)}Y(Q,`skipVoid`);function Vs(e,t,n,r,i=!1){if(!r)return t=zs(e,t),t<0?e.length:t;for(let a=t;a<e.length;a++){let t=e[a];if(t===`#`)a=zs(e,a);else if(t===n)return a+1;else if(t===r||i&&(t===`
|
|
89
|
+
`||t===`\r`&&e[a+1]===`
|
|
90
|
+
`))return a}throw new Z(`cannot find end of structure`,{toml:e,ptr:t})}Y(Vs,`skipUntil`);function Hs(e,t){let n=e[t],r=n===e[t+1]&&e[t+1]===e[t+2]?e.slice(t,t+3):n;t+=r.length-1;do t=e.indexOf(r,++t);while(t>-1&&n!==`'`&&Rs(e,t));return t>-1&&(t+=r.length,r.length>1&&(e[t]===n&&t++,e[t]===n&&t++)),t}Y(Hs,`getStringEnd`);var Us=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}:\d{2}(?:\.\d+)?)?(Z|[-+]\d{2}:\d{2})?$/i,Ws=class e extends Date{static{Y(this,`TomlDate`)}#e=!1;#t=!1;#n=null;constructor(e){let t=!0,n=!0,r=`Z`;if(typeof e==`string`){let i=e.match(Us);i?(i[1]||(t=!1,e=`0000-01-01T${e}`),n=!!i[2],n&&e[10]===` `&&(e=e.replace(` `,`T`)),i[2]&&+i[2]>23?e=``:(r=i[3]||null,e=e.toUpperCase(),!r&&n&&(e+=`Z`))):e=``}super(e),isNaN(this.getTime())||(this.#e=t,this.#t=n,this.#n=r)}isDateTime(){return this.#e&&this.#t}isLocal(){return!this.#e||!this.#t||!this.#n}isDate(){return this.#e&&!this.#t}isTime(){return this.#t&&!this.#e}isValid(){return this.#e||this.#t}toISOString(){let e=super.toISOString();if(this.isDate())return e.slice(0,10);if(this.isTime())return e.slice(11,23);if(this.#n===null)return e.slice(0,-1);if(this.#n===`Z`)return e;let t=this.#n.slice(1,3)*60+ +this.#n.slice(4,6);return t=this.#n[0]===`-`?t:-t,new Date(this.getTime()-t*6e4).toISOString().slice(0,-1)+this.#n}static wrapAsOffsetDateTime(t,n=`Z`){let r=new e(t);return r.#n=n,r}static wrapAsLocalDateTime(t){let n=new e(t);return n.#n=null,n}static wrapAsLocalDate(t){let n=new e(t);return n.#t=!1,n.#n=null,n}static wrapAsLocalTime(t){let n=new e(t);return n.#e=!1,n.#n=null,n}},Gs=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,Ks=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,qs=/^[+-]?0[0-9_]/,Js=/^[0-9a-f]{4,8}$/i,Ys={b:`\b`,t:` `,n:`
|
|
91
|
+
`,f:`\f`,r:`\r`,'"':`"`,"\\":`\\`};function Xs(e,t=0,n=e.length){let r=e[t]===`'`,i=e[t++]===e[t]&&e[t]===e[t+1];i&&(n-=2,e[t+=2]===`\r`&&t++,e[t]===`
|
|
92
|
+
`&&t++);let a=0,o,s=``,c=t;for(;t<n-1;){let n=e[t++];if(n===`
|
|
93
|
+
`||n===`\r`&&e[t]===`
|
|
94
|
+
`){if(!i)throw new Z(`newlines are not allowed in strings`,{toml:e,ptr:t-1})}else if(n<` `&&n!==` `||n===``)throw new Z(`control characters are not allowed in strings`,{toml:e,ptr:t-1});if(o){if(o=!1,n===`u`||n===`U`){let r=e.slice(t,t+=n===`u`?4:8);if(!Js.test(r))throw new Z(`invalid unicode escape`,{toml:e,ptr:a});try{s+=String.fromCodePoint(parseInt(r,16))}catch{throw new Z(`invalid unicode escape`,{toml:e,ptr:a})}}else if(i&&(n===`
|
|
95
|
+
`||n===` `||n===` `||n===`\r`)){if(t=Q(e,t-1,!0),e[t]!==`
|
|
96
|
+
`&&e[t]!==`\r`)throw new Z(`invalid escape: only line-ending whitespace may be escaped`,{toml:e,ptr:a});t=Q(e,t)}else if(n in Ys)s+=Ys[n];else throw new Z(`unrecognized escape sequence`,{toml:e,ptr:a});c=t}else !r&&n===`\\`&&(a=t-1,o=!0,s+=e.slice(c,a))}return s+e.slice(c,n-1)}Y(Xs,`parseString`);function Zs(e,t,n,r){if(e===`true`)return!0;if(e===`false`)return!1;if(e===`-inf`)return-1/0;if(e===`inf`||e===`+inf`)return 1/0;if(e===`nan`||e===`+nan`||e===`-nan`)return NaN;if(e===`-0`)return r?0n:0;let i=Gs.test(e);if(i||Ks.test(e)){if(qs.test(e))throw new Z(`leading zeroes are not allowed`,{toml:t,ptr:n});e=e.replace(/_/g,``);let a=+e;if(isNaN(a))throw new Z(`invalid number`,{toml:t,ptr:n});if(i){if((i=!Number.isSafeInteger(a))&&!r)throw new Z(`integer value cannot be represented losslessly`,{toml:t,ptr:n});(i||r===!0)&&(a=BigInt(e))}return a}let a=new Ws(e);if(!a.isValid())throw new Z(`invalid value`,{toml:t,ptr:n});return a}Y(Zs,`parseValue`);function Qs(e,t,n,r){let i=e.slice(t,n),a=i.indexOf(`#`);a>-1&&(Bs(e,a),i=i.slice(0,a));let o=i.trimEnd();if(!r){let n=i.indexOf(`
|
|
97
|
+
`,o.length);if(n>-1)throw new Z(`newlines are not allowed in inline tables`,{toml:e,ptr:t+n})}return[o,a]}Y(Qs,`sliceAndTrimEndOf`);function $s(e,t,n,r,i){if(r===0)throw new Z(`document contains excessively nested structures. aborting.`,{toml:e,ptr:t});let a=e[t];if(a===`[`||a===`{`){let[o,s]=a===`[`?rc(e,t,r,i):nc(e,t,r,i),c=n?Vs(e,s,`,`,n):s;if(s-c&&n===`}`){let t=zs(e,s,c);if(t>-1)throw new Z(`newlines are not allowed in inline tables`,{toml:e,ptr:t})}return[o,c]}let o;if(a===`"`||a===`'`){o=Hs(e,t);let r=Xs(e,t,o);if(n){if(o=Q(e,o,n!==`]`),e[o]&&e[o]!==`,`&&e[o]!==n&&e[o]!==`
|
|
98
|
+
`&&e[o]!==`\r`)throw new Z(`unexpected character encountered`,{toml:e,ptr:o});o+=+(e[o]===`,`)}return[r,o]}o=Vs(e,t,`,`,n);let s=Qs(e,t,o-+(e[o-1]===`,`),n===`]`);if(!s[0])throw new Z(`incomplete key-value declaration: no value specified`,{toml:e,ptr:t});return n&&s[1]>-1&&(o=Q(e,t+s[1]),o+=+(e[o]===`,`)),[Zs(s[0],e,t,i),o]}Y($s,`extractValue`);var ec=/^[a-zA-Z0-9-_]+[ \t]*$/;function tc(e,t,n=`=`){let r=t-1,i=[],a=e.indexOf(n,t);if(a<0)throw new Z(`incomplete key-value: cannot find end of key`,{toml:e,ptr:t});do{let o=e[t=++r];if(o!==` `&&o!==` `)if(o===`"`||o===`'`){if(o===e[t+1]&&o===e[t+2])throw new Z(`multiline strings are not allowed in keys`,{toml:e,ptr:t});let s=Hs(e,t);if(s<0)throw new Z(`unfinished string encountered`,{toml:e,ptr:t});r=e.indexOf(`.`,s);let c=e.slice(s,r<0||r>a?a:r),l=zs(c);if(l>-1)throw new Z(`newlines are not allowed in keys`,{toml:e,ptr:t+r+l});if(c.trimStart())throw new Z(`found extra tokens after the string part`,{toml:e,ptr:s});if(a<s&&(a=e.indexOf(n,s),a<0))throw new Z(`incomplete key-value: cannot find end of key`,{toml:e,ptr:t});i.push(Xs(e,t,s))}else{r=e.indexOf(`.`,t);let n=e.slice(t,r<0||r>a?a:r);if(!ec.test(n))throw new Z(`only letter, numbers, dashes and underscores are allowed in keys`,{toml:e,ptr:t});i.push(n.trimEnd())}}while(r+1&&r<a);return[i,Q(e,a+1,!0,!0)]}Y(tc,`parseKey`);function nc(e,t,n,r){let i={},a=new Set,o,s=0;for(t++;(o=e[t++])!==`}`&&o;){let c={toml:e,ptr:t-1};if(o===`
|
|
99
|
+
`)throw new Z(`newlines are not allowed in inline tables`,c);if(o===`#`)throw new Z(`inline tables cannot contain comments`,c);if(o===`,`)throw new Z(`expected key-value, found comma`,c);if(o!==` `&&o!==` `){let o,c=i,l=!1,[u,d]=tc(e,t-1);for(let n=0;n<u.length;n++){if(n&&(c=l?c[o]:c[o]={}),o=u[n],(l=Object.hasOwn(c,o))&&(typeof c[o]!=`object`||a.has(c[o])))throw new Z(`trying to redefine an already defined value`,{toml:e,ptr:t});!l&&o===`__proto__`&&Object.defineProperty(c,o,{enumerable:!0,configurable:!0,writable:!0})}if(l)throw new Z(`trying to redefine an already defined value`,{toml:e,ptr:t});let[f,p]=$s(e,d,`}`,n-1,r);a.add(f),c[o]=f,t=p,s=e[t-1]===`,`?t-1:0}}if(s)throw new Z(`trailing commas are not allowed in inline tables`,{toml:e,ptr:s});if(!o)throw new Z(`unfinished table encountered`,{toml:e,ptr:t});return[i,t]}Y(nc,`parseInlineTable`);function rc(e,t,n,r){let i=[],a;for(t++;(a=e[t++])!==`]`&&a;)if(a===`,`)throw new Z(`expected value, found comma`,{toml:e,ptr:t-1});else if(a===`#`)t=Bs(e,t);else if(a!==` `&&a!==` `&&a!==`
|
|
100
|
+
`&&a!==`\r`){let a=$s(e,t-1,`]`,n-1,r);i.push(a[0]),t=a[1]}if(!a)throw new Z(`unfinished array encountered`,{toml:e,ptr:t});return[i,t]}Y(rc,`parseArray`);function ic(e,t,n,r){let i=t,a=n,o,s=!1,c;for(let t=0;t<e.length;t++){if(t){if(i=s?i[o]:i[o]={},a=(c=a[o]).c,r===0&&(c.t===1||c.t===2))return null;if(c.t===2){let e=i.length-1;i=i[e],a=a[e].c}}if(o=e[t],(s=Object.hasOwn(i,o))&&a[o]?.t===0&&a[o]?.d)return null;s||(o===`__proto__`&&(Object.defineProperty(i,o,{enumerable:!0,configurable:!0,writable:!0}),Object.defineProperty(a,o,{enumerable:!0,configurable:!0,writable:!0})),a[o]={t:t<e.length-1&&r===2?3:r,d:!1,i:0,c:{}})}if(c=a[o],c.t!==r&&!(r===1&&c.t===3)||(r===2&&(c.d||(c.d=!0,i[o]=[]),i[o].push(i={}),c.c[c.i++]=c={t:1,d:!1,i:0,c:{}}),c.d))return null;if(c.d=!0,r===1)i=s?i[o]:i[o]={};else if(r===0&&s)return null;return[o,i,c.c]}Y(ic,`peekTable`);function ac(e,{maxDepth:t=1e3,integersAsBigInt:n}={}){let r={},i={},a=r,o=i;for(let s=Q(e,0);s<e.length;){if(e[s]===`[`){let t=e[++s]===`[`,n=tc(e,s+=+t,`]`);if(t){if(e[n[1]-1]!==`]`)throw new Z(`expected end of table declaration`,{toml:e,ptr:n[1]-1});n[1]++}let c=ic(n[0],r,i,t?2:1);if(!c)throw new Z(`trying to redefine an already defined table or value`,{toml:e,ptr:s});o=c[2],a=c[1],s=n[1]}else{let r=tc(e,s),i=ic(r[0],a,o,0);if(!i)throw new Z(`trying to redefine an already defined table or value`,{toml:e,ptr:s});let c=$s(e,r[1],void 0,t,n);i[1][i[0]]=c[0],s=c[1]}if(s=Q(e,s,!0),e[s]&&e[s]!==`
|
|
101
|
+
`&&e[s]!==`\r`)throw new Z(`each key-value declaration must be followed by an end-of-line`,{toml:e,ptr:s});s=Q(e,s)}return r}Y(ac,`parse`);var oc=/^[a-z0-9-_]+$/i;function sc(e){let t=typeof e;if(t===`object`){if(Array.isArray(e))return`array`;if(e instanceof Date)return`date`}return t}Y(sc,`extendedTypeOf`);function cc(e){for(let t=0;t<e.length;t++)if(sc(e[t])!==`object`)return!1;return e.length!=0}Y(cc,`isArrayOfTables`);function lc(e){return JSON.stringify(e).replace(/\x7f/g,`\\u007f`)}Y(lc,`formatString`);function uc(e,t,n,r){if(n===0)throw Error(`Could not stringify the object: maximum object depth exceeded`);if(t===`number`)return isNaN(e)?`nan`:e===1/0?`inf`:e===-1/0?`-inf`:r&&Number.isInteger(e)?e.toFixed(1):e.toString();if(t===`bigint`||t===`boolean`)return e.toString();if(t===`string`)return lc(e);if(t===`date`){if(isNaN(e.getTime()))throw TypeError(`cannot serialize invalid date`);return e.toISOString()}if(t===`object`)return dc(e,n,r);if(t===`array`)return fc(e,n,r)}Y(uc,`stringifyValue`);function dc(e,t,n){let r=Object.keys(e);if(r.length===0)return`{}`;let i=`{ `;for(let a=0;a<r.length;a++){let o=r[a];a&&(i+=`, `),i+=oc.test(o)?o:lc(o),i+=` = `,i+=uc(e[o],sc(e[o]),t-1,n)}return i+` }`}Y(dc,`stringifyInlineTable`);function fc(e,t,n){if(e.length===0)return`[]`;let r=`[ `;for(let i=0;i<e.length;i++){if(i&&(r+=`, `),e[i]===null||e[i]===void 0)throw TypeError(`arrays cannot contain null or undefined values`);r+=uc(e[i],sc(e[i]),t-1,n)}return r+` ]`}Y(fc,`stringifyArray`);function pc(e,t,n,r){if(n===0)throw Error(`Could not stringify the object: maximum object depth exceeded`);let i=``;for(let a=0;a<e.length;a++)i+=`${i&&`
|
|
102
|
+
`}[[${t}]]
|
|
103
|
+
`,i+=mc(0,e[a],t,n,r);return i}Y(pc,`stringifyArrayTable`);function mc(e,t,n,r,i){if(r===0)throw Error(`Could not stringify the object: maximum object depth exceeded`);let a=``,o=``,s=Object.keys(t);for(let e=0;e<s.length;e++){let c=s[e];if(t[c]!==null&&t[c]!==void 0){let e=sc(t[c]);if(e===`symbol`||e===`function`)throw TypeError(`cannot serialize values of type '${e}'`);let s=oc.test(c)?c:lc(c);if(e===`array`&&cc(t[c]))o+=(o&&`
|
|
104
|
+
`)+pc(t[c],n?`${n}.${s}`:s,r-1,i);else if(e===`object`){let e=n?`${n}.${s}`:s;o+=(o&&`
|
|
105
|
+
`)+mc(e,t[c],e,r-1,i)}else a+=s,a+=` = `,a+=uc(t[c],e,r,i),a+=`
|
|
106
|
+
`}}return e&&(a||!o)&&(a=a?`[${e}]
|
|
107
|
+
${a}`:`[${e}]`),a&&o?`${a}
|
|
108
|
+
${o}`:a||o}Y(mc,`stringifyTable`);function hc(e,{maxDepth:t=1e3,numbersAsFloat:n=!1}={}){if(sc(e)!==`object`)throw TypeError(`stringify can only be called with an object`);let r=mc(0,e,``,t,n);return r[r.length-1]===`
|
|
109
|
+
`?r:r+`
|
|
110
|
+
`}Y(hc,`stringify`);var gc={parse:ac,stringify:hc,TomlDate:Ws,TomlError:Z},_c=class extends X{static{Y(this,`ParseError`)}text;notes;location;kind;constructor({text:e,notes:t,location:n,kind:r,telemetryMessage:i}){super(e,{telemetryMessage:i}),this.name=this.constructor.name,this.text=e,this.notes=t??[],this.location=n,this.kind=r??`error`}};(class extends _c{static{Y(this,`APIError`)}#e;code;accountTag;meta;retryAfterMs;constructor({status:e,retryAfterMs:t,...n}){super(n),this.name=this.constructor.name,this.#e=e,this.retryAfterMs=t}get status(){return this.#e}isGatewayError(){return this.#e===void 0?!1:[524].includes(this.#e)}isRetryable(){return String(this.#e).startsWith(`5`)}#t=!0;get reportable(){return this.#t}preventReport(){this.#t=!1}});function vc(e,t){try{return gc.parse(e)}catch(n){if(!(n instanceof Z))throw n;let r={lineText:e.split(`
|
|
111
|
+
`)[n.line-1],line:n.line,column:n.column-1,file:t,fileText:e};throw new _c({text:n.message.substring(0,n.message.indexOf(`
|
|
112
|
+
`)),location:r,telemetryMessage:`TOML parse error`})}}Y(vc,`parseTOML`);function yc(e,t){return bc(e,t)}Y(yc,`parsePackageJSON`);function bc(e,t){return xc(e,t,{allowEmptyContent:!1,allowTrailingComma:!1,disallowComments:!0})}Y(bc,`parseJSON`);function xc(e,t,n={allowTrailingComma:!0}){let r=[],i=As(e,r,n);if(r.length)throw new _c({text:Ms(r[0].error),location:{...wc({file:t,fileText:e},r[0].offset+1),length:r[0].length},telemetryMessage:`JSON(C) parse error`});return i}Y(xc,`parseJSONC`);function Sc(e){try{return d(e)}catch(t){let{message:n}=t;throw new _c({text:`Could not read file: ${e}`,notes:[{text:n.replace(e,v(e))}],telemetryMessage:!1})}}Y(Sc,`readFileSyncToBuffer`);function Cc(e){try{return jc(d(e),e)}catch(t){if(t instanceof _c)throw t;let{message:n}=t;throw new _c({text:`Could not read file: ${e}`,notes:[{text:n.replace(e,v(e))}],telemetryMessage:`Could not read file`})}}Y(Cc,`readFileSync`);function wc(e,t){let n,r=0,i=0,a=0,{fileText:o=``}=e;for(let e of o.split(`
|
|
113
|
+
`))if(r++,a+=e.length+1,a>=t){n=e,i=e.length-(a-t);break}return{lineText:n,line:r,column:i,...e}}Y(wc,`indexLocation`);function Tc(e,t){let n,r,i=0,a=0,o=String(t),{fileText:s=``}=e;for(let e of s.split(`
|
|
114
|
+
`)){i++;let t=e.indexOf(o);if(t>=0){n=e,a=t,r=o.length;break}}return{lineText:n,line:i,column:a,length:r,...e}}Y(Tc,`searchLocation`);var Ec={nanoseconds:1e-9,nanosecond:1e-9,microseconds:1e-6,microsecond:1e-6,milliseconds:.001,millisecond:.001,seconds:1,second:1,minutes:60,minute:60,hours:3600,hour:3600,days:86400,day:86400,weeks:604800,week:604800,month:18144e3,year:220752e3,nsecs:1e-9,nsec:1e-9,usecs:1e-6,usec:1e-6,msecs:.001,msec:.001,secs:1,sec:1,mins:60,min:60,ns:1e-9,us:1e-6,ms:.001,mo:18144e3,yr:220752e3,s:1,m:60,h:3600,d:86400,w:604800,y:220752e3};function Dc(e){let t=new Map(Object.entries(Ec));e=e.trim().toLowerCase();let n=1;for(let[r,i]of t)if(e.endsWith(r)){e=e.substring(0,e.length-r.length),n=t.get(r)||1;break}return Number(e)*n}Y(Dc,`parseHumanDuration`);function Oc(e){if(e==null||e.includes(`-`))return e;if(e.length!=32)return null;let t=[];t.push(e.slice(0,8)),t.push(e.slice(8,12)),t.push(e.slice(12,16)),t.push(e.slice(16,20)),t.push(e.slice(20));let n=``;return t.forEach(e=>n+=e+`-`),n.slice(0,36)}Y(Oc,`parseNonHyphenedUuid`);function kc(e,t=void 0){let n=e.match(/^(\d*\.*\d*)\s*([kKmMgGtTpP]{0,1})([i]{0,1}[bB]{0,1})$/);if(!n)return NaN;let r=n[1];if(r.length===0||isNaN(Number(r)))return NaN;let i=n[2].toLowerCase(),a={k:1,m:2,g:3,t:4,p:5};if(i.length!==0&&!(i in a))return NaN;let o=n[3].toLowerCase()==`ib`;if(o&&i.length===0)return NaN;let s=a[i]||0;return Math.floor(Number(r)*(t??(o?1024:1e3))**+s)}Y(kc,`parseByteSize`);var Ac=[{buffer:Buffer.from([0,0,254,255]),encoding:`UTF-32 BE`},{buffer:Buffer.from([255,254,0,0]),encoding:`UTF-32 LE`},{buffer:Buffer.from([254,255]),encoding:`UTF-16 BE`},{buffer:Buffer.from([255,254]),encoding:`UTF-16 LE`}];function jc(e,t){for(let n of Ac)if(e.length>=n.buffer.length&&e.subarray(0,n.buffer.length).equals(n.buffer))throw new _c({text:`Configuration file contains ${n.encoding} byte order marker`,notes:[{text:`The file "${t}" appears to be encoded as ${n.encoding}. Please save the file as UTF-8 without BOM.`}],location:{file:t,line:1,column:0},telemetryMessage:`${n.encoding} BOM detected`});let n=e.toString(`utf-8`);return n.charCodeAt(0)===65279?n.slice(1):n}Y(jc,`removeBOMAndValidate`);var Mc=`.wrangler/deploy/config.json`;function Nc(e,t){return g(e)?e:v(t||`.`,e)}Y(Nc,`absolute`);function Pc(e,t){let{last:n,cwd:r}=t||{},i=Nc(e,r),a=Nc(n||`/`,r),o,s=[];for(;o!==a&&(s.push(i),i=h(o=i),i!==o););return s}Y(Pc,`up`);function Fc(e,t){let n,r;for(n of Pc(t&&t.cwd||``,t))try{if(r=_(n,e),f(r).isFile())return r}catch{}}Y(Fc,`file`);function Ic(e,t){let n,r;for(n of Pc(t&&t.cwd||``,t))try{if(r=_(n,e),f(r).isDirectory())return r}catch{}}Y(Ic,`dir`);function Lc(e){var t=[...arguments].slice(1),n=Array.from(typeof e==`string`?[e]:e);n[n.length-1]=n[n.length-1].replace(/\r?\n([\t ]*)$/,``);var r=n.reduce(function(e,t){var n=t.match(/\n([\t ]+|(?!\s).)/g);return n?e.concat(n.map(function(e){return e.match(/[\t ]/g)?.length??0})):e},[]);if(r.length){var i=RegExp(`
|
|
115
|
+
[ ]{`+Math.min.apply(Math,r)+`}`,`g`);n=n.map(function(e){return e.replace(i,`
|
|
116
|
+
`)})}n[0]=n[0].replace(/^\r?\n/,``);var a=n[0];return t.forEach(function(e,t){var r=a.match(/(?:^|\n)( *)$/),i=r?r[1]:``,o=e;typeof e==`string`&&e.includes(`
|
|
117
|
+
`)&&(o=String(e).split(`
|
|
118
|
+
`).map(function(e,t){return t===0?e:``+i+e}).join(`
|
|
119
|
+
`)),a+=o+n[t+1]}),a}Y(Lc,`dedent`);var Rc=Lc;function zc({config:e,script:t},n){return e===void 0?Bc(t===void 0?process.cwd():m.dirname(t),n):{userConfigPath:e,configPath:e,deployConfigPath:void 0,redirected:!1}}Y(zc,`resolveWranglerConfigPath`);function Bc(e=process.cwd(),{useRedirectIfAvailable:t=!1}={}){let n=Fc(`wrangler.json`,{cwd:e})??Fc(`wrangler.jsonc`,{cwd:e})??Fc(`wrangler.toml`,{cwd:e});if(!t)return{userConfigPath:n,configPath:n,deployConfigPath:void 0,redirected:!1};let{configPath:r,deployConfigPath:i,redirected:a}=Vc(e,n);return{userConfigPath:n,configPath:r,deployConfigPath:i,redirected:a}}Y(Bc,`findWranglerConfig`);function Vc(e,t){let n=Fc(Mc,{cwd:e});if(n===void 0)return{configPath:t,deployConfigPath:n,redirected:!1};let r,i=Cc(n);try{let e=xc(i,n);r=e.configPath&&m.resolve(m.dirname(n),e.configPath)}catch(e){throw new X(`Failed to parse the deploy configuration file at ${m.relative(`.`,n)}`,{cause:e,telemetryMessage:!1})}if(!r)throw new X(Rc`
|
|
120
|
+
A deploy configuration file was found at "${m.relative(`.`,n)}".
|
|
121
|
+
But this is not valid - the required "configPath" property was not found.
|
|
122
|
+
Instead this file contains:
|
|
123
|
+
\`\`\`
|
|
124
|
+
${i}
|
|
125
|
+
\`\`\`
|
|
126
|
+
`,{telemetryMessage:!1});if(!u(r))throw new X(Rc`
|
|
127
|
+
There is a deploy configuration at "${m.relative(`.`,n)}".
|
|
128
|
+
But the redirected configuration path it points to, "${m.relative(`.`,r)}", does not exist.
|
|
129
|
+
`,{telemetryMessage:!1});if(t&&m.join(m.dirname(t),Mc)!==n)throw new X(Rc`
|
|
130
|
+
Found both a user configuration file at "${m.relative(`.`,t)}"
|
|
131
|
+
and a deploy configuration file at "${m.relative(`.`,n)}".
|
|
132
|
+
But these do not share the same base path so it is not clear which should be used.
|
|
133
|
+
`,{telemetryMessage:!1});return{configPath:r,deployConfigPath:n,redirected:!0}}Y(Vc,`findRedirectedWranglerConfig`);function Hc(e){return e.configPath!==void 0&&e.configPath!==e.userConfigPath}Y(Hc,`isRedirectedConfig`);function Uc(e,t,n){return Hc({configPath:t,userConfigPath:n})}Y(Uc,`isRedirectedRawConfig`);function Wc(e){return e?.endsWith(`toml`)?`toml`:e?.endsWith(`jsonc`)?`jsonc`:e?.endsWith(`json`)?`json`:`none`}Y(Wc,`configFormat`);function Gc(e){switch(Wc(e)){case`toml`:return`wrangler.toml`;case`json`:return`wrangler.json`;case`jsonc`:return`wrangler.jsonc`;default:return`Wrangler configuration`}}Y(Gc,`configFileName`);function Kc(e,t,n=!0){return Wc(t)===`toml`?gc.stringify(e):n?JSON.stringify(e,null,2):JSON.stringify(e)}Y(Kc,`formatConfigSnippet`);function qc(e,t){let n={};return Yc(e,n),Qc(e,n),$c(e,n),tl(e,n),el(e,n),nl(e,n),t!==void 0&&Jc(t,n),n}function Jc(e,t){e.accountId!==void 0&&(t.account_id=e.accountId),e.complianceRegion!==void 0&&(t.compliance_region=e.complianceRegion===`fedramp-high`?`fedramp_high`:`public`)}function Yc(e,t){if(e.name!==void 0&&(t.name=e.name),typeof e.entrypoint==`string`&&(t.main=e.entrypoint),e.compatibilityDate!==void 0&&(t.compatibility_date=e.compatibilityDate),e.compatibilityFlags!==void 0&&(t.compatibility_flags=e.compatibilityFlags),e.workersDev!==void 0&&(t.workers_dev=e.workersDev),e.previewUrls!==void 0&&(t.preview_urls=e.previewUrls),e.logpush!==void 0&&(t.logpush=e.logpush),e.firstPartyWorker!==void 0&&(t.first_party_worker=e.firstPartyWorker),e.placement!==void 0&&(t.placement=e.placement),e.limits!==void 0){let n={};e.limits.cpuMs!==void 0&&(n.cpu_ms=e.limits.cpuMs),e.limits.subrequests!==void 0&&(n.subrequests=e.limits.subrequests),t.limits=n}if(e.observability!==void 0&&(t.observability=Xc(e.observability)),e.cache!==void 0){let n={enabled:e.cache.enabled};e.cache.crossVersionCache!==void 0&&(n.cross_version_cache=e.cache.crossVersionCache),t.cache=n}e.unsafe!==void 0&&(t.unsafe=Zc(e.unsafe))}function Xc(e){let t={};if(e.enabled!==void 0&&(t.enabled=e.enabled),e.headSamplingRate!==void 0&&(t.head_sampling_rate=e.headSamplingRate),e.logs!==void 0){let n={},{logs:r}=e;r.enabled!==void 0&&(n.enabled=r.enabled),r.headSamplingRate!==void 0&&(n.head_sampling_rate=r.headSamplingRate),r.invocationLogs!==void 0&&(n.invocation_logs=r.invocationLogs),r.persist!==void 0&&(n.persist=r.persist),r.destinations!==void 0&&(n.destinations=r.destinations),t.logs=n}if(e.traces!==void 0){let n={},{traces:r}=e;r.enabled!==void 0&&(n.enabled=r.enabled),r.headSamplingRate!==void 0&&(n.head_sampling_rate=r.headSamplingRate),r.persist!==void 0&&(n.persist=r.persist),r.destinations!==void 0&&(n.destinations=r.destinations),t.traces=n}return t}function Zc(e){let t={};return e.metadata!==void 0&&(t.metadata=e.metadata),e.capnp!==void 0&&(`compiledSchema`in e.capnp&&e.capnp.compiledSchema?t.capnp={compiled_schema:e.capnp.compiledSchema}:`basePath`in e.capnp&&e.capnp.basePath&&(t.capnp={base_path:e.capnp.basePath,source_schemas:e.capnp.sourceSchemas??[]})),t}function Qc(e,t){let n,r=e.env??{},i=[],a=[],o=[],s=[],c=[],l=[],u=[],d=[],f=[],p=[],m=[],h=[],g=[],_=[],v=[],ee=[],y=[],b=[],x=[],S=[],C=[],te=[],w=[],T=[],ne=[],re=[],E={},ie=[];for(let[e,w]of Object.entries(r)){if(Ro(w)){re.push({...w,name:e,type:w.type.slice(7)});continue}switch(w.type){case`agent-memory`:m.push($({binding:e,namespace:w.namespace,remote:w.remote}));break;case`ai`:t.ai=$({binding:e,remote:w.remote});break;case`ai-search`:f.push($({binding:e,instance_name:w.name,remote:w.remote}));break;case`ai-search-namespace`:p.push($({binding:e,namespace:w.namespace,remote:w.remote}));break;case`analytics-engine-dataset`:h.push($({binding:e,dataset:w.name}));break;case`artifacts`:g.push($({binding:e,namespace:w.namespace,remote:w.remote}));break;case`assets`:n=e;break;case`browser`:t.browser=$({binding:e,remote:w.remote});break;case`d1`:a.push($({binding:e,database_id:w.id,database_name:w.name,remote:w.remote}));break;case`dispatch-namespace`:{let t={binding:e,namespace:w.namespace};w.outbound&&(t.outbound=$({service:w.outbound.workerName,parameters:w.outbound.parameters})),w.remote!==void 0&&(t.remote=w.remote),_.push(t);break}case`durable-object`:te.push({name:e,class_name:w.exportName,script_name:w.workerName});break;case`flagship`:d.push($({binding:e,app_id:w.id,remote:w.remote}));break;case`hyperdrive`:l.push($({binding:e,id:w.id,localConnectionString:w.localConnectionString}));break;case`images`:t.images=$({binding:e,remote:w.remote});break;case`json`:E[e]=w.value;break;case`kv`:i.push($({binding:e,id:w.id,remote:w.remote}));break;case`logfwdr`:ne.push({name:e,destination:w.destination});break;case`media`:t.media=$({binding:e,remote:w.remote});break;case`mtls-certificate`:c.push($({binding:e,certificate_id:w.id,remote:w.remote}));break;case`pipeline`:u.push($({binding:e,stream:w.name,remote:w.remote}));break;case`queue`:T.push($({binding:e,queue:w.name,delivery_delay:w.deliveryDelay,remote:w.remote}));break;case`rate-limit`:S.push({name:e,namespace_id:w.namespace,simple:w.simple});break;case`r2`:o.push($({binding:e,bucket_name:w.name,jurisdiction:w.jurisdiction,remote:w.remote}));break;case`secret`:ie.push(e);break;case`secrets-store-secret`:v.push({binding:e,store_id:w.storeId,secret_name:w.secretName});break;case`send-email`:ee.push($({name:e,destination_address:w.destinationAddress,allowed_destination_addresses:w.allowedDestinationAddresses,allowed_sender_addresses:w.allowedSenderAddresses,remote:w.remote}));break;case`stream`:t.stream=$({binding:e,remote:w.remote});break;case`text`:E[e]=w.value;break;case`vectorize`:s.push($({binding:e,index_name:w.name,remote:w.remote}));break;case`version-metadata`:t.version_metadata={binding:e};break;case`vpc-service`:y.push($({binding:e,service_id:w.id,remote:w.remote}));break;case`vpc-network`:w.tunnelId===void 0?w.networkId!==void 0&&b.push($({binding:e,network_id:w.networkId,remote:w.remote})):b.push($({binding:e,tunnel_id:w.tunnelId,remote:w.remote}));break;case`web-search`:t.websearch=$({binding:e,remote:w.remote});break;case`worker`:C.push($({binding:e,service:w.workerName,entrypoint:w.exportName,props:w.props,remote:w.remote}));break;case`worker-loader`:x.push({binding:e});break}}if(i.length&&(t.kv_namespaces=i),a.length&&(t.d1_databases=a),o.length&&(t.r2_buckets=o),s.length&&(t.vectorize=s),c.length&&(t.mtls_certificates=c),l.length&&(t.hyperdrive=l),u.length&&(t.pipelines=u),d.length&&(t.flagship=d),f.length&&(t.ai_search=f),p.length&&(t.ai_search_namespaces=p),m.length&&(t.agent_memory=m),h.length&&(t.analytics_engine_datasets=h),g.length&&(t.artifacts=g),_.length&&(t.dispatch_namespaces=_),v.length&&(t.secrets_store_secrets=v),ee.length&&(t.send_email=ee),y.length&&(t.vpc_services=y),b.length&&(t.vpc_networks=b),x.length&&(t.worker_loaders=x),S.length&&(t.ratelimits=S),C.length&&(t.services=C),te.length&&(t.durable_objects={bindings:te}),w.length&&(t.workflows=w),T.length&&(t.queues={...t.queues??{},producers:T}),ne.length&&(t.logfwdr={bindings:ne}),re.length&&(t.unsafe={...t.unsafe??{},bindings:re}),Object.keys(E).length&&(t.vars=E),ie.length&&(t.secrets={required:ie}),e.assets!==void 0||n!==void 0){let r={};n!==void 0&&(r.binding=n),e.assets?.htmlHandling!==void 0&&(r.html_handling=e.assets.htmlHandling),e.assets?.notFoundHandling!==void 0&&(r.not_found_handling=e.assets.notFoundHandling),e.assets?.runWorkerFirst!==void 0&&(r.run_worker_first=e.assets.runWorkerFirst),t.assets=r}}function $c(e,t){let n=e.exports;if(!n)return;let r={},i={};for(let[e,t]of Object.entries(n)){if(t.type===`worker`){r[e]=t;continue}if(t.type!==`durable-object`){i[e]=t;continue}switch(t.state){case void 0:case`created`:r[e]={type:`durable-object`,storage:t.storage};break;case`deleted`:r[e]={type:`durable-object`,state:`deleted`};break;case`renamed`:r[e]={type:`durable-object`,state:`renamed`,renamed_to:t.renamedTo};break;case`transferred`:r[e]={type:`durable-object`,state:`transferred`,transferred_to:t.transferredTo};break;case`expecting-transfer`:r[e]={type:`durable-object`,state:`expecting-transfer`,storage:t.storage,transfer_from:t.transferFrom};break}}if(Object.keys(i).length>0)throw new X(`Unknown export types found: `+Object.entries(i).map(([e,{type:t}])=>`- ${e} : ${t}`).join(`
|
|
134
|
+
`),{telemetryMessage:`Unknown export types found`});Object.keys(r).length>0&&(t.exports=r)}function el(e,t){let n=e.triggers;if(!n||n.length===0)return;let r=[],i=t.routes?[...t.routes]:[],a=t.queues?.consumers?[...t.queues.consumers]:[],o;for(let e of n)switch(e.type){case`email`:o??=[],o.push(...e.addresses);break;case`scheduled`:r.push(e.schedule);break;case`fetch`:e.zone===void 0?i.push(e.pattern):e.zone.includes(`.`)?i.push({pattern:e.pattern,zone_name:e.zone}):i.push({pattern:e.pattern,zone_id:e.zone});break;case`queue`:a.push($({queue:e.name,dead_letter_queue:e.deadLetterQueue,max_batch_size:e.maxBatchSize,max_batch_timeout:e.maxBatchTimeout,max_concurrency:e.maxConcurrency,max_retries:e.maxRetries,retry_delay:e.retryDelay,visibility_timeout_ms:e.visibilityTimeoutMs}));break}r.length&&(t.triggers={crons:r}),i.length&&(t.routes=i),a.length&&(t.queues={...t.queues??{},consumers:a}),o!==void 0&&(t.addresses=o)}function tl(e,t){if(!e.domains||e.domains.length===0)return;let n=t.routes?[...t.routes]:[];for(let t of e.domains)n.push({pattern:t,custom_domain:!0});t.routes=n}function nl(e,t){let n=e.tailConsumers;if(!n||n.length===0)return;let r=[],i=[];for(let e of n)e.streaming?i.push({service:e.workerName}):r.push({service:e.workerName});r.length&&(t.tail_consumers=r),i.length&&(t.streaming_tail_consumers=i)}function $(e){let t={};for(let[n,r]of Object.entries(e))r!==void 0&&(t[n]=r);return t}new ee;const rl=`config.json`;function il(e){return p.resolve(e,`.cloudflare/output`)}function al(e){return p.join(il(e),`v0`,rl)}function ol(e){return p.join(il(e),`v0`,`workers`)}function sl(e){return p.join(ol(e),`default`)}function cl(e){return p.join(sl(e),rl)}function ll(e){return p.join(sl(e),`bundle`)}function ul(e){return p.join(sl(e),`assets`)}var dl=Object.defineProperty,fl=(e,t)=>dl(e,`name`,{value:t,configurable:!0});function pl(e){return l.statSync(e,{throwIfNoEntry:!1})?.isDirectory()??!1}fl(pl,`isDirectory`);function ml(e,{fireAndForget:t=!1}={}){let n=l.promises.rm(e,{recursive:!0,force:!0,maxRetries:5,retryDelay:100});if(t)n.catch(()=>{});else return n}fl(ml,`removeDir`);function hl(e){l.rmSync(e,{recursive:!0,force:!0,maxRetries:5,retryDelay:100})}fl(hl,`removeDirSync`);var gl=class extends Error{constructor(e){super(`Build Output Specification: ${e}`),this.name=`BuildOutputError`}};async function _l(e){return{root:e,version:`v0`,settings:await yl(e),workers:[await vl(e)]}}async function vl(e){let t=cl(e);if(!c.existsSync(t))throw new gl(`No Worker config found at ${t}.`);let n=await y.readFile(t,`utf-8`),r=rs.safeParse(bl(n,t));if(!r.success)throw new gl(`invalid Worker config at ${t}.\n${r.error.message}`);let i=ll(e),a=ul(e),o=c.existsSync(i),s=c.existsSync(a);if(r.data.manifest&&!o)throw new gl(`Worker config at ${t} contains a manifest, but no bundle directory exists at ${i}.`);if(o)return{configPath:t,config:r.data,bundleDir:i,assetsDir:s?a:void 0};if(s)return{configPath:t,config:r.data,bundleDir:void 0,assetsDir:a};throw new gl(`Worker config at ${t} has neither a bundle directory (${i}) nor an assets directory (${a}).`)}async function yl(e){let t=al(e);if(!c.existsSync(t))return;let n=await y.readFile(t,`utf-8`),r=Qo.safeParse(bl(n,t));if(!r.success)throw new gl(`invalid root config at ${t}.\n${r.error.message}`);return r.data}function bl(e,t){try{return JSON.parse(e)}catch(e){throw new gl(`could not parse JSON at ${t}.\n${e instanceof Error?e.message:String(e)}`)}}var xl=class extends Error{constructor(e){super(e),this.name=`BuildOutputConfigError`}};function Sl(e,t){let n=e.config,r=qc(n,t);n.manifest?.mainModule&&e.bundleDir&&(r.main=m.join(e.bundleDir,n.manifest.mainModule));let i=m.resolve(`cloudflare.config.ts`);return{wranglerConfig:Cl(r,e.configPath,i),builtConfig:n}}function Cl(e,t,r){let{config:i,diagnostics:a}=n(e,t,r,{});if(a.hasErrors())throw new xl(a.renderErrors());return a.hasWarnings()&&console.warn(a.renderWarnings()),i}var wl=e({default:()=>Ol,runBuild:()=>El});function Tl(e){return e.option(`mode`,{type:`string`,alias:`m`,description:`Build mode (e.g. production, staging, preview)`})}async function El(e){let n=o(process.cwd()),c=e?[`--mode`,e]:[];a.message(r.bold(`Build`),{symbol:i.dim(`├`),spacing:0}),a.message(`Delegating to ${Dl(n)}`,{spacing:0});let l=await s(n,`build`,c);if(l!==0)throw new t(l);let{workers:[u],settings:d}=await _l(process.cwd());Sl(u,d),a.success(`Build complete`,{spacing:0})}function Dl(e){switch(e.impl.pkg){case`@cloudflare/vite-plugin`:return`Vite`;case`wrangler`:return`Wrangler`;case`cloudflare-py-dev-server`:return`the Python dev server`;case`cloudflare-rs-dev-server`:return`the Rust dev server`;default:return e.impl.pkg}}const Ol={command:`build`,describe:`Build a project for Cloudflare`,builder:Tl,handler:async e=>{await El(e.mode)}};export{x as C,Ha as S,K as _,_l as a,To as b,U as c,jo as d,J as f,qa as g,V as h,Sl as i,H as l,Wa as m,El as n,q as o,Ja as p,xl as r,Ba as s,wl as t,Za as u,W as v,G as x,z as y};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{
|
|
3
|
-
`);return}if(
|
|
4
|
-
`);return}
|
|
5
|
-
`);return}
|
|
2
|
+
import{N as e}from"./oauth-B5k80sip.mjs";import{i as t,n}from"./auth-DX9KnJ0P.mjs";import{n as r,t as i}from"./body-parser-DWSy7uZ8.mjs";import{t as a}from"./output-B6fBFRqe.mjs";import{n as o,t as s}from"./progress-CL8I-7YK.mjs";import{n as c}from"./input-validation-_fMCApaH.mjs";import{n as l,t as u}from"./prompt-q3B7sM2A.mjs";function d(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const f={command:`clear`,describe:`You can use Cache Reserve Clear to clear your Cache Reserve, but you must first disable Cache Reserve. In most cases, this will be accomplished within 24 hours. You cannot re-enable Cache Reserve while this process is ongoing. Keep in mind that you cannot undo or cancel this operation.`,builder:d,handler:async t=>{if(t.dryRun){o({command:`cf cache cache-reserve clear`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/cache/cache_reserve_clear`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`none`});return}let r=await n(t),i=await e({zone:t.zone},r,{quiet:t.quiet});t.zoneId=i,a(await s(`Creating`,async()=>r.cache.cacheReserve.clear({zone_id:i})),{successLabel:`Created`})}};function p(e){return e.option(`value`,{type:`string`,description:`Value of the Cache Reserve zone setting.`,choices:[`on`,`off`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const m={command:`edit`,describe:`Increase cache lifetimes by automatically storing all cacheable files into Cloudflare's persistent object storage buckets. Requires Cache Reserve subscription. Note: using Tiered Cache with Cache Reserve is highly recommended to reduce Reserve operations costs. See the [developer docs](https://developers.cloudflare.com/cache/about/cache-reserve) for more information.`,builder:p,handler:async t=>{if(t.dryRun){o({command:`cf cache cache-reserve edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/cache/cache_reserve`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:t.body===void 0?i({value:c(t.value,`value`,`text`)}):r(t.body)});return}let u=await n(t),d=await e({zone:t.zone},u,{quiet:t.quiet});if(t.zoneId=d,t.body){let e=r(t.body);a(await s(`Updating`,async()=>u.cache.cacheReserve.edit({...e,zone_id:d})),{successLabel:`Updated`});return}t.value===void 0&&(t.value=await l(`value`,`Value of the Cache Reserve zone setting.`,[`on`,`off`]));let f=i({value:c(t.value,`value`,`text`)});a(await s(`Updating`,async()=>u.cache.cacheReserve.edit({...f,zone_id:d})),{successLabel:`Updated`})}};function h(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const g={command:`get`,describe:`Increase cache lifetimes by automatically storing all cacheable files into Cloudflare's persistent object storage buckets. Requires Cache Reserve subscription. Note: using Tiered Cache with Cache Reserve is highly recommended to reduce Reserve operations costs. See the [developer docs](https://developers.cloudflare.com/cache/about/cache-reserve) for more information.`,builder:h,handler:async t=>{if(t.dryRun){o({command:`cf cache cache-reserve get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/cache/cache_reserve`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`none`});return}let r=await n(t),i=await e({zone:t.zone},r,{quiet:t.quiet});t.zoneId=i,a(await s(`Loading`,async()=>r.cache.cacheReserve.get({zone_id:i})),{successLabel:`Loaded`})}};function _(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={command:`status`,describe:`You can use Cache Reserve Clear to clear your Cache Reserve, but you must first disable Cache Reserve. In most cases, this will be accomplished within 24 hours. You cannot re-enable Cache Reserve while this process is ongoing. Keep in mind that you cannot undo or cancel this operation.`,builder:_,handler:async t=>{if(t.dryRun){o({command:`cf cache cache-reserve status`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/cache/cache_reserve_clear`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`none`});return}let r=await n(t),i=await e({zone:t.zone},r,{quiet:t.quiet});t.zoneId=i,a(await s(`Loading`,async()=>r.cache.cacheReserve.status({zone_id:i})),{successLabel:`Loaded`})}},y={command:`cache-reserve`,describe:`Persistent storage tier that keeps cached assets even after eviction from edge caches`,builder:e=>e.command(f).command(m).command(g).command(v).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function b(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const x={command:`purge`,describe:'### Purge All Cached Content Removes ALL files from Cloudflare\'s cache. All tiers can purge everything. ``` {"purge_everything": true} ``` ### Purge Cached Content by URL Granularly removes one or more files from Cloudflare\'s cache by specifying URLs. All tiers can purge by URL. To purge files with custom cache keys, include the headers used to compute the cache key as in the example. If you have a device type or geo in your cache key, you will need to include the CF-Device-Type or CF-IPCountry headers. If you have lang in your cache key, you will need to include the Accept-Language header. **NB:** When including the Origin header, be sure to include the **scheme** and **hostname**. The port number can be omitted if it is the default port (80 for http, 443 for https), but must be included otherwise. Single file purge example with files: ``` {"files": ["http://www.example.com/css/styles.css", "http://www.example.com/js/index.js"]} ``` Single file purge example with url and header pairs: ``` {"files": [{"url": "http://www.example.com/cat_picture.jpg", "headers": {"CF-IPCountry": "US", "CF-Device-Type": "desktop", "Accept-Language": "zh-CN"}}, {"url": "http://www.example.com/dog_picture.jpg", "headers": {"CF-IPCountry": "EU", "CF-Device-Type": "mobile", "Accept-Language": "en-US"}}]} ``` ### Purge Cached Content by Tag, Host or Prefix Granularly removes one or more files from Cloudflare\'s cache either by specifying the host, the associated Cache-Tag, or a Prefix. Flex purge with tags: ``` {"tags": ["a-cache-tag", "another-cache-tag"]} ``` Flex purge with hosts: ``` {"hosts": ["www.example.com", "images.example.com"]} ``` Flex purge with prefixes: ``` {"prefixes": ["www.example.com/foo", "images.example.com/bar/baz"]} ``` ### Availability and limits Please refer to [purge cache availability and limits documentation page](https://developers.cloudflare.com/cache/how-to/purge-cache/#availability-and-limits).',builder:b,handler:async i=>{if(i.dryRun){o({command:`cf cache purge`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${i.zone??i.zoneId??`<zone>`}/purge_cache`,pathParams:{"zone-id":String(i.zone??i[`zone-id`]??``)},bodyKind:`json`,body:i.body===void 0?void 0:r(i.body)});return}let c=await n(i),l=await e({zone:i.zone},c,{quiet:i.quiet});if(i.zoneId=l,!await u({force:!!i.force,message:`This operation destroys cached content for a zone.`})){process.stderr.write(`Aborted.
|
|
3
|
+
`);return}if(i.body){let e=r(i.body);a(await s(`Deleting`,async()=>c.cache.purge({body:e,zone_id:l})),{successLabel:`Deleted`});return}a(await s(`Deleting`,async()=>t(c,`POST`,`/zones/${i.zoneId}/purge_cache`)),{successLabel:`Deleted`})}};function S(e){return e.option(`value`,{type:`string`,description:`Value of the Regional Tiered Cache zone setting.`,choices:[`on`,`off`]}).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 C={command:`edit`,describe:`Instructs Cloudflare to check a regional hub data center on the way to your upper tier. This can help improve performance for smart and custom tiered cache topologies.`,builder:S,handler:async t=>{if(t.dryRun){o({command:`cf cache regional-tiered-cache edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/cache/regional_tiered_cache`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:t.body===void 0?i({value:c(t.value,`value`,`text`)}):r(t.body)});return}let u=await n(t),d=await e({zone:t.zone},u,{quiet:t.quiet});if(t.zoneId=d,t.body){let e=r(t.body);a(await s(`Updating`,async()=>u.cache.regionalTieredCache.edit({...e,zone_id:d})),{successLabel:`Updated`});return}t.value===void 0&&(t.value=await l(`value`,`Value of the Regional Tiered Cache zone setting.`,[`on`,`off`]));let f=i({value:c(t.value,`value`,`text`)});a(await s(`Updating`,async()=>u.cache.regionalTieredCache.edit({...f,zone_id:d})),{successLabel:`Updated`})}};function w(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const T={command:`get`,describe:`Instructs Cloudflare to check a regional hub data center on the way to your upper tier. This can help improve performance for smart and custom tiered cache topologies.`,builder:w,handler:async t=>{if(t.dryRun){o({command:`cf cache regional-tiered-cache get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/cache/regional_tiered_cache`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`none`});return}let r=await n(t),i=await e({zone:t.zone},r,{quiet:t.quiet});t.zoneId=i,a(await s(`Loading`,async()=>r.cache.regionalTieredCache.get({zone_id:i})),{successLabel:`Loaded`})}},E={command:`regional-tiered-cache`,describe:`Restrict tiered cache topology to data centers within a specific geographic region`,builder:e=>e.command(C).command(T).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function D(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const O={command:`delete`,describe:`Smart Tiered Cache dynamically selects the single closest upper tier for each of your website’s origins with no configuration required, using our in-house performance and routing data. Cloudflare collects latency data for each request to an origin, and uses the latency data to determine how well any upper-tier data center is connected with an origin. As a result, Cloudflare can select the data center with the lowest latency to be the upper-tier for an origin.`,builder:D,handler:async t=>{if(t.dryRun){o({command:`cf cache smart-tiered-cache delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/cache/tiered_cache_smart_topology_enable`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`none`});return}let r=await n(t),i=await e({zone:t.zone},r,{quiet:t.quiet});if(t.zoneId=i,!await u({force:!!t.force})){process.stderr.write(`Aborted.
|
|
4
|
+
`);return}a(await s(`Deleting`,async()=>r.cache.smartTieredCache.delete({zone_id:i})),{successLabel:`Deleted`})}};function k(e){return e.option(`value`,{type:`string`,description:`Enable or disable the Smart Tiered Cache.`,choices:[`on`,`off`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Update enablement of Smart Tiered Cache.`})}const A={command:`edit`,describe:`Smart Tiered Cache dynamically selects the single closest upper tier for each of your website’s origins with no configuration required, using our in-house performance and routing data. Cloudflare collects latency data for each request to an origin, and uses the latency data to determine how well any upper-tier data center is connected with an origin. As a result, Cloudflare can select the data center with the lowest latency to be the upper-tier for an origin.`,builder:k,handler:async t=>{if(t.dryRun){o({command:`cf cache smart-tiered-cache edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/cache/tiered_cache_smart_topology_enable`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:t.body===void 0?i({value:c(t.value,`value`,`text`)}):r(t.body)});return}let u=await n(t),d=await e({zone:t.zone},u,{quiet:t.quiet});if(t.zoneId=d,t.body){let e=r(t.body);a(await s(`Updating`,async()=>u.cache.smartTieredCache.edit({body:e,zone_id:d})),{successLabel:`Updated`});return}t.value===void 0&&(t.value=await l(`value`,`Enable or disable the Smart Tiered Cache.`,[`on`,`off`]));let f=i({value:c(t.value,`value`,`text`)});a(await s(`Updating`,async()=>u.cache.smartTieredCache.edit({body:f,zone_id:d})),{successLabel:`Updated`})}};function j(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const M={command:`get`,describe:`Smart Tiered Cache dynamically selects the single closest upper tier for each of your website’s origins with no configuration required, using our in-house performance and routing data. Cloudflare collects latency data for each request to an origin, and uses the latency data to determine how well any upper-tier data center is connected with an origin. As a result, Cloudflare can select the data center with the lowest latency to be the upper-tier for an origin.`,builder:j,handler:async t=>{if(t.dryRun){o({command:`cf cache smart-tiered-cache get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/cache/tiered_cache_smart_topology_enable`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`none`});return}let r=await n(t),i=await e({zone:t.zone},r,{quiet:t.quiet});t.zoneId=i,a(await s(`Loading`,async()=>r.cache.smartTieredCache.get({zone_id:i})),{successLabel:`Loaded`})}},N={command:`smart-tiered-cache`,describe:`Automatically determine the best upper-tier data centers for tiered cache topology`,builder:e=>e.command(O).command(A).command(M).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function P(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const F={command:`delete`,describe:`Variant support enables caching variants of images with certain file extensions in addition to the original. This only applies when the origin server sends the 'Vary: Accept' response header. If the origin server sends 'Vary: Accept' but does not serve the variant requested, the response will not be cached. This will be indicated with BYPASS cache status in the response headers.`,builder:P,handler:async t=>{if(t.dryRun){o({command:`cf cache variants delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/cache/variants`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`none`});return}let r=await n(t),i=await e({zone:t.zone},r,{quiet:t.quiet});if(t.zoneId=i,!await u({force:!!t.force})){process.stderr.write(`Aborted.
|
|
5
|
+
`);return}a(await s(`Deleting`,async()=>r.cache.variants.delete({zone_id:i})),{successLabel:`Deleted`})}};function I(e){return e.option(`value-avif`,{type:`string`,array:!0,description:`List of strings with the MIME types of all the variants that should be served for avif.`}).option(`value-bmp`,{type:`string`,array:!0,description:`List of strings with the MIME types of all the variants that should be served for bmp.`}).option(`value-gif`,{type:`string`,array:!0,description:`List of strings with the MIME types of all the variants that should be served for gif.`}).option(`value-jp2`,{type:`string`,array:!0,description:`List of strings with the MIME types of all the variants that should be served for jp2.`}).option(`value-jpeg`,{type:`string`,array:!0,description:`List of strings with the MIME types of all the variants that should be served for jpeg.`}).option(`value-jpg`,{type:`string`,array:!0,description:`List of strings with the MIME types of all the variants that should be served for jpg.`}).option(`value-jpg2`,{type:`string`,array:!0,description:`List of strings with the MIME types of all the variants that should be served for jpg2.`}).option(`value-png`,{type:`string`,array:!0,description:`List of strings with the MIME types of all the variants that should be served for png.`}).option(`value-tif`,{type:`string`,array:!0,description:`List of strings with the MIME types of all the variants that should be served for tif.`}).option(`value-tiff`,{type:`string`,array:!0,description:`List of strings with the MIME types of all the variants that should be served for tiff.`}).option(`value-webp`,{type:`string`,array:!0,description:`List of strings with the MIME types of all the variants that should be served for webp.`}).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:`edit`,describe:`Variant support enables caching variants of images with certain file extensions in addition to the original. This only applies when the origin server sends the 'Vary: Accept' response header. If the origin server sends 'Vary: Accept' but does not serve the variant requested, the response will not be cached. This will be indicated with BYPASS cache status in the response headers.`,builder:I,handler:async t=>{if(t.dryRun){o({command:`cf cache variants edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/cache/variants`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:t.body===void 0?i({value:{avif:t[`value-avif`],bmp:t[`value-bmp`],gif:t[`value-gif`],jp2:t[`value-jp2`],jpeg:t[`value-jpeg`],jpg:t[`value-jpg`],jpg2:t[`value-jpg2`],png:t[`value-png`],tif:t[`value-tif`],tiff:t[`value-tiff`],webp:t[`value-webp`]}}):r(t.body)});return}let c=await n(t),l=await e({zone:t.zone},c,{quiet:t.quiet});if(t.zoneId=l,t.body){let e=r(t.body);a(await s(`Updating`,async()=>c.cache.variants.edit({...e,zone_id:l})),{successLabel:`Updated`});return}let u=i({value:{avif:t[`value-avif`],bmp:t[`value-bmp`],gif:t[`value-gif`],jp2:t[`value-jp2`],jpeg:t[`value-jpeg`],jpg:t[`value-jpg`],jpg2:t[`value-jpg2`],png:t[`value-png`],tif:t[`value-tif`],tiff:t[`value-tiff`],webp:t[`value-webp`]}});a(await s(`Updating`,async()=>c.cache.variants.edit({...u,zone_id:l})),{successLabel:`Updated`})}};function R(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const z={command:`get`,describe:`Variant support enables caching variants of images with certain file extensions in addition to the original. This only applies when the origin server sends the 'Vary: Accept' response header. If the origin server sends 'Vary: Accept' but does not serve the variant requested, the response will not be cached. This will be indicated with BYPASS cache status in the response headers.`,builder:R,handler:async t=>{if(t.dryRun){o({command:`cf cache variants get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/cache/variants`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`none`});return}let r=await n(t),i=await e({zone:t.zone},r,{quiet:t.quiet});t.zoneId=i,a(await s(`Loading`,async()=>r.cache.variants.get({zone_id:i})),{successLabel:`Loaded`})}},B={command:`variants`,describe:`Serve different cached versions of an image based on the Accept header (WebP, AVIF, etc.)`,builder:e=>e.command(F).command(L).command(z).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},V={command:`cache`,describe:`Purge cached content and configure Cache Reserve, tiered caching, and variant serving`,builder:e=>e.command(x).command(y).command(E).command(N).command(B).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{V as default};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{O as e,P as t}from"./oauth-B5k80sip.mjs";import{n}from"./auth-DX9KnJ0P.mjs";import{n as r,t as i}from"./body-parser-DWSy7uZ8.mjs";import{t as a}from"./output-B6fBFRqe.mjs";import{n as o,t as s}from"./progress-CL8I-7YK.mjs";import{n as c}from"./input-validation-_fMCApaH.mjs";import{t as l}from"./local-CYc9q7l2.mjs";import{t as u}from"./prompt-q3B7sM2A.mjs";function d(e){return e.option(`name`,{type:`string`,description:`A short description of Calls app, not shown to end users.`,default:``}).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 f={command:`create`,describe:`Creates a new Cloudflare calls app. An app is an unique enviroment where each Session can access all Tracks within the app.`,builder:d,handler:async u=>{if(u.dryRun){o({command:`cf calls sfu create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/calls/apps`,pathParams:{},bodyKind:`json`,body:u.body===void 0?i({name:c(u.name,`name`,`text`)}):r(u.body)});return}let d=await n(u),f=u.local?l:await e();if(u.accountId=f,u.body){let e=r(u.body);a(await s(`Creating`,async()=>d.calls.sfu.create({body:e,account_id:f})),{successLabel:`Created`});return}let p=i({name:c(u.name,`name`,`text`)});a(await s(`Creating`,async()=>d.calls.sfu.create({body:p,account_id:f})),{successLabel:`Created`})}};function p(e){return e.positional(`app-id`,{type:`string`,description:`A Cloudflare-generated unique identifier for a 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 m={command:`delete <app-id>`,describe:`Deletes an app from Cloudflare Calls`,builder:p,handler:async r=>{if(r.dryRun){o({command:`cf calls sfu delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/calls/apps/${r[`app-id`]==null?`<app-id>`:encodeURIComponent(String(r[`app-id`]))}`,pathParams:{"app-id":String(r[`app-id`]??``)},bodyKind:`none`});return}let i=await n(r),c=r.local?l:await e();if(r.accountId=c,!await u({force:!!r.force})){process.stderr.write(`Aborted.
|
|
3
|
+
`);return}a(await s(`Deleting`,async()=>i.calls.sfu.delete({account_id:c,app_id:r[`app-id`]})),{successLabel:`Deleted`})}};function h(e){return e.positional(`app-id`,{type:`string`,description:`A Cloudflare-generated unique identifier for a item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const g={command:`get <app-id>`,describe:`Fetches details for a single Calls app.`,builder:h,handler:async r=>{if(r.dryRun){o({command:`cf calls sfu get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/calls/apps/${r[`app-id`]==null?`<app-id>`:encodeURIComponent(String(r[`app-id`]))}`,pathParams:{"app-id":String(r[`app-id`]??``)},bodyKind:`none`});return}let i=await n(r),c=r.local?l:await e();r.accountId=c,a(await s(`Loading`,async()=>i.calls.sfu.get({account_id:c,app_id:r[`app-id`]})),{successLabel:`Loaded`})}};function _(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={command:`list`,describe:`Lists all apps in the Cloudflare account`,builder:_,handler:async r=>{if(r.dryRun){o({command:`cf calls sfu list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/calls/apps`,pathParams:{},bodyKind:`none`});return}let i=await n(r),c=r.local?l:await e();r.accountId=c,a(await s(`Loading`,async()=>i.calls.sfu.list({account_id:c})),{successLabel:`Loaded`})}};function y(e){return e.positional(`app-id`,{type:`string`,description:`A Cloudflare-generated unique identifier for a item.`,demandOption:!0}).option(`name`,{type:`string`,description:`A short description of Calls app, not shown to end users.`}).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 b={command:`update <app-id>`,describe:`Edit details for a single app.`,builder:y,handler:async u=>{if(u.dryRun){o({command:`cf calls sfu update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/calls/apps/${u[`app-id`]==null?`<app-id>`:encodeURIComponent(String(u[`app-id`]))}`,pathParams:{"app-id":String(u[`app-id`]??``)},bodyKind:`json`,body:u.body===void 0?i({name:c(u.name,`name`,`text`)}):r(u.body)});return}let d=await n(u),f=u.local?l:await e();if(u.accountId=f,u.body){let e=r(u.body);a(await s(`Updating`,async()=>d.calls.sfu.update({body:e,account_id:f,app_id:u[`app-id`]})),{successLabel:`Updated`});return}let p=i({name:c(u.name,`name`,`text`)});a(await s(`Updating`,async()=>d.calls.sfu.update({body:p,account_id:f,app_id:u[`app-id`]})),{successLabel:`Updated`})}},x={command:`sfu`,describe:`Operations for sfu`,builder:e=>e.command(f).command(m).command(g).command(v).command(b).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function S(e){return e.option(`name`,{type:`string`,description:`A short description of a TURN key, not shown to end users.`,default:``}).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 C={command:`create`,describe:`Creates a new Cloudflare Calls TURN key.`,builder:S,handler:async u=>{if(u.dryRun){o({command:`cf calls turn create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/calls/turn_keys`,pathParams:{},bodyKind:`json`,body:u.body===void 0?i({name:c(u.name,`name`,`text`)}):r(u.body)});return}let d=await n(u),f=u.local?l:await e();if(u.accountId=f,u.body){let e=r(u.body);a(await s(`Creating`,async()=>d.calls.turn.create({body:e,account_id:f})),{successLabel:`Created`});return}let p=i({name:c(u.name,`name`,`text`)});a(await s(`Creating`,async()=>d.calls.turn.create({body:p,account_id:f})),{successLabel:`Created`})}};function w(e){return e.positional(`key-id`,{type:`string`,description:`A Cloudflare-generated unique identifier for a 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 T={command:`delete <key-id>`,describe:`Deletes a TURN key from Cloudflare Calls`,builder:w,handler:async r=>{if(r.dryRun){o({command:`cf calls turn delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/calls/turn_keys/${r[`key-id`]==null?`<key-id>`:encodeURIComponent(String(r[`key-id`]))}`,pathParams:{"key-id":String(r[`key-id`]??``)},bodyKind:`none`});return}let i=await n(r),c=r.local?l:await e();if(r.accountId=c,!await u({force:!!r.force})){process.stderr.write(`Aborted.
|
|
4
|
+
`);return}a(await s(`Deleting`,async()=>i.calls.turn.delete({account_id:c,key_id:r[`key-id`]})),{successLabel:`Deleted`})}};function E(e){return e.positional(`key-id`,{type:`string`,description:`A Cloudflare-generated unique identifier for a item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const D={command:`get <key-id>`,describe:`Fetches details for a single TURN key.`,builder:E,handler:async r=>{if(r.dryRun){o({command:`cf calls turn get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/calls/turn_keys/${r[`key-id`]==null?`<key-id>`:encodeURIComponent(String(r[`key-id`]))}`,pathParams:{"key-id":String(r[`key-id`]??``)},bodyKind:`none`});return}let i=await n(r),c=r.local?l:await e();r.accountId=c,a(await s(`Loading`,async()=>i.calls.turn.get({account_id:c,key_id:r[`key-id`]})),{successLabel:`Loaded`})}};function O(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const k={command:`list`,describe:`Lists all TURN keys in the Cloudflare account`,builder:O,handler:async r=>{if(r.dryRun){o({command:`cf calls turn list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/calls/turn_keys`,pathParams:{},bodyKind:`none`});return}let i=await n(r),c=r.local?l:await e();r.accountId=c,a(await s(`Loading`,async()=>i.calls.turn.list({account_id:c})),{successLabel:`Loaded`})}};function A(e){return e.positional(`key-id`,{type:`string`,description:`A Cloudflare-generated unique identifier for a item.`,demandOption:!0}).option(`name`,{type:`string`,description:`A short description of a TURN key, not shown to end users.`}).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:`update <key-id>`,describe:`Edit details for a single TURN key.`,builder:A,handler:async u=>{if(u.dryRun){o({command:`cf calls turn update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/calls/turn_keys/${u[`key-id`]==null?`<key-id>`:encodeURIComponent(String(u[`key-id`]))}`,pathParams:{"key-id":String(u[`key-id`]??``)},bodyKind:`json`,body:u.body===void 0?i({name:c(u.name,`name`,`text`)}):r(u.body)});return}let d=await n(u),f=u.local?l:await e();if(u.accountId=f,u.body){let e=r(u.body);a(await s(`Updating`,async()=>d.calls.turn.update({body:e,account_id:f,key_id:u[`key-id`]})),{successLabel:`Updated`});return}let p=i({name:c(u.name,`name`,`text`)});a(await s(`Updating`,async()=>d.calls.turn.update({body:p,account_id:f,key_id:u[`key-id`]})),{successLabel:`Updated`})}},M={command:`turn`,describe:`Operations for turn`,builder:e=>e.command(C).command(T).command(D).command(k).command(j).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},N={command:`calls`,describe:`calls`,builder:e=>e.command(x).command(M).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{N as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{N as e}from"./oauth-B5k80sip.mjs";import{n as t}from"./auth-DX9KnJ0P.mjs";import{n,t as r}from"./body-parser-DWSy7uZ8.mjs";import{t as i}from"./output-B6fBFRqe.mjs";import{n as a,t as o}from"./progress-CL8I-7YK.mjs";import{n as s}from"./input-validation-_fMCApaH.mjs";function c(e){return e.option(`mtls-certificate-id`,{type:`string`,description:`The UUID to match against for a certificate that was uploaded to the mTLS Certificate Management endpoint. If no mtls_certificate_id is given, the results will be the hostnames associated to your active Cloudflare Managed CA.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const l={command:`get`,describe:`List Hostname Associations.`,builder:c,handler:async n=>{let r={mtls_certificate_id:n[`mtls-certificate-id`]};if(n.dryRun){a({command:`cf certificate-authorities hostname-associations get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/certificate_authorities/hostname_associations`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``)},query:r,bodyKind:`none`});return}let s=await t(n),c=await e({zone:n.zone},s,{quiet:n.quiet});n.zoneId=c,i(await o(`Loading`,async()=>s.certificateAuthorities.hostnameAssociations.get({zone_id:c,...r})),{successLabel:`Loaded`})}};function u(e){return e.option(`hostnames`,{type:`string`,array:!0,description:`The hostnames field`}).option(`mtls-certificate-id`,{type:`string`,description:`The UUID for a certificate that was uploaded to the mTLS Certificate Management endpoint. If no mtls_certificate_id is given, the hostnames will be associated to your active Cloudflare Managed CA.`}).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:`update`,describe:`Replace Hostname Associations.`,builder:u,handler:async c=>{if(c.dryRun){a({command:`cf certificate-authorities hostname-associations update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${c.zone??c.zoneId??`<zone>`}/certificate_authorities/hostname_associations`,pathParams:{"zone-id":String(c.zone??c[`zone-id`]??``)},bodyKind:`json`,body:c.body===void 0?r({hostnames:c.hostnames,mtls_certificate_id:s(c[`mtls-certificate-id`],`mtls-certificate-id`,`text`)}):n(c.body)});return}let l=await t(c),u=await e({zone:c.zone},l,{quiet:c.quiet});if(c.zoneId=u,c.body){let e=n(c.body);i(await o(`Updating`,async()=>l.certificateAuthorities.hostnameAssociations.update({...e,zone_id:u})),{successLabel:`Updated`});return}let d=r({hostnames:c.hostnames,mtls_certificate_id:s(c[`mtls-certificate-id`],`mtls-certificate-id`,`text`)});i(await o(`Updating`,async()=>l.certificateAuthorities.hostnameAssociations.update({...d,zone_id:u})),{successLabel:`Updated`})}},f={command:`hostname-associations`,describe:`Operations for hostname-associations`,builder:e=>e.command(l).command(d).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},p={command:`certificate-authorities`,describe:`Map client certificates to specific hostnames for mTLS authentication`,builder:e=>e.command(f).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{p as default};
|