@workflow/web 4.1.10 → 4.1.11

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.
@@ -14,7 +14,7 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
14
14
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
15
15
  var __superGet = (cls, obj, key) => __reflectGet(__getProtoOf(cls), key, obj);
16
16
  var _a2, _b, _root, _hasMagic, _uflag, _parts, _parent, _parentIndex, _negs, _filledNegs, _options, _toString, _emptyExt, _AST_instances, fillNegs_fn, _AST_static, parseAST_fn, canAdoptWithSpace_fn, canAdopt_fn, canAdoptType_fn, adoptWithSpace_fn, adopt_fn, canUsurpType_fn, canUsurp_fn, usurp_fn, flatten_fn, partsToRegExp_fn, parseGlob_fn, _Minimatch_instances, matchGlobstar_fn, matchGlobStarBodySections_fn, matchOne_fn, _reader;
17
- import { a as requireReact, S as ServerRouter, c as createReadableStreamFromReadable, r as reactExports, g as getDefaultExportFromCjs, R as React, b as ReactExports, w as withComponentProps, d as withErrorBoundaryProps, M as Meta, L as Links, e as ScrollRestoration, f as Scripts, O as Outlet, u as useNavigate, h as useSearchParams, i as Link$1, j as useRouteError, k as isRouteErrorResponse, l as useLocation, m as useParams } from "./app-B2JDIan2.js";
17
+ import { a as requireReact, S as ServerRouter, c as createReadableStreamFromReadable, r as reactExports, g as getDefaultExportFromCjs, R as React, b as ReactExports, w as withComponentProps, d as withErrorBoundaryProps, M as Meta, L as Links, e as ScrollRestoration, f as Scripts, O as Outlet, u as useNavigate, h as useSearchParams, i as Link$1, j as useRouteError, k as isRouteErrorResponse, l as useLocation, m as useParams } from "./app-BR0o9iNl.js";
18
18
  import require$$0$5, { PassThrough } from "node:stream";
19
19
  import require$$0 from "util";
20
20
  import require$$1 from "crypto";
@@ -24067,10 +24067,10 @@ const computePosition$1 = async (reference, floating, config2) => {
24067
24067
  const {
24068
24068
  placement = "bottom",
24069
24069
  strategy = "absolute",
24070
- middleware: middleware2 = [],
24070
+ middleware = [],
24071
24071
  platform: platform2
24072
24072
  } = config2;
24073
- const validMiddleware = middleware2.filter(Boolean);
24073
+ const validMiddleware = middleware.filter(Boolean);
24074
24074
  const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(floating));
