@workflow/world-testing 4.1.0-beta.75 → 4.1.0-beta.76

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.
@@ -15235,6 +15235,42 @@ var init_queue = __esm({
15235
15235
  }
15236
15236
  });
15237
15237
 
15238
+ // ../world/dist/recovery.js
15239
+ async function reenqueueActiveRuns(runs, enqueue, label) {
15240
+ let reenqueued = 0;
15241
+ for (const status of ["pending", "running"]) {
15242
+ let cursor;
15243
+ let hasMore = true;
15244
+ while (hasMore) {
15245
+ const page = await runs.list({
15246
+ status,
15247
+ resolveData: "none",
15248
+ pagination: { cursor }
15249
+ });
15250
+ for (const run of page.data) {
15251
+ try {
15252
+ const queueName = `__wkf_workflow_${run.workflowName}`;
15253
+ await enqueue(queueName, { runId: run.runId });
15254
+ reenqueued++;
15255
+ } catch (err) {
15256
+ console.warn(`[${label}] Failed to re-enqueue run ${run.runId}: ${err}`);
15257
+ }
15258
+ }
15259
+ hasMore = page.hasMore;
15260
+ cursor = page.cursor ?? void 0;
15261
+ }
15262
+ }
15263
+ if (reenqueued > 0) {
15264
+ console.log(`[${label}] Re-enqueued ${reenqueued} active run(s) on startup`);
15265
+ }
15266
+ }
15267
+ var init_recovery = __esm({
15268
+ "../world/dist/recovery.js"() {
15269
+ "use strict";
15270
+ __name(reenqueueActiveRuns, "reenqueueActiveRuns");
15271
+ }
15272
+ });
15273
+
15238
15274
  // ../world/dist/shared.js
15239
15275
  var zodJsonSchema, PaginatedResponseSchema, StructuredErrorSchema;
