ccjk 12.0.0 → 12.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (161) hide show
  1. package/dist/chunks/agent-teams.mjs +17 -18
  2. package/dist/chunks/agent.mjs +105 -102
  3. package/dist/chunks/agents.mjs +87 -77
  4. package/dist/chunks/api-cli.mjs +41 -27
  5. package/dist/chunks/api-providers.mjs +2 -4
  6. package/dist/chunks/api.mjs +22 -11
  7. package/dist/chunks/auto-bootstrap.mjs +3 -5
  8. package/dist/chunks/auto-init.mjs +3 -4
  9. package/dist/chunks/auto-updater.mjs +103 -91
  10. package/dist/chunks/banner.mjs +41 -42
  11. package/dist/chunks/boost.mjs +30 -31
  12. package/dist/chunks/ccjk-agents.mjs +6 -9
  13. package/dist/chunks/ccjk-all.mjs +703 -85
  14. package/dist/chunks/ccjk-config.mjs +6 -6
  15. package/dist/chunks/ccjk-hooks.mjs +20 -9
  16. package/dist/chunks/ccjk-mcp.mjs +64 -52
  17. package/dist/chunks/ccjk-setup.mjs +35 -25
  18. package/dist/chunks/ccjk-skills.mjs +51 -41
  19. package/dist/chunks/ccr.mjs +42 -32
  20. package/dist/chunks/ccu.mjs +16 -12
  21. package/dist/chunks/check-updates.mjs +30 -19
  22. package/dist/chunks/claude-code-config-manager.mjs +25 -10
  23. package/dist/chunks/claude-code-incremental-manager.mjs +65 -51
  24. package/dist/chunks/claude-config.mjs +2 -2
  25. package/dist/chunks/claude-wrapper.mjs +9 -6
  26. package/dist/chunks/cleanup-migration.mjs +1 -1
  27. package/dist/chunks/cli-hook.mjs +10 -3
  28. package/dist/chunks/cloud-sync.mjs +1 -1
  29. package/dist/chunks/codex-config-switch.mjs +58 -45
  30. package/dist/chunks/codex-provider-manager.mjs +29 -16
  31. package/dist/chunks/codex-uninstaller.mjs +5 -6
  32. package/dist/chunks/codex.mjs +89 -89
  33. package/dist/chunks/commands.mjs +28 -29
  34. package/dist/chunks/commands2.mjs +4 -3
  35. package/dist/chunks/commit.mjs +42 -23
  36. package/dist/chunks/completion.mjs +46 -47
  37. package/dist/chunks/config-consolidator.mjs +12 -13
  38. package/dist/chunks/config-switch.mjs +66 -53
  39. package/dist/chunks/config.mjs +10 -10
  40. package/dist/chunks/config2.mjs +53 -42
  41. package/dist/chunks/config3.mjs +107 -93
  42. package/dist/chunks/constants.mjs +2 -4
  43. package/dist/chunks/context-loader.mjs +5 -4
  44. package/dist/chunks/context.mjs +77 -76
  45. package/dist/chunks/convoy-manager.mjs +4 -4
  46. package/dist/chunks/dashboard.mjs +28 -29
  47. package/dist/chunks/doctor.mjs +68 -54
  48. package/dist/chunks/evolution.mjs +37 -38
  49. package/dist/chunks/features.mjs +103 -92
  50. package/dist/chunks/fs-operations.mjs +1 -1
  51. package/dist/chunks/health-alerts.mjs +1 -1
  52. package/dist/chunks/health-check.mjs +1 -1
  53. package/dist/chunks/help.mjs +117 -116
  54. package/dist/chunks/hook-installer.mjs +3 -2
  55. package/dist/chunks/index.mjs +20 -6
  56. package/dist/chunks/index10.mjs +1171 -0
  57. package/dist/chunks/index11.mjs +1008 -0
  58. package/dist/chunks/index12.mjs +193 -0
  59. package/dist/chunks/index13.mjs +218 -0
  60. package/dist/chunks/index14.mjs +663 -0
  61. package/dist/chunks/index2.mjs +19 -10
  62. package/dist/chunks/index3.mjs +19079 -164
  63. package/dist/chunks/index4.mjs +8 -1171
  64. package/dist/chunks/index5.mjs +7479 -884
  65. package/dist/chunks/index6.mjs +160 -184
  66. package/dist/chunks/index7.mjs +3573 -653
  67. package/dist/chunks/index8.mjs +19 -0
  68. package/dist/chunks/index9.mjs +616 -0
  69. package/dist/chunks/init.mjs +173 -173
  70. package/dist/chunks/installer.mjs +92 -82
  71. package/dist/chunks/installer2.mjs +3 -2
  72. package/dist/chunks/interview.mjs +118 -107
  73. package/dist/chunks/json-config.mjs +3 -2
  74. package/dist/chunks/linux.mjs +3863 -0
  75. package/dist/chunks/macos.mjs +69 -0
  76. package/dist/chunks/main.mjs +635 -0
  77. package/dist/chunks/marketplace.mjs +69 -66
  78. package/dist/chunks/mcp-cli.mjs +61 -48
  79. package/dist/chunks/mcp.mjs +140 -127
  80. package/dist/chunks/menu.mjs +85 -85
  81. package/dist/chunks/metrics-display.mjs +41 -40
  82. package/dist/chunks/migrator.mjs +4 -5
  83. package/dist/chunks/monitor.mjs +95 -95
  84. package/dist/chunks/notification.mjs +151 -141
  85. package/dist/chunks/onboarding.mjs +26 -15
  86. package/dist/chunks/package.mjs +1 -1
  87. package/dist/chunks/paradigm.mjs +24 -23
  88. package/dist/chunks/permission-manager.mjs +10 -11
  89. package/dist/chunks/permissions.mjs +72 -57
  90. package/dist/chunks/persistence-manager.mjs +97 -84
  91. package/dist/chunks/persistence.mjs +1 -1
  92. package/dist/chunks/platform.mjs +29 -29
  93. package/dist/chunks/plugin.mjs +104 -105
  94. package/dist/chunks/prompts.mjs +36 -25
  95. package/dist/chunks/providers.mjs +68 -69
  96. package/dist/chunks/quick-actions.mjs +71 -72
  97. package/dist/chunks/quick-provider.mjs +56 -40
  98. package/dist/chunks/quick-setup.mjs +71 -60
  99. package/dist/chunks/remote.mjs +21 -12
  100. package/dist/chunks/session.mjs +116 -103
  101. package/dist/chunks/sessions.mjs +29 -28
  102. package/dist/chunks/silent-updater.mjs +8 -10
  103. package/dist/chunks/simple-config.mjs +13 -10
  104. package/dist/chunks/skill.mjs +8560 -103
  105. package/dist/chunks/skills-sync.mjs +5212 -79
  106. package/dist/chunks/skills.mjs +105 -94
  107. package/dist/chunks/slash-commands.mjs +36 -37
  108. package/dist/chunks/smart-defaults.mjs +7 -3
  109. package/dist/chunks/smart-guide.mjs +1 -1
  110. package/dist/chunks/startup.mjs +2 -4
  111. package/dist/chunks/stats.mjs +41 -42
  112. package/dist/chunks/status.mjs +49 -50
  113. package/dist/chunks/team.mjs +24 -12
  114. package/dist/chunks/thinking.mjs +74 -63
  115. package/dist/chunks/trace.mjs +20 -19
  116. package/dist/chunks/uninstall.mjs +69 -56
  117. package/dist/chunks/update.mjs +39 -28
  118. package/dist/chunks/upgrade-manager.mjs +24 -18
  119. package/dist/chunks/version-checker.mjs +45 -41
  120. package/dist/chunks/vim.mjs +81 -69
  121. package/dist/chunks/windows.mjs +14 -0
  122. package/dist/chunks/workflows.mjs +15 -15
  123. package/dist/chunks/wsl.mjs +129 -0
  124. package/dist/chunks/zero-config.mjs +45 -34
  125. package/dist/cli.mjs +20 -20
  126. package/dist/index.mjs +41 -31
  127. package/dist/shared/ccjk.BAGoDD49.mjs +36 -0
  128. package/dist/shared/ccjk.BBtCGd_g.mjs +899 -0
  129. package/dist/shared/{ccjk.CGcy7cNM.mjs → ccjk.BDKUdmLk.mjs} +1 -1
  130. package/dist/shared/{ccjk.DtMBiwVG.mjs → ccjk.BFxsJM0k.mjs} +1 -1
  131. package/dist/shared/{ccjk.j4uut26D.mjs → ccjk.BIxuVL3_.mjs} +5 -5
  132. package/dist/shared/ccjk.BRZ9ww8S.mjs +142 -0
  133. package/dist/shared/{ccjk.CN0edl87.mjs → ccjk.BSYWk9ML.mjs} +1 -1
  134. package/dist/shared/{ccjk.Dk1HDseQ.mjs → ccjk.BnpWvs9V.mjs} +75 -75
  135. package/dist/shared/ccjk.BoApaI4j.mjs +28 -0
  136. package/dist/shared/{ccjk.DKojSRzw.mjs → ccjk.BrPUmTqm.mjs} +1 -1
  137. package/dist/shared/{ccjk.C10pepYx.mjs → ccjk.BxSmJ8B7.mjs} +1 -1
  138. package/dist/shared/ccjk.Bx_rmYfN.mjs +69 -0
  139. package/dist/shared/ccjk.COweQ1RR.mjs +5 -0
  140. package/dist/shared/{ccjk.BN90X6oc.mjs → ccjk.CePkJq2S.mjs} +17 -17
  141. package/dist/shared/{ccjk.Bvoex4TZ.mjs → ccjk.CfKKcvWy.mjs} +1 -1
  142. package/dist/shared/ccjk.Cjgrln_h.mjs +297 -0
  143. package/dist/shared/ccjk.CxpGa6MC.mjs +2724 -0
  144. package/dist/shared/{ccjk.DfwJOEok.mjs → ccjk.D5MFQT7w.mjs} +1 -1
  145. package/dist/shared/{ccjk.cChAaGgT.mjs → ccjk.DG_o24cZ.mjs} +6 -6
  146. package/dist/shared/{ccjk.bhFAMRyc.mjs → ccjk.DLLw-h4Y.mjs} +32 -32
  147. package/dist/shared/ccjk.DOwtZMk8.mjs +4019 -0
  148. package/dist/shared/{ccjk.BsXQugfY.mjs → ccjk.DTdjs-qK.mjs} +13 -13
  149. package/dist/shared/{ccjk.Bdhyg3X-.mjs → ccjk.DsYaCCx4.mjs} +1 -1
  150. package/dist/shared/ccjk.KfSWcGlE.mjs +38 -0
  151. package/dist/shared/ccjk.RyizuzOI.mjs +21 -0
  152. package/dist/shared/{ccjk.h7_W-wTs.mjs → ccjk.SPoXMvZD.mjs} +1 -1
  153. package/dist/shared/ccjk.T_cX87dY.mjs +15 -0
  154. package/dist/shared/{ccjk.CrB6OYHv.mjs → ccjk._dESH4Rk.mjs} +2 -2
  155. package/dist/shared/ccjk.bQ7Dh1g4.mjs +249 -0
  156. package/dist/shared/{ccjk.CBhIZiPz.mjs → ccjk.hoqrwWdN.mjs} +1 -1
  157. package/dist/shared/{ccjk.BNwRnWYx.mjs → ccjk.s7OCVzdd.mjs} +1230 -33
  158. package/dist/shared/{ccjk.BOIUTf5z.mjs → ccjk.waa2ikKJ.mjs} +8 -9
  159. package/package.json +31 -30
  160. package/dist/shared/ccjk.DHbrGcgg.mjs +0 -13
  161. package/dist/shared/ccjk.DntgA8fQ.mjs +0 -42
