@uipath/rules-tool 1.205.0-preview.277 → 1.206.0-preview.279

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 (62) hide show
  1. package/dist/DmnFactory-L7MABUC6-q2sr3grz.js +10 -0
  2. package/dist/DmnModelTypes-ATR7FVKZ-h8srwcxk.js +8 -0
  3. package/dist/KieDmnMarshaller-LGE63WDG-nfkpv8f4.js +8 -0
  4. package/dist/THIRD-PARTY-NOTICES.md +4 -4
  5. package/dist/business-rules-z2zw35qd.js +25 -0
  6. package/dist/{constants-cnn0jfw6.js → constants-1sdwfz26.js} +7 -15
  7. package/dist/{embedded-file-reader-z4becc02.js → embedded-file-reader-0228j82a.js} +1 -4
  8. package/dist/first-party-service-hegqxm82.js +8 -0
  9. package/dist/hitPolicyResult-CGCR73CW-jz89f1aa.js +12 -0
  10. package/dist/index-4a4x1ygg.js +24 -0
  11. package/dist/{index-52h8rpew.js → index-egzwtc07.js} +2 -4
  12. package/dist/{index-sby22td6.js → index-nzr4mx5p.js} +2 -22
  13. package/dist/index-xaxgkfez.js +23 -0
  14. package/dist/{tool-tjcg2xje.js → index-y5yffb2s.js} +3525 -236
  15. package/dist/index-z4kt2kt6.js +8 -0
  16. package/dist/{index-bhjt1h5c.js → index-zeszs1ra.js} +23 -66
  17. package/dist/index.js +8 -9
  18. package/dist/{jmespath-231m3hyn.js → jmespath-ab6tdc42.js} +1 -1
  19. package/dist/{js-yaml-88tdqrtd.js → js-yaml-a2bk27p6.js} +1 -3
  20. package/dist/rule-catalog-5qnmp0xp.js +71 -0
  21. package/dist/rules-command-error-30c8a3n9.js +13 -0
  22. package/dist/{rules-debug-service-830zfzcy.js → rules-debug-service-xc1cmwwh.js} +37 -38
  23. package/dist/{rules-init-service-qphmbh3k.js → rules-init-service-frjbgfcs.js} +12 -16
  24. package/dist/{rules-refresh-service-jn6my893.js → rules-refresh-service-18hrs394.js} +13 -14
  25. package/dist/{rules-validate-service-hfw8m3dm.js → rules-validate-service-s787ehrr.js} +10 -13
  26. package/dist/{tool-fk8rznma.js → tool-89e90qrm.js} +173 -223
  27. package/dist/{tool-fbxe48wd.js → tool-8cnhz30a.js} +13991 -15184
  28. package/dist/{tool-ey5djkhz.js → tool-8sjyv0xg.js} +659 -14
  29. package/dist/{tool-h7gn1rar.js → tool-93hqhaj3.js} +402 -417
  30. package/dist/{tool-c2xarvad.js → tool-cf9810hm.js} +32 -34
  31. package/dist/{tool-wf2qkrye.js → tool-cs8nyk0r.js} +990 -514
  32. package/dist/{tool-txp5th7j.js → tool-e23cj2jx.js} +127 -42
  33. package/dist/{tool-1de529jm.js → tool-epsr41wx.js} +12 -3
  34. package/dist/{tool-gkbr01gc.js → tool-fkppxa9f.js} +14 -17
  35. package/dist/{tool-86f1xpxn.js → tool-m59a481n.js} +18 -20
  36. package/dist/tool-mst6a4dr.js +73 -0
  37. package/dist/{tool-t4k013ex.js → tool-njnhj05q.js} +8 -8
  38. package/dist/tool-p7hqn93n.js +455 -0
  39. package/dist/{tool-z1ay3csx.js → tool-sbtf80ft.js} +66 -24
  40. package/dist/{tool-yq5jph4h.js → tool-vqm4apm6.js} +207 -216
  41. package/dist/tool.js +7 -8
  42. package/package.json +2 -2
  43. package/dist/DmnFactory-L7MABUC6-98k17dkr.js +0 -46
  44. package/dist/DmnModelTypes-ATR7FVKZ-jp35cecy.js +0 -18
  45. package/dist/KieDmnMarshaller-LGE63WDG-3vemswef.js +0 -20
  46. package/dist/business-rules-pm96sefm.js +0 -26
  47. package/dist/first-party-service-sd8yaf73.js +0 -27
  48. package/dist/hitPolicyResult-CGCR73CW-9bmc4nsr.js +0 -36
  49. package/dist/index-cpm94vee.js +0 -132
  50. package/dist/index-dqa169gp.js +0 -25
  51. package/dist/index-x9msn1dj.js +0 -85
  52. package/dist/index-ybrgtfsg.js +0 -3326
  53. package/dist/rule-catalog-10fhgevc.js +0 -74
  54. package/dist/rules-command-error-k6kxwfn7.js +0 -14
  55. package/dist/tool-1pccj6q3.js +0 -1116
  56. package/dist/tool-53w8skv5.js +0 -262
  57. package/dist/tool-7haj67tr.js +0 -19
  58. package/dist/tool-fbmxx07c.js +0 -73
  59. package/dist/tool-gdtpsdn7.js +0 -342
  60. package/dist/tool-jd313s2x.js +0 -10
  61. package/dist/tool-qgqscsjc.js +0 -46
  62. /package/dist/{tool-cfrcyxgm.js → tool-2nmqvfmt.js} +0 -0