15240
15276
  var init_shared = __esm({
@@ -15686,6 +15722,7 @@ __export(dist_exports, {
15686
15722
  WorkflowRunSchema: () => WorkflowRunSchema,
15687
15723
  WorkflowRunStatusSchema: () => WorkflowRunStatusSchema,
15688
15724
  isLegacySpecVersion: () => isLegacySpecVersion,
15725
+ reenqueueActiveRuns: () => reenqueueActiveRuns,
15689
15726
  requiresNewerWorld: () => requiresNewerWorld,
15690
15727
  stripEventDataRefs: () => stripEventDataRefs,
15691
15728
  ulidToDate: () => ulidToDate,
@@ -15697,6 +15734,7 @@ var init_dist = __esm({
15697
15734
  init_events();
15698
15735
  init_hooks();
15699
15736
  init_queue();
15737
+ init_recovery();
15700
15738
  init_runs();
15701
15739
  init_serialization();
15702
15740
  init_shared();
@@ -45897,6 +45935,1948 @@ var require_seedrandom2 = __commonJS({
45897
45935
  }
45898
45936
  });
45899
45937
 
45938
+ // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/constants.js
45939
+ var require_constants6 = __commonJS({
45940
+ "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/constants.js"(exports2, module2) {
45941
+ "use strict";
45942
+ var SEMVER_SPEC_VERSION = "2.0.0";
45943
+ var MAX_LENGTH = 256;
45944
+ var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */
45945
+ 9007199254740991;
45946
+ var MAX_SAFE_COMPONENT_LENGTH = 16;
45947
+ var MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6;
45948
+ var RELEASE_TYPES = [
45949
+ "major",
45950
+ "premajor",
45951
+ "minor",
45952
+ "preminor",
45953
+ "patch",
45954
+ "prepatch",
45955
+ "prerelease"
45956
+ ];
45957
+ module2.exports = {
45958
+ MAX_LENGTH,
45959
+ MAX_SAFE_COMPONENT_LENGTH,
45960
+ MAX_SAFE_BUILD_LENGTH,
45961
+ MAX_SAFE_INTEGER,
45962
+ RELEASE_TYPES,
45963
+ SEMVER_SPEC_VERSION,
45964
+ FLAG_INCLUDE_PRERELEASE: 1,
45965
+ FLAG_LOOSE: 2
45966
+ };
45967
+ }
45968
+ });
45969
+
45970
+ // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/debug.js
45971
+ var require_debug = __commonJS({
45972
+ "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/debug.js"(exports2, module2) {
45973
+ "use strict";
45974
+ var debug2 = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {
45975
+ };
45976
+ module2.exports = debug2;
45977
+ }
45978
+ });
45979
+
45980
+ // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/re.js
45981
+ var require_re = __commonJS({
45982
+ "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/re.js"(exports2, module2) {
45983
+ "use strict";
45984
+ var {
45985
+ MAX_SAFE_COMPONENT_LENGTH,
45986
+ MAX_SAFE_BUILD_LENGTH,
45987
+ MAX_LENGTH
45988
+ } = require_constants6();
45989
+ var debug2 = require_debug();
45990
+ exports2 = module2.exports = {};
45991
+ var re2 = exports2.re = [];
45992
+ var safeRe = exports2.safeRe = [];
45993
+ var src2 = exports2.src = [];
45994
+ var safeSrc = exports2.safeSrc = [];
45995
+ var t = exports2.t = {};
45996
+ var R = 0;
45997
+ var LETTERDASHNUMBER = "[a-zA-Z0-9-]";
45998
+ var safeRegexReplacements = [
45999
+ ["\\s", 1],
46000
+ ["\\d", MAX_LENGTH],
46001
+ [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
46002
+ ];
46003
+ var makeSafeRegex = /* @__PURE__ */ __name((value) => {
46004
+ for (const [token, max] of safeRegexReplacements) {
46005
+ value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
46006
+ }
46007
+ return value;
46008
+ }, "makeSafeRegex");
46009
+ var createToken = /* @__PURE__ */ __name((name, value, isGlobal) => {
46010
+ const safe = makeSafeRegex(value);
46011
+ const index = R++;
46012
+ debug2(name, index, value);
46013
+ t[name] = index;
46014
+ src2[index] = value;
46015
+ safeSrc[index] = safe;
46016
+ re2[index] = new RegExp(value, isGlobal ? "g" : void 0);
46017
+ safeRe[index] = new RegExp(safe, isGlobal ? "g" : void 0);
46018
+ }, "createToken");
46019
+ createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
46020
+ createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
46021
+ createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
46022
+ createToken("MAINVERSION", `(${src2[t.NUMERICIDENTIFIER]})\\.(${src2[t.NUMERICIDENTIFIER]})\\.(${src2[t.NUMERICIDENTIFIER]})`);
46023
+ createToken("MAINVERSIONLOOSE", `(${src2[t.NUMERICIDENTIFIERLOOSE]})\\.(${src2[t.NUMERICIDENTIFIERLOOSE]})\\.(${src2[t.NUMERICIDENTIFIERLOOSE]})`);
46024
+ createToken("PRERELEASEIDENTIFIER", `(?:${src2[t.NONNUMERICIDENTIFIER]}|${src2[t.NUMERICIDENTIFIER]})`);
46025
+ createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src2[t.NONNUMERICIDENTIFIER]}|${src2[t.NUMERICIDENTIFIERLOOSE]})`);
46026
+ createToken("PRERELEASE", `(?:-(${src2[t.PRERELEASEIDENTIFIER]}(?:\\.${src2[t.PRERELEASEIDENTIFIER]})*))`);
46027
+ createToken("PRERELEASELOOSE", `(?:-?(${src2[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src2[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
46028
+ createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
46029
+ createToken("BUILD", `(?:\\+(${src2[t.BUILDIDENTIFIER]}(?:\\.${src2[t.BUILDIDENTIFIER]})*))`);
46030
+ createToken("FULLPLAIN", `v?${src2[t.MAINVERSION]}${src2[t.PRERELEASE]}?${src2[t.BUILD]}?`);
46031
+ createToken("FULL", `^${src2[t.FULLPLAIN]}$`);
46032
+ createToken("LOOSEPLAIN", `[v=\\s]*${src2[t.MAINVERSIONLOOSE]}${src2[t.PRERELEASELOOSE]}?${src2[t.BUILD]}?`);
46033
+ createToken("LOOSE", `^${src2[t.LOOSEPLAIN]}$`);
46034
+ createToken("GTLT", "((?:<|>)?=?)");
46035
+ createToken("XRANGEIDENTIFIERLOOSE", `${src2[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
46036
+ createToken("XRANGEIDENTIFIER", `${src2[t.NUMERICIDENTIFIER]}|x|X|\\*`);
46037
+ createToken("XRANGEPLAIN", `[v=\\s]*(${src2[t.XRANGEIDENTIFIER]})(?:\\.(${src2[t.XRANGEIDENTIFIER]})(?:\\.(${src2[t.XRANGEIDENTIFIER]})(?:${src2[t.PRERELEASE]})?${src2[t.BUILD]}?)?)?`);
46038
+ createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src2[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src2[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src2[t.XRANGEIDENTIFIERLOOSE]})(?:${src2[t.PRERELEASELOOSE]})?${src2[t.BUILD]}?)?)?`);
46039
+ createToken("XRANGE", `^${src2[t.GTLT]}\\s*${src2[t.XRANGEPLAIN]}$`);
46040
+ createToken("XRANGELOOSE", `^${src2[t.GTLT]}\\s*${src2[t.XRANGEPLAINLOOSE]}$`);
46041
+ createToken("COERCEPLAIN", `${"(^|[^\\d])(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
46042
+ createToken("COERCE", `${src2[t.COERCEPLAIN]}(?:$|[^\\d])`);
46043
+ createToken("COERCEFULL", src2[t.COERCEPLAIN] + `(?:${src2[t.PRERELEASE]})?(?:${src2[t.BUILD]})?(?:$|[^\\d])`);
46044
+ createToken("COERCERTL", src2[t.COERCE], true);
46045
+ createToken("COERCERTLFULL", src2[t.COERCEFULL], true);
46046
+ createToken("LONETILDE", "(?:~>?)");
46047
+ createToken("TILDETRIM", `(\\s*)${src2[t.LONETILDE]}\\s+`, true);
46048
+ exports2.tildeTrimReplace = "$1~";
46049
+ createToken("TILDE", `^${src2[t.LONETILDE]}${src2[t.XRANGEPLAIN]}$`);
46050
+ createToken("TILDELOOSE", `^${src2[t.LONETILDE]}${src2[t.XRANGEPLAINLOOSE]}$`);
46051
+ createToken("LONECARET", "(?:\\^)");
46052
+ createToken("CARETTRIM", `(\\s*)${src2[t.LONECARET]}\\s+`, true);
46053
+ exports2.caretTrimReplace = "$1^";
46054
+ createToken("CARET", `^${src2[t.LONECARET]}${src2[t.XRANGEPLAIN]}$`);
46055
+ createToken("CARETLOOSE", `^${src2[t.LONECARET]}${src2[t.XRANGEPLAINLOOSE]}$`);
46056
+ createToken("COMPARATORLOOSE", `^${src2[t.GTLT]}\\s*(${src2[t.LOOSEPLAIN]})$|^$`);
46057
+ createToken("COMPARATOR", `^${src2[t.GTLT]}\\s*(${src2[t.FULLPLAIN]})$|^$`);
46058
+ createToken("COMPARATORTRIM", `(\\s*)${src2[t.GTLT]}\\s*(${src2[t.LOOSEPLAIN]}|${src2[t.XRANGEPLAIN]})`, true);
46059
+ exports2.comparatorTrimReplace = "$1$2$3";
46060
+ createToken("HYPHENRANGE", `^\\s*(${src2[t.XRANGEPLAIN]})\\s+-\\s+(${src2[t.XRANGEPLAIN]})\\s*$`);
46061
+ createToken("HYPHENRANGELOOSE", `^\\s*(${src2[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src2[t.XRANGEPLAINLOOSE]})\\s*$`);
46062
+ createToken("STAR", "(<|>)?=?\\s*\\*");
46063
+ createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
46064
+ createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
46065
+ }
46066
+ });
46067
+
46068
+ // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/parse-options.js
46069
+ var require_parse_options = __commonJS({
46070
+ "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/parse-options.js"(exports2, module2) {
46071
+ "use strict";
46072
+ var looseOption = Object.freeze({ loose: true });
46073
+ var emptyOpts = Object.freeze({});
46074
+ var parseOptions = /* @__PURE__ */ __name((options) => {
46075
+ if (!options) {
46076
+ return emptyOpts;
46077
+ }
46078
+ if (typeof options !== "object") {
46079
+ return looseOption;
46080
+ }
46081
+ return options;
46082
+ }, "parseOptions");
46083
+ module2.exports = parseOptions;
46084
+ }
46085
+ });
46086
+
46087
+ // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/identifiers.js
46088
+ var require_identifiers = __commonJS({
46089
+ "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/identifiers.js"(exports2, module2) {
46090
+ "use strict";
46091
+ var numeric2 = /^[0-9]+$/;
46092
+ var compareIdentifiers = /* @__PURE__ */ __name((a, b) => {
46093
+ if (typeof a === "number" && typeof b === "number") {
46094
+ return a === b ? 0 : a < b ? -1 : 1;
46095
+ }
46096
+ const anum = numeric2.test(a);
46097
+ const bnum = numeric2.test(b);
46098
+ if (anum && bnum) {
46099
+ a = +a;
46100
+ b = +b;
46101
+ }
46102
+ return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
46103
+ }, "compareIdentifiers");
46104
+ var rcompareIdentifiers = /* @__PURE__ */ __name((a, b) => compareIdentifiers(b, a), "rcompareIdentifiers");
46105
+ module2.exports = {
46106
+ compareIdentifiers,
46107
+ rcompareIdentifiers
46108
+ };
46109
+ }
46110
+ });
46111
+
46112
+ // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/classes/semver.js
46113
+ var require_semver = __commonJS({
46114
+ "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/classes/semver.js"(exports2, module2) {
46115
+ "use strict";
46116
+ var debug2 = require_debug();
46117
+ var { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants6();
46118
+ var { safeRe: re2, t } = require_re();
46119
+ var parseOptions = require_parse_options();
46120
+ var { compareIdentifiers } = require_identifiers();
46121
+ var SemVer = class _SemVer {
46122
+ static {
46123
+ __name(this, "SemVer");
46124
+ }
46125
+ constructor(version4, options) {
46126
+ options = parseOptions(options);
46127
+ if (version4 instanceof _SemVer) {
46128
+ if (version4.loose === !!options.loose && version4.includePrerelease === !!options.includePrerelease) {
46129
+ return version4;
46130
+ } else {
46131
+ version4 = version4.version;
46132
+ }
46133
+ } else if (typeof version4 !== "string") {
46134
+ throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version4}".`);
46135
+ }
46136
+ if (version4.length > MAX_LENGTH) {
46137
+ throw new TypeError(
46138
+ `version is longer than ${MAX_LENGTH} characters`
46139
+ );
46140
+ }
46141
+ debug2("SemVer", version4, options);
46142
+ this.options = options;
46143
+ this.loose = !!options.loose;
46144
+ this.includePrerelease = !!options.includePrerelease;
46145
+ const m = version4.trim().match(options.loose ? re2[t.LOOSE] : re2[t.FULL]);
46146
+ if (!m) {
46147
+ throw new TypeError(`Invalid Version: ${version4}`);
46148
+ }
46149
+ this.raw = version4;
46150
+ this.major = +m[1];
46151
+ this.minor = +m[2];
46152
+ this.patch = +m[3];
46153
+ if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
46154
+ throw new TypeError("Invalid major version");
46155
+ }
46156
+ if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
46157
+ throw new TypeError("Invalid minor version");
46158
+ }
46159
+ if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
46160
+ throw new TypeError("Invalid patch version");
46161
+ }
46162
+ if (!m[4]) {
46163
+ this.prerelease = [];
46164
+ } else {
46165
+ this.prerelease = m[4].split(".").map((id) => {
46166
+ if (/^[0-9]+$/.test(id)) {
46167
+ const num = +id;
46168
+ if (num >= 0 && num < MAX_SAFE_INTEGER) {
46169
+ return num;
46170
+ }
46171
+ }
46172
+ return id;
46173
+ });
46174
+ }
46175
+ this.build = m[5] ? m[5].split(".") : [];
46176
+ this.format();
46177
+ }
46178
+ format() {
46179
+ this.version = `${this.major}.${this.minor}.${this.patch}`;
46180
+ if (this.prerelease.length) {
46181
+ this.version += `-${this.prerelease.join(".")}`;
46182
+ }
46183
+ return this.version;
46184
+ }
46185
+ toString() {
46186
+ return this.version;
46187
+ }
46188
+ compare(other) {
46189
+ debug2("SemVer.compare", this.version, this.options, other);
46190
+ if (!(other instanceof _SemVer)) {
46191
+ if (typeof other === "string" && other === this.version) {
46192
+ return 0;
46193
+ }
46194
+ other = new _SemVer(other, this.options);
46195
+ }
46196
+ if (other.version === this.version) {
46197
+ return 0;
46198
+ }
46199
+ return this.compareMain(other) || this.comparePre(other);
46200
+ }
46201
+ compareMain(other) {
46202
+ if (!(other instanceof _SemVer)) {
46203
+ other = new _SemVer(other, this.options);
46204
+ }
46205
+ if (this.major < other.major) {
46206
+ return -1;
46207
+ }
46208
+ if (this.major > other.major) {
46209
+ return 1;
46210
+ }
46211
+ if (this.minor < other.minor) {
46212
+ return -1;
46213
+ }
46214
+ if (this.minor > other.minor) {
46215
+ return 1;
46216
+ }
46217
+ if (this.patch < other.patch) {
46218
+ return -1;
46219
+ }
46220
+ if (this.patch > other.patch) {
46221
+ return 1;
46222
+ }
46223
+ return 0;
46224
+ }
46225
+ comparePre(other) {
46226
+ if (!(other instanceof _SemVer)) {
46227
+ other = new _SemVer(other, this.options);
46228
+ }
46229
+ if (this.prerelease.length && !other.prerelease.length) {
46230
+ return -1;
46231
+ } else if (!this.prerelease.length && other.prerelease.length) {
46232
+ return 1;
46233
+ } else if (!this.prerelease.length && !other.prerelease.length) {
46234
+ return 0;
46235
+ }
46236
+ let i = 0;
46237
+ do {
46238
+ const a = this.prerelease[i];
46239
+ const b = other.prerelease[i];
46240
+ debug2("prerelease compare", i, a, b);
46241
+ if (a === void 0 && b === void 0) {
46242
+ return 0;
46243
+ } else if (b === void 0) {
46244
+ return 1;
46245
+ } else if (a === void 0) {
46246
+ return -1;
46247
+ } else if (a === b) {
46248
+ continue;
46249
+ } else {
46250
+ return compareIdentifiers(a, b);
46251
+ }
46252
+ } while (++i);
46253
+ }
46254
+ compareBuild(other) {
46255
+ if (!(other instanceof _SemVer)) {
46256
+ other = new _SemVer(other, this.options);
46257
+ }
46258
+ let i = 0;
46259
+ do {
46260
+ const a = this.build[i];
46261
+ const b = other.build[i];
46262
+ debug2("build compare", i, a, b);
46263
+ if (a === void 0 && b === void 0) {
46264
+ return 0;
46265
+ } else if (b === void 0) {
46266
+ return 1;
46267
+ } else if (a === void 0) {
46268
+ return -1;
46269
+ } else if (a === b) {
46270
+ continue;
46271
+ } else {
46272
+ return compareIdentifiers(a, b);
46273
+ }
46274
+ } while (++i);
46275
+ }
46276
+ // preminor will bump the version up to the next minor release, and immediately
46277
+ // down to pre-release. premajor and prepatch work the same way.
46278
+ inc(release, identifier, identifierBase) {
46279
+ if (release.startsWith("pre")) {
46280
+ if (!identifier && identifierBase === false) {
46281
+ throw new Error("invalid increment argument: identifier is empty");
46282
+ }
46283
+ if (identifier) {
46284
+ const match2 = `-${identifier}`.match(this.options.loose ? re2[t.PRERELEASELOOSE] : re2[t.PRERELEASE]);
46285
+ if (!match2 || match2[1] !== identifier) {
46286
+ throw new Error(`invalid identifier: ${identifier}`);
46287
+ }
46288
+ }
46289
+ }
46290
+ switch (release) {
46291
+ case "premajor":
46292
+ this.prerelease.length = 0;
46293
+ this.patch = 0;
46294
+ this.minor = 0;
46295
+ this.major++;
46296
+ this.inc("pre", identifier, identifierBase);
46297
+ break;
46298
+ case "preminor":
46299
+ this.prerelease.length = 0;
46300
+ this.patch = 0;
46301
+ this.minor++;
46302
+ this.inc("pre", identifier, identifierBase);
46303
+ break;
46304
+ case "prepatch":
46305
+ this.prerelease.length = 0;
46306
+ this.inc("patch", identifier, identifierBase);
46307
+ this.inc("pre", identifier, identifierBase);
46308
+ break;
46309
+ // If the input is a non-prerelease version, this acts the same as
46310
+ // prepatch.
46311
+ case "prerelease":
46312
+ if (this.prerelease.length === 0) {
46313
+ this.inc("patch", identifier, identifierBase);
46314
+ }
46315
+ this.inc("pre", identifier, identifierBase);
46316
+ break;
46317
+ case "release":
46318
+ if (this.prerelease.length === 0) {
46319
+ throw new Error(`version ${this.raw} is not a prerelease`);
46320
+ }
46321
+ this.prerelease.length = 0;
46322
+ break;
46323
+ case "major":
46324
+ if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
46325
+ this.major++;
46326
+ }
46327
+ this.minor = 0;
46328
+ this.patch = 0;
46329
+ this.prerelease = [];
46330
+ break;
46331
+ case "minor":
46332
+ if (this.patch !== 0 || this.prerelease.length === 0) {
46333
+ this.minor++;
46334
+ }
46335
+ this.patch = 0;
46336
+ this.prerelease = [];
46337
+ break;
46338
+ case "patch":
46339
+ if (this.prerelease.length === 0) {
46340
+ this.patch++;
46341
+ }
46342
+ this.prerelease = [];
46343
+ break;
46344
+ // This probably shouldn't be used publicly.
46345
+ // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
46346
+ case "pre": {
46347
+ const base = Number(identifierBase) ? 1 : 0;
46348
+ if (this.prerelease.length === 0) {
46349
+ this.prerelease = [base];
46350
+ } else {
46351
+ let i = this.prerelease.length;
46352
+ while (--i >= 0) {
46353
+ if (typeof this.prerelease[i] === "number") {
46354
+ this.prerelease[i]++;
46355
+ i = -2;
46356
+ }
46357
+ }
46358
+ if (i === -1) {
46359
+ if (identifier === this.prerelease.join(".") && identifierBase === false) {
46360
+ throw new Error("invalid increment argument: identifier already exists");
46361
+ }
46362
+ this.prerelease.push(base);
46363
+ }
46364
+ }
46365
+ if (identifier) {
46366
+ let prerelease = [identifier, base];
46367
+ if (identifierBase === false) {
46368
+ prerelease = [identifier];
46369
+ }
46370
+ if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
46371
+ if (isNaN(this.prerelease[1])) {
46372
+ this.prerelease = prerelease;
46373
+ }
46374
+ } else {
46375
+ this.prerelease = prerelease;
46376
+ }
46377
+ }
46378
+ break;
46379
+ }
46380
+ default:
46381
+ throw new Error(`invalid increment argument: ${release}`);
46382
+ }
46383
+ this.raw = this.format();
46384
+ if (this.build.length) {
46385
+ this.raw += `+${this.build.join(".")}`;
46386
+ }
46387
+ return this;
46388
+ }
46389
+ };
46390
+ module2.exports = SemVer;
46391
+ }
46392
+ });
46393
+
46394
+ // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/parse.js
46395
+ var require_parse2 = __commonJS({
46396
+ "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/parse.js"(exports2, module2) {
46397
+ "use strict";
46398
+ var SemVer = require_semver();
46399
+ var parse5 = /* @__PURE__ */ __name((version4, options, throwErrors = false) => {
46400
+ if (version4 instanceof SemVer) {
46401
+ return version4;
46402
+ }
46403
+ try {
46404
+ return new SemVer(version4, options);
46405
+ } catch (er) {
46406
+ if (!throwErrors) {
46407
+ return null;
46408
+ }
46409
+ throw er;
46410
+ }
46411
+ }, "parse");
46412
+ module2.exports = parse5;
46413
+ }
46414
+ });
46415
+
46416
+ // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/valid.js
46417
+ var require_valid = __commonJS({
46418
+ "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/valid.js"(exports2, module2) {
46419
+ "use strict";
46420
+ var parse5 = require_parse2();
46421
+ var valid = /* @__PURE__ */ __name((version4, options) => {
46422
+ const v = parse5(version4, options);
46423
+ return v ? v.version : null;
46424
+ }, "valid");
46425
+ module2.exports = valid;
46426
+ }
46427
+ });
46428
+
46429
+ // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/clean.js
46430
+ var require_clean = __commonJS({
46431
+ "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/clean.js"(exports2, module2) {
46432
+ "use strict";
46433
+ var parse5 = require_parse2();
46434
+ var clean = /* @__PURE__ */ __name((version4, options) => {
46435
+ const s = parse5(version4.trim().replace(/^[=v]+/, ""), options);
46436
+ return s ? s.version : null;
46437
+ }, "clean");
46438
+ module2.exports = clean;
46439
+ }
46440
+ });
46441
+
46442
+ // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/inc.js
46443
+ var require_inc = __commonJS({
46444
+ "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/inc.js"(exports2, module2) {
46445
+ "use strict";
46446
+ var SemVer = require_semver();
46447
+ var inc = /* @__PURE__ */ __name((version4, release, options, identifier, identifierBase) => {
46448
+ if (typeof options === "string") {
46449
+ identifierBase = identifier;
46450
+ identifier = options;
46451
+ options = void 0;
46452
+ }
46453
+ try {
46454
+ return new SemVer(
46455
+ version4 instanceof SemVer ? version4.version : version4,
46456
+ options
46457
+ ).inc(release, identifier, identifierBase).version;
46458
+ } catch (er) {
46459
+ return null;
46460
+ }
46461
+ }, "inc");
46462
+ module2.exports = inc;
46463
+ }
46464
+ });
46465
+
46466
+ // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/diff.js
46467
+ var require_diff = __commonJS({
46468
+ "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/diff.js"(exports2, module2) {
46469
+ "use strict";
46470
+ var parse5 = require_parse2();
46471
+ var diff = /* @__PURE__ */ __name((version1, version22) => {
46472
+ const v1 = parse5(version1, null, true);
46473
+ const v2 = parse5(version22, null, true);
46474
+ const comparison = v1.compare(v2);
46475
+ if (comparison === 0) {
46476
+ return null;
46477
+ }
46478
+ const v1Higher = comparison > 0;
46479
+ const highVersion = v1Higher ? v1 : v2;
46480
+ const lowVersion = v1Higher ? v2 : v1;
46481
+ const highHasPre = !!highVersion.prerelease.length;
46482
+ const lowHasPre = !!lowVersion.prerelease.length;
46483
+ if (lowHasPre && !highHasPre) {
46484
+ if (!lowVersion.patch && !lowVersion.minor) {
46485
+ return "major";
46486
+ }
46487
+ if (lowVersion.compareMain(highVersion) === 0) {
46488
+ if (lowVersion.minor && !lowVersion.patch) {
46489
+ return "minor";
46490
+ }
46491
+ return "patch";
46492
+ }
46493
+ }
46494
+ const prefix = highHasPre ? "pre" : "";
46495
+ if (v1.major !== v2.major) {
46496
+ return prefix + "major";
46497
+ }
46498
+ if (v1.minor !== v2.minor) {
46499
+ return prefix + "minor";
46500
+ }
46501
+ if (v1.patch !== v2.patch) {
46502
+ return prefix + "patch";
46503
+ }
46504
+ return "prerelease";
46505
+ }, "diff");
46506
+ module2.exports = diff;
46507
+ }
46508
+ });
46509
+
46510
+ // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/major.js
46511
+ var require_major = __commonJS({
46512
+ "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/major.js"(exports2, module2) {
46513
+ "use strict";
46514
+ var SemVer = require_semver();
46515
+ var major2 = /* @__PURE__ */ __name((a, loose) => new SemVer(a, loose).major, "major");
46516
+ module2.exports = major2;
46517
+ }
46518
+ });
46519
+
46520
+ // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/minor.js
46521
+ var require_minor = __commonJS({
46522
+ "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/minor.js"(exports2, module2) {
46523
+ "use strict";
46524
+ var SemVer = require_semver();
46525
+ var minor = /* @__PURE__ */ __name((a, loose) => new SemVer(a, loose).minor, "minor");
46526
+ module2.exports = minor;
46527
+ }
46528
+ });
46529
+
46530
+ // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/patch.js
46531
+ var require_patch = __commonJS({
46532
+ "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/patch.js"(exports2, module2) {
46533
+ "use strict";
46534
+ var SemVer = require_semver();
46535
+ var patch = /* @__PURE__ */ __name((a, loose) => new SemVer(a, loose).patch, "patch");
46536
+ module2.exports = patch;
46537
+ }
46538
+ });
46539
+
46540
+ // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/prerelease.js
46541
+ var require_prerelease = __commonJS({
46542
+ "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/prerelease.js"(exports2, module2) {
46543
+ "use strict";
46544
+ var parse5 = require_parse2();
46545
+ var prerelease = /* @__PURE__ */ __name((version4, options) => {
46546
+ const parsed = parse5(version4, options);
46547
+ return parsed && parsed.prerelease.length ? parsed.prerelease : null;
46548
+ }, "prerelease");
46549
+ module2.exports = prerelease;
46550
+ }
46551
+ });
46552
+
46553
+ // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/compare.js
46554
+ var require_compare = __commonJS({
46555
+ "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/compare.js"(exports2, module2) {
46556
+ "use strict";
46557
+ var SemVer = require_semver();
46558
+ var compare = /* @__PURE__ */ __name((a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose)), "compare");
46559
+ module2.exports = compare;
46560
+ }
46561
+ });
46562
+
46563
+ // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/rcompare.js
46564
+ var require_rcompare = __commonJS({
46565
+ "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/rcompare.js"(exports2, module2) {
46566
+ "use strict";
46567
+ var compare = require_compare();
46568
+ var rcompare = /* @__PURE__ */ __name((a, b, loose) => compare(b, a, loose), "rcompare");
46569
+ module2.exports = rcompare;
46570
+ }
46571
+ });
46572
+
46573
+ // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/compare-loose.js
46574
+ var require_compare_loose = __commonJS({
46575
+ "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/compare-loose.js"(exports2, module2) {
46576
+ "use strict";
46577
+ var compare = require_compare();
46578
+ var compareLoose = /* @__PURE__ */ __name((a, b) => compare(a, b, true), "compareLoose");
46579
+ module2.exports = compareLoose;
46580
+ }
46581
+ });
46582
+
46583
+ // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/compare-build.js
46584
+ var require_compare_build = __commonJS({
46585
+ "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/compare-build.js"(exports2, module2) {
46586
+ "use strict";
46587
+ var SemVer = require_semver();
46588
+ var compareBuild = /* @__PURE__ */ __name((a, b, loose) => {
46589
+ const versionA = new SemVer(a, loose);
46590
+ const versionB = new SemVer(b, loose);
46591
+ return versionA.compare(versionB) || versionA.compareBuild(versionB);
46592
+ }, "compareBuild");
46593
+ module2.exports = compareBuild;
46594
+ }
46595
+ });
46596
+
46597
+ // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/sort.js
46598
+ var require_sort = __commonJS({
46599
+ "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/sort.js"(exports2, module2) {
46600
+ "use strict";
46601
+ var compareBuild = require_compare_build();
46602
+ var sort2 = /* @__PURE__ */ __name((list, loose) => list.sort((a, b) => compareBuild(a, b, loose)), "sort");
46603
+ module2.exports = sort2;
46604
+ }
46605
+ });
46606
+
46607
+ // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/rsort.js
46608
+ var require_rsort = __commonJS({
46609
+ "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/rsort.js"(exports2, module2) {
46610
+ "use strict";
46611
+ var compareBuild = require_compare_build();
46612
+ var rsort = /* @__PURE__ */ __name((list, loose) => list.sort((a, b) => compareBuild(b, a, loose)), "rsort");
46613
+ module2.exports = rsort;
46614
+ }
46615
+ });
46616
+
46617
+ // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/gt.js
46618
+ var require_gt = __commonJS({
46619
+ "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/gt.js"(exports2, module2) {
46620
+ "use strict";
46621
+ var compare = require_compare();
46622
+ var gt = /* @__PURE__ */ __name((a, b, loose) => compare(a, b, loose) > 0, "gt");
46623
+ module2.exports = gt;
46624
+ }
46625
+ });
46626
+
46627
+ // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/lt.js
46628
+ var require_lt = __commonJS({
46629
+ "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/lt.js"(exports2, module2) {
46630
+ "use strict";
46631
+ var compare = require_compare();
46632
+ var lt = /* @__PURE__ */ __name((a, b, loose) => compare(a, b, loose) < 0, "lt");
46633
+ module2.exports = lt;
46634
+ }
46635
+ });
46636
+
46637
+ // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/eq.js
46638
+ var require_eq = __commonJS({
46639
+ "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/eq.js"(exports2, module2) {
46640
+ "use strict";
46641
+ var compare = require_compare();
46642
+ var eq = /* @__PURE__ */ __name((a, b, loose) => compare(a, b, loose) === 0, "eq");
46643
+ module2.exports = eq;
46644
+ }
46645
+ });
46646
+
46647
+ // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/neq.js
46648
+ var require_neq = __commonJS({
46649
+ "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/neq.js"(exports2, module2) {
46650
+ "use strict";
46651
+ var compare = require_compare();
46652
+ var neq = /* @__PURE__ */ __name((a, b, loose) => compare(a, b, loose) !== 0, "neq");
46653
+ module2.exports = neq;
46654
+ }
46655
+ });
46656
+
46657
+ // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/gte.js
46658
+ var require_gte = __commonJS({
46659
+ "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/gte.js"(exports2, module2) {
46660
+ "use strict";
46661
+ var compare = require_compare();
46662
+ var gte2 = /* @__PURE__ */ __name((a, b, loose) => compare(a, b, loose) >= 0, "gte");
46663
+ module2.exports = gte2;
46664
+ }
46665
+ });
46666
+
46667
+ // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/lte.js
46668
+ var require_lte = __commonJS({
46669
+ "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/lte.js"(exports2, module2) {
46670
+ "use strict";
46671
+ var compare = require_compare();
46672
+ var lte2 = /* @__PURE__ */ __name((a, b, loose) => compare(a, b, loose) <= 0, "lte");
46673
+ module2.exports = lte2;
46674
+ }
46675
+ });
46676
+
46677
+ // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/cmp.js
46678
+ var require_cmp = __commonJS({
46679
+ "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/cmp.js"(exports2, module2) {
46680
+ "use strict";
46681
+ var eq = require_eq();
46682
+ var neq = require_neq();
46683
+ var gt = require_gt();
46684
+ var gte2 = require_gte();
46685
+ var lt = require_lt();
46686
+ var lte2 = require_lte();
46687
+ var cmp = /* @__PURE__ */ __name((a, op, b, loose) => {
46688
+ switch (op) {
46689
+ case "===":
46690
+ if (typeof a === "object") {
46691
+ a = a.version;
46692
+ }
46693
+ if (typeof b === "object") {
46694
+ b = b.version;
46695
+ }
46696
+ return a === b;
46697
+ case "!==":
46698
+ if (typeof a === "object") {
46699
+ a = a.version;
46700
+ }
46701
+ if (typeof b === "object") {
46702
+ b = b.version;
46703
+ }
46704
+ return a !== b;
46705
+ case "":
46706
+ case "=":
46707
+ case "==":
46708
+ return eq(a, b, loose);
46709
+ case "!=":
46710
+ return neq(a, b, loose);
46711
+ case ">":
46712
+ return gt(a, b, loose);
46713
+ case ">=":
46714
+ return gte2(a, b, loose);
46715
+ case "<":
46716
+ return lt(a, b, loose);
46717
+ case "<=":
46718
+ return lte2(a, b, loose);
46719
+ default:
46720
+ throw new TypeError(`Invalid operator: ${op}`);
46721
+ }
46722
+ }, "cmp");
46723
+ module2.exports = cmp;
46724
+ }
46725
+ });
46726
+
46727
+ // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/coerce.js
46728
+ var require_coerce = __commonJS({
46729
+ "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/coerce.js"(exports2, module2) {
46730
+ "use strict";
46731
+ var SemVer = require_semver();
46732
+ var parse5 = require_parse2();
46733
+ var { safeRe: re2, t } = require_re();
46734
+ var coerce = /* @__PURE__ */ __name((version4, options) => {
46735
+ if (version4 instanceof SemVer) {
46736
+ return version4;
46737
+ }
46738
+ if (typeof version4 === "number") {
46739
+ version4 = String(version4);
46740
+ }
46741
+ if (typeof version4 !== "string") {
46742
+ return null;
46743
+ }
46744
+ options = options || {};
46745
+ let match2 = null;
46746
+ if (!options.rtl) {
46747
+ match2 = version4.match(options.includePrerelease ? re2[t.COERCEFULL] : re2[t.COERCE]);
46748
+ } else {
46749
+ const coerceRtlRegex = options.includePrerelease ? re2[t.COERCERTLFULL] : re2[t.COERCERTL];
46750
+ let next2;
46751
+ while ((next2 = coerceRtlRegex.exec(version4)) && (!match2 || match2.index + match2[0].length !== version4.length)) {
46752
+ if (!match2 || next2.index + next2[0].length !== match2.index + match2[0].length) {
46753
+ match2 = next2;
46754
+ }
46755
+ coerceRtlRegex.lastIndex = next2.index + next2[1].length + next2[2].length;
46756
+ }
46757
+ coerceRtlRegex.lastIndex = -1;
46758
+ }
46759
+ if (match2 === null) {
46760
+ return null;
46761
+ }
46762
+ const major2 = match2[2];
46763
+ const minor = match2[3] || "0";
46764
+ const patch = match2[4] || "0";
46765
+ const prerelease = options.includePrerelease && match2[5] ? `-${match2[5]}` : "";
46766
+ const build = options.includePrerelease && match2[6] ? `+${match2[6]}` : "";
46767
+ return parse5(`${major2}.${minor}.${patch}${prerelease}${build}`, options);
46768
+ }, "coerce");
46769
+ module2.exports = coerce;
46770
+ }
46771
+ });
46772
+
46773
+ // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/lrucache.js
46774
+ var require_lrucache = __commonJS({
46775
+ "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/lrucache.js"(exports2, module2) {
46776
+ "use strict";
46777
+ var LRUCache = class {
46778
+ static {
46779
+ __name(this, "LRUCache");
46780
+ }
46781
+ constructor() {
46782
+ this.max = 1e3;
46783
+ this.map = /* @__PURE__ */ new Map();
46784
+ }
46785
+ get(key) {
46786
+ const value = this.map.get(key);
46787
+ if (value === void 0) {
46788
+ return void 0;
46789
+ } else {
46790
+ this.map.delete(key);
46791
+ this.map.set(key, value);
46792
+ return value;
46793
+ }
46794
+ }
46795
+ delete(key) {
46796
+ return this.map.delete(key);
46797
+ }
46798
+ set(key, value) {
46799
+ const deleted = this.delete(key);
46800
+ if (!deleted && value !== void 0) {
46801
+ if (this.map.size >= this.max) {
46802
+ const firstKey = this.map.keys().next().value;
46803
+ this.delete(firstKey);
46804
+ }
46805
+ this.map.set(key, value);
46806
+ }
46807
+ return this;
46808
+ }
46809
+ };
46810
+ module2.exports = LRUCache;
46811
+ }
46812
+ });
46813
+
46814
+ // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/classes/range.js
46815
+ var require_range = __commonJS({
46816
+ "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/classes/range.js"(exports2, module2) {
46817
+ "use strict";
46818
+ var SPACE_CHARACTERS = /\s+/g;
46819
+ var Range = class _Range {
46820
+ static {
46821
+ __name(this, "Range");
46822
+ }
46823
+ constructor(range2, options) {
46824
+ options = parseOptions(options);
46825
+ if (range2 instanceof _Range) {
46826
+ if (range2.loose === !!options.loose && range2.includePrerelease === !!options.includePrerelease) {
46827
+ return range2;
46828
+ } else {
46829
+ return new _Range(range2.raw, options);
46830
+ }
46831
+ }
46832
+ if (range2 instanceof Comparator) {
46833
+ this.raw = range2.value;
46834
+ this.set = [[range2]];
46835
+ this.formatted = void 0;
46836
+ return this;
46837
+ }
46838
+ this.options = options;
46839
+ this.loose = !!options.loose;
46840
+ this.includePrerelease = !!options.includePrerelease;
46841
+ this.raw = range2.trim().replace(SPACE_CHARACTERS, " ");
46842
+ this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length);
46843
+ if (!this.set.length) {
46844
+ throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
46845
+ }
46846
+ if (this.set.length > 1) {
46847
+ const first = this.set[0];
46848
+ this.set = this.set.filter((c) => !isNullSet(c[0]));
46849
+ if (this.set.length === 0) {
46850
+ this.set = [first];
46851
+ } else if (this.set.length > 1) {
46852
+ for (const c of this.set) {
46853
+ if (c.length === 1 && isAny(c[0])) {
46854
+ this.set = [c];
46855
+ break;
46856
+ }
46857
+ }
46858
+ }
46859
+ }
46860
+ this.formatted = void 0;
46861
+ }
46862
+ get range() {
46863
+ if (this.formatted === void 0) {
46864
+ this.formatted = "";
46865
+ for (let i = 0; i < this.set.length; i++) {
46866
+ if (i > 0) {
46867
+ this.formatted += "||";
46868
+ }
46869
+ const comps = this.set[i];
46870
+ for (let k = 0; k < comps.length; k++) {
46871
+ if (k > 0) {
46872
+ this.formatted += " ";
46873
+ }
46874
+ this.formatted += comps[k].toString().trim();
46875
+ }
46876
+ }
46877
+ }
46878
+ return this.formatted;
46879
+ }
46880
+ format() {
46881
+ return this.range;
46882
+ }
46883
+ toString() {
46884
+ return this.range;
46885
+ }
46886
+ parseRange(range2) {
46887
+ const memoOpts = (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE);
46888
+ const memoKey = memoOpts + ":" + range2;
46889
+ const cached2 = cache.get(memoKey);
46890
+ if (cached2) {
46891
+ return cached2;
46892
+ }
46893
+ const loose = this.options.loose;
46894
+ const hr = loose ? re2[t.HYPHENRANGELOOSE] : re2[t.HYPHENRANGE];
46895
+ range2 = range2.replace(hr, hyphenReplace(this.options.includePrerelease));
46896
+ debug2("hyphen replace", range2);
46897
+ range2 = range2.replace(re2[t.COMPARATORTRIM], comparatorTrimReplace);
46898
+ debug2("comparator trim", range2);
46899
+ range2 = range2.replace(re2[t.TILDETRIM], tildeTrimReplace);
46900
+ debug2("tilde trim", range2);
46901
+ range2 = range2.replace(re2[t.CARETTRIM], caretTrimReplace);
46902
+ debug2("caret trim", range2);
46903
+ let rangeList = range2.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
46904
+ if (loose) {
46905
+ rangeList = rangeList.filter((comp) => {
46906
+ debug2("loose invalid filter", comp, this.options);
46907
+ return !!comp.match(re2[t.COMPARATORLOOSE]);
46908
+ });
46909
+ }
46910
+ debug2("range list", rangeList);
46911
+ const rangeMap = /* @__PURE__ */ new Map();
46912
+ const comparators = rangeList.map((comp) => new Comparator(comp, this.options));
46913
+ for (const comp of comparators) {
46914
+ if (isNullSet(comp)) {
46915
+ return [comp];
46916
+ }
46917
+ rangeMap.set(comp.value, comp);
46918
+ }
46919
+ if (rangeMap.size > 1 && rangeMap.has("")) {
46920
+ rangeMap.delete("");
46921
+ }
46922
+ const result = [...rangeMap.values()];
46923
+ cache.set(memoKey, result);
46924
+ return result;
46925
+ }
46926
+ intersects(range2, options) {
46927
+ if (!(range2 instanceof _Range)) {
46928
+ throw new TypeError("a Range is required");
46929
+ }
46930
+ return this.set.some((thisComparators) => {
46931
+ return isSatisfiable(thisComparators, options) && range2.set.some((rangeComparators) => {
46932
+ return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
46933
+ return rangeComparators.every((rangeComparator) => {
46934
+ return thisComparator.intersects(rangeComparator, options);
46935
+ });
46936
+ });
46937
+ });
46938
+ });
46939
+ }
46940
+ // if ANY of the sets match ALL of its comparators, then pass
46941
+ test(version4) {
46942
+ if (!version4) {
46943
+ return false;
46944
+ }
46945
+ if (typeof version4 === "string") {
46946
+ try {
46947
+ version4 = new SemVer(version4, this.options);
46948
+ } catch (er) {
46949
+ return false;
46950
+ }
46951
+ }
46952
+ for (let i = 0; i < this.set.length; i++) {
46953
+ if (testSet(this.set[i], version4, this.options)) {
46954
+ return true;
46955
+ }
46956
+ }
46957
+ return false;
46958
+ }
46959
+ };
46960
+ module2.exports = Range;
46961
+ var LRU = require_lrucache();
46962
+ var cache = new LRU();
46963
+ var parseOptions = require_parse_options();
46964
+ var Comparator = require_comparator();
46965
+ var debug2 = require_debug();
46966
+ var SemVer = require_semver();
46967
+ var {
46968
+ safeRe: re2,
46969
+ t,
46970
+ comparatorTrimReplace,
46971
+ tildeTrimReplace,
46972
+ caretTrimReplace
46973
+ } = require_re();
46974
+ var { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants6();
46975
+ var isNullSet = /* @__PURE__ */ __name((c) => c.value === "<0.0.0-0", "isNullSet");
46976
+ var isAny = /* @__PURE__ */ __name((c) => c.value === "", "isAny");
46977
+ var isSatisfiable = /* @__PURE__ */ __name((comparators, options) => {
46978
+ let result = true;
46979
+ const remainingComparators = comparators.slice();
46980
+ let testComparator = remainingComparators.pop();
46981
+ while (result && remainingComparators.length) {
46982
+ result = remainingComparators.every((otherComparator) => {
46983
+ return testComparator.intersects(otherComparator, options);
46984
+ });
46985
+ testComparator = remainingComparators.pop();
46986
+ }
46987
+ return result;
46988
+ }, "isSatisfiable");
46989
+ var parseComparator = /* @__PURE__ */ __name((comp, options) => {
46990
+ comp = comp.replace(re2[t.BUILD], "");
46991
+ debug2("comp", comp, options);
46992
+ comp = replaceCarets(comp, options);
46993
+ debug2("caret", comp);
46994
+ comp = replaceTildes(comp, options);
46995
+ debug2("tildes", comp);
46996
+ comp = replaceXRanges(comp, options);
46997
+ debug2("xrange", comp);
46998
+ comp = replaceStars(comp, options);
46999
+ debug2("stars", comp);
47000
+ return comp;
47001
+ }, "parseComparator");
47002
+ var isX = /* @__PURE__ */ __name((id) => !id || id.toLowerCase() === "x" || id === "*", "isX");
47003
+ var replaceTildes = /* @__PURE__ */ __name((comp, options) => {
47004
+ return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" ");
47005
+ }, "replaceTildes");
47006
+ var replaceTilde = /* @__PURE__ */ __name((comp, options) => {
47007
+ const r = options.loose ? re2[t.TILDELOOSE] : re2[t.TILDE];
47008
+ return comp.replace(r, (_, M, m, p, pr) => {
47009
+ debug2("tilde", comp, _, M, m, p, pr);
47010
+ let ret;
47011
+ if (isX(M)) {
47012
+ ret = "";
47013
+ } else if (isX(m)) {
47014
+ ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
47015
+ } else if (isX(p)) {
47016
+ ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
47017
+ } else if (pr) {
47018
+ debug2("replaceTilde pr", pr);
47019
+ ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
47020
+ } else {
47021
+ ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
47022
+ }
47023
+ debug2("tilde return", ret);
47024
+ return ret;
47025
+ });
47026
+ }, "replaceTilde");
47027
+ var replaceCarets = /* @__PURE__ */ __name((comp, options) => {
47028
+ return comp.trim().split(/\s+/).map((c) => replaceCaret(c, options)).join(" ");
47029
+ }, "replaceCarets");
47030
+ var replaceCaret = /* @__PURE__ */ __name((comp, options) => {
47031
+ debug2("caret", comp, options);
47032
+ const r = options.loose ? re2[t.CARETLOOSE] : re2[t.CARET];
47033
+ const z2 = options.includePrerelease ? "-0" : "";
47034
+ return comp.replace(r, (_, M, m, p, pr) => {
47035
+ debug2("caret", comp, _, M, m, p, pr);
47036
+ let ret;
47037
+ if (isX(M)) {
47038
+ ret = "";
47039
+ } else if (isX(m)) {
47040
+ ret = `>=${M}.0.0${z2} <${+M + 1}.0.0-0`;
47041
+ } else if (isX(p)) {
47042
+ if (M === "0") {
47043
+ ret = `>=${M}.${m}.0${z2} <${M}.${+m + 1}.0-0`;
47044
+ } else {
47045
+ ret = `>=${M}.${m}.0${z2} <${+M + 1}.0.0-0`;
47046
+ }
47047
+ } else if (pr) {
47048
+ debug2("replaceCaret pr", pr);
47049
+ if (M === "0") {
47050
+ if (m === "0") {
47051
+ ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
47052
+ } else {
47053
+ ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
47054
+ }
47055
+ } else {
47056
+ ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
47057
+ }
47058
+ } else {
47059
+ debug2("no pr");
47060
+ if (M === "0") {
47061
+ if (m === "0") {
47062
+ ret = `>=${M}.${m}.${p}${z2} <${M}.${m}.${+p + 1}-0`;
47063
+ } else {
47064
+ ret = `>=${M}.${m}.${p}${z2} <${M}.${+m + 1}.0-0`;
47065
+ }
47066
+ } else {
47067
+ ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
47068
+ }
47069
+ }
47070
+ debug2("caret return", ret);
47071
+ return ret;
47072
+ });
47073
+ }, "replaceCaret");
47074
+ var replaceXRanges = /* @__PURE__ */ __name((comp, options) => {
47075
+ debug2("replaceXRanges", comp, options);
47076
+ return comp.split(/\s+/).map((c) => replaceXRange(c, options)).join(" ");
47077
+ }, "replaceXRanges");
47078
+ var replaceXRange = /* @__PURE__ */ __name((comp, options) => {
47079
+ comp = comp.trim();
47080
+ const r = options.loose ? re2[t.XRANGELOOSE] : re2[t.XRANGE];
47081
+ return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
47082
+ debug2("xRange", comp, ret, gtlt, M, m, p, pr);
47083
+ const xM = isX(M);
47084
+ const xm = xM || isX(m);
47085
+ const xp = xm || isX(p);
47086
+ const anyX = xp;
47087
+ if (gtlt === "=" && anyX) {
47088
+ gtlt = "";
47089
+ }
47090
+ pr = options.includePrerelease ? "-0" : "";
47091
+ if (xM) {
47092
+ if (gtlt === ">" || gtlt === "<") {
47093
+ ret = "<0.0.0-0";
47094
+ } else {
47095
+ ret = "*";
47096
+ }
47097
+ } else if (gtlt && anyX) {
47098
+ if (xm) {
47099
+ m = 0;
47100
+ }
47101
+ p = 0;
47102
+ if (gtlt === ">") {
47103
+ gtlt = ">=";
47104
+ if (xm) {
47105
+ M = +M + 1;
47106
+ m = 0;
47107
+ p = 0;
47108
+ } else {
47109
+ m = +m + 1;
47110
+ p = 0;
47111
+ }
47112
+ } else if (gtlt === "<=") {
47113
+ gtlt = "<";
47114
+ if (xm) {
47115
+ M = +M + 1;
47116
+ } else {
47117
+ m = +m + 1;
47118
+ }
47119
+ }
47120
+ if (gtlt === "<") {
47121
+ pr = "-0";
47122
+ }
47123
+ ret = `${gtlt + M}.${m}.${p}${pr}`;
47124
+ } else if (xm) {
47125
+ ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
47126
+ } else if (xp) {
47127
+ ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`;
47128
+ }
47129
+ debug2("xRange return", ret);
47130
+ return ret;
47131
+ });
47132
+ }, "replaceXRange");
47133
+ var replaceStars = /* @__PURE__ */ __name((comp, options) => {
47134
+ debug2("replaceStars", comp, options);
47135
+ return comp.trim().replace(re2[t.STAR], "");
47136
+ }, "replaceStars");
47137
+ var replaceGTE0 = /* @__PURE__ */ __name((comp, options) => {
47138
+ debug2("replaceGTE0", comp, options);
47139
+ return comp.trim().replace(re2[options.includePrerelease ? t.GTE0PRE : t.GTE0], "");
47140
+ }, "replaceGTE0");
47141
+ var hyphenReplace = /* @__PURE__ */ __name((incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
47142
+ if (isX(fM)) {
47143
+ from = "";
47144
+ } else if (isX(fm)) {
47145
+ from = `>=${fM}.0.0${incPr ? "-0" : ""}`;
47146
+ } else if (isX(fp)) {
47147
+ from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`;
47148
+ } else if (fpr) {
47149
+ from = `>=${from}`;
47150
+ } else {
47151
+ from = `>=${from}${incPr ? "-0" : ""}`;
47152
+ }
47153
+ if (isX(tM)) {
47154
+ to = "";
47155
+ } else if (isX(tm)) {
47156
+ to = `<${+tM + 1}.0.0-0`;
47157
+ } else if (isX(tp)) {
47158
+ to = `<${tM}.${+tm + 1}.0-0`;
47159
+ } else if (tpr) {
47160
+ to = `<=${tM}.${tm}.${tp}-${tpr}`;
47161
+ } else if (incPr) {
47162
+ to = `<${tM}.${tm}.${+tp + 1}-0`;
47163
+ } else {
47164
+ to = `<=${to}`;
47165
+ }
47166
+ return `${from} ${to}`.trim();
47167
+ }, "hyphenReplace");
47168
+ var testSet = /* @__PURE__ */ __name((set2, version4, options) => {
47169
+ for (let i = 0; i < set2.length; i++) {
47170
+ if (!set2[i].test(version4)) {
47171
+ return false;
47172
+ }
47173
+ }
47174
+ if (version4.prerelease.length && !options.includePrerelease) {
47175
+ for (let i = 0; i < set2.length; i++) {
47176
+ debug2(set2[i].semver);
47177
+ if (set2[i].semver === Comparator.ANY) {
47178
+ continue;
47179
+ }
47180
+ if (set2[i].semver.prerelease.length > 0) {
47181
+ const allowed = set2[i].semver;
47182
+ if (allowed.major === version4.major && allowed.minor === version4.minor && allowed.patch === version4.patch) {
47183
+ return true;
47184
+ }
47185
+ }
47186
+ }
47187
+ return false;
47188
+ }
47189
+ return true;
47190
+ }, "testSet");
47191
+ }
47192
+ });
47193
+
47194
+ // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/classes/comparator.js
47195
+ var require_comparator = __commonJS({
47196
+ "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/classes/comparator.js"(exports2, module2) {
47197
+ "use strict";
47198
+ var ANY = /* @__PURE__ */ Symbol("SemVer ANY");
47199
+ var Comparator = class _Comparator {
47200
+ static {
47201
+ __name(this, "Comparator");
47202
+ }
47203
+ static get ANY() {
47204
+ return ANY;
47205
+ }
47206
+ constructor(comp, options) {
47207
+ options = parseOptions(options);
47208
+ if (comp instanceof _Comparator) {
47209
+ if (comp.loose === !!options.loose) {
47210
+ return comp;
47211
+ } else {
47212
+ comp = comp.value;
47213
+ }
47214
+ }
47215
+ comp = comp.trim().split(/\s+/).join(" ");
47216
+ debug2("comparator", comp, options);
47217
+ this.options = options;
47218
+ this.loose = !!options.loose;
47219
+ this.parse(comp);
47220
+ if (this.semver === ANY) {
47221
+ this.value = "";
47222
+ } else {
47223
+ this.value = this.operator + this.semver.version;
47224
+ }
47225
+ debug2("comp", this);
47226
+ }
47227
+ parse(comp) {
47228
+ const r = this.options.loose ? re2[t.COMPARATORLOOSE] : re2[t.COMPARATOR];
47229
+ const m = comp.match(r);
47230
+ if (!m) {
47231
+ throw new TypeError(`Invalid comparator: ${comp}`);
47232
+ }
47233
+ this.operator = m[1] !== void 0 ? m[1] : "";
47234
+ if (this.operator === "=") {
47235
+ this.operator = "";
47236
+ }
47237
+ if (!m[2]) {
47238
+ this.semver = ANY;
47239
+ } else {
47240
+ this.semver = new SemVer(m[2], this.options.loose);
47241
+ }
47242
+ }
47243
+ toString() {
47244
+ return this.value;
47245
+ }
47246
+ test(version4) {
47247
+ debug2("Comparator.test", version4, this.options.loose);
47248
+ if (this.semver === ANY || version4 === ANY) {
47249
+ return true;
47250
+ }
47251
+ if (typeof version4 === "string") {
47252
+ try {
47253
+ version4 = new SemVer(version4, this.options);
47254
+ } catch (er) {
47255
+ return false;
47256
+ }
47257
+ }
47258
+ return cmp(version4, this.operator, this.semver, this.options);
47259
+ }
47260
+ intersects(comp, options) {
47261
+ if (!(comp instanceof _Comparator)) {
47262
+ throw new TypeError("a Comparator is required");
47263
+ }
47264
+ if (this.operator === "") {
47265
+ if (this.value === "") {
47266
+ return true;
47267
+ }
47268
+ return new Range(comp.value, options).test(this.value);
47269
+ } else if (comp.operator === "") {
47270
+ if (comp.value === "") {
47271
+ return true;
47272
+ }
47273
+ return new Range(this.value, options).test(comp.semver);
47274
+ }
47275
+ options = parseOptions(options);
47276
+ if (options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) {
47277
+ return false;
47278
+ }
47279
+ if (!options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) {
47280
+ return false;
47281
+ }
47282
+ if (this.operator.startsWith(">") && comp.operator.startsWith(">")) {
47283
+ return true;
47284
+ }
47285
+ if (this.operator.startsWith("<") && comp.operator.startsWith("<")) {
47286
+ return true;
47287
+ }
47288
+ if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) {
47289
+ return true;
47290
+ }
47291
+ if (cmp(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<")) {
47292
+ return true;
47293
+ }
47294
+ if (cmp(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")) {
47295
+ return true;
47296
+ }
47297
+ return false;
47298
+ }
47299
+ };
47300
+ module2.exports = Comparator;
47301
+ var parseOptions = require_parse_options();
47302
+ var { safeRe: re2, t } = require_re();
47303
+ var cmp = require_cmp();
47304
+ var debug2 = require_debug();
47305
+ var SemVer = require_semver();
47306
+ var Range = require_range();
47307
+ }
47308
+ });
47309
+
47310
+ // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/satisfies.js
47311
+ var require_satisfies = __commonJS({
47312
+ "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/satisfies.js"(exports2, module2) {
47313
+ "use strict";
47314
+ var Range = require_range();
47315
+ var satisfies = /* @__PURE__ */ __name((version4, range2, options) => {
47316
+ try {
47317
+ range2 = new Range(range2, options);
47318
+ } catch (er) {
47319
+ return false;
47320
+ }
47321
+ return range2.test(version4);
47322
+ }, "satisfies");
47323
+ module2.exports = satisfies;
47324
+ }
47325
+ });
47326
+
47327
+ // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/to-comparators.js
47328
+ var require_to_comparators = __commonJS({
47329
+ "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/to-comparators.js"(exports2, module2) {
47330
+ "use strict";
47331
+ var Range = require_range();
47332
+ var toComparators = /* @__PURE__ */ __name((range2, options) => new Range(range2, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" ")), "toComparators");
47333
+ module2.exports = toComparators;
47334
+ }
47335
+ });
47336
+
47337
+ // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/max-satisfying.js
47338
+ var require_max_satisfying = __commonJS({
47339
+ "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/max-satisfying.js"(exports2, module2) {
47340
+ "use strict";
47341
+ var SemVer = require_semver();
47342
+ var Range = require_range();
47343
+ var maxSatisfying = /* @__PURE__ */ __name((versions, range2, options) => {
47344
+ let max = null;
47345
+ let maxSV = null;
47346
+ let rangeObj = null;
47347
+ try {
47348
+ rangeObj = new Range(range2, options);
47349
+ } catch (er) {
47350
+ return null;
47351
+ }
47352
+ versions.forEach((v) => {
47353
+ if (rangeObj.test(v)) {
47354
+ if (!max || maxSV.compare(v) === -1) {
47355
+ max = v;
47356
+ maxSV = new SemVer(max, options);
47357
+ }
47358
+ }
47359
+ });
47360
+ return max;
47361
+ }, "maxSatisfying");
47362
+ module2.exports = maxSatisfying;
47363
+ }
47364
+ });
47365
+
47366
+ // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/min-satisfying.js
47367
+ var require_min_satisfying = __commonJS({
47368
+ "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/min-satisfying.js"(exports2, module2) {
47369
+ "use strict";
47370
+ var SemVer = require_semver();
47371
+ var Range = require_range();
47372
+ var minSatisfying = /* @__PURE__ */ __name((versions, range2, options) => {
47373
+ let min = null;
47374
+ let minSV = null;
47375
+ let rangeObj = null;
47376
+ try {
47377
+ rangeObj = new Range(range2, options);
47378
+ } catch (er) {
47379
+ return null;
47380
+ }
47381
+ versions.forEach((v) => {
47382
+ if (rangeObj.test(v)) {
47383
+ if (!min || minSV.compare(v) === 1) {
47384
+ min = v;
47385
+ minSV = new SemVer(min, options);
47386
+ }
47387
+ }
47388
+ });
47389
+ return min;
47390
+ }, "minSatisfying");
47391
+ module2.exports = minSatisfying;
47392
+ }
47393
+ });
47394
+
47395
+ // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/min-version.js
47396
+ var require_min_version = __commonJS({
47397
+ "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/min-version.js"(exports2, module2) {
47398
+ "use strict";
47399
+ var SemVer = require_semver();
47400
+ var Range = require_range();
47401
+ var gt = require_gt();
47402
+ var minVersion = /* @__PURE__ */ __name((range2, loose) => {
47403
+ range2 = new Range(range2, loose);
47404
+ let minver = new SemVer("0.0.0");
47405
+ if (range2.test(minver)) {
47406
+ return minver;
47407
+ }
47408
+ minver = new SemVer("0.0.0-0");
47409
+ if (range2.test(minver)) {
47410
+ return minver;
47411
+ }
47412
+ minver = null;
47413
+ for (let i = 0; i < range2.set.length; ++i) {
47414
+ const comparators = range2.set[i];
47415
+ let setMin = null;
47416
+ comparators.forEach((comparator) => {
47417
+ const compver = new SemVer(comparator.semver.version);
47418
+ switch (comparator.operator) {
47419
+ case ">":
47420
+ if (compver.prerelease.length === 0) {
47421
+ compver.patch++;
47422
+ } else {
47423
+ compver.prerelease.push(0);
47424
+ }
47425
+ compver.raw = compver.format();
47426
+ /* fallthrough */
47427
+ case "":
47428
+ case ">=":
47429
+ if (!setMin || gt(compver, setMin)) {
47430
+ setMin = compver;
47431
+ }
47432
+ break;
47433
+ case "<":
47434
+ case "<=":
47435
+ break;
47436
+ /* istanbul ignore next */
47437
+ default:
47438
+ throw new Error(`Unexpected operation: ${comparator.operator}`);
47439
+ }
47440
+ });
47441
+ if (setMin && (!minver || gt(minver, setMin))) {
47442
+ minver = setMin;
47443
+ }
47444
+ }
47445
+ if (minver && range2.test(minver)) {
47446
+ return minver;
47447
+ }
47448
+ return null;
47449
+ }, "minVersion");
47450
+ module2.exports = minVersion;
47451
+ }
47452
+ });
47453
+
47454
+ // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/valid.js
47455
+ var require_valid2 = __commonJS({
47456
+ "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/valid.js"(exports2, module2) {
47457
+ "use strict";
47458
+ var Range = require_range();
47459
+ var validRange = /* @__PURE__ */ __name((range2, options) => {
47460
+ try {
47461
+ return new Range(range2, options).range || "*";
47462
+ } catch (er) {
47463
+ return null;
47464
+ }
47465
+ }, "validRange");
47466
+ module2.exports = validRange;
47467
+ }
47468
+ });
47469
+
47470
+ // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/outside.js
47471
+ var require_outside = __commonJS({
47472
+ "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/outside.js"(exports2, module2) {
47473
+ "use strict";
47474
+ var SemVer = require_semver();
47475
+ var Comparator = require_comparator();
47476
+ var { ANY } = Comparator;
47477
+ var Range = require_range();
47478
+ var satisfies = require_satisfies();
47479
+ var gt = require_gt();
47480
+ var lt = require_lt();
47481
+ var lte2 = require_lte();
47482
+ var gte2 = require_gte();
47483
+ var outside = /* @__PURE__ */ __name((version4, range2, hilo, options) => {
47484
+ version4 = new SemVer(version4, options);
47485
+ range2 = new Range(range2, options);
47486
+ let gtfn, ltefn, ltfn, comp, ecomp;
47487
+ switch (hilo) {
47488
+ case ">":
47489
+ gtfn = gt;
47490
+ ltefn = lte2;
47491
+ ltfn = lt;
47492
+ comp = ">";
47493
+ ecomp = ">=";
47494
+ break;
47495
+ case "<":
47496
+ gtfn = lt;
47497
+ ltefn = gte2;
47498
+ ltfn = gt;
47499
+ comp = "<";
47500
+ ecomp = "<=";
47501
+ break;
47502
+ default:
47503
+ throw new TypeError('Must provide a hilo val of "<" or ">"');
47504
+ }
47505
+ if (satisfies(version4, range2, options)) {
47506
+ return false;
47507
+ }
47508
+ for (let i = 0; i < range2.set.length; ++i) {
47509
+ const comparators = range2.set[i];
47510
+ let high = null;
47511
+ let low = null;
47512
+ comparators.forEach((comparator) => {
47513
+ if (comparator.semver === ANY) {
47514
+ comparator = new Comparator(">=0.0.0");
47515
+ }
47516
+ high = high || comparator;
47517
+ low = low || comparator;
47518
+ if (gtfn(comparator.semver, high.semver, options)) {
47519
+ high = comparator;
47520
+ } else if (ltfn(comparator.semver, low.semver, options)) {
47521
+ low = comparator;
47522
+ }
47523
+ });
47524
+ if (high.operator === comp || high.operator === ecomp) {
47525
+ return false;
47526
+ }
47527
+ if ((!low.operator || low.operator === comp) && ltefn(version4, low.semver)) {
47528
+ return false;
47529
+ } else if (low.operator === ecomp && ltfn(version4, low.semver)) {
47530
+ return false;
47531
+ }
47532
+ }
47533
+ return true;
47534
+ }, "outside");
47535
+ module2.exports = outside;
47536
+ }
47537
+ });
47538
+
47539
+ // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/gtr.js
47540
+ var require_gtr = __commonJS({
47541
+ "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/gtr.js"(exports2, module2) {
47542
+ "use strict";
47543
+ var outside = require_outside();
47544
+ var gtr = /* @__PURE__ */ __name((version4, range2, options) => outside(version4, range2, ">", options), "gtr");
47545
+ module2.exports = gtr;
47546
+ }
47547
+ });
47548
+
47549
+ // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/ltr.js
47550
+ var require_ltr = __commonJS({
47551
+ "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/ltr.js"(exports2, module2) {
47552
+ "use strict";
47553
+ var outside = require_outside();
47554
+ var ltr = /* @__PURE__ */ __name((version4, range2, options) => outside(version4, range2, "<", options), "ltr");
47555
+ module2.exports = ltr;
47556
+ }
47557
+ });
47558
+
47559
+ // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/intersects.js
47560
+ var require_intersects = __commonJS({
47561
+ "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/intersects.js"(exports2, module2) {
47562
+ "use strict";
47563
+ var Range = require_range();
47564
+ var intersects = /* @__PURE__ */ __name((r1, r2, options) => {
47565
+ r1 = new Range(r1, options);
47566
+ r2 = new Range(r2, options);
47567
+ return r1.intersects(r2, options);
47568
+ }, "intersects");
47569
+ module2.exports = intersects;
47570
+ }
47571
+ });
47572
+
47573
+ // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/simplify.js
47574
+ var require_simplify = __commonJS({
47575
+ "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/simplify.js"(exports2, module2) {
47576
+ "use strict";
47577
+ var satisfies = require_satisfies();
47578
+ var compare = require_compare();
47579
+ module2.exports = (versions, range2, options) => {
47580
+ const set2 = [];
47581
+ let first = null;
47582
+ let prev = null;
47583
+ const v = versions.sort((a, b) => compare(a, b, options));
47584
+ for (const version4 of v) {
47585
+ const included = satisfies(version4, range2, options);
47586
+ if (included) {
47587
+ prev = version4;
47588
+ if (!first) {
47589
+ first = version4;
47590
+ }
47591
+ } else {
47592
+ if (prev) {
47593
+ set2.push([first, prev]);
47594
+ }
47595
+ prev = null;
47596
+ first = null;
47597
+ }
47598
+ }
47599
+ if (first) {
47600
+ set2.push([first, null]);
47601
+ }
47602
+ const ranges = [];
47603
+ for (const [min, max] of set2) {
47604
+ if (min === max) {
47605
+ ranges.push(min);
47606
+ } else if (!max && min === v[0]) {
47607
+ ranges.push("*");
47608
+ } else if (!max) {
47609
+ ranges.push(`>=${min}`);
47610
+ } else if (min === v[0]) {
47611
+ ranges.push(`<=${max}`);
47612
+ } else {
47613
+ ranges.push(`${min} - ${max}`);
47614
+ }
47615
+ }
47616
+ const simplified = ranges.join(" || ");
47617
+ const original = typeof range2.raw === "string" ? range2.raw : String(range2);
47618
+ return simplified.length < original.length ? simplified : range2;
47619
+ };
47620
+ }
47621
+ });
47622
+
47623
+ // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/subset.js
47624
+ var require_subset = __commonJS({
47625
+ "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/subset.js"(exports2, module2) {
47626
+ "use strict";
47627
+ var Range = require_range();
47628
+ var Comparator = require_comparator();
47629
+ var { ANY } = Comparator;
47630
+ var satisfies = require_satisfies();
47631
+ var compare = require_compare();
47632
+ var subset = /* @__PURE__ */ __name((sub, dom, options = {}) => {
47633
+ if (sub === dom) {
47634
+ return true;
47635
+ }
47636
+ sub = new Range(sub, options);
47637
+ dom = new Range(dom, options);
47638
+ let sawNonNull = false;
47639
+ OUTER: for (const simpleSub of sub.set) {
47640
+ for (const simpleDom of dom.set) {
47641
+ const isSub = simpleSubset(simpleSub, simpleDom, options);
47642
+ sawNonNull = sawNonNull || isSub !== null;
47643
+ if (isSub) {
47644
+ continue OUTER;
47645
+ }
47646
+ }
47647
+ if (sawNonNull) {
47648
+ return false;
47649
+ }
47650
+ }
47651
+ return true;
47652
+ }, "subset");
47653
+ var minimumVersionWithPreRelease = [new Comparator(">=0.0.0-0")];
47654
+ var minimumVersion = [new Comparator(">=0.0.0")];
47655
+ var simpleSubset = /* @__PURE__ */ __name((sub, dom, options) => {
47656
+ if (sub === dom) {
47657
+ return true;
47658
+ }
47659
+ if (sub.length === 1 && sub[0].semver === ANY) {
47660
+ if (dom.length === 1 && dom[0].semver === ANY) {
47661
+ return true;
47662
+ } else if (options.includePrerelease) {
47663
+ sub = minimumVersionWithPreRelease;
47664
+ } else {
47665
+ sub = minimumVersion;
47666
+ }
47667
+ }
47668
+ if (dom.length === 1 && dom[0].semver === ANY) {
47669
+ if (options.includePrerelease) {
47670
+ return true;
47671
+ } else {
47672
+ dom = minimumVersion;
47673
+ }
47674
+ }
47675
+ const eqSet = /* @__PURE__ */ new Set();
47676
+ let gt, lt;
47677
+ for (const c of sub) {
47678
+ if (c.operator === ">" || c.operator === ">=") {
47679
+ gt = higherGT(gt, c, options);
47680
+ } else if (c.operator === "<" || c.operator === "<=") {
47681
+ lt = lowerLT(lt, c, options);
47682
+ } else {
47683
+ eqSet.add(c.semver);
47684
+ }
47685
+ }
47686
+ if (eqSet.size > 1) {
47687
+ return null;
47688
+ }
47689
+ let gtltComp;
47690
+ if (gt && lt) {
47691
+ gtltComp = compare(gt.semver, lt.semver, options);
47692
+ if (gtltComp > 0) {
47693
+ return null;
47694
+ } else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) {
47695
+ return null;
47696
+ }
47697
+ }
47698
+ for (const eq of eqSet) {
47699
+ if (gt && !satisfies(eq, String(gt), options)) {
47700
+ return null;
47701
+ }
47702
+ if (lt && !satisfies(eq, String(lt), options)) {
47703
+ return null;
47704
+ }
47705
+ for (const c of dom) {
47706
+ if (!satisfies(eq, String(c), options)) {
47707
+ return false;
47708
+ }
47709
+ }
47710
+ return true;
47711
+ }
47712
+ let higher, lower;
47713
+ let hasDomLT, hasDomGT;
47714
+ let needDomLTPre = lt && !options.includePrerelease && lt.semver.prerelease.length ? lt.semver : false;
47715
+ let needDomGTPre = gt && !options.includePrerelease && gt.semver.prerelease.length ? gt.semver : false;
47716
+ if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === "<" && needDomLTPre.prerelease[0] === 0) {
47717
+ needDomLTPre = false;
47718
+ }
47719
+ for (const c of dom) {
47720
+ hasDomGT = hasDomGT || c.operator === ">" || c.operator === ">=";
47721
+ hasDomLT = hasDomLT || c.operator === "<" || c.operator === "<=";
47722
+ if (gt) {
47723
+ if (needDomGTPre) {
47724
+ if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomGTPre.major && c.semver.minor === needDomGTPre.minor && c.semver.patch === needDomGTPre.patch) {
47725
+ needDomGTPre = false;
47726
+ }
47727
+ }
47728
+ if (c.operator === ">" || c.operator === ">=") {
47729
+ higher = higherGT(gt, c, options);
47730
+ if (higher === c && higher !== gt) {
47731
+ return false;
47732
+ }
47733
+ } else if (gt.operator === ">=" && !satisfies(gt.semver, String(c), options)) {
47734
+ return false;
47735
+ }
47736
+ }
47737
+ if (lt) {
47738
+ if (needDomLTPre) {
47739
+ if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomLTPre.major && c.semver.minor === needDomLTPre.minor && c.semver.patch === needDomLTPre.patch) {
47740
+ needDomLTPre = false;
47741
+ }
47742
+ }
47743
+ if (c.operator === "<" || c.operator === "<=") {
47744
+ lower = lowerLT(lt, c, options);
47745
+ if (lower === c && lower !== lt) {
47746
+ return false;
47747
+ }
47748
+ } else if (lt.operator === "<=" && !satisfies(lt.semver, String(c), options)) {
47749
+ return false;
47750
+ }
47751
+ }
47752
+ if (!c.operator && (lt || gt) && gtltComp !== 0) {
47753
+ return false;
47754
+ }
47755
+ }
47756
+ if (gt && hasDomLT && !lt && gtltComp !== 0) {
47757
+ return false;
47758
+ }
47759
+ if (lt && hasDomGT && !gt && gtltComp !== 0) {
47760
+ return false;
47761
+ }
47762
+ if (needDomGTPre || needDomLTPre) {
47763
+ return false;
47764
+ }
47765
+ return true;
47766
+ }, "simpleSubset");
47767
+ var higherGT = /* @__PURE__ */ __name((a, b, options) => {
47768
+ if (!a) {
47769
+ return b;
47770
+ }
47771
+ const comp = compare(a.semver, b.semver, options);
47772
+ return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a;
47773
+ }, "higherGT");
47774
+ var lowerLT = /* @__PURE__ */ __name((a, b, options) => {
47775
+ if (!a) {
47776
+ return b;
47777
+ }
47778
+ const comp = compare(a.semver, b.semver, options);
47779
+ return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a;
47780
+ }, "lowerLT");
47781
+ module2.exports = subset;
47782
+ }
47783
+ });
47784
+
47785
+ // ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/index.js
47786
+ var require_semver2 = __commonJS({
47787
+ "../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/index.js"(exports2, module2) {
47788
+ "use strict";
47789
+ var internalRe = require_re();
47790
+ var constants2 = require_constants6();
47791
+ var SemVer = require_semver();
47792
+ var identifiers = require_identifiers();
47793
+ var parse5 = require_parse2();
47794
+ var valid = require_valid();
47795
+ var clean = require_clean();
47796
+ var inc = require_inc();
47797
+ var diff = require_diff();
47798
+ var major2 = require_major();
47799
+ var minor = require_minor();
47800
+ var patch = require_patch();
47801
+ var prerelease = require_prerelease();
47802
+ var compare = require_compare();
47803
+ var rcompare = require_rcompare();
47804
+ var compareLoose = require_compare_loose();
47805
+ var compareBuild = require_compare_build();
47806
+ var sort2 = require_sort();
47807
+ var rsort = require_rsort();
47808
+ var gt = require_gt();
47809
+ var lt = require_lt();
47810
+ var eq = require_eq();
47811
+ var neq = require_neq();
47812
+ var gte2 = require_gte();
47813
+ var lte2 = require_lte();
47814
+ var cmp = require_cmp();
47815
+ var coerce = require_coerce();
47816
+ var Comparator = require_comparator();
47817
+ var Range = require_range();
47818
+ var satisfies = require_satisfies();
47819
+ var toComparators = require_to_comparators();
47820
+ var maxSatisfying = require_max_satisfying();
47821
+ var minSatisfying = require_min_satisfying();
47822
+ var minVersion = require_min_version();
47823
+ var validRange = require_valid2();
47824
+ var outside = require_outside();
47825
+ var gtr = require_gtr();
47826
+ var ltr = require_ltr();
47827
+ var intersects = require_intersects();
47828
+ var simplifyRange = require_simplify();
47829
+ var subset = require_subset();
47830
+ module2.exports = {
47831
+ parse: parse5,
47832
+ valid,
47833
+ clean,
47834
+ inc,
47835
+ diff,
47836
+ major: major2,
47837
+ minor,
47838
+ patch,
47839
+ prerelease,
47840
+ compare,
47841
+ rcompare,
47842
+ compareLoose,
47843
+ compareBuild,
47844
+ sort: sort2,
47845
+ rsort,
47846
+ gt,
47847
+ lt,
47848
+ eq,
47849
+ neq,
47850
+ gte: gte2,
47851
+ lte: lte2,
47852
+ cmp,
47853
+ coerce,
47854
+ Comparator,
47855
+ Range,
47856
+ satisfies,
47857
+ toComparators,
47858
+ maxSatisfying,
47859
+ minSatisfying,
47860
+ minVersion,
47861
+ validRange,
47862
+ outside,
47863
+ gtr,
47864
+ ltr,
47865
+ intersects,
47866
+ simplifyRange,
47867
+ subset,
47868
+ SemVer,
47869
+ re: internalRe.re,
47870
+ src: internalRe.src,
47871
+ tokens: internalRe.t,
47872
+ SEMVER_SPEC_VERSION: constants2.SEMVER_SPEC_VERSION,
47873
+ RELEASE_TYPES: constants2.RELEASE_TYPES,
47874
+ compareIdentifiers: identifiers.compareIdentifiers,
47875
+ rcompareIdentifiers: identifiers.rcompareIdentifiers
47876
+ };
47877
+ }
47878
+ });
47879
+
45900
47880
  // virtual-entry.js
