@dereekb/util 13.23.0 → 13.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,26 @@
1
1
  'use strict';
2
2
 
3
+ var ts = require('typescript');
4
+
5
+ function _interopNamespaceDefault(e) {
6
+ var n = Object.create(null);
7
+ if (e) {
8
+ Object.keys(e).forEach(function (k) {
9
+ if (k !== 'default') {
10
+ var d = Object.getOwnPropertyDescriptor(e, k);
11
+ Object.defineProperty(n, k, d.get ? d : {
12
+ enumerable: true,
13
+ get: function () { return e[k]; }
14
+ });
15
+ }
16
+ });
17
+ }
18
+ n.default = e;
19
+ return Object.freeze(n);
20
+ }
21
+
22
+ var ts__namespace = /*#__PURE__*/_interopNamespaceDefault(ts);
23
+
3
24
  /**
4
25
  * The bundler hint string that marks a function call as side-effect-free.
5
26
  */ var NO_SIDE_EFFECTS_TAG = '@__NO_SIDE_EFFECTS__';
@@ -270,7 +291,7 @@
270
291
  return result;
271
292
  }
272
293
 
273
- function _array_like_to_array$c(arr, len) {
294
+ function _array_like_to_array$d(arr, len) {
274
295
  if (len == null || len > arr.length) len = arr.length;
275
296
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
276
297
  return arr2;
@@ -278,10 +299,10 @@ function _array_like_to_array$c(arr, len) {
278
299
  function _array_with_holes$a(arr) {
279
300
  if (Array.isArray(arr)) return arr;
280
301
  }
281
- function _array_without_holes$4(arr) {
282
- if (Array.isArray(arr)) return _array_like_to_array$c(arr);
302
+ function _array_without_holes$5(arr) {
303
+ if (Array.isArray(arr)) return _array_like_to_array$d(arr);
283
304
  }
284
- function _iterable_to_array$4(iter) {
305
+ function _iterable_to_array$5(iter) {
285
306
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
286
307
  }
287
308
  function _iterable_to_array_limit$a(arr, i) {
@@ -311,22 +332,22 @@ function _iterable_to_array_limit$a(arr, i) {
311
332
  function _non_iterable_rest$a() {
312
333
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
313
334
  }
314
- function _non_iterable_spread$4() {
335
+ function _non_iterable_spread$5() {
315
336
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
316
337
  }
317
338
  function _sliced_to_array$a(arr, i) {
318
- return _array_with_holes$a(arr) || _iterable_to_array_limit$a(arr, i) || _unsupported_iterable_to_array$c(arr, i) || _non_iterable_rest$a();
339
+ return _array_with_holes$a(arr) || _iterable_to_array_limit$a(arr, i) || _unsupported_iterable_to_array$d(arr, i) || _non_iterable_rest$a();
319
340
  }
320
- function _to_consumable_array$4(arr) {
321
- return _array_without_holes$4(arr) || _iterable_to_array$4(arr) || _unsupported_iterable_to_array$c(arr) || _non_iterable_spread$4();
341
+ function _to_consumable_array$5(arr) {
342
+ return _array_without_holes$5(arr) || _iterable_to_array$5(arr) || _unsupported_iterable_to_array$d(arr) || _non_iterable_spread$5();
322
343
  }
323
- function _unsupported_iterable_to_array$c(o, minLen) {
344
+ function _unsupported_iterable_to_array$d(o, minLen) {
324
345
  if (!o) return;
325
- if (typeof o === "string") return _array_like_to_array$c(o, minLen);
346
+ if (typeof o === "string") return _array_like_to_array$d(o, minLen);
326
347
  var n = Object.prototype.toString.call(o).slice(8, -1);
327
348
  if (n === "Object" && o.constructor) n = o.constructor.name;
328
349
  if (n === "Map" || n === "Set") return Array.from(n);
329
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$c(o, minLen);
350
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$d(o, minLen);
330
351
  }
331
352
  /**
332
353
  * The JSDoc tag identifying a function as a factory in the @dereekb conventions.
@@ -366,7 +387,7 @@ function pickMessageId(hasOverloads, jsdoc) {
366
387
  var additional = ((_options_additionalNamePatterns = options.additionalNamePatterns) !== null && _options_additionalNamePatterns !== void 0 ? _options_additionalNamePatterns : []).map(function(source) {
367
388
  return new RegExp(source);
368
389
  });
369
- result = _to_consumable_array$4(DEFAULT_NAME_PATTERNS).concat(_to_consumable_array$4(additional));
390
+ result = _to_consumable_array$5(DEFAULT_NAME_PATTERNS).concat(_to_consumable_array$5(additional));
370
391
  } else {
371
392
  result = [];
372
393
  }
@@ -474,7 +495,7 @@ function pickMessageId(hasOverloads, jsdoc) {
474
495
  var _fixes;
475
496
  var jsdoc = ctx.jsdoc, redundantLineComments = ctx.orphanLineComments, hasOverloads = ctx.hasOverloads, implLineComment = ctx.implLineComment, chainStartStatement = ctx.chainStartStatement;
476
497
  var fixes = [];
477
- if (jsdoc && !jsdoc.hasNoSideEffects) (_fixes = fixes).push.apply(_fixes, _to_consumable_array$4(buildJsdocTagFixes(fixer, jsdoc)));
498
+ if (jsdoc && !jsdoc.hasNoSideEffects) (_fixes = fixes).push.apply(_fixes, _to_consumable_array$5(buildJsdocTagFixes(fixer, jsdoc)));
478
499
  else if (!jsdoc) fixes.push(buildCreateJsdocFix(fixer, chainStartStatement));
479
500
  if (hasOverloads && !implLineComment) fixes.push(buildImplLineCommentFix(fixer, node));
480
501
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
@@ -527,7 +548,7 @@ function pickMessageId(hasOverloads, jsdoc) {
527
548
  }
528
549
  };
529
550
 
530
- function _array_like_to_array$b(arr, len) {
551
+ function _array_like_to_array$c(arr, len) {
531
552
  if (len == null || len > arr.length) len = arr.length;
532
553
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
533
554
  return arr2;
@@ -563,15 +584,15 @@ function _non_iterable_rest$9() {
563
584
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
564
585
  }
565
586
  function _sliced_to_array$9(arr, i) {
566
- return _array_with_holes$9(arr) || _iterable_to_array_limit$9(arr, i) || _unsupported_iterable_to_array$b(arr, i) || _non_iterable_rest$9();
587
+ return _array_with_holes$9(arr) || _iterable_to_array_limit$9(arr, i) || _unsupported_iterable_to_array$c(arr, i) || _non_iterable_rest$9();
567
588
  }
568
- function _unsupported_iterable_to_array$b(o, minLen) {
589
+ function _unsupported_iterable_to_array$c(o, minLen) {
569
590
  if (!o) return;
570
- if (typeof o === "string") return _array_like_to_array$b(o, minLen);
591
+ if (typeof o === "string") return _array_like_to_array$c(o, minLen);
571
592
  var n = Object.prototype.toString.call(o).slice(8, -1);
572
593
  if (n === "Object" && o.constructor) n = o.constructor.name;
573
594
  if (n === "Map" || n === "Set") return Array.from(n);
574
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$b(o, minLen);
595
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$c(o, minLen);
575
596
  }
576
597
  var UTIL_PREFER_NO_SIDE_EFFECTS_IN_JSDOC_RULE = {
577
598
  meta: {
@@ -871,7 +892,7 @@ function _templateObject() {
871
892
  }
872
893
  };
873
894
 
874
- function _array_like_to_array$a(arr, len) {
895
+ function _array_like_to_array$b(arr, len) {
875
896
  if (len == null || len > arr.length) len = arr.length;
876
897
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
877
898
  return arr2;
@@ -907,19 +928,19 @@ function _non_iterable_rest$8() {
907
928
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
908
929
  }
909
930
  function _sliced_to_array$8(arr, i) {
910
- return _array_with_holes$8(arr) || _iterable_to_array_limit$8(arr, i) || _unsupported_iterable_to_array$a(arr, i) || _non_iterable_rest$8();
931
+ return _array_with_holes$8(arr) || _iterable_to_array_limit$8(arr, i) || _unsupported_iterable_to_array$b(arr, i) || _non_iterable_rest$8();
911
932
  }
912
933
  function _type_of$1(obj) {
913
934
  "@swc/helpers - typeof";
914
935
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
915
936
  }
916
- function _unsupported_iterable_to_array$a(o, minLen) {
937
+ function _unsupported_iterable_to_array$b(o, minLen) {
917
938
  if (!o) return;
918
- if (typeof o === "string") return _array_like_to_array$a(o, minLen);
939
+ if (typeof o === "string") return _array_like_to_array$b(o, minLen);
919
940
  var n = Object.prototype.toString.call(o).slice(8, -1);
920
941
  if (n === "Object" && o.constructor) n = o.constructor.name;
921
942
  if (n === "Map" || n === "Set") return Array.from(n);
922
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$a(o, minLen);
943
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$b(o, minLen);
923
944
  }
924
945
  /**
925
946
  * AST node types whose bodies represent a *new* function scope and must be skipped during return-counting.
@@ -1116,30 +1137,30 @@ function walkChildren(node, out) {
1116
1137
  }
1117
1138
  };
1118
1139
 
1119
- function _array_like_to_array$9(arr, len) {
1140
+ function _array_like_to_array$a(arr, len) {
1120
1141
  if (len == null || len > arr.length) len = arr.length;
1121
1142
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
1122
1143
  return arr2;
1123
1144
  }
1124
- function _array_without_holes$3(arr) {
1125
- if (Array.isArray(arr)) return _array_like_to_array$9(arr);
1145
+ function _array_without_holes$4(arr) {
1146
+ if (Array.isArray(arr)) return _array_like_to_array$a(arr);
1126
1147
  }
1127
- function _iterable_to_array$3(iter) {
1148
+ function _iterable_to_array$4(iter) {
1128
1149
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
1129
1150
  }
1130
- function _non_iterable_spread$3() {
1151
+ function _non_iterable_spread$4() {
1131
1152
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1132
1153
  }
1133
- function _to_consumable_array$3(arr) {
1134
- return _array_without_holes$3(arr) || _iterable_to_array$3(arr) || _unsupported_iterable_to_array$9(arr) || _non_iterable_spread$3();
1154
+ function _to_consumable_array$4(arr) {
1155
+ return _array_without_holes$4(arr) || _iterable_to_array$4(arr) || _unsupported_iterable_to_array$a(arr) || _non_iterable_spread$4();
1135
1156
  }
1136
- function _unsupported_iterable_to_array$9(o, minLen) {
1157
+ function _unsupported_iterable_to_array$a(o, minLen) {
1137
1158
  if (!o) return;
1138
- if (typeof o === "string") return _array_like_to_array$9(o, minLen);
1159
+ if (typeof o === "string") return _array_like_to_array$a(o, minLen);
1139
1160
  var n = Object.prototype.toString.call(o).slice(8, -1);
1140
1161
  if (n === "Object" && o.constructor) n = o.constructor.name;
1141
1162
  if (n === "Map" || n === "Set") return Array.from(n);
1142
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$9(o, minLen);
1163
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$a(o, minLen);
1143
1164
  }
1144
1165
  /**
1145
1166
  * Default name suffixes that mark an interface as config-shaped (its properties should be readonly).
@@ -1244,7 +1265,7 @@ function _unsupported_iterable_to_array$9(o, minLen) {
1244
1265
  create: function create(context) {
1245
1266
  var _context_options_, _options_additionalSuffixes, _options_exemptJsdocTag;
1246
1267
  var options = (_context_options_ = context.options[0]) !== null && _context_options_ !== void 0 ? _context_options_ : {};
1247
- var suffixes = _to_consumable_array$3(DEFAULT_SUFFIXES).concat(_to_consumable_array$3((_options_additionalSuffixes = options.additionalSuffixes) !== null && _options_additionalSuffixes !== void 0 ? _options_additionalSuffixes : []));
1268
+ var suffixes = _to_consumable_array$4(DEFAULT_SUFFIXES).concat(_to_consumable_array$4((_options_additionalSuffixes = options.additionalSuffixes) !== null && _options_additionalSuffixes !== void 0 ? _options_additionalSuffixes : []));
1248
1269
  var exemptTag = (_options_exemptJsdocTag = options.exemptJsdocTag) !== null && _options_exemptJsdocTag !== void 0 ? _options_exemptJsdocTag : DEFAULT_EXEMPT_JSDOC_TAG$3;
1249
1270
  var sourceCode = context.sourceCode;
1250
1271
  function interfaceNameMatches(name) {
@@ -1860,34 +1881,34 @@ function statementBringsMaybeIntoScope(stmt) {
1860
1881
  }
1861
1882
  };
1862
1883
 
1863
- function _array_like_to_array$8(arr, len) {
1884
+ function _array_like_to_array$9(arr, len) {
1864
1885
  if (len == null || len > arr.length) len = arr.length;
1865
1886
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
1866
1887
  return arr2;
1867
1888
  }
1868
- function _array_without_holes$2(arr) {
1869
- if (Array.isArray(arr)) return _array_like_to_array$8(arr);
1889
+ function _array_without_holes$3(arr) {
1890
+ if (Array.isArray(arr)) return _array_like_to_array$9(arr);
1870
1891
  }
1871
- function _iterable_to_array$2(iter) {
1892
+ function _iterable_to_array$3(iter) {
1872
1893
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
1873
1894
  }
1874
- function _non_iterable_spread$2() {
1895
+ function _non_iterable_spread$3() {
1875
1896
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1876
1897
  }
1877
- function _to_consumable_array$2(arr) {
1878
- return _array_without_holes$2(arr) || _iterable_to_array$2(arr) || _unsupported_iterable_to_array$8(arr) || _non_iterable_spread$2();
1898
+ function _to_consumable_array$3(arr) {
1899
+ return _array_without_holes$3(arr) || _iterable_to_array$3(arr) || _unsupported_iterable_to_array$9(arr) || _non_iterable_spread$3();
1879
1900
  }
1880
1901
  function _type_of(obj) {
1881
1902
  "@swc/helpers - typeof";
1882
1903
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
1883
1904
  }
1884
- function _unsupported_iterable_to_array$8(o, minLen) {
1905
+ function _unsupported_iterable_to_array$9(o, minLen) {
1885
1906
  if (!o) return;
1886
- if (typeof o === "string") return _array_like_to_array$8(o, minLen);
1907
+ if (typeof o === "string") return _array_like_to_array$9(o, minLen);
1887
1908
  var n = Object.prototype.toString.call(o).slice(8, -1);
1888
1909
  if (n === "Object" && o.constructor) n = o.constructor.name;
1889
1910
  if (n === "Map" || n === "Set") return Array.from(n);
1890
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$8(o, minLen);
1911
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$9(o, minLen);
1891
1912
  }
1892
1913
  /**
1893
1914
  * The required marker line comment that opens the deprecated-aliases section at the bottom of a file.
@@ -2110,7 +2131,7 @@ function _unsupported_iterable_to_array$8(o, minLen) {
2110
2131
  for(var _iterator = ((_node_properties = node.properties) !== null && _node_properties !== void 0 ? _node_properties : [])[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
2111
2132
  var property = _step.value;
2112
2133
  var _names;
2113
- (_names = names).push.apply(_names, _to_consumable_array$2(collectPatternNames(property.type === 'RestElement' ? property.argument : property.value)));
2134
+ (_names = names).push.apply(_names, _to_consumable_array$3(collectPatternNames(property.type === 'RestElement' ? property.argument : property.value)));
2114
2135
  }
2115
2136
  } catch (err) {
2116
2137
  _didIteratorError = true;
@@ -2133,7 +2154,7 @@ function _unsupported_iterable_to_array$8(o, minLen) {
2133
2154
  for(var _iterator1 = ((_node_elements = node.elements) !== null && _node_elements !== void 0 ? _node_elements : [])[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
2134
2155
  var element = _step1.value;
2135
2156
  var _names1;
2136
- (_names1 = names).push.apply(_names1, _to_consumable_array$2(collectPatternNames((element === null || element === void 0 ? void 0 : element.type) === 'RestElement' ? element.argument : element)));
2157
+ (_names1 = names).push.apply(_names1, _to_consumable_array$3(collectPatternNames((element === null || element === void 0 ? void 0 : element.type) === 'RestElement' ? element.argument : element)));
2137
2158
  }
2138
2159
  } catch (err) {
2139
2160
  _didIteratorError1 = true;
@@ -2151,10 +2172,10 @@ function _unsupported_iterable_to_array$8(o, minLen) {
2151
2172
  }
2152
2173
  } else if (node.type === 'AssignmentPattern') {
2153
2174
  var _names2;
2154
- (_names2 = names).push.apply(_names2, _to_consumable_array$2(collectPatternNames(node.left)));
2175
+ (_names2 = names).push.apply(_names2, _to_consumable_array$3(collectPatternNames(node.left)));
2155
2176
  } else if (node.type === 'RestElement') {
2156
2177
  var _names3;
2157
- (_names3 = names).push.apply(_names3, _to_consumable_array$2(collectPatternNames(node.argument)));
2178
+ (_names3 = names).push.apply(_names3, _to_consumable_array$3(collectPatternNames(node.argument)));
2158
2179
  }
2159
2180
  }
2160
2181
  return names;
@@ -2176,7 +2197,7 @@ function _unsupported_iterable_to_array$8(o, minLen) {
2176
2197
  for(var _iterator = ((_declaration_declarations = declaration.declarations) !== null && _declaration_declarations !== void 0 ? _declaration_declarations : [])[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
2177
2198
  var declarator = _step.value;
2178
2199
  var _names;
2179
- (_names = names).push.apply(_names, _to_consumable_array$2(collectPatternNames(declarator.id)));
2200
+ (_names = names).push.apply(_names, _to_consumable_array$3(collectPatternNames(declarator.id)));
2180
2201
  }
2181
2202
  } catch (err) {
2182
2203
  _didIteratorError = true;
@@ -2668,7 +2689,7 @@ function _unsupported_iterable_to_array$8(o, minLen) {
2668
2689
  }).join('\n\n');
2669
2690
  var appendText = "".concat(trailingNewline, "\n").concat(COMPAT_MARKER_LINE, "\n").concat(joinedBlocks, "\n");
2670
2691
  return function(fixer) {
2671
- return _to_consumable_array$2(blockRanges.map(function(r) {
2692
+ return _to_consumable_array$3(blockRanges.map(function(r) {
2672
2693
  return fixer.removeRange(r);
2673
2694
  })).concat([
2674
2695
  fixer.insertTextAfterRange([
@@ -2886,7 +2907,7 @@ function _unsupported_iterable_to_array$8(o, minLen) {
2886
2907
  }
2887
2908
  };
2888
2909
 
2889
- function _array_like_to_array$7(arr, len) {
2910
+ function _array_like_to_array$8(arr, len) {
2890
2911
  if (len == null || len > arr.length) len = arr.length;
2891
2912
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
2892
2913
  return arr2;
@@ -2922,15 +2943,15 @@ function _non_iterable_rest$7() {
2922
2943
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2923
2944
  }
2924
2945
  function _sliced_to_array$7(arr, i) {
2925
- return _array_with_holes$7(arr) || _iterable_to_array_limit$7(arr, i) || _unsupported_iterable_to_array$7(arr, i) || _non_iterable_rest$7();
2946
+ return _array_with_holes$7(arr) || _iterable_to_array_limit$7(arr, i) || _unsupported_iterable_to_array$8(arr, i) || _non_iterable_rest$7();
2926
2947
  }
2927
- function _unsupported_iterable_to_array$7(o, minLen) {
2948
+ function _unsupported_iterable_to_array$8(o, minLen) {
2928
2949
  if (!o) return;
2929
- if (typeof o === "string") return _array_like_to_array$7(o, minLen);
2950
+ if (typeof o === "string") return _array_like_to_array$8(o, minLen);
2930
2951
  var n = Object.prototype.toString.call(o).slice(8, -1);
2931
2952
  if (n === "Object" && o.constructor) n = o.constructor.name;
2932
2953
  if (n === "Map" || n === "Set") return Array.from(n);
2933
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$7(o, minLen);
2954
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$8(o, minLen);
2934
2955
  }
2935
2956
  var TAG_LINE_REGEX$1 = /^@([A-Za-z_]\w*)\s*(.*)$/;
2936
2957
  var TYPE_ANNOTATION_REGEX = /^\{([^}]*)\}\s*(.*)$/;
@@ -3270,7 +3291,7 @@ var LINE_PREFIX_REGEX = /^(\s*\*?\s?)(.*)$/;
3270
3291
  };
3271
3292
  }
3272
3293
 
3273
- function _array_like_to_array$6(arr, len) {
3294
+ function _array_like_to_array$7(arr, len) {
3274
3295
  if (len == null || len > arr.length) len = arr.length;
3275
3296
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
3276
3297
  return arr2;
@@ -3278,10 +3299,10 @@ function _array_like_to_array$6(arr, len) {
3278
3299
  function _array_with_holes$6(arr) {
3279
3300
  if (Array.isArray(arr)) return arr;
3280
3301
  }
3281
- function _array_without_holes$1(arr) {
3282
- if (Array.isArray(arr)) return _array_like_to_array$6(arr);
3302
+ function _array_without_holes$2(arr) {
3303
+ if (Array.isArray(arr)) return _array_like_to_array$7(arr);
3283
3304
  }
3284
- function _iterable_to_array$1(iter) {
3305
+ function _iterable_to_array$2(iter) {
3285
3306
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
3286
3307
  }
3287
3308
  function _iterable_to_array_limit$6(arr, i) {
@@ -3311,22 +3332,22 @@ function _iterable_to_array_limit$6(arr, i) {
3311
3332
  function _non_iterable_rest$6() {
3312
3333
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
3313
3334
  }
3314
- function _non_iterable_spread$1() {
3335
+ function _non_iterable_spread$2() {
3315
3336
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
3316
3337
  }
3317
3338
  function _sliced_to_array$6(arr, i) {
3318
- return _array_with_holes$6(arr) || _iterable_to_array_limit$6(arr, i) || _unsupported_iterable_to_array$6(arr, i) || _non_iterable_rest$6();
3339
+ return _array_with_holes$6(arr) || _iterable_to_array_limit$6(arr, i) || _unsupported_iterable_to_array$7(arr, i) || _non_iterable_rest$6();
3319
3340
  }
3320
- function _to_consumable_array$1(arr) {
3321
- return _array_without_holes$1(arr) || _iterable_to_array$1(arr) || _unsupported_iterable_to_array$6(arr) || _non_iterable_spread$1();
3341
+ function _to_consumable_array$2(arr) {
3342
+ return _array_without_holes$2(arr) || _iterable_to_array$2(arr) || _unsupported_iterable_to_array$7(arr) || _non_iterable_spread$2();
3322
3343
  }
3323
- function _unsupported_iterable_to_array$6(o, minLen) {
3344
+ function _unsupported_iterable_to_array$7(o, minLen) {
3324
3345
  if (!o) return;
3325
- if (typeof o === "string") return _array_like_to_array$6(o, minLen);
3346
+ if (typeof o === "string") return _array_like_to_array$7(o, minLen);
3326
3347
  var n = Object.prototype.toString.call(o).slice(8, -1);
3327
3348
  if (n === "Object" && o.constructor) n = o.constructor.name;
3328
3349
  if (n === "Map" || n === "Set") return Array.from(n);
3329
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$6(o, minLen);
3350
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$7(o, minLen);
3330
3351
  }
3331
3352
  var TAG_LINE_REGEX = /^@([A-Za-z_]\w*)\s*(.*)$/;
3332
3353
  var DEFAULT_WORKSPACE_TAG_PREFIXES = [
@@ -3645,7 +3666,7 @@ var TYPE_RESTATING_PATTERNS = [
3645
3666
  }
3646
3667
  return [
3647
3668
  header
3648
- ].concat(_to_consumable_array$1(tag.continuationLines));
3669
+ ].concat(_to_consumable_array$2(tag.continuationLines));
3649
3670
  }
3650
3671
  /**
3651
3672
  * Groups the canonical tags into bucketed sections, inserting a new section when the bucket changes.
@@ -3670,7 +3691,7 @@ var TYPE_RESTATING_PATTERNS = [
3670
3691
  currentBucket = b;
3671
3692
  hasCurrentSection = true;
3672
3693
  }
3673
- (_currentSection = currentSection).push.apply(_currentSection, _to_consumable_array$1(serializeTag(tag)));
3694
+ (_currentSection = currentSection).push.apply(_currentSection, _to_consumable_array$2(serializeTag(tag)));
3674
3695
  }
3675
3696
  } catch (err) {
3676
3697
  _didIteratorError = true;
@@ -3701,7 +3722,7 @@ var TYPE_RESTATING_PATTERNS = [
3701
3722
  var _step_value = _sliced_to_array$6(_step.value, 2), i = _step_value[0], section = _step_value[1];
3702
3723
  var _allLines;
3703
3724
  if (i > 0) allLines.push('');
3704
- (_allLines = allLines).push.apply(_allLines, _to_consumable_array$1(section));
3725
+ (_allLines = allLines).push.apply(_allLines, _to_consumable_array$2(section));
3705
3726
  }
3706
3727
  } catch (err) {
3707
3728
  _didIteratorError = true;
@@ -3772,10 +3793,10 @@ var TYPE_RESTATING_PATTERNS = [
3772
3793
  result = '* ' + descText + ' ';
3773
3794
  } else {
3774
3795
  var descriptionSections = model.descriptionParagraphs.map(function(paragraph) {
3775
- return _to_consumable_array$1(paragraph);
3796
+ return _to_consumable_array$2(paragraph);
3776
3797
  });
3777
3798
  var tagSections = groupTagsIntoSections(model.tags, workspacePrefixes);
3778
- var allLines = flattenSections(_to_consumable_array$1(descriptionSections).concat(_to_consumable_array$1(tagSections)));
3799
+ var allLines = flattenSections(_to_consumable_array$2(descriptionSections).concat(_to_consumable_array$2(tagSections)));
3779
3800
  result = renderMultilineValue(allLines, indent);
3780
3801
  }
3781
3802
  return result;
@@ -3942,7 +3963,7 @@ var LOWER_LETTER_PATTERN = /[a-z]/;
3942
3963
  if (tag.tag !== 'example') return;
3943
3964
  var bodyLines = [];
3944
3965
  if (tag.headerText.length > 0) bodyLines.push(tag.headerText);
3945
- (_bodyLines = bodyLines).push.apply(_bodyLines, _to_consumable_array$1(tag.continuationLines));
3966
+ (_bodyLines = bodyLines).push.apply(_bodyLines, _to_consumable_array$2(tag.continuationLines));
3946
3967
  var firstNonBlank = findFirstNonBlankLine(bodyLines);
3947
3968
  if (firstNonBlank == null) return;
3948
3969
  if (firstNonBlank.trimStart().startsWith('```')) return;
@@ -3952,7 +3973,7 @@ var LOWER_LETTER_PATTERN = /[a-z]/;
3952
3973
  tag.headerText = '';
3953
3974
  tag.continuationLines = [
3954
3975
  '```ts'
3955
- ].concat(_to_consumable_array$1(content), [
3976
+ ].concat(_to_consumable_array$2(content), [
3956
3977
  '```'
3957
3978
  ]);
3958
3979
  }
@@ -4818,7 +4839,7 @@ var LOWER_LETTER_PATTERN = /[a-z]/;
4818
4839
  return name;
4819
4840
  }
4820
4841
 
4821
- function _array_like_to_array$5(arr, len) {
4842
+ function _array_like_to_array$6(arr, len) {
4822
4843
  if (len == null || len > arr.length) len = arr.length;
4823
4844
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4824
4845
  return arr2;
@@ -4854,15 +4875,15 @@ function _non_iterable_rest$5() {
4854
4875
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
4855
4876
  }
4856
4877
  function _sliced_to_array$5(arr, i) {
4857
- return _array_with_holes$5(arr) || _iterable_to_array_limit$5(arr, i) || _unsupported_iterable_to_array$5(arr, i) || _non_iterable_rest$5();
4878
+ return _array_with_holes$5(arr) || _iterable_to_array_limit$5(arr, i) || _unsupported_iterable_to_array$6(arr, i) || _non_iterable_rest$5();
4858
4879
  }
4859
- function _unsupported_iterable_to_array$5(o, minLen) {
4880
+ function _unsupported_iterable_to_array$6(o, minLen) {
4860
4881
  if (!o) return;
4861
- if (typeof o === "string") return _array_like_to_array$5(o, minLen);
4882
+ if (typeof o === "string") return _array_like_to_array$6(o, minLen);
4862
4883
  var n = Object.prototype.toString.call(o).slice(8, -1);
4863
4884
  if (n === "Object" && o.constructor) n = o.constructor.name;
4864
4885
  if (n === "Map" || n === "Set") return Array.from(n);
4865
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$5(o, minLen);
4886
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$6(o, minLen);
4866
4887
  }
4867
4888
  /**
4868
4889
  * Shared helpers for the `@dbx<Family>` companion-tag ESLint rules. Mirrors the
@@ -6940,7 +6961,7 @@ var DEFAULT_KNOWN_COMPANIONS$4 = [
6940
6961
  }
6941
6962
  };
6942
6963
 
6943
- function _array_like_to_array$4(arr, len) {
6964
+ function _array_like_to_array$5(arr, len) {
6944
6965
  if (len == null || len > arr.length) len = arr.length;
6945
6966
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
6946
6967
  return arr2;
@@ -6948,10 +6969,10 @@ function _array_like_to_array$4(arr, len) {
6948
6969
  function _array_with_holes$4(arr) {
6949
6970
  if (Array.isArray(arr)) return arr;
6950
6971
  }
6951
- function _array_without_holes(arr) {
6952
- if (Array.isArray(arr)) return _array_like_to_array$4(arr);
6972
+ function _array_without_holes$1(arr) {
6973
+ if (Array.isArray(arr)) return _array_like_to_array$5(arr);
6953
6974
  }
6954
- function _iterable_to_array(iter) {
6975
+ function _iterable_to_array$1(iter) {
6955
6976
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
6956
6977
  }
6957
6978
  function _iterable_to_array_limit$4(arr, i) {
@@ -6981,22 +7002,22 @@ function _iterable_to_array_limit$4(arr, i) {
6981
7002
  function _non_iterable_rest$4() {
6982
7003
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
6983
7004
  }
6984
- function _non_iterable_spread() {
7005
+ function _non_iterable_spread$1() {
6985
7006
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
6986
7007
  }
6987
7008
  function _sliced_to_array$4(arr, i) {
6988
- return _array_with_holes$4(arr) || _iterable_to_array_limit$4(arr, i) || _unsupported_iterable_to_array$4(arr, i) || _non_iterable_rest$4();
7009
+ return _array_with_holes$4(arr) || _iterable_to_array_limit$4(arr, i) || _unsupported_iterable_to_array$5(arr, i) || _non_iterable_rest$4();
6989
7010
  }
6990
- function _to_consumable_array(arr) {
6991
- return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array$4(arr) || _non_iterable_spread();
7011
+ function _to_consumable_array$1(arr) {
7012
+ return _array_without_holes$1(arr) || _iterable_to_array$1(arr) || _unsupported_iterable_to_array$5(arr) || _non_iterable_spread$1();
6992
7013
  }
6993
- function _unsupported_iterable_to_array$4(o, minLen) {
7014
+ function _unsupported_iterable_to_array$5(o, minLen) {
6994
7015
  if (!o) return;
6995
- if (typeof o === "string") return _array_like_to_array$4(o, minLen);
7016
+ if (typeof o === "string") return _array_like_to_array$5(o, minLen);
6996
7017
  var n = Object.prototype.toString.call(o).slice(8, -1);
6997
7018
  if (n === "Object" && o.constructor) n = o.constructor.name;
6998
7019
  if (n === "Map" || n === "Set") return Array.from(n);
6999
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$4(o, minLen);
7020
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$5(o, minLen);
7000
7021
  }
7001
7022
  var DEFAULT_ALLOWED_ROLES = [
7002
7023
  'directive',
@@ -7460,7 +7481,7 @@ function reportClassSkillRefs(ctx, skillRefsTags) {
7460
7481
  });
7461
7482
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
7462
7483
  try {
7463
- for(var _iterator = _to_consumable_array(fromTags).concat(_to_consumable_array(toTags))[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
7484
+ for(var _iterator = _to_consumable_array$1(fromTags).concat(_to_consumable_array$1(toTags))[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
7464
7485
  var tag = _step.value;
7465
7486
  var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
7466
7487
  try {
@@ -7525,7 +7546,7 @@ function reportClassSkillRefs(ctx, skillRefsTags) {
7525
7546
  }
7526
7547
  };
7527
7548
 
7528
- function _array_like_to_array$3(arr, len) {
7549
+ function _array_like_to_array$4(arr, len) {
7529
7550
  if (len == null || len > arr.length) len = arr.length;
7530
7551
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
7531
7552
  return arr2;
@@ -7561,15 +7582,15 @@ function _non_iterable_rest$3() {
7561
7582
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
7562
7583
  }
7563
7584
  function _sliced_to_array$3(arr, i) {
7564
- return _array_with_holes$3(arr) || _iterable_to_array_limit$3(arr, i) || _unsupported_iterable_to_array$3(arr, i) || _non_iterable_rest$3();
7585
+ return _array_with_holes$3(arr) || _iterable_to_array_limit$3(arr, i) || _unsupported_iterable_to_array$4(arr, i) || _non_iterable_rest$3();
7565
7586
  }
7566
- function _unsupported_iterable_to_array$3(o, minLen) {
7587
+ function _unsupported_iterable_to_array$4(o, minLen) {
7567
7588
  if (!o) return;
7568
- if (typeof o === "string") return _array_like_to_array$3(o, minLen);
7589
+ if (typeof o === "string") return _array_like_to_array$4(o, minLen);
7569
7590
  var n = Object.prototype.toString.call(o).slice(8, -1);
7570
7591
  if (n === "Object" && o.constructor) n = o.constructor.name;
7571
7592
  if (n === "Map" || n === "Set") return Array.from(n);
7572
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$3(o, minLen);
7593
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$4(o, minLen);
7573
7594
  }
7574
7595
  var FORM_MARKERS = new Set([
7575
7596
  'dbxFormField',
@@ -8267,7 +8288,7 @@ function reportFormComposesFromKebab(ctx, composesFromTags, markers) {
8267
8288
  }
8268
8289
  };
8269
8290
 
8270
- function _array_like_to_array$2(arr, len) {
8291
+ function _array_like_to_array$3(arr, len) {
8271
8292
  if (len == null || len > arr.length) len = arr.length;
8272
8293
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
8273
8294
  return arr2;
@@ -8303,15 +8324,15 @@ function _non_iterable_rest$2() {
8303
8324
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
8304
8325
  }
8305
8326
  function _sliced_to_array$2(arr, i) {
8306
- return _array_with_holes$2(arr) || _iterable_to_array_limit$2(arr, i) || _unsupported_iterable_to_array$2(arr, i) || _non_iterable_rest$2();
8327
+ return _array_with_holes$2(arr) || _iterable_to_array_limit$2(arr, i) || _unsupported_iterable_to_array$3(arr, i) || _non_iterable_rest$2();
8307
8328
  }
8308
- function _unsupported_iterable_to_array$2(o, minLen) {
8329
+ function _unsupported_iterable_to_array$3(o, minLen) {
8309
8330
  if (!o) return;
8310
- if (typeof o === "string") return _array_like_to_array$2(o, minLen);
8331
+ if (typeof o === "string") return _array_like_to_array$3(o, minLen);
8311
8332
  var n = Object.prototype.toString.call(o).slice(8, -1);
8312
8333
  if (n === "Object" && o.constructor) n = o.constructor.name;
8313
8334
  if (n === "Map" || n === "Set") return Array.from(n);
8314
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$2(o, minLen);
8335
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$3(o, minLen);
8315
8336
  }
8316
8337
  var DEFAULT_KNOWN_COMPANIONS$1 = [
8317
8338
  'ClaimsApp',
@@ -8651,7 +8672,7 @@ var DEFAULT_KNOWN_COMPANIONS$1 = [
8651
8672
  }
8652
8673
  };
8653
8674
 
8654
- function _array_like_to_array$1(arr, len) {
8675
+ function _array_like_to_array$2(arr, len) {
8655
8676
  if (len == null || len > arr.length) len = arr.length;
8656
8677
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
8657
8678
  return arr2;
@@ -8687,15 +8708,15 @@ function _non_iterable_rest$1() {
8687
8708
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
8688
8709
  }
8689
8710
  function _sliced_to_array$1(arr, i) {
8690
- return _array_with_holes$1(arr) || _iterable_to_array_limit$1(arr, i) || _unsupported_iterable_to_array$1(arr, i) || _non_iterable_rest$1();
8711
+ return _array_with_holes$1(arr) || _iterable_to_array_limit$1(arr, i) || _unsupported_iterable_to_array$2(arr, i) || _non_iterable_rest$1();
8691
8712
  }
8692
- function _unsupported_iterable_to_array$1(o, minLen) {
8713
+ function _unsupported_iterable_to_array$2(o, minLen) {
8693
8714
  if (!o) return;
8694
- if (typeof o === "string") return _array_like_to_array$1(o, minLen);
8715
+ if (typeof o === "string") return _array_like_to_array$2(o, minLen);
8695
8716
  var n = Object.prototype.toString.call(o).slice(8, -1);
8696
8717
  if (n === "Object" && o.constructor) n = o.constructor.name;
8697
8718
  if (n === "Map" || n === "Set") return Array.from(n);
8698
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$1(o, minLen);
8719
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$2(o, minLen);
8699
8720
  }
8700
8721
  var DEFAULT_ALLOWED_SEVERITIES = [
8701
8722
  'error',
@@ -9661,6 +9682,310 @@ function collectRuleCompanions(parsed) {
9661
9682
  }
9662
9683
  };
9663
9684
 
9685
+ function _array_like_to_array$1(arr, len) {
9686
+ if (len == null || len > arr.length) len = arr.length;
9687
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
9688
+ return arr2;
9689
+ }
9690
+ function _array_without_holes(arr) {
9691
+ if (Array.isArray(arr)) return _array_like_to_array$1(arr);
9692
+ }
9693
+ function _iterable_to_array(iter) {
9694
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
9695
+ }
9696
+ function _non_iterable_spread() {
9697
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
9698
+ }
9699
+ function _to_consumable_array(arr) {
9700
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array$1(arr) || _non_iterable_spread();
9701
+ }
9702
+ function _unsupported_iterable_to_array$1(o, minLen) {
9703
+ if (!o) return;
9704
+ if (typeof o === "string") return _array_like_to_array$1(o, minLen);
9705
+ var n = Object.prototype.toString.call(o).slice(8, -1);
9706
+ if (n === "Object" && o.constructor) n = o.constructor.name;
9707
+ if (n === "Map" || n === "Set") return Array.from(n);
9708
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$1(o, minLen);
9709
+ }
9710
+ /**
9711
+ * Reads a numeric/string literal value from an assertion's asserted expression. Handles a bare
9712
+ * `Literal` (e.g. `0`, `'foo'`) and a unary-signed numeric literal (e.g. `-1`, `+2`) so negative
9713
+ * enum values round-trip. Returns `null` for anything else (member access, call, template, etc.) —
9714
+ * those are not the "magic literal stamped onto an enum type" smell this rule targets.
9715
+ *
9716
+ * @param node - The asserted expression AST node.
9717
+ * @returns The literal value + source text, or `null` when the expression is not a literal.
9718
+ */ function readLiteral(node) {
9719
+ var result = null;
9720
+ if (node) {
9721
+ var _node_argument;
9722
+ if (node.type === 'Literal' && (typeof node.value === 'number' || typeof node.value === 'string')) {
9723
+ var _node_raw;
9724
+ result = {
9725
+ value: node.value,
9726
+ text: String((_node_raw = node.raw) !== null && _node_raw !== void 0 ? _node_raw : node.value)
9727
+ };
9728
+ } else if (node.type === 'UnaryExpression' && (node.operator === '-' || node.operator === '+') && ((_node_argument = node.argument) === null || _node_argument === void 0 ? void 0 : _node_argument.type) === 'Literal' && typeof node.argument.value === 'number') {
9729
+ var _node_argument_raw;
9730
+ var numeric = node.operator === '-' ? -node.argument.value : node.argument.value;
9731
+ result = {
9732
+ value: numeric,
9733
+ text: "".concat(node.operator).concat((_node_argument_raw = node.argument.raw) !== null && _node_argument_raw !== void 0 ? _node_argument_raw : node.argument.value)
9734
+ };
9735
+ }
9736
+ }
9737
+ return result;
9738
+ }
9739
+ /**
9740
+ * Resolves the enum symbol behind a TS type node, following an `import type` / import alias to the
9741
+ * real declaration. Returns `null` when the type is not an enum (a branded number/string alias like
9742
+ * `EntityId`, a class, an interface, a primitive, etc. — none of which have named members to prefer).
9743
+ *
9744
+ * @param checker - The TS type checker.
9745
+ * @param typeRefNode - The TS node mapped from the assertion's `typeAnnotation`.
9746
+ * @returns The enum's symbol, or `null` when the target type is not an enum.
9747
+ */ function resolveEnumSymbol(checker, typeRefNode) {
9748
+ var result = null;
9749
+ if (typeRefNode && ts__namespace.isTypeReferenceNode(typeRefNode) && ts__namespace.isIdentifier(typeRefNode.typeName)) {
9750
+ var symbol = checker.getSymbolAtLocation(typeRefNode.typeName);
9751
+ if (symbol && symbol.flags & ts__namespace.SymbolFlags.Alias) {
9752
+ symbol = checker.getAliasedSymbol(symbol);
9753
+ }
9754
+ // `SymbolFlags.Enum` === `RegularEnum | ConstEnum`, so this matches both `enum` and `const enum`.
9755
+ if (symbol && symbol.flags & ts__namespace.SymbolFlags.Enum) {
9756
+ result = symbol;
9757
+ }
9758
+ }
9759
+ return result;
9760
+ }
9761
+ /**
9762
+ * Finds the name of the enum member whose constant value equals `value`. Iterates the enum symbol's
9763
+ * member table and compares each member's computed constant value (works for `enum` and `const enum`,
9764
+ * numeric and string members). Returns `null` when no member matches — i.e. the literal is outside
9765
+ * the enum's domain, which is an unsafe cast the type system would otherwise have caught.
9766
+ *
9767
+ * @param checker - The TS type checker.
9768
+ * @param enumSymbol - The resolved enum symbol.
9769
+ * @param value - The literal value the cast stamps onto the enum type.
9770
+ * @returns The matching member name, or `null` when the value matches no member.
9771
+ */ function findEnumMemberName(checker, enumSymbol, value) {
9772
+ var result = null;
9773
+ var members = enumSymbol.exports;
9774
+ if (members) {
9775
+ members.forEach(function(memberSymbol) {
9776
+ var declaration = memberSymbol.valueDeclaration;
9777
+ if (result == null && declaration && ts__namespace.isEnumMember(declaration) && checker.getConstantValue(declaration) === value) {
9778
+ result = memberSymbol.getName();
9779
+ }
9780
+ });
9781
+ }
9782
+ return result;
9783
+ }
9784
+ /**
9785
+ * Locates the import that binds `localName` and classifies how the enum must be made value-usable.
9786
+ * When the binding is not a type-only import (already a value import, or a local enum declaration),
9787
+ * returns a `value` plan that needs no import edit.
9788
+ *
9789
+ * @param program - The `Program` AST node.
9790
+ * @param localName - The local identifier used in the cast (the enum's in-scope name).
9791
+ * @returns The import-fix plan for the binding.
9792
+ */ function planImportFix(program, localName) {
9793
+ var _ref;
9794
+ var plan = {
9795
+ kind: 'value'
9796
+ };
9797
+ var body = (_ref = program === null || program === void 0 ? void 0 : program.body) !== null && _ref !== void 0 ? _ref : [];
9798
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
9799
+ try {
9800
+ for(var _iterator = body[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
9801
+ var statement = _step.value;
9802
+ if (plan.kind === 'value' && statement.type === 'ImportDeclaration') {
9803
+ var _statement_specifiers;
9804
+ var specifiers = (_statement_specifiers = statement.specifiers) !== null && _statement_specifiers !== void 0 ? _statement_specifiers : [];
9805
+ var specifier = specifiers.find(function(spec) {
9806
+ var _spec_local;
9807
+ return spec.type === 'ImportSpecifier' && ((_spec_local = spec.local) === null || _spec_local === void 0 ? void 0 : _spec_local.name) === localName;
9808
+ });
9809
+ if (specifier) {
9810
+ if (specifier.importKind === 'type') {
9811
+ plan = {
9812
+ kind: 'inline-type',
9813
+ declaration: statement,
9814
+ specifier: specifier
9815
+ };
9816
+ } else if (statement.importKind === 'type') {
9817
+ plan = specifiers.length === 1 ? {
9818
+ kind: 'decl-type-single',
9819
+ declaration: statement,
9820
+ specifier: specifier
9821
+ } : {
9822
+ kind: 'decl-type-multi',
9823
+ declaration: statement,
9824
+ specifier: specifier
9825
+ };
9826
+ }
9827
+ }
9828
+ }
9829
+ }
9830
+ } catch (err) {
9831
+ _didIteratorError = true;
9832
+ _iteratorError = err;
9833
+ } finally{
9834
+ try {
9835
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
9836
+ _iterator.return();
9837
+ }
9838
+ } finally{
9839
+ if (_didIteratorError) {
9840
+ throw _iteratorError;
9841
+ }
9842
+ }
9843
+ }
9844
+ return plan;
9845
+ }
9846
+ /**
9847
+ * Builds the fixer edits that convert the enum's binding into a value import per the resolved plan.
9848
+ * Returns an empty array for the `value` plan (nothing to change).
9849
+ *
9850
+ * @param fixer - The ESLint fixer.
9851
+ * @param sourceCode - The ESLint `SourceCode` instance.
9852
+ * @param plan - The import-fix plan from {@link planImportFix}.
9853
+ * @returns The list of fixer edits (possibly empty).
9854
+ */ function buildImportFixes(fixer, sourceCode, plan) {
9855
+ var fixes = [];
9856
+ if (plan.kind === 'inline-type' && plan.specifier) {
9857
+ // `type Foo` -> `Foo`: drop the leading `type` keyword + following whitespace.
9858
+ var typeToken = sourceCode.getFirstToken(plan.specifier);
9859
+ var nameToken = sourceCode.getTokenAfter(typeToken);
9860
+ fixes.push(fixer.removeRange([
9861
+ typeToken.range[0],
9862
+ nameToken.range[0]
9863
+ ]));
9864
+ } else if (plan.kind === 'decl-type-single' && plan.declaration) {
9865
+ // `import type { Foo }` -> `import { Foo }`: drop the declaration-level `type` keyword.
9866
+ var importToken = sourceCode.getFirstToken(plan.declaration);
9867
+ var typeToken1 = sourceCode.getTokenAfter(importToken);
9868
+ var afterTypeToken = sourceCode.getTokenAfter(typeToken1);
9869
+ fixes.push(fixer.removeRange([
9870
+ typeToken1.range[0],
9871
+ afterTypeToken.range[0]
9872
+ ]));
9873
+ } else if (plan.kind === 'decl-type-multi' && plan.declaration && plan.specifier) {
9874
+ var _plan_declaration_specifiers;
9875
+ // `import type { A, Foo }` -> `import type { A };\nimport { Foo } from '…';`
9876
+ var specifiers = (_plan_declaration_specifiers = plan.declaration.specifiers) !== null && _plan_declaration_specifiers !== void 0 ? _plan_declaration_specifiers : [];
9877
+ var index = specifiers.indexOf(plan.specifier);
9878
+ if (index === specifiers.length - 1) {
9879
+ // last specifier: also remove the preceding comma (sits after the previous specifier).
9880
+ var previous = specifiers[index - 1];
9881
+ fixes.push(fixer.removeRange([
9882
+ previous.range[1],
9883
+ plan.specifier.range[1]
9884
+ ]));
9885
+ } else {
9886
+ // not last: remove the specifier and the comma/space up to the next specifier.
9887
+ fixes.push(fixer.removeRange([
9888
+ plan.specifier.range[0],
9889
+ specifiers[index + 1].range[0]
9890
+ ]));
9891
+ }
9892
+ fixes.push(fixer.insertTextAfter(plan.declaration, "\nimport { ".concat(sourceCode.getText(plan.specifier), " } from ").concat(plan.declaration.source.raw, ";")));
9893
+ }
9894
+ return fixes;
9895
+ }
9896
+ /**
9897
+ * ESLint rule that flags a numeric/string literal asserted onto an enum type — e.g.
9898
+ * `layer: 0 as PromptLayer` — and steers it to the named member (`PromptLayer.REPLY_PROTOCOL`).
9899
+ *
9900
+ * The cast is doubly harmful: it bypasses type-checking (any in-range *or* out-of-range number
9901
+ * satisfies `n as SomeEnum`, so `99 as PromptLayer` compiles silently) and it hides intent behind a
9902
+ * magic number. The rule is type-aware: it fires ONLY when the assertion target resolves to a real
9903
+ * `enum` / `const enum`, so legitimate branded-primitive aliases (`30 as EntityId`,
9904
+ * `7001 as ConceptId`) — which have no named members and for which the cast is the sanctioned form —
9905
+ * are never touched.
9906
+ *
9907
+ * When the literal matches a member, the fix rewrites the assertion to `Enum.MEMBER` and, when the
9908
+ * enum is bound via `import type` / `import { type … }`, converts that binding to a value import so
9909
+ * the rewritten value reference compiles. When the literal matches NO member, the rule reports the
9910
+ * unsafe cast without a fix (there is no correct member to substitute).
9911
+ *
9912
+ * Requires type information — it no-ops in lint passes without it (no `projectService` / `project`).
9913
+ */ var UTIL_NO_ENUM_LITERAL_CAST_RULE = {
9914
+ meta: {
9915
+ type: 'problem',
9916
+ fixable: 'code',
9917
+ docs: {
9918
+ description: 'Disallow asserting a literal onto an enum type (e.g. `0 as PromptLayer`); use the named enum member instead.',
9919
+ recommended: true
9920
+ },
9921
+ messages: {
9922
+ useEnumMember: 'Avoid `{{literal}} as {{enumName}}`; use the named member `{{enumName}}.{{member}}`. The literal cast bypasses type-checking (any number satisfies it) and hides intent.',
9923
+ unsafeEnumCast: '`{{literal}} as {{enumName}}` casts a literal onto enum `{{enumName}}`, but no `{{enumName}}` member has that value. The cast bypasses type-checking — use a real `{{enumName}}` member.'
9924
+ },
9925
+ schema: []
9926
+ },
9927
+ create: function create(context) {
9928
+ var sourceCode = context.sourceCode;
9929
+ var services = sourceCode === null || sourceCode === void 0 ? void 0 : sourceCode.parserServices;
9930
+ // The rule is only meaningful with type information. Without it (`program`/node-map absent) it
9931
+ // cannot tell an enum target from a branded-primitive alias, so it stays silent rather than guess.
9932
+ if (!(services === null || services === void 0 ? void 0 : services.program) || !(services === null || services === void 0 ? void 0 : services.esTreeNodeToTSNodeMap)) {
9933
+ return {};
9934
+ }
9935
+ var checker = services.program.getTypeChecker();
9936
+ var programNode = null;
9937
+ function check(node) {
9938
+ var _node_typeAnnotation, _node_typeAnnotation_typeName;
9939
+ var literal = readLiteral(node.expression);
9940
+ if (literal && ((_node_typeAnnotation = node.typeAnnotation) === null || _node_typeAnnotation === void 0 ? void 0 : _node_typeAnnotation.type) === 'TSTypeReference' && ((_node_typeAnnotation_typeName = node.typeAnnotation.typeName) === null || _node_typeAnnotation_typeName === void 0 ? void 0 : _node_typeAnnotation_typeName.type) === 'Identifier') {
9941
+ var typeRefNode = services.esTreeNodeToTSNodeMap.get(node.typeAnnotation);
9942
+ var enumSymbol = resolveEnumSymbol(checker, typeRefNode);
9943
+ if (enumSymbol) {
9944
+ var enumName = node.typeAnnotation.typeName.name;
9945
+ var member = findEnumMemberName(checker, enumSymbol, literal.value);
9946
+ if (member == null) {
9947
+ // No member carries this literal value (e.g. `99 as Color`): an unsafe cast the type
9948
+ // system would otherwise catch. Report it, but there is no correct member to fix to.
9949
+ context.report({
9950
+ node: node,
9951
+ messageId: 'unsafeEnumCast',
9952
+ data: {
9953
+ literal: literal.text,
9954
+ enumName: enumName
9955
+ }
9956
+ });
9957
+ } else {
9958
+ var plan = programNode ? planImportFix(programNode, enumName) : {
9959
+ kind: 'value'
9960
+ };
9961
+ context.report({
9962
+ node: node,
9963
+ messageId: 'useEnumMember',
9964
+ data: {
9965
+ literal: literal.text,
9966
+ enumName: enumName,
9967
+ member: member
9968
+ },
9969
+ fix: function fix(fixer) {
9970
+ return [
9971
+ fixer.replaceText(node, "".concat(enumName, ".").concat(member))
9972
+ ].concat(_to_consumable_array(buildImportFixes(fixer, sourceCode, plan)));
9973
+ }
9974
+ });
9975
+ }
9976
+ }
9977
+ }
9978
+ }
9979
+ return {
9980
+ Program: function Program(node) {
9981
+ programNode = node;
9982
+ },
9983
+ TSAsExpression: check,
9984
+ TSTypeAssertion: check
9985
+ };
9986
+ }
9987
+ };
9988
+
9664
9989
  function _array_like_to_array(arr, len) {
9665
9990
  if (len == null || len > arr.length) len = arr.length;
9666
9991
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
@@ -9919,7 +10244,8 @@ function _unsupported_iterable_to_array(o, minLen) {
9919
10244
  'require-default-prefix-naming': UTIL_REQUIRE_DEFAULT_PREFIX_NAMING_RULE,
9920
10245
  'require-exported-jsdoc-example': UTIL_REQUIRE_EXPORTED_JSDOC_EXAMPLE_RULE,
9921
10246
  'no-inline-string-empty-object-intersection': UTIL_NO_INLINE_STRING_EMPTY_OBJECT_INTERSECTION_RULE,
9922
- 'prefer-suggested-string': UTIL_PREFER_SUGGESTED_STRING_RULE
10247
+ 'prefer-suggested-string': UTIL_PREFER_SUGGESTED_STRING_RULE,
10248
+ 'no-enum-literal-cast': UTIL_NO_ENUM_LITERAL_CAST_RULE
9923
10249
  }
9924
10250
  };
9925
10251
  /**
@@ -9929,6 +10255,7 @@ function _unsupported_iterable_to_array(o, minLen) {
9929
10255
  */ var utilESLintPlugin = UTIL_ESLINT_PLUGIN;
9930
10256
 
9931
10257
  exports.UTIL_ESLINT_PLUGIN = UTIL_ESLINT_PLUGIN;
10258
+ exports.UTIL_NO_ENUM_LITERAL_CAST_RULE = UTIL_NO_ENUM_LITERAL_CAST_RULE;
9932
10259
  exports.UTIL_NO_INLINE_TYPE_IMPORT_RULE = UTIL_NO_INLINE_TYPE_IMPORT_RULE;
9933
10260
  exports.UTIL_NO_SISTER_RE_EXPORT_RULE = UTIL_NO_SISTER_RE_EXPORT_RULE;
9934
10261
  exports.UTIL_PREFER_CANONICAL_JSDOC_RULE = UTIL_PREFER_CANONICAL_JSDOC_RULE;