@@ -1,3326 +0,0 @@
1
- import {
2
- l,
3
- m as m2
4
- } from "./tool-cfrcyxgm.js";
5
- import {
6
- K as K2,
7
- Q as Q2,
8
- U as U2,
9
- W,
10
- X,
11
- Y,
12
- de,
13
- ee as ee2,
14
- ne as ne2,
15
- pe
16
- } from "./tool-tjcg2xje.js";
17
- import {
18
- $,
19
- At,
20
- Ui,
21
- fe,
22
- g as g2,
23
- w
24
- } from "./tool-fk8rznma.js";
25
- import {
26
- bs
27
- } from "./tool-h7gn1rar.js";
28
- import {
29
- J as J2,
30
- _e,
31
- b,
32
- c,
33
- ee,
34
- h,
35
- me,
36
- ne,
37
- parser,
38
- te,
39
- trackVariables,
40
- xe
41
- } from "./tool-yq5jph4h.js";
42
- import {
43
- A,
44
- C,
45
- E,
46
- O,
47
- S,
48
- T,
49
- f,
50
- g,
51
- m,
52
- p,
53
- u,
54
- x
55
- } from "./tool-86f1xpxn.js";
56
- import"./tool-qgqscsjc.js";
57
- import {
58
- B,
59
- G,
60
- J,
61
- K,
62
- Q,
63
- R,
64
- U,
65
- z
66
- } from "./tool-z1ay3csx.js";
67
- import {
68
- e,
69
- r
70
- } from "./tool-jd313s2x.js";
71
- import"./tool-7haj67tr.js";
72
- import"./tool-1de529jm.js";
73
-
74
- // ../../node_modules/@bpmn-io/feel-analyzer/dist/index.js
75
- function stripBackticks(text) {
76
- return text.replace(/^`|`$/g, "");
77
- }
78
- function nodeText(node, source) {
79
- return stripBackticks(source.substring(node.from, node.to));
80
- }
81
- function isInScope(varName, scopes) {
82
- return scopes.some((scope) => scope.has(varName));
83
- }
84
- function withScope(scopes, initialNames, fn) {
85
- const scope = new Set(initialNames);
86
- scopes.push(scope);
87
- const result = fn(scope);
88
- scopes.pop();
89
- return result;
90
- }
91
- function forEachChild(node, callback) {
92
- let child = node.firstChild;
93
- while (child) {
94
- callback(child);
95
- child = child.nextSibling;
96
- }
97
- }
98
- function collectPathParts(node, source) {
99
- const parts = [];
100
- forEachChild(node, (child) => {
101
- if (child.name === "PathExpression") {
102
- parts.push(...collectPathParts(child, source));
103
- } else if (child.name === "VariableName" || child.name === "PathName") {
104
- parts.push(nodeText(child, source));
105
- }
106
- });
107
- return parts;
108
- }
109
- function getFilterBase(node) {
110
- const firstChild = node.firstChild;
111
- if (!firstChild)
112
- return null;
113
- if (firstChild.name === "FilterExpression")
114
- return firstChild;
115
- if (firstChild.name === "PathExpression")
116
- return getFilterBase(firstChild);
117
- return null;
118
- }
119
- function hasContextBase(node) {
120
- const firstChild = node.firstChild;
121
- if (!firstChild)
122
- return false;
123
- if (firstChild.name === "Context")
124
- return true;
125
- if (firstChild.name === "PathExpression")
126
- return hasContextBase(firstChild);
127
- return false;
128
- }
129
- function extractContextKeys(contextNode, source) {
130
- const keys = [];
131
- forEachChild(contextNode, (child) => {
132
- if (child.name === "ContextEntry") {
133
- const keyName = child.getChild("Key")?.getChild("Name");
134
- if (keyName) {
135
- keys.push(nodeText(keyName, source));
136
- }
137
- }
138
- });
139
- return keys;
140
- }
141
- function collectIterationVariables(node, source) {
142
- const vars = [];
143
- const inExpressions = node.getChild("InExpressions");
144
- if (inExpressions) {
145
- forEachChild(inExpressions, (child) => {
146
- if (child.name === "InExpression") {
147
- const id = child.getChild("Name")?.getChild("Identifier");
148
- if (id)
149
- vars.push(source.substring(id.from, id.to));
150
- }
151
- });
152
- }
153
- return vars;
154
- }
155
- function collectFunctionParameters(node, source) {
156
- const params = [];
157
- const formalParams = node.getChild("FormalParameters");
158
- if (formalParams) {
159
- forEachChild(formalParams, (child) => {
160
- if (child.name === "FormalParameter") {
161
- const id = child.getChild("ParameterName")?.getChild("Name")?.getChild("Identifier");
162
- if (id)
163
- params.push(source.substring(id.from, id.to));
164
- }
165
- });
166
- }
167
- return params;
168
- }
169
- function findVariable(variables, name) {
170
- return variables.find((v) => v.name === name);
171
- }
172
- function findOrCreateVariable(variables, name) {
173
- let variable = findVariable(variables, name);
174
- if (!variable) {
175
- variable = { name };
176
- variables.push(variable);
177
- }
178
- return variable;
179
- }
180
- function buildNestedEntries(variables, pathParts) {
181
- const rootVar = findOrCreateVariable(variables, pathParts[0]);
182
- if (pathParts.length <= 1)
183
- return;
184
- if (!rootVar.type) {
185
- rootVar.type = "Context";
186
- rootVar.entries = rootVar.entries || [];
187
- }
188
- if (rootVar.type !== "Context")
189
- return;
190
- let currentLevel = rootVar.entries;
191
- for (let i = 1;i < pathParts.length; i++) {
192
- const part = pathParts[i];
193
- const isLast = i === pathParts.length - 1;
194
- let entry = findVariable(currentLevel, part);
195
- if (!entry) {
196
- entry = isLast ? { name: part } : { name: part, type: "Context", entries: [] };
197
- currentLevel.push(entry);
198
- } else if (!isLast && !entry.type) {
199
- entry.type = "Context";
200
- entry.entries = entry.entries || [];
201
- }
202
- if (!isLast) {
203
- entry.entries = entry.entries || [];
204
- currentLevel = entry.entries;
205
- }
206
- }
207
- }
208
- function sortEntries(variable) {
209
- if (variable.entries) {
210
- variable.entries.sort((a, b2) => a.name.localeCompare(b2.name));
211
- for (const entry of variable.entries) {
212
- sortEntries(entry);
213
- }
214
- }
215
- }
216
- var ITERATION_KEYWORDS$1 = new Set(["for", "return", "some", "every", "InExpressions", "satisfies"]);
217
- function extractInputNames(node, source, builtinNames) {
218
- const inputs = new Set;
219
- const localScopes = [new Set];
220
- function isExternal(name, filterCtx) {
221
- return !isInScope(name, localScopes) && !builtinNames.has(name) && !(filterCtx !== "none" && name === "item");
222
- }
223
- const collectInputs = (node2, filterCtx = "none") => {
224
- const { name: nodeName } = node2;
225
- if (node2.type.isError) {
226
- return;
227
- }
228
- if (nodeName === "FunctionInvocation") {
229
- const funcNameNode = node2.getChild("VariableName");
230
- if (funcNameNode) {
231
- const funcName = nodeText(funcNameNode, source);
232
- if (isExternal(funcName, filterCtx)) {
233
- inputs.add(funcName);
234
- }
235
- }
236
- forEachChild(node2, (child) => {
237
- if (child.name !== "VariableName" && child.name !== "(" && child.name !== ")") {
238
- collectInputs(child, filterCtx);
239
- }
240
- });
241
- return;
242
- }
243
- if (nodeName === "PathExpression") {
244
- const filterBase = getFilterBase(node2);
245
- if (hasContextBase(node2)) {
246
- forEachChild(node2, (child) => collectInputs(child, filterCtx));
247
- } else if (filterBase) {
248
- collectInputs(filterBase, filterCtx);
249
- } else {
250
- const pathParts = collectPathParts(node2, source);
251
- if (pathParts.length > 0 && isExternal(pathParts[0], filterCtx)) {
252
- inputs.add(pathParts.join("."));
253
- }
254
- }
255
- return;
256
- }
257
- if (nodeName === "VariableName" && node2.parent?.name !== "PathExpression" && node2.parent?.name !== "FunctionInvocation") {
258
- const varName = nodeText(node2, source);
259
- const isImplicitFilterProp = filterCtx === "variable-list" && varName !== "item";
260
- if (isExternal(varName, filterCtx) && !isImplicitFilterProp) {
261
- inputs.add(varName);
262
- }
263
- return;
264
- }
265
- if (nodeName === "Context" && node2.parent?.name !== "List") {
266
- withScope(localScopes, [], (scope) => {
267
- forEachChild(node2, (child) => {
268
- if (child.name === "ContextEntry") {
269
- forEachChild(child, (entryChild) => {
270
- if (entryChild.name !== "Key")
271
- collectInputs(entryChild, filterCtx);
272
- });
273
- const keyName = child.getChild("Key")?.getChild("Name");
274
- if (keyName)
275
- scope.add(nodeText(keyName, source));
276
- }
277
- });
278
- });
279
- return;
280
- }
281
- if (nodeName === "FilterExpression") {
282
- let newFilterCtx = "none";
283
- const scopeNames = ["item"];
284
- const listNode = node2.getChild("List");
285
- if (listNode) {
286
- forEachChild(listNode, (child) => {
287
- if (child.name === "Context") {
288
- scopeNames.push(...extractContextKeys(child, source));
289
- }
290
- });
291
- newFilterCtx = "list-literal";
292
- } else {
293
- forEachChild(node2, (child) => {
294
- if (child.name === "VariableName") {
295
- collectInputs(child, "none");
296
- newFilterCtx = "variable-list";
297
- }
298
- });
299
- }
300
- withScope(localScopes, scopeNames, () => {
301
- forEachChild(node2, (child) => {
302
- if (child.name === "Comparison" || child.name === "Expression") {
303
- collectInputs(child, newFilterCtx);
304
- }
305
- });
306
- });
307
- return;
308
- }
309
- if (nodeName === "ForExpression" || nodeName === "QuantifiedExpression") {
310
- const iterVars = collectIterationVariables(node2, source);
311
- const inExp = node2.getChild("InExpressions");
312
- if (inExp) {
313
- forEachChild(inExp, (child) => {
314
- if (child.name === "InExpression") {
315
- forEachChild(child, (innerChild) => {
316
- if (innerChild.name !== "Name" && innerChild.name !== "in" && innerChild.name !== "Identifier") {
317
- collectInputs(innerChild, filterCtx);
318
- }
319
- });
320
- }
321
- });
322
- }
323
- withScope(localScopes, iterVars, () => {
324
- forEachChild(node2, (child) => {
325
- if (!ITERATION_KEYWORDS$1.has(child.name)) {
326
- collectInputs(child, "none");
327
- }
328
- });
329
- });
330
- return;
331
- }
332
- if (nodeName === "FunctionDefinition") {
333
- const params = collectFunctionParameters(node2, source);
334
- withScope(localScopes, params, () => {
335
- const body = node2.getChild("FunctionBody");
336
- if (body)
337
- collectInputs(body, "none");
338
- });
339
- return;
340
- }
341
- forEachChild(node2, (child) => collectInputs(child, filterCtx));
342
- };
343
- collectInputs(node);
344
- return Array.from(inputs).sort();
345
- }
346
- function initializeInputVariables(collectedInputs) {
347
- const variables = [];
348
- for (const input of collectedInputs) {
349
- buildNestedEntries(variables, input.split("."));
350
- }
351
- return variables;
352
- }
353
- function checkLiteralsInNode(node) {
354
- let hasString = false;
355
- let hasNumber = false;
356
- forEachChild(node, (child) => {
357
- if (child.name === "StringLiteral")
358
- hasString = true;
359
- else if (child.name === "NumericLiteral")
360
- hasNumber = true;
361
- else if (child.name === "ArithmeticExpression") {
362
- const nested = checkLiteralsInNode(child);
363
- hasString = hasString || nested.hasString;
364
- hasNumber = hasNumber || nested.hasNumber;
365
- }
366
- });
367
- return { hasString, hasNumber };
368
- }
369
- function inferTypeForVariablesInNode(node, source, inputs, localScopes, inferredType) {
370
- if (node.name === "VariableName" && node.parent?.name !== "PathExpression") {
371
- const varName = nodeText(node, source);
372
- const variable = findVariable(inputs, varName);
373
- if (!isInScope(varName, localScopes) && variable && !variable.type) {
374
- variable.type = inferredType;
375
- }
376
- } else if (node.name === "PathExpression") {
377
- const pathParts = collectPathParts(node, source);
378
- if (pathParts.length > 0) {
379
- const rootVar = pathParts[0];
380
- const variable = findVariable(inputs, rootVar);
381
- if (!isInScope(rootVar, localScopes) && variable && !variable.type) {
382
- variable.type = inferredType;
383
- }
384
- }
385
- } else {
386
- forEachChild(node, (child) => {
387
- inferTypeForVariablesInNode(child, source, inputs, localScopes, inferredType);
388
- });
389
- }
390
- }
391
- function trackFilterItemProperties(node, source, listVarName, inputs, localScopes) {
392
- const listVar = listVarName ? findVariable(inputs, listVarName) : null;
393
- if (!listVar)
394
- return;
395
- const visit = (node2) => {
396
- if (listVar.type !== "List")
397
- return;
398
- if (node2.name === "PathExpression") {
399
- const pathParts = collectPathParts(node2, source);
400
- if (pathParts.length > 1 && pathParts[0] === "item") {
401
- const entries = listVar.entries || [];
402
- for (let i = 1;i < pathParts.length; i++) {
403
- if (!findVariable(entries, pathParts[i])) {
404
- entries.push({ name: pathParts[i] });
405
- }
406
- }
407
- listVar.entries = entries;
408
- }
409
- } else if (node2.name === "VariableName") {
410
- const varName = nodeText(node2, source);
411
- if (!isInScope(varName, localScopes) && varName !== "item" && node2.parent?.name !== "PathExpression") {
412
- const entries = listVar.entries || [];
413
- if (!findVariable(entries, varName)) {
414
- entries.push({ name: varName });
415
- }
416
- listVar.entries = entries;
417
- }
418
- }
419
- forEachChild(node2, visit);
420
- };
421
- visit(node);
422
- }
423
- function inferTypeFromComparison(varNode, literalNode, source, inputs, localScopes) {
424
- if (varNode.name !== "VariableName")
425
- return;
426
- const varName = nodeText(varNode, source);
427
- const variable = findVariable(inputs, varName);
428
- if (isInScope(varName, localScopes) || !variable)
429
- return;
430
- if (variable.type)
431
- return;
432
- const literalTypeMap = {
433
- NumericLiteral: "Number",
434
- StringLiteral: "String",
435
- BooleanLiteral: "Boolean"
436
- };
437
- const inferred = literalTypeMap[literalNode.name];
438
- if (inferred)
439
- variable.type = inferred;
440
- }
441
- function inferTypes(node, source, inputs, localScopes, filterCtx = "none") {
442
- const { name: nodeName } = node;
443
- if (nodeName === "PathExpression") {
444
- const first = node.firstChild;
445
- if (first?.name === "Context" || first?.name === "PathExpression" || first?.name === "FilterExpression") {
446
- inferTypes(first, source, inputs, localScopes, filterCtx);
447
- return;
448
- }
449
- const pathParts = collectPathParts(node, source);
450
- if (pathParts.length > 0) {
451
- const rootVar = pathParts[0];
452
- if (!isInScope(rootVar, localScopes) && !(filterCtx !== "none" && rootVar === "item") && findVariable(inputs, rootVar)) {
453
- buildNestedEntries(inputs, pathParts);
454
- }
455
- }
456
- return;
457
- }
458
- if (nodeName === "Context" && node.parent?.name !== "List") {
459
- withScope(localScopes, [], (scope) => {
460
- forEachChild(node, (child) => {
461
- if (child.name === "ContextEntry") {
462
- forEachChild(child, (innerChild) => {
463
- if (innerChild.name !== "Key") {
464
- inferTypes(innerChild, source, inputs, localScopes, filterCtx);
465
- }
466
- });
467
- const keyName = child.getChild("Key")?.getChild("Name");
468
- if (keyName)
469
- scope.add(nodeText(keyName, source));
470
- }
471
- });
472
- });
473
- return;
474
- }
475
- if (nodeName === "FilterExpression") {
476
- let newFilterCtx = "none";
477
- let listVarName = null;
478
- const scopeNames = ["item"];
479
- const listNode = node.getChild("List");
480
- if (listNode) {
481
- forEachChild(listNode, (child) => {
482
- if (child.name === "Context") {
483
- scopeNames.push(...extractContextKeys(child, source));
484
- }
485
- });
486
- newFilterCtx = "list-literal";
487
- } else {
488
- forEachChild(node, (child) => {
489
- if (child.name === "VariableName") {
490
- listVarName = nodeText(child, source);
491
- const variable = findVariable(inputs, listVarName);
492
- if (!isInScope(listVarName, localScopes) && variable) {
493
- if (!variable.type) {
494
- variable.type = "List";
495
- }
496
- }
497
- newFilterCtx = "variable-list";
498
- }
499
- });
500
- }
501
- withScope(localScopes, scopeNames, () => {
502
- forEachChild(node, (child) => {
503
- if (child.name === "Comparison" || child.name === "Expression") {
504
- trackFilterItemProperties(child, source, listVarName, inputs, localScopes);
505
- inferTypes(child, source, inputs, localScopes, newFilterCtx);
506
- }
507
- });
508
- });
509
- return;
510
- }
511
- if (nodeName === "Comparison") {
512
- const operands = [];
513
- forEachChild(node, (child) => {
514
- if (child.name !== "CompareOp")
515
- operands.push(child);
516
- });
517
- if (operands.length === 2) {
518
- inferTypeFromComparison(operands[0], operands[1], source, inputs, localScopes);
519
- inferTypeFromComparison(operands[1], operands[0], source, inputs, localScopes);
520
- }
521
- }
522
- if (nodeName === "ArithmeticExpression") {
523
- const { hasString, hasNumber } = checkLiteralsInNode(node);
524
- const inferredType = hasString && !hasNumber ? "String" : !hasString && hasNumber ? "Number" : null;
525
- if (inferredType) {
526
- inferTypeForVariablesInNode(node, source, inputs, localScopes, inferredType);
527
- }
528
- forEachChild(node, (child) => {
529
- if (!["ArithmeticExpression", "ArithOp", "NumericLiteral", "StringLiteral"].includes(child.name)) {
530
- inferTypes(child, source, inputs, localScopes, filterCtx);
531
- }
532
- });
533
- return;
534
- }
535
- if (nodeName === "ForExpression" || nodeName === "QuantifiedExpression") {
536
- const iterVars = collectIterationVariables(node, source);
537
- const inExp = node.getChild("InExpressions");
538
- if (inExp) {
539
- forEachChild(inExp, (child) => {
540
- if (child.name === "InExpression") {
541
- forEachChild(child, (innerChild) => {
542
- if (!["Name", "in", "Identifier"].includes(innerChild.name)) {
543
- inferTypes(innerChild, source, inputs, localScopes, filterCtx);
544
- }
545
- });
546
- }
547
- });
548
- }
549
- withScope(localScopes, iterVars, () => {
550
- forEachChild(node, (child) => {
551
- if (!ITERATION_KEYWORDS$1.has(child.name)) {
552
- inferTypes(child, source, inputs, localScopes, "none");
553
- }
554
- });
555
- });
556
- return;
557
- }
558
- if (nodeName === "FunctionDefinition") {
559
- const params = collectFunctionParameters(node, source);
560
- withScope(localScopes, params, () => {
561
- const body = node.getChild("FunctionBody");
562
- if (body)
563
- inferTypes(body, source, inputs, localScopes, "none");
564
- });
565
- return;
566
- }
567
- forEachChild(node, (child) => {
568
- inferTypes(child, source, inputs, localScopes, filterCtx);
569
- });
570
- }
571
- function analyzeForInputs(node, source, builtinNames) {
572
- const collectedInputs = extractInputNames(node, source, builtinNames);
573
- const inputs = initializeInputVariables(collectedInputs);
574
- const localScopes = [new Set];
575
- inferTypes(node, source, inputs, localScopes);
576
- for (const variable of inputs) {
577
- sortEntries(variable);
578
- }
579
- inputs.sort((a, b2) => a.name.localeCompare(b2.name));
580
- return inputs;
581
- }
582
- var ITERATION_KEYWORDS = new Set(["for", "return", "some", "every", "InExpressions", "satisfies"]);
583
- function analyzeForFunctions(node, source, builtinNames) {
584
- const functions = [];
585
- const scopes = [];
586
- const recordInvocation = (funcNameNode) => {
587
- const name = nodeText(funcNameNode, source);
588
- const type = !isInScope(name, scopes) && builtinNames.has(name) ? "builtin" : "user";
589
- const { from, to } = funcNameNode;
590
- functions.push({ name, type, from, to });
591
- };
592
- const walk = (n) => {
593
- const { name: nodeName } = n;
594
- if (nodeName === "Context") {
595
- withScope(scopes, [], (scope) => {
596
- forEachChild(n, (child) => {
597
- if (child.name !== "ContextEntry")
598
- return;
599
- forEachChild(child, (entryChild) => {
600
- if (entryChild.name !== "Key")
601
- walk(entryChild);
602
- });
603
- const keyName = child.getChild("Key")?.getChild("Name");
604
- if (keyName)
605
- scope.add(nodeText(keyName, source));
606
- });
607
- });
608
- return;
609
- }
610
- if (nodeName === "FunctionDefinition") {
611
- const params = collectFunctionParameters(n, source);
612
- withScope(scopes, params, () => {
613
- const body = n.getChild("FunctionBody");
614
- if (body)
615
- walk(body);
616
- });
617
- return;
618
- }
619
- if (nodeName === "ForExpression" || nodeName === "QuantifiedExpression") {
620
- const inExp = n.getChild("InExpressions");
621
- if (inExp) {
622
- forEachChild(inExp, (child) => {
623
- if (child.name === "InExpression") {
624
- forEachChild(child, (innerChild) => {
625
- if (innerChild.name !== "Name" && innerChild.name !== "in" && innerChild.name !== "Identifier") {
626
- walk(innerChild);
627
- }
628
- });
629
- }
630
- });
631
- }
632
- withScope(scopes, collectIterationVariables(n, source), () => {
633
- forEachChild(n, (child) => {
634
- if (!ITERATION_KEYWORDS.has(child.name))
635
- walk(child);
636
- });
637
- });
638
- return;
639
- }
640
- if (nodeName === "FunctionInvocation") {
641
- const funcNameNode = n.getChild("VariableName");
642
- if (funcNameNode)
643
- recordInvocation(funcNameNode);
644
- }
645
- forEachChild(n, walk);
646
- };
647
- walk(node);
648
- return functions.sort((a, b2) => a.from - b2.from);
649
- }
650
- function analyzeForValidity(node) {
651
- return !containsErrorNodes(node);
652
- }
653
- function containsErrorNodes(node) {
654
- if (node.type.isError) {
655
- return true;
656
- }
657
- let child = node.firstChild;
658
- while (child) {
659
- if (containsErrorNodes(child)) {
660
- return true;
661
- }
662
- child = child.nextSibling;
663
- }
664
- return false;
665
- }
666
- function createContext(variables) {
667
- return variables.reduce((context, variable) => {
668
- context[variable.name] = () => {};
669
- return context;
670
- }, {});
671
- }
672
-
673
- class FeelAnalyzer {
674
- constructor(options = {}) {
675
- this.builtinNames = new Set(options.builtins?.map((b2) => b2.name) ?? []);
676
- const config = {
677
- top: options.dialect === "unaryTests" ? "UnaryTests" : "Expression",
678
- dialect: options.parserDialect
679
- };
680
- if (options.reservedNameBuiltins && options.reservedNameBuiltins.length > 0) {
681
- config.contextTracker = trackVariables(createContext(options.reservedNameBuiltins));
682
- }
683
- this.parser = parser.configure(config);
684
- }
685
- analyzeExpression(expression) {
686
- const tree = this.parser.parse(expression);
687
- return this.analyzeTree(tree, expression);
688
- }
689
- analyzeTree(tree, source) {
690
- const node = tree.topNode;
691
- return {
692
- valid: analyzeForValidity(node),
693
- inputs: analyzeForInputs(node, source, this.builtinNames),
694
- functions: analyzeForFunctions(node, source, this.builtinNames)
695
- };
696
- }
697
- }
698
-
699
- // ../../node_modules/@bpmn-io/semver-compat/dist/index.js
700
- var re = { exports: {} };
701
- var constants;
702
- var hasRequiredConstants;
703
- function requireConstants() {
704
- if (hasRequiredConstants)
705
- return constants;
706
- hasRequiredConstants = 1;
707
- const SEMVER_SPEC_VERSION = "2.0.0";
708
- const MAX_LENGTH = 256;
709
- const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
710
- const MAX_SAFE_COMPONENT_LENGTH = 16;
711
- const MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6;
712
- const RELEASE_TYPES = [
713
- "major",
714
- "premajor",
715
- "minor",
716
- "preminor",
717
- "patch",
718
- "prepatch",
719
- "prerelease"
720
- ];
721
- constants = {
722
- MAX_LENGTH,
723
- MAX_SAFE_COMPONENT_LENGTH,
724
- MAX_SAFE_BUILD_LENGTH,
725
- MAX_SAFE_INTEGER,
726
- RELEASE_TYPES,
727
- SEMVER_SPEC_VERSION,
728
- FLAG_INCLUDE_PRERELEASE: 1,
729
- FLAG_LOOSE: 2
730
- };
731
- return constants;
732
- }
733
- var debug_1;
734
- var hasRequiredDebug;
735
- function requireDebug() {
736
- if (hasRequiredDebug)
737
- return debug_1;
738
- hasRequiredDebug = 1;
739
- const debug = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {};
740
- debug_1 = debug;
741
- return debug_1;
742
- }
743
- var hasRequiredRe;
744
- function requireRe() {
745
- if (hasRequiredRe)
746
- return re.exports;
747
- hasRequiredRe = 1;
748
- (function(module, exports$1) {
749
- const {
750
- MAX_SAFE_COMPONENT_LENGTH,
751
- MAX_SAFE_BUILD_LENGTH,
752
- MAX_LENGTH
753
- } = requireConstants();
754
- const debug = requireDebug();
755
- exports$1 = module.exports = {};
756
- const re2 = exports$1.re = [];
757
- const safeRe = exports$1.safeRe = [];
758
- const src = exports$1.src = [];
759
- const safeSrc = exports$1.safeSrc = [];
760
- const t = exports$1.t = {};
761
- let R2 = 0;
762
- const LETTERDASHNUMBER = "[a-zA-Z0-9-]";
763
- const safeRegexReplacements = [
764
- ["\\s", 1],
765
- ["\\d", MAX_LENGTH],
766
- [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
767
- ];
768
- const makeSafeRegex = (value) => {
769
- for (const [token, max] of safeRegexReplacements) {
770
- value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
771
- }
772
- return value;
773
- };
774
- const createToken = (name, value, isGlobal) => {
775
- const safe = makeSafeRegex(value);
776
- const index = R2++;
777
- debug(name, index, value);
778
- t[name] = index;
779
- src[index] = value;
780
- safeSrc[index] = safe;
781
- re2[index] = new RegExp(value, isGlobal ? "g" : undefined);
782
- safeRe[index] = new RegExp(safe, isGlobal ? "g" : undefined);
783
- };
784
- createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
785
- createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
786
- createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
787
- createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.` + `(${src[t.NUMERICIDENTIFIER]})\\.` + `(${src[t.NUMERICIDENTIFIER]})`);
788
- createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + `(${src[t.NUMERICIDENTIFIERLOOSE]})`);
789
- createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIER]})`);
790
- createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIERLOOSE]})`);
791
- createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
792
- createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
793
- createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
794
- createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
795
- createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);
796
- createToken("FULL", `^${src[t.FULLPLAIN]}$`);
797
- createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);
798
- createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`);
799
- createToken("GTLT", "((?:<|>)?=?)");
800
- createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
801
- createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
802
- createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` + `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + `(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?` + `)?)?`);
803
- createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` + `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + `(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?` + `)?)?`);
804
- createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
805
- createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
806
- createToken("COERCEPLAIN", `${"(^|[^\\d])" + "(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH}})` + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
807
- createToken("COERCE", `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
808
- createToken("COERCEFULL", src[t.COERCEPLAIN] + `(?:${src[t.PRERELEASE]})?` + `(?:${src[t.BUILD]})?` + `(?:$|[^\\d])`);
809
- createToken("COERCERTL", src[t.COERCE], true);
810
- createToken("COERCERTLFULL", src[t.COERCEFULL], true);
811
- createToken("LONETILDE", "(?:~>?)");
812
- createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true);
813
- exports$1.tildeTrimReplace = "$1~";
814
- createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
815
- createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
816
- createToken("LONECARET", "(?:\\^)");
817
- createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true);
818
- exports$1.caretTrimReplace = "$1^";
819
- createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
820
- createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
821
- createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
822
- createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
823
- createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
824
- exports$1.comparatorTrimReplace = "$1$2$3";
825
- createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})` + `\\s+-\\s+` + `(${src[t.XRANGEPLAIN]})` + `\\s*$`);
826
- createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})` + `\\s+-\\s+` + `(${src[t.XRANGEPLAINLOOSE]})` + `\\s*$`);
827
- createToken("STAR", "(<|>)?=?\\s*\\*");
828
- createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
829
- createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
830
- })(re, re.exports);
831
- return re.exports;
832
- }
833
- var parseOptions_1;
834
- var hasRequiredParseOptions;
835
- function requireParseOptions() {
836
- if (hasRequiredParseOptions)
837
- return parseOptions_1;
838
- hasRequiredParseOptions = 1;
839
- const looseOption = Object.freeze({ loose: true });
840
- const emptyOpts = Object.freeze({});
841
- const parseOptions = (options) => {
842
- if (!options) {
843
- return emptyOpts;
844
- }
845
- if (typeof options !== "object") {
846
- return looseOption;
847
- }
848
- return options;
849
- };
850
- parseOptions_1 = parseOptions;
851
- return parseOptions_1;
852
- }
853
- var identifiers;
854
- var hasRequiredIdentifiers;
855
- function requireIdentifiers() {
856
- if (hasRequiredIdentifiers)
857
- return identifiers;
858
- hasRequiredIdentifiers = 1;
859
- const numeric = /^[0-9]+$/;
860
- const compareIdentifiers = (a, b2) => {
861
- if (typeof a === "number" && typeof b2 === "number") {
862
- return a === b2 ? 0 : a < b2 ? -1 : 1;
863
- }
864
- const anum = numeric.test(a);
865
- const bnum = numeric.test(b2);
866
- if (anum && bnum) {
867
- a = +a;
868
- b2 = +b2;
869
- }
870
- return a === b2 ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b2 ? -1 : 1;
871
- };
872
- const rcompareIdentifiers = (a, b2) => compareIdentifiers(b2, a);
873
- identifiers = {
874
- compareIdentifiers,
875
- rcompareIdentifiers
876
- };
877
- return identifiers;
878
- }
879
- var semver$1;
880
- var hasRequiredSemver$1;
881
- function requireSemver$1() {
882
- if (hasRequiredSemver$1)
883
- return semver$1;
884
- hasRequiredSemver$1 = 1;
885
- const debug = requireDebug();
886
- const { MAX_LENGTH, MAX_SAFE_INTEGER } = requireConstants();
887
- const { safeRe: re2, t } = requireRe();
888
- const parseOptions = requireParseOptions();
889
- const { compareIdentifiers } = requireIdentifiers();
890
-
891
- class SemVer {
892
- constructor(version, options) {
893
- options = parseOptions(options);
894
- if (version instanceof SemVer) {
895
- if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) {
896
- return version;
897
- } else {
898
- version = version.version;
899
- }
900
- } else if (typeof version !== "string") {
901
- throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
902
- }
903
- if (version.length > MAX_LENGTH) {
904
- throw new TypeError(`version is longer than ${MAX_LENGTH} characters`);
905
- }
906
- debug("SemVer", version, options);
907
- this.options = options;
908
- this.loose = !!options.loose;
909
- this.includePrerelease = !!options.includePrerelease;
910
- const m3 = version.trim().match(options.loose ? re2[t.LOOSE] : re2[t.FULL]);
911
- if (!m3) {
912
- throw new TypeError(`Invalid Version: ${version}`);
913
- }
914
- this.raw = version;
915
- this.major = +m3[1];
916
- this.minor = +m3[2];
917
- this.patch = +m3[3];
918
- if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
919
- throw new TypeError("Invalid major version");
920
- }
921
- if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
922
- throw new TypeError("Invalid minor version");
923
- }
924
- if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
925
- throw new TypeError("Invalid patch version");
926
- }
927
- if (!m3[4]) {
928
- this.prerelease = [];
929
- } else {
930
- this.prerelease = m3[4].split(".").map((id) => {
931
- if (/^[0-9]+$/.test(id)) {
932
- const num = +id;
933
- if (num >= 0 && num < MAX_SAFE_INTEGER) {
934
- return num;
935
- }
936
- }
937
- return id;
938
- });
939
- }
940
- this.build = m3[5] ? m3[5].split(".") : [];
941
- this.format();
942
- }
943
- format() {
944
- this.version = `${this.major}.${this.minor}.${this.patch}`;
945
- if (this.prerelease.length) {
946
- this.version += `-${this.prerelease.join(".")}`;
947
- }
948
- return this.version;
949
- }
950
- toString() {
951
- return this.version;
952
- }
953
- compare(other) {
954
- debug("SemVer.compare", this.version, this.options, other);
955
- if (!(other instanceof SemVer)) {
956
- if (typeof other === "string" && other === this.version) {
957
- return 0;
958
- }
959
- other = new SemVer(other, this.options);
960
- }
961
- if (other.version === this.version) {
962
- return 0;
963
- }
964
- return this.compareMain(other) || this.comparePre(other);
965
- }
966
- compareMain(other) {
967
- if (!(other instanceof SemVer)) {
968
- other = new SemVer(other, this.options);
969
- }
970
- if (this.major < other.major) {
971
- return -1;
972
- }
973
- if (this.major > other.major) {
974
- return 1;
975
- }
976
- if (this.minor < other.minor) {
977
- return -1;
978
- }
979
- if (this.minor > other.minor) {
980
- return 1;
981
- }
982
- if (this.patch < other.patch) {
983
- return -1;
984
- }
985
- if (this.patch > other.patch) {
986
- return 1;
987
- }
988
- return 0;
989
- }
990
- comparePre(other) {
991
- if (!(other instanceof SemVer)) {
992
- other = new SemVer(other, this.options);
993
- }
994
- if (this.prerelease.length && !other.prerelease.length) {
995
- return -1;
996
- } else if (!this.prerelease.length && other.prerelease.length) {
997
- return 1;
998
- } else if (!this.prerelease.length && !other.prerelease.length) {
999
- return 0;
1000
- }
1001
- let i = 0;
1002
- do {
1003
- const a = this.prerelease[i];
1004
- const b2 = other.prerelease[i];
1005
- debug("prerelease compare", i, a, b2);
1006
- if (a === undefined && b2 === undefined) {
1007
- return 0;
1008
- } else if (b2 === undefined) {
1009
- return 1;
1010
- } else if (a === undefined) {
1011
- return -1;
1012
- } else if (a === b2) {
1013
- continue;
1014
- } else {
1015
- return compareIdentifiers(a, b2);
1016
- }
1017
- } while (++i);
1018
- }
1019
- compareBuild(other) {
1020
- if (!(other instanceof SemVer)) {
1021
- other = new SemVer(other, this.options);
1022
- }
1023
- let i = 0;
1024
- do {
1025
- const a = this.build[i];
1026
- const b2 = other.build[i];
1027
- debug("build compare", i, a, b2);
1028
- if (a === undefined && b2 === undefined) {
1029
- return 0;
1030
- } else if (b2 === undefined) {
1031
- return 1;
1032
- } else if (a === undefined) {
1033
- return -1;
1034
- } else if (a === b2) {
1035
- continue;
1036
- } else {
1037
- return compareIdentifiers(a, b2);
1038
- }
1039
- } while (++i);
1040
- }
1041
- inc(release, identifier, identifierBase) {
1042
- if (release.startsWith("pre")) {
1043
- if (!identifier && identifierBase === false) {
1044
- throw new Error("invalid increment argument: identifier is empty");
1045
- }
1046
- if (identifier) {
1047
- const match = `-${identifier}`.match(this.options.loose ? re2[t.PRERELEASELOOSE] : re2[t.PRERELEASE]);
1048
- if (!match || match[1] !== identifier) {
1049
- throw new Error(`invalid identifier: ${identifier}`);
1050
- }
1051
- }
1052
- }
1053
- switch (release) {
1054
- case "premajor":
1055
- this.prerelease.length = 0;
1056
- this.patch = 0;
1057
- this.minor = 0;
1058
- this.major++;
1059
- this.inc("pre", identifier, identifierBase);
1060
- break;
1061
- case "preminor":
1062
- this.prerelease.length = 0;
1063
- this.patch = 0;
1064
- this.minor++;
1065
- this.inc("pre", identifier, identifierBase);
1066
- break;
1067
- case "prepatch":
1068
- this.prerelease.length = 0;
1069
- this.inc("patch", identifier, identifierBase);
1070
- this.inc("pre", identifier, identifierBase);
1071
- break;
1072
- case "prerelease":
1073
- if (this.prerelease.length === 0) {
1074
- this.inc("patch", identifier, identifierBase);
1075
- }
1076
- this.inc("pre", identifier, identifierBase);
1077
- break;
1078
- case "release":
1079
- if (this.prerelease.length === 0) {
1080
- throw new Error(`version ${this.raw} is not a prerelease`);
1081
- }
1082
- this.prerelease.length = 0;
1083
- break;
1084
- case "major":
1085
- if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
1086
- this.major++;
1087
- }
1088
- this.minor = 0;
1089
- this.patch = 0;
1090
- this.prerelease = [];
1091
- break;
1092
- case "minor":
1093
- if (this.patch !== 0 || this.prerelease.length === 0) {
1094
- this.minor++;
1095
- }
1096
- this.patch = 0;
1097
- this.prerelease = [];
1098
- break;
1099
- case "patch":
1100
- if (this.prerelease.length === 0) {
1101
- this.patch++;
1102
- }
1103
- this.prerelease = [];
1104
- break;
1105
- case "pre": {
1106
- const base = Number(identifierBase) ? 1 : 0;
1107
- if (this.prerelease.length === 0) {
1108
- this.prerelease = [base];
1109
- } else {
1110
- let i = this.prerelease.length;
1111
- while (--i >= 0) {
1112
- if (typeof this.prerelease[i] === "number") {
1113
- this.prerelease[i]++;
1114
- i = -2;
1115
- }
1116
- }
1117
- if (i === -1) {
1118
- if (identifier === this.prerelease.join(".") && identifierBase === false) {
1119
- throw new Error("invalid increment argument: identifier already exists");
1120
- }
1121
- this.prerelease.push(base);
1122
- }
1123
- }
1124
- if (identifier) {
1125
- let prerelease = [identifier, base];
1126
- if (identifierBase === false) {
1127
- prerelease = [identifier];
1128
- }
1129
- if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
1130
- if (isNaN(this.prerelease[1])) {
1131
- this.prerelease = prerelease;
1132
- }
1133
- } else {
1134
- this.prerelease = prerelease;
1135
- }
1136
- }
1137
- break;
1138
- }
1139
- default:
1140
- throw new Error(`invalid increment argument: ${release}`);
1141
- }
1142
- this.raw = this.format();
1143
- if (this.build.length) {
1144
- this.raw += `+${this.build.join(".")}`;
1145
- }
1146
- return this;
1147
- }
1148
- }
1149
- semver$1 = SemVer;
1150
- return semver$1;
1151
- }
1152
- var parse_1;
1153
- var hasRequiredParse;
1154
- function requireParse() {
1155
- if (hasRequiredParse)
1156
- return parse_1;
1157
- hasRequiredParse = 1;
1158
- const SemVer = requireSemver$1();
1159
- const parse = (version, options, throwErrors = false) => {
1160
- if (version instanceof SemVer) {
1161
- return version;
1162
- }
1163
- try {
1164
- return new SemVer(version, options);
1165
- } catch (er) {
1166
- if (!throwErrors) {
1167
- return null;
1168
- }
1169
- throw er;
1170
- }
1171
- };
1172
- parse_1 = parse;
1173
- return parse_1;
1174
- }
1175
- var valid_1;
1176
- var hasRequiredValid$1;
1177
- function requireValid$1() {
1178
- if (hasRequiredValid$1)
1179
- return valid_1;
1180
- hasRequiredValid$1 = 1;
1181
- const parse = requireParse();
1182
- const valid = (version, options) => {
1183
- const v = parse(version, options);
1184
- return v ? v.version : null;
1185
- };
1186
- valid_1 = valid;
1187
- return valid_1;
1188
- }
1189
- var clean_1;
1190
- var hasRequiredClean;
1191
- function requireClean() {
1192
- if (hasRequiredClean)
1193
- return clean_1;
1194
- hasRequiredClean = 1;
1195
- const parse = requireParse();
1196
- const clean = (version, options) => {
1197
- const s = parse(version.trim().replace(/^[=v]+/, ""), options);
1198
- return s ? s.version : null;
1199
- };
1200
- clean_1 = clean;
1201
- return clean_1;
1202
- }
1203
- var inc_1;
1204
- var hasRequiredInc;
1205
- function requireInc() {
1206
- if (hasRequiredInc)
1207
- return inc_1;
1208
- hasRequiredInc = 1;
1209
- const SemVer = requireSemver$1();
1210
- const inc = (version, release, options, identifier, identifierBase) => {
1211
- if (typeof options === "string") {
1212
- identifierBase = identifier;
1213
- identifier = options;
1214
- options = undefined;
1215
- }
1216
- try {
1217
- return new SemVer(version instanceof SemVer ? version.version : version, options).inc(release, identifier, identifierBase).version;
1218
- } catch (er) {
1219
- return null;
1220
- }
1221
- };
1222
- inc_1 = inc;
1223
- return inc_1;
1224
- }
1225
- var diff_1;
1226
- var hasRequiredDiff;
1227
- function requireDiff() {
1228
- if (hasRequiredDiff)
1229
- return diff_1;
1230
- hasRequiredDiff = 1;
1231
- const parse = requireParse();
1232
- const diff = (version1, version2) => {
1233
- const v1 = parse(version1, null, true);
1234
- const v2 = parse(version2, null, true);
1235
- const comparison = v1.compare(v2);
1236
- if (comparison === 0) {
1237
- return null;
1238
- }
1239
- const v1Higher = comparison > 0;
1240
- const highVersion = v1Higher ? v1 : v2;
1241
- const lowVersion = v1Higher ? v2 : v1;
1242
- const highHasPre = !!highVersion.prerelease.length;
1243
- const lowHasPre = !!lowVersion.prerelease.length;
1244
- if (lowHasPre && !highHasPre) {
1245
- if (!lowVersion.patch && !lowVersion.minor) {
1246
- return "major";
1247
- }
1248
- if (lowVersion.compareMain(highVersion) === 0) {
1249
- if (lowVersion.minor && !lowVersion.patch) {
1250
- return "minor";
1251
- }
1252
- return "patch";
1253
- }
1254
- }
1255
- const prefix = highHasPre ? "pre" : "";
1256
- if (v1.major !== v2.major) {
1257
- return prefix + "major";
1258
- }
1259
- if (v1.minor !== v2.minor) {
1260
- return prefix + "minor";
1261
- }
1262
- if (v1.patch !== v2.patch) {
1263
- return prefix + "patch";
1264
- }
1265
- return "prerelease";
1266
- };
1267
- diff_1 = diff;
1268
- return diff_1;
1269
- }
1270
- var major_1;
1271
- var hasRequiredMajor;
1272
- function requireMajor() {
1273
- if (hasRequiredMajor)
1274
- return major_1;
1275
- hasRequiredMajor = 1;
1276
- const SemVer = requireSemver$1();
1277
- const major = (a, loose) => new SemVer(a, loose).major;
1278
- major_1 = major;
1279
- return major_1;
1280
- }
1281
- var minor_1;
1282
- var hasRequiredMinor;
1283
- function requireMinor() {
1284
- if (hasRequiredMinor)
1285
- return minor_1;
1286
- hasRequiredMinor = 1;
1287
- const SemVer = requireSemver$1();
1288
- const minor = (a, loose) => new SemVer(a, loose).minor;
1289
- minor_1 = minor;
1290
- return minor_1;
1291
- }
1292
- var patch_1;
1293
- var hasRequiredPatch;
1294
- function requirePatch() {
1295
- if (hasRequiredPatch)
1296
- return patch_1;
1297
- hasRequiredPatch = 1;
1298
- const SemVer = requireSemver$1();
1299
- const patch = (a, loose) => new SemVer(a, loose).patch;
1300
- patch_1 = patch;
1301
- return patch_1;
1302
- }
1303
- var prerelease_1;
1304
- var hasRequiredPrerelease;
1305
- function requirePrerelease() {
1306
- if (hasRequiredPrerelease)
1307
- return prerelease_1;
1308
- hasRequiredPrerelease = 1;
1309
- const parse = requireParse();
1310
- const prerelease = (version, options) => {
1311
- const parsed = parse(version, options);
1312
- return parsed && parsed.prerelease.length ? parsed.prerelease : null;
1313
- };
1314
- prerelease_1 = prerelease;
1315
- return prerelease_1;
1316
- }
1317
- var compare_1;
1318
- var hasRequiredCompare;
1319
- function requireCompare() {
1320
- if (hasRequiredCompare)
1321
- return compare_1;
1322
- hasRequiredCompare = 1;
1323
- const SemVer = requireSemver$1();
1324
- const compare = (a, b2, loose) => new SemVer(a, loose).compare(new SemVer(b2, loose));
1325
- compare_1 = compare;
1326
- return compare_1;
1327
- }
1328
- var rcompare_1;
1329
- var hasRequiredRcompare;
1330
- function requireRcompare() {
1331
- if (hasRequiredRcompare)
1332
- return rcompare_1;
1333
- hasRequiredRcompare = 1;
1334
- const compare = requireCompare();
1335
- const rcompare = (a, b2, loose) => compare(b2, a, loose);
1336
- rcompare_1 = rcompare;
1337
- return rcompare_1;
1338
- }
1339
- var compareLoose_1;
1340
- var hasRequiredCompareLoose;
1341
- function requireCompareLoose() {
1342
- if (hasRequiredCompareLoose)
1343
- return compareLoose_1;
1344
- hasRequiredCompareLoose = 1;
1345
- const compare = requireCompare();
1346
- const compareLoose = (a, b2) => compare(a, b2, true);
1347
- compareLoose_1 = compareLoose;
1348
- return compareLoose_1;
1349
- }
1350
- var compareBuild_1;
1351
- var hasRequiredCompareBuild;
1352
- function requireCompareBuild() {
1353
- if (hasRequiredCompareBuild)
1354
- return compareBuild_1;
1355
- hasRequiredCompareBuild = 1;
1356
- const SemVer = requireSemver$1();
1357
- const compareBuild = (a, b2, loose) => {
1358
- const versionA = new SemVer(a, loose);
1359
- const versionB = new SemVer(b2, loose);
1360
- return versionA.compare(versionB) || versionA.compareBuild(versionB);
1361
- };
1362
- compareBuild_1 = compareBuild;
1363
- return compareBuild_1;
1364
- }
1365
- var sort_1;
1366
- var hasRequiredSort;
1367
- function requireSort() {
1368
- if (hasRequiredSort)
1369
- return sort_1;
1370
- hasRequiredSort = 1;
1371
- const compareBuild = requireCompareBuild();
1372
- const sort = (list, loose) => list.sort((a, b2) => compareBuild(a, b2, loose));
1373
- sort_1 = sort;
1374
- return sort_1;
1375
- }
1376
- var rsort_1;
1377
- var hasRequiredRsort;
1378
- function requireRsort() {
1379
- if (hasRequiredRsort)
1380
- return rsort_1;
1381
- hasRequiredRsort = 1;
1382
- const compareBuild = requireCompareBuild();
1383
- const rsort = (list, loose) => list.sort((a, b2) => compareBuild(b2, a, loose));
1384
- rsort_1 = rsort;
1385
- return rsort_1;
1386
- }
1387
- var gt_1;
1388
- var hasRequiredGt;
1389
- function requireGt() {
1390
- if (hasRequiredGt)
1391
- return gt_1;
1392
- hasRequiredGt = 1;
1393
- const compare = requireCompare();
1394
- const gt = (a, b2, loose) => compare(a, b2, loose) > 0;
1395
- gt_1 = gt;
1396
- return gt_1;
1397
- }
1398
- var lt_1;
1399
- var hasRequiredLt;
1400
- function requireLt() {
1401
- if (hasRequiredLt)
1402
- return lt_1;
1403
- hasRequiredLt = 1;
1404
- const compare = requireCompare();
1405
- const lt = (a, b2, loose) => compare(a, b2, loose) < 0;
1406
- lt_1 = lt;
1407
- return lt_1;
1408
- }
1409
- var eq_1;
1410
- var hasRequiredEq;
1411
- function requireEq() {
1412
- if (hasRequiredEq)
1413
- return eq_1;
1414
- hasRequiredEq = 1;
1415
- const compare = requireCompare();
1416
- const eq = (a, b2, loose) => compare(a, b2, loose) === 0;
1417
- eq_1 = eq;
1418
- return eq_1;
1419
- }
1420
- var neq_1;
1421
- var hasRequiredNeq;
1422
- function requireNeq() {
1423
- if (hasRequiredNeq)
1424
- return neq_1;
1425
- hasRequiredNeq = 1;
1426
- const compare = requireCompare();
1427
- const neq = (a, b2, loose) => compare(a, b2, loose) !== 0;
1428
- neq_1 = neq;
1429
- return neq_1;
1430
- }
1431
- var gte_1;
1432
- var hasRequiredGte;
1433
- function requireGte() {
1434
- if (hasRequiredGte)
1435
- return gte_1;
1436
- hasRequiredGte = 1;
1437
- const compare = requireCompare();
1438
- const gte = (a, b2, loose) => compare(a, b2, loose) >= 0;
1439
- gte_1 = gte;
1440
- return gte_1;
1441
- }
1442
- var lte_1;
1443
- var hasRequiredLte;
1444
- function requireLte() {
1445
- if (hasRequiredLte)
1446
- return lte_1;
1447
- hasRequiredLte = 1;
1448
- const compare = requireCompare();
1449
- const lte = (a, b2, loose) => compare(a, b2, loose) <= 0;
1450
- lte_1 = lte;
1451
- return lte_1;
1452
- }
1453
- var cmp_1;
1454
- var hasRequiredCmp;
1455
- function requireCmp() {
1456
- if (hasRequiredCmp)
1457
- return cmp_1;
1458
- hasRequiredCmp = 1;
1459
- const eq = requireEq();
1460
- const neq = requireNeq();
1461
- const gt = requireGt();
1462
- const gte = requireGte();
1463
- const lt = requireLt();
1464
- const lte = requireLte();
1465
- const cmp = (a, op, b2, loose) => {
1466
- switch (op) {
1467
- case "===":
1468
- if (typeof a === "object") {
1469
- a = a.version;
1470
- }
1471
- if (typeof b2 === "object") {
1472
- b2 = b2.version;
1473
- }
1474
- return a === b2;
1475
- case "!==":
1476
- if (typeof a === "object") {
1477
- a = a.version;
1478
- }
1479
- if (typeof b2 === "object") {
1480
- b2 = b2.version;
1481
- }
1482
- return a !== b2;
1483
- case "":
1484
- case "=":
1485
- case "==":
1486
- return eq(a, b2, loose);
1487
- case "!=":
1488
- return neq(a, b2, loose);
1489
- case ">":
1490
- return gt(a, b2, loose);
1491
- case ">=":
1492
- return gte(a, b2, loose);
1493
- case "<":
1494
- return lt(a, b2, loose);
1495
- case "<=":
1496
- return lte(a, b2, loose);
1497
- default:
1498
- throw new TypeError(`Invalid operator: ${op}`);
1499
- }
1500
- };
1501
- cmp_1 = cmp;
1502
- return cmp_1;
1503
- }
1504
- var coerce_1;
1505
- var hasRequiredCoerce;
1506
- function requireCoerce() {
1507
- if (hasRequiredCoerce)
1508
- return coerce_1;
1509
- hasRequiredCoerce = 1;
1510
- const SemVer = requireSemver$1();
1511
- const parse = requireParse();
1512
- const { safeRe: re2, t } = requireRe();
1513
- const coerce = (version, options) => {
1514
- if (version instanceof SemVer) {
1515
- return version;
1516
- }
1517
- if (typeof version === "number") {
1518
- version = String(version);
1519
- }
1520
- if (typeof version !== "string") {
1521
- return null;
1522
- }
1523
- options = options || {};
1524
- let match = null;
1525
- if (!options.rtl) {
1526
- match = version.match(options.includePrerelease ? re2[t.COERCEFULL] : re2[t.COERCE]);
1527
- } else {
1528
- const coerceRtlRegex = options.includePrerelease ? re2[t.COERCERTLFULL] : re2[t.COERCERTL];
1529
- let next;
1530
- while ((next = coerceRtlRegex.exec(version)) && (!match || match.index + match[0].length !== version.length)) {
1531
- if (!match || next.index + next[0].length !== match.index + match[0].length) {
1532
- match = next;
1533
- }
1534
- coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
1535
- }
1536
- coerceRtlRegex.lastIndex = -1;
1537
- }
1538
- if (match === null) {
1539
- return null;
1540
- }
1541
- const major = match[2];
1542
- const minor = match[3] || "0";
1543
- const patch = match[4] || "0";
1544
- const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : "";
1545
- const build = options.includePrerelease && match[6] ? `+${match[6]}` : "";
1546
- return parse(`${major}.${minor}.${patch}${prerelease}${build}`, options);
1547
- };
1548
- coerce_1 = coerce;
1549
- return coerce_1;
1550
- }
1551
- var lrucache;
1552
- var hasRequiredLrucache;
1553
- function requireLrucache() {
1554
- if (hasRequiredLrucache)
1555
- return lrucache;
1556
- hasRequiredLrucache = 1;
1557
-
1558
- class LRUCache {
1559
- constructor() {
1560
- this.max = 1000;
1561
- this.map = new Map;
1562
- }
1563
- get(key) {
1564
- const value = this.map.get(key);
1565
- if (value === undefined) {
1566
- return;
1567
- } else {
1568
- this.map.delete(key);
1569
- this.map.set(key, value);
1570
- return value;
1571
- }
1572
- }
1573
- delete(key) {
1574
- return this.map.delete(key);
1575
- }
1576
- set(key, value) {
1577
- const deleted = this.delete(key);
1578
- if (!deleted && value !== undefined) {
1579
- if (this.map.size >= this.max) {
1580
- const firstKey = this.map.keys().next().value;
1581
- this.delete(firstKey);
1582
- }
1583
- this.map.set(key, value);
1584
- }
1585
- return this;
1586
- }
1587
- }
1588
- lrucache = LRUCache;
1589
- return lrucache;
1590
- }
1591
- var range;
1592
- var hasRequiredRange;
1593
- function requireRange() {
1594
- if (hasRequiredRange)
1595
- return range;
1596
- hasRequiredRange = 1;
1597
- const SPACE_CHARACTERS = /\s+/g;
1598
-
1599
- class Range {
1600
- constructor(range2, options) {
1601
- options = parseOptions(options);
1602
- if (range2 instanceof Range) {
1603
- if (range2.loose === !!options.loose && range2.includePrerelease === !!options.includePrerelease) {
1604
- return range2;
1605
- } else {
1606
- return new Range(range2.raw, options);
1607
- }
1608
- }
1609
- if (range2 instanceof Comparator) {
1610
- this.raw = range2.value;
1611
- this.set = [[range2]];
1612
- this.formatted = undefined;
1613
- return this;
1614
- }
1615
- this.options = options;
1616
- this.loose = !!options.loose;
1617
- this.includePrerelease = !!options.includePrerelease;
1618
- this.raw = range2.trim().replace(SPACE_CHARACTERS, " ");
1619
- this.set = this.raw.split("||").map((r2) => this.parseRange(r2.trim())).filter((c2) => c2.length);
1620
- if (!this.set.length) {
1621
- throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
1622
- }
1623
- if (this.set.length > 1) {
1624
- const first = this.set[0];
1625
- this.set = this.set.filter((c2) => !isNullSet(c2[0]));
1626
- if (this.set.length === 0) {
1627
- this.set = [first];
1628
- } else if (this.set.length > 1) {
1629
- for (const c2 of this.set) {
1630
- if (c2.length === 1 && isAny(c2[0])) {
1631
- this.set = [c2];
1632
- break;
1633
- }
1634
- }
1635
- }
1636
- }
1637
- this.formatted = undefined;
1638
- }
1639
- get range() {
1640
- if (this.formatted === undefined) {
1641
- this.formatted = "";
1642
- for (let i = 0;i < this.set.length; i++) {
1643
- if (i > 0) {
1644
- this.formatted += "||";
1645
- }
1646
- const comps = this.set[i];
1647
- for (let k = 0;k < comps.length; k++) {
1648
- if (k > 0) {
1649
- this.formatted += " ";
1650
- }
1651
- this.formatted += comps[k].toString().trim();
1652
- }
1653
- }
1654
- }
1655
- return this.formatted;
1656
- }
1657
- format() {
1658
- return this.range;
1659
- }
1660
- toString() {
1661
- return this.range;
1662
- }
1663
- parseRange(range2) {
1664
- const memoOpts = (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE);
1665
- const memoKey = memoOpts + ":" + range2;
1666
- const cached = cache.get(memoKey);
1667
- if (cached) {
1668
- return cached;
1669
- }
1670
- const loose = this.options.loose;
1671
- const hr = loose ? re2[t.HYPHENRANGELOOSE] : re2[t.HYPHENRANGE];
1672
- range2 = range2.replace(hr, hyphenReplace(this.options.includePrerelease));
1673
- debug("hyphen replace", range2);
1674
- range2 = range2.replace(re2[t.COMPARATORTRIM], comparatorTrimReplace);
1675
- debug("comparator trim", range2);
1676
- range2 = range2.replace(re2[t.TILDETRIM], tildeTrimReplace);
1677
- debug("tilde trim", range2);
1678
- range2 = range2.replace(re2[t.CARETTRIM], caretTrimReplace);
1679
- debug("caret trim", range2);
1680
- let rangeList = range2.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
1681
- if (loose) {
1682
- rangeList = rangeList.filter((comp) => {
1683
- debug("loose invalid filter", comp, this.options);
1684
- return !!comp.match(re2[t.COMPARATORLOOSE]);
1685
- });
1686
- }
1687
- debug("range list", rangeList);
1688
- const rangeMap = new Map;
1689
- const comparators = rangeList.map((comp) => new Comparator(comp, this.options));
1690
- for (const comp of comparators) {
1691
- if (isNullSet(comp)) {
1692
- return [comp];
1693
- }
1694
- rangeMap.set(comp.value, comp);
1695
- }
1696
- if (rangeMap.size > 1 && rangeMap.has("")) {
1697
- rangeMap.delete("");
1698
- }
1699
- const result = [...rangeMap.values()];
1700
- cache.set(memoKey, result);
1701
- return result;
1702
- }
1703
- intersects(range2, options) {
1704
- if (!(range2 instanceof Range)) {
1705
- throw new TypeError("a Range is required");
1706
- }
1707
- return this.set.some((thisComparators) => {
1708
- return isSatisfiable(thisComparators, options) && range2.set.some((rangeComparators) => {
1709
- return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
1710
- return rangeComparators.every((rangeComparator) => {
1711
- return thisComparator.intersects(rangeComparator, options);
1712
- });
1713
- });
1714
- });
1715
- });
1716
- }
1717
- test(version) {
1718
- if (!version) {
1719
- return false;
1720
- }
1721
- if (typeof version === "string") {
1722
- try {
1723
- version = new SemVer(version, this.options);
1724
- } catch (er) {
1725
- return false;
1726
- }
1727
- }
1728
- for (let i = 0;i < this.set.length; i++) {
1729
- if (testSet(this.set[i], version, this.options)) {
1730
- return true;
1731
- }
1732
- }
1733
- return false;
1734
- }
1735
- }
1736
- range = Range;
1737
- const LRU = requireLrucache();
1738
- const cache = new LRU;
1739
- const parseOptions = requireParseOptions();
1740
- const Comparator = requireComparator();
1741
- const debug = requireDebug();
1742
- const SemVer = requireSemver$1();
1743
- const {
1744
- safeRe: re2,
1745
- t,
1746
- comparatorTrimReplace,
1747
- tildeTrimReplace,
1748
- caretTrimReplace
1749
- } = requireRe();
1750
- const { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = requireConstants();
1751
- const isNullSet = (c2) => c2.value === "<0.0.0-0";
1752
- const isAny = (c2) => c2.value === "";
1753
- const isSatisfiable = (comparators, options) => {
1754
- let result = true;
1755
- const remainingComparators = comparators.slice();
1756
- let testComparator = remainingComparators.pop();
1757
- while (result && remainingComparators.length) {
1758
- result = remainingComparators.every((otherComparator) => {
1759
- return testComparator.intersects(otherComparator, options);
1760
- });
1761
- testComparator = remainingComparators.pop();
1762
- }
1763
- return result;
1764
- };
1765
- const parseComparator = (comp, options) => {
1766
- comp = comp.replace(re2[t.BUILD], "");
1767
- debug("comp", comp, options);
1768
- comp = replaceCarets(comp, options);
1769
- debug("caret", comp);
1770
- comp = replaceTildes(comp, options);
1771
- debug("tildes", comp);
1772
- comp = replaceXRanges(comp, options);
1773
- debug("xrange", comp);
1774
- comp = replaceStars(comp, options);
1775
- debug("stars", comp);
1776
- return comp;
1777
- };
1778
- const isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
1779
- const replaceTildes = (comp, options) => {
1780
- return comp.trim().split(/\s+/).map((c2) => replaceTilde(c2, options)).join(" ");
1781
- };
1782
- const replaceTilde = (comp, options) => {
1783
- const r2 = options.loose ? re2[t.TILDELOOSE] : re2[t.TILDE];
1784
- return comp.replace(r2, (_, M, m3, p2, pr) => {
1785
- debug("tilde", comp, _, M, m3, p2, pr);
1786
- let ret;
1787
- if (isX(M)) {
1788
- ret = "";
1789
- } else if (isX(m3)) {
1790
- ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
1791
- } else if (isX(p2)) {
1792
- ret = `>=${M}.${m3}.0 <${M}.${+m3 + 1}.0-0`;
1793
- } else if (pr) {
1794
- debug("replaceTilde pr", pr);
1795
- ret = `>=${M}.${m3}.${p2}-${pr} <${M}.${+m3 + 1}.0-0`;
1796
- } else {
1797
- ret = `>=${M}.${m3}.${p2} <${M}.${+m3 + 1}.0-0`;
1798
- }
1799
- debug("tilde return", ret);
1800
- return ret;
1801
- });
1802
- };
1803
- const replaceCarets = (comp, options) => {
1804
- return comp.trim().split(/\s+/).map((c2) => replaceCaret(c2, options)).join(" ");
1805
- };
1806
- const replaceCaret = (comp, options) => {
1807
- debug("caret", comp, options);
1808
- const r2 = options.loose ? re2[t.CARETLOOSE] : re2[t.CARET];
1809
- const z2 = options.includePrerelease ? "-0" : "";
1810
- return comp.replace(r2, (_, M, m3, p2, pr) => {
1811
- debug("caret", comp, _, M, m3, p2, pr);
1812
- let ret;
1813
- if (isX(M)) {
1814
- ret = "";
1815
- } else if (isX(m3)) {
1816
- ret = `>=${M}.0.0${z2} <${+M + 1}.0.0-0`;
1817
- } else if (isX(p2)) {
1818
- if (M === "0") {
1819
- ret = `>=${M}.${m3}.0${z2} <${M}.${+m3 + 1}.0-0`;
1820
- } else {
1821
- ret = `>=${M}.${m3}.0${z2} <${+M + 1}.0.0-0`;
1822
- }
1823
- } else if (pr) {
1824
- debug("replaceCaret pr", pr);
1825
- if (M === "0") {
1826
- if (m3 === "0") {
1827
- ret = `>=${M}.${m3}.${p2}-${pr} <${M}.${m3}.${+p2 + 1}-0`;
1828
- } else {
1829
- ret = `>=${M}.${m3}.${p2}-${pr} <${M}.${+m3 + 1}.0-0`;
1830
- }
1831
- } else {
1832
- ret = `>=${M}.${m3}.${p2}-${pr} <${+M + 1}.0.0-0`;
1833
- }
1834
- } else {
1835
- debug("no pr");
1836
- if (M === "0") {
1837
- if (m3 === "0") {
1838
- ret = `>=${M}.${m3}.${p2}${z2} <${M}.${m3}.${+p2 + 1}-0`;
1839
- } else {
1840
- ret = `>=${M}.${m3}.${p2}${z2} <${M}.${+m3 + 1}.0-0`;
1841
- }
1842
- } else {
1843
- ret = `>=${M}.${m3}.${p2} <${+M + 1}.0.0-0`;
1844
- }
1845
- }
1846
- debug("caret return", ret);
1847
- return ret;
1848
- });
1849
- };
1850
- const replaceXRanges = (comp, options) => {
1851
- debug("replaceXRanges", comp, options);
1852
- return comp.split(/\s+/).map((c2) => replaceXRange(c2, options)).join(" ");
1853
- };
1854
- const replaceXRange = (comp, options) => {
1855
- comp = comp.trim();
1856
- const r2 = options.loose ? re2[t.XRANGELOOSE] : re2[t.XRANGE];
1857
- return comp.replace(r2, (ret, gtlt, M, m3, p2, pr) => {
1858
- debug("xRange", comp, ret, gtlt, M, m3, p2, pr);
1859
- const xM = isX(M);
1860
- const xm = xM || isX(m3);
1861
- const xp = xm || isX(p2);
1862
- const anyX = xp;
1863
- if (gtlt === "=" && anyX) {
1864
- gtlt = "";
1865
- }
1866
- pr = options.includePrerelease ? "-0" : "";
1867
- if (xM) {
1868
- if (gtlt === ">" || gtlt === "<") {
1869
- ret = "<0.0.0-0";
1870
- } else {
1871
- ret = "*";
1872
- }
1873
- } else if (gtlt && anyX) {
1874
- if (xm) {
1875
- m3 = 0;
1876
- }
1877
- p2 = 0;
1878
- if (gtlt === ">") {
1879
- gtlt = ">=";
1880
- if (xm) {
1881
- M = +M + 1;
1882
- m3 = 0;
1883
- p2 = 0;
1884
- } else {
1885
- m3 = +m3 + 1;
1886
- p2 = 0;
1887
- }
1888
- } else if (gtlt === "<=") {
1889
- gtlt = "<";
1890
- if (xm) {
1891
- M = +M + 1;
1892
- } else {
1893
- m3 = +m3 + 1;
1894
- }
1895
- }
1896
- if (gtlt === "<") {
1897
- pr = "-0";
1898
- }
1899
- ret = `${gtlt + M}.${m3}.${p2}${pr}`;
1900
- } else if (xm) {
1901
- ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
1902
- } else if (xp) {
1903
- ret = `>=${M}.${m3}.0${pr} <${M}.${+m3 + 1}.0-0`;
1904
- }
1905
- debug("xRange return", ret);
1906
- return ret;
1907
- });
1908
- };
1909
- const replaceStars = (comp, options) => {
1910
- debug("replaceStars", comp, options);
1911
- return comp.trim().replace(re2[t.STAR], "");
1912
- };
1913
- const replaceGTE0 = (comp, options) => {
1914
- debug("replaceGTE0", comp, options);
1915
- return comp.trim().replace(re2[options.includePrerelease ? t.GTE0PRE : t.GTE0], "");
1916
- };
1917
- const hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
1918
- if (isX(fM)) {
1919
- from = "";
1920
- } else if (isX(fm)) {
1921
- from = `>=${fM}.0.0${incPr ? "-0" : ""}`;
1922
- } else if (isX(fp)) {
1923
- from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`;
1924
- } else if (fpr) {
1925
- from = `>=${from}`;
1926
- } else {
1927
- from = `>=${from}${incPr ? "-0" : ""}`;
1928
- }
1929
- if (isX(tM)) {
1930
- to = "";
1931
- } else if (isX(tm)) {
1932
- to = `<${+tM + 1}.0.0-0`;
1933
- } else if (isX(tp)) {
1934
- to = `<${tM}.${+tm + 1}.0-0`;
1935
- } else if (tpr) {
1936
- to = `<=${tM}.${tm}.${tp}-${tpr}`;
1937
- } else if (incPr) {
1938
- to = `<${tM}.${tm}.${+tp + 1}-0`;
1939
- } else {
1940
- to = `<=${to}`;
1941
- }
1942
- return `${from} ${to}`.trim();
1943
- };
1944
- const testSet = (set, version, options) => {
1945
- for (let i = 0;i < set.length; i++) {
1946
- if (!set[i].test(version)) {
1947
- return false;
1948
- }
1949
- }
1950
- if (version.prerelease.length && !options.includePrerelease) {
1951
- for (let i = 0;i < set.length; i++) {
1952
- debug(set[i].semver);
1953
- if (set[i].semver === Comparator.ANY) {
1954
- continue;
1955
- }
1956
- if (set[i].semver.prerelease.length > 0) {
1957
- const allowed = set[i].semver;
1958
- if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) {
1959
- return true;
1960
- }
1961
- }
1962
- }
1963
- return false;
1964
- }
1965
- return true;
1966
- };
1967
- return range;
1968
- }
1969
- var comparator;
1970
- var hasRequiredComparator;
1971
- function requireComparator() {
1972
- if (hasRequiredComparator)
1973
- return comparator;
1974
- hasRequiredComparator = 1;
1975
- const ANY = Symbol("SemVer ANY");
1976
-
1977
- class Comparator {
1978
- static get ANY() {
1979
- return ANY;
1980
- }
1981
- constructor(comp, options) {
1982
- options = parseOptions(options);
1983
- if (comp instanceof Comparator) {
1984
- if (comp.loose === !!options.loose) {
1985
- return comp;
1986
- } else {
1987
- comp = comp.value;
1988
- }
1989
- }
1990
- comp = comp.trim().split(/\s+/).join(" ");
1991
- debug("comparator", comp, options);
1992
- this.options = options;
1993
- this.loose = !!options.loose;
1994
- this.parse(comp);
1995
- if (this.semver === ANY) {
1996
- this.value = "";
1997
- } else {
1998
- this.value = this.operator + this.semver.version;
1999
- }
2000
- debug("comp", this);
2001
- }
2002
- parse(comp) {
2003
- const r2 = this.options.loose ? re2[t.COMPARATORLOOSE] : re2[t.COMPARATOR];
2004
- const m3 = comp.match(r2);
2005
- if (!m3) {
2006
- throw new TypeError(`Invalid comparator: ${comp}`);
2007
- }
2008
- this.operator = m3[1] !== undefined ? m3[1] : "";
2009
- if (this.operator === "=") {
2010
- this.operator = "";
2011
- }
2012
- if (!m3[2]) {
2013
- this.semver = ANY;
2014
- } else {
2015
- this.semver = new SemVer(m3[2], this.options.loose);
2016
- }
2017
- }
2018
- toString() {
2019
- return this.value;
2020
- }
2021
- test(version) {
2022
- debug("Comparator.test", version, this.options.loose);
2023
- if (this.semver === ANY || version === ANY) {
2024
- return true;
2025
- }
2026
- if (typeof version === "string") {
2027
- try {
2028
- version = new SemVer(version, this.options);
2029
- } catch (er) {
2030
- return false;
2031
- }
2032
- }
2033
- return cmp(version, this.operator, this.semver, this.options);
2034
- }
2035
- intersects(comp, options) {
2036
- if (!(comp instanceof Comparator)) {
2037
- throw new TypeError("a Comparator is required");
2038
- }
2039
- if (this.operator === "") {
2040
- if (this.value === "") {
2041
- return true;
2042
- }
2043
- return new Range(comp.value, options).test(this.value);
2044
- } else if (comp.operator === "") {
2045
- if (comp.value === "") {
2046
- return true;
2047
- }
2048
- return new Range(this.value, options).test(comp.semver);
2049
- }
2050
- options = parseOptions(options);
2051
- if (options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) {
2052
- return false;
2053
- }
2054
- if (!options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) {
2055
- return false;
2056
- }
2057
- if (this.operator.startsWith(">") && comp.operator.startsWith(">")) {
2058
- return true;
2059
- }
2060
- if (this.operator.startsWith("<") && comp.operator.startsWith("<")) {
2061
- return true;
2062
- }
2063
- if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) {
2064
- return true;
2065
- }
2066
- if (cmp(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<")) {
2067
- return true;
2068
- }
2069
- if (cmp(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")) {
2070
- return true;
2071
- }
2072
- return false;
2073
- }
2074
- }
2075
- comparator = Comparator;
2076
- const parseOptions = requireParseOptions();
2077
- const { safeRe: re2, t } = requireRe();
2078
- const cmp = requireCmp();
2079
- const debug = requireDebug();
2080
- const SemVer = requireSemver$1();
2081
- const Range = requireRange();
2082
- return comparator;
2083
- }
2084
- var satisfies_1;
2085
- var hasRequiredSatisfies;
2086
- function requireSatisfies() {
2087
- if (hasRequiredSatisfies)
2088
- return satisfies_1;
2089
- hasRequiredSatisfies = 1;
2090
- const Range = requireRange();
2091
- const satisfies = (version, range2, options) => {
2092
- try {
2093
- range2 = new Range(range2, options);
2094
- } catch (er) {
2095
- return false;
2096
- }
2097
- return range2.test(version);
2098
- };
2099
- satisfies_1 = satisfies;
2100
- return satisfies_1;
2101
- }
2102
- var toComparators_1;
2103
- var hasRequiredToComparators;
2104
- function requireToComparators() {
2105
- if (hasRequiredToComparators)
2106
- return toComparators_1;
2107
- hasRequiredToComparators = 1;
2108
- const Range = requireRange();
2109
- const toComparators = (range2, options) => new Range(range2, options).set.map((comp) => comp.map((c2) => c2.value).join(" ").trim().split(" "));
2110
- toComparators_1 = toComparators;
2111
- return toComparators_1;
2112
- }
2113
- var maxSatisfying_1;
2114
- var hasRequiredMaxSatisfying;
2115
- function requireMaxSatisfying() {
2116
- if (hasRequiredMaxSatisfying)
2117
- return maxSatisfying_1;
2118
- hasRequiredMaxSatisfying = 1;
2119
- const SemVer = requireSemver$1();
2120
- const Range = requireRange();
2121
- const maxSatisfying = (versions, range2, options) => {
2122
- let max = null;
2123
- let maxSV = null;
2124
- let rangeObj = null;
2125
- try {
2126
- rangeObj = new Range(range2, options);
2127
- } catch (er) {
2128
- return null;
2129
- }
2130
- versions.forEach((v) => {
2131
- if (rangeObj.test(v)) {
2132
- if (!max || maxSV.compare(v) === -1) {
2133
- max = v;
2134
- maxSV = new SemVer(max, options);
2135
- }
2136
- }
2137
- });
2138
- return max;
2139
- };
2140
- maxSatisfying_1 = maxSatisfying;
2141
- return maxSatisfying_1;
2142
- }
2143
- var minSatisfying_1;
2144
- var hasRequiredMinSatisfying;
2145
- function requireMinSatisfying() {
2146
- if (hasRequiredMinSatisfying)
2147
- return minSatisfying_1;
2148
- hasRequiredMinSatisfying = 1;
2149
- const SemVer = requireSemver$1();
2150
- const Range = requireRange();
2151
- const minSatisfying = (versions, range2, options) => {
2152
- let min = null;
2153
- let minSV = null;
2154
- let rangeObj = null;
2155
- try {
2156
- rangeObj = new Range(range2, options);
2157
- } catch (er) {
2158
- return null;
2159
- }
2160
- versions.forEach((v) => {
2161
- if (rangeObj.test(v)) {
2162
- if (!min || minSV.compare(v) === 1) {
2163
- min = v;
2164
- minSV = new SemVer(min, options);
2165
- }
2166
- }
2167
- });
2168
- return min;
2169
- };
2170
- minSatisfying_1 = minSatisfying;
2171
- return minSatisfying_1;
2172
- }
2173
- var minVersion_1;
2174
- var hasRequiredMinVersion;
2175
- function requireMinVersion() {
2176
- if (hasRequiredMinVersion)
2177
- return minVersion_1;
2178
- hasRequiredMinVersion = 1;
2179
- const SemVer = requireSemver$1();
2180
- const Range = requireRange();
2181
- const gt = requireGt();
2182
- const minVersion = (range2, loose) => {
2183
- range2 = new Range(range2, loose);
2184
- let minver = new SemVer("0.0.0");
2185
- if (range2.test(minver)) {
2186
- return minver;
2187
- }
2188
- minver = new SemVer("0.0.0-0");
2189
- if (range2.test(minver)) {
2190
- return minver;
2191
- }
2192
- minver = null;
2193
- for (let i = 0;i < range2.set.length; ++i) {
2194
- const comparators = range2.set[i];
2195
- let setMin = null;
2196
- comparators.forEach((comparator2) => {
2197
- const compver = new SemVer(comparator2.semver.version);
2198
- switch (comparator2.operator) {
2199
- case ">":
2200
- if (compver.prerelease.length === 0) {
2201
- compver.patch++;
2202
- } else {
2203
- compver.prerelease.push(0);
2204
- }
2205
- compver.raw = compver.format();
2206
- case "":
2207
- case ">=":
2208
- if (!setMin || gt(compver, setMin)) {
2209
- setMin = compver;
2210
- }
2211
- break;
2212
- case "<":
2213
- case "<=":
2214
- break;
2215
- default:
2216
- throw new Error(`Unexpected operation: ${comparator2.operator}`);
2217
- }
2218
- });
2219
- if (setMin && (!minver || gt(minver, setMin))) {
2220
- minver = setMin;
2221
- }
2222
- }
2223
- if (minver && range2.test(minver)) {
2224
- return minver;
2225
- }
2226
- return null;
2227
- };
2228
- minVersion_1 = minVersion;
2229
- return minVersion_1;
2230
- }
2231
- var valid;
2232
- var hasRequiredValid;
2233
- function requireValid() {
2234
- if (hasRequiredValid)
2235
- return valid;
2236
- hasRequiredValid = 1;
2237
- const Range = requireRange();
2238
- const validRange = (range2, options) => {
2239
- try {
2240
- return new Range(range2, options).range || "*";
2241
- } catch (er) {
2242
- return null;
2243
- }
2244
- };
2245
- valid = validRange;
2246
- return valid;
2247
- }
2248
- var outside_1;
2249
- var hasRequiredOutside;
2250
- function requireOutside() {
2251
- if (hasRequiredOutside)
2252
- return outside_1;
2253
- hasRequiredOutside = 1;
2254
- const SemVer = requireSemver$1();
2255
- const Comparator = requireComparator();
2256
- const { ANY } = Comparator;
2257
- const Range = requireRange();
2258
- const satisfies = requireSatisfies();
2259
- const gt = requireGt();
2260
- const lt = requireLt();
2261
- const lte = requireLte();
2262
- const gte = requireGte();
2263
- const outside = (version, range2, hilo, options) => {
2264
- version = new SemVer(version, options);
2265
- range2 = new Range(range2, options);
2266
- let gtfn, ltefn, ltfn, comp, ecomp;
2267
- switch (hilo) {
2268
- case ">":
2269
- gtfn = gt;
2270
- ltefn = lte;
2271
- ltfn = lt;
2272
- comp = ">";
2273
- ecomp = ">=";
2274
- break;
2275
- case "<":
2276
- gtfn = lt;
2277
- ltefn = gte;
2278
- ltfn = gt;
2279
- comp = "<";
2280
- ecomp = "<=";
2281
- break;
2282
- default:
2283
- throw new TypeError('Must provide a hilo val of "<" or ">"');
2284
- }
2285
- if (satisfies(version, range2, options)) {
2286
- return false;
2287
- }
2288
- for (let i = 0;i < range2.set.length; ++i) {
2289
- const comparators = range2.set[i];
2290
- let high = null;
2291
- let low = null;
2292
- comparators.forEach((comparator2) => {
2293
- if (comparator2.semver === ANY) {
2294
- comparator2 = new Comparator(">=0.0.0");
2295
- }
2296
- high = high || comparator2;
2297
- low = low || comparator2;
2298
- if (gtfn(comparator2.semver, high.semver, options)) {
2299
- high = comparator2;
2300
- } else if (ltfn(comparator2.semver, low.semver, options)) {
2301
- low = comparator2;
2302
- }
2303
- });
2304
- if (high.operator === comp || high.operator === ecomp) {
2305
- return false;
2306
- }
2307
- if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) {
2308
- return false;
2309
- } else if (low.operator === ecomp && ltfn(version, low.semver)) {
2310
- return false;
2311
- }
2312
- }
2313
- return true;
2314
- };
2315
- outside_1 = outside;
2316
- return outside_1;
2317
- }
2318
- var gtr_1;
2319
- var hasRequiredGtr;
2320
- function requireGtr() {
2321
- if (hasRequiredGtr)
2322
- return gtr_1;
2323
- hasRequiredGtr = 1;
2324
- const outside = requireOutside();
2325
- const gtr = (version, range2, options) => outside(version, range2, ">", options);
2326
- gtr_1 = gtr;
2327
- return gtr_1;
2328
- }
2329
- var ltr_1;
2330
- var hasRequiredLtr;
2331
- function requireLtr() {
2332
- if (hasRequiredLtr)
2333
- return ltr_1;
2334
- hasRequiredLtr = 1;
2335
- const outside = requireOutside();
2336
- const ltr = (version, range2, options) => outside(version, range2, "<", options);
2337
- ltr_1 = ltr;
2338
- return ltr_1;
2339
- }
2340
- var intersects_1;
2341
- var hasRequiredIntersects;
2342
- function requireIntersects() {
2343
- if (hasRequiredIntersects)
2344
- return intersects_1;
2345
- hasRequiredIntersects = 1;
2346
- const Range = requireRange();
2347
- const intersects = (r1, r2, options) => {
2348
- r1 = new Range(r1, options);
2349
- r2 = new Range(r2, options);
2350
- return r1.intersects(r2, options);
2351
- };
2352
- intersects_1 = intersects;
2353
- return intersects_1;
2354
- }
2355
- var simplify;
2356
- var hasRequiredSimplify;
2357
- function requireSimplify() {
2358
- if (hasRequiredSimplify)
2359
- return simplify;
2360
- hasRequiredSimplify = 1;
2361
- const satisfies = requireSatisfies();
2362
- const compare = requireCompare();
2363
- simplify = (versions, range2, options) => {
2364
- const set = [];
2365
- let first = null;
2366
- let prev = null;
2367
- const v = versions.sort((a, b2) => compare(a, b2, options));
2368
- for (const version of v) {
2369
- const included = satisfies(version, range2, options);
2370
- if (included) {
2371
- prev = version;
2372
- if (!first) {
2373
- first = version;
2374
- }
2375
- } else {
2376
- if (prev) {
2377
- set.push([first, prev]);
2378
- }
2379
- prev = null;
2380
- first = null;
2381
- }
2382
- }
2383
- if (first) {
2384
- set.push([first, null]);
2385
- }
2386
- const ranges = [];
2387
- for (const [min, max] of set) {
2388
- if (min === max) {
2389
- ranges.push(min);
2390
- } else if (!max && min === v[0]) {
2391
- ranges.push("*");
2392
- } else if (!max) {
2393
- ranges.push(`>=${min}`);
2394
- } else if (min === v[0]) {
2395
- ranges.push(`<=${max}`);
2396
- } else {
2397
- ranges.push(`${min} - ${max}`);
2398
- }
2399
- }
2400
- const simplified = ranges.join(" || ");
2401
- const original = typeof range2.raw === "string" ? range2.raw : String(range2);
2402
- return simplified.length < original.length ? simplified : range2;
2403
- };
2404
- return simplify;
2405
- }
2406
- var subset_1;
2407
- var hasRequiredSubset;
2408
- function requireSubset() {
2409
- if (hasRequiredSubset)
2410
- return subset_1;
2411
- hasRequiredSubset = 1;
2412
- const Range = requireRange();
2413
- const Comparator = requireComparator();
2414
- const { ANY } = Comparator;
2415
- const satisfies = requireSatisfies();
2416
- const compare = requireCompare();
2417
- const subset = (sub, dom, options = {}) => {
2418
- if (sub === dom) {
2419
- return true;
2420
- }
2421
- sub = new Range(sub, options);
2422
- dom = new Range(dom, options);
2423
- let sawNonNull = false;
2424
- OUTER:
2425
- for (const simpleSub of sub.set) {
2426
- for (const simpleDom of dom.set) {
2427
- const isSub = simpleSubset(simpleSub, simpleDom, options);
2428
- sawNonNull = sawNonNull || isSub !== null;
2429
- if (isSub) {
2430
- continue OUTER;
2431
- }
2432
- }
2433
- if (sawNonNull) {
2434
- return false;
2435
- }
2436
- }
2437
- return true;
2438
- };
2439
- const minimumVersionWithPreRelease = [new Comparator(">=0.0.0-0")];
2440
- const minimumVersion = [new Comparator(">=0.0.0")];
2441
- const simpleSubset = (sub, dom, options) => {
2442
- if (sub === dom) {
2443
- return true;
2444
- }
2445
- if (sub.length === 1 && sub[0].semver === ANY) {
2446
- if (dom.length === 1 && dom[0].semver === ANY) {
2447
- return true;
2448
- } else if (options.includePrerelease) {
2449
- sub = minimumVersionWithPreRelease;
2450
- } else {
2451
- sub = minimumVersion;
2452
- }
2453
- }
2454
- if (dom.length === 1 && dom[0].semver === ANY) {
2455
- if (options.includePrerelease) {
2456
- return true;
2457
- } else {
2458
- dom = minimumVersion;
2459
- }
2460
- }
2461
- const eqSet = new Set;
2462
- let gt, lt;
2463
- for (const c2 of sub) {
2464
- if (c2.operator === ">" || c2.operator === ">=") {
2465
- gt = higherGT(gt, c2, options);
2466
- } else if (c2.operator === "<" || c2.operator === "<=") {
2467
- lt = lowerLT(lt, c2, options);
2468
- } else {
2469
- eqSet.add(c2.semver);
2470
- }
2471
- }
2472
- if (eqSet.size > 1) {
2473
- return null;
2474
- }
2475
- let gtltComp;
2476
- if (gt && lt) {
2477
- gtltComp = compare(gt.semver, lt.semver, options);
2478
- if (gtltComp > 0) {
2479
- return null;
2480
- } else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) {
2481
- return null;
2482
- }
2483
- }
2484
- for (const eq of eqSet) {
2485
- if (gt && !satisfies(eq, String(gt), options)) {
2486
- return null;
2487
- }
2488
- if (lt && !satisfies(eq, String(lt), options)) {
2489
- return null;
2490
- }
2491
- for (const c2 of dom) {
2492
- if (!satisfies(eq, String(c2), options)) {
2493
- return false;
2494
- }
2495
- }
2496
- return true;
2497
- }
2498
- let higher, lower;
2499
- let hasDomLT, hasDomGT;
2500
- let needDomLTPre = lt && !options.includePrerelease && lt.semver.prerelease.length ? lt.semver : false;
2501
- let needDomGTPre = gt && !options.includePrerelease && gt.semver.prerelease.length ? gt.semver : false;
2502
- if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === "<" && needDomLTPre.prerelease[0] === 0) {
2503
- needDomLTPre = false;
2504
- }
2505
- for (const c2 of dom) {
2506
- hasDomGT = hasDomGT || c2.operator === ">" || c2.operator === ">=";
2507
- hasDomLT = hasDomLT || c2.operator === "<" || c2.operator === "<=";
2508
- if (gt) {
2509
- if (needDomGTPre) {
2510
- if (c2.semver.prerelease && c2.semver.prerelease.length && c2.semver.major === needDomGTPre.major && c2.semver.minor === needDomGTPre.minor && c2.semver.patch === needDomGTPre.patch) {
2511
- needDomGTPre = false;
2512
- }
2513
- }
2514
- if (c2.operator === ">" || c2.operator === ">=") {
2515
- higher = higherGT(gt, c2, options);
2516
- if (higher === c2 && higher !== gt) {
2517
- return false;
2518
- }
2519
- } else if (gt.operator === ">=" && !satisfies(gt.semver, String(c2), options)) {
2520
- return false;
2521
- }
2522
- }
2523
- if (lt) {
2524
- if (needDomLTPre) {
2525
- if (c2.semver.prerelease && c2.semver.prerelease.length && c2.semver.major === needDomLTPre.major && c2.semver.minor === needDomLTPre.minor && c2.semver.patch === needDomLTPre.patch) {
2526
- needDomLTPre = false;
2527
- }
2528
- }
2529
- if (c2.operator === "<" || c2.operator === "<=") {
2530
- lower = lowerLT(lt, c2, options);
2531
- if (lower === c2 && lower !== lt) {
2532
- return false;
2533
- }
2534
- } else if (lt.operator === "<=" && !satisfies(lt.semver, String(c2), options)) {
2535
- return false;
2536
- }
2537
- }
2538
- if (!c2.operator && (lt || gt) && gtltComp !== 0) {
2539
- return false;
2540
- }
2541
- }
2542
- if (gt && hasDomLT && !lt && gtltComp !== 0) {
2543
- return false;
2544
- }
2545
- if (lt && hasDomGT && !gt && gtltComp !== 0) {
2546
- return false;
2547
- }
2548
- if (needDomGTPre || needDomLTPre) {
2549
- return false;
2550
- }
2551
- return true;
2552
- };
2553
- const higherGT = (a, b2, options) => {
2554
- if (!a) {
2555
- return b2;
2556
- }
2557
- const comp = compare(a.semver, b2.semver, options);
2558
- return comp > 0 ? a : comp < 0 ? b2 : b2.operator === ">" && a.operator === ">=" ? b2 : a;
2559
- };
2560
- const lowerLT = (a, b2, options) => {
2561
- if (!a) {
2562
- return b2;
2563
- }
2564
- const comp = compare(a.semver, b2.semver, options);
2565
- return comp < 0 ? a : comp > 0 ? b2 : b2.operator === "<" && a.operator === "<=" ? b2 : a;
2566
- };
2567
- subset_1 = subset;
2568
- return subset_1;
2569
- }
2570
- var semver;
2571
- var hasRequiredSemver;
2572
- function requireSemver() {
2573
- if (hasRequiredSemver)
2574
- return semver;
2575
- hasRequiredSemver = 1;
2576
- const internalRe = requireRe();
2577
- const constants2 = requireConstants();
2578
- const SemVer = requireSemver$1();
2579
- const identifiers2 = requireIdentifiers();
2580
- const parse = requireParse();
2581
- const valid2 = requireValid$1();
2582
- const clean = requireClean();
2583
- const inc = requireInc();
2584
- const diff = requireDiff();
2585
- const major = requireMajor();
2586
- const minor = requireMinor();
2587
- const patch = requirePatch();
2588
- const prerelease = requirePrerelease();
2589
- const compare = requireCompare();
2590
- const rcompare = requireRcompare();
2591
- const compareLoose = requireCompareLoose();
2592
- const compareBuild = requireCompareBuild();
2593
- const sort = requireSort();
2594
- const rsort = requireRsort();
2595
- const gt = requireGt();
2596
- const lt = requireLt();
2597
- const eq = requireEq();
2598
- const neq = requireNeq();
2599
- const gte = requireGte();
2600
- const lte = requireLte();
2601
- const cmp = requireCmp();
2602
- const coerce = requireCoerce();
2603
- const Comparator = requireComparator();
2604
- const Range = requireRange();
2605
- const satisfies = requireSatisfies();
2606
- const toComparators = requireToComparators();
2607
- const maxSatisfying = requireMaxSatisfying();
2608
- const minSatisfying = requireMinSatisfying();
2609
- const minVersion = requireMinVersion();
2610
- const validRange = requireValid();
2611
- const outside = requireOutside();
2612
- const gtr = requireGtr();
2613
- const ltr = requireLtr();
2614
- const intersects = requireIntersects();
2615
- const simplifyRange = requireSimplify();
2616
- const subset = requireSubset();
2617
- semver = {
2618
- parse,
2619
- valid: valid2,
2620
- clean,
2621
- inc,
2622
- diff,
2623
- major,
2624
- minor,
2625
- patch,
2626
- prerelease,
2627
- compare,
2628
- rcompare,
2629
- compareLoose,
2630
- compareBuild,
2631
- sort,
2632
- rsort,
2633
- gt,
2634
- lt,
2635
- eq,
2636
- neq,
2637
- gte,
2638
- lte,
2639
- cmp,
2640
- coerce,
2641
- Comparator,
2642
- Range,
2643
- satisfies,
2644
- toComparators,
2645
- maxSatisfying,
2646
- minSatisfying,
2647
- minVersion,
2648
- validRange,
2649
- outside,
2650
- gtr,
2651
- ltr,
2652
- intersects,
2653
- simplifyRange,
2654
- subset,
2655
- SemVer,
2656
- re: internalRe.re,
2657
- src: internalRe.src,
2658
- tokens: internalRe.t,
2659
- SEMVER_SPEC_VERSION: constants2.SEMVER_SPEC_VERSION,
2660
- RELEASE_TYPES: constants2.RELEASE_TYPES,
2661
- compareIdentifiers: identifiers2.compareIdentifiers,
2662
- rcompareIdentifiers: identifiers2.rcompareIdentifiers
2663
- };
2664
- return semver;
2665
- }
2666
- var semverExports = requireSemver();
2667
- function isCompatible(required, provided) {
2668
- for (const [name, range2] of Object.entries(required)) {
2669
- const version = provided[name];
2670
- if (!version) {
2671
- continue;
2672
- }
2673
- if (isSatisfied(range2, version) === false) {
2674
- return false;
2675
- }
2676
- }
2677
- return true;
2678
- }
2679
- function isSatisfied(range2, version) {
2680
- if (!semverExports.validRange(range2)) {
2681
- return null;
2682
- }
2683
- const coerced = semverExports.coerce(version);
2684
- if (!coerced) {
2685
- return null;
2686
- }
2687
- return semverExports.satisfies(coerced, range2);
2688
- }
2689
-
2690
- // ../../node_modules/@bpmn-io/feel-lint/dist/index.js
2691
- function lintSyntax(syntaxTree) {
2692
- const lintMessages = [];
2693
- syntaxTree.iterate({
2694
- enter: (ref) => {
2695
- const node = ref.node;
2696
- if (!node.type.isError) {
2697
- return;
2698
- }
2699
- const parent = node.parent;
2700
- const next = getNextNode(node);
2701
- const message = {
2702
- from: node.from,
2703
- to: node.to,
2704
- severity: "error",
2705
- type: "Syntax Error"
2706
- };
2707
- if (node.from !== node.to) {
2708
- message.message = `Unrecognized token in <${parent.name}>`;
2709
- } else if (next) {
2710
- message.message = `Unrecognized token <${next.name}> in <${parent.name}>`;
2711
- message.to = next.to;
2712
- } else {
2713
- const before = parent.enterUnfinishedNodesBefore(node.to);
2714
- message.message = `Incomplete <${(before || parent).name}>`;
2715
- }
2716
- lintMessages.push(message);
2717
- }
2718
- });
2719
- return lintMessages;
2720
- }
2721
- function getNextNode(node) {
2722
- if (!node) {
2723
- return null;
2724
- }
2725
- return node.nextSibling || getNextNode(node.parent);
2726
- }
2727
- var RULE_NAME$1 = "first-item";
2728
- var firstItem = {
2729
- create(context) {
2730
- return {
2731
- enter(node) {
2732
- if (node.name !== "FilterExpression") {
2733
- return;
2734
- }
2735
- const content = context.readContent(node.from, node.to);
2736
- if (zeroIndexPattern().test(content)) {
2737
- const {
2738
- from,
2739
- to
2740
- } = node;
2741
- context.report({
2742
- from,
2743
- to,
2744
- message: "First item is accessed via [1]",
2745
- severity: "warning",
2746
- type: RULE_NAME$1,
2747
- actions: [
2748
- {
2749
- name: "fix",
2750
- apply(_, start = from, end = to) {
2751
- context.updateContent(start, end, content.replace(zeroIndexPattern(), "[1]"));
2752
- }
2753
- }
2754
- ]
2755
- });
2756
- }
2757
- }
2758
- };
2759
- }
2760
- };
2761
- function zeroIndexPattern() {
2762
- return /\[\s*0\s*\]$/;
2763
- }
2764
- var RULES = [
2765
- firstItem
2766
- ];
2767
- function lintRules(context) {
2768
- const {
2769
- readContent,
2770
- syntaxTree,
2771
- updateContent
2772
- } = context;
2773
- const lintMessages = [];
2774
- const ruleContext = {
2775
- readContent,
2776
- report: (message) => {
2777
- lintMessages.push(message);
2778
- },
2779
- updateContent
2780
- };
2781
- const rules = RULES.map((rule) => rule.create(ruleContext));
2782
- syntaxTree.iterate({
2783
- enter: (ref) => {
2784
- for (const rule of rules) {
2785
- rule.enter && rule.enter(ref);
2786
- }
2787
- },
2788
- leave: (ref) => {
2789
- for (const rule of rules) {
2790
- rule.leave && rule.leave(ref);
2791
- }
2792
- }
2793
- });
2794
- return lintMessages;
2795
- }
2796
- var RULE_NAME = "compatibility";
2797
- function lintCompatibility(context = {}) {
2798
- const {
2799
- syntaxTree,
2800
- expression,
2801
- engines,
2802
- builtins = []
2803
- } = context;
2804
- if (!engines || !Object.keys(engines).length || !builtins.length) {
2805
- return [];
2806
- }
2807
- const unavailable = getUnavailableBuiltins(builtins, engines);
2808
- if (!unavailable.size) {
2809
- return [];
2810
- }
2811
- const analyzer = new FeelAnalyzer({ builtins });
2812
- const { valid: valid2, functions = [] } = analyzer.analyzeTree(syntaxTree, expression);
2813
- if (!valid2) {
2814
- return [];
2815
- }
2816
- return functions.reduce((messages, fn) => {
2817
- if (fn.type !== "builtin") {
2818
- return messages;
2819
- }
2820
- const builtin = unavailable.get(fn.name);
2821
- if (!builtin) {
2822
- return messages;
2823
- }
2824
- messages.push({
2825
- from: fn.from,
2826
- to: fn.to,
2827
- severity: "warning",
2828
- type: RULE_NAME,
2829
- message: `Function '${fn.name}' requires ${formatEngines(builtin.engines)}`
2830
- });
2831
- return messages;
2832
- }, []);
2833
- }
2834
- function getUnavailableBuiltins(builtins, engines) {
2835
- const unavailable = new Map;
2836
- for (const builtin of builtins) {
2837
- if (builtin.engines && !isCompatible(builtin.engines, engines)) {
2838
- unavailable.set(builtin.name, builtin);
2839
- }
2840
- }
2841
- return unavailable;
2842
- }
2843
- function formatEngines(engines) {
2844
- return Object.entries(engines).map(([name, range2]) => `${capitalize(name)} ${range2}`).join(", ");
2845
- }
2846
- function capitalize(string) {
2847
- return string.charAt(0).toUpperCase() + string.slice(1);
2848
- }
2849
- function lintAll(context) {
2850
- const lintMessages = [
2851
- ...lintSyntax(context.syntaxTree),
2852
- ...lintRules(context),
2853
- ...lintCompatibility(context)
2854
- ];
2855
- return lintMessages;
2856
- }
2857
- function createContext2(variables) {
2858
- return variables.slice().reverse().reduce((context, variable) => {
2859
- context[variable.name] = () => {};
2860
- return context;
2861
- }, {});
2862
- }
2863
- function lintExpression(expression, {
2864
- dialect = "expression",
2865
- parserDialect,
2866
- builtins = [],
2867
- variables = [],
2868
- engines
2869
- } = {}) {
2870
- const context = createContext2([...builtins, ...variables]);
2871
- const syntaxTree = parser.configure({
2872
- top: dialect === "unaryTests" ? "UnaryTests" : "Expression",
2873
- dialect: parserDialect,
2874
- contextTracker: trackVariables(context)
2875
- }).parse(expression);
2876
- const lintMessages = lintAll({
2877
- syntaxTree,
2878
- expression,
2879
- builtins,
2880
- engines,
2881
- readContent: (from, to) => expression.slice(from, to),
2882
- updateContent: (from, to, content) => {}
2883
- });
2884
- return lintMessages;
2885
- }
2886
-
2887
- // ../../node_modules/@uipath/dmn-editor-utils/dist/validation/index.js
2888
- var yt = (e2, t) => e2.severity === t.severity ? 0 : e2.severity === "error" ? -1 : 1;
2889
- var Tt = (e2) => e2.isCollection ? `list<${e2.components ? "context" : e2.baseTypeRef ?? "Any"}>` : e2.baseTypeRef;
2890
- var qe = (e2) => {
2891
- let t = B(e2);
2892
- if (t)
2893
- return { fieldlessType: t };
2894
- let n = U(e2);
2895
- return n ? { fieldlessType: n, fieldlessItems: true } : {};
2896
- };
2897
- var He = (e2) => z(e2) ? [] : e2.components && !e2.recursive ? e2.components.map((t) => {
2898
- let n = He(t.type), i = Tt(t.type);
2899
- return { name: t.name, ...i ? { detail: i } : {}, ...n ? { entries: n } : {}, ...qe(t.type) };
2900
- }) : undefined;
2901
- var Z = (e2, t, n, i) => {
2902
- let a = { name: e2, ...t ? { detail: t } : {} };
2903
- if (i?.length)
2904
- return { ...a, entries: i.map((m3) => Z(m3.name, m3.typeRef, n, m3.members)) };
2905
- let s = J(n ?? {}, t), r2 = n && He(s);
2906
- return { ...a, ...r2 ? { entries: r2 } : {}, ...qe(s) };
2907
- };
2908
- var B2 = (e2, t = [], n) => {
2909
- let i = e2.filter((r2) => ne(r2)), a = i.map((r2) => Z(ne(r2), r2.typeRef, n)), s = new Set(i.map(ne));
2910
- for (let r2 of t)
2911
- s.has(r2.name) || (s.add(r2.name), a.push(Z(r2.name, r2.typeRef, n, r2.members)));
2912
- return a;
2913
- };
2914
- var We = "DMN_INPUT_EXPRESSION_MISSING";
2915
- var Et = ["error", "warning", "info"];
2916
- var vt = (e2) => Et.includes(e2) ? e2 : "info";
2917
- var It = (e2) => ({ from: e2.from, to: e2.to, severity: vt(e2.severity), message: e2.message });
2918
- var ee3 = (e2, t, n = []) => lintExpression(e2, { dialect: t, variables: n }).map(It);
2919
- var te2 = (e2, t) => {
2920
- let n = e2.trim();
2921
- return n === "" || t === "unaryTests" && n === "-";
2922
- };
2923
- var ht = /"(?:\\[\s\S]|[^"\\])*"?|\/\*[\s\S]*?(?:\*\/|$)|\/\/[^\n]*|'/g;
2924
- var Mt = (e2) => Array.from(e2.matchAll(ht), (t) => t[0] === "'" ? t.index : -1).filter((t) => t >= 0);
2925
- var Xe = (e2, t) => {
2926
- let n = new Set(t.filter((i) => i.severity === "error").map((i) => i.from));
2927
- return Mt(e2).find((i) => n.has(i));
2928
- };
2929
- var I = (e2, t, n) => {
2930
- if (te2(e2, t))
2931
- return [];
2932
- let i = ee3(e2, t, n), a = Xe(e2, i);
2933
- return a !== undefined ? [{ code: "DMN_FEEL_SYNTAX", severity: "error", messageKey: "validation_feel_single_quote", range: { from: a, to: a + 1 } }] : i.map((s) => s.severity === "error" ? { code: "DMN_FEEL_SYNTAX", severity: "error", messageKey: "validation_feel_syntax", messageParams: { message: s.message }, range: { from: s.from, to: s.to } } : { code: "DMN_FEEL_LINT", severity: "warning", messageKey: "validation_feel_lint", messageParams: { message: s.message }, range: { from: s.from, to: s.to } });
2934
- };
2935
- var ne3 = { StringLiteral: "string", NumericLiteral: "number", BooleanLiteral: "boolean" };
2936
- var je = { string: ["number", "boolean"], number: ["string", "boolean"], boolean: ["string", "number"] };
2937
- var ie = (e2, t) => {
2938
- let n = e2.trim();
2939
- if (!n)
2940
- return;
2941
- let i = c(n, t), a;
2942
- return i.iterate({ enter(s) {
2943
- s.from === 0 && s.to === n.length && (a = ne3[s.name] ?? a);
2944
- } }), a;
2945
- };
2946
- var ze = (e2, t) => !e2 || !t || !je[e2].includes(R(t)) ? [] : [{ code: "DMN_TYPE_MISMATCH", severity: "error", messageKey: "validation_type_mismatch", messageParams: { literalType: e2, columnType: t } }];
2947
- var bt = new Set([...Object.keys(ne3), "DateTimeLiteral", "null"]);
2948
- var St = new Set(["UnaryTests", "PositiveUnaryTests", "PositiveUnaryTest", "SimplePositiveUnaryTest", "Interval", "Expression"]);
2949
- var Ot = (e2) => {
2950
- for (let t = e2;t; t = t.parent)
2951
- if (t.name === "Interval")
2952
- return true;
2953
- return false;
2954
- };
2955
- var Pt = (e2) => {
2956
- for (let t = e2;t; t = t.parent)
2957
- if (!St.has(t.name))
2958
- return false;
2959
- return true;
2960
- };
2961
- var Rt = (e2, t) => {
2962
- let n = e2.trim(), i = { operands: [], intervals: [] };
2963
- if (!n)
2964
- return i;
2965
- let a = e2.length - e2.trimStart().length;
2966
- return c(n, t).iterate({ enter(s) {
2967
- if (!bt.has(s.name) && s.name !== "Interval" || !Pt(s.node.parent))
2968
- return;
2969
- let r2 = { from: a + s.from, to: a + s.to };
2970
- if (s.name === "Interval") {
2971
- Ot(s.node.parent) || i.intervals.push(r2);
2972
- return;
2973
- }
2974
- i.operands.push({ nodeName: s.name, kind: ne3[s.name], ...r2 });
2975
- } }), i;
2976
- };
2977
- var At2 = (e2) => {
2978
- let t = R(e2);
2979
- return t === "string" || t === "number" || t === "boolean" ? t : undefined;
2980
- };
2981
- var wt = new Set(["number", "string", "date", "time", "date and time", "dayTimeDuration", "yearMonthDuration"]);
2982
- var xt = new Set(["boolean"]);
2983
- var Lt = (e2) => {
2984
- let t = R(e2);
2985
- return wt.has(t) ? "ordered" : xt.has(t) ? "unordered" : "unknown";
2986
- };
2987
- var $e = (e2, t) => t.from >= e2.from && t.to <= e2.to;
2988
- var se = (e2, t, n) => {
2989
- if (!n || te2(e2, t))
2990
- return [];
2991
- let { operands: i, intervals: a } = Rt(e2, t), s = [], r2 = At2(n), m3 = Lt(n), u2 = m3 === "unordered" ? a : [];
2992
- if (m3 === "unordered")
2993
- for (let l2 of a)
2994
- s.push({ code: "DMN_RANGE_NOT_ORDERED", severity: "error", messageKey: "validation_range_not_ordered", messageParams: { columnType: n }, range: l2 });
2995
- else if (!r2)
2996
- for (let l2 of a)
2997
- new Set(i.filter((D) => $e(l2, D) && D.kind).map((D) => D.kind)).size > 1 && s.push({ code: "DMN_RANGE_ENDPOINT_TYPES", severity: "error", messageKey: "validation_range_endpoint_types", range: l2 });
2998
- if (et.has(R(n))) {
2999
- for (let l2 of i) {
3000
- let _ = e2.slice(l2.from, l2.to), D = l2.nodeName === "null" ? "" : Y(_);
3001
- l2.nodeName !== "null" && (D === undefined || !de(D, n)) && s.push({ code: "DMN_VALUE_NOT_VALID_FOR_TYPE", severity: "error", messageKey: "validation_value_not_valid_for_type", messageParams: { value: _, columnType: n }, range: { from: l2.from, to: l2.to } });
3002
- }
3003
- return s;
3004
- }
3005
- if (!r2)
3006
- return s;
3007
- for (let l2 of i)
3008
- if (!(l2.nodeName === "null" || u2.some((_) => $e(_, l2)))) {
3009
- if (r2 === "boolean") {
3010
- l2.kind !== "boolean" && s.push({ code: "DMN_BOOLEAN_COLUMN_VALUE", severity: "error", messageKey: "validation_boolean_column_value", messageParams: { value: e2.slice(l2.from, l2.to) }, range: { from: l2.from, to: l2.to } });
3011
- continue;
3012
- }
3013
- l2.kind && je[l2.kind].includes(r2) && s.push({ code: "DMN_TYPE_MISMATCH", severity: "error", messageKey: "validation_value_not_valid_for_type", messageParams: { value: e2.slice(l2.from, l2.to), columnType: n }, range: { from: l2.from, to: l2.to } });
3014
- }
3015
- return s;
3016
- };
3017
- var Je = (e2) => {
3018
- let t = c(e2.trim(), "unaryTests").topNode, n = t.getChild("PositiveUnaryTests");
3019
- return n && !t.getChild("not") ? n.getChildren("PositiveUnaryTest").length : 1;
3020
- };
3021
- var re2 = (e2) => {
3022
- let t = ie(e2, "expression");
3023
- return t ? Ct(t, e2) : Y(e2);
3024
- };
3025
- var Ze = (e2) => {
3026
- let t = e2.trim(), n = c(t, "unaryTests").topNode, i = n.getChild("PositiveUnaryTests");
3027
- if (!i || n.getChild("not"))
3028
- return;
3029
- let a = new Set;
3030
- for (let s of i.getChildren("PositiveUnaryTest")) {
3031
- let r2 = re2(t.slice(s.from, s.to));
3032
- if (r2 === undefined)
3033
- return;
3034
- a.add(r2);
3035
- }
3036
- return a;
3037
- };
3038
- var Ct = (e2, t) => {
3039
- let n = t.trim();
3040
- return e2 === "number" ? Number(n.replace(/\s+/g, "")) : e2 === "string" ? X(n)[0] : n === "true";
3041
- };
3042
- var Ft = (e2, t) => t.results.has(e2) ? ["DMN_RESULT_NAME_REFERENCED", "validation_result_name_referenced"] : t.allowedValues?.has(e2) ? ["DMN_ALLOWED_VALUE_UNQUOTED", "validation_allowed_value_unquoted"] : ["DMN_UNKNOWN_NAME", "validation_unknown_name"];
3043
- var et = new Set(["date", "time", "date and time", "dayTimeDuration", "yearMonthDuration"]);
3044
- var tt = (e2, t, n = new Set) => {
3045
- let i = R(t ?? "string");
3046
- if (!(W(i) || i === "string"))
3047
- return [];
3048
- let a = (m3, u2) => {
3049
- if (m3 === "null")
3050
- return true;
3051
- if (i === "string")
3052
- return U2(m3);
3053
- if (et.has(i)) {
3054
- let l2 = Y(m3);
3055
- return l2 !== undefined && de(l2, t);
3056
- }
3057
- return !U2(m3) && de(u2, t);
3058
- }, s = (m3, u2, l2) => ({ code: "DMN_VALUE_NOT_VALID_FOR_TYPE", severity: "error", messageKey: "validation_value_not_valid_for_type", messageParams: { value: m3, columnType: t ?? i }, range: { from: u2, to: l2 } }), r2 = ee2(t);
3059
- return Q2(e2).flatMap((m3) => {
3060
- if (n.has(m3.token))
3061
- return [];
3062
- let u2 = r2 ? K2(m3.token) : undefined;
3063
- return u2 ? u2.filter((l2) => !a(l2.text, l2.text)).map((l2) => s(l2.text, m3.from + l2.from, m3.from + l2.to)) : m3.value !== undefined && !a(m3.token, m3.value) ? [s(m3.token, m3.from, m3.to)] : [];
3064
- });
3065
- };
3066
- var Ut = (e2, t, n) => {
3067
- let i;
3068
- return (a, s) => !a.includes("'") && e2[s - 1] !== "'" ? false : (i ??= Xe(e2, ee3(e2, t, Array.from(n, (r2) => ({ name: r2 })))) !== undefined, i);
3069
- };
3070
- var Vt = (e2, t, n) => e2.filter((i) => !t.known.has(i.name) && !n(i.name, i.from)).map((i) => {
3071
- let [a, s] = Ft(i.name, t);
3072
- return { code: a, messageKey: s, severity: "error", messageParams: { name: i.name }, range: { from: i.from, to: i.to } };
3073
- });
3074
- var Qe = new WeakMap;
3075
- var kt = (e2) => {
3076
- let t = Qe.get(e2);
3077
- return t || (t = new Map(e2.map((n) => [n.name, n])), Qe.set(e2, t)), t;
3078
- };
3079
- var Kt = (e2, t, n) => {
3080
- let i = kt(t), a = (s, r2) => {
3081
- if (n(s.name, s.from))
3082
- return;
3083
- let m3 = { from: s.from, to: s.to };
3084
- if (r2.fieldlessType) {
3085
- let l2 = { name: s.name, parent: r2.name, type: r2.fieldlessType };
3086
- return { code: "DMN_FIELD_OF_SINGLE_VALUE", severity: "error", messageKey: r2.fieldlessItems ? "validation_field_of_list_item" : "validation_field_of_single_value", messageParams: l2, range: m3 };
3087
- }
3088
- return { code: "DMN_UNKNOWN_MEMBER", severity: "error", messageKey: "validation_unknown_member", messageParams: { name: s.name, parent: r2.name }, range: m3 };
3089
- };
3090
- return e2.flatMap(({ segments: s }) => {
3091
- let r2 = i.get(s[0].name);
3092
- for (let m3 of s.slice(1)) {
3093
- if (!r2 || !r2.entries && !r2.fieldlessType)
3094
- return [];
3095
- let u2 = r2.entries?.find((l2) => l2.name === m3.name);
3096
- if (!u2) {
3097
- let l2 = a(m3, r2);
3098
- return l2 ? [l2] : [];
3099
- }
3100
- r2 = u2;
3101
- }
3102
- return [];
3103
- });
3104
- };
3105
- var h2 = (e2, t, n, i) => {
3106
- if (te2(e2, t))
3107
- return [];
3108
- let a = b(e2, t).filter((r2) => !r2.inFilterPredicate), s = Ut(e2, t, n.known);
3109
- return [...Vt(a, n, s), ...Kt(a, i, s)];
3110
- };
3111
- var w2 = (e2) => e2.filter((t) => !ne(t)).map((t) => ({ code: "DMN_INPUT_DATA_NAME_MISSING", severity: "error", messageKey: "validation_input_data_name_missing", target: { kind: "inputData", inputDataId: t.id } }));
3112
- var nt = (e2) => (e2.definitions.drgElement ?? []).flatMap((t) => {
3113
- if (t.__$$element !== "inputData")
3114
- return [];
3115
- let n = { id: g2(t), name: t["@_name"], variableName: t.variable?.["@_name"] };
3116
- return w2([n]).map((i) => ({ ...i, elementName: fe(t).trim() }));
3117
- });
3118
- var G2 = { kind: "document" };
3119
- var Yt = (e2, t) => {
3120
- let n = new Set;
3121
- for (let i = G(e2, t);i && !i.components?.length; i = G(e2, i)) {
3122
- if (i === t)
3123
- return true;
3124
- if (n.has(i))
3125
- return false;
3126
- n.add(i);
3127
- }
3128
- return false;
3129
- };
3130
- var st = (e2) => e2.typeRef === undefined && !e2.components?.length;
3131
- var rt = (e2, t) => {
3132
- let n = t.components ?? [], i = new Set;
3133
- return n.flatMap((a) => {
3134
- let s = i.has(a.name);
3135
- return i.add(a.name), [...s ? [{ code: "DMN_ITEM_COMPONENT_DUPLICATE_NAME", severity: "error", messageKey: "validation_item_component_duplicate_name", messageParams: { type: e2, field: a.name }, target: G2 }] : [], ...h(a.name) ? [] : [{ code: "DMN_ITEM_COMPONENT_NAME_INVALID", severity: "error", messageKey: "validation_item_component_name_invalid", messageParams: { type: e2, field: a.name }, target: G2 }], ...st(a) ? [{ code: "DMN_ITEM_COMPONENT_EMPTY", severity: "warning", messageKey: "validation_item_component_empty", messageParams: { type: e2, field: a.name }, target: G2 }] : [], ...rt(e2, a)];
3136
- });
3137
- };
3138
- var at = (e2) => e2.typeRef !== undefined && !!e2.components?.length || !!e2.components?.some(at);
3139
- var it = new WeakMap;
3140
- var M = (e2) => {
3141
- let t = e2.itemDefinitions;
3142
- if (!t)
3143
- return [];
3144
- let n = it.get(t);
3145
- if (n && n.namespace === e2.namespace && n.namespaces === e2.namespaces)
3146
- return [...n.diagnostics];
3147
- let i = Bt(e2, t);
3148
- return it.set(t, { namespace: e2.namespace, namespaces: e2.namespaces, diagnostics: i }), [...i];
3149
- };
3150
- var Bt = (e2, t) => {
3151
- let n = new Set;
3152
- return t.flatMap((i) => {
3153
- let a = i.name, s = n.has(a);
3154
- n.add(a);
3155
- let r2 = (m3, u2) => ({ code: m3, severity: "error", messageKey: u2, messageParams: { type: a }, target: G2 });
3156
- return [...s ? [r2("DMN_ITEM_DEFINITION_DUPLICATE_NAME", "validation_item_definition_duplicate_name")] : [], ...at(i) ? [r2("DMN_ITEM_DEFINITION_SIMPLE_AND_STRUCTURED", "validation_item_definition_simple_and_structured")] : [], ...Yt(e2, i) ? [r2("DMN_ITEM_DEFINITION_CYCLE", "validation_item_definition_cycle")] : [], ...st(i) ? [{ ...r2("DMN_ITEM_DEFINITION_EMPTY", "validation_item_definition_empty"), severity: "warning" }] : [], ...rt(a, i)];
3157
- });
3158
- };
3159
- var ot = (e2, t, n, i, a) => {
3160
- let s = { ...n, field: "allowedValues" }, r2 = (m3) => m3.map((u2) => ({ ...u2, target: s }));
3161
- switch (pe(e2, t)) {
3162
- case "none":
3163
- return [];
3164
- case "list":
3165
- return r2(tt(e2.text, t, a.known));
3166
- default: {
3167
- let m3 = I(e2.text, "unaryTests", i), l2 = m3.some((_) => _.severity === "error") ? [] : se(e2.text, "unaryTests", t);
3168
- return r2([...m3, ...h2(e2.text, "unaryTests", a, i), ...l2]);
3169
- }
3170
- }
3171
- };
3172
- var Gt = (e2, t, n) => !n || !g(n) || [t, n].some((i) => R(i) === "Any") ? true : T(e2, t) ? false : !g(t) || R(t) === R(n);
3173
- var dt = (e2) => {
3174
- let t = e2.trim();
3175
- return t === "" || t === "-";
3176
- };
3177
- var qt = (e2) => JSON.stringify(e2.inputEntries.map((t) => dt(t.text) ? null : t.text.trim()));
3178
- var Ht = (e2) => ({ kind: "row", ruleId: e2 });
3179
- var lt = "string";
3180
- var Wt = new Set(["dayTimeDuration", "yearMonthDuration"]);
3181
- var mt = (e2, t) => t ? ne2(e2.inputData, t) ?? e2.scopeVariables?.find((n) => n.name === t) : undefined;
3182
- var ct = (e2, t) => {
3183
- if (t.foreign)
3184
- return { name: "Any", list: t.isCollection, structure: false };
3185
- if (!t.recursive) {
3186
- if (t.components) {
3187
- let n = [...t.chain].reverse().find((a) => a.components?.length);
3188
- return { name: n && e2.itemDefinitions?.includes(n) ? n.name : "context", list: t.isCollection, structure: true };
3189
- }
3190
- return t.baseTypeRef === undefined ? undefined : { name: t.baseTypeRef, list: t.isCollection, structure: false };
3191
- }
3192
- };
3193
- var ut = (e2, t) => {
3194
- let n = e2.structure && !!t?.structure && t.name !== e2.name;
3195
- return l(e2.structure && !n ? "Any" : e2.name, e2.list);
3196
- };
3197
- var $t = (e2, t) => e2.structure && !t.structure && t.name === "Any" && e2.list === t.list || e2.structure === t.structure && e2.name === t.name && e2.list === t.list;
3198
- var Qt = (e2, t) => {
3199
- let n = t.trim(), i = mt(e2, n);
3200
- if (i)
3201
- return J(e2, i.typeRef);
3202
- let a = me(n, "expression"), s = _e(n);
3203
- if (a.length !== 1 || a[0] !== s)
3204
- return;
3205
- let [r2, ...m3] = s.split("."), u2 = m3.length ? mt(e2, r2) : undefined;
3206
- if (u2)
3207
- return K(J(e2, u2.typeRef), m3).type;
3208
- };
3209
- var ae = (e2) => {
3210
- let t = e2.decision.decisionTable, n = [], i = B2(e2.inputData, e2.scopeVariables, e2), a = new Set(i.map((o) => o.name)), s = te(e2.decision.variableName, e2.decision.name), r2 = new Set([s, ...t.outputs.map((o, c2) => ee(o, c2))]), m3 = (o) => new Set(o ? X(o.text) : []), u2 = t.inputs.map((o) => m3(o.allowedValues)), l2 = t.outputs.map((o) => m3(A(e2, o)));
3211
- if (e2.decision.name.trim() || n.push({ code: "DMN_DECISION_NAME_MISSING", severity: "error", messageKey: "validation_decision_name_missing", target: { kind: "decision" } }), t.rules.length === 0 && n.push({ code: "DMN_NO_RULES", severity: "warning", messageKey: "validation_no_rules", target: { kind: "decision" } }), t.hitPolicy === e.Collect && t.aggregation) {
3212
- let { aggregation: o } = t;
3213
- t.outputs.forEach((f2) => {
3214
- let g3 = p(e2, f2);
3215
- g3 && !S(e2, o, f2) && n.push({ code: "DMN_COLLECT_AGGREGATION_TYPE", severity: "error", messageKey: "validation_collect_aggregation_type", messageParams: { aggregation: o, typeRef: g3 }, target: { kind: "output", outputId: f2.id } });
3216
- });
3217
- let c2 = e2.decision.variableTypeRef, d = t.outputs.length === 1, p2 = u(e2, c2);
3218
- !!c2 && (d ? !Gt(e2, c2, u(e2, C(o, t.outputs[0]))) : T(e2, c2) || !!p2 && g(p2) && p2 !== "Any") && n.push({ code: "DMN_AGGREGATION_RESULT_TYPE", severity: d ? "warning" : "error", messageKey: "validation_aggregation_result_type", messageParams: { aggregation: o, typeRef: c2 }, target: { kind: "decision" } });
3219
- }
3220
- if (m.has(t.hitPolicy)) {
3221
- let o = t.outputs.flatMap((c2) => A(e2, c2) ?? []);
3222
- o.length === 0 ? n.push({ code: "DMN_RANKED_OUTPUT_VALUES_MISSING", severity: "error", messageKey: "validation_ranked_output_values_missing", messageParams: { hitPolicy: t.hitPolicy }, target: { kind: "decision" } }) : o.every((c2) => Je(c2.text) < 2) && n.push({ code: "DMN_RANKED_OUTPUT_VALUES_SINGLE", severity: "warning", messageKey: "validation_ranked_output_values_single", messageParams: { hitPolicy: t.hitPolicy }, target: { kind: "decision" } });
3223
- }
3224
- let _ = e2.decision.variableTypeRef;
3225
- O(t) === "list" && _ && x(e2, _) && n.push({ code: "DMN_LIST_RESULT_TYPE", severity: "error", messageKey: "validation_list_result_type", messageParams: { hitPolicy: t.hitPolicy, typeRef: _ }, target: { kind: "decision" } });
3226
- let D = new Map;
3227
- t.outputs.forEach((o, c2) => {
3228
- let d = ee(o, c2);
3229
- D.set(d, (D.get(d) ?? 0) + 1);
3230
- }), t.inputs.forEach((o, c2) => {
3231
- let p2 = { ...{ kind: "input", inputId: o.id }, field: "expression" };
3232
- o.expressionText.trim() || n.push({ code: We, severity: "error", messageKey: "validation_input_expression_missing", target: p2 }), n.push(...[...I(o.expressionText, "expression", i), ...h2(o.expressionText, "expression", { known: a, results: r2 }, i)].map((y) => ({ ...y, target: p2 })));
3233
- let b2 = Qt(e2, o.expressionText), f2 = b2 && ct(e2, b2), g3 = o.typeRef ? ct(e2, J(e2, o.typeRef)) : { name: lt, list: false, structure: false };
3234
- if (!!f2 && (f2.structure || f2.name !== "Any" && r.includes(f2.name)) && (g3 ? !$t(f2, g3) : !f2.structure)) {
3235
- let y = !f2.structure && !f2.list && f2.name === "string" && !!g3 && !g3.list && Wt.has(g3.name);
3236
- n.push({ code: "DMN_COLUMN_TYPE_MISMATCH", severity: "error", messageKey: y ? "validation_column_type_mismatch_duration" : "validation_column_type_mismatch", messageParams: { name: o.expressionText.trim(), declared: ut(f2, g3), column: g3 ? ut(g3, f2) : u(e2, o.typeRef) ?? lt }, target: p2 });
3237
- }
3238
- if (o.allowedValues) {
3239
- let y = E(e2, o.typeRef), S2 = { known: a, results: r2, allowedValues: u2[c2] };
3240
- n.push(...ot(o.allowedValues, y, { kind: "input", inputId: o.id }, i, S2));
3241
- }
3242
- }), t.outputs.forEach((o, c2) => {
3243
- let d = { kind: "output", outputId: o.id }, p2 = ee(o, c2);
3244
- (D.get(p2) ?? 0) > 1 && n.push({ code: "DMN_DUPLICATE_OUTPUT_NAME", severity: "error", messageKey: "validation_duplicate_output_name", messageParams: { name: p2 }, target: d }), o.name?.trim() ? J2(o.name.trim()) || n.push({ code: "DMN_OUTPUT_NAME_INVALID", severity: "error", messageKey: "validation_output_name_invalid", messageParams: { name: o.name.trim() }, target: d }) : t.outputs.length > 1 && n.push({ code: "DMN_OUTPUT_NAME_MISSING", severity: "error", messageKey: "validation_output_name_missing", target: d }), o.allowedValues && n.push(...ot(o.allowedValues, E(e2, p(e2, o)), { kind: "output", outputId: o.id }, i, { known: a, results: r2, allowedValues: l2[c2] }));
3245
- });
3246
- let pt = new Set((e2.scopeVariables ?? []).map((o) => o.name)), ft = xe(t);
3247
- n.push(...w2(e2.inputData));
3248
- let le = e2.inputData.filter((o) => ne(o)), q = new Map;
3249
- le.forEach((o) => {
3250
- let c2 = ne(o);
3251
- q.set(c2, (q.get(c2) ?? 0) + 1);
3252
- }), le.forEach((o) => {
3253
- let c2 = ne(o), d = { kind: "inputData", inputDataId: o.id };
3254
- (q.get(c2) ?? 0) > 1 || c2 === s ? n.push({ code: "DMN_DUPLICATE_INPUT_DATA_NAME", severity: "error", messageKey: "validation_duplicate_input_data_name", messageParams: { name: c2 }, target: d }) : pt.has(c2) && n.push({ code: "DMN_INPUT_DATA_SHADOWS_DECISION", severity: "error", messageKey: "validation_input_data_shadows_decision", messageParams: { name: c2 }, target: d }), h(c2) || n.push({ code: "DMN_INPUT_DATA_NAME_INVALID", severity: "error", messageKey: "validation_input_data_name_invalid", messageParams: { name: c2 }, target: d }), !o.requirementId && ft.has(c2) && n.push({ code: "DMN_MISSING_REQUIREMENT", severity: "error", messageKey: "validation_missing_requirement", messageParams: { name: c2 }, target: d });
3255
- });
3256
- let gt = t.outputs.map((o) => {
3257
- let c2 = A(e2, o);
3258
- return c2 && Ze(c2.text);
3259
- }), me2 = t.outputs.map(() => 0), ce = new Set, ue = false;
3260
- return t.rules.forEach((o) => {
3261
- let c2 = Ht(o.id);
3262
- if ((o.inputEntries.length !== t.inputs.length || o.outputEntries.length !== t.outputs.length) && n.push({ code: "DMN_RULE_ENTRY_COUNT", severity: "error", messageKey: "validation_rule_entry_count", target: c2 }), t.hitPolicy === e.First && (ue ? n.push({ code: "DMN_UNREACHABLE_RULE", severity: "warning", messageKey: "validation_unreachable_rule", target: c2 }) : o.inputEntries.every((p2) => dt(p2.text)) && (ue = true)), !f.has(t.hitPolicy)) {
3263
- let p2 = qt(o);
3264
- ce.has(p2) ? n.push({ code: "DMN_DUPLICATE_RULE", severity: "warning", messageKey: "validation_duplicate_rule", target: c2 }) : ce.add(p2);
3265
- }
3266
- let d = [{ entries: o.inputEntries, columns: t.inputs, literals: u2, dialect: "unaryTests" }, { entries: o.outputEntries, columns: t.outputs, literals: l2, dialect: "expression" }];
3267
- for (let { entries: p2, columns: b2, literals: f2, dialect: g3 } of d)
3268
- p2.forEach((E2, y) => {
3269
- let S2 = b2[y];
3270
- if (!S2)
3271
- return;
3272
- let de2 = { kind: "cell", ruleId: o.id, columnId: S2.id }, H = I(E2.text, g3, i), W2 = g3 === "expression" && !H.some((O2) => O2.severity === "error") ? gt[y] : undefined, pe2 = W2 ? re2(E2.text) : undefined, fe2 = H.some((O2) => O2.severity === "error") ? [] : se(E2.text, g3, E(e2, S2.typeRef)), _t = [...H, ...h2(E2.text, g3, { known: a, results: r2, allowedValues: f2[y] }, i), ...fe2];
3273
- n.push(..._t.map((O2) => ({ ...O2, target: de2 }))), !(!W2 || !E2.text.trim()) && (pe2 === undefined ? me2[y] += 1 : fe2.length === 0 && !W2.has(pe2) && n.push({ code: "DMN_OUTPUT_VALUE_NOT_ALLOWED", severity: "error", messageKey: "validation_output_value_not_allowed", messageParams: { value: E2.text.trim() }, target: de2 }));
3274
- });
3275
- }), t.outputs.forEach((o, c2) => {
3276
- let d = me2[c2];
3277
- d > 0 && n.push({ code: "DMN_OUTPUT_VALUE_UNCHECKED", severity: "warning", messageKey: "validation_output_value_unchecked", messageParams: { count: d }, target: { kind: "output", outputId: o.id, field: "allowedValues" } });
3278
- }), n.push(...M(e2)), n;
3279
- };
3280
- var oe = (e2) => {
3281
- let { literalExpression: t } = e2.decision, n = M(e2), i = { kind: "decision" }, a = B2(e2.inputData, e2.scopeVariables, e2);
3282
- if (e2.decision.name.trim() || n.push({ code: "DMN_DECISION_NAME_MISSING", severity: "error", messageKey: "validation_decision_name_missing", target: i }), n.push(...w2(e2.inputData)), !t.text.trim())
3283
- return n.push({ code: "DMN_LITERAL_EXPRESSION_EMPTY", severity: "error", messageKey: "validation_literal_expression_empty", target: i }), n;
3284
- t.typeRef || n.push({ code: "DMN_LITERAL_EXPRESSION_TYPE_MISSING", severity: "warning", messageKey: "validation_literal_expression_type_missing", target: i });
3285
- let s = new Set(a.map((r2) => r2.name));
3286
- return n.push(...[...I(t.text, "expression", a), ...h2(t.text, "expression", { known: s, results: new Set([te(e2.decision.variableName, e2.decision.name)]) }, a), ...ze(ie(t.text, "expression"), t.typeRef)].map((r2) => ({ ...r2, target: i }))), n;
3287
- };
3288
- var Xt = new Set(["invalid-xml", "unsafe-xml", "migration-failed", "unsupported-version"]);
3289
- var jt = (e2) => Xt.has(e2) ? { code: "DMN_DOCUMENT_UNREADABLE", severity: "error", messageKey: "validation_document_unreadable", target: { kind: "document" } } : null;
3290
- var zt = (e2) => {
3291
- let t = e2.definitions.drgElement ?? [], n = new Set(t.filter((r2) => r2.__$$element === "inputData").map(g2)), i = new Set(t.filter((r2) => r2.__$$element === "decision").map(g2)), a = (r2, m3) => {
3292
- if (!r2)
3293
- return false;
3294
- let u2 = r2["@_href"], l2 = $(u2);
3295
- return l2 !== undefined ? !m3.has(l2) : !u2;
3296
- };
3297
- return t.filter((r2) => r2.__$$element === "decision").some((r2) => (r2.informationRequirement ?? []).some((m3) => a(m3.requiredInput, n) || a(m3.requiredDecision, i))) ? [{ code: "DMN_DANGLING_REQUIREMENT", severity: "error", messageKey: "validation_dangling_requirement", target: { kind: "document" } }] : [];
3298
- };
3299
- var Jt = async (e2, t) => {
3300
- let n = await bs(e2);
3301
- if (n.status === "error") {
3302
- let s = jt(n.reason);
3303
- return s ? [s] : [];
3304
- }
3305
- let i = zt(n.document);
3306
- if (i.length > 0)
3307
- return i;
3308
- if (w(n.document.definitions).length === 1) {
3309
- let s = t?.kind === "decision-table" ? t : await At(e2);
3310
- if (s.kind === "decision-table")
3311
- return i.push(...ae(s.model)), i;
3312
- }
3313
- let a = Ui(n.document);
3314
- return a ? i.push(...oe(a)) : i.push(...nt(n.document), ...M(Q(n.document.definitions))), i;
3315
- };
3316
- export {
3317
- yt as bySeverityWorstFirst,
3318
- J2 as isFeelIdentifier,
3319
- h as isFeelVariableName,
3320
- m2 as localizedMessageParams,
3321
- ae as validateDecisionTableModel,
3322
- Jt as validateDmnDocument,
3323
- oe as validateLiteralExpressionModel
3324
- };
3325
-
3326
- //# debugId=2D8B75C4B292421F64756E2164756E21