45901
47881
  var virtual_entry_exports = {};
45902
47882
  __export(virtual_entry_exports, {
@@ -46009,7 +47989,9 @@ var RUN_ERROR_CODES = {
46009
47989
  /** Internal runtime error (corrupted event log, missing timestamps) */
46010
47990
  RUNTIME_ERROR: "RUNTIME_ERROR",
46011
47991
  /** Run exceeded the maximum number of queue deliveries */
46012
- MAX_DELIVERIES_EXCEEDED: "MAX_DELIVERIES_EXCEEDED"
47992
+ MAX_DELIVERIES_EXCEEDED: "MAX_DELIVERIES_EXCEEDED",
47993
+ /** Workflow replay exceeded the maximum allowed duration */
47994
+ REPLAY_TIMEOUT: "REPLAY_TIMEOUT"
46013
47995
  };
46014
47996
 
46015
47997
  // ../errors/dist/index.js
@@ -46261,6 +48243,9 @@ var RetryableError = class extends Error {
46261
48243
  }
46262
48244
  };
46263
48245
 
48246
+ // ../core/dist/runtime.js
48247
+ init_dist();
48248
+
46264
48249
  // ../core/dist/classify-error.js
46265
48250
  function classifyRunError(err) {
46266
48251
  if (err instanceof WorkflowRuntimeError) {
@@ -46270,12 +48255,6 @@ function classifyRunError(err) {
46270
48255
  }
46271
48256
  __name(classifyRunError, "classifyRunError");
46272
48257
 
46273
- // ../core/dist/runtime/constants.js
46274
- var MAX_QUEUE_DELIVERIES = 48;
46275
-
46276
- // ../core/dist/runtime.js
46277
- init_dist();
46278
-
46279
48258
  // ../core/dist/encryption.js
46280
48259
  var NONCE_LENGTH = 12;
46281
48260
  var TAG_LENGTH = 128;
@@ -46614,6 +48593,10 @@ var webhookLogger = createLogger("webhook");
46614
48593
  var eventsLogger = createLogger("events");
46615
48594
  var adapterLogger = createLogger("adapter");
46616
48595
 
48596
+ // ../core/dist/runtime/constants.js
48597
+ var MAX_QUEUE_DELIVERIES = 48;
48598
+ var REPLAY_TIMEOUT_MS = 24e4;
48599
+
46617
48600
  // ../core/dist/runtime/helpers.js
46618
48601
  init_dist();
46619
48602
  init_node();
@@ -46626,6 +48609,7 @@ var import_node_path10 = require("node:path");
46626
48609
  var import_node_fs2 = require("node:fs");
46627
48610
  var import_promises5 = require("node:fs/promises");
46628
48611
  var import_node_path9 = __toESM(require("node:path"), 1);
48612
+ init_dist();
46629
48613
 
46630
48614
  // ../utils/dist/get-port.js
46631
48615
  var import_node_child_process = require("node:child_process");
@@ -47360,6 +49344,112 @@ async function initDataDir(dataDir) {
47360
49344
  }
47361
49345
  __name(initDataDir, "initDataDir");
47362
49346
 
49347
+ // ../world-local/dist/telemetry.js
49348
+ var otelApiPromise = null;
49349
+ async function getOtelApi() {
49350
+ if (!otelApiPromise) {
49351
+ otelApiPromise = Promise.resolve().then(() => (init_esm(), esm_exports)).catch(() => null);
49352
+ }
49353
+ return otelApiPromise;
49354
+ }
49355
+ __name(getOtelApi, "getOtelApi");
49356
+ var tracerPromise = null;
49357
+ async function getTracer() {
49358
+ if (!tracerPromise) {
49359
+ tracerPromise = getOtelApi().then((otel) => otel ? otel.trace.getTracer("workflow") : null);
49360
+ }
49361
+ return tracerPromise;
49362
+ }
49363
+ __name(getTracer, "getTracer");
49364
+ async function trace3(spanName, ...args) {
49365
+ const [tracer, otel] = await Promise.all([getTracer(), getOtelApi()]);
49366
+ const { fn, opts } = typeof args[0] === "function" ? { fn: args[0], opts: {} } : { fn: args[1], opts: args[0] };
49367
+ if (!fn)
49368
+ throw new Error("Function to trace must be provided");
49369
+ if (!tracer || !otel) {
49370
+ return await fn();
49371
+ }
49372
+ return tracer.startActiveSpan(spanName, opts, async (span) => {
49373
+ try {
49374
+ const result = await fn(span);
49375
+ span.setStatus({ code: otel.SpanStatusCode.OK });
49376
+ return result;
49377
+ } catch (e) {
49378
+ span.setStatus({
49379
+ code: otel.SpanStatusCode.ERROR,
49380
+ message: e.message
49381
+ });
49382
+ throw e;
49383
+ } finally {
49384
+ span.end();
49385
+ }
49386
+ });
49387
+ }
49388
+ __name(trace3, "trace");
49389
+ async function getSpanKind2(field) {
49390
+ const otel = await getOtelApi();
49391
+ if (!otel)
49392
+ return void 0;
49393
+ return otel.SpanKind[field];
49394
+ }
49395
+ __name(getSpanKind2, "getSpanKind");
49396
+ function SemanticConvention2(...names) {
49397
+ return (value) => Object.fromEntries(names.map((name) => [name, value]));
49398
+ }
49399
+ __name(SemanticConvention2, "SemanticConvention");
49400
+ var PeerService2 = SemanticConvention2("peer.service");
49401
+ var RpcSystem2 = SemanticConvention2("rpc.system");
49402
+ var RpcService2 = SemanticConvention2("rpc.service");
49403
+ var RpcMethod2 = SemanticConvention2("rpc.method");
49404
+
49405
+ // ../world-local/dist/instrumentObject.js
49406
+ var WORLD_LOCAL_SERVICE = {
49407
+ peerService: "world-local",
49408
+ rpcSystem: "local",
49409
+ rpcService: "world-local"
49410
+ };
49411
+ function extractEventType(args) {
49412
+ if (args.length >= 2 && typeof args[1] === "object" && args[1] !== null) {
49413
+ const data = args[1];
49414
+ if (typeof data.eventType === "string") {
49415
+ return data.eventType;
49416
+ }
49417
+ }
49418
+ return void 0;
49419
+ }
49420
+ __name(extractEventType, "extractEventType");
49421
+ function instrumentObject(prefix, o) {
49422
+ const handlers = {};
49423
+ for (const key of Object.keys(o)) {
49424
+ if (typeof o[key] !== "function") {
49425
+ handlers[key] = o[key];
49426
+ } else {
49427
+ const f = o[key];
49428
+ const methodName = String(key);
49429
+ handlers[key] = async (...args) => {
49430
+ let spanName = `${prefix}.${methodName}`;
49431
+ if (prefix === "world.events" && methodName === "create") {
49432
+ const eventType = extractEventType(args);
49433
+ if (eventType) {
49434
+ spanName = `${prefix}.${methodName} ${eventType}`;
49435
+ }
49436
+ }
49437
+ return trace3(spanName, { kind: await getSpanKind2("INTERNAL") }, async (span) => {
49438
+ span?.setAttributes({
49439
+ ...PeerService2(WORLD_LOCAL_SERVICE.peerService),
49440
+ ...RpcSystem2(WORLD_LOCAL_SERVICE.rpcSystem),
49441
+ ...RpcService2(WORLD_LOCAL_SERVICE.rpcService),
49442
+ ...RpcMethod2(spanName)
49443
+ });
49444
+ return f(...args);
49445
+ });
49446
+ };
49447
+ }
49448
+ }
49449
+ return handlers;
49450
+ }
49451
+ __name(instrumentObject, "instrumentObject");
49452
+
47363
49453
  // ../world-local/dist/queue.js
47364
49454
  var import_promises3 = require("node:timers/promises");
47365
49455
 
@@ -51992,111 +54082,29 @@ function createQueue(config3) {
51992
54082
  }
51993
54083
  __name(createQueue, "createQueue");
51994
54084
 
51995
- // ../world-local/dist/telemetry.js
51996
- var otelApiPromise = null;
51997
- async function getOtelApi() {
51998
- if (!otelApiPromise) {
51999
- otelApiPromise = Promise.resolve().then(() => (init_esm(), esm_exports)).catch(() => null);
52000
- }
52001
- return otelApiPromise;
52002
- }
52003
- __name(getOtelApi, "getOtelApi");
52004
- var tracerPromise = null;
52005
- async function getTracer() {
52006
- if (!tracerPromise) {
52007
- tracerPromise = getOtelApi().then((otel) => otel ? otel.trace.getTracer("workflow") : null);
52008
- }
52009
- return tracerPromise;
52010
- }
52011
- __name(getTracer, "getTracer");
52012
- async function trace3(spanName, ...args) {
52013
- const [tracer, otel] = await Promise.all([getTracer(), getOtelApi()]);
52014
- const { fn, opts } = typeof args[0] === "function" ? { fn: args[0], opts: {} } : { fn: args[1], opts: args[0] };
52015
- if (!fn)
52016
- throw new Error("Function to trace must be provided");
52017
- if (!tracer || !otel) {
52018
- return await fn();
52019
- }
52020
- return tracer.startActiveSpan(spanName, opts, async (span) => {
52021
- try {
52022
- const result = await fn(span);
52023
- span.setStatus({ code: otel.SpanStatusCode.OK });
52024
- return result;
52025
- } catch (e) {
52026
- span.setStatus({
52027
- code: otel.SpanStatusCode.ERROR,
52028
- message: e.message
52029
- });
52030
- throw e;
52031
- } finally {
52032
- span.end();
52033
- }
52034
- });
52035
- }
52036
- __name(trace3, "trace");
52037
- async function getSpanKind2(field) {
52038
- const otel = await getOtelApi();
52039
- if (!otel)
52040
- return void 0;
52041
- return otel.SpanKind[field];
52042
- }
52043
- __name(getSpanKind2, "getSpanKind");
52044
- function SemanticConvention2(...names) {
52045
- return (value) => Object.fromEntries(names.map((name) => [name, value]));
54085
+ // ../world-local/dist/storage/helpers.js
54086
+ var import_node_crypto2 = require("node:crypto");
54087
+ init_node();
54088
+ function hashToken(token) {
54089
+ return (0, import_node_crypto2.createHash)("sha256").update(token).digest("hex");
52046
54090
  }
52047
- __name(SemanticConvention2, "SemanticConvention");
52048
- var PeerService2 = SemanticConvention2("peer.service");
52049
- var RpcSystem2 = SemanticConvention2("rpc.system");
52050
- var RpcService2 = SemanticConvention2("rpc.service");
52051
- var RpcMethod2 = SemanticConvention2("rpc.method");
52052
-
52053
- // ../world-local/dist/instrumentObject.js
52054
- var WORLD_LOCAL_SERVICE = {
52055
- peerService: "world-local",
52056
- rpcSystem: "local",
52057
- rpcService: "world-local"
52058
- };
52059
- function extractEventType(args) {
52060
- if (args.length >= 2 && typeof args[1] === "object" && args[1] !== null) {
52061
- const data = args[1];
52062
- if (typeof data.eventType === "string") {
52063
- return data.eventType;
52064
- }
54091
+ __name(hashToken, "hashToken");
54092
+ var monotonicUlid = monotonicFactory(() => Math.random());
54093
+ var getObjectCreatedAt = /* @__PURE__ */ __name((idPrefix) => (filename) => {
54094
+ const cleanName = stripTag(filename.replace(/\.json$/, "")) + ".json";
54095
+ const replaceRegex = new RegExp(`^${idPrefix}_`, "g");
54096
+ const dashIndex = cleanName.indexOf("-");
54097
+ if (dashIndex === -1) {
54098
+ const ulid6 = cleanName.replace(/\.json$/, "").replace(replaceRegex, "");
54099
+ return ulidToDate(ulid6);
52065
54100
  }
52066
- return void 0;
52067
- }
52068
- __name(extractEventType, "extractEventType");
52069
- function instrumentObject(prefix, o) {
52070
- const handlers = {};
52071
- for (const key of Object.keys(o)) {
52072
- if (typeof o[key] !== "function") {
52073
- handlers[key] = o[key];
52074
- } else {
52075
- const f = o[key];
52076
- const methodName = String(key);
52077
- handlers[key] = async (...args) => {
52078
- let spanName = `${prefix}.${methodName}`;
52079
- if (prefix === "world.events" && methodName === "create") {
52080
- const eventType = extractEventType(args);
52081
- if (eventType) {
52082
- spanName = `${prefix}.${methodName} ${eventType}`;
52083
- }
52084
- }
52085
- return trace3(spanName, { kind: await getSpanKind2("INTERNAL") }, async (span) => {
52086
- span?.setAttributes({
52087
- ...PeerService2(WORLD_LOCAL_SERVICE.peerService),
52088
- ...RpcSystem2(WORLD_LOCAL_SERVICE.rpcSystem),
52089
- ...RpcService2(WORLD_LOCAL_SERVICE.rpcService),
52090
- ...RpcMethod2(spanName)
52091
- });
52092
- return f(...args);
52093
- });
52094
- };
52095
- }
54101
+ if (idPrefix === "step") {
54102
+ return null;
52096
54103
  }
52097
- return handlers;
52098
- }
52099
- __name(instrumentObject, "instrumentObject");
54104
+ const id = cleanName.substring(dashIndex + 1).replace(/\.json$/, "");
54105
+ const ulid5 = id.replace(replaceRegex, "");
54106
+ return ulidToDate(ulid5);
54107
+ }, "getObjectCreatedAt");
52100
54108
 
52101
54109
  // ../world-local/dist/storage/events-storage.js
52102
54110
  var import_promises4 = __toESM(require("node:fs/promises"), 1);
@@ -52136,30 +54144,6 @@ function filterHookData(hook, resolveData) {
52136
54144
  }
52137
54145
  __name(filterHookData, "filterHookData");
52138
54146
 
52139
- // ../world-local/dist/storage/helpers.js
52140
- var import_node_crypto2 = require("node:crypto");
52141
- init_node();
52142
- function hashToken(token) {
52143
- return (0, import_node_crypto2.createHash)("sha256").update(token).digest("hex");
52144
- }
52145
- __name(hashToken, "hashToken");
52146
- var monotonicUlid = monotonicFactory(() => Math.random());
52147
- var getObjectCreatedAt = /* @__PURE__ */ __name((idPrefix) => (filename) => {
52148
- const cleanName = stripTag(filename.replace(/\.json$/, "")) + ".json";
52149
- const replaceRegex = new RegExp(`^${idPrefix}_`, "g");
52150
- const dashIndex = cleanName.indexOf("-");
52151
- if (dashIndex === -1) {
52152
- const ulid6 = cleanName.replace(/\.json$/, "").replace(replaceRegex, "");
52153
- return ulidToDate(ulid6);
52154
- }
52155
- if (idPrefix === "step") {
52156
- return null;
52157
- }
52158
- const id = cleanName.substring(dashIndex + 1).replace(/\.json$/, "");
52159
- const ulid5 = id.replace(replaceRegex, "");
52160
- return ulidToDate(ulid5);
52161
- }, "getObjectCreatedAt");
52162
-
52163
54147
  // ../world-local/dist/storage/hooks-storage.js
52164
54148
  var import_node_path3 = __toESM(require("node:path"), 1);
52165
54149
  init_dist();
@@ -52363,6 +54347,9 @@ function createEventsStorage(basedir, tag) {
52363
54347
  run: currentRun
52364
54348
  };
52365
54349
  }
54350
+ if (data.eventType === "run_started") {
54351
+ throw new RunExpiredError(`Workflow run "${effectiveRunId}" is already in terminal state "${currentRun.status}"`);
54352
+ }
52366
54353
  if (runTerminalEvents.includes(data.eventType) || data.eventType === "run_cancelled") {
52367
54354
  throw new EntityConflictError(`Cannot transition run from terminal state "${currentRun.status}"`);
52368
54355
  }
@@ -52406,6 +54393,9 @@ function createEventsStorage(basedir, tag) {
52406
54393
  createdAt: now,
52407
54394
  specVersion: effectiveSpecVersion
52408
54395
  };
54396
+ if (data.eventType === "run_started" && "eventData" in event) {
54397
+ delete event.eventData;
54398
+ }
52409
54399
  let run;
52410
54400
  let step;
52411
54401
  let hook;
@@ -52431,6 +54421,9 @@ function createEventsStorage(basedir, tag) {
52431
54421
  await writeJSON(taggedPath(basedir, "runs", effectiveRunId, tag), run);
52432
54422
  } else if (data.eventType === "run_started") {
52433
54423
  if (currentRun) {
54424
+ if (currentRun.status === "running") {
54425
+ return { run: currentRun };
54426
+ }
52434
54427
  run = {
52435
54428
  runId: currentRun.runId,
52436
54429
  deploymentId: currentRun.deploymentId,
@@ -52739,12 +54732,25 @@ function createEventsStorage(basedir, tag) {
52739
54732
  await writeJSON(taggedPath(basedir, "events", compositeKey, tag), event);
52740
54733
  const resolveData = params?.resolveData ?? DEFAULT_RESOLVE_DATA_OPTION;
52741
54734
  const filteredEvent = stripEventDataRefs(event, resolveData);
54735
+ let events;
54736
+ if (data.eventType === "run_started" && run) {
54737
+ const allEvents = await paginatedFileSystemQuery({
54738
+ directory: import_node_path5.default.join(basedir, "events"),
54739
+ schema: EventSchema,
54740
+ filePrefix: `${effectiveRunId}-`,
54741
+ sortOrder: "asc",
54742
+ getCreatedAt: getObjectCreatedAt("evnt"),
54743
+ getId: /* @__PURE__ */ __name((e) => e.eventId, "getId")
54744
+ });
54745
+ events = allEvents.data;
54746
+ }
52742
54747
  return {
52743
54748
  event: filteredEvent,
52744
54749
  run,
52745
54750
  step,
52746
54751
  hook,
52747
- wait
54752
+ wait,
54753
+ events
52748
54754
  };
52749
54755
  },
52750
54756
  async get(runId, eventId, params) {
@@ -53237,12 +55243,14 @@ function createLocalWorld(args) {
53237
55243
  const mergedConfig = { ...config2.value, ...definedArgs };
53238
55244
  const tag = mergedConfig.tag;
53239
55245
  const queue = createQueue(mergedConfig);
55246
+ const storage = createStorage(mergedConfig.dataDir, tag);
53240
55247
  return {
53241
55248
  ...queue,
53242
- ...createStorage(mergedConfig.dataDir, tag),
55249
+ ...storage,
53243
55250
  ...instrumentObject("world.streams", createStreamer(mergedConfig.dataDir, tag)),
53244
55251
  async start() {
53245
55252
  await initDataDir(mergedConfig.dataDir);
55253
+ await reenqueueActiveRuns(storage.runs, queue.queue, "world-local");
53246
55254
  },
53247
55255
  async close() {
53248
55256
  await queue.close();
@@ -55892,7 +57900,7 @@ if (!nativeAccelerationDisabled) {
55892
57900
  }
55893
57901
 
55894
57902
  // ../world-vercel/dist/version.js
55895
- var version2 = "4.1.0-beta.45";
57903
+ var version2 = "4.1.0-beta.46";
55896
57904
 
55897
57905
  // ../world-vercel/dist/utils.js
55898
57906
  var HTTP_DEBUG_ENABLED = typeof process !== "undefined" && typeof process.env.DEBUG === "string" && (process.env.DEBUG.includes("workflow:") || process.env.DEBUG === "*");
@@ -61407,6 +63415,18 @@ __name(runWorkflow, "runWorkflow");
61407
63415
  var import_functions3 = __toESM(require_functions(), 1);
61408
63416
  init_dist();
61409
63417
 
63418
+ // ../core/dist/capabilities.js
63419
+ var import_semver2 = __toESM(require_semver2(), 1);
63420
+ var FORMAT_VERSION_TABLE = [
63421
+ { format: SerializationFormat.ENCRYPTED, minVersion: "4.2.0-beta.64" }
63422
+ // Future entries:
63423
+ // { format: SerializationFormat.CBOR, minVersion: '5.x.y' },
63424
+ // { format: SerializationFormat.ENCRYPTED_V2, minVersion: '5.x.y' },
63425
+ ];
63426
+ var BASELINE_FORMATS = /* @__PURE__ */ new Set([
63427
+ SerializationFormat.DEVALUE_V1
63428
+ ]);
63429
+
61410
63430
  // ../core/dist/runtime/run.js
61411
63431
  init_dist();
61412
63432
 
@@ -61993,6 +64013,31 @@ function workflowEntrypoint(workflowCode2) {
61993
64013
  return;
61994
64014
  }
61995
64015
  const spanLinks = await linkToCurrentContext();
64016
+ let replayTimeout;
64017
+ if (process.env.VERCEL_URL !== void 0) {
64018
+ replayTimeout = setTimeout(async () => {
64019
+ runtimeLogger.error("Workflow replay exceeded timeout", {
64020
+ workflowRunId: runId,
64021
+ timeoutMs: REPLAY_TIMEOUT_MS
64022
+ });
64023
+ try {
64024
+ const world = getWorld();
64025
+ await world.events.create(runId, {
64026
+ eventType: "run_failed",
64027
+ specVersion: SPEC_VERSION_CURRENT,
64028
+ eventData: {
64029
+ error: {
64030
+ message: `Workflow replay exceeded maximum duration (${REPLAY_TIMEOUT_MS / 1e3}s)`
64031
+ },
64032
+ errorCode: RUN_ERROR_CODES.REPLAY_TIMEOUT
64033
+ }
64034
+ }, { requestId });
64035
+ } catch {
64036
+ }
64037
+ process.exit(1);
64038
+ }, REPLAY_TIMEOUT_MS);
64039
+ replayTimeout.unref();
64040
+ }
61996
64041
  return await withTraceContext(traceContext, async () => {
61997
64042
  return await withWorkflowBaggage({ workflowRunId: runId, workflowName }, async () => {
61998
64043
  const world = getWorld();
@@ -62012,17 +64057,19 @@ function workflowEntrypoint(workflowCode2) {
62012
64057
  ...WorkflowTracePropagated(!!traceContext)
62013
64058
  });
62014
64059
  let workflowStartedAt = -1;
62015
- let workflowRun = await world.runs.get(runId);
64060
+ let workflowRun;
64061
+ let preloadedEvents;
62016
64062
  try {
62017
- if (workflowRun.status === "pending") {
62018
- const result = await world.events.create(runId, {
62019
- eventType: "run_started",
62020
- specVersion: SPEC_VERSION_CURRENT
62021
- }, { requestId });
62022
- if (!result.run) {
62023
- throw new WorkflowRuntimeError(`Event creation for 'run_started' did not return the run entity for run "${runId}"`);
62024
- }
62025
- workflowRun = result.run;
64063
+ const result = await world.events.create(runId, {
64064
+ eventType: "run_started",
64065
+ specVersion: SPEC_VERSION_CURRENT
64066
+ }, { requestId });
64067
+ if (!result.run) {
64068
+ throw new WorkflowRuntimeError(`Event creation for 'run_started' did not return the run entity for run "${runId}"`);
64069
+ }
64070
+ workflowRun = result.run;
64071
+ if (result.events && result.events.length > 0) {
64072
+ preloadedEvents = result.events;
62026
64073
  }
62027
64074
  if (!workflowRun.startedAt) {
62028
64075
  throw new WorkflowRuntimeError(`Workflow run "${runId}" has no "startedAt" timestamp`);
@@ -62068,7 +64115,7 @@ function workflowEntrypoint(workflowCode2) {
62068
64115
  });
62069
64116
  return;
62070
64117
  }
62071
- const events = await getAllWorkflowRunEvents(workflowRun.runId);
64118
+ const events = preloadedEvents ?? await getAllWorkflowRunEvents(workflowRun.runId);
62072
64119
  const now = Date.now();
62073
64120
  const completedWaitIds = new Set(events.filter((e) => e.eventType === "wait_completed").map((e) => e.correlationId));
62074
64121
  const waitsToComplete = events.filter((e) => e.eventType === "wait_created" && e.correlationId !== void 0 && !completedWaitIds.has(e.correlationId) && now >= e.eventData.resumeAt.getTime()).map((e) => ({
@@ -62203,6 +64250,10 @@ function workflowEntrypoint(workflowCode2) {
62203
64250
  });
62204
64251
  });
62205
64252
  });
64253
+ }).finally(() => {
64254
+ if (replayTimeout) {
64255
+ clearTimeout(replayTimeout);
64256
+ }
62206
64257
  });
62207
64258
  });
62208
64259
  return withHealthCheck(handler);