24075
24075
  let rects = await platform2.getElementRects({
24076
24076
  reference,
@@ -25552,7 +25552,7 @@ function useFloating(options) {
25552
25552
  const {
25553
25553
  placement = "bottom",
25554
25554
  strategy = "absolute",
25555
- middleware: middleware2 = [],
25555
+ middleware = [],
25556
25556
  platform: platform2,
25557
25557
  elements: {
25558
25558
  reference: externalReference,
@@ -25570,9 +25570,9 @@ function useFloating(options) {
25570
25570
  middlewareData: {},
25571
25571
  isPositioned: false
25572
25572
  });
25573
- const [latestMiddleware, setLatestMiddleware] = reactExports.useState(middleware2);
25574
- if (!deepEqual(latestMiddleware, middleware2)) {
25575
- setLatestMiddleware(middleware2);
25573
+ const [latestMiddleware, setLatestMiddleware] = reactExports.useState(middleware);
25574
+ if (!deepEqual(latestMiddleware, middleware)) {
25575
+ setLatestMiddleware(middleware);
25576
25576
  }
25577
25577
  const [_reference, _setReference] = reactExports.useState(null);
25578
25578
  const [_floating, _setFloating] = reactExports.useState(null);
@@ -48714,11 +48714,30 @@ const HookSchema = object$1({
48714
48714
  specVersion: number$3().optional(),
48715
48715
  isWebhook: boolean$3().optional()
48716
48716
  });
48717
- const QueuePrefix = union([
48718
- literal("__wkf_step_"),
48719
- literal("__wkf_workflow_")
48720
- ]);
48721
- const ValidQueueName = templateLiteral([QueuePrefix, string$3()]);
48717
+ const QueuePrefix = string$3().regex(/^__(?:[a-z][a-z0-9]*_)?wkf_(?:workflow|step)_$/, "Must match __wkf_{workflow|step}_ or __{namespace}_wkf_{workflow|step}_");
48718
+ const ValidQueueName = string$3().regex(/^__(?:[a-z][a-z0-9]*_)?wkf_(?:workflow|step)_.+$/, "Must be a valid queue name with a recognized prefix");
48719
+ const QueueNamespace = string$3().regex(/^[a-z][a-z0-9]*$/, "Must be lowercase alphanumeric, starting with a letter");
48720
+ function resolveQueueNamespace(namespace2) {
48721
+ return namespace2 ?? process.env.WORKFLOW_QUEUE_NAMESPACE ?? void 0;
48722
+ }
48723
+ function getQueueTopicPrefix(kind, namespace2) {
48724
+ if (namespace2 !== void 0) {
48725
+ QueueNamespace.parse(namespace2);
48726
+ return `__${namespace2}_wkf_${kind}_`;
48727
+ }
48728
+ return `__wkf_${kind}_`;
48729
+ }
48730
+ function parseQueueName(name2) {
48731
+ const match2 = name2.match(/^(__(?:[a-z][a-z0-9]*_)?wkf_(workflow|step)_)(.+)$/);
48732
+ if (!match2) {
48733
+ throw new Error(`Invalid queue name: ${name2}`);
48734
+ }
48735
+ return {
48736
+ prefix: QueuePrefix.parse(match2[1]),
48737
+ kind: match2[2],
48738
+ id: match2[3]
48739
+ };
48740
+ }
48722
48741
  const MessageId = string$3().brand().describe("A stored queue message ID");
48723
48742
  const TraceCarrierSchema = record(string$3(), string$3());
48724
48743
  const RunInputSchema = object$1({
@@ -76988,17 +77007,17 @@ function trough() {
76988
77007
  return pipeline;
76989
77008
  }
76990
77009
  }
76991
- function wrap(middleware2, callback) {
77010
+ function wrap(middleware, callback) {
76992
77011
  let called;
76993
77012
  return wrapped;
76994
77013
  function wrapped(...parameters) {
76995
- const fnExpectsCallback = middleware2.length > parameters.length;
77014
+ const fnExpectsCallback = middleware.length > parameters.length;
76996
77015
  let result;
76997
77016
  if (fnExpectsCallback) {
76998
77017
  parameters.push(done);
76999
77018
  }
77000
77019
  try {
77001
- result = middleware2.apply(this, parameters);
77020
+ result = middleware.apply(this, parameters);
77002
77021
  } catch (error2) {
77003
77022
  const exception = (
77004
77023
  /** @type {Error} */
@@ -79387,7 +79406,7 @@ var tn = f("block", "before:content-[counter(line)]", "before:inline-block", "be
79387
79406
  var et = ({ className: e, language: t, style: o, isIncomplete: n, ...s2 }) => jsxRuntimeExports.jsx("div", { className: f("my-4 flex w-full flex-col gap-2 rounded-xl border border-border bg-sidebar p-2", e), "data-incomplete": n || void 0, "data-language": t, "data-streamdown": "code-block", style: { contentVisibility: "auto", containIntrinsicSize: "auto 200px", ...o }, ...s2 });
79388
79407
  var Se = reactExports.createContext({ code: "" }), de = () => reactExports.useContext(Se);
79389
79408
  var ot = ({ language: e }) => jsxRuntimeExports.jsx("div", { className: "flex h-8 items-center text-muted-foreground text-xs", "data-language": e, "data-streamdown": "code-block-header", children: jsxRuntimeExports.jsx("span", { className: "ml-1 font-mono lowercase", children: e }) });
79390
- var cn$1 = /\n+$/, dn = reactExports.lazy(() => import("./highlighted-body-B3W2YXNL-B94lzYCW.js").then((e) => ({ default: e.HighlightedCodeBlockBody }))), rt = ({ code: e, language: t, className: o, children: n, isIncomplete: s2 = false, ...r2 }) => {
79409
+ var cn$1 = /\n+$/, dn = reactExports.lazy(() => import("./highlighted-body-B3W2YXNL-BeWNj3yf.js").then((e) => ({ default: e.HighlightedCodeBlockBody }))), rt = ({ code: e, language: t, className: o, children: n, isIncomplete: s2 = false, ...r2 }) => {
79391
79410
  let i = reactExports.useMemo(() => e.replace(cn$1, ""), [e]), c = reactExports.useMemo(() => ({ bg: "transparent", fg: "inherit", tokens: i.split(`
79392
79411
  `).map((a2) => [{ content: a2, color: "inherit", bgColor: "transparent", htmlStyle: {}, offset: 0 }]) }), [i]);
79393
79412
  return jsxRuntimeExports.jsx(Se.Provider, { value: { code: e }, children: jsxRuntimeExports.jsxs(et, { isIncomplete: s2, language: t, children: [jsxRuntimeExports.jsx(ot, { language: t }), n ? jsxRuntimeExports.jsx("div", { className: "pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end", children: jsxRuntimeExports.jsx("div", { className: "pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur", "data-streamdown": "code-block-actions", children: n }) }) : null, jsxRuntimeExports.jsx(reactExports.Suspense, { fallback: jsxRuntimeExports.jsx(Qe, { className: o, language: t, result: c, ...r2 }), children: jsxRuntimeExports.jsx(dn, { className: o, code: i, language: t, raw: c, ...r2 }) })] }) });
@@ -79709,7 +79728,7 @@ var Dt = ({ children: e, className: t, onDownload: o, onError: n }) => {
79709
79728
  }, []), jsxRuntimeExports.jsxs("div", { className: "relative", ref: i, children: [jsxRuntimeExports.jsx("button", { className: f("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50", t), disabled: c, onClick: () => r2(!s2), title: "Download table", type: "button", children: e != null ? e : jsxRuntimeExports.jsx(Z, { size: 14 }) }), s2 ? jsxRuntimeExports.jsxs("div", { className: "absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg", children: [jsxRuntimeExports.jsx("button", { className: "w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40", onClick: () => a2("csv"), title: "Download table as CSV", type: "button", children: "CSV" }), jsxRuntimeExports.jsx("button", { className: "w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40", onClick: () => a2("markdown"), title: "Download table as Markdown", type: "button", children: "Markdown" })] }) : null] });
79710
79729
  };
79711
79730
  var Vt = ({ children: e, className: t, showControls: o, ...n }) => jsxRuntimeExports.jsxs("div", { className: "my-4 flex flex-col gap-2 rounded-lg border border-border bg-sidebar p-2", "data-streamdown": "table-wrapper", children: [o ? jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-end gap-1", children: [jsxRuntimeExports.jsx(Ht, {}), jsxRuntimeExports.jsx(Dt, {})] }) : null, jsxRuntimeExports.jsx("div", { className: "border-collapse overflow-x-auto overscroll-y-auto rounded-md border border-border bg-background", children: jsxRuntimeExports.jsx("table", { className: f("w-full divide-y divide-border", t), "data-streamdown": "table", ...n, children: e }) })] });
79712
- var Jn = reactExports.lazy(() => import("./mermaid-3ZIDBTTL-CbeG5Tzv.js").then((e) => ({ default: e.Mermaid }))), Kn = /language-([^\s]+)/;
79731
+ var Jn = reactExports.lazy(() => import("./mermaid-3ZIDBTTL-Akc2Gx2g.js").then((e) => ({ default: e.Mermaid }))), Kn = /language-([^\s]+)/;
79713
79732
  function ke(e, t) {
79714
79733
  if (!(e != null && e.position || t != null && t.position)) return true;
79715
79734
  if (!(e != null && e.position && (t != null && t.position))) return false;
@@ -89607,7 +89626,7 @@ createLogger("webhook");
89607
89626
  createLogger("events");
89608
89627
  createLogger("adapter");
89609
89628
  const MAX_QUEUE_DELIVERIES = 48;
89610
- const version$1 = "4.4.0";
89629
+ const version$1 = "4.5.0";
89611
89630
  const execFileAsync = promisify(execFile);
89612
89631
  function parsePort$1(value, radix = 10) {
89613
89632
  const port = parseInt(value, radix);
@@ -105943,11 +105962,11 @@ function requireDns() {
105943
105962
  };
105944
105963
  return dns;
105945
105964
  }
105946
- var cache$3;
105947
- var hasRequiredCache$3;
105948
- function requireCache$3() {
105949
- if (hasRequiredCache$3) return cache$3;
105950
- hasRequiredCache$3 = 1;
105965
+ var cache$2;
105966
+ var hasRequiredCache$2;
105967
+ function requireCache$2() {
105968
+ if (hasRequiredCache$2) return cache$2;
105969
+ hasRequiredCache$2 = 1;
105951
105970
  const {
105952
105971
  safeHTTPMethods,
105953
105972
  pathHasQueryOrFragment,
@@ -106198,7 +106217,7 @@ function requireCache$3() {
106198
106217
  }
106199
106218
  return JSON.stringify([cacheKey.origin, cacheKey.method, cacheKey.path, headers2]);
106200
106219
  }
106201
- cache$3 = {
106220
+ cache$2 = {
106202
106221
  makeCacheKey,
106203
106222
  normalizeHeaders,
106204
106223
  assertCacheKey,
@@ -106210,7 +106229,7 @@ function requireCache$3() {
106210
106229
  assertCacheStore,
106211
106230
  makeDeduplicationKey
106212
106231
  };
106213
- return cache$3;
106232
+ return cache$2;
106214
106233
  }
106215
106234
  var date$1;
106216
106235
  var hasRequiredDate;
@@ -106719,7 +106738,7 @@ function requireCacheHandler() {
106719
106738
  parseCacheControlHeader,
106720
106739
  parseVaryHeader,
106721
106740
  isEtagUsable
106722
- } = requireCache$3();
106741
+ } = requireCache$2();
106723
106742
  const { parseHttpDate } = requireDate();
106724
106743
  function noop3() {
106725
106744
  }
@@ -107115,7 +107134,7 @@ function requireMemoryCacheStore() {
107115
107134
  hasRequiredMemoryCacheStore = 1;
107116
107135
  const { Writable } = require$$0$5;
107117
107136
  const { EventEmitter: EventEmitter2 } = require$$0$3;
107118
- const { assertCacheKey, assertCacheValue } = requireCache$3();
107137
+ const { assertCacheKey, assertCacheValue } = requireCache$2();
107119
107138
  class MemoryCacheStore extends EventEmitter2 {
107120
107139
  /**
107121
107140
  * @param {import('../../types/cache-interceptor.d.ts').default.MemoryCacheStoreOpts | undefined} [opts]
@@ -107390,18 +107409,18 @@ function requireCacheRevalidationHandler() {
107390
107409
  cacheRevalidationHandler = CacheRevalidationHandler;
107391
107410
  return cacheRevalidationHandler;
107392
107411
  }
107393
- var cache$2;
107394
- var hasRequiredCache$2;
107395
- function requireCache$2() {
107396
- if (hasRequiredCache$2) return cache$2;
107397
- hasRequiredCache$2 = 1;
107412
+ var cache$1;
107413
+ var hasRequiredCache$1;
107414
+ function requireCache$1() {
107415
+ if (hasRequiredCache$1) return cache$1;
107416
+ hasRequiredCache$1 = 1;
107398
107417
  const assert2 = require$$0$4;
107399
107418
  const { Readable } = require$$0$5;
107400
107419
  const util2 = requireUtil$5();
107401
107420
  const CacheHandler = requireCacheHandler();
107402
107421
  const MemoryCacheStore = requireMemoryCacheStore();
107403
107422
  const CacheRevalidationHandler = requireCacheRevalidationHandler();
107404
- const { assertCacheStore, assertCacheMethods, makeCacheKey, normalizeHeaders, parseCacheControlHeader } = requireCache$3();
107423
+ const { assertCacheStore, assertCacheMethods, makeCacheKey, normalizeHeaders, parseCacheControlHeader } = requireCache$2();
107405
107424
  const { AbortError } = requireErrors();
107406
107425
  function assertCacheOrigins(origins, name2) {
107407
107426
  if (origins === void 0) return;
@@ -107644,7 +107663,7 @@ function requireCache$2() {
107644
107663
  }
107645
107664
  sendCachedValue(handler, opts, result, age, null, false);
107646
107665
  }
107647
- cache$2 = (opts = {}) => {
107666
+ cache$1 = (opts = {}) => {
107648
107667
  const {
107649
107668
  store = new MemoryCacheStore(),
107650
107669
  methods = ["GET"],
@@ -107730,7 +107749,7 @@ function requireCache$2() {
107730
107749
  };
107731
107750
  };
107732
107751
  };
107733
- return cache$2;
107752
+ return cache$1;
107734
107753
  }
107735
107754
  var decompress;
107736
107755
  var hasRequiredDecompress;
@@ -108347,7 +108366,7 @@ function requireDeduplicate() {
108347
108366
  const diagnosticsChannel = require$$0$7;
108348
108367
  const util2 = requireUtil$5();
108349
108368
  const DeduplicationHandler = requireDeduplicationHandler();
108350
- const { normalizeHeaders, makeCacheKey, makeDeduplicationKey } = requireCache$3();
108369
+ const { normalizeHeaders, makeCacheKey, makeDeduplicationKey } = requireCache$2();
108351
108370
  const pendingRequestsChannel = diagnosticsChannel.channel("undici:request:pending-requests");
108352
108371
  deduplicate = (opts = {}) => {
108353
108372
  const {
@@ -108431,7 +108450,7 @@ function requireSqliteCacheStore() {
108431
108450
  if (hasRequiredSqliteCacheStore) return sqliteCacheStore;
108432
108451
  hasRequiredSqliteCacheStore = 1;
108433
108452
  const { Writable } = require$$0$5;
108434
- const { assertCacheKey, assertCacheValue } = requireCache$3();
108453
+ const { assertCacheKey, assertCacheValue } = requireCache$2();
108435
108454
  let DatabaseSync;
108436
108455
  const VERSION = 3;
108437
108456
  const MAX_ENTRY_SIZE = 2 * 1e3 * 1e3 * 1e3;
@@ -108783,12 +108802,12 @@ function requireSqliteCacheStore() {
108783
108802
  }
108784
108803
  return sqliteCacheStore;
108785
108804
  }
108786
- var headers$1;
108787
- var hasRequiredHeaders$1;
108788
- function requireHeaders$1() {
108805
+ var headers;
108806
+ var hasRequiredHeaders;
108807
+ function requireHeaders() {
108789
108808
  var _guard, _headersList;
108790
- if (hasRequiredHeaders$1) return headers$1;
108791
- hasRequiredHeaders$1 = 1;
108809
+ if (hasRequiredHeaders) return headers;
108810
+ hasRequiredHeaders = 1;
108792
108811
  const { kConstruct } = requireSymbols();
108793
108812
  const { kEnumerableProperty } = requireUtil$5();
108794
108813
  const {
@@ -109236,7 +109255,7 @@ function requireHeaders$1() {
109236
109255
  types: ["sequence<sequence<ByteString>>", "record<ByteString, ByteString>"]
109237
109256
  });
109238
109257
  };
109239
- headers$1 = {
109258
+ headers = {
109240
109259
  fill,
109241
109260
  // for test.
109242
109261
  compareHeaderName,
@@ -109247,7 +109266,7 @@ function requireHeaders$1() {
109247
109266
  setHeadersList,
109248
109267
  getHeadersList
109249
109268
  };
109250
- return headers$1;
109269
+ return headers;
109251
109270
  }
109252
109271
  var response;
109253
109272
  var hasRequiredResponse;
@@ -109255,7 +109274,7 @@ function requireResponse() {
109255
109274
  var _headers, _state;
109256
109275
  if (hasRequiredResponse) return response;
109257
109276
  hasRequiredResponse = 1;
109258
- const { Headers: Headers2, HeadersList, fill, getHeadersGuard, setHeadersGuard, setHeadersList } = requireHeaders$1();
109277
+ const { Headers: Headers2, HeadersList, fill, getHeadersGuard, setHeadersGuard, setHeadersList } = requireHeaders();
109259
109278
  const { extractBody, cloneBody, mixinBody, streamRegistry, bodyUnusable } = requireBody();
109260
109279
  const util2 = requireUtil$5();
109261
109280
  const nodeUtil = require$$3;
@@ -109684,7 +109703,7 @@ function requireRequest() {
109684
109703
  if (hasRequiredRequest) return request;
109685
109704
  hasRequiredRequest = 1;
109686
109705
  const { extractBody, mixinBody, cloneBody, bodyUnusable } = requireBody();
109687
- const { Headers: Headers2, fill: fillHeaders, HeadersList, setHeadersGuard, getHeadersGuard, setHeadersList, getHeadersList } = requireHeaders$1();
109706
+ const { Headers: Headers2, fill: fillHeaders, HeadersList, setHeadersGuard, getHeadersGuard, setHeadersList, getHeadersList } = requireHeaders();
109688
109707
  const util2 = requireUtil$5();
109689
109708
  const nodeUtil = require$$3;
109690
109709
  const {
@@ -110592,7 +110611,7 @@ function requireFetch() {
110592
110611
  fromInnerResponse,
110593
110612
  getResponseState
110594
110613
  } = requireResponse();
110595
- const { HeadersList } = requireHeaders$1();
110614
+ const { HeadersList } = requireHeaders();
110596
110615
  const { Request: Request2, cloneRequest, getRequestDispatcher, getRequestState } = requireRequest();
110597
110616
  const zlib = require$$3$1;
110598
110617
  const {
@@ -111746,12 +111765,12 @@ function requireUtil$3() {
111746
111765
  };
111747
111766
  return util$3;
111748
111767
  }
111749
- var cache$1;
111750
- var hasRequiredCache$1;
111751
- function requireCache$1() {
111768
+ var cache;
111769
+ var hasRequiredCache;
111770
+ function requireCache() {
111752
111771
  var _relevantRequestResponseList, _Cache_instances, batchCacheOperations_fn, queryCache_fn, requestMatchesCachedItem_fn, internalMatchAll_fn;
111753
- if (hasRequiredCache$1) return cache$1;
111754
- hasRequiredCache$1 = 1;
111772
+ if (hasRequiredCache) return cache;
111773
+ hasRequiredCache = 1;
111755
111774
  const assert2 = require$$0$4;
111756
111775
  const { kConstruct } = requireSymbols();
111757
111776
  const { urlEquals, getFieldValues } = requireUtil$3();
@@ -112295,10 +112314,10 @@ function requireCache$1() {
112295
112314
  webidl.converters["sequence<RequestInfo>"] = webidl.sequenceConverter(
112296
112315
  webidl.converters.RequestInfo
112297
112316
  );
112298
- cache$1 = {
112317
+ cache = {
112299
112318
  Cache
112300
112319
  };
112301
- return cache$1;
112320
+ return cache;
112302
112321
  }
112303
112322
  var cachestorage;
112304
112323
  var hasRequiredCachestorage;
@@ -112306,7 +112325,7 @@ function requireCachestorage() {
112306
112325
  var _caches;
112307
112326
  if (hasRequiredCachestorage) return cachestorage;
112308
112327
  hasRequiredCachestorage = 1;
112309
- const { Cache } = requireCache$1();
112328
+ const { Cache } = requireCache();
112310
112329
  const { webidl } = requireWebidl();
112311
112330
  const { kEnumerableProperty } = requireUtil$5();
112312
112331
  const { kConstruct } = requireSymbols();
@@ -112745,7 +112764,7 @@ function requireCookies() {
112745
112764
  const { parseSetCookie } = requireParse$1();
112746
112765
  const { stringify: stringify2 } = requireUtil$2();
112747
112766
  const { webidl } = requireWebidl();
112748
- const { Headers: Headers2 } = requireHeaders$1();
112767
+ const { Headers: Headers2 } = requireHeaders();
112749
112768
  const brandChecks = webidl.brandCheckMultiple([Headers2, globalThis.Headers].filter(Boolean));
112750
112769
  function getCookies(headers2) {
112751
112770
  webidl.argumentLengthCheck(arguments, 1, "getCookies");
@@ -113500,7 +113519,7 @@ function requireConnection() {
113500
113519
  const { parseExtensions, isClosed, isClosing, isEstablished, isConnecting, validateCloseCodeAndReason } = requireUtil$1();
113501
113520
  const { makeRequest: makeRequest2 } = requireRequest();
113502
113521
  const { fetching } = requireFetch();
113503
- const { Headers: Headers2, getHeadersList } = requireHeaders$1();
113522
+ const { Headers: Headers2, getHeadersList } = requireHeaders();
113504
113523
  const { getDecodeSplit } = requireUtil$4();
113505
113524
  const { WebsocketFrameSend } = requireFrame();
113506
113525
  const assert2 = require$$0$4;
@@ -115705,7 +115724,7 @@ function requireUndici() {
115705
115724
  retry: requireRetry(),
115706
115725
  dump: requireDump(),
115707
115726
  dns: requireDns(),
115708
- cache: requireCache$2(),
115727
+ cache: requireCache$1(),
115709
115728
  decompress: requireDecompress(),
115710
115729
  deduplicate: requireDeduplicate()
115711
115730
  };
@@ -115791,7 +115810,7 @@ ${captureLines}` : capture.stack;
115791
115810
  throw err;
115792
115811
  });
115793
115812
  };
115794
- module.exports.Headers = requireHeaders$1().Headers;
115813
+ module.exports.Headers = requireHeaders().Headers;
115795
115814
  module.exports.Response = requireResponse().Response;
115796
115815
  module.exports.Request = requireRequest().Request;
115797
115816
  module.exports.FormData = requireFormdata().FormData;
@@ -115890,13 +115909,11 @@ function isDetachedArrayBufferQueueError(error2) {
115890
115909
  return false;
115891
115910
  }
115892
115911
  function getQueueRoute(queueName) {
115893
- if (queueName.startsWith("__wkf_step_")) {
115894
- return { pathname: "step", prefix: "__wkf_step_" };
115895
- }
115896
- if (queueName.startsWith("__wkf_workflow_")) {
115897
- return { pathname: "flow", prefix: "__wkf_workflow_" };
115898
- }
115899
- throw new Error("Unknown queue name prefix");
115912
+ const { kind, prefix } = parseQueueName(queueName);
115913
+ return {
115914
+ pathname: kind === "workflow" ? "flow" : "step",
115915
+ prefix
115916
+ };
115900
115917
  }
115901
115918
  function createQueue$2(config2) {
115902
115919
  const httpAgent = new undiciExports.Agent({
@@ -117372,7 +117389,7 @@ function createLocalWorld(args) {
117372
117389
  const basedir = mergedConfig.dataDir;
117373
117390
  const hooksDir = path$3.join(basedir, "hooks");
117374
117391
  const taggedHookFiles = await listTaggedFiles(hooksDir, tag);
117375
- const { HookSchema: HookSchema2 } = await import("./index-U5RLwYV5.js");
117392
+ const { HookSchema: HookSchema2 } = await import("./index-rguLY73T.js");
117376
117393
  await Promise.all(taggedHookFiles.map(async (hookFile) => {
117377
117394
  const hook = await readJSON(path$3.join(hooksDir, hookFile), HookSchema2);
117378
117395
  if (hook == null ? void 0 : hook.token) {
@@ -117406,11 +117423,11 @@ function createLocalWorld(args) {
117406
117423
  }
117407
117424
  };
117408
117425
  }
117409
- var getContext_1$1;
117410
- var hasRequiredGetContext$1;
117411
- function requireGetContext$1() {
117412
- if (hasRequiredGetContext$1) return getContext_1$1;
117413
- hasRequiredGetContext$1 = 1;
117426
+ var getContext_1;
117427
+ var hasRequiredGetContext;
117428
+ function requireGetContext() {
117429
+ if (hasRequiredGetContext) return getContext_1;
117430
+ hasRequiredGetContext = 1;
117414
117431
  var __defProp3 = Object.defineProperty;
117415
117432
  var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
117416
117433
  var __getOwnPropNames2 = Object.getOwnPropertyNames;
@@ -117433,14 +117450,14 @@ function requireGetContext$1() {
117433
117450
  SYMBOL_FOR_REQ_CONTEXT: () => SYMBOL_FOR_REQ_CONTEXT,
117434
117451
  getContext: () => getContext
117435
117452
  });
117436
- getContext_1$1 = __toCommonJS(get_context_exports);
117453
+ getContext_1 = __toCommonJS(get_context_exports);
117437
117454
  const SYMBOL_FOR_REQ_CONTEXT = Symbol.for("@vercel/request-context");
117438
117455
  function getContext() {
117439
117456
  var _a3, _b2;
117440
117457
  const fromSymbol = globalThis;
117441
117458
  return ((_b2 = (_a3 = fromSymbol[SYMBOL_FOR_REQ_CONTEXT]) == null ? void 0 : _a3.get) == null ? void 0 : _b2.call(_a3)) ?? {};
117442
117459
  }
117443
- return getContext_1$1;
117460
+ return getContext_1;
117444
117461
  }
117445
117462
  var tokenError;
117446
117463
  var hasRequiredTokenError;
@@ -117512,7 +117529,7 @@ function requireGetVercelOidcToken() {
117512
117529
  getVercelOidcTokenSync: () => getVercelOidcTokenSync
117513
117530
  });
117514
117531
  getVercelOidcToken_1 = __toCommonJS(get_vercel_oidc_token_exports);
117515
- var import_get_context = requireGetContext$1();
117532
+ var import_get_context = requireGetContext();
117516
117533
  var import_token_error = requireTokenError();
117517
117534
  async function getVercelOidcToken(options) {
117518
117535
  let token = "";
@@ -117524,8 +117541,8 @@ function requireGetVercelOidcToken() {
117524
117541
  }
117525
117542
  try {
117526
117543
  const [{ getTokenPayload, isExpired }, { refreshToken }] = await Promise.all([
117527
- await import("./token-util-BvFOCYE8.js").then((n) => n.t),
117528
- await import("./token-CYpoZN9a.js").then((n) => n.t)
117544
+ await import("./token-util-DvAHyiW3.js").then((n) => n.t),
117545
+ await import("./token-D7Mmh4mK.js").then((n) => n.t)
117529
117546
  ]);
117530
117547
  if (!token || isExpired(getTokenPayload(token), options == null ? void 0 : options.expirationBufferMs)) {
117531
117548
  await refreshToken(options);
@@ -118082,7 +118099,7 @@ function requireDist() {
118082
118099
  });
118083
118100
  dist = __toCommonJS(src_exports);
118084
118101
  var import_get_vercel_oidc_token = requireGetVercelOidcToken();
118085
- var import_get_context = requireGetContext$1();
118102
+ var import_get_context = requireGetContext();
118086
118103
  var import_auth_errors = requireAuthErrors();
118087
118104
  var import_token_util = requireTokenUtil();
118088
118105
  return dist;
@@ -120703,6 +120720,15 @@ var MessageCorruptedError = class extends Error {
120703
120720
  this.name = "MessageCorruptedError";
120704
120721
  }
120705
120722
  };
120723
+ var TooManyRequestsError = class extends Error {
120724
+ constructor(message2 = "Too many requests", retryAfter) {
120725
+ super(message2);
120726
+ /** Suggested retry delay in seconds, from the Retry-After header, if sent. */
120727
+ __publicField(this, "retryAfter");
120728
+ this.name = "TooManyRequestsError";
120729
+ this.retryAfter = retryAfter;
120730
+ }
120731
+ };
120706
120732
  var UnauthorizedError = class extends Error {
120707
120733
  constructor(message2 = "Missing or invalid authentication token") {
120708
120734
  super(message2);
@@ -120766,6 +120792,8 @@ var MIN_VISIBILITY_TIMEOUT_SECONDS = 30;
120766
120792
  var MAX_RENEWAL_INTERVAL_SECONDS = 60;
120767
120793
  var MIN_RENEWAL_INTERVAL_SECONDS = 10;
120768
120794
  var RETRY_INTERVAL_MS = 3e3;
120795
+ var DIRECTIVE_CALL_ATTEMPTS = 3;
120796
+ var DIRECTIVE_CALL_RETRY_DELAY_MS = 250;
120769
120797
  function calculateRenewalInterval(visibilityTimeoutSeconds) {
120770
120798
  return Math.min(
120771
120799
  MAX_RENEWAL_INTERVAL_SECONDS,
@@ -120809,6 +120837,54 @@ var ConsumerGroup = class {
120809
120837
  error2 instanceof UnauthorizedError || // 401 - auth failed
120810
120838
  error2 instanceof ForbiddenError;
120811
120839
  }
120840
+ /**
120841
+ * Network-level failures (DNS, connection reset, socket close) surface
120842
+ * from fetch as TypeError with the cause attached; any response that
120843
+ * actually reached the server — whatever its HTTP status — does not.
120844
+ */
120845
+ isNetworkError(error2) {
120846
+ return error2 instanceof TypeError;
120847
+ }
120848
+ /**
120849
+ * Run a directive call (acknowledge / changeVisibility) with bounded
120850
+ * retries. Only failures that are worth re-attempting in process are
120851
+ * retried:
120852
+ * - network-level failures (the request may never have reached the
120853
+ * server), with jittered linear backoff;
120854
+ * - 429 responses that carry a Retry-After header, waiting the
120855
+ * indicated delay.
120856
+ * Everything else — other 4xx, 5xx, 429 without Retry-After — is
120857
+ * thrown immediately.
120858
+ */
120859
+ async directiveCallWithRetries(fn2) {
120860
+ let lastError;
120861
+ for (let attempt = 1; attempt <= DIRECTIVE_CALL_ATTEMPTS; attempt++) {
120862
+ try {
120863
+ return await fn2();
120864
+ } catch (error2) {
120865
+ lastError = error2;
120866
+ if (attempt === DIRECTIVE_CALL_ATTEMPTS) {
120867
+ throw error2;
120868
+ }
120869
+ if (error2 instanceof TooManyRequestsError) {
120870
+ if (error2.retryAfter === void 0) {
120871
+ throw error2;
120872
+ }
120873
+ await new Promise(
120874
+ (resolve2) => setTimeout(resolve2, error2.retryAfter * 1e3)
120875
+ );
120876
+ continue;
120877
+ }
120878
+ if (!this.isNetworkError(error2)) {
120879
+ throw error2;
120880
+ }
120881
+ const baseDelayMs = DIRECTIVE_CALL_RETRY_DELAY_MS * attempt;
120882
+ const delayMs = baseDelayMs / 2 + Math.random() * (baseDelayMs / 2);
120883
+ await new Promise((resolve2) => setTimeout(resolve2, delayMs));
120884
+ }
120885
+ }
120886
+ throw lastError;
120887
+ }
120812
120888
  /**
120813
120889
  * Starts a background loop that periodically extends the visibility timeout for a message.
120814
120890
  *
@@ -120953,11 +121029,13 @@ var ConsumerGroup = class {
120953
121029
  if (directive) {
120954
121030
  if ("acknowledge" in directive && directive.acknowledge) {
120955
121031
  try {
120956
- await this.client.acknowledgeMessage({
120957
- queueName: this.topicName,
120958
- consumerGroup: this.consumerGroupName,
120959
- receiptHandle: message2.receiptHandle
120960
- });
121032
+ await this.directiveCallWithRetries(
121033
+ () => this.client.acknowledgeMessage({
121034
+ queueName: this.topicName,
121035
+ consumerGroup: this.consumerGroupName,
121036
+ receiptHandle: message2.receiptHandle
121037
+ })
121038
+ );
120961
121039
  } catch (ackError) {
120962
121040
  console.warn("Failed to acknowledge message:", ackError);
120963
121041
  }
@@ -120966,12 +121044,14 @@ var ConsumerGroup = class {
120966
121044
  }
120967
121045
  if ("afterSeconds" in directive && typeof directive.afterSeconds === "number") {
120968
121046
  try {
120969
- await this.client.changeVisibility({
120970
- queueName: this.topicName,
120971
- consumerGroup: this.consumerGroupName,
120972
- receiptHandle: message2.receiptHandle,
120973
- visibilityTimeoutSeconds: directive.afterSeconds
120974
- });
121047
+ await this.directiveCallWithRetries(
121048
+ () => this.client.changeVisibility({
121049
+ queueName: this.topicName,
121050
+ consumerGroup: this.consumerGroupName,
121051
+ receiptHandle: message2.receiptHandle,
121052
+ visibilityTimeoutSeconds: directive.afterSeconds
121053
+ })
121054
+ );
120975
121055
  } catch (changeError) {
120976
121056
  console.warn(
120977
121057
  "Failed to reschedule message for retry:",
@@ -121989,10 +122069,28 @@ async function consumeStream(stream) {
121989
122069
  reader.releaseLock();
121990
122070
  }
121991
122071
  }
121992
- function throwCommonHttpError(status, statusText, errorText, operation, badRequestDefault = "Invalid parameters") {
122072
+ function parseRetryAfterSeconds(value) {
122073
+ if (!value) return void 0;
122074
+ const seconds = Number(value);
122075
+ if (Number.isFinite(seconds) && seconds >= 0) {
122076
+ return seconds;
122077
+ }
122078
+ const dateMs = Date.parse(value);
122079
+ if (!Number.isNaN(dateMs)) {
122080
+ return Math.max(0, (dateMs - Date.now()) / 1e3);
122081
+ }
122082
+ return void 0;
122083
+ }
122084
+ function throwCommonHttpError(status, statusText, errorText, operation, badRequestDefault = "Invalid parameters", retryAfterHeader) {
121993
122085
  if (status === 400) {
121994
122086
  throw new BadRequestError(errorText || badRequestDefault);
121995
122087
  }
122088
+ if (status === 429) {
122089
+ throw new TooManyRequestsError(
122090
+ errorText || `Too many requests: ${operation}`,
122091
+ parseRetryAfterSeconds(retryAfterHeader)
122092
+ );
122093
+ }
121996
122094
  if (status === 401) {
121997
122095
  throw new UnauthorizedError(errorText || void 0);
121998
122096
  }
@@ -122169,7 +122267,7 @@ Cause: ${cause}`
122169
122267
  }
122170
122268
  console.debug("[VQS Debug] Request:", JSON.stringify(logData, null, 2));
122171
122269
  }
122172
- init2.headers.set("User-Agent", `@vercel/queue/${"0.3.0"}`);
122270
+ init2.headers.set("User-Agent", `@vercel/queue/${"0.3.1"}`);
122173
122271
  init2.headers.set("Vqs-Client-Ts", (/* @__PURE__ */ new Date()).toISOString());
122174
122272
  const fetchInit = this.dispatcher ? { ...init2, dispatcher: this.dispatcher } : init2;
122175
122273
  const response2 = await fetch(url2, fetchInit);
@@ -122410,6 +122508,7 @@ Cause: ${cause}`
122410
122508
  throw new MessageNotFoundError(messageId);
122411
122509
  }
122412
122510
  async acknowledgeMessage(options) {
122511
+ var _a3;
122413
122512
  const { queueName, consumerGroup, receiptHandle } = options;
122414
122513
  const headers2 = new Headers({
122415
122514
  Authorization: `Bearer ${await this.getToken()}`,
@@ -122448,13 +122547,15 @@ Cause: ${cause}`
122448
122547
  response2.statusText,
122449
122548
  errorText,
122450
122549
  "acknowledge message",
122451
- "Missing or invalid receipt handle"
122550
+ "Missing or invalid receipt handle",
122551
+ ((_a3 = response2.headers) == null ? void 0 : _a3.get("Retry-After")) ?? null
122452
122552
  );
122453
122553
  }
122454
122554
  await response2.text();
122455
122555
  return { acknowledged: true };
122456
122556
  }
122457
122557
  async changeVisibility(options) {
122558
+ var _a3;
122458
122559
  const {
122459
122560
  queueName,
122460
122561
  consumerGroup,
@@ -122500,7 +122601,8 @@ Cause: ${cause}`
122500
122601
  response2.statusText,
122501
122602
  errorText,
122502
122603
  "change visibility",
122503
- "Missing receipt handle or invalid visibility timeout"
122604
+ "Missing receipt handle or invalid visibility timeout",
122605
+ ((_a3 = response2.headers) == null ? void 0 : _a3.get("Retry-After")) ?? null
122504
122606
  );
122505
122607
  }
122506
122608
  await response2.text();
@@ -122715,7 +122817,7 @@ var QueueClient = class {
122715
122817
  setApi(this, new ApiClient({ ...options, region }));
122716
122818
  }
122717
122819
  };
122718
- const version = "4.4.0";
122820
+ const version = "4.4.1";
122719
122821
  const HTTP_DEBUG_ENABLED = typeof process !== "undefined" && typeof process.env.DEBUG === "string" && (process.env.DEBUG.includes("workflow:") || process.env.DEBUG === "*");
122720
122822
  function httpLog(method, endpoint, response2, ms2) {
122721
122823
  if (HTTP_DEBUG_ENABLED) {
@@ -124128,8 +124230,10 @@ function createStreamer(config2) {
124128
124230
  if (typeof startIndex === "number") {
124129
124231
  url2.searchParams.set("startIndex", String(startIndex));
124130
124232
  }
124233
+ const abortController = new AbortController();
124131
124234
  const response2 = await fetch(url2, {
124132
- headers: httpConfig.headers
124235
+ headers: httpConfig.headers,
124236
+ signal: abortController.signal
124133
124237
  });
124134
124238
  if (!response2.ok) {
124135
124239
  throw new Error(`Failed to fetch stream: ${response2.status}`);
@@ -124137,7 +124241,30 @@ function createStreamer(config2) {
124137
124241
  if (!response2.body) {
124138
124242
  throw new Error("No response body for stream");
124139
124243
  }
124140
- return response2.body;
124244
+ const upstream = response2.body;
124245
+ return new ReadableStream({
124246
+ start(controller) {
124247
+ const reader = upstream.getReader();
124248
+ const pump = async () => {
124249
+ try {
124250
+ for (; ; ) {
124251
+ const { done, value } = await reader.read();
124252
+ if (done) {
124253
+ controller.close();
124254
+ return;
124255
+ }
124256
+ controller.enqueue(value);
124257
+ }
124258
+ } catch (err) {
124259
+ controller.error(err);
124260
+ }
124261
+ };
124262
+ pump();
124263
+ },
124264
+ cancel(reason) {
124265
+ abortController.abort(reason);
124266
+ }
124267
+ });
124141
124268
  },
124142
124269
  async getStreamChunks(name2, runId, options) {
124143
124270
  const params = new URLSearchParams();
@@ -124241,11 +124368,12 @@ const getWorld = () => {
124241
124368
  };
124242
124369
  const DEFAULT_HEALTH_CHECK_TIMEOUT = 3e4;
124243
124370
  const SAFE_WORKFLOW_NAME_PATTERN = /^[a-zA-Z0-9_\-./@]+$/;
124244
- function getWorkflowQueueName(workflowName) {
124371
+ function getWorkflowQueueName(workflowName, namespace2) {
124245
124372
  if (!SAFE_WORKFLOW_NAME_PATTERN.test(workflowName)) {
124246
124373
  throw new Error(`Invalid workflow name "${workflowName}": must only contain alphanumeric characters, underscores, hyphens, dots, forward slashes, or at signs`);
124247
124374
  }
124248
- return `__wkf_workflow_${workflowName}`;
124375
+ const prefix = getQueueTopicPrefix("workflow", resolveQueueNamespace(namespace2));
124376
+ return `${prefix}${workflowName}`;
124249
124377
  }
124250
124378
  const generateId = monotonicFactory();
124251
124379
  function getHealthCheckStreamName(correlationId) {
@@ -124383,7 +124511,7 @@ async function healthCheck(world, endpoint, options) {
124383
124511
  const timeout2 = (options == null ? void 0 : options.timeout) ?? DEFAULT_HEALTH_CHECK_TIMEOUT;
124384
124512
  const correlationId = generateId();
124385
124513
  const streamName = getHealthCheckStreamName(correlationId);
124386
- const queueName = endpoint === "workflow" ? "__wkf_workflow_health_check" : "__wkf_step_health_check";
124514
+ const queueName = `${getQueueTopicPrefix(endpoint, resolveQueueNamespace(options == null ? void 0 : options.namespace))}health_check`;
124387
124515
  const startTime = Date.now();
124388
124516
  try {
124389
124517
  await withHealthCheckTimeout(world.queue(queueName, { __healthCheck: true, correlationId }, {
@@ -124450,1098 +124578,6 @@ function getQueueOverhead(message2) {
124450
124578
  return;
124451
124579
  }
124452
124580
  }
124453
- var headers;
124454
- var hasRequiredHeaders;
124455
- function requireHeaders() {
124456
- if (hasRequiredHeaders) return headers;
124457
- hasRequiredHeaders = 1;
124458
- var __defProp3 = Object.defineProperty;
124459
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
124460
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
124461
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
124462
- var __export2 = (target2, all2) => {
124463
- for (var name2 in all2)
124464
- __defProp3(target2, name2, { get: all2[name2], enumerable: true });
124465
- };
124466
- var __copyProps2 = (to2, from, except, desc) => {
124467
- if (from && typeof from === "object" || typeof from === "function") {
124468
- for (let key of __getOwnPropNames2(from))
124469
- if (!__hasOwnProp2.call(to2, key) && key !== except)
124470
- __defProp3(to2, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
124471
- }
124472
- return to2;
124473
- };
124474
- var __toCommonJS = (mod) => __copyProps2(__defProp3({}, "__esModule", { value: true }), mod);
124475
- var headers_exports = {};
124476
- __export2(headers_exports, {
124477
- CITY_HEADER_NAME: () => CITY_HEADER_NAME,
124478
- COUNTRY_HEADER_NAME: () => COUNTRY_HEADER_NAME,
124479
- EMOJI_FLAG_UNICODE_STARTING_POSITION: () => EMOJI_FLAG_UNICODE_STARTING_POSITION,
124480
- IP_HEADER_NAME: () => IP_HEADER_NAME,
124481
- LATITUDE_HEADER_NAME: () => LATITUDE_HEADER_NAME,
124482
- LONGITUDE_HEADER_NAME: () => LONGITUDE_HEADER_NAME,
124483
- POSTAL_CODE_HEADER_NAME: () => POSTAL_CODE_HEADER_NAME,
124484
- REGION_HEADER_NAME: () => REGION_HEADER_NAME,
124485
- REQUEST_ID_HEADER_NAME: () => REQUEST_ID_HEADER_NAME,
124486
- geolocation: () => geolocation,
124487
- ipAddress: () => ipAddress
124488
- });
124489
- headers = __toCommonJS(headers_exports);
124490
- const CITY_HEADER_NAME = "x-vercel-ip-city";
124491
- const COUNTRY_HEADER_NAME = "x-vercel-ip-country";
124492
- const IP_HEADER_NAME = "x-real-ip";
124493
- const LATITUDE_HEADER_NAME = "x-vercel-ip-latitude";
124494
- const LONGITUDE_HEADER_NAME = "x-vercel-ip-longitude";
124495
- const REGION_HEADER_NAME = "x-vercel-ip-country-region";
124496
- const POSTAL_CODE_HEADER_NAME = "x-vercel-ip-postal-code";
124497
- const REQUEST_ID_HEADER_NAME = "x-vercel-id";
124498
- const EMOJI_FLAG_UNICODE_STARTING_POSITION = 127397;
124499
- function getHeader2(headers2, key) {
124500
- return headers2.get(key) ?? void 0;
124501
- }
124502
- function getHeaderWithDecode(request2, key) {
124503
- const header = getHeader2(request2.headers, key);
124504
- return header ? decodeURIComponent(header) : void 0;
124505
- }
124506
- function getFlag(countryCode) {
124507
- const regex = new RegExp("^[A-Z]{2}$").test(countryCode);
124508
- if (!countryCode || !regex)
124509
- return void 0;
124510
- return String.fromCodePoint(
124511
- ...countryCode.split("").map((char) => EMOJI_FLAG_UNICODE_STARTING_POSITION + char.charCodeAt(0))
124512
- );
124513
- }
124514
- function ipAddress(input) {
124515
- const headers2 = "headers" in input ? input.headers : input;
124516
- return getHeader2(headers2, IP_HEADER_NAME);
124517
- }
124518
- function getRegionFromRequestId(requestId) {
124519
- if (!requestId) {
124520
- return "dev1";
124521
- }
124522
- return requestId.split(":")[0];
124523
- }
124524
- function geolocation(request2) {
124525
- return {
124526
- // city name may be encoded to support multi-byte characters
124527
- city: getHeaderWithDecode(request2, CITY_HEADER_NAME),
124528
- country: getHeader2(request2.headers, COUNTRY_HEADER_NAME),
124529
- flag: getFlag(getHeader2(request2.headers, COUNTRY_HEADER_NAME)),
124530
- countryRegion: getHeader2(request2.headers, REGION_HEADER_NAME),
124531
- region: getRegionFromRequestId(
124532
- getHeader2(request2.headers, REQUEST_ID_HEADER_NAME)
124533
- ),
124534
- latitude: getHeader2(request2.headers, LATITUDE_HEADER_NAME),
124535
- longitude: getHeader2(request2.headers, LONGITUDE_HEADER_NAME),
124536
- postalCode: getHeader2(request2.headers, POSTAL_CODE_HEADER_NAME)
124537
- };
124538
- }
124539
- return headers;
124540
- }
124541
- var getEnv_1;
124542
- var hasRequiredGetEnv;
124543
- function requireGetEnv() {
124544
- if (hasRequiredGetEnv) return getEnv_1;
124545
- hasRequiredGetEnv = 1;
124546
- var __defProp3 = Object.defineProperty;
124547
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
124548
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
124549
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
124550
- var __export2 = (target2, all2) => {
124551
- for (var name2 in all2)
124552
- __defProp3(target2, name2, { get: all2[name2], enumerable: true });
124553
- };
124554
- var __copyProps2 = (to2, from, except, desc) => {
124555
- if (from && typeof from === "object" || typeof from === "function") {
124556
- for (let key of __getOwnPropNames2(from))
124557
- if (!__hasOwnProp2.call(to2, key) && key !== except)
124558
- __defProp3(to2, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
124559
- }
124560
- return to2;
124561
- };
124562
- var __toCommonJS = (mod) => __copyProps2(__defProp3({}, "__esModule", { value: true }), mod);
124563
- var get_env_exports = {};
124564
- __export2(get_env_exports, {
124565
- getEnv: () => getEnv
124566
- });
124567
- getEnv_1 = __toCommonJS(get_env_exports);
124568
- const getEnv = (env2 = process.env) => ({
124569
- /**
124570
- * An indicator to show that System Environment Variables have been exposed to your project's Deployments.
124571
- * @example "1"
124572
- */
124573
- VERCEL: get2(env2, "VERCEL"),
124574
- /**
124575
- * An indicator that the code is running in a Continuous Integration environment.
124576
- * @example "1"
124577
- */
124578
- CI: get2(env2, "CI"),
124579
- /**
124580
- * The Environment that the app is deployed and running on.
124581
- * @example "production"
124582
- */
124583
- VERCEL_ENV: get2(env2, "VERCEL_ENV"),
124584
- /**
124585
- * The domain name of the generated deployment URL. The value does not include the protocol scheme https://.
124586
- * NOTE: This Variable cannot be used in conjunction with Standard Deployment Protection.
124587
- * @example "*.vercel.app"
124588
- */
124589
- VERCEL_URL: get2(env2, "VERCEL_URL"),
124590
- /**
124591
- * The domain name of the generated Git branch URL. The value does not include the protocol scheme https://.
124592
- * @example "*-git-*.vercel.app"
124593
- */
124594
- VERCEL_BRANCH_URL: get2(env2, "VERCEL_BRANCH_URL"),
124595
- /**
124596
- * A production domain name of the project. This is useful to reliably generate links that point to production such as OG-image URLs.
124597
- * The value does not include the protocol scheme https://.
124598
- * @example "myproject.vercel.app"
124599
- */
124600
- VERCEL_PROJECT_PRODUCTION_URL: get2(env2, "VERCEL_PROJECT_PRODUCTION_URL"),
124601
- /**
124602
- * The ID of the Region where the app is running.
124603
- *
124604
- * Possible values:
124605
- * - arn1 (Stockholm, Sweden)
124606
- * - bom1 (Mumbai, India)
124607
- * - cdg1 (Paris, France)
124608
- * - cle1 (Cleveland, USA)
124609
- * - cpt1 (Cape Town, South Africa)
124610
- * - dub1 (Dublin, Ireland)
124611
- * - fra1 (Frankfurt, Germany)
124612
- * - gru1 (São Paulo, Brazil)
124613
- * - hkg1 (Hong Kong)
124614
- * - hnd1 (Tokyo, Japan)
124615
- * - iad1 (Washington, D.C., USA)
124616
- * - icn1 (Seoul, South Korea)
124617
- * - kix1 (Osaka, Japan)
124618
- * - lhr1 (London, United Kingdom)
124619
- * - pdx1 (Portland, USA)
124620
- * - sfo1 (San Francisco, USA)
124621
- * - sin1 (Singapore)
124622
- * - syd1 (Sydney, Australia)
124623
- * - dev1 (Development Region)
124624
- *
124625
- * @example "iad1"
124626
- */
124627
- VERCEL_REGION: get2(env2, "VERCEL_REGION"),
124628
- /**
124629
- * The unique identifier for the deployment, which can be used to implement Skew Protection.
124630
- * @example "dpl_7Gw5ZMBpQA8h9GF832KGp7nwbuh3"
124631
- */
124632
- VERCEL_DEPLOYMENT_ID: get2(env2, "VERCEL_DEPLOYMENT_ID"),
124633
- /**
124634
- * When Skew Protection is enabled in Project Settings, this value is set to 1.
124635
- * @example "1"
124636
- */
124637
- VERCEL_SKEW_PROTECTION_ENABLED: get2(env2, "VERCEL_SKEW_PROTECTION_ENABLED"),
124638
- /**
124639
- * The Protection Bypass for Automation value, if the secret has been generated in the project's Deployment Protection settings.
124640
- */
124641
- VERCEL_AUTOMATION_BYPASS_SECRET: get2(env2, "VERCEL_AUTOMATION_BYPASS_SECRET"),
124642
- /**
124643
- * The Git Provider the deployment is triggered from.
124644
- * @example "github"
124645
- */
124646
- VERCEL_GIT_PROVIDER: get2(env2, "VERCEL_GIT_PROVIDER"),
124647
- /**
124648
- * The origin repository the deployment is triggered from.
124649
- * @example "my-site"
124650
- */
124651
- VERCEL_GIT_REPO_SLUG: get2(env2, "VERCEL_GIT_REPO_SLUG"),
124652
- /**
124653
- * The account that owns the repository the deployment is triggered from.
124654
- * @example "acme"
124655
- */
124656
- VERCEL_GIT_REPO_OWNER: get2(env2, "VERCEL_GIT_REPO_OWNER"),
124657
- /**
124658
- * The ID of the repository the deployment is triggered from.
124659
- * @example "117716146"
124660
- */
124661
- VERCEL_GIT_REPO_ID: get2(env2, "VERCEL_GIT_REPO_ID"),
124662
- /**
124663
- * The git branch of the commit the deployment was triggered by.
124664
- * @example "improve-about-page"
124665
- */
124666
- VERCEL_GIT_COMMIT_REF: get2(env2, "VERCEL_GIT_COMMIT_REF"),
124667
- /**
124668
- * The git SHA of the commit the deployment was triggered by.
124669
- * @example "fa1eade47b73733d6312d5abfad33ce9e4068081"
124670
- */
124671
- VERCEL_GIT_COMMIT_SHA: get2(env2, "VERCEL_GIT_COMMIT_SHA"),
124672
- /**
124673
- * The message attached to the commit the deployment was triggered by.
124674
- * @example "Update about page"
124675
- */
124676
- VERCEL_GIT_COMMIT_MESSAGE: get2(env2, "VERCEL_GIT_COMMIT_MESSAGE"),
124677
- /**
124678
- * The username attached to the author of the commit that the project was deployed by.
124679
- * @example "johndoe"
124680
- */
124681
- VERCEL_GIT_COMMIT_AUTHOR_LOGIN: get2(env2, "VERCEL_GIT_COMMIT_AUTHOR_LOGIN"),
124682
- /**
124683
- * The name attached to the author of the commit that the project was deployed by.
124684
- * @example "John Doe"
124685
- */
124686
- VERCEL_GIT_COMMIT_AUTHOR_NAME: get2(env2, "VERCEL_GIT_COMMIT_AUTHOR_NAME"),
124687
- /**
124688
- * The git SHA of the last successful deployment for the project and branch.
124689
- * NOTE: This Variable is only exposed when an Ignored Build Step is provided.
124690
- * @example "fa1eade47b73733d6312d5abfad33ce9e4068080"
124691
- */
124692
- VERCEL_GIT_PREVIOUS_SHA: get2(env2, "VERCEL_GIT_PREVIOUS_SHA"),
124693
- /**
124694
- * The pull request id the deployment was triggered by. If a deployment is created on a branch before a pull request is made, this value will be an empty string.
124695
- * @example "23"
124696
- */
124697
- VERCEL_GIT_PULL_REQUEST_ID: get2(env2, "VERCEL_GIT_PULL_REQUEST_ID")
124698
- });
124699
- const get2 = (env2, key) => {
124700
- const value = env2[key];
124701
- return value === "" ? void 0 : value;
124702
- };
124703
- return getEnv_1;
124704
- }
124705
- var getContext_1;
124706
- var hasRequiredGetContext;
124707
- function requireGetContext() {
124708
- if (hasRequiredGetContext) return getContext_1;
124709
- hasRequiredGetContext = 1;
124710
- var __defProp3 = Object.defineProperty;
124711
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
124712
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
124713
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
124714
- var __export2 = (target2, all2) => {
124715
- for (var name2 in all2)
124716
- __defProp3(target2, name2, { get: all2[name2], enumerable: true });
124717
- };
124718
- var __copyProps2 = (to2, from, except, desc) => {
124719
- if (from && typeof from === "object" || typeof from === "function") {
124720
- for (let key of __getOwnPropNames2(from))
124721
- if (!__hasOwnProp2.call(to2, key) && key !== except)
124722
- __defProp3(to2, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
124723
- }
124724
- return to2;
124725
- };
124726
- var __toCommonJS = (mod) => __copyProps2(__defProp3({}, "__esModule", { value: true }), mod);
124727
- var get_context_exports = {};
124728
- __export2(get_context_exports, {
124729
- SYMBOL_FOR_REQ_CONTEXT: () => SYMBOL_FOR_REQ_CONTEXT,
124730
- getContext: () => getContext
124731
- });
124732
- getContext_1 = __toCommonJS(get_context_exports);
124733
- const SYMBOL_FOR_REQ_CONTEXT = Symbol.for("@vercel/request-context");
124734
- function getContext() {
124735
- var _a3, _b2;
124736
- const fromSymbol = globalThis;
124737
- return ((_b2 = (_a3 = fromSymbol[SYMBOL_FOR_REQ_CONTEXT]) == null ? void 0 : _a3.get) == null ? void 0 : _b2.call(_a3)) ?? {};
124738
- }
124739
- return getContext_1;
124740
- }
124741
- var waitUntil_1;
124742
- var hasRequiredWaitUntil;
124743
- function requireWaitUntil() {
124744
- if (hasRequiredWaitUntil) return waitUntil_1;
124745
- hasRequiredWaitUntil = 1;
124746
- var __defProp3 = Object.defineProperty;
124747
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
124748
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
124749
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
124750
- var __export2 = (target2, all2) => {
124751
- for (var name2 in all2)
124752
- __defProp3(target2, name2, { get: all2[name2], enumerable: true });
124753
- };
124754
- var __copyProps2 = (to2, from, except, desc) => {
124755
- if (from && typeof from === "object" || typeof from === "function") {
124756
- for (let key of __getOwnPropNames2(from))
124757
- if (!__hasOwnProp2.call(to2, key) && key !== except)
124758
- __defProp3(to2, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
124759
- }
124760
- return to2;
124761
- };
124762
- var __toCommonJS = (mod) => __copyProps2(__defProp3({}, "__esModule", { value: true }), mod);
124763
- var wait_until_exports = {};
124764
- __export2(wait_until_exports, {
124765
- waitUntil: () => waitUntil
124766
- });
124767
- waitUntil_1 = __toCommonJS(wait_until_exports);
124768
- var import_get_context = requireGetContext();
124769
- const waitUntil = (promise2) => {
124770
- var _a3, _b2;
124771
- if (promise2 === null || typeof promise2 !== "object" || typeof promise2.then !== "function") {
124772
- throw new TypeError(
124773
- `waitUntil can only be called with a Promise, got ${typeof promise2}`
124774
- );
124775
- }
124776
- return (_b2 = (_a3 = (0, import_get_context.getContext)()).waitUntil) == null ? void 0 : _b2.call(_a3, promise2);
124777
- };
124778
- return waitUntil_1;
124779
- }
124780
- var middleware;
124781
- var hasRequiredMiddleware;
124782
- function requireMiddleware() {
124783
- if (hasRequiredMiddleware) return middleware;
124784
- hasRequiredMiddleware = 1;
124785
- var __defProp3 = Object.defineProperty;
124786
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
124787
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
124788
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
124789
- var __export2 = (target2, all2) => {
124790
- for (var name2 in all2)
124791
- __defProp3(target2, name2, { get: all2[name2], enumerable: true });
124792
- };
124793
- var __copyProps2 = (to2, from, except, desc) => {
124794
- if (from && typeof from === "object" || typeof from === "function") {
124795
- for (let key of __getOwnPropNames2(from))
124796
- if (!__hasOwnProp2.call(to2, key) && key !== except)
124797
- __defProp3(to2, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
124798
- }
124799
- return to2;
124800
- };
124801
- var __toCommonJS = (mod) => __copyProps2(__defProp3({}, "__esModule", { value: true }), mod);
124802
- var middleware_exports = {};
124803
- __export2(middleware_exports, {
124804
- next: () => next2,
124805
- rewrite: () => rewrite
124806
- });
124807
- middleware = __toCommonJS(middleware_exports);
124808
- function handleMiddlewareField(init2, headers2) {
124809
- var _a3;
124810
- if ((_a3 = init2 == null ? void 0 : init2.request) == null ? void 0 : _a3.headers) {
124811
- if (!(init2.request.headers instanceof Headers)) {
124812
- throw new Error("request.headers must be an instance of Headers");
124813
- }
124814
- const keys2 = [];
124815
- for (const [key, value] of init2.request.headers) {
124816
- headers2.set("x-middleware-request-" + key, value);
124817
- keys2.push(key);
124818
- }
124819
- headers2.set("x-middleware-override-headers", keys2.join(","));
124820
- }
124821
- }
124822
- function rewrite(destination, init2) {
124823
- const headers2 = new Headers((init2 == null ? void 0 : init2.headers) ?? {});
124824
- headers2.set("x-middleware-rewrite", String(destination));
124825
- handleMiddlewareField(init2, headers2);
124826
- return new Response(null, {
124827
- ...init2,
124828
- headers: headers2
124829
- });
124830
- }
124831
- function next2(init2) {
124832
- const headers2 = new Headers((init2 == null ? void 0 : init2.headers) ?? {});
124833
- headers2.set("x-middleware-next", "1");
124834
- handleMiddlewareField(init2, headers2);
124835
- return new Response(null, {
124836
- ...init2,
124837
- headers: headers2
124838
- });
124839
- }
124840
- return middleware;
124841
- }
124842
- var inMemoryCache;
124843
- var hasRequiredInMemoryCache;
124844
- function requireInMemoryCache() {
124845
- if (hasRequiredInMemoryCache) return inMemoryCache;
124846
- hasRequiredInMemoryCache = 1;
124847
- var __defProp3 = Object.defineProperty;
124848
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
124849
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
124850
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
124851
- var __export2 = (target2, all2) => {
124852
- for (var name2 in all2)
124853
- __defProp3(target2, name2, { get: all2[name2], enumerable: true });
124854
- };
124855
- var __copyProps2 = (to2, from, except, desc) => {
124856
- if (from && typeof from === "object" || typeof from === "function") {
124857
- for (let key of __getOwnPropNames2(from))
124858
- if (!__hasOwnProp2.call(to2, key) && key !== except)
124859
- __defProp3(to2, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
124860
- }
124861
- return to2;
124862
- };
124863
- var __toCommonJS = (mod) => __copyProps2(__defProp3({}, "__esModule", { value: true }), mod);
124864
- var in_memory_cache_exports = {};
124865
- __export2(in_memory_cache_exports, {
124866
- InMemoryCache: () => InMemoryCache
124867
- });
124868
- inMemoryCache = __toCommonJS(in_memory_cache_exports);
124869
- class InMemoryCache {
124870
- constructor() {
124871
- this.cache = {};
124872
- }
124873
- async get(key) {
124874
- const entry2 = this.cache[key];
124875
- if (entry2) {
124876
- if (entry2.ttl && entry2.lastModified + entry2.ttl * 1e3 < Date.now()) {
124877
- await this.delete(key);
124878
- return null;
124879
- }
124880
- return JSON.parse(entry2.value);
124881
- }
124882
- return null;
124883
- }
124884
- async set(key, value, options) {
124885
- const serialized = JSON.stringify(value ?? null);
124886
- this.cache[key] = {
124887
- value: serialized,
124888
- lastModified: Date.now(),
124889
- ttl: options == null ? void 0 : options.ttl,
124890
- tags: new Set((options == null ? void 0 : options.tags) || [])
124891
- };
124892
- }
124893
- async delete(key) {
124894
- delete this.cache[key];
124895
- }
124896
- async expireTag(tag) {
124897
- const tags = Array.isArray(tag) ? tag : [tag];
124898
- for (const key in this.cache) {
124899
- if (Object.prototype.hasOwnProperty.call(this.cache, key)) {
124900
- const entry2 = this.cache[key];
124901
- if (tags.some((t) => entry2.tags.has(t))) {
124902
- delete this.cache[key];
124903
- }
124904
- }
124905
- }
124906
- }
124907
- }
124908
- return inMemoryCache;
124909
- }
124910
- var buildClient;
124911
- var hasRequiredBuildClient;
124912
- function requireBuildClient() {
124913
- if (hasRequiredBuildClient) return buildClient;
124914
- hasRequiredBuildClient = 1;
124915
- var __defProp3 = Object.defineProperty;
124916
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
124917
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
124918
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
124919
- var __export2 = (target2, all2) => {
124920
- for (var name2 in all2)
124921
- __defProp3(target2, name2, { get: all2[name2], enumerable: true });
124922
- };
124923
- var __copyProps2 = (to2, from, except, desc) => {
124924
- if (from && typeof from === "object" || typeof from === "function") {
124925
- for (let key of __getOwnPropNames2(from))
124926
- if (!__hasOwnProp2.call(to2, key) && key !== except)
124927
- __defProp3(to2, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
124928
- }
124929
- return to2;
124930
- };
124931
- var __toCommonJS = (mod) => __copyProps2(__defProp3({}, "__esModule", { value: true }), mod);
124932
- var build_client_exports = {};
124933
- __export2(build_client_exports, {
124934
- BuildCache: () => BuildCache
124935
- });
124936
- buildClient = __toCommonJS(build_client_exports);
124937
- var import_index = requireCache();
124938
- class BuildCache {
124939
- constructor({
124940
- endpoint,
124941
- headers: headers2,
124942
- onError,
124943
- timeout: timeout2 = 500
124944
- }) {
124945
- this.get = async (key) => {
124946
- var _a3, _b2, _c, _d;
124947
- const controller = new AbortController();
124948
- const timeoutId = setTimeout(() => controller.abort(), this.timeout);
124949
- try {
124950
- const res = await fetch(`${this.endpoint}${key}`, {
124951
- headers: this.headers,
124952
- method: "GET",
124953
- signal: controller.signal
124954
- });
124955
- if (res.status === 404) {
124956
- clearTimeout(timeoutId);
124957
- return null;
124958
- }
124959
- if (res.status === 200) {
124960
- const cacheState = res.headers.get(
124961
- import_index.HEADERS_VERCEL_CACHE_STATE
124962
- );
124963
- if (cacheState !== import_index.PkgCacheState.Fresh) {
124964
- (_b2 = (_a3 = res.body) == null ? void 0 : _a3.cancel) == null ? void 0 : _b2.call(_a3);
124965
- clearTimeout(timeoutId);
124966
- return null;
124967
- }
124968
- const result = await res.json();
124969
- clearTimeout(timeoutId);
124970
- return result;
124971
- } else {
124972
- clearTimeout(timeoutId);
124973
- throw new Error(`Failed to get cache: ${res.statusText}`);
124974
- }
124975
- } catch (error2) {
124976
- clearTimeout(timeoutId);
124977
- if (error2.name === "AbortError") {
124978
- const timeoutError = new Error(
124979
- `Cache request timed out after ${this.timeout}ms`
124980
- );
124981
- timeoutError.stack = error2.stack;
124982
- (_c = this.onError) == null ? void 0 : _c.call(this, timeoutError);
124983
- } else {
124984
- (_d = this.onError) == null ? void 0 : _d.call(this, error2);
124985
- }
124986
- return null;
124987
- }
124988
- };
124989
- this.set = async (key, value, options) => {
124990
- var _a3, _b2;
124991
- const controller = new AbortController();
124992
- const timeoutId = setTimeout(() => controller.abort(), this.timeout);
124993
- try {
124994
- const optionalHeaders = {};
124995
- if (options == null ? void 0 : options.ttl) {
124996
- optionalHeaders[import_index.HEADERS_VERCEL_REVALIDATE] = options.ttl.toString();
124997
- }
124998
- if ((options == null ? void 0 : options.tags) && options.tags.length > 0) {
124999
- optionalHeaders[import_index.HEADERS_VERCEL_CACHE_TAGS] = options.tags.join(",");
125000
- }
125001
- if (options == null ? void 0 : options.name) {
125002
- optionalHeaders[import_index.HEADERS_VERCEL_CACHE_ITEM_NAME] = options.name;
125003
- }
125004
- const res = await fetch(`${this.endpoint}${key}`, {
125005
- method: "POST",
125006
- headers: {
125007
- ...this.headers,
125008
- ...optionalHeaders
125009
- },
125010
- body: JSON.stringify(value),
125011
- signal: controller.signal
125012
- });
125013
- clearTimeout(timeoutId);
125014
- if (res.status !== 200) {
125015
- throw new Error(`Failed to set cache: ${res.status} ${res.statusText}`);
125016
- }
125017
- } catch (error2) {
125018
- clearTimeout(timeoutId);
125019
- if (error2.name === "AbortError") {
125020
- const timeoutError = new Error(
125021
- `Cache request timed out after ${this.timeout}ms`
125022
- );
125023
- timeoutError.stack = error2.stack;
125024
- (_a3 = this.onError) == null ? void 0 : _a3.call(this, timeoutError);
125025
- } else {
125026
- (_b2 = this.onError) == null ? void 0 : _b2.call(this, error2);
125027
- }
125028
- }
125029
- };
125030
- this.delete = async (key) => {
125031
- var _a3, _b2;
125032
- const controller = new AbortController();
125033
- const timeoutId = setTimeout(() => controller.abort(), this.timeout);
125034
- try {
125035
- const res = await fetch(`${this.endpoint}${key}`, {
125036
- method: "DELETE",
125037
- headers: this.headers,
125038
- signal: controller.signal
125039
- });
125040
- clearTimeout(timeoutId);
125041
- if (res.status !== 200) {
125042
- throw new Error(`Failed to delete cache: ${res.statusText}`);
125043
- }
125044
- } catch (error2) {
125045
- clearTimeout(timeoutId);
125046
- if (error2.name === "AbortError") {
125047
- const timeoutError = new Error(
125048
- `Cache request timed out after ${this.timeout}ms`
125049
- );
125050
- timeoutError.stack = error2.stack;
125051
- (_a3 = this.onError) == null ? void 0 : _a3.call(this, timeoutError);
125052
- } else {
125053
- (_b2 = this.onError) == null ? void 0 : _b2.call(this, error2);
125054
- }
125055
- }
125056
- };
125057
- this.expireTag = async (tag) => {
125058
- var _a3, _b2;
125059
- const controller = new AbortController();
125060
- const timeoutId = setTimeout(() => controller.abort(), this.timeout);
125061
- try {
125062
- if (Array.isArray(tag)) {
125063
- tag = tag.join(",");
125064
- }
125065
- const res = await fetch(`${this.endpoint}revalidate?tags=${tag}`, {
125066
- method: "POST",
125067
- headers: this.headers,
125068
- signal: controller.signal
125069
- });
125070
- clearTimeout(timeoutId);
125071
- if (res.status !== 200) {
125072
- throw new Error(`Failed to revalidate tag: ${res.statusText}`);
125073
- }
125074
- } catch (error2) {
125075
- clearTimeout(timeoutId);
125076
- if (error2.name === "AbortError") {
125077
- const timeoutError = new Error(
125078
- `Cache request timed out after ${this.timeout}ms`
125079
- );
125080
- timeoutError.stack = error2.stack;
125081
- (_a3 = this.onError) == null ? void 0 : _a3.call(this, timeoutError);
125082
- } else {
125083
- (_b2 = this.onError) == null ? void 0 : _b2.call(this, error2);
125084
- }
125085
- }
125086
- };
125087
- this.endpoint = endpoint;
125088
- this.headers = headers2;
125089
- this.onError = onError;
125090
- this.timeout = timeout2;
125091
- }
125092
- }
125093
- return buildClient;
125094
- }
125095
- var cache;
125096
- var hasRequiredCache;
125097
- function requireCache() {
125098
- if (hasRequiredCache) return cache;
125099
- hasRequiredCache = 1;
125100
- var __defProp3 = Object.defineProperty;
125101
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
125102
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
125103
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
125104
- var __export2 = (target2, all2) => {
125105
- for (var name2 in all2)
125106
- __defProp3(target2, name2, { get: all2[name2], enumerable: true });
125107
- };
125108
- var __copyProps2 = (to2, from, except, desc) => {
125109
- if (from && typeof from === "object" || typeof from === "function") {
125110
- for (let key of __getOwnPropNames2(from))
125111
- if (!__hasOwnProp2.call(to2, key) && key !== except)
125112
- __defProp3(to2, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
125113
- }
125114
- return to2;
125115
- };
125116
- var __toCommonJS = (mod) => __copyProps2(__defProp3({}, "__esModule", { value: true }), mod);
125117
- var cache_exports = {};
125118
- __export2(cache_exports, {
125119
- HEADERS_VERCEL_CACHE_ITEM_NAME: () => HEADERS_VERCEL_CACHE_ITEM_NAME,
125120
- HEADERS_VERCEL_CACHE_STATE: () => HEADERS_VERCEL_CACHE_STATE,
125121
- HEADERS_VERCEL_CACHE_TAGS: () => HEADERS_VERCEL_CACHE_TAGS,
125122
- HEADERS_VERCEL_REVALIDATE: () => HEADERS_VERCEL_REVALIDATE,
125123
- PkgCacheState: () => PkgCacheState,
125124
- getCache: () => getCache
125125
- });
125126
- cache = __toCommonJS(cache_exports);
125127
- var import_get_context = requireGetContext();
125128
- var import_in_memory_cache = requireInMemoryCache();
125129
- var import_build_client = requireBuildClient();
125130
- const defaultKeyHashFunction = (key) => {
125131
- let hash2 = 5381;
125132
- for (let i = 0; i < key.length; i++) {
125133
- hash2 = hash2 * 33 ^ key.charCodeAt(i);
125134
- }
125135
- return (hash2 >>> 0).toString(16);
125136
- };
125137
- const defaultNamespaceSeparator = "$";
125138
- let inMemoryCacheInstance = null;
125139
- let buildCacheInstance = null;
125140
- const getCache = (cacheOptions) => {
125141
- const resolveCache = () => {
125142
- let cache2;
125143
- if ((0, import_get_context.getContext)().cache) {
125144
- cache2 = (0, import_get_context.getContext)().cache;
125145
- } else {
125146
- cache2 = getCacheImplementation(
125147
- process.env.SUSPENSE_CACHE_DEBUG === "true"
125148
- );
125149
- }
125150
- return cache2;
125151
- };
125152
- return wrapWithKeyTransformation(
125153
- resolveCache,
125154
- createKeyTransformer(cacheOptions)
125155
- );
125156
- };
125157
- function createKeyTransformer(cacheOptions) {
125158
- const hashFunction = (cacheOptions == null ? void 0 : cacheOptions.keyHashFunction) || defaultKeyHashFunction;
125159
- return (key) => {
125160
- if (!(cacheOptions == null ? void 0 : cacheOptions.namespace))
125161
- return hashFunction(key);
125162
- const separator = cacheOptions.namespaceSeparator || defaultNamespaceSeparator;
125163
- return `${cacheOptions.namespace}${separator}${hashFunction(key)}`;
125164
- };
125165
- }
125166
- function wrapWithKeyTransformation(resolveCache, makeKey) {
125167
- return {
125168
- get: (key) => {
125169
- return resolveCache().get(makeKey(key));
125170
- },
125171
- set: (key, value, options) => {
125172
- return resolveCache().set(makeKey(key), value, options);
125173
- },
125174
- delete: (key) => {
125175
- return resolveCache().delete(makeKey(key));
125176
- },
125177
- expireTag: (tag) => {
125178
- return resolveCache().expireTag(tag);
125179
- }
125180
- };
125181
- }
125182
- let warnedCacheUnavailable = false;
125183
- function getCacheImplementation(debug2) {
125184
- if (!inMemoryCacheInstance) {
125185
- inMemoryCacheInstance = new import_in_memory_cache.InMemoryCache();
125186
- }
125187
- if (process.env.RUNTIME_CACHE_DISABLE_BUILD_CACHE === "true") {
125188
- debug2 && console.log("Using InMemoryCache as build cache is disabled");
125189
- return inMemoryCacheInstance;
125190
- }
125191
- const { RUNTIME_CACHE_ENDPOINT, RUNTIME_CACHE_HEADERS } = process.env;
125192
- if (debug2) {
125193
- console.log("Runtime cache environment variables:", {
125194
- RUNTIME_CACHE_ENDPOINT,
125195
- RUNTIME_CACHE_HEADERS
125196
- });
125197
- }
125198
- if (!RUNTIME_CACHE_ENDPOINT || !RUNTIME_CACHE_HEADERS) {
125199
- if (!warnedCacheUnavailable) {
125200
- console.warn(
125201
- "Runtime Cache unavailable in this environment. Falling back to in-memory cache."
125202
- );
125203
- warnedCacheUnavailable = true;
125204
- }
125205
- return inMemoryCacheInstance;
125206
- }
125207
- if (!buildCacheInstance) {
125208
- let parsedHeaders = {};
125209
- try {
125210
- parsedHeaders = JSON.parse(RUNTIME_CACHE_HEADERS);
125211
- } catch (e) {
125212
- console.error("Failed to parse RUNTIME_CACHE_HEADERS:", e);
125213
- return inMemoryCacheInstance;
125214
- }
125215
- let timeout2 = 500;
125216
- if (process.env.RUNTIME_CACHE_TIMEOUT) {
125217
- const parsed = parseInt(process.env.RUNTIME_CACHE_TIMEOUT, 10);
125218
- if (!isNaN(parsed) && parsed > 0) {
125219
- timeout2 = parsed;
125220
- } else {
125221
- console.warn(
125222
- `Invalid RUNTIME_CACHE_TIMEOUT value: "${process.env.RUNTIME_CACHE_TIMEOUT}". Using default: ${timeout2}ms`
125223
- );
125224
- }
125225
- }
125226
- buildCacheInstance = new import_build_client.BuildCache({
125227
- endpoint: RUNTIME_CACHE_ENDPOINT,
125228
- headers: parsedHeaders,
125229
- onError: (error2) => console.error(error2),
125230
- timeout: timeout2
125231
- });
125232
- }
125233
- return buildCacheInstance;
125234
- }
125235
- var PkgCacheState = /* @__PURE__ */ ((PkgCacheState2) => {
125236
- PkgCacheState2["Fresh"] = "fresh";
125237
- PkgCacheState2["Stale"] = "stale";
125238
- PkgCacheState2["Expired"] = "expired";
125239
- PkgCacheState2["NotFound"] = "notFound";
125240
- PkgCacheState2["Error"] = "error";
125241
- return PkgCacheState2;
125242
- })(PkgCacheState || {});
125243
- const HEADERS_VERCEL_CACHE_STATE = "x-vercel-cache-state";
125244
- const HEADERS_VERCEL_REVALIDATE = "x-vercel-revalidate";
125245
- const HEADERS_VERCEL_CACHE_TAGS = "x-vercel-cache-tags";
125246
- const HEADERS_VERCEL_CACHE_ITEM_NAME = "x-vercel-cache-item-name";
125247
- return cache;
125248
- }
125249
- var dbConnections;
125250
- var hasRequiredDbConnections;
125251
- function requireDbConnections() {
125252
- if (hasRequiredDbConnections) return dbConnections;
125253
- hasRequiredDbConnections = 1;
125254
- var __defProp3 = Object.defineProperty;
125255
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
125256
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
125257
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
125258
- var __export2 = (target2, all2) => {
125259
- for (var name2 in all2)
125260
- __defProp3(target2, name2, { get: all2[name2], enumerable: true });
125261
- };
125262
- var __copyProps2 = (to2, from, except, desc) => {
125263
- if (from && typeof from === "object" || typeof from === "function") {
125264
- for (let key of __getOwnPropNames2(from))
125265
- if (!__hasOwnProp2.call(to2, key) && key !== except)
125266
- __defProp3(to2, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
125267
- }
125268
- return to2;
125269
- };
125270
- var __toCommonJS = (mod) => __copyProps2(__defProp3({}, "__esModule", { value: true }), mod);
125271
- var db_connections_exports = {};
125272
- __export2(db_connections_exports, {
125273
- attachDatabasePool: () => attachDatabasePool,
125274
- experimental_attachDatabasePool: () => experimental_attachDatabasePool
125275
- });
125276
- dbConnections = __toCommonJS(db_connections_exports);
125277
- var import_get_context = requireGetContext();
125278
- const DEBUG = !!process.env.DEBUG;
125279
- function getIdleTimeout(dbPool) {
125280
- if ("options" in dbPool && dbPool.options) {
125281
- if ("idleTimeoutMillis" in dbPool.options) {
125282
- return typeof dbPool.options.idleTimeoutMillis === "number" ? dbPool.options.idleTimeoutMillis : 1e4;
125283
- }
125284
- if ("maxIdleTimeMS" in dbPool.options) {
125285
- return typeof dbPool.options.maxIdleTimeMS === "number" ? dbPool.options.maxIdleTimeMS : 0;
125286
- }
125287
- if ("status" in dbPool) {
125288
- return 5e3;
125289
- }
125290
- if ("connect" in dbPool && "execute" in dbPool) {
125291
- return 3e4;
125292
- }
125293
- }
125294
- if ("config" in dbPool && dbPool.config) {
125295
- if ("connectionConfig" in dbPool.config && dbPool.config.connectionConfig) {
125296
- return dbPool.config.connectionConfig.idleTimeout || 6e4;
125297
- }
125298
- if ("idleTimeout" in dbPool.config) {
125299
- return typeof dbPool.config.idleTimeout === "number" ? dbPool.config.idleTimeout : 6e4;
125300
- }
125301
- }
125302
- if ("poolTimeout" in dbPool) {
125303
- return typeof dbPool.poolTimeout === "number" ? dbPool.poolTimeout : 6e4;
125304
- }
125305
- if ("idleTimeout" in dbPool) {
125306
- return typeof dbPool.idleTimeout === "number" ? dbPool.idleTimeout : 0;
125307
- }
125308
- return 1e4;
125309
- }
125310
- let idleTimeout = null;
125311
- let idleTimeoutResolve = () => {
125312
- };
125313
- const bootTime = Date.now();
125314
- const maximumDuration = 15 * 60 * 1e3 - 1e3;
125315
- function waitUntilIdleTimeout(dbPool) {
125316
- if (!process.env.VERCEL_URL || // This is not set during builds where we don't need to wait for idle connections using the mechanism
125317
- !process.env.VERCEL_REGION) {
125318
- return;
125319
- }
125320
- if (idleTimeout) {
125321
- clearTimeout(idleTimeout);
125322
- idleTimeoutResolve();
125323
- }
125324
- const promise2 = new Promise((resolve2) => {
125325
- idleTimeoutResolve = resolve2;
125326
- });
125327
- const waitTime = Math.min(
125328
- getIdleTimeout(dbPool) + 100,
125329
- Math.max(100, maximumDuration - (Date.now() - bootTime))
125330
- );
125331
- idleTimeout = setTimeout(() => {
125332
- idleTimeoutResolve == null ? void 0 : idleTimeoutResolve();
125333
- if (DEBUG) {
125334
- console.log("Database pool idle timeout reached. Releasing connections.");
125335
- }
125336
- }, waitTime);
125337
- const requestContext = (0, import_get_context.getContext)();
125338
- if (requestContext == null ? void 0 : requestContext.waitUntil) {
125339
- requestContext.waitUntil(promise2);
125340
- } else {
125341
- console.warn("Pool release event triggered outside of request scope.");
125342
- }
125343
- }
125344
- function attachDatabasePool(dbPool) {
125345
- if (idleTimeout) {
125346
- idleTimeoutResolve == null ? void 0 : idleTimeoutResolve();
125347
- clearTimeout(idleTimeout);
125348
- }
125349
- if ("on" in dbPool && dbPool.on && "options" in dbPool && "idleTimeoutMillis" in dbPool.options) {
125350
- const pgPool = dbPool;
125351
- pgPool.on("release", () => {
125352
- if (DEBUG) {
125353
- console.log("Client released from pool");
125354
- }
125355
- waitUntilIdleTimeout(dbPool);
125356
- });
125357
- return;
125358
- } else if ("on" in dbPool && dbPool.on && "config" in dbPool && dbPool.config && "connectionConfig" in dbPool.config) {
125359
- const mysqlPool = dbPool;
125360
- mysqlPool.on("release", () => {
125361
- if (DEBUG) {
125362
- console.log("MySQL client released from pool");
125363
- }
125364
- waitUntilIdleTimeout(dbPool);
125365
- });
125366
- return;
125367
- } else if ("on" in dbPool && dbPool.on && "config" in dbPool && dbPool.config && "idleTimeout" in dbPool.config) {
125368
- const mysql2Pool = dbPool;
125369
- mysql2Pool.on("release", () => {
125370
- if (DEBUG) {
125371
- console.log("MySQL2/MariaDB client released from pool");
125372
- }
125373
- waitUntilIdleTimeout(dbPool);
125374
- });
125375
- return;
125376
- }
125377
- if ("on" in dbPool && dbPool.on && "options" in dbPool && dbPool.options && "maxIdleTimeMS" in dbPool.options) {
125378
- const mongoPool = dbPool;
125379
- mongoPool.on("connectionCheckedOut", () => {
125380
- if (DEBUG) {
125381
- console.log("MongoDB connection checked out");
125382
- }
125383
- waitUntilIdleTimeout(dbPool);
125384
- });
125385
- return;
125386
- }
125387
- if ("on" in dbPool && dbPool.on && "options" in dbPool && dbPool.options && "socket" in dbPool.options) {
125388
- const redisPool = dbPool;
125389
- redisPool.on("end", () => {
125390
- if (DEBUG) {
125391
- console.log("Redis connection ended");
125392
- }
125393
- waitUntilIdleTimeout(dbPool);
125394
- });
125395
- return;
125396
- }
125397
- throw new Error("Unsupported database pool type");
125398
- }
125399
- const experimental_attachDatabasePool = attachDatabasePool;
125400
- return dbConnections;
125401
- }
125402
- var purge;
125403
- var hasRequiredPurge;
125404
- function requirePurge() {
125405
- if (hasRequiredPurge) return purge;
125406
- hasRequiredPurge = 1;
125407
- var __defProp3 = Object.defineProperty;
125408
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
125409
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
125410
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
125411
- var __export2 = (target2, all2) => {
125412
- for (var name2 in all2)
125413
- __defProp3(target2, name2, { get: all2[name2], enumerable: true });
125414
- };
125415
- var __copyProps2 = (to2, from, except, desc) => {
125416
- if (from && typeof from === "object" || typeof from === "function") {
125417
- for (let key of __getOwnPropNames2(from))
125418
- if (!__hasOwnProp2.call(to2, key) && key !== except)
125419
- __defProp3(to2, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
125420
- }
125421
- return to2;
125422
- };
125423
- var __toCommonJS = (mod) => __copyProps2(__defProp3({}, "__esModule", { value: true }), mod);
125424
- var purge_exports = {};
125425
- __export2(purge_exports, {
125426
- dangerouslyDeleteBySrcImage: () => dangerouslyDeleteBySrcImage,
125427
- dangerouslyDeleteByTag: () => dangerouslyDeleteByTag,
125428
- invalidateBySrcImage: () => invalidateBySrcImage,
125429
- invalidateByTag: () => invalidateByTag
125430
- });
125431
- purge = __toCommonJS(purge_exports);
125432
- var import_get_context = requireGetContext();
125433
- const invalidateByTag = (tag) => {
125434
- const api2 = (0, import_get_context.getContext)().purge;
125435
- if (api2) {
125436
- return api2.invalidateByTag(tag);
125437
- }
125438
- return Promise.resolve();
125439
- };
125440
- const dangerouslyDeleteByTag = (tag, options) => {
125441
- const api2 = (0, import_get_context.getContext)().purge;
125442
- if (api2) {
125443
- return api2.dangerouslyDeleteByTag(tag, options);
125444
- }
125445
- return Promise.resolve();
125446
- };
125447
- const invalidateBySrcImage = (src2) => {
125448
- const api2 = (0, import_get_context.getContext)().purge;
125449
- return api2 ? api2.invalidateBySrcImage(src2) : Promise.resolve();
125450
- };
125451
- const dangerouslyDeleteBySrcImage = (src2, options) => {
125452
- const api2 = (0, import_get_context.getContext)().purge;
125453
- return api2 ? api2.dangerouslyDeleteBySrcImage(src2, options) : Promise.resolve();
125454
- };
125455
- return purge;
125456
- }
125457
- var addcachetag;
125458
- var hasRequiredAddcachetag;
125459
- function requireAddcachetag() {
125460
- if (hasRequiredAddcachetag) return addcachetag;
125461
- hasRequiredAddcachetag = 1;
125462
- var __defProp3 = Object.defineProperty;
125463
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
125464
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
125465
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
125466
- var __export2 = (target2, all2) => {
125467
- for (var name2 in all2)
125468
- __defProp3(target2, name2, { get: all2[name2], enumerable: true });
125469
- };
125470
- var __copyProps2 = (to2, from, except, desc) => {
125471
- if (from && typeof from === "object" || typeof from === "function") {
125472
- for (let key of __getOwnPropNames2(from))
125473
- if (!__hasOwnProp2.call(to2, key) && key !== except)
125474
- __defProp3(to2, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
125475
- }
125476
- return to2;
125477
- };
125478
- var __toCommonJS = (mod) => __copyProps2(__defProp3({}, "__esModule", { value: true }), mod);
125479
- var addcachetag_exports = {};
125480
- __export2(addcachetag_exports, {
125481
- addCacheTag: () => addCacheTag
125482
- });
125483
- addcachetag = __toCommonJS(addcachetag_exports);
125484
- var import_get_context = requireGetContext();
125485
- const addCacheTag = (tag) => {
125486
- const addCacheTag2 = (0, import_get_context.getContext)().addCacheTag;
125487
- if (addCacheTag2) {
125488
- return addCacheTag2(tag);
125489
- }
125490
- return Promise.resolve();
125491
- };
125492
- return addcachetag;
125493
- }
125494
- var functions;
125495
- var hasRequiredFunctions;
125496
- function requireFunctions() {
125497
- if (hasRequiredFunctions) return functions;
125498
- hasRequiredFunctions = 1;
125499
- var __defProp3 = Object.defineProperty;
125500
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
125501
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
125502
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
125503
- var __export2 = (target2, all2) => {
125504
- for (var name2 in all2)
125505
- __defProp3(target2, name2, { get: all2[name2], enumerable: true });
125506
- };
125507
- var __copyProps2 = (to2, from, except, desc) => {
125508
- if (from && typeof from === "object" || typeof from === "function") {
125509
- for (let key of __getOwnPropNames2(from))
125510
- if (!__hasOwnProp2.call(to2, key) && key !== except)
125511
- __defProp3(to2, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
125512
- }
125513
- return to2;
125514
- };
125515
- var __toCommonJS = (mod) => __copyProps2(__defProp3({}, "__esModule", { value: true }), mod);
125516
- var src_exports = {};
125517
- __export2(src_exports, {
125518
- addCacheTag: () => import_addcachetag.addCacheTag,
125519
- attachDatabasePool: () => import_db_connections.attachDatabasePool,
125520
- dangerouslyDeleteBySrcImage: () => import_purge.dangerouslyDeleteBySrcImage,
125521
- dangerouslyDeleteByTag: () => import_purge.dangerouslyDeleteByTag,
125522
- experimental_attachDatabasePool: () => import_db_connections.experimental_attachDatabasePool,
125523
- geolocation: () => import_headers.geolocation,
125524
- getCache: () => import_cache.getCache,
125525
- getEnv: () => import_get_env.getEnv,
125526
- invalidateBySrcImage: () => import_purge.invalidateBySrcImage,
125527
- invalidateByTag: () => import_purge.invalidateByTag,
125528
- ipAddress: () => import_headers.ipAddress,
125529
- next: () => import_middleware.next,
125530
- rewrite: () => import_middleware.rewrite,
125531
- waitUntil: () => import_wait_until.waitUntil
125532
- });
125533
- functions = __toCommonJS(src_exports);
125534
- var import_headers = requireHeaders();
125535
- var import_get_env = requireGetEnv();
125536
- var import_wait_until = requireWaitUntil();
125537
- var import_middleware = requireMiddleware();
125538
- var import_cache = requireCache();
125539
- var import_db_connections = requireDbConnections();
125540
- var import_purge = requirePurge();
125541
- var import_addcachetag = requireAddcachetag();
125542
- return functions;
125543
- }
125544
- var functionsExports = requireFunctions();
125545
124581
  const WORKFLOW_SERIALIZE = Symbol.for("workflow-serialize");
125546
124582
  const WORKFLOW_DESERIALIZE = Symbol.for("workflow-deserialize");
125547
124583
  const STABLE_ULID = Symbol.for("WORKFLOW_STABLE_ULID");
@@ -125997,6 +125033,107 @@ class WorkflowServerReadableStream extends ReadableStream {
125997
125033
  }
125998
125034
  }
125999
125035
  _reader = new WeakMap();
125036
+ const FRAMED_STREAM_MAX_RECONNECTS = 50;
125037
+ const FRAMED_STREAM_MAX_TOTAL_RECONNECTS = 1e3;
125038
+ function createReconnectingFramedStream(name2, startIndex) {
125039
+ const reconnectSupported = startIndex === void 0 || startIndex >= 0;
125040
+ let currentStartIndex = startIndex ?? 0;
125041
+ let consumedFrames = 0;
125042
+ let reconnectCount = 0;
125043
+ let totalReconnectCount = 0;
125044
+ let reader;
125045
+ let buffer2 = new Uint8Array(0);
125046
+ async function connect2() {
125047
+ const world = getWorld();
125048
+ const effectiveStartIndex = reconnectSupported ? currentStartIndex + consumedFrames : startIndex;
125049
+ const stream = await world.readFromStream(name2, effectiveStartIndex);
125050
+ reader = stream.getReader();
125051
+ }
125052
+ async function reconnect() {
125053
+ reconnectCount++;
125054
+ totalReconnectCount++;
125055
+ if (reconnectCount > FRAMED_STREAM_MAX_RECONNECTS) {
125056
+ throw new Error(`Stream "${name2}" exceeded maximum reconnection attempts (${FRAMED_STREAM_MAX_RECONNECTS})`);
125057
+ }
125058
+ if (totalReconnectCount > FRAMED_STREAM_MAX_TOTAL_RECONNECTS) {
125059
+ throw new Error(`Stream "${name2}" exceeded maximum total reconnection attempts (${FRAMED_STREAM_MAX_TOTAL_RECONNECTS})`);
125060
+ }
125061
+ if (reader) {
125062
+ await reader.cancel().catch(() => {
125063
+ });
125064
+ reader = void 0;
125065
+ }
125066
+ currentStartIndex += consumedFrames;
125067
+ consumedFrames = 0;
125068
+ buffer2 = new Uint8Array(0);
125069
+ await connect2();
125070
+ }
125071
+ return new ReadableStream({
125072
+ pull: async (controller) => {
125073
+ for (; ; ) {
125074
+ if (!reader) {
125075
+ try {
125076
+ await connect2();
125077
+ } catch (err) {
125078
+ controller.error(err);
125079
+ return;
125080
+ }
125081
+ }
125082
+ let result;
125083
+ try {
125084
+ result = await reader.read();
125085
+ } catch (err) {
125086
+ if (!reconnectSupported) {
125087
+ controller.error(err);
125088
+ return;
125089
+ }
125090
+ try {
125091
+ await reconnect();
125092
+ } catch (reconnectErr) {
125093
+ controller.error(reconnectErr);
125094
+ return;
125095
+ }
125096
+ continue;
125097
+ }
125098
+ if (result.done || !result.value) {
125099
+ reader = void 0;
125100
+ controller.close();
125101
+ return;
125102
+ }
125103
+ const incoming = result.value;
125104
+ if (incoming.length > 0) {
125105
+ const combined = new Uint8Array(buffer2.length + incoming.length);
125106
+ combined.set(buffer2, 0);
125107
+ combined.set(incoming, buffer2.length);
125108
+ buffer2 = combined;
125109
+ }
125110
+ let emitted = false;
125111
+ while (buffer2.length >= FRAME_HEADER_SIZE$1) {
125112
+ const frameLength = new DataView(buffer2.buffer, buffer2.byteOffset, buffer2.byteLength).getUint32(0, false);
125113
+ const total = FRAME_HEADER_SIZE$1 + frameLength;
125114
+ if (buffer2.length < total)
125115
+ break;
125116
+ controller.enqueue(buffer2.slice(0, total));
125117
+ buffer2 = buffer2.slice(total);
125118
+ consumedFrames++;
125119
+ emitted = true;
125120
+ }
125121
+ if (emitted) {
125122
+ reconnectCount = 0;
125123
+ return;
125124
+ }
125125
+ }
125126
+ },
125127
+ cancel: async () => {
125128
+ if (reader) {
125129
+ await reader.cancel().catch((err) => {
125130
+ console.warn("Error closing ReadableStream reader:", err);
125131
+ });
125132
+ reader = void 0;
125133
+ }
125134
+ }
125135
+ });
125136
+ }
126000
125137
  const STREAM_FLUSH_INTERVAL_MS = 10;
126001
125138
  class WorkflowServerWritableStream extends WritableStream {
126002
125139
  constructor(name2, runId) {
@@ -126463,8 +125600,8 @@ function getExternalRevivers(global2 = globalThis, ops, runId, cryptoKey) {
126463
125600
  const response2 = new global2.Response(bodyInit);
126464
125601
  return response2.body;
126465
125602
  }
126466
- const readable2 = new WorkflowServerReadableStream(value.name, value.startIndex);
126467
125603
  if (value.type === "bytes") {
125604
+ const readable2 = new WorkflowServerReadableStream(value.name, value.startIndex);
126468
125605
  const state = createFlushableState();
126469
125606
  ops.push(state.promise);
126470
125607
  const { readable: userReadable, writable } = new global2.TransformStream();
@@ -126473,6 +125610,7 @@ function getExternalRevivers(global2 = globalThis, ops, runId, cryptoKey) {
126473
125610
  pollReadableLock(userReadable, state);
126474
125611
  return userReadable;
126475
125612
  } else {
125613
+ const readable2 = createReconnectingFramedStream(value.name, value.startIndex);
126476
125614
  const transform2 = getDeserializeStream(getExternalRevivers(global2, ops, runId, cryptoKey), cryptoKey);
126477
125615
  const state = createFlushableState();
126478
125616
  ops.push(state.promise);
@@ -126929,12 +126067,6 @@ function getWorkflowRunStreamId(runId, namespace2) {
126929
126067
  const encodedNamespace = Buffer.from(namespace2, "utf-8").toString("base64url");
126930
126068
  return `${streamId}_${encodedNamespace}`;
126931
126069
  }
126932
- async function waitedUntil(fn2) {
126933
- const result = fn2();
126934
- functionsExports.waitUntil(result.catch(() => {
126935
- }));
126936
- return result;
126937
- }
126938
126070
  var EventConsumerResult;
126939
126071
  (function(EventConsumerResult2) {
126940
126072
  EventConsumerResult2[EventConsumerResult2["Consumed"] = 0] = "Consumed";
@@ -129573,6 +128705,28 @@ function getRunCapabilities(workflowCoreVersion) {
129573
128705
  }
129574
128706
  return { supportedFormats: formats };
129575
128707
  }
128708
+ function waitUntil(promise2) {
128709
+ void import("./index-B8YoYr9f.js").then((n) => n.i).then(({ waitUntil: waitUntil2 }) => {
128710
+ waitUntil2(promise2);
128711
+ });
128712
+ }
128713
+ function safeWaitUntil(promise2, onError) {
128714
+ waitUntil(promise2.catch((err) => {
128715
+ const isAbortError = (err == null ? void 0 : err.name) === "AbortError" || (err == null ? void 0 : err.name) === "ResponseAborted";
128716
+ if (!isAbortError) {
128717
+ try {
128718
+ onError(err);
128719
+ } catch {
128720
+ }
128721
+ }
128722
+ }));
128723
+ }
128724
+ async function waitedUntil(fn2) {
128725
+ const result = fn2();
128726
+ waitUntil(result.catch(() => {
128727
+ }));
128728
+ return result;
128729
+ }
129576
128730
  async function getHookByTokenWithKey(token) {
129577
128731
  var _a3;
129578
128732
  const world = getWorld();
@@ -129621,10 +128775,15 @@ async function resumeHook$2(tokenOrHook, payload, encryptionKeyOverride) {
129621
128775
  const ops = [];
129622
128776
  const v1Compat = isLegacySpecVersion(hook.specVersion);
129623
128777
  const dehydratedPayload = await dehydrateStepReturnValue(payload, hook.runId, encryptionKey, ops, globalThis, v1Compat);
129624
- functionsExports.waitUntil(Promise.all(ops).catch((err) => {
129625
- if (err !== void 0)
129626
- throw err;
129627
- }));
128778
+ safeWaitUntil(Promise.all(ops), (err) => {
128779
+ if (err === void 0)
128780
+ return;
128781
+ runtimeLogger.warn("Background flush of hook payload ops failed", {
128782
+ workflowRunId: hook.runId,
128783
+ hookId: hook.hookId,
128784
+ error: err instanceof Error ? err.message : String(err)
128785
+ });
128786
+ });
129628
128787
  await world.events.create(hook.runId, {
129629
128788
  eventType: "hook_received",
129630
128789
  specVersion: SPEC_VERSION_CURRENT,
@@ -129760,11 +128919,12 @@ async function start$1(workflow, argsOrOptions, options) {
129760
128919
  throw new WorkflowRuntimeError(`Server returned different runId than requested: expected ${runId}, got ${result.run.runId}`);
129761
128920
  }
129762
128921
  }
129763
- functionsExports.waitUntil(Promise.all(ops).catch((err) => {
129764
- const isAbortError = (err == null ? void 0 : err.name) === "AbortError" || (err == null ? void 0 : err.name) === "ResponseAborted";
129765
- if (!isAbortError)
129766
- throw err;
129767
- }));
128922
+ safeWaitUntil(Promise.all(ops), (err) => {
128923
+ runtimeLogger.warn("Background flush of workflow argument streams failed", {
128924
+ workflowRunId: runId,
128925
+ error: err instanceof Error ? err.message : String(err)
128926
+ });
128927
+ });
129768
128928
  span == null ? void 0 : span.setAttributes({
129769
128929
  ...WorkflowRunId(runId),
129770
128930
  ...DeploymentId(deploymentId),
@@ -130097,8 +129257,10 @@ class Run {
130097
129257
  }
130098
129258
  }
130099
129259
  const DEFAULT_STEP_MAX_RETRIES = 3;
129260
+ const stepNamespace = resolveQueueNamespace();
129261
+ const stepPrefix = getQueueTopicPrefix("step", stepNamespace);
130100
129262
  const { createQueueHandler, specVersion: worldSpecVersion } = getWorldHandlers();
130101
- createQueueHandler("__wkf_step_", async (message_, metadata) => {
129263
+ createQueueHandler(stepPrefix, async (message_, metadata) => {
130102
129264
  const healthCheck2 = parseHealthCheckPayload(message_);
130103
129265
  if (healthCheck2) {
130104
129266
  await handleHealthCheckMessage(healthCheck2, "step", worldSpecVersion);
@@ -130106,7 +129268,7 @@ createQueueHandler("__wkf_step_", async (message_, metadata) => {
130106
129268
  }
130107
129269
  const { workflowName, workflowRunId, workflowStartedAt, stepId, traceCarrier: traceContext, requestedAt } = StepInvokePayloadSchema.parse(message_);
130108
129270
  const { requestId } = metadata;
130109
- const stepNameFromQueue = metadata.queueName.slice("__wkf_step_".length);
129271
+ const stepNameFromQueue = metadata.queueName.slice(stepPrefix.length);
130110
129272
  if (metadata.attempt > MAX_QUEUE_DELIVERIES) {
130111
129273
  runtimeLogger.error(`Step handler exceeded max deliveries (${metadata.attempt}/${MAX_QUEUE_DELIVERIES})`, {
130112
129274
  workflowRunId,
@@ -130125,7 +129287,7 @@ createQueueHandler("__wkf_step_", async (message_, metadata) => {
130125
129287
  error: `Step exceeded maximum queue deliveries (${metadata.attempt}/${MAX_QUEUE_DELIVERIES})`
130126
129288
  }
130127
129289
  }, { requestId });
130128
- await queueMessage(world, getWorkflowQueueName(workflowName), {
129290
+ await queueMessage(world, getWorkflowQueueName(workflowName, stepNamespace), {
130129
129291
  runId: workflowRunId,
130130
129292
  traceCarrier: await serializeTraceCarrier(),
130131
129293
  requestedAt: /* @__PURE__ */ new Date()
@@ -130145,7 +129307,7 @@ createQueueHandler("__wkf_step_", async (message_, metadata) => {
130145
129307
  }
130146
129308
  const spanLinks = await linkToCurrentContext();
130147
129309
  return await withTraceContext(traceContext, async () => {
130148
- const stepName = metadata.queueName.slice("__wkf_step_".length);
129310
+ const stepName = metadata.queueName.slice(stepPrefix.length);
130149
129311
  const world = getWorld();
130150
129312
  const isVercel = process.env.VERCEL_URL !== void 0;
130151
129313
  const [port, spanKind] = await Promise.all([
@@ -130211,7 +129373,7 @@ createQueueHandler("__wkf_step_", async (message_, metadata) => {
130211
129373
  "step.name": stepName,
130212
129374
  "step.id": stepId
130213
129375
  });
130214
- await queueMessage(world, getWorkflowQueueName(workflowName), {
129376
+ await queueMessage(world, getWorkflowQueueName(workflowName, stepNamespace), {
130215
129377
  runId: workflowRunId,
130216
129378
  traceCarrier: await serializeTraceCarrier(),
130217
129379
  requestedAt: /* @__PURE__ */ new Date()
@@ -130281,7 +129443,7 @@ createQueueHandler("__wkf_step_", async (message_, metadata) => {
130281
129443
  ...StepStatus("failed"),
130282
129444
  ...StepFatalError(true)
130283
129445
  });
130284
- await queueMessage(world, getWorkflowQueueName(workflowName), {
129446
+ await queueMessage(world, getWorkflowQueueName(workflowName, stepNamespace), {
130285
129447
  runId: workflowRunId,
130286
129448
  traceCarrier: await serializeTraceCarrier(),
130287
129449
  requestedAt: /* @__PURE__ */ new Date()
@@ -130328,7 +129490,7 @@ createQueueHandler("__wkf_step_", async (message_, metadata) => {
130328
129490
  ...StepStatus("failed"),
130329
129491
  ...StepRetryExhausted(true)
130330
129492
  });
130331
- await queueMessage(world, getWorkflowQueueName(workflowName), {
129493
+ await queueMessage(world, getWorkflowQueueName(workflowName, stepNamespace), {
130332
129494
  runId: workflowRunId,
130333
129495
  traceCarrier: await serializeTraceCarrier(),
130334
129496
  requestedAt: /* @__PURE__ */ new Date()
@@ -130360,7 +129522,7 @@ createQueueHandler("__wkf_step_", async (message_, metadata) => {
130360
129522
  }
130361
129523
  throw failErr;
130362
129524
  }
130363
- await queueMessage(world, getWorkflowQueueName(workflowName), {
129525
+ await queueMessage(world, getWorkflowQueueName(workflowName, stepNamespace), {
130364
129526
  runId: workflowRunId,
130365
129527
  traceCarrier: await serializeTraceCarrier(),
130366
129528
  requestedAt: /* @__PURE__ */ new Date()
@@ -130579,7 +129741,7 @@ createQueueHandler("__wkf_step_", async (message_, metadata) => {
130579
129741
  return { timeoutSeconds };
130580
129742
  }
130581
129743
  }
130582
- await queueMessage(world, getWorkflowQueueName(workflowName), {
129744
+ await queueMessage(world, getWorkflowQueueName(workflowName, stepNamespace), {
130583
129745
  runId: workflowRunId,
130584
129746
  traceCarrier: await serializeTraceCarrier(),
130585
129747
  requestedAt: /* @__PURE__ */ new Date()
@@ -130598,11 +129760,13 @@ createQueueHandler("__wkf_step_", async (message_, metadata) => {
130598
129760
  });
130599
129761
  return dehydrated;
130600
129762
  });
130601
- functionsExports.waitUntil(Promise.all(ops).catch((err) => {
130602
- const isAbortError = (err == null ? void 0 : err.name) === "AbortError" || (err == null ? void 0 : err.name) === "ResponseAborted";
130603
- if (!isAbortError)
130604
- throw err;
130605
- }));
129763
+ safeWaitUntil(Promise.all(ops), (err) => {
129764
+ runtimeLogger.warn("Background flush of step stream ops failed", {
129765
+ workflowRunId,
129766
+ stepId,
129767
+ error: err instanceof Error ? err.message : String(err)
129768
+ });
129769
+ });
130606
129770
  let stepCompleted409 = false;
130607
129771
  const [, traceCarrier] = await Promise.all([
130608
129772
  world.events.create(workflowRunId, {
@@ -130635,7 +129799,7 @@ createQueueHandler("__wkf_step_", async (message_, metadata) => {
130635
129799
  ...StepStatus("completed"),
130636
129800
  ...StepResultType(typeof result)
130637
129801
  });
130638
- await queueMessage(world, getWorkflowQueueName(workflowName), {
129802
+ await queueMessage(world, getWorkflowQueueName(workflowName, stepNamespace), {
130639
129803
  runId: workflowRunId,
130640
129804
  traceCarrier,
130641
129805
  requestedAt: /* @__PURE__ */ new Date()
@@ -133401,9 +132565,9 @@ function useMergeRefs(refs, defaultValue) {
133401
132565
  function ItoI(a2) {
133402
132566
  return a2;
133403
132567
  }
133404
- function innerCreateMedium(defaults2, middleware2) {
133405
- if (middleware2 === void 0) {
133406
- middleware2 = ItoI;
132568
+ function innerCreateMedium(defaults2, middleware) {
132569
+ if (middleware === void 0) {
132570
+ middleware = ItoI;
133407
132571
  }
133408
132572
  var buffer2 = [];
133409
132573
  var assigned = false;
@@ -133418,7 +132582,7 @@ function innerCreateMedium(defaults2, middleware2) {
133418
132582
  return defaults2;
133419
132583
  },
133420
132584
  useMedium: function(data) {
133421
- var item = middleware2(data, assigned);
132585
+ var item = middleware(data, assigned);
133422
132586
  buffer2.push(item);
133423
132587
  return function() {
133424
132588
  buffer2 = buffer2.filter(function(x2) {
@@ -147515,8 +146679,8 @@ function BatchProvider({ children: children2 }) {
147515
146679
  items: next2,
147516
146680
  lookup: nodeLookup
147517
146681
  });
147518
- for (const middleware2 of onNodesChangeMiddlewareMap.values()) {
147519
- changes = middleware2(changes);
146682
+ for (const middleware of onNodesChangeMiddlewareMap.values()) {
146683
+ changes = middleware(changes);
147520
146684
  }
147521
146685
  if (hasDefaultNodes) {
147522
146686
  setNodes(next2);
@@ -149469,8 +148633,8 @@ const createStore = ({ nodes, edges, defaultNodes, defaultEdges, width, height,
149469
148633
  const parentExpandChanges = handleExpandParent(parentExpandChildren, nodeLookup, parentLookup, nodeOrigin2);
149470
148634
  changes.push(...parentExpandChanges);
149471
148635
  }
149472
- for (const middleware2 of onNodesChangeMiddlewareMap.values()) {
149473
- changes = middleware2(changes);
148636
+ for (const middleware of onNodesChangeMiddlewareMap.values()) {
148637
+ changes = middleware(changes);
149474
148638
  }
149475
148639
  triggerNodeChanges(changes);
149476
148640
  },
@@ -153993,7 +153157,7 @@ const route4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
153993
153157
  __proto__: null,
153994
153158
  loader
153995
153159
  }, Symbol.toStringTag, { value: "Module" }));
153996
- const serverManifest = { "entry": { "module": "/assets/entry.client-DtOpLtMQ.js", "imports": ["/assets/index-BsV8i_Jn.js"], "css": [] }, "routes": { "root": { "id": "root", "parentId": void 0, "path": "", "index": void 0, "caseSensitive": void 0, "hasAction": true, "hasLoader": true, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": true, "hasErrorBoundary": true, "module": "/assets/root-B9F5GRJi.js", "imports": ["/assets/index-BsV8i_Jn.js", "/assets/mermaid-3ZIDBTTL-ZIVWJOga.js"], "css": ["/assets/root-aMfmV5uh.css", "/assets/mermaid-3ZIDBTTL-DKxHcEOp.css"], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 }, "routes/home": { "id": "routes/home", "parentId": "root", "path": void 0, "index": true, "caseSensitive": void 0, "hasAction": false, "hasLoader": false, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": true, "hasErrorBoundary": false, "module": "/assets/home-BwM2ND3E.js", "imports": ["/assets/index-BsV8i_Jn.js", "/assets/workflow-graph-viewer-Dv4c6IRL.js", "/assets/mermaid-3ZIDBTTL-ZIVWJOga.js", "/assets/index-7hulCzI_.js"], "css": ["/assets/workflow-graph-viewer-yls6qlc0.css", "/assets/mermaid-3ZIDBTTL-DKxHcEOp.css"], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 }, "routes/run-detail": { "id": "routes/run-detail", "parentId": "root", "path": "run/:runId", "index": void 0, "caseSensitive": void 0, "hasAction": false, "hasLoader": false, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": true, "hasErrorBoundary": false, "module": "/assets/run-detail-2uFavmKZ.js", "imports": ["/assets/index-BsV8i_Jn.js", "/assets/workflow-graph-viewer-Dv4c6IRL.js", "/assets/mermaid-3ZIDBTTL-ZIVWJOga.js", "/assets/encryption-Bd25Keng.js", "/assets/index-7hulCzI_.js"], "css": ["/assets/workflow-graph-viewer-yls6qlc0.css", "/assets/mermaid-3ZIDBTTL-DKxHcEOp.css"], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 }, "routes/api.rpc": { "id": "routes/api.rpc", "parentId": "root", "path": "api/rpc", "index": void 0, "caseSensitive": void 0, "hasAction": true, "hasLoader": true, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": false, "hasErrorBoundary": false, "module": "/assets/api.rpc-l0sNRNKZ.js", "imports": [], "css": [], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 }, "routes/api.stream.$streamId": { "id": "routes/api.stream.$streamId", "parentId": "root", "path": "api/stream/:streamId", "index": void 0, "caseSensitive": void 0, "hasAction": false, "hasLoader": true, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": false, "hasErrorBoundary": false, "module": "/assets/api.stream._streamId-l0sNRNKZ.js", "imports": [], "css": [], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 } }, "url": "/assets/manifest-7155e3b4.js", "version": "7155e3b4", "sri": void 0 };
153160
+ const serverManifest = { "entry": { "module": "/assets/entry.client-DtOpLtMQ.js", "imports": ["/assets/index-BsV8i_Jn.js"], "css": [] }, "routes": { "root": { "id": "root", "parentId": void 0, "path": "", "index": void 0, "caseSensitive": void 0, "hasAction": true, "hasLoader": true, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": true, "hasErrorBoundary": true, "module": "/assets/root-axkUVsvL.js", "imports": ["/assets/index-BsV8i_Jn.js", "/assets/mermaid-3ZIDBTTL-CWOyQBTZ.js"], "css": ["/assets/root-aMfmV5uh.css", "/assets/mermaid-3ZIDBTTL-DKxHcEOp.css"], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 }, "routes/home": { "id": "routes/home", "parentId": "root", "path": void 0, "index": true, "caseSensitive": void 0, "hasAction": false, "hasLoader": false, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": true, "hasErrorBoundary": false, "module": "/assets/home-D5gYz0XH.js", "imports": ["/assets/index-BsV8i_Jn.js", "/assets/workflow-graph-viewer-CLv3yYv8.js", "/assets/mermaid-3ZIDBTTL-CWOyQBTZ.js", "/assets/index-7hulCzI_.js"], "css": ["/assets/workflow-graph-viewer-yls6qlc0.css", "/assets/mermaid-3ZIDBTTL-DKxHcEOp.css"], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 }, "routes/run-detail": { "id": "routes/run-detail", "parentId": "root", "path": "run/:runId", "index": void 0, "caseSensitive": void 0, "hasAction": false, "hasLoader": false, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": true, "hasErrorBoundary": false, "module": "/assets/run-detail-ldKIjs8Z.js", "imports": ["/assets/index-BsV8i_Jn.js", "/assets/workflow-graph-viewer-CLv3yYv8.js", "/assets/mermaid-3ZIDBTTL-CWOyQBTZ.js", "/assets/encryption-Bd25Keng.js", "/assets/index-7hulCzI_.js"], "css": ["/assets/workflow-graph-viewer-yls6qlc0.css", "/assets/mermaid-3ZIDBTTL-DKxHcEOp.css"], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 }, "routes/api.rpc": { "id": "routes/api.rpc", "parentId": "root", "path": "api/rpc", "index": void 0, "caseSensitive": void 0, "hasAction": true, "hasLoader": true, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": false, "hasErrorBoundary": false, "module": "/assets/api.rpc-l0sNRNKZ.js", "imports": [], "css": [], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 }, "routes/api.stream.$streamId": { "id": "routes/api.stream.$streamId", "parentId": "root", "path": "api/stream/:streamId", "index": void 0, "caseSensitive": void 0, "hasAction": false, "hasLoader": true, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": false, "hasErrorBoundary": false, "module": "/assets/api.stream._streamId-l0sNRNKZ.js", "imports": [], "css": [], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 } }, "url": "/assets/manifest-a1c479ba.js", "version": "a1c479ba", "sri": void 0 };
153997
153161
  const assetsBuildDirectory = "build/client";
153998
153162
  const basename = "/";
153999
153163
  const future = { "unstable_optimizeDeps": false, "unstable_subResourceIntegrity": false, "unstable_trailingSlashAwareDataRequests": false, "unstable_previewServerPrerendering": false, "v8_middleware": false, "v8_splitRouteModules": false, "v8_viteEnvironmentApi": false };
@@ -154062,18 +153226,21 @@ const serverBuild = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
154062
153226
  ssr
154063
153227
  }, Symbol.toStringTag, { value: "Module" }));
154064
153228
  export {
154065
- Qe as A,
153229
+ validateUlidTimestamp as A,
154066
153230
  BaseEventSchema as B,
154067
- requireTokenUtil as C,
153231
+ R as C,
154068
153232
  DEFAULT_TIMESTAMP_THRESHOLD_FUTURE_MS as D,
154069
153233
  EVENT_DATA_REF_FIELDS as E,
154070
- requireTokenError as F,
154071
- serverBuild as G,
153234
+ jsxRuntimeExports as F,
153235
+ Qe as G,
154072
153236
  HookSchema as H,
153237
+ requireTokenUtil as I,
153238
+ requireTokenError as J,
154073
153239
  Ks as K,
154074
153240
  LegacySerializedDataSchemaV1 as L,
154075
153241
  MessageId as M,
154076
153242
  Nt as N,
153243
+ serverBuild as O,
154077
153244
  PaginatedResponseSchema as P,
154078
153245
  QueuePayloadSchema as Q,
154079
153246
  RunInputSchema as R,
@@ -154098,12 +153265,12 @@ export {
154098
153265
  WorkflowRunBaseSchema as p,
154099
153266
  WorkflowRunSchema as q,
154100
153267
  WorkflowRunStatusSchema as r,
154101
- isLegacySpecVersion as s,
154102
- reenqueueActiveRuns as t,
154103
- requiresNewerWorld as u,
154104
- stripEventDataRefs as v,
154105
- ulidToDate as w,
154106
- validateUlidTimestamp as x,
154107
- R as y,
154108
- jsxRuntimeExports as z
153268
+ getQueueTopicPrefix as s,
153269
+ isLegacySpecVersion as t,
153270
+ parseQueueName as u,
153271
+ reenqueueActiveRuns as v,
153272
+ requiresNewerWorld as w,
153273
+ resolveQueueNamespace as x,
153274
+ stripEventDataRefs as y,
153275
+ ulidToDate as z
154109
153276
  };