@@ -0,0 +1,2724 @@
1
+ import { g as getDefaultExportFromCjs } from './ccjk.BAGoDD49.mjs';
2
+
3
+ var re = {exports: {}};
4
+
5
+ var constants;
6
+ var hasRequiredConstants;
7
+
8
+ function requireConstants () {
9
+ if (hasRequiredConstants) return constants;
10
+ hasRequiredConstants = 1;
11
+
12
+ // Note: this is the semver.org version of the spec that it implements
13
+ // Not necessarily the package version of this code.
14
+ const SEMVER_SPEC_VERSION = '2.0.0';
15
+
16
+ const MAX_LENGTH = 256;
17
+ const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||
18
+ /* istanbul ignore next */ 9007199254740991;
19
+
20
+ // Max safe segment length for coercion.
21
+ const MAX_SAFE_COMPONENT_LENGTH = 16;
22
+
23
+ // Max safe length for a build identifier. The max length minus 6 characters for
24
+ // the shortest version with a build 0.0.0+BUILD.
25
+ const MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6;
26
+
27
+ const RELEASE_TYPES = [
28
+ 'major',
29
+ 'premajor',
30
+ 'minor',
31
+ 'preminor',
32
+ 'patch',
33
+ 'prepatch',
34
+ 'prerelease',
35
+ ];
36
+
37
+ constants = {
38
+ MAX_LENGTH,
39
+ MAX_SAFE_COMPONENT_LENGTH,
40
+ MAX_SAFE_BUILD_LENGTH,
41
+ MAX_SAFE_INTEGER,
42
+ RELEASE_TYPES,
43
+ SEMVER_SPEC_VERSION,
44
+ FLAG_INCLUDE_PRERELEASE: 0b001,
45
+ FLAG_LOOSE: 0b010,
46
+ };
47
+ return constants;
48
+ }
49
+
50
+ var debug_1;
51
+ var hasRequiredDebug;
52
+
53
+ function requireDebug () {
54
+ if (hasRequiredDebug) return debug_1;
55
+ hasRequiredDebug = 1;
56
+
57
+ const debug = (
58
+ typeof process === 'object' &&
59
+ process.env &&
60
+ process.env.NODE_DEBUG &&
61
+ /\bsemver\b/i.test(process.env.NODE_DEBUG)
62
+ ) ? (...args) => console.error('SEMVER', ...args)
63
+ : () => {};
64
+
65
+ debug_1 = debug;
66
+ return debug_1;
67
+ }
68
+
69
+ var hasRequiredRe;
70
+
71
+ function requireRe () {
72
+ if (hasRequiredRe) return re.exports;
73
+ hasRequiredRe = 1;
74
+ (function (module, exports) {
75
+
76
+ const {
77
+ MAX_SAFE_COMPONENT_LENGTH,
78
+ MAX_SAFE_BUILD_LENGTH,
79
+ MAX_LENGTH,
80
+ } = requireConstants();
81
+ const debug = requireDebug();
82
+ exports = module.exports = {};
83
+
84
+ // The actual regexps go on exports.re
85
+ const re = exports.re = [];
86
+ const safeRe = exports.safeRe = [];
87
+ const src = exports.src = [];
88
+ const safeSrc = exports.safeSrc = [];
89
+ const t = exports.t = {};
90
+ let R = 0;
91
+
92
+ const LETTERDASHNUMBER = '[a-zA-Z0-9-]';
93
+
94
+ // Replace some greedy regex tokens to prevent regex dos issues. These regex are
95
+ // used internally via the safeRe object since all inputs in this library get
96
+ // normalized first to trim and collapse all extra whitespace. The original
97
+ // regexes are exported for userland consumption and lower level usage. A
98
+ // future breaking change could export the safer regex only with a note that
99
+ // all input should have extra whitespace removed.
100
+ const safeRegexReplacements = [
101
+ ['\\s', 1],
102
+ ['\\d', MAX_LENGTH],
103
+ [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH],
104
+ ];
105
+
106
+ const makeSafeRegex = (value) => {
107
+ for (const [token, max] of safeRegexReplacements) {
108
+ value = value
109
+ .split(`${token}*`).join(`${token}{0,${max}}`)
110
+ .split(`${token}+`).join(`${token}{1,${max}}`);
111
+ }
112
+ return value
113
+ };
114
+
115
+ const createToken = (name, value, isGlobal) => {
116
+ const safe = makeSafeRegex(value);
117
+ const index = R++;
118
+ debug(name, index, value);
119
+ t[name] = index;
120
+ src[index] = value;
121
+ safeSrc[index] = safe;
122
+ re[index] = new RegExp(value, isGlobal ? 'g' : undefined);
123
+ safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined);
124
+ };
125
+
126
+ // The following Regular Expressions can be used for tokenizing,
127
+ // validating, and parsing SemVer version strings.
128
+
129
+ // ## Numeric Identifier
130
+ // A single `0`, or a non-zero digit followed by zero or more digits.
131
+
132
+ createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*');
133
+ createToken('NUMERICIDENTIFIERLOOSE', '\\d+');
134
+
135
+ // ## Non-numeric Identifier
136
+ // Zero or more digits, followed by a letter or hyphen, and then zero or
137
+ // more letters, digits, or hyphens.
138
+
139
+ createToken('NONNUMERICIDENTIFIER', `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
140
+
141
+ // ## Main Version
142
+ // Three dot-separated numeric identifiers.
143
+
144
+ createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\.` +
145
+ `(${src[t.NUMERICIDENTIFIER]})\\.` +
146
+ `(${src[t.NUMERICIDENTIFIER]})`);
147
+
148
+ createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
149
+ `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
150
+ `(${src[t.NUMERICIDENTIFIERLOOSE]})`);
151
+
152
+ // ## Pre-release Version Identifier
153
+ // A numeric identifier, or a non-numeric identifier.
154
+ // Non-numeric identifiers include numeric identifiers but can be longer.
155
+ // Therefore non-numeric identifiers must go first.
156
+
157
+ createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NONNUMERICIDENTIFIER]
158
+ }|${src[t.NUMERICIDENTIFIER]})`);
159
+
160
+ createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NONNUMERICIDENTIFIER]
161
+ }|${src[t.NUMERICIDENTIFIERLOOSE]})`);
162
+
163
+ // ## Pre-release Version
164
+ // Hyphen, followed by one or more dot-separated pre-release version
165
+ // identifiers.
166
+
167
+ createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER]
168
+ }(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
169
+
170
+ createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]
171
+ }(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
172
+
173
+ // ## Build Metadata Identifier
174
+ // Any combination of digits, letters, or hyphens.
175
+
176
+ createToken('BUILDIDENTIFIER', `${LETTERDASHNUMBER}+`);
177
+
178
+ // ## Build Metadata
179
+ // Plus sign, followed by one or more period-separated build metadata
180
+ // identifiers.
181
+
182
+ createToken('BUILD', `(?:\\+(${src[t.BUILDIDENTIFIER]
183
+ }(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
184
+
185
+ // ## Full Version String
186
+ // A main version, followed optionally by a pre-release version and
187
+ // build metadata.
188
+
189
+ // Note that the only major, minor, patch, and pre-release sections of
190
+ // the version string are capturing groups. The build metadata is not a
191
+ // capturing group, because it should not ever be used in version
192
+ // comparison.
193
+
194
+ createToken('FULLPLAIN', `v?${src[t.MAINVERSION]
195
+ }${src[t.PRERELEASE]}?${
196
+ src[t.BUILD]}?`);
197
+
198
+ createToken('FULL', `^${src[t.FULLPLAIN]}$`);
199
+
200
+ // like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
201
+ // also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
202
+ // common in the npm registry.
203
+ createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE]
204
+ }${src[t.PRERELEASELOOSE]}?${
205
+ src[t.BUILD]}?`);
206
+
207
+ createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`);
208
+
209
+ createToken('GTLT', '((?:<|>)?=?)');
210
+
211
+ // Something like "2.*" or "1.2.x".
212
+ // Note that "x.x" is a valid xRange identifer, meaning "any version"
213
+ // Only the first item is strictly required.
214
+ createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
215
+ createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
216
+
217
+ createToken('XRANGEPLAIN', `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` +
218
+ `(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
219
+ `(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
220
+ `(?:${src[t.PRERELEASE]})?${
221
+ src[t.BUILD]}?` +
222
+ `)?)?`);
223
+
224
+ createToken('XRANGEPLAINLOOSE', `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` +
225
+ `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
226
+ `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
227
+ `(?:${src[t.PRERELEASELOOSE]})?${
228
+ src[t.BUILD]}?` +
229
+ `)?)?`);
230
+
231
+ createToken('XRANGE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
232
+ createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
233
+
234
+ // Coercion.
235
+ // Extract anything that could conceivably be a part of a valid semver
236
+ createToken('COERCEPLAIN', `${'(^|[^\\d])' +
237
+ '(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` +
238
+ `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +
239
+ `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
240
+ createToken('COERCE', `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
241
+ createToken('COERCEFULL', src[t.COERCEPLAIN] +
242
+ `(?:${src[t.PRERELEASE]})?` +
243
+ `(?:${src[t.BUILD]})?` +
244
+ `(?:$|[^\\d])`);
245
+ createToken('COERCERTL', src[t.COERCE], true);
246
+ createToken('COERCERTLFULL', src[t.COERCEFULL], true);
247
+
248
+ // Tilde ranges.
249
+ // Meaning is "reasonably at or greater than"
250
+ createToken('LONETILDE', '(?:~>?)');
251
+
252
+ createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true);
253
+ exports.tildeTrimReplace = '$1~';
254
+
255
+ createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
256
+ createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
257
+
258
+ // Caret ranges.
259
+ // Meaning is "at least and backwards compatible with"
260
+ createToken('LONECARET', '(?:\\^)');
261
+
262
+ createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true);
263
+ exports.caretTrimReplace = '$1^';
264
+
265
+ createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
266
+ createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
267
+
268
+ // A simple gt/lt/eq thing, or just "" to indicate "any version"
269
+ createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
270
+ createToken('COMPARATOR', `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
271
+
272
+ // An expression to strip any whitespace between the gtlt and the thing
273
+ // it modifies, so that `> 1.2.3` ==> `>1.2.3`
274
+ createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT]
275
+ }\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
276
+ exports.comparatorTrimReplace = '$1$2$3';
277
+
278
+ // Something like `1.2.3 - 1.2.4`
279
+ // Note that these all use the loose form, because they'll be
280
+ // checked against either the strict or loose comparator form
281
+ // later.
282
+ createToken('HYPHENRANGE', `^\\s*(${src[t.XRANGEPLAIN]})` +
283
+ `\\s+-\\s+` +
284
+ `(${src[t.XRANGEPLAIN]})` +
285
+ `\\s*$`);
286
+
287
+ createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` +
288
+ `\\s+-\\s+` +
289
+ `(${src[t.XRANGEPLAINLOOSE]})` +
290
+ `\\s*$`);
291
+
292
+ // Star ranges basically just allow anything at all.
293
+ createToken('STAR', '(<|>)?=?\\s*\\*');
294
+ // >=0.0.0 is like a star
295
+ createToken('GTE0', '^\\s*>=\\s*0\\.0\\.0\\s*$');
296
+ createToken('GTE0PRE', '^\\s*>=\\s*0\\.0\\.0-0\\s*$');
297
+ } (re, re.exports));
298
+ return re.exports;
299
+ }
300
+
301
+ var parseOptions_1;
302
+ var hasRequiredParseOptions;
303
+
304
+ function requireParseOptions () {
305
+ if (hasRequiredParseOptions) return parseOptions_1;
306
+ hasRequiredParseOptions = 1;
307
+
308
+ // parse out just the options we care about
309
+ const looseOption = Object.freeze({ loose: true });
310
+ const emptyOpts = Object.freeze({ });
311
+ const parseOptions = options => {
312
+ if (!options) {
313
+ return emptyOpts
314
+ }
315
+
316
+ if (typeof options !== 'object') {
317
+ return looseOption
318
+ }
319
+
320
+ return options
321
+ };
322
+ parseOptions_1 = parseOptions;
323
+ return parseOptions_1;
324
+ }
325
+
326
+ var identifiers;
327
+ var hasRequiredIdentifiers;
328
+
329
+ function requireIdentifiers () {
330
+ if (hasRequiredIdentifiers) return identifiers;
331
+ hasRequiredIdentifiers = 1;
332
+
333
+ const numeric = /^[0-9]+$/;
334
+ const compareIdentifiers = (a, b) => {
335
+ if (typeof a === 'number' && typeof b === 'number') {
336
+ return a === b ? 0 : a < b ? -1 : 1
337
+ }
338
+
339
+ const anum = numeric.test(a);
340
+ const bnum = numeric.test(b);
341
+
342
+ if (anum && bnum) {
343
+ a = +a;
344
+ b = +b;
345
+ }
346
+
347
+ return a === b ? 0
348
+ : (anum && !bnum) ? -1
349
+ : (bnum && !anum) ? 1
350
+ : a < b ? -1
351
+ : 1
352
+ };
353
+
354
+ const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
355
+
356
+ identifiers = {
357
+ compareIdentifiers,
358
+ rcompareIdentifiers,
359
+ };
360
+ return identifiers;
361
+ }
362
+
363
+ var semver$2;
364
+ var hasRequiredSemver$1;
365
+
366
+ function requireSemver$1 () {
367
+ if (hasRequiredSemver$1) return semver$2;
368
+ hasRequiredSemver$1 = 1;
369
+
370
+ const debug = requireDebug();
371
+ const { MAX_LENGTH, MAX_SAFE_INTEGER } = requireConstants();
372
+ const { safeRe: re, t } = requireRe();
373
+
374
+ const parseOptions = requireParseOptions();
375
+ const { compareIdentifiers } = requireIdentifiers();
376
+ class SemVer {
377
+ constructor (version, options) {
378
+ options = parseOptions(options);
379
+
380
+ if (version instanceof SemVer) {
381
+ if (version.loose === !!options.loose &&
382
+ version.includePrerelease === !!options.includePrerelease) {
383
+ return version
384
+ } else {
385
+ version = version.version;
386
+ }
387
+ } else if (typeof version !== 'string') {
388
+ throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`)
389
+ }
390
+
391
+ if (version.length > MAX_LENGTH) {
392
+ throw new TypeError(
393
+ `version is longer than ${MAX_LENGTH} characters`
394
+ )
395
+ }
396
+
397
+ debug('SemVer', version, options);
398
+ this.options = options;
399
+ this.loose = !!options.loose;
400
+ // this isn't actually relevant for versions, but keep it so that we
401
+ // don't run into trouble passing this.options around.
402
+ this.includePrerelease = !!options.includePrerelease;
403
+
404
+ const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
405
+
406
+ if (!m) {
407
+ throw new TypeError(`Invalid Version: ${version}`)
408
+ }
409
+
410
+ this.raw = version;
411
+
412
+ // these are actually numbers
413
+ this.major = +m[1];
414
+ this.minor = +m[2];
415
+ this.patch = +m[3];
416
+
417
+ if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
418
+ throw new TypeError('Invalid major version')
419
+ }
420
+
421
+ if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
422
+ throw new TypeError('Invalid minor version')
423
+ }
424
+
425
+ if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
426
+ throw new TypeError('Invalid patch version')
427
+ }
428
+
429
+ // numberify any prerelease numeric ids
430
+ if (!m[4]) {
431
+ this.prerelease = [];
432
+ } else {
433
+ this.prerelease = m[4].split('.').map((id) => {
434
+ if (/^[0-9]+$/.test(id)) {
435
+ const num = +id;
436
+ if (num >= 0 && num < MAX_SAFE_INTEGER) {
437
+ return num
438
+ }
439
+ }
440
+ return id
441
+ });
442
+ }
443
+
444
+ this.build = m[5] ? m[5].split('.') : [];
445
+ this.format();
446
+ }
447
+
448
+ format () {
449
+ this.version = `${this.major}.${this.minor}.${this.patch}`;
450
+ if (this.prerelease.length) {
451
+ this.version += `-${this.prerelease.join('.')}`;
452
+ }
453
+ return this.version
454
+ }
455
+
456
+ toString () {
457
+ return this.version
458
+ }
459
+
460
+ compare (other) {
461
+ debug('SemVer.compare', this.version, this.options, other);
462
+ if (!(other instanceof SemVer)) {
463
+ if (typeof other === 'string' && other === this.version) {
464
+ return 0
465
+ }
466
+ other = new SemVer(other, this.options);
467
+ }
468
+
469
+ if (other.version === this.version) {
470
+ return 0
471
+ }
472
+
473
+ return this.compareMain(other) || this.comparePre(other)
474
+ }
475
+
476
+ compareMain (other) {
477
+ if (!(other instanceof SemVer)) {
478
+ other = new SemVer(other, this.options);
479
+ }
480
+
481
+ if (this.major < other.major) {
482
+ return -1
483
+ }
484
+ if (this.major > other.major) {
485
+ return 1
486
+ }
487
+ if (this.minor < other.minor) {
488
+ return -1
489
+ }
490
+ if (this.minor > other.minor) {
491
+ return 1
492
+ }
493
+ if (this.patch < other.patch) {
494
+ return -1
495
+ }
496
+ if (this.patch > other.patch) {
497
+ return 1
498
+ }
499
+ return 0
500
+ }
501
+
502
+ comparePre (other) {
503
+ if (!(other instanceof SemVer)) {
504
+ other = new SemVer(other, this.options);
505
+ }
506
+
507
+ // NOT having a prerelease is > having one
508
+ if (this.prerelease.length && !other.prerelease.length) {
509
+ return -1
510
+ } else if (!this.prerelease.length && other.prerelease.length) {
511
+ return 1
512
+ } else if (!this.prerelease.length && !other.prerelease.length) {
513
+ return 0
514
+ }
515
+
516
+ let i = 0;
517
+ do {
518
+ const a = this.prerelease[i];
519
+ const b = other.prerelease[i];
520
+ debug('prerelease compare', i, a, b);
521
+ if (a === undefined && b === undefined) {
522
+ return 0
523
+ } else if (b === undefined) {
524
+ return 1
525
+ } else if (a === undefined) {
526
+ return -1
527
+ } else if (a === b) {
528
+ continue
529
+ } else {
530
+ return compareIdentifiers(a, b)
531
+ }
532
+ } while (++i)
533
+ }
534
+
535
+ compareBuild (other) {
536
+ if (!(other instanceof SemVer)) {
537
+ other = new SemVer(other, this.options);
538
+ }
539
+
540
+ let i = 0;
541
+ do {
542
+ const a = this.build[i];
543
+ const b = other.build[i];
544
+ debug('build compare', i, a, b);
545
+ if (a === undefined && b === undefined) {
546
+ return 0
547
+ } else if (b === undefined) {
548
+ return 1
549
+ } else if (a === undefined) {
550
+ return -1
551
+ } else if (a === b) {
552
+ continue
553
+ } else {
554
+ return compareIdentifiers(a, b)
555
+ }
556
+ } while (++i)
557
+ }
558
+
559
+ // preminor will bump the version up to the next minor release, and immediately
560
+ // down to pre-release. premajor and prepatch work the same way.
561
+ inc (release, identifier, identifierBase) {
562
+ if (release.startsWith('pre')) {
563
+ if (!identifier && identifierBase === false) {
564
+ throw new Error('invalid increment argument: identifier is empty')
565
+ }
566
+ // Avoid an invalid semver results
567
+ if (identifier) {
568
+ const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE]);
569
+ if (!match || match[1] !== identifier) {
570
+ throw new Error(`invalid identifier: ${identifier}`)
571
+ }
572
+ }
573
+ }
574
+
575
+ switch (release) {
576
+ case 'premajor':
577
+ this.prerelease.length = 0;
578
+ this.patch = 0;
579
+ this.minor = 0;
580
+ this.major++;
581
+ this.inc('pre', identifier, identifierBase);
582
+ break
583
+ case 'preminor':
584
+ this.prerelease.length = 0;
585
+ this.patch = 0;
586
+ this.minor++;
587
+ this.inc('pre', identifier, identifierBase);
588
+ break
589
+ case 'prepatch':
590
+ // If this is already a prerelease, it will bump to the next version
591
+ // drop any prereleases that might already exist, since they are not
592
+ // relevant at this point.
593
+ this.prerelease.length = 0;
594
+ this.inc('patch', identifier, identifierBase);
595
+ this.inc('pre', identifier, identifierBase);
596
+ break
597
+ // If the input is a non-prerelease version, this acts the same as
598
+ // prepatch.
599
+ case 'prerelease':
600
+ if (this.prerelease.length === 0) {
601
+ this.inc('patch', identifier, identifierBase);
602
+ }
603
+ this.inc('pre', identifier, identifierBase);
604
+ break
605
+ case 'release':
606
+ if (this.prerelease.length === 0) {
607
+ throw new Error(`version ${this.raw} is not a prerelease`)
608
+ }
609
+ this.prerelease.length = 0;
610
+ break
611
+
612
+ case 'major':
613
+ // If this is a pre-major version, bump up to the same major version.
614
+ // Otherwise increment major.
615
+ // 1.0.0-5 bumps to 1.0.0
616
+ // 1.1.0 bumps to 2.0.0
617
+ if (
618
+ this.minor !== 0 ||
619
+ this.patch !== 0 ||
620
+ this.prerelease.length === 0
621
+ ) {
622
+ this.major++;
623
+ }
624
+ this.minor = 0;
625
+ this.patch = 0;
626
+ this.prerelease = [];
627
+ break
628
+ case 'minor':
629
+ // If this is a pre-minor version, bump up to the same minor version.
630
+ // Otherwise increment minor.
631
+ // 1.2.0-5 bumps to 1.2.0
632
+ // 1.2.1 bumps to 1.3.0
633
+ if (this.patch !== 0 || this.prerelease.length === 0) {
634
+ this.minor++;
635
+ }
636
+ this.patch = 0;
637
+ this.prerelease = [];
638
+ break
639
+ case 'patch':
640
+ // If this is not a pre-release version, it will increment the patch.
641
+ // If it is a pre-release it will bump up to the same patch version.
642
+ // 1.2.0-5 patches to 1.2.0
643
+ // 1.2.0 patches to 1.2.1
644
+ if (this.prerelease.length === 0) {
645
+ this.patch++;
646
+ }
647
+ this.prerelease = [];
648
+ break
649
+ // This probably shouldn't be used publicly.
650
+ // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
651
+ case 'pre': {
652
+ const base = Number(identifierBase) ? 1 : 0;
653
+
654
+ if (this.prerelease.length === 0) {
655
+ this.prerelease = [base];
656
+ } else {
657
+ let i = this.prerelease.length;
658
+ while (--i >= 0) {
659
+ if (typeof this.prerelease[i] === 'number') {
660
+ this.prerelease[i]++;
661
+ i = -2;
662
+ }
663
+ }
664
+ if (i === -1) {
665
+ // didn't increment anything
666
+ if (identifier === this.prerelease.join('.') && identifierBase === false) {
667
+ throw new Error('invalid increment argument: identifier already exists')
668
+ }
669
+ this.prerelease.push(base);
670
+ }
671
+ }
672
+ if (identifier) {
673
+ // 1.2.0-beta.1 bumps to 1.2.0-beta.2,
674
+ // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
675
+ let prerelease = [identifier, base];
676
+ if (identifierBase === false) {
677
+ prerelease = [identifier];
678
+ }
679
+ if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
680
+ if (isNaN(this.prerelease[1])) {
681
+ this.prerelease = prerelease;
682
+ }
683
+ } else {
684
+ this.prerelease = prerelease;
685
+ }
686
+ }
687
+ break
688
+ }
689
+ default:
690
+ throw new Error(`invalid increment argument: ${release}`)
691
+ }
692
+ this.raw = this.format();
693
+ if (this.build.length) {
694
+ this.raw += `+${this.build.join('.')}`;
695
+ }
696
+ return this
697
+ }
698
+ }
699
+
700
+ semver$2 = SemVer;
701
+ return semver$2;
702
+ }
703
+
704
+ var parse_1;
705
+ var hasRequiredParse;
706
+
707
+ function requireParse () {
708
+ if (hasRequiredParse) return parse_1;
709
+ hasRequiredParse = 1;
710
+
711
+ const SemVer = requireSemver$1();
712
+ const parse = (version, options, throwErrors = false) => {
713
+ if (version instanceof SemVer) {
714
+ return version
715
+ }
716
+ try {
717
+ return new SemVer(version, options)
718
+ } catch (er) {
719
+ if (!throwErrors) {
720
+ return null
721
+ }
722
+ throw er
723
+ }
724
+ };
725
+
726
+ parse_1 = parse;
727
+ return parse_1;
728
+ }
729
+
730
+ var valid_1;
731
+ var hasRequiredValid$1;
732
+
733
+ function requireValid$1 () {
734
+ if (hasRequiredValid$1) return valid_1;
735
+ hasRequiredValid$1 = 1;
736
+
737
+ const parse = requireParse();
738
+ const valid = (version, options) => {
739
+ const v = parse(version, options);
740
+ return v ? v.version : null
741
+ };
742
+ valid_1 = valid;
743
+ return valid_1;
744
+ }
745
+
746
+ var clean_1;
747
+ var hasRequiredClean;
748
+
749
+ function requireClean () {
750
+ if (hasRequiredClean) return clean_1;
751
+ hasRequiredClean = 1;
752
+
753
+ const parse = requireParse();
754
+ const clean = (version, options) => {
755
+ const s = parse(version.trim().replace(/^[=v]+/, ''), options);
756
+ return s ? s.version : null
757
+ };
758
+ clean_1 = clean;
759
+ return clean_1;
760
+ }
761
+
762
+ var inc_1;
763
+ var hasRequiredInc;
764
+
765
+ function requireInc () {
766
+ if (hasRequiredInc) return inc_1;
767
+ hasRequiredInc = 1;
768
+
769
+ const SemVer = requireSemver$1();
770
+
771
+ const inc = (version, release, options, identifier, identifierBase) => {
772
+ if (typeof (options) === 'string') {
773
+ identifierBase = identifier;
774
+ identifier = options;
775
+ options = undefined;
776
+ }
777
+
778
+ try {
779
+ return new SemVer(
780
+ version instanceof SemVer ? version.version : version,
781
+ options
782
+ ).inc(release, identifier, identifierBase).version
783
+ } catch (er) {
784
+ return null
785
+ }
786
+ };
787
+ inc_1 = inc;
788
+ return inc_1;
789
+ }
790
+
791
+ var diff_1;
792
+ var hasRequiredDiff;
793
+
794
+ function requireDiff () {
795
+ if (hasRequiredDiff) return diff_1;
796
+ hasRequiredDiff = 1;
797
+
798
+ const parse = requireParse();
799
+
800
+ const diff = (version1, version2) => {
801
+ const v1 = parse(version1, null, true);
802
+ const v2 = parse(version2, null, true);
803
+ const comparison = v1.compare(v2);
804
+
805
+ if (comparison === 0) {
806
+ return null
807
+ }
808
+
809
+ const v1Higher = comparison > 0;
810
+ const highVersion = v1Higher ? v1 : v2;
811
+ const lowVersion = v1Higher ? v2 : v1;
812
+ const highHasPre = !!highVersion.prerelease.length;
813
+ const lowHasPre = !!lowVersion.prerelease.length;
814
+
815
+ if (lowHasPre && !highHasPre) {
816
+ // Going from prerelease -> no prerelease requires some special casing
817
+
818
+ // If the low version has only a major, then it will always be a major
819
+ // Some examples:
820
+ // 1.0.0-1 -> 1.0.0
821
+ // 1.0.0-1 -> 1.1.1
822
+ // 1.0.0-1 -> 2.0.0
823
+ if (!lowVersion.patch && !lowVersion.minor) {
824
+ return 'major'
825
+ }
826
+
827
+ // If the main part has no difference
828
+ if (lowVersion.compareMain(highVersion) === 0) {
829
+ if (lowVersion.minor && !lowVersion.patch) {
830
+ return 'minor'
831
+ }
832
+ return 'patch'
833
+ }
834
+ }
835
+
836
+ // add the `pre` prefix if we are going to a prerelease version
837
+ const prefix = highHasPre ? 'pre' : '';
838
+
839
+ if (v1.major !== v2.major) {
840
+ return prefix + 'major'
841
+ }
842
+
843
+ if (v1.minor !== v2.minor) {
844
+ return prefix + 'minor'
845
+ }
846
+
847
+ if (v1.patch !== v2.patch) {
848
+ return prefix + 'patch'
849
+ }
850
+
851
+ // high and low are prereleases
852
+ return 'prerelease'
853
+ };
854
+
855
+ diff_1 = diff;
856
+ return diff_1;
857
+ }
858
+
859
+ var major_1;
860
+ var hasRequiredMajor;
861
+
862
+ function requireMajor () {
863
+ if (hasRequiredMajor) return major_1;
864
+ hasRequiredMajor = 1;
865
+
866
+ const SemVer = requireSemver$1();
867
+ const major = (a, loose) => new SemVer(a, loose).major;
868
+ major_1 = major;
869
+ return major_1;
870
+ }
871
+
872
+ var minor_1;
873
+ var hasRequiredMinor;
874
+
875
+ function requireMinor () {
876
+ if (hasRequiredMinor) return minor_1;
877
+ hasRequiredMinor = 1;
878
+
879
+ const SemVer = requireSemver$1();
880
+ const minor = (a, loose) => new SemVer(a, loose).minor;
881
+ minor_1 = minor;
882
+ return minor_1;
883
+ }
884
+
885
+ var patch_1;
886
+ var hasRequiredPatch;
887
+
888
+ function requirePatch () {
889
+ if (hasRequiredPatch) return patch_1;
890
+ hasRequiredPatch = 1;
891
+
892
+ const SemVer = requireSemver$1();
893
+ const patch = (a, loose) => new SemVer(a, loose).patch;
894
+ patch_1 = patch;
895
+ return patch_1;
896
+ }
897
+
898
+ var prerelease_1;
899
+ var hasRequiredPrerelease;
900
+
901
+ function requirePrerelease () {
902
+ if (hasRequiredPrerelease) return prerelease_1;
903
+ hasRequiredPrerelease = 1;
904
+
905
+ const parse = requireParse();
906
+ const prerelease = (version, options) => {
907
+ const parsed = parse(version, options);
908
+ return (parsed && parsed.prerelease.length) ? parsed.prerelease : null
909
+ };
910
+ prerelease_1 = prerelease;
911
+ return prerelease_1;
912
+ }
913
+
914
+ var compare_1;
915
+ var hasRequiredCompare;
916
+
917
+ function requireCompare () {
918
+ if (hasRequiredCompare) return compare_1;
919
+ hasRequiredCompare = 1;
920
+
921
+ const SemVer = requireSemver$1();
922
+ const compare = (a, b, loose) =>
923
+ new SemVer(a, loose).compare(new SemVer(b, loose));
924
+
925
+ compare_1 = compare;
926
+ return compare_1;
927
+ }
928
+
929
+ var rcompare_1;
930
+ var hasRequiredRcompare;
931
+
932
+ function requireRcompare () {
933
+ if (hasRequiredRcompare) return rcompare_1;
934
+ hasRequiredRcompare = 1;
935
+
936
+ const compare = requireCompare();
937
+ const rcompare = (a, b, loose) => compare(b, a, loose);
938
+ rcompare_1 = rcompare;
939
+ return rcompare_1;
940
+ }
941
+
942
+ var compareLoose_1;
943
+ var hasRequiredCompareLoose;
944
+
945
+ function requireCompareLoose () {
946
+ if (hasRequiredCompareLoose) return compareLoose_1;
947
+ hasRequiredCompareLoose = 1;
948
+
949
+ const compare = requireCompare();
950
+ const compareLoose = (a, b) => compare(a, b, true);
951
+ compareLoose_1 = compareLoose;
952
+ return compareLoose_1;
953
+ }
954
+
955
+ var compareBuild_1;
956
+ var hasRequiredCompareBuild;
957
+
958
+ function requireCompareBuild () {
959
+ if (hasRequiredCompareBuild) return compareBuild_1;
960
+ hasRequiredCompareBuild = 1;
961
+
962
+ const SemVer = requireSemver$1();
963
+ const compareBuild = (a, b, loose) => {
964
+ const versionA = new SemVer(a, loose);
965
+ const versionB = new SemVer(b, loose);
966
+ return versionA.compare(versionB) || versionA.compareBuild(versionB)
967
+ };
968
+ compareBuild_1 = compareBuild;
969
+ return compareBuild_1;
970
+ }
971
+
972
+ var sort_1;
973
+ var hasRequiredSort;
974
+
975
+ function requireSort () {
976
+ if (hasRequiredSort) return sort_1;
977
+ hasRequiredSort = 1;
978
+
979
+ const compareBuild = requireCompareBuild();
980
+ const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose));
981
+ sort_1 = sort;
982
+ return sort_1;
983
+ }
984
+
985
+ var rsort_1;
986
+ var hasRequiredRsort;
987
+
988
+ function requireRsort () {
989
+ if (hasRequiredRsort) return rsort_1;
990
+ hasRequiredRsort = 1;
991
+
992
+ const compareBuild = requireCompareBuild();
993
+ const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose));
994
+ rsort_1 = rsort;
995
+ return rsort_1;
996
+ }
997
+
998
+ var gt_1;
999
+ var hasRequiredGt;
1000
+
1001
+ function requireGt () {
1002
+ if (hasRequiredGt) return gt_1;
1003
+ hasRequiredGt = 1;
1004
+
1005
+ const compare = requireCompare();
1006
+ const gt = (a, b, loose) => compare(a, b, loose) > 0;
1007
+ gt_1 = gt;
1008
+ return gt_1;
1009
+ }
1010
+
1011
+ var lt_1;
1012
+ var hasRequiredLt;
1013
+
1014
+ function requireLt () {
1015
+ if (hasRequiredLt) return lt_1;
1016
+ hasRequiredLt = 1;
1017
+
1018
+ const compare = requireCompare();
1019
+ const lt = (a, b, loose) => compare(a, b, loose) < 0;
1020
+ lt_1 = lt;
1021
+ return lt_1;
1022
+ }
1023
+
1024
+ var eq_1;
1025
+ var hasRequiredEq;
1026
+
1027
+ function requireEq () {
1028
+ if (hasRequiredEq) return eq_1;
1029
+ hasRequiredEq = 1;
1030
+
1031
+ const compare = requireCompare();
1032
+ const eq = (a, b, loose) => compare(a, b, loose) === 0;
1033
+ eq_1 = eq;
1034
+ return eq_1;
1035
+ }
1036
+
1037
+ var neq_1;
1038
+ var hasRequiredNeq;
1039
+
1040
+ function requireNeq () {
1041
+ if (hasRequiredNeq) return neq_1;
1042
+ hasRequiredNeq = 1;
1043
+
1044
+ const compare = requireCompare();
1045
+ const neq = (a, b, loose) => compare(a, b, loose) !== 0;
1046
+ neq_1 = neq;
1047
+ return neq_1;
1048
+ }
1049
+
1050
+ var gte_1;
1051
+ var hasRequiredGte;
1052
+
1053
+ function requireGte () {
1054
+ if (hasRequiredGte) return gte_1;
1055
+ hasRequiredGte = 1;
1056
+
1057
+ const compare = requireCompare();
1058
+ const gte = (a, b, loose) => compare(a, b, loose) >= 0;
1059
+ gte_1 = gte;
1060
+ return gte_1;
1061
+ }
1062
+
1063
+ var lte_1;
1064
+ var hasRequiredLte;
1065
+
1066
+ function requireLte () {
1067
+ if (hasRequiredLte) return lte_1;
1068
+ hasRequiredLte = 1;
1069
+
1070
+ const compare = requireCompare();
1071
+ const lte = (a, b, loose) => compare(a, b, loose) <= 0;
1072
+ lte_1 = lte;
1073
+ return lte_1;
1074
+ }
1075
+
1076
+ var cmp_1;
1077
+ var hasRequiredCmp;
1078
+
1079
+ function requireCmp () {
1080
+ if (hasRequiredCmp) return cmp_1;
1081
+ hasRequiredCmp = 1;
1082
+
1083
+ const eq = requireEq();
1084
+ const neq = requireNeq();
1085
+ const gt = requireGt();
1086
+ const gte = requireGte();
1087
+ const lt = requireLt();
1088
+ const lte = requireLte();
1089
+
1090
+ const cmp = (a, op, b, loose) => {
1091
+ switch (op) {
1092
+ case '===':
1093
+ if (typeof a === 'object') {
1094
+ a = a.version;
1095
+ }
1096
+ if (typeof b === 'object') {
1097
+ b = b.version;
1098
+ }
1099
+ return a === b
1100
+
1101
+ case '!==':
1102
+ if (typeof a === 'object') {
1103
+ a = a.version;
1104
+ }
1105
+ if (typeof b === 'object') {
1106
+ b = b.version;
1107
+ }
1108
+ return a !== b
1109
+
1110
+ case '':
1111
+ case '=':
1112
+ case '==':
1113
+ return eq(a, b, loose)
1114
+
1115
+ case '!=':
1116
+ return neq(a, b, loose)
1117
+
1118
+ case '>':
1119
+ return gt(a, b, loose)
1120
+
1121
+ case '>=':
1122
+ return gte(a, b, loose)
1123
+
1124
+ case '<':
1125
+ return lt(a, b, loose)
1126
+
1127
+ case '<=':
1128
+ return lte(a, b, loose)
1129
+
1130
+ default:
1131
+ throw new TypeError(`Invalid operator: ${op}`)
1132
+ }
1133
+ };
1134
+ cmp_1 = cmp;
1135
+ return cmp_1;
1136
+ }
1137
+
1138
+ var coerce_1;
1139
+ var hasRequiredCoerce;
1140
+
1141
+ function requireCoerce () {
1142
+ if (hasRequiredCoerce) return coerce_1;
1143
+ hasRequiredCoerce = 1;
1144
+
1145
+ const SemVer = requireSemver$1();
1146
+ const parse = requireParse();
1147
+ const { safeRe: re, t } = requireRe();
1148
+
1149
+ const coerce = (version, options) => {
1150
+ if (version instanceof SemVer) {
1151
+ return version
1152
+ }
1153
+
1154
+ if (typeof version === 'number') {
1155
+ version = String(version);
1156
+ }
1157
+
1158
+ if (typeof version !== 'string') {
1159
+ return null
1160
+ }
1161
+
1162
+ options = options || {};
1163
+
1164
+ let match = null;
1165
+ if (!options.rtl) {
1166
+ match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]);
1167
+ } else {
1168
+ // Find the right-most coercible string that does not share
1169
+ // a terminus with a more left-ward coercible string.
1170
+ // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4'
1171
+ // With includePrerelease option set, '1.2.3.4-rc' wants to coerce '2.3.4-rc', not '2.3.4'
1172
+ //
1173
+ // Walk through the string checking with a /g regexp
1174
+ // Manually set the index so as to pick up overlapping matches.
1175
+ // Stop when we get a match that ends at the string end, since no
1176
+ // coercible string can be more right-ward without the same terminus.
1177
+ const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL];
1178
+ let next;
1179
+ while ((next = coerceRtlRegex.exec(version)) &&
1180
+ (!match || match.index + match[0].length !== version.length)
1181
+ ) {
1182
+ if (!match ||
1183
+ next.index + next[0].length !== match.index + match[0].length) {
1184
+ match = next;
1185
+ }
1186
+ coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
1187
+ }
1188
+ // leave it in a clean state
1189
+ coerceRtlRegex.lastIndex = -1;
1190
+ }
1191
+
1192
+ if (match === null) {
1193
+ return null
1194
+ }
1195
+
1196
+ const major = match[2];
1197
+ const minor = match[3] || '0';
1198
+ const patch = match[4] || '0';
1199
+ const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : '';
1200
+ const build = options.includePrerelease && match[6] ? `+${match[6]}` : '';
1201
+
1202
+ return parse(`${major}.${minor}.${patch}${prerelease}${build}`, options)
1203
+ };
1204
+ coerce_1 = coerce;
1205
+ return coerce_1;
1206
+ }
1207
+
1208
+ var lrucache;
1209
+ var hasRequiredLrucache;
1210
+
1211
+ function requireLrucache () {
1212
+ if (hasRequiredLrucache) return lrucache;
1213
+ hasRequiredLrucache = 1;
1214
+
1215
+ class LRUCache {
1216
+ constructor () {
1217
+ this.max = 1000;
1218
+ this.map = new Map();
1219
+ }
1220
+
1221
+ get (key) {
1222
+ const value = this.map.get(key);
1223
+ if (value === undefined) {
1224
+ return undefined
1225
+ } else {
1226
+ // Remove the key from the map and add it to the end
1227
+ this.map.delete(key);
1228
+ this.map.set(key, value);
1229
+ return value
1230
+ }
1231
+ }
1232
+
1233
+ delete (key) {
1234
+ return this.map.delete(key)
1235
+ }
1236
+
1237
+ set (key, value) {
1238
+ const deleted = this.delete(key);
1239
+
1240
+ if (!deleted && value !== undefined) {
1241
+ // If cache is full, delete the least recently used item
1242
+ if (this.map.size >= this.max) {
1243
+ const firstKey = this.map.keys().next().value;
1244
+ this.delete(firstKey);
1245
+ }
1246
+
1247
+ this.map.set(key, value);
1248
+ }
1249
+
1250
+ return this
1251
+ }
1252
+ }
1253
+
1254
+ lrucache = LRUCache;
1255
+ return lrucache;
1256
+ }
1257
+
1258
+ var range;
1259
+ var hasRequiredRange;
1260
+
1261
+ function requireRange () {
1262
+ if (hasRequiredRange) return range;
1263
+ hasRequiredRange = 1;
1264
+
1265
+ const SPACE_CHARACTERS = /\s+/g;
1266
+
1267
+ // hoisted class for cyclic dependency
1268
+ class Range {
1269
+ constructor (range, options) {
1270
+ options = parseOptions(options);
1271
+
1272
+ if (range instanceof Range) {
1273
+ if (
1274
+ range.loose === !!options.loose &&
1275
+ range.includePrerelease === !!options.includePrerelease
1276
+ ) {
1277
+ return range
1278
+ } else {
1279
+ return new Range(range.raw, options)
1280
+ }
1281
+ }
1282
+
1283
+ if (range instanceof Comparator) {
1284
+ // just put it in the set and return
1285
+ this.raw = range.value;
1286
+ this.set = [[range]];
1287
+ this.formatted = undefined;
1288
+ return this
1289
+ }
1290
+
1291
+ this.options = options;
1292
+ this.loose = !!options.loose;
1293
+ this.includePrerelease = !!options.includePrerelease;
1294
+
1295
+ // First reduce all whitespace as much as possible so we do not have to rely
1296
+ // on potentially slow regexes like \s*. This is then stored and used for
1297
+ // future error messages as well.
1298
+ this.raw = range.trim().replace(SPACE_CHARACTERS, ' ');
1299
+
1300
+ // First, split on ||
1301
+ this.set = this.raw
1302
+ .split('||')
1303
+ // map the range to a 2d array of comparators
1304
+ .map(r => this.parseRange(r.trim()))
1305
+ // throw out any comparator lists that are empty
1306
+ // this generally means that it was not a valid range, which is allowed
1307
+ // in loose mode, but will still throw if the WHOLE range is invalid.
1308
+ .filter(c => c.length);
1309
+
1310
+ if (!this.set.length) {
1311
+ throw new TypeError(`Invalid SemVer Range: ${this.raw}`)
1312
+ }
1313
+
1314
+ // if we have any that are not the null set, throw out null sets.
1315
+ if (this.set.length > 1) {
1316
+ // keep the first one, in case they're all null sets
1317
+ const first = this.set[0];
1318
+ this.set = this.set.filter(c => !isNullSet(c[0]));
1319
+ if (this.set.length === 0) {
1320
+ this.set = [first];
1321
+ } else if (this.set.length > 1) {
1322
+ // if we have any that are *, then the range is just *
1323
+ for (const c of this.set) {
1324
+ if (c.length === 1 && isAny(c[0])) {
1325
+ this.set = [c];
1326
+ break
1327
+ }
1328
+ }
1329
+ }
1330
+ }
1331
+
1332
+ this.formatted = undefined;
1333
+ }
1334
+
1335
+ get range () {
1336
+ if (this.formatted === undefined) {
1337
+ this.formatted = '';
1338
+ for (let i = 0; i < this.set.length; i++) {
1339
+ if (i > 0) {
1340
+ this.formatted += '||';
1341
+ }
1342
+ const comps = this.set[i];
1343
+ for (let k = 0; k < comps.length; k++) {
1344
+ if (k > 0) {
1345
+ this.formatted += ' ';
1346
+ }
1347
+ this.formatted += comps[k].toString().trim();
1348
+ }
1349
+ }
1350
+ }
1351
+ return this.formatted
1352
+ }
1353
+
1354
+ format () {
1355
+ return this.range
1356
+ }
1357
+
1358
+ toString () {
1359
+ return this.range
1360
+ }
1361
+
1362
+ parseRange (range) {
1363
+ // memoize range parsing for performance.
1364
+ // this is a very hot path, and fully deterministic.
1365
+ const memoOpts =
1366
+ (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) |
1367
+ (this.options.loose && FLAG_LOOSE);
1368
+ const memoKey = memoOpts + ':' + range;
1369
+ const cached = cache.get(memoKey);
1370
+ if (cached) {
1371
+ return cached
1372
+ }
1373
+
1374
+ const loose = this.options.loose;
1375
+ // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
1376
+ const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
1377
+ range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
1378
+ debug('hyphen replace', range);
1379
+
1380
+ // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
1381
+ range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
1382
+ debug('comparator trim', range);
1383
+
1384
+ // `~ 1.2.3` => `~1.2.3`
1385
+ range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
1386
+ debug('tilde trim', range);
1387
+
1388
+ // `^ 1.2.3` => `^1.2.3`
1389
+ range = range.replace(re[t.CARETTRIM], caretTrimReplace);
1390
+ debug('caret trim', range);
1391
+
1392
+ // At this point, the range is completely trimmed and
1393
+ // ready to be split into comparators.
1394
+
1395
+ let rangeList = range
1396
+ .split(' ')
1397
+ .map(comp => parseComparator(comp, this.options))
1398
+ .join(' ')
1399
+ .split(/\s+/)
1400
+ // >=0.0.0 is equivalent to *
1401
+ .map(comp => replaceGTE0(comp, this.options));
1402
+
1403
+ if (loose) {
1404
+ // in loose mode, throw out any that are not valid comparators
1405
+ rangeList = rangeList.filter(comp => {
1406
+ debug('loose invalid filter', comp, this.options);
1407
+ return !!comp.match(re[t.COMPARATORLOOSE])
1408
+ });
1409
+ }
1410
+ debug('range list', rangeList);
1411
+
1412
+ // if any comparators are the null set, then replace with JUST null set
1413
+ // if more than one comparator, remove any * comparators
1414
+ // also, don't include the same comparator more than once
1415
+ const rangeMap = new Map();
1416
+ const comparators = rangeList.map(comp => new Comparator(comp, this.options));
1417
+ for (const comp of comparators) {
1418
+ if (isNullSet(comp)) {
1419
+ return [comp]
1420
+ }
1421
+ rangeMap.set(comp.value, comp);
1422
+ }
1423
+ if (rangeMap.size > 1 && rangeMap.has('')) {
1424
+ rangeMap.delete('');
1425
+ }
1426
+
1427
+ const result = [...rangeMap.values()];
1428
+ cache.set(memoKey, result);
1429
+ return result
1430
+ }
1431
+
1432
+ intersects (range, options) {
1433
+ if (!(range instanceof Range)) {
1434
+ throw new TypeError('a Range is required')
1435
+ }
1436
+
1437
+ return this.set.some((thisComparators) => {
1438
+ return (
1439
+ isSatisfiable(thisComparators, options) &&
1440
+ range.set.some((rangeComparators) => {
1441
+ return (
1442
+ isSatisfiable(rangeComparators, options) &&
1443
+ thisComparators.every((thisComparator) => {
1444
+ return rangeComparators.every((rangeComparator) => {
1445
+ return thisComparator.intersects(rangeComparator, options)
1446
+ })
1447
+ })
1448
+ )
1449
+ })
1450
+ )
1451
+ })
1452
+ }
1453
+
1454
+ // if ANY of the sets match ALL of its comparators, then pass
1455
+ test (version) {
1456
+ if (!version) {
1457
+ return false
1458
+ }
1459
+
1460
+ if (typeof version === 'string') {
1461
+ try {
1462
+ version = new SemVer(version, this.options);
1463
+ } catch (er) {
1464
+ return false
1465
+ }
1466
+ }
1467
+
1468
+ for (let i = 0; i < this.set.length; i++) {
1469
+ if (testSet(this.set[i], version, this.options)) {
1470
+ return true
1471
+ }
1472
+ }
1473
+ return false
1474
+ }
1475
+ }
1476
+
1477
+ range = Range;
1478
+
1479
+ const LRU = requireLrucache();
1480
+ const cache = new LRU();
1481
+
1482
+ const parseOptions = requireParseOptions();
1483
+ const Comparator = requireComparator();
1484
+ const debug = requireDebug();
1485
+ const SemVer = requireSemver$1();
1486
+ const {
1487
+ safeRe: re,
1488
+ t,
1489
+ comparatorTrimReplace,
1490
+ tildeTrimReplace,
1491
+ caretTrimReplace,
1492
+ } = requireRe();
1493
+ const { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = requireConstants();
1494
+
1495
+ const isNullSet = c => c.value === '<0.0.0-0';
1496
+ const isAny = c => c.value === '';
1497
+
1498
+ // take a set of comparators and determine whether there
1499
+ // exists a version which can satisfy it
1500
+ const isSatisfiable = (comparators, options) => {
1501
+ let result = true;
1502
+ const remainingComparators = comparators.slice();
1503
+ let testComparator = remainingComparators.pop();
1504
+
1505
+ while (result && remainingComparators.length) {
1506
+ result = remainingComparators.every((otherComparator) => {
1507
+ return testComparator.intersects(otherComparator, options)
1508
+ });
1509
+
1510
+ testComparator = remainingComparators.pop();
1511
+ }
1512
+
1513
+ return result
1514
+ };
1515
+
1516
+ // comprised of xranges, tildes, stars, and gtlt's at this point.
1517
+ // already replaced the hyphen ranges
1518
+ // turn into a set of JUST comparators.
1519
+ const parseComparator = (comp, options) => {
1520
+ comp = comp.replace(re[t.BUILD], '');
1521
+ debug('comp', comp, options);
1522
+ comp = replaceCarets(comp, options);
1523
+ debug('caret', comp);
1524
+ comp = replaceTildes(comp, options);
1525
+ debug('tildes', comp);
1526
+ comp = replaceXRanges(comp, options);
1527
+ debug('xrange', comp);
1528
+ comp = replaceStars(comp, options);
1529
+ debug('stars', comp);
1530
+ return comp
1531
+ };
1532
+
1533
+ const isX = id => !id || id.toLowerCase() === 'x' || id === '*';
1534
+
1535
+ // ~, ~> --> * (any, kinda silly)
1536
+ // ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0
1537
+ // ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0
1538
+ // ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0
1539
+ // ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0
1540
+ // ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0
1541
+ // ~0.0.1 --> >=0.0.1 <0.1.0-0
1542
+ const replaceTildes = (comp, options) => {
1543
+ return comp
1544
+ .trim()
1545
+ .split(/\s+/)
1546
+ .map((c) => replaceTilde(c, options))
1547
+ .join(' ')
1548
+ };
1549
+
1550
+ const replaceTilde = (comp, options) => {
1551
+ const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
1552
+ return comp.replace(r, (_, M, m, p, pr) => {
1553
+ debug('tilde', comp, _, M, m, p, pr);
1554
+ let ret;
1555
+
1556
+ if (isX(M)) {
1557
+ ret = '';
1558
+ } else if (isX(m)) {
1559
+ ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
1560
+ } else if (isX(p)) {
1561
+ // ~1.2 == >=1.2.0 <1.3.0-0
1562
+ ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
1563
+ } else if (pr) {
1564
+ debug('replaceTilde pr', pr);
1565
+ ret = `>=${M}.${m}.${p}-${pr
1566
+ } <${M}.${+m + 1}.0-0`;
1567
+ } else {
1568
+ // ~1.2.3 == >=1.2.3 <1.3.0-0
1569
+ ret = `>=${M}.${m}.${p
1570
+ } <${M}.${+m + 1}.0-0`;
1571
+ }
1572
+
1573
+ debug('tilde return', ret);
1574
+ return ret
1575
+ })
1576
+ };
1577
+
1578
+ // ^ --> * (any, kinda silly)
1579
+ // ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0
1580
+ // ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0
1581
+ // ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0
1582
+ // ^1.2.3 --> >=1.2.3 <2.0.0-0
1583
+ // ^1.2.0 --> >=1.2.0 <2.0.0-0
1584
+ // ^0.0.1 --> >=0.0.1 <0.0.2-0
1585
+ // ^0.1.0 --> >=0.1.0 <0.2.0-0
1586
+ const replaceCarets = (comp, options) => {
1587
+ return comp
1588
+ .trim()
1589
+ .split(/\s+/)
1590
+ .map((c) => replaceCaret(c, options))
1591
+ .join(' ')
1592
+ };
1593
+
1594
+ const replaceCaret = (comp, options) => {
1595
+ debug('caret', comp, options);
1596
+ const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
1597
+ const z = options.includePrerelease ? '-0' : '';
1598
+ return comp.replace(r, (_, M, m, p, pr) => {
1599
+ debug('caret', comp, _, M, m, p, pr);
1600
+ let ret;
1601
+
1602
+ if (isX(M)) {
1603
+ ret = '';
1604
+ } else if (isX(m)) {
1605
+ ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
1606
+ } else if (isX(p)) {
1607
+ if (M === '0') {
1608
+ ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
1609
+ } else {
1610
+ ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
1611
+ }
1612
+ } else if (pr) {
1613
+ debug('replaceCaret pr', pr);
1614
+ if (M === '0') {
1615
+ if (m === '0') {
1616
+ ret = `>=${M}.${m}.${p}-${pr
1617
+ } <${M}.${m}.${+p + 1}-0`;
1618
+ } else {
1619
+ ret = `>=${M}.${m}.${p}-${pr
1620
+ } <${M}.${+m + 1}.0-0`;
1621
+ }
1622
+ } else {
1623
+ ret = `>=${M}.${m}.${p}-${pr
1624
+ } <${+M + 1}.0.0-0`;
1625
+ }
1626
+ } else {
1627
+ debug('no pr');
1628
+ if (M === '0') {
1629
+ if (m === '0') {
1630
+ ret = `>=${M}.${m}.${p
1631
+ }${z} <${M}.${m}.${+p + 1}-0`;
1632
+ } else {
1633
+ ret = `>=${M}.${m}.${p
1634
+ }${z} <${M}.${+m + 1}.0-0`;
1635
+ }
1636
+ } else {
1637
+ ret = `>=${M}.${m}.${p
1638
+ } <${+M + 1}.0.0-0`;
1639
+ }
1640
+ }
1641
+
1642
+ debug('caret return', ret);
1643
+ return ret
1644
+ })
1645
+ };
1646
+
1647
+ const replaceXRanges = (comp, options) => {
1648
+ debug('replaceXRanges', comp, options);
1649
+ return comp
1650
+ .split(/\s+/)
1651
+ .map((c) => replaceXRange(c, options))
1652
+ .join(' ')
1653
+ };
1654
+
1655
+ const replaceXRange = (comp, options) => {
1656
+ comp = comp.trim();
1657
+ const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
1658
+ return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
1659
+ debug('xRange', comp, ret, gtlt, M, m, p, pr);
1660
+ const xM = isX(M);
1661
+ const xm = xM || isX(m);
1662
+ const xp = xm || isX(p);
1663
+ const anyX = xp;
1664
+
1665
+ if (gtlt === '=' && anyX) {
1666
+ gtlt = '';
1667
+ }
1668
+
1669
+ // if we're including prereleases in the match, then we need
1670
+ // to fix this to -0, the lowest possible prerelease value
1671
+ pr = options.includePrerelease ? '-0' : '';
1672
+
1673
+ if (xM) {
1674
+ if (gtlt === '>' || gtlt === '<') {
1675
+ // nothing is allowed
1676
+ ret = '<0.0.0-0';
1677
+ } else {
1678
+ // nothing is forbidden
1679
+ ret = '*';
1680
+ }
1681
+ } else if (gtlt && anyX) {
1682
+ // we know patch is an x, because we have any x at all.
1683
+ // replace X with 0
1684
+ if (xm) {
1685
+ m = 0;
1686
+ }
1687
+ p = 0;
1688
+
1689
+ if (gtlt === '>') {
1690
+ // >1 => >=2.0.0
1691
+ // >1.2 => >=1.3.0
1692
+ gtlt = '>=';
1693
+ if (xm) {
1694
+ M = +M + 1;
1695
+ m = 0;
1696
+ p = 0;
1697
+ } else {
1698
+ m = +m + 1;
1699
+ p = 0;
1700
+ }
1701
+ } else if (gtlt === '<=') {
1702
+ // <=0.7.x is actually <0.8.0, since any 0.7.x should
1703
+ // pass. Similarly, <=7.x is actually <8.0.0, etc.
1704
+ gtlt = '<';
1705
+ if (xm) {
1706
+ M = +M + 1;
1707
+ } else {
1708
+ m = +m + 1;
1709
+ }
1710
+ }
1711
+
1712
+ if (gtlt === '<') {
1713
+ pr = '-0';
1714
+ }
1715
+
1716
+ ret = `${gtlt + M}.${m}.${p}${pr}`;
1717
+ } else if (xm) {
1718
+ ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
1719
+ } else if (xp) {
1720
+ ret = `>=${M}.${m}.0${pr
1721
+ } <${M}.${+m + 1}.0-0`;
1722
+ }
1723
+
1724
+ debug('xRange return', ret);
1725
+
1726
+ return ret
1727
+ })
1728
+ };
1729
+
1730
+ // Because * is AND-ed with everything else in the comparator,
1731
+ // and '' means "any version", just remove the *s entirely.
1732
+ const replaceStars = (comp, options) => {
1733
+ debug('replaceStars', comp, options);
1734
+ // Looseness is ignored here. star is always as loose as it gets!
1735
+ return comp
1736
+ .trim()
1737
+ .replace(re[t.STAR], '')
1738
+ };
1739
+
1740
+ const replaceGTE0 = (comp, options) => {
1741
+ debug('replaceGTE0', comp, options);
1742
+ return comp
1743
+ .trim()
1744
+ .replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '')
1745
+ };
1746
+
1747
+ // This function is passed to string.replace(re[t.HYPHENRANGE])
1748
+ // M, m, patch, prerelease, build
1749
+ // 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
1750
+ // 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do
1751
+ // 1.2 - 3.4 => >=1.2.0 <3.5.0-0
1752
+ // TODO build?
1753
+ const hyphenReplace = incPr => ($0,
1754
+ from, fM, fm, fp, fpr, fb,
1755
+ to, tM, tm, tp, tpr) => {
1756
+ if (isX(fM)) {
1757
+ from = '';
1758
+ } else if (isX(fm)) {
1759
+ from = `>=${fM}.0.0${incPr ? '-0' : ''}`;
1760
+ } else if (isX(fp)) {
1761
+ from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}`;
1762
+ } else if (fpr) {
1763
+ from = `>=${from}`;
1764
+ } else {
1765
+ from = `>=${from}${incPr ? '-0' : ''}`;
1766
+ }
1767
+
1768
+ if (isX(tM)) {
1769
+ to = '';
1770
+ } else if (isX(tm)) {
1771
+ to = `<${+tM + 1}.0.0-0`;
1772
+ } else if (isX(tp)) {
1773
+ to = `<${tM}.${+tm + 1}.0-0`;
1774
+ } else if (tpr) {
1775
+ to = `<=${tM}.${tm}.${tp}-${tpr}`;
1776
+ } else if (incPr) {
1777
+ to = `<${tM}.${tm}.${+tp + 1}-0`;
1778
+ } else {
1779
+ to = `<=${to}`;
1780
+ }
1781
+
1782
+ return `${from} ${to}`.trim()
1783
+ };
1784
+
1785
+ const testSet = (set, version, options) => {
1786
+ for (let i = 0; i < set.length; i++) {
1787
+ if (!set[i].test(version)) {
1788
+ return false
1789
+ }
1790
+ }
1791
+
1792
+ if (version.prerelease.length && !options.includePrerelease) {
1793
+ // Find the set of versions that are allowed to have prereleases
1794
+ // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0
1795
+ // That should allow `1.2.3-pr.2` to pass.
1796
+ // However, `1.2.4-alpha.notready` should NOT be allowed,
1797
+ // even though it's within the range set by the comparators.
1798
+ for (let i = 0; i < set.length; i++) {
1799
+ debug(set[i].semver);
1800
+ if (set[i].semver === Comparator.ANY) {
1801
+ continue
1802
+ }
1803
+
1804
+ if (set[i].semver.prerelease.length > 0) {
1805
+ const allowed = set[i].semver;
1806
+ if (allowed.major === version.major &&
1807
+ allowed.minor === version.minor &&
1808
+ allowed.patch === version.patch) {
1809
+ return true
1810
+ }
1811
+ }
1812
+ }
1813
+
1814
+ // Version has a -pre, but it's not one of the ones we like.
1815
+ return false
1816
+ }
1817
+
1818
+ return true
1819
+ };
1820
+ return range;
1821
+ }
1822
+
1823
+ var comparator;
1824
+ var hasRequiredComparator;
1825
+
1826
+ function requireComparator () {
1827
+ if (hasRequiredComparator) return comparator;
1828
+ hasRequiredComparator = 1;
1829
+
1830
+ const ANY = Symbol('SemVer ANY');
1831
+ // hoisted class for cyclic dependency
1832
+ class Comparator {
1833
+ static get ANY () {
1834
+ return ANY
1835
+ }
1836
+
1837
+ constructor (comp, options) {
1838
+ options = parseOptions(options);
1839
+
1840
+ if (comp instanceof Comparator) {
1841
+ if (comp.loose === !!options.loose) {
1842
+ return comp
1843
+ } else {
1844
+ comp = comp.value;
1845
+ }
1846
+ }
1847
+
1848
+ comp = comp.trim().split(/\s+/).join(' ');
1849
+ debug('comparator', comp, options);
1850
+ this.options = options;
1851
+ this.loose = !!options.loose;
1852
+ this.parse(comp);
1853
+
1854
+ if (this.semver === ANY) {
1855
+ this.value = '';
1856
+ } else {
1857
+ this.value = this.operator + this.semver.version;
1858
+ }
1859
+
1860
+ debug('comp', this);
1861
+ }
1862
+
1863
+ parse (comp) {
1864
+ const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
1865
+ const m = comp.match(r);
1866
+
1867
+ if (!m) {
1868
+ throw new TypeError(`Invalid comparator: ${comp}`)
1869
+ }
1870
+
1871
+ this.operator = m[1] !== undefined ? m[1] : '';
1872
+ if (this.operator === '=') {
1873
+ this.operator = '';
1874
+ }
1875
+
1876
+ // if it literally is just '>' or '' then allow anything.
1877
+ if (!m[2]) {
1878
+ this.semver = ANY;
1879
+ } else {
1880
+ this.semver = new SemVer(m[2], this.options.loose);
1881
+ }
1882
+ }
1883
+
1884
+ toString () {
1885
+ return this.value
1886
+ }
1887
+
1888
+ test (version) {
1889
+ debug('Comparator.test', version, this.options.loose);
1890
+
1891
+ if (this.semver === ANY || version === ANY) {
1892
+ return true
1893
+ }
1894
+
1895
+ if (typeof version === 'string') {
1896
+ try {
1897
+ version = new SemVer(version, this.options);
1898
+ } catch (er) {
1899
+ return false
1900
+ }
1901
+ }
1902
+
1903
+ return cmp(version, this.operator, this.semver, this.options)
1904
+ }
1905
+
1906
+ intersects (comp, options) {
1907
+ if (!(comp instanceof Comparator)) {
1908
+ throw new TypeError('a Comparator is required')
1909
+ }
1910
+
1911
+ if (this.operator === '') {
1912
+ if (this.value === '') {
1913
+ return true
1914
+ }
1915
+ return new Range(comp.value, options).test(this.value)
1916
+ } else if (comp.operator === '') {
1917
+ if (comp.value === '') {
1918
+ return true
1919
+ }
1920
+ return new Range(this.value, options).test(comp.semver)
1921
+ }
1922
+
1923
+ options = parseOptions(options);
1924
+
1925
+ // Special cases where nothing can possibly be lower
1926
+ if (options.includePrerelease &&
1927
+ (this.value === '<0.0.0-0' || comp.value === '<0.0.0-0')) {
1928
+ return false
1929
+ }
1930
+ if (!options.includePrerelease &&
1931
+ (this.value.startsWith('<0.0.0') || comp.value.startsWith('<0.0.0'))) {
1932
+ return false
1933
+ }
1934
+
1935
+ // Same direction increasing (> or >=)
1936
+ if (this.operator.startsWith('>') && comp.operator.startsWith('>')) {
1937
+ return true
1938
+ }
1939
+ // Same direction decreasing (< or <=)
1940
+ if (this.operator.startsWith('<') && comp.operator.startsWith('<')) {
1941
+ return true
1942
+ }
1943
+ // same SemVer and both sides are inclusive (<= or >=)
1944
+ if (
1945
+ (this.semver.version === comp.semver.version) &&
1946
+ this.operator.includes('=') && comp.operator.includes('=')) {
1947
+ return true
1948
+ }
1949
+ // opposite directions less than
1950
+ if (cmp(this.semver, '<', comp.semver, options) &&
1951
+ this.operator.startsWith('>') && comp.operator.startsWith('<')) {
1952
+ return true
1953
+ }
1954
+ // opposite directions greater than
1955
+ if (cmp(this.semver, '>', comp.semver, options) &&
1956
+ this.operator.startsWith('<') && comp.operator.startsWith('>')) {
1957
+ return true
1958
+ }
1959
+ return false
1960
+ }
1961
+ }
1962
+
1963
+ comparator = Comparator;
1964
+
1965
+ const parseOptions = requireParseOptions();
1966
+ const { safeRe: re, t } = requireRe();
1967
+ const cmp = requireCmp();
1968
+ const debug = requireDebug();
1969
+ const SemVer = requireSemver$1();
1970
+ const Range = requireRange();
1971
+ return comparator;
1972
+ }
1973
+
1974
+ var satisfies_1;
1975
+ var hasRequiredSatisfies;
1976
+
1977
+ function requireSatisfies () {
1978
+ if (hasRequiredSatisfies) return satisfies_1;
1979
+ hasRequiredSatisfies = 1;
1980
+
1981
+ const Range = requireRange();
1982
+ const satisfies = (version, range, options) => {
1983
+ try {
1984
+ range = new Range(range, options);
1985
+ } catch (er) {
1986
+ return false
1987
+ }
1988
+ return range.test(version)
1989
+ };
1990
+ satisfies_1 = satisfies;
1991
+ return satisfies_1;
1992
+ }
1993
+
1994
+ var toComparators_1;
1995
+ var hasRequiredToComparators;
1996
+
1997
+ function requireToComparators () {
1998
+ if (hasRequiredToComparators) return toComparators_1;
1999
+ hasRequiredToComparators = 1;
2000
+
2001
+ const Range = requireRange();
2002
+
2003
+ // Mostly just for testing and legacy API reasons
2004
+ const toComparators = (range, options) =>
2005
+ new Range(range, options).set
2006
+ .map(comp => comp.map(c => c.value).join(' ').trim().split(' '));
2007
+
2008
+ toComparators_1 = toComparators;
2009
+ return toComparators_1;
2010
+ }
2011
+
2012
+ var maxSatisfying_1;
2013
+ var hasRequiredMaxSatisfying;
2014
+
2015
+ function requireMaxSatisfying () {
2016
+ if (hasRequiredMaxSatisfying) return maxSatisfying_1;
2017
+ hasRequiredMaxSatisfying = 1;
2018
+
2019
+ const SemVer = requireSemver$1();
2020
+ const Range = requireRange();
2021
+
2022
+ const maxSatisfying = (versions, range, options) => {
2023
+ let max = null;
2024
+ let maxSV = null;
2025
+ let rangeObj = null;
2026
+ try {
2027
+ rangeObj = new Range(range, options);
2028
+ } catch (er) {
2029
+ return null
2030
+ }
2031
+ versions.forEach((v) => {
2032
+ if (rangeObj.test(v)) {
2033
+ // satisfies(v, range, options)
2034
+ if (!max || maxSV.compare(v) === -1) {
2035
+ // compare(max, v, true)
2036
+ max = v;
2037
+ maxSV = new SemVer(max, options);
2038
+ }
2039
+ }
2040
+ });
2041
+ return max
2042
+ };
2043
+ maxSatisfying_1 = maxSatisfying;
2044
+ return maxSatisfying_1;
2045
+ }
2046
+
2047
+ var minSatisfying_1;
2048
+ var hasRequiredMinSatisfying;
2049
+
2050
+ function requireMinSatisfying () {
2051
+ if (hasRequiredMinSatisfying) return minSatisfying_1;
2052
+ hasRequiredMinSatisfying = 1;
2053
+
2054
+ const SemVer = requireSemver$1();
2055
+ const Range = requireRange();
2056
+ const minSatisfying = (versions, range, options) => {
2057
+ let min = null;
2058
+ let minSV = null;
2059
+ let rangeObj = null;
2060
+ try {
2061
+ rangeObj = new Range(range, options);
2062
+ } catch (er) {
2063
+ return null
2064
+ }
2065
+ versions.forEach((v) => {
2066
+ if (rangeObj.test(v)) {
2067
+ // satisfies(v, range, options)
2068
+ if (!min || minSV.compare(v) === 1) {
2069
+ // compare(min, v, true)
2070
+ min = v;
2071
+ minSV = new SemVer(min, options);
2072
+ }
2073
+ }
2074
+ });
2075
+ return min
2076
+ };
2077
+ minSatisfying_1 = minSatisfying;
2078
+ return minSatisfying_1;
2079
+ }
2080
+
2081
+ var minVersion_1;
2082
+ var hasRequiredMinVersion;
2083
+
2084
+ function requireMinVersion () {
2085
+ if (hasRequiredMinVersion) return minVersion_1;
2086
+ hasRequiredMinVersion = 1;
2087
+
2088
+ const SemVer = requireSemver$1();
2089
+ const Range = requireRange();
2090
+ const gt = requireGt();
2091
+
2092
+ const minVersion = (range, loose) => {
2093
+ range = new Range(range, loose);
2094
+
2095
+ let minver = new SemVer('0.0.0');
2096
+ if (range.test(minver)) {
2097
+ return minver
2098
+ }
2099
+
2100
+ minver = new SemVer('0.0.0-0');
2101
+ if (range.test(minver)) {
2102
+ return minver
2103
+ }
2104
+
2105
+ minver = null;
2106
+ for (let i = 0; i < range.set.length; ++i) {
2107
+ const comparators = range.set[i];
2108
+
2109
+ let setMin = null;
2110
+ comparators.forEach((comparator) => {
2111
+ // Clone to avoid manipulating the comparator's semver object.
2112
+ const compver = new SemVer(comparator.semver.version);
2113
+ switch (comparator.operator) {
2114
+ case '>':
2115
+ if (compver.prerelease.length === 0) {
2116
+ compver.patch++;
2117
+ } else {
2118
+ compver.prerelease.push(0);
2119
+ }
2120
+ compver.raw = compver.format();
2121
+ /* fallthrough */
2122
+ case '':
2123
+ case '>=':
2124
+ if (!setMin || gt(compver, setMin)) {
2125
+ setMin = compver;
2126
+ }
2127
+ break
2128
+ case '<':
2129
+ case '<=':
2130
+ /* Ignore maximum versions */
2131
+ break
2132
+ /* istanbul ignore next */
2133
+ default:
2134
+ throw new Error(`Unexpected operation: ${comparator.operator}`)
2135
+ }
2136
+ });
2137
+ if (setMin && (!minver || gt(minver, setMin))) {
2138
+ minver = setMin;
2139
+ }
2140
+ }
2141
+
2142
+ if (minver && range.test(minver)) {
2143
+ return minver
2144
+ }
2145
+
2146
+ return null
2147
+ };
2148
+ minVersion_1 = minVersion;
2149
+ return minVersion_1;
2150
+ }
2151
+
2152
+ var valid;
2153
+ var hasRequiredValid;
2154
+
2155
+ function requireValid () {
2156
+ if (hasRequiredValid) return valid;
2157
+ hasRequiredValid = 1;
2158
+
2159
+ const Range = requireRange();
2160
+ const validRange = (range, options) => {
2161
+ try {
2162
+ // Return '*' instead of '' so that truthiness works.
2163
+ // This will throw if it's invalid anyway
2164
+ return new Range(range, options).range || '*'
2165
+ } catch (er) {
2166
+ return null
2167
+ }
2168
+ };
2169
+ valid = validRange;
2170
+ return valid;
2171
+ }
2172
+
2173
+ var outside_1;
2174
+ var hasRequiredOutside;
2175
+
2176
+ function requireOutside () {
2177
+ if (hasRequiredOutside) return outside_1;
2178
+ hasRequiredOutside = 1;
2179
+
2180
+ const SemVer = requireSemver$1();
2181
+ const Comparator = requireComparator();
2182
+ const { ANY } = Comparator;
2183
+ const Range = requireRange();
2184
+ const satisfies = requireSatisfies();
2185
+ const gt = requireGt();
2186
+ const lt = requireLt();
2187
+ const lte = requireLte();
2188
+ const gte = requireGte();
2189
+
2190
+ const outside = (version, range, hilo, options) => {
2191
+ version = new SemVer(version, options);
2192
+ range = new Range(range, options);
2193
+
2194
+ let gtfn, ltefn, ltfn, comp, ecomp;
2195
+ switch (hilo) {
2196
+ case '>':
2197
+ gtfn = gt;
2198
+ ltefn = lte;
2199
+ ltfn = lt;
2200
+ comp = '>';
2201
+ ecomp = '>=';
2202
+ break
2203
+ case '<':
2204
+ gtfn = lt;
2205
+ ltefn = gte;
2206
+ ltfn = gt;
2207
+ comp = '<';
2208
+ ecomp = '<=';
2209
+ break
2210
+ default:
2211
+ throw new TypeError('Must provide a hilo val of "<" or ">"')
2212
+ }
2213
+
2214
+ // If it satisfies the range it is not outside
2215
+ if (satisfies(version, range, options)) {
2216
+ return false
2217
+ }
2218
+
2219
+ // From now on, variable terms are as if we're in "gtr" mode.
2220
+ // but note that everything is flipped for the "ltr" function.
2221
+
2222
+ for (let i = 0; i < range.set.length; ++i) {
2223
+ const comparators = range.set[i];
2224
+
2225
+ let high = null;
2226
+ let low = null;
2227
+
2228
+ comparators.forEach((comparator) => {
2229
+ if (comparator.semver === ANY) {
2230
+ comparator = new Comparator('>=0.0.0');
2231
+ }
2232
+ high = high || comparator;
2233
+ low = low || comparator;
2234
+ if (gtfn(comparator.semver, high.semver, options)) {
2235
+ high = comparator;
2236
+ } else if (ltfn(comparator.semver, low.semver, options)) {
2237
+ low = comparator;
2238
+ }
2239
+ });
2240
+
2241
+ // If the edge version comparator has a operator then our version
2242
+ // isn't outside it
2243
+ if (high.operator === comp || high.operator === ecomp) {
2244
+ return false
2245
+ }
2246
+
2247
+ // If the lowest version comparator has an operator and our version
2248
+ // is less than it then it isn't higher than the range
2249
+ if ((!low.operator || low.operator === comp) &&
2250
+ ltefn(version, low.semver)) {
2251
+ return false
2252
+ } else if (low.operator === ecomp && ltfn(version, low.semver)) {
2253
+ return false
2254
+ }
2255
+ }
2256
+ return true
2257
+ };
2258
+
2259
+ outside_1 = outside;
2260
+ return outside_1;
2261
+ }
2262
+
2263
+ var gtr_1;
2264
+ var hasRequiredGtr;
2265
+
2266
+ function requireGtr () {
2267
+ if (hasRequiredGtr) return gtr_1;
2268
+ hasRequiredGtr = 1;
2269
+
2270
+ // Determine if version is greater than all the versions possible in the range.
2271
+ const outside = requireOutside();
2272
+ const gtr = (version, range, options) => outside(version, range, '>', options);
2273
+ gtr_1 = gtr;
2274
+ return gtr_1;
2275
+ }
2276
+
2277
+ var ltr_1;
2278
+ var hasRequiredLtr;
2279
+
2280
+ function requireLtr () {
2281
+ if (hasRequiredLtr) return ltr_1;
2282
+ hasRequiredLtr = 1;
2283
+
2284
+ const outside = requireOutside();
2285
+ // Determine if version is less than all the versions possible in the range
2286
+ const ltr = (version, range, options) => outside(version, range, '<', options);
2287
+ ltr_1 = ltr;
2288
+ return ltr_1;
2289
+ }
2290
+
2291
+ var intersects_1;
2292
+ var hasRequiredIntersects;
2293
+
2294
+ function requireIntersects () {
2295
+ if (hasRequiredIntersects) return intersects_1;
2296
+ hasRequiredIntersects = 1;
2297
+
2298
+ const Range = requireRange();
2299
+ const intersects = (r1, r2, options) => {
2300
+ r1 = new Range(r1, options);
2301
+ r2 = new Range(r2, options);
2302
+ return r1.intersects(r2, options)
2303
+ };
2304
+ intersects_1 = intersects;
2305
+ return intersects_1;
2306
+ }
2307
+
2308
+ var simplify;
2309
+ var hasRequiredSimplify;
2310
+
2311
+ function requireSimplify () {
2312
+ if (hasRequiredSimplify) return simplify;
2313
+ hasRequiredSimplify = 1;
2314
+
2315
+ // given a set of versions and a range, create a "simplified" range
2316
+ // that includes the same versions that the original range does
2317
+ // If the original range is shorter than the simplified one, return that.
2318
+ const satisfies = requireSatisfies();
2319
+ const compare = requireCompare();
2320
+ simplify = (versions, range, options) => {
2321
+ const set = [];
2322
+ let first = null;
2323
+ let prev = null;
2324
+ const v = versions.sort((a, b) => compare(a, b, options));
2325
+ for (const version of v) {
2326
+ const included = satisfies(version, range, options);
2327
+ if (included) {
2328
+ prev = version;
2329
+ if (!first) {
2330
+ first = version;
2331
+ }
2332
+ } else {
2333
+ if (prev) {
2334
+ set.push([first, prev]);
2335
+ }
2336
+ prev = null;
2337
+ first = null;
2338
+ }
2339
+ }
2340
+ if (first) {
2341
+ set.push([first, null]);
2342
+ }
2343
+
2344
+ const ranges = [];
2345
+ for (const [min, max] of set) {
2346
+ if (min === max) {
2347
+ ranges.push(min);
2348
+ } else if (!max && min === v[0]) {
2349
+ ranges.push('*');
2350
+ } else if (!max) {
2351
+ ranges.push(`>=${min}`);
2352
+ } else if (min === v[0]) {
2353
+ ranges.push(`<=${max}`);
2354
+ } else {
2355
+ ranges.push(`${min} - ${max}`);
2356
+ }
2357
+ }
2358
+ const simplified = ranges.join(' || ');
2359
+ const original = typeof range.raw === 'string' ? range.raw : String(range);
2360
+ return simplified.length < original.length ? simplified : range
2361
+ };
2362
+ return simplify;
2363
+ }
2364
+
2365
+ var subset_1;
2366
+ var hasRequiredSubset;
2367
+
2368
+ function requireSubset () {
2369
+ if (hasRequiredSubset) return subset_1;
2370
+ hasRequiredSubset = 1;
2371
+
2372
+ const Range = requireRange();
2373
+ const Comparator = requireComparator();
2374
+ const { ANY } = Comparator;
2375
+ const satisfies = requireSatisfies();
2376
+ const compare = requireCompare();
2377
+
2378
+ // Complex range `r1 || r2 || ...` is a subset of `R1 || R2 || ...` iff:
2379
+ // - Every simple range `r1, r2, ...` is a null set, OR
2380
+ // - Every simple range `r1, r2, ...` which is not a null set is a subset of
2381
+ // some `R1, R2, ...`
2382
+ //
2383
+ // Simple range `c1 c2 ...` is a subset of simple range `C1 C2 ...` iff:
2384
+ // - If c is only the ANY comparator
2385
+ // - If C is only the ANY comparator, return true
2386
+ // - Else if in prerelease mode, return false
2387
+ // - else replace c with `[>=0.0.0]`
2388
+ // - If C is only the ANY comparator
2389
+ // - if in prerelease mode, return true
2390
+ // - else replace C with `[>=0.0.0]`
2391
+ // - Let EQ be the set of = comparators in c
2392
+ // - If EQ is more than one, return true (null set)
2393
+ // - Let GT be the highest > or >= comparator in c
2394
+ // - Let LT be the lowest < or <= comparator in c
2395
+ // - If GT and LT, and GT.semver > LT.semver, return true (null set)
2396
+ // - If any C is a = range, and GT or LT are set, return false
2397
+ // - If EQ
2398
+ // - If GT, and EQ does not satisfy GT, return true (null set)
2399
+ // - If LT, and EQ does not satisfy LT, return true (null set)
2400
+ // - If EQ satisfies every C, return true
2401
+ // - Else return false
2402
+ // - If GT
2403
+ // - If GT.semver is lower than any > or >= comp in C, return false
2404
+ // - If GT is >=, and GT.semver does not satisfy every C, return false
2405
+ // - If GT.semver has a prerelease, and not in prerelease mode
2406
+ // - If no C has a prerelease and the GT.semver tuple, return false
2407
+ // - If LT
2408
+ // - If LT.semver is greater than any < or <= comp in C, return false
2409
+ // - If LT is <=, and LT.semver does not satisfy every C, return false
2410
+ // - If LT.semver has a prerelease, and not in prerelease mode
2411
+ // - If no C has a prerelease and the LT.semver tuple, return false
2412
+ // - Else return true
2413
+
2414
+ const subset = (sub, dom, options = {}) => {
2415
+ if (sub === dom) {
2416
+ return true
2417
+ }
2418
+
2419
+ sub = new Range(sub, options);
2420
+ dom = new Range(dom, options);
2421
+ let sawNonNull = false;
2422
+
2423
+ OUTER: for (const simpleSub of sub.set) {
2424
+ for (const simpleDom of dom.set) {
2425
+ const isSub = simpleSubset(simpleSub, simpleDom, options);
2426
+ sawNonNull = sawNonNull || isSub !== null;
2427
+ if (isSub) {
2428
+ continue OUTER
2429
+ }
2430
+ }
2431
+ // the null set is a subset of everything, but null simple ranges in
2432
+ // a complex range should be ignored. so if we saw a non-null range,
2433
+ // then we know this isn't a subset, but if EVERY simple range was null,
2434
+ // then it is a subset.
2435
+ if (sawNonNull) {
2436
+ return false
2437
+ }
2438
+ }
2439
+ return true
2440
+ };
2441
+
2442
+ const minimumVersionWithPreRelease = [new Comparator('>=0.0.0-0')];
2443
+ const minimumVersion = [new Comparator('>=0.0.0')];
2444
+
2445
+ const simpleSubset = (sub, dom, options) => {
2446
+ if (sub === dom) {
2447
+ return true
2448
+ }
2449
+
2450
+ if (sub.length === 1 && sub[0].semver === ANY) {
2451
+ if (dom.length === 1 && dom[0].semver === ANY) {
2452
+ return true
2453
+ } else if (options.includePrerelease) {
2454
+ sub = minimumVersionWithPreRelease;
2455
+ } else {
2456
+ sub = minimumVersion;
2457
+ }
2458
+ }
2459
+
2460
+ if (dom.length === 1 && dom[0].semver === ANY) {
2461
+ if (options.includePrerelease) {
2462
+ return true
2463
+ } else {
2464
+ dom = minimumVersion;
2465
+ }
2466
+ }
2467
+
2468
+ const eqSet = new Set();
2469
+ let gt, lt;
2470
+ for (const c of sub) {
2471
+ if (c.operator === '>' || c.operator === '>=') {
2472
+ gt = higherGT(gt, c, options);
2473
+ } else if (c.operator === '<' || c.operator === '<=') {
2474
+ lt = lowerLT(lt, c, options);
2475
+ } else {
2476
+ eqSet.add(c.semver);
2477
+ }
2478
+ }
2479
+
2480
+ if (eqSet.size > 1) {
2481
+ return null
2482
+ }
2483
+
2484
+ let gtltComp;
2485
+ if (gt && lt) {
2486
+ gtltComp = compare(gt.semver, lt.semver, options);
2487
+ if (gtltComp > 0) {
2488
+ return null
2489
+ } else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<=')) {
2490
+ return null
2491
+ }
2492
+ }
2493
+
2494
+ // will iterate one or zero times
2495
+ for (const eq of eqSet) {
2496
+ if (gt && !satisfies(eq, String(gt), options)) {
2497
+ return null
2498
+ }
2499
+
2500
+ if (lt && !satisfies(eq, String(lt), options)) {
2501
+ return null
2502
+ }
2503
+
2504
+ for (const c of dom) {
2505
+ if (!satisfies(eq, String(c), options)) {
2506
+ return false
2507
+ }
2508
+ }
2509
+
2510
+ return true
2511
+ }
2512
+
2513
+ let higher, lower;
2514
+ let hasDomLT, hasDomGT;
2515
+ // if the subset has a prerelease, we need a comparator in the superset
2516
+ // with the same tuple and a prerelease, or it's not a subset
2517
+ let needDomLTPre = lt &&
2518
+ !options.includePrerelease &&
2519
+ lt.semver.prerelease.length ? lt.semver : false;
2520
+ let needDomGTPre = gt &&
2521
+ !options.includePrerelease &&
2522
+ gt.semver.prerelease.length ? gt.semver : false;
2523
+ // exception: <1.2.3-0 is the same as <1.2.3
2524
+ if (needDomLTPre && needDomLTPre.prerelease.length === 1 &&
2525
+ lt.operator === '<' && needDomLTPre.prerelease[0] === 0) {
2526
+ needDomLTPre = false;
2527
+ }
2528
+
2529
+ for (const c of dom) {
2530
+ hasDomGT = hasDomGT || c.operator === '>' || c.operator === '>=';
2531
+ hasDomLT = hasDomLT || c.operator === '<' || c.operator === '<=';
2532
+ if (gt) {
2533
+ if (needDomGTPre) {
2534
+ if (c.semver.prerelease && c.semver.prerelease.length &&
2535
+ c.semver.major === needDomGTPre.major &&
2536
+ c.semver.minor === needDomGTPre.minor &&
2537
+ c.semver.patch === needDomGTPre.patch) {
2538
+ needDomGTPre = false;
2539
+ }
2540
+ }
2541
+ if (c.operator === '>' || c.operator === '>=') {
2542
+ higher = higherGT(gt, c, options);
2543
+ if (higher === c && higher !== gt) {
2544
+ return false
2545
+ }
2546
+ } else if (gt.operator === '>=' && !satisfies(gt.semver, String(c), options)) {
2547
+ return false
2548
+ }
2549
+ }
2550
+ if (lt) {
2551
+ if (needDomLTPre) {
2552
+ if (c.semver.prerelease && c.semver.prerelease.length &&
2553
+ c.semver.major === needDomLTPre.major &&
2554
+ c.semver.minor === needDomLTPre.minor &&
2555
+ c.semver.patch === needDomLTPre.patch) {
2556
+ needDomLTPre = false;
2557
+ }
2558
+ }
2559
+ if (c.operator === '<' || c.operator === '<=') {
2560
+ lower = lowerLT(lt, c, options);
2561
+ if (lower === c && lower !== lt) {
2562
+ return false
2563
+ }
2564
+ } else if (lt.operator === '<=' && !satisfies(lt.semver, String(c), options)) {
2565
+ return false
2566
+ }
2567
+ }
2568
+ if (!c.operator && (lt || gt) && gtltComp !== 0) {
2569
+ return false
2570
+ }
2571
+ }
2572
+
2573
+ // if there was a < or >, and nothing in the dom, then must be false
2574
+ // UNLESS it was limited by another range in the other direction.
2575
+ // Eg, >1.0.0 <1.0.1 is still a subset of <2.0.0
2576
+ if (gt && hasDomLT && !lt && gtltComp !== 0) {
2577
+ return false
2578
+ }
2579
+
2580
+ if (lt && hasDomGT && !gt && gtltComp !== 0) {
2581
+ return false
2582
+ }
2583
+
2584
+ // we needed a prerelease range in a specific tuple, but didn't get one
2585
+ // then this isn't a subset. eg >=1.2.3-pre is not a subset of >=1.0.0,
2586
+ // because it includes prereleases in the 1.2.3 tuple
2587
+ if (needDomGTPre || needDomLTPre) {
2588
+ return false
2589
+ }
2590
+
2591
+ return true
2592
+ };
2593
+
2594
+ // >=1.2.3 is lower than >1.2.3
2595
+ const higherGT = (a, b, options) => {
2596
+ if (!a) {
2597
+ return b
2598
+ }
2599
+ const comp = compare(a.semver, b.semver, options);
2600
+ return comp > 0 ? a
2601
+ : comp < 0 ? b
2602
+ : b.operator === '>' && a.operator === '>=' ? b
2603
+ : a
2604
+ };
2605
+
2606
+ // <=1.2.3 is higher than <1.2.3
2607
+ const lowerLT = (a, b, options) => {
2608
+ if (!a) {
2609
+ return b
2610
+ }
2611
+ const comp = compare(a.semver, b.semver, options);
2612
+ return comp < 0 ? a
2613
+ : comp > 0 ? b
2614
+ : b.operator === '<' && a.operator === '<=' ? b
2615
+ : a
2616
+ };
2617
+
2618
+ subset_1 = subset;
2619
+ return subset_1;
2620
+ }
2621
+
2622
+ var semver$1;
2623
+ var hasRequiredSemver;
2624
+
2625
+ function requireSemver () {
2626
+ if (hasRequiredSemver) return semver$1;
2627
+ hasRequiredSemver = 1;
2628
+
2629
+ // just pre-load all the stuff that index.js lazily exports
2630
+ const internalRe = requireRe();
2631
+ const constants = requireConstants();
2632
+ const SemVer = requireSemver$1();
2633
+ const identifiers = requireIdentifiers();
2634
+ const parse = requireParse();
2635
+ const valid = requireValid$1();
2636
+ const clean = requireClean();
2637
+ const inc = requireInc();
2638
+ const diff = requireDiff();
2639
+ const major = requireMajor();
2640
+ const minor = requireMinor();
2641
+ const patch = requirePatch();
2642
+ const prerelease = requirePrerelease();
2643
+ const compare = requireCompare();
2644
+ const rcompare = requireRcompare();
2645
+ const compareLoose = requireCompareLoose();
2646
+ const compareBuild = requireCompareBuild();
2647
+ const sort = requireSort();
2648
+ const rsort = requireRsort();
2649
+ const gt = requireGt();
2650
+ const lt = requireLt();
2651
+ const eq = requireEq();
2652
+ const neq = requireNeq();
2653
+ const gte = requireGte();
2654
+ const lte = requireLte();
2655
+ const cmp = requireCmp();
2656
+ const coerce = requireCoerce();
2657
+ const Comparator = requireComparator();
2658
+ const Range = requireRange();
2659
+ const satisfies = requireSatisfies();
2660
+ const toComparators = requireToComparators();
2661
+ const maxSatisfying = requireMaxSatisfying();
2662
+ const minSatisfying = requireMinSatisfying();
2663
+ const minVersion = requireMinVersion();
2664
+ const validRange = requireValid();
2665
+ const outside = requireOutside();
2666
+ const gtr = requireGtr();
2667
+ const ltr = requireLtr();
2668
+ const intersects = requireIntersects();
2669
+ const simplifyRange = requireSimplify();
2670
+ const subset = requireSubset();
2671
+ semver$1 = {
2672
+ parse,
2673
+ valid,
2674
+ clean,
2675
+ inc,
2676
+ diff,
2677
+ major,
2678
+ minor,
2679
+ patch,
2680
+ prerelease,
2681
+ compare,
2682
+ rcompare,
2683
+ compareLoose,
2684
+ compareBuild,
2685
+ sort,
2686
+ rsort,
2687
+ gt,
2688
+ lt,
2689
+ eq,
2690
+ neq,
2691
+ gte,
2692
+ lte,
2693
+ cmp,
2694
+ coerce,
2695
+ Comparator,
2696
+ Range,
2697
+ satisfies,
2698
+ toComparators,
2699
+ maxSatisfying,
2700
+ minSatisfying,
2701
+ minVersion,
2702
+ validRange,
2703
+ outside,
2704
+ gtr,
2705
+ ltr,
2706
+ intersects,
2707
+ simplifyRange,
2708
+ subset,
2709
+ SemVer,
2710
+ re: internalRe.re,
2711
+ src: internalRe.src,
2712
+ tokens: internalRe.t,
2713
+ SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
2714
+ RELEASE_TYPES: constants.RELEASE_TYPES,
2715
+ compareIdentifiers: identifiers.compareIdentifiers,
2716
+ rcompareIdentifiers: identifiers.rcompareIdentifiers,
2717
+ };
2718
+ return semver$1;
2719
+ }
2720
+
2721
+ var semverExports = requireSemver();
2722
+ const semver = /*@__PURE__*/getDefaultExportFromCjs(semverExports);
2723
+
2724
+ export { semver as a, semverExports as s };