@splunk/react-ui 5.3.0 → 5.5.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.
Files changed (114) hide show
  1. package/Accordion.js +31 -31
  2. package/Avatar.js +13 -13
  3. package/Badge.js +154 -0
  4. package/Breadcrumbs.js +66 -63
  5. package/ButtonSimple.js +52 -52
  6. package/CHANGELOG.md +43 -0
  7. package/CardLayout.js +39 -36
  8. package/Clickable.js +5 -6
  9. package/Code.js +917 -424
  10. package/CollapsiblePanel.js +1 -1
  11. package/Color.js +904 -1025
  12. package/ComboBox.js +6 -5
  13. package/DefinitionList.js +1 -1
  14. package/FormRows.js +13 -11
  15. package/JSONTree.js +682 -1408
  16. package/Link.js +74 -44
  17. package/MIGRATION.md +32 -1
  18. package/Markdown.js +9 -5
  19. package/Menu.js +100 -97
  20. package/Multiselect.js +1223 -2858
  21. package/Number.js +3 -3
  22. package/PhoneNumber.d.ts +2 -0
  23. package/PhoneNumber.js +769 -0
  24. package/Popover.js +235 -232
  25. package/RadioList.js +166 -151
  26. package/Resize.js +11 -8
  27. package/ResultsMenu.js +911 -1030
  28. package/ScreenReaderContent.js +86 -130
  29. package/Scroll.js +366 -425
  30. package/Select.js +267 -1947
  31. package/SelectBase.d.ts +2 -0
  32. package/SelectBase.js +1681 -0
  33. package/Slider.js +202 -199
  34. package/SlidingPanels.js +170 -175
  35. package/StepBar.js +123 -97
  36. package/Switch.js +137 -118
  37. package/TabBar.js +296 -295
  38. package/TabLayout.js +14 -14
  39. package/Table.js +1562 -1516
  40. package/TextArea.js +596 -684
  41. package/TransitionOpen.js +82 -74
  42. package/Tree.js +638 -682
  43. package/docker-compose.yml +99 -52
  44. package/package.json +16 -12
  45. package/stubs-splunkui.d.ts +0 -86
  46. package/test-runner-jest.config.js +1 -0
  47. package/types/src/Badge/Badge.d.ts +29 -0
  48. package/types/src/Badge/docs/examples/Basic.d.ts +5 -0
  49. package/types/src/Badge/docs/examples/Count.d.ts +6 -0
  50. package/types/src/Badge/docs/examples/CustomColors.d.ts +8 -0
  51. package/types/src/Badge/docs/examples/Icon.d.ts +6 -0
  52. package/types/src/Badge/index.d.ts +2 -0
  53. package/types/src/Breadcrumbs/Breadcrumbs.d.ts +1 -5
  54. package/types/src/Breadcrumbs/BreadcrumbsContext.d.ts +7 -0
  55. package/types/src/Breadcrumbs/Item.d.ts +1 -1
  56. package/types/src/ButtonSimple/mixin.d.ts +1 -1
  57. package/types/src/Code/Code.d.ts +4 -3
  58. package/types/src/Code/index.d.ts +1 -0
  59. package/types/src/JSONTree/JSONTreeItem.d.ts +1 -1
  60. package/types/src/JSONTree/renderTreeItems.d.ts +1 -1
  61. package/types/src/Link/Link.d.ts +4 -0
  62. package/types/src/Link/LinkContext.d.ts +14 -0
  63. package/types/src/Link/docs/examples/Visited.d.ts +7 -0
  64. package/types/src/Link/index.d.ts +1 -0
  65. package/types/src/Modal/ModalContext.d.ts +1 -1
  66. package/types/src/Multiselect/Compact.d.ts +3 -3
  67. package/types/src/Multiselect/Multiselect.d.ts +1 -1
  68. package/types/src/Multiselect/Normal.d.ts +2 -2
  69. package/types/src/Number/utils.d.ts +1 -1
  70. package/types/src/PhoneNumber/PhoneNumber.d.ts +139 -0
  71. package/types/src/PhoneNumber/docs/examples/Controlled.d.ts +7 -0
  72. package/types/src/PhoneNumber/docs/examples/DefaultCountry.d.ts +7 -0
  73. package/types/src/PhoneNumber/docs/examples/Disabled.d.ts +6 -0
  74. package/types/src/PhoneNumber/docs/examples/Error.d.ts +6 -0
  75. package/types/src/PhoneNumber/docs/examples/Inline.d.ts +7 -0
  76. package/types/src/PhoneNumber/docs/examples/Uncontrolled.d.ts +7 -0
  77. package/types/src/PhoneNumber/index.d.ts +2 -0
  78. package/types/src/PhoneNumber/utils.d.ts +47 -0
  79. package/types/src/Popover/getPlacement.d.ts +1 -1
  80. package/types/src/RadioList/Option.d.ts +7 -2
  81. package/types/src/RadioList/RadioListContext.d.ts +1 -1
  82. package/types/src/RadioList/docs/examples/Description.d.ts +6 -0
  83. package/types/src/Select/Option.d.ts +8 -3
  84. package/types/src/Select/Select.d.ts +1 -1
  85. package/types/src/{Select → SelectBase}/OptionBase.d.ts +8 -2
  86. package/types/src/{Select → SelectBase}/SelectBase.d.ts +3 -1
  87. package/types/src/SelectBase/index.d.ts +2 -0
  88. package/types/src/StepBar/StepBar.d.ts +4 -1
  89. package/types/src/StepBar/StepBarContext.d.ts +1 -0
  90. package/types/src/StepBar/docs/examples/Vertical.d.ts +6 -0
  91. package/types/src/Switch/Switch.d.ts +10 -1
  92. package/types/src/TabBar/Tab.d.ts +3 -1
  93. package/types/src/TabBar/docs/examples/Icons.d.ts +4 -0
  94. package/types/src/TabBar/docs/examples/Tooltips.d.ts +3 -0
  95. package/types/src/TabLayout/Panel.d.ts +2 -0
  96. package/types/src/Table/Body.d.ts +6 -1
  97. package/types/src/Table/Cell.d.ts +5 -1
  98. package/types/src/Table/Head.d.ts +6 -2
  99. package/types/src/Table/HeadCell.d.ts +5 -1
  100. package/types/src/Table/Row.d.ts +5 -1
  101. package/types/src/Table/Table.d.ts +21 -1
  102. package/types/src/Table/TableContext.d.ts +1 -0
  103. package/types/src/Table/docs/examples/HorizontalOverflowScroll.d.ts +8 -0
  104. package/types/src/Table/docs/examples/PinActionColumn.d.ts +7 -0
  105. package/types/src/TransitionOpen/TransitionOpen.d.ts +3 -1
  106. package/types/src/Tree/TreeContext.d.ts +1 -1
  107. package/types/src/useResizeObserver/useResizeObserver.d.ts +2 -0
  108. package/types/src/useRovingFocus/useRovingFocus.d.ts +8 -1
  109. package/useControlled.js +61 -97
  110. package/usePrevious.d.ts +2 -0
  111. package/usePrevious.js +30 -62
  112. package/useResizeObserver.js +71 -136
  113. package/useRovingFocus.js +96 -41
  114. /package/types/src/{Select → SelectBase}/SelectAllOption.d.ts +0 -0
package/Code.js CHANGED
@@ -1,106 +1,6 @@
1
1
  /******/ (() => {
2
2
  // webpackBootstrap
3
3
  /******/ var e = {
4
- /***/ 6283:
5
- /***/ (e, t, n) => {
6
- "use strict";
7
- // EXPORTS
8
- n.d(t, {
9
- default: () => /* reexport */ p
10
- });
11
- // EXTERNAL MODULE: external "react"
12
- var r = n(9497);
13
- // CONCATENATED MODULE: ./src/useResizeObserver/useResizeObserver.ts
14
- function a(e, t) {
15
- return u(e) || l(e, t) || s(e, t) || i();
16
- }
17
- function i() {
18
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
19
- }
20
- function s(e, t) {
21
- if (e) {
22
- if ("string" == typeof e) return o(e, t);
23
- var n = {}.toString.call(e).slice(8, -1);
24
- return "Object" === n && e.constructor && (n = e.constructor.name), "Map" === n || "Set" === n ? Array.from(e) : "Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? o(e, t) : void 0;
25
- }
26
- }
27
- function o(e, t) {
28
- (null == t || t > e.length) && (t = e.length);
29
- for (var n = 0, r = Array(t); n < t; n++) {
30
- r[n] = e[n];
31
- }
32
- return r;
33
- }
34
- function l(e, t) {
35
- var n = null == e ? null : "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
36
- if (null != n) {
37
- var r, a, i, s, o = [], l = !0, u = !1;
38
- try {
39
- if (i = (n = n.call(e)).next, 0 === t) {
40
- if (Object(n) !== n) return;
41
- l = !1;
42
- } else for (;!(l = (r = i.call(n)).done) && (o.push(r.value), o.length !== t); l = !0) {
43
- }
44
- } catch (e) {
45
- u = !0, a = e;
46
- } finally {
47
- try {
48
- if (!l && null != n["return"] && (s = n["return"](), Object(s) !== s)) return;
49
- } finally {
50
- if (u) throw a;
51
- }
52
- }
53
- return o;
54
- }
55
- }
56
- function u(e) {
57
- if (Array.isArray(e)) return e;
58
- }
59
- /**
60
- * Watches a React ref element for changes in size.
61
- *
62
- * @param ref - The React ref to observe size changes on
63
- */ var c = function e(t, n) {
64
- var i = (0, r.useState)({
65
- width: 0,
66
- height: 0
67
- }), s = a(i, 2), o = s[0], l = s[1];
68
- (0, r.useEffect)((function() {
69
- var e = t.current;
70
- if (typeof window !== "undefined" && window.ResizeObserver) {
71
- var r = new ResizeObserver((function(e) {
72
- if (e[0]) {
73
- var r, a;
74
- var i = {
75
- width: (t === null || t === void 0 ? void 0 : (r = t.current) === null || r === void 0 ? void 0 : r.getBoundingClientRect().width) || 0,
76
- height: (t === null || t === void 0 ? void 0 : (a = t.current) === null || a === void 0 ? void 0 : a.getBoundingClientRect().height) || 0
77
- };
78
- l((function(e) {
79
- if (e.height !== i.height || e.width !== i.width) {
80
- n === null || n === void 0 ? void 0 : n(i);
81
- return i;
82
- }
83
- return e;
84
- }));
85
- }
86
- }));
87
- if (e) {
88
- r.observe(e);
89
- }
90
- return function() {
91
- if (e) {
92
- r.unobserve(e);
93
- }
94
- };
95
- }
96
- // Return a no-op function to satisfy consistent-return rule
97
- return function() {};
98
- }), [ n, t ]);
99
- return o;
100
- };
101
- /* harmony default export */ const p = c;
102
- } // CONCATENATED MODULE: ./src/useResizeObserver/index.ts
103
- /***/ ,
104
4
  /***/ 74:
105
5
  /***/ e => {
106
6
  (function() {
@@ -121,7 +21,7 @@
121
21
  var r = 0;
122
22
  // The grammar object for plaintext
123
23
  var a = {};
124
- var i = {
24
+ var s = {
125
25
  /**
126
26
  * By default, Prism will attempt to highlight all code elements (by calling {@link Prism.highlightAll}) on the
127
27
  * current page after the page finished loading. This might be a problem if e.g. you wanted to asynchronously load
@@ -177,8 +77,8 @@
177
77
  */
178
78
  util: {
179
79
  encode: function e(t) {
180
- if (t instanceof s) {
181
- return new s(t.type, e(t.content), t.alias);
80
+ if (t instanceof i) {
81
+ return new i(t.type, e(t.content), t.alias);
182
82
  } else if (Array.isArray(t)) {
183
83
  return t.map(e);
184
84
  } else {
@@ -232,24 +132,24 @@
232
132
  n = n || {};
233
133
  var r;
234
134
  var a;
235
- switch (i.util.type(t)) {
135
+ switch (s.util.type(t)) {
236
136
  case "Object":
237
- a = i.util.objId(t);
137
+ a = s.util.objId(t);
238
138
  if (n[a]) {
239
139
  return n[a];
240
140
  }
241
141
  r = /** @type {Record<string, any>} */ {};
242
142
  n[a] = r;
243
- for (var s in t) {
244
- if (t.hasOwnProperty(s)) {
245
- r[s] = e(t[s], n);
143
+ for (var i in t) {
144
+ if (t.hasOwnProperty(i)) {
145
+ r[i] = e(t[i], n);
246
146
  }
247
147
  }
248
148
  /** @type {any} */
249
149
  return r;
250
150
 
251
151
  case "Array":
252
- a = i.util.objId(t);
152
+ a = s.util.objId(t);
253
153
  if (n[a]) {
254
154
  return n[a];
255
155
  }
@@ -414,7 +314,7 @@
414
314
  * });
415
315
  */
416
316
  extend: function(e, t) {
417
- var n = i.util.clone(i.languages[e]);
317
+ var n = s.util.clone(s.languages[e]);
418
318
  for (var r in t) {
419
319
  n[r] = t[r];
420
320
  }
@@ -496,48 +396,48 @@
496
396
  * @public
497
397
  */
498
398
  insertBefore: function(e, t, n, r) {
499
- r = r || /** @type {any} */ i.languages;
399
+ r = r || /** @type {any} */ s.languages;
500
400
  var a = r[e];
501
- /** @type {Grammar} */ var s = {};
401
+ /** @type {Grammar} */ var i = {};
502
402
  for (var o in a) {
503
403
  if (a.hasOwnProperty(o)) {
504
404
  if (o == t) {
505
405
  for (var l in n) {
506
406
  if (n.hasOwnProperty(l)) {
507
- s[l] = n[l];
407
+ i[l] = n[l];
508
408
  }
509
409
  }
510
410
  }
511
411
  // Do not insert token which also occur in insert. See #1525
512
412
  if (!n.hasOwnProperty(o)) {
513
- s[o] = a[o];
413
+ i[o] = a[o];
514
414
  }
515
415
  }
516
416
  }
517
417
  var u = r[e];
518
- r[e] = s;
418
+ r[e] = i;
519
419
  // Update references in other language definitions
520
- i.languages.DFS(i.languages, (function(t, n) {
420
+ s.languages.DFS(s.languages, (function(t, n) {
521
421
  if (n === u && t != e) {
522
- this[t] = s;
422
+ this[t] = i;
523
423
  }
524
424
  }));
525
- return s;
425
+ return i;
526
426
  },
527
427
  // Traverse a language definition with Depth First Search
528
428
  DFS: function e(t, n, r, a) {
529
429
  a = a || {};
530
- var s = i.util.objId;
430
+ var i = s.util.objId;
531
431
  for (var o in t) {
532
432
  if (t.hasOwnProperty(o)) {
533
433
  n.call(t, o, t[o], r || o);
534
434
  var l = t[o];
535
- var u = i.util.type(l);
536
- if (u === "Object" && !a[s(l)]) {
537
- a[s(l)] = true;
435
+ var u = s.util.type(l);
436
+ if (u === "Object" && !a[i(l)]) {
437
+ a[i(l)] = true;
538
438
  e(l, n, null, a);
539
- } else if (u === "Array" && !a[s(l)]) {
540
- a[s(l)] = true;
439
+ } else if (u === "Array" && !a[i(l)]) {
440
+ a[i(l)] = true;
541
441
  e(l, n, o, a);
542
442
  }
543
443
  }
@@ -558,7 +458,7 @@
558
458
  * @public
559
459
  */
560
460
  highlightAll: function(e, t) {
561
- i.highlightAllUnder(document, e, t);
461
+ s.highlightAllUnder(document, e, t);
562
462
  },
563
463
  /**
564
464
  * Fetches all the descendants of `container` that have a `.language-xxxx` class and then calls
@@ -581,11 +481,11 @@
581
481
  container: e,
582
482
  selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
583
483
  };
584
- i.hooks.run("before-highlightall", r);
484
+ s.hooks.run("before-highlightall", r);
585
485
  r.elements = Array.prototype.slice.apply(r.container.querySelectorAll(r.selector));
586
- i.hooks.run("before-all-elements-highlight", r);
587
- for (var a = 0, s; s = r.elements[a++]; ) {
588
- i.highlightElement(s, t === true, r.callback);
486
+ s.hooks.run("before-all-elements-highlight", r);
487
+ for (var a = 0, i; i = r.elements[a++]; ) {
488
+ s.highlightElement(i, t === true, r.callback);
589
489
  }
590
490
  },
591
491
  /**
@@ -618,48 +518,48 @@
618
518
  */
619
519
  highlightElement: function(t, n, r) {
620
520
  // Find language
621
- var a = i.util.getLanguage(t);
622
- var s = i.languages[a];
521
+ var a = s.util.getLanguage(t);
522
+ var i = s.languages[a];
623
523
  // Set language on the element, if not present
624
- i.util.setLanguage(t, a);
524
+ s.util.setLanguage(t, a);
625
525
  // Set language on the parent, for styling
626
526
  var o = t.parentElement;
627
527
  if (o && o.nodeName.toLowerCase() === "pre") {
628
- i.util.setLanguage(o, a);
528
+ s.util.setLanguage(o, a);
629
529
  }
630
530
  var l = t.textContent;
631
531
  var u = {
632
532
  element: t,
633
533
  language: a,
634
- grammar: s,
534
+ grammar: i,
635
535
  code: l
636
536
  };
637
537
  function c(e) {
638
538
  u.highlightedCode = e;
639
- i.hooks.run("before-insert", u);
539
+ s.hooks.run("before-insert", u);
640
540
  u.element.innerHTML = u.highlightedCode;
641
- i.hooks.run("after-highlight", u);
642
- i.hooks.run("complete", u);
541
+ s.hooks.run("after-highlight", u);
542
+ s.hooks.run("complete", u);
643
543
  r && r.call(u.element);
644
544
  }
645
- i.hooks.run("before-sanity-check", u);
545
+ s.hooks.run("before-sanity-check", u);
646
546
  // plugins may change/add the parent/element
647
547
  o = u.element.parentElement;
648
548
  if (o && o.nodeName.toLowerCase() === "pre" && !o.hasAttribute("tabindex")) {
649
549
  o.setAttribute("tabindex", "0");
650
550
  }
651
551
  if (!u.code) {
652
- i.hooks.run("complete", u);
552
+ s.hooks.run("complete", u);
653
553
  r && r.call(u.element);
654
554
  return;
655
555
  }
656
- i.hooks.run("before-highlight", u);
556
+ s.hooks.run("before-highlight", u);
657
557
  if (!u.grammar) {
658
- c(i.util.encode(u.code));
558
+ c(s.util.encode(u.code));
659
559
  return;
660
560
  }
661
561
  if (n && e.Worker) {
662
- var p = new Worker(i.filename);
562
+ var p = new Worker(s.filename);
663
563
  p.onmessage = function(e) {
664
564
  c(e.data);
665
565
  };
@@ -669,7 +569,7 @@
669
569
  immediateClose: true
670
570
  }));
671
571
  } else {
672
- c(i.highlight(u.code, u.grammar, u.language));
572
+ c(s.highlight(u.code, u.grammar, u.language));
673
573
  }
674
574
  },
675
575
  /**
@@ -698,13 +598,13 @@
698
598
  grammar: t,
699
599
  language: n
700
600
  };
701
- i.hooks.run("before-tokenize", r);
601
+ s.hooks.run("before-tokenize", r);
702
602
  if (!r.grammar) {
703
603
  throw new Error('The language "' + r.language + '" has no grammar.');
704
604
  }
705
- r.tokens = i.tokenize(r.code, r.grammar);
706
- i.hooks.run("after-tokenize", r);
707
- return s.stringify(i.util.encode(r.tokens), r.language);
605
+ r.tokens = s.tokenize(r.code, r.grammar);
606
+ s.hooks.run("after-tokenize", r);
607
+ return i.stringify(s.util.encode(r.tokens), r.language);
708
608
  },
709
609
  /**
710
610
  * This is the heart of Prism, and the most low-level function you can use. It accepts a string of text as input
@@ -763,7 +663,7 @@
763
663
  * @public
764
664
  */
765
665
  add: function(e, t) {
766
- var n = i.hooks.all;
666
+ var n = s.hooks.all;
767
667
  n[e] = n[e] || [];
768
668
  n[e].push(t);
769
669
  },
@@ -777,7 +677,7 @@
777
677
  * @public
778
678
  */
779
679
  run: function(e, t) {
780
- var n = i.hooks.all[e];
680
+ var n = s.hooks.all[e];
781
681
  if (!n || !n.length) {
782
682
  return;
783
683
  }
@@ -786,9 +686,9 @@
786
686
  }
787
687
  }
788
688
  },
789
- Token: s
689
+ Token: i
790
690
  };
791
- e.Prism = i;
691
+ e.Prism = s;
792
692
  // Typescript note:
793
693
  // The following can be used to import the Token type in JSDoc:
794
694
 
@@ -803,7 +703,7 @@
803
703
  * @class
804
704
  * @global
805
705
  * @public
806
- */ function s(e, t, n, r) {
706
+ */ function i(e, t, n, r) {
807
707
  /**
808
708
  * The type of the token.
809
709
  *
@@ -858,7 +758,7 @@
858
758
  * @returns {string} The HTML representation of the token or token stream.
859
759
  * @memberof Token
860
760
  * @static
861
- */ s.stringify = function e(t, n) {
761
+ */ i.stringify = function e(t, n) {
862
762
  if (typeof t == "string") {
863
763
  return t;
864
764
  }
@@ -877,15 +777,15 @@
877
777
  attributes: {},
878
778
  language: n
879
779
  };
880
- var s = t.alias;
881
- if (s) {
882
- if (Array.isArray(s)) {
883
- Array.prototype.push.apply(a.classes, s);
780
+ var i = t.alias;
781
+ if (i) {
782
+ if (Array.isArray(i)) {
783
+ Array.prototype.push.apply(a.classes, i);
884
784
  } else {
885
- a.classes.push(s);
785
+ a.classes.push(i);
886
786
  }
887
787
  }
888
- i.hooks.run("wrap", a);
788
+ s.hooks.run("wrap", a);
889
789
  var o = "";
890
790
  for (var l in a.attributes) {
891
791
  o += " " + l + '="' + (a.attributes[l] || "").replace(/"/g, "&quot;") + '"';
@@ -903,9 +803,9 @@
903
803
  var a = e.exec(n);
904
804
  if (a && r && a[1]) {
905
805
  // change the match to remove the text matched by the Prism lookbehind group
906
- var i = a[1].length;
907
- a.index += i;
908
- a[0] = a[0].slice(i);
806
+ var s = a[1].length;
807
+ a.index += s;
808
+ a[0] = a[0].slice(s);
909
809
  }
910
810
  return a;
911
811
  }
@@ -934,97 +834,97 @@
934
834
  return;
935
835
  }
936
836
  var m = g[f];
937
- var v = m.inside;
837
+ var b = m.inside;
938
838
  var h = !!m.lookbehind;
939
- var E = !!m.greedy;
940
- var b = m.alias;
941
- if (E && !m.pattern.global) {
839
+ var v = !!m.greedy;
840
+ var E = m.alias;
841
+ if (v && !m.pattern.global) {
942
842
  // Without the global flag, lastIndex won't work
943
843
  var y = m.pattern.toString().match(/[imsuy]*$/)[0];
944
844
  m.pattern = RegExp(m.pattern.source, y + "g");
945
845
  }
946
846
  /** @type {RegExp} */ var S = m.pattern || m;
947
847
  for (// iterate the token list and keep track of the current token/string position
948
- var A = r.next, T = a; A !== t.tail; T += A.value.length, A = A.next) {
949
- if (u && T >= u.reach) {
848
+ var A = r.next, k = a; A !== t.tail; k += A.value.length, A = A.next) {
849
+ if (u && k >= u.reach) {
950
850
  break;
951
851
  }
952
- var I = A.value;
852
+ var x = A.value;
953
853
  if (t.length > e.length) {
954
854
  // Something went terribly wrong, ABORT, ABORT!
955
855
  return;
956
856
  }
957
- if (I instanceof s) {
857
+ if (x instanceof i) {
958
858
  continue;
959
859
  }
960
- var O = 1;
860
+ var T = 1;
961
861
  // this is the to parameter of removeBetween
962
- var N;
963
- if (E) {
964
- N = o(S, T, e, h);
965
- if (!N || N.index >= e.length) {
862
+ var I;
863
+ if (v) {
864
+ I = o(S, k, e, h);
865
+ if (!I || I.index >= e.length) {
966
866
  break;
967
867
  }
968
- var x = N.index;
969
- var R = N.index + N[0].length;
970
- var k = T;
868
+ var R = I.index;
869
+ var w = I.index + I[0].length;
870
+ var N = k;
971
871
  // find the node that contains the match
972
- k += A.value.length;
973
- while (x >= k) {
872
+ N += A.value.length;
873
+ while (R >= N) {
974
874
  A = A.next;
975
- k += A.value.length;
875
+ N += A.value.length;
976
876
  }
977
877
  // adjust pos (and p)
978
- k -= A.value.length;
979
- T = k;
878
+ N -= A.value.length;
879
+ k = N;
980
880
  // the current node is a Token, then the match starts inside another Token, which is invalid
981
- if (A.value instanceof s) {
881
+ if (A.value instanceof i) {
982
882
  continue;
983
883
  }
984
884
  // find the last node which is affected by this match
985
- for (var L = A; L !== t.tail && (k < R || typeof L.value === "string"); L = L.next) {
986
- O++;
987
- k += L.value.length;
885
+ for (var O = A; O !== t.tail && (N < w || typeof O.value === "string"); O = O.next) {
886
+ T++;
887
+ N += O.value.length;
988
888
  }
989
- O--;
889
+ T--;
990
890
  // replace with the new match
991
- I = e.slice(T, k);
992
- N.index -= T;
891
+ x = e.slice(k, N);
892
+ I.index -= k;
993
893
  } else {
994
- N = o(S, 0, I, h);
995
- if (!N) {
894
+ I = o(S, 0, x, h);
895
+ if (!I) {
996
896
  continue;
997
897
  }
998
898
  }
999
899
  // eslint-disable-next-line no-redeclare
1000
- var x = N.index;
1001
- var F = N[0];
1002
- var w = I.slice(0, x);
1003
- var C = I.slice(x + F.length);
1004
- var D = T + I.length;
1005
- if (u && D > u.reach) {
1006
- u.reach = D;
900
+ var R = I.index;
901
+ var _ = I[0];
902
+ var L = x.slice(0, R);
903
+ var F = x.slice(R + _.length);
904
+ var C = k + x.length;
905
+ if (u && C > u.reach) {
906
+ u.reach = C;
1007
907
  }
1008
- var P = A.prev;
1009
- if (w) {
1010
- P = c(t, P, w);
1011
- T += w.length;
908
+ var D = A.prev;
909
+ if (L) {
910
+ D = c(t, D, L);
911
+ k += L.length;
1012
912
  }
1013
- p(t, P, O);
1014
- var _ = new s(d, v ? i.tokenize(F, v) : F, b, F);
1015
- A = c(t, P, _);
1016
- if (C) {
1017
- c(t, A, C);
913
+ p(t, D, T);
914
+ var P = new i(d, b ? s.tokenize(_, b) : _, E, _);
915
+ A = c(t, D, P);
916
+ if (F) {
917
+ c(t, A, F);
1018
918
  }
1019
- if (O > 1) {
919
+ if (T > 1) {
1020
920
  // at least one Token object was removed, so we have to do some rematching
1021
921
  // this can only happen if the current pattern is greedy
1022
922
  /** @type {RematchOptions} */
1023
923
  var $ = {
1024
924
  cause: d + "," + f,
1025
- reach: D
925
+ reach: C
1026
926
  };
1027
- l(e, t, n, A.prev, T, $);
927
+ l(e, t, n, A.prev, k, $);
1028
928
  // the reach might have been extended because of the rematching
1029
929
  if (u && $.reach > u.reach) {
1030
930
  u.reach = $.reach;
@@ -1115,37 +1015,37 @@
1115
1015
  if (!e.document) {
1116
1016
  if (!e.addEventListener) {
1117
1017
  // in Node.js
1118
- return i;
1018
+ return s;
1119
1019
  }
1120
- if (!i.disableWorkerMessageHandler) {
1020
+ if (!s.disableWorkerMessageHandler) {
1121
1021
  // In worker
1122
1022
  e.addEventListener("message", (function(t) {
1123
1023
  var n = JSON.parse(t.data);
1124
1024
  var r = n.language;
1125
1025
  var a = n.code;
1126
- var s = n.immediateClose;
1127
- e.postMessage(i.highlight(a, i.languages[r], r));
1128
- if (s) {
1026
+ var i = n.immediateClose;
1027
+ e.postMessage(s.highlight(a, s.languages[r], r));
1028
+ if (i) {
1129
1029
  e.close();
1130
1030
  }
1131
1031
  }), false);
1132
1032
  }
1133
- return i;
1033
+ return s;
1134
1034
  }
1135
1035
  // Get current script and highlight
1136
- var g = i.util.currentScript();
1036
+ var g = s.util.currentScript();
1137
1037
  if (g) {
1138
- i.filename = g.src;
1038
+ s.filename = g.src;
1139
1039
  if (g.hasAttribute("data-manual")) {
1140
- i.manual = true;
1040
+ s.manual = true;
1141
1041
  }
1142
1042
  }
1143
1043
  function f() {
1144
- if (!i.manual) {
1145
- i.highlightAll();
1044
+ if (!s.manual) {
1045
+ s.highlightAll();
1146
1046
  }
1147
1047
  }
1148
- if (!i.manual) {
1048
+ if (!s.manual) {
1149
1049
  // If the document state is "loading", then we'll use DOMContentLoaded.
1150
1050
  // If the document state is "interactive" and the prism.js script is deferred, then we'll also use the
1151
1051
  // DOMContentLoaded event because there might be some plugins or languages which have also been deferred and they
@@ -1163,7 +1063,7 @@
1163
1063
  }
1164
1064
  }
1165
1065
  }
1166
- return i;
1066
+ return s;
1167
1067
  }(r);
1168
1068
  if (true && e.exports) {
1169
1069
  e.exports = a;
@@ -1341,26 +1241,26 @@
1341
1241
  inside: a.languages[n]
1342
1242
  };
1343
1243
  r["cdata"] = /^<!\[CDATA\[|\]\]>$/i;
1344
- var i = {
1244
+ var s = {
1345
1245
  "included-cdata": {
1346
1246
  pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
1347
1247
  inside: r
1348
1248
  }
1349
1249
  };
1350
- i["language-" + n] = {
1250
+ s["language-" + n] = {
1351
1251
  pattern: /[\s\S]+/,
1352
1252
  inside: a.languages[n]
1353
1253
  };
1354
- var s = {};
1355
- s[t] = {
1254
+ var i = {};
1255
+ i[t] = {
1356
1256
  pattern: RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g, (function() {
1357
1257
  return t;
1358
1258
  })), "i"),
1359
1259
  lookbehind: true,
1360
1260
  greedy: true,
1361
- inside: i
1261
+ inside: s
1362
1262
  };
1363
- a.languages.insertBefore("markup", "cdata", s);
1263
+ a.languages.insertBefore("markup", "cdata", i);
1364
1264
  }
1365
1265
  });
1366
1266
  Object.defineProperty(a.languages.markup.tag, "addAttribute", {
@@ -1577,7 +1477,7 @@
1577
1477
  /**
1578
1478
  * @param {string} source
1579
1479
  * @param {string} [flags]
1580
- */ function i(e, t) {
1480
+ */ function s(e, t) {
1581
1481
  e = e.replace(/<S>/g, (function() {
1582
1482
  return n;
1583
1483
  })).replace(/<BRACES>/g, (function() {
@@ -1587,23 +1487,23 @@
1587
1487
  }));
1588
1488
  return RegExp(e, t);
1589
1489
  }
1590
- a = i(a).source;
1490
+ a = s(a).source;
1591
1491
  e.languages.jsx = e.languages.extend("markup", t);
1592
- e.languages.jsx.tag.pattern = i(/<\/?(?:[\w.:-]+(?:<S>+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\/?)?>/.source);
1492
+ e.languages.jsx.tag.pattern = s(/<\/?(?:[\w.:-]+(?:<S>+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\/?)?>/.source);
1593
1493
  e.languages.jsx.tag.inside["tag"].pattern = /^<\/?[^\s>\/]*/;
1594
1494
  e.languages.jsx.tag.inside["attr-value"].pattern = /=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/;
1595
1495
  e.languages.jsx.tag.inside["tag"].inside["class-name"] = /^[A-Z]\w*(?:\.[A-Z]\w*)*$/;
1596
1496
  e.languages.jsx.tag.inside["comment"] = t["comment"];
1597
1497
  e.languages.insertBefore("inside", "attr-name", {
1598
1498
  spread: {
1599
- pattern: i(/<SPREAD>/.source),
1499
+ pattern: s(/<SPREAD>/.source),
1600
1500
  inside: e.languages.jsx
1601
1501
  }
1602
1502
  }, e.languages.jsx.tag);
1603
1503
  e.languages.insertBefore("inside", "special-attr", {
1604
1504
  script: {
1605
1505
  // Allow for two levels of nesting
1606
- pattern: i(/=<BRACES>/.source),
1506
+ pattern: s(/=<BRACES>/.source),
1607
1507
  alias: "language-javascript",
1608
1508
  inside: {
1609
1509
  "script-punctuation": {
@@ -1615,7 +1515,7 @@
1615
1515
  }
1616
1516
  }, e.languages.jsx.tag);
1617
1517
  // The following will handle plain text inside tags
1618
- var s = function(e) {
1518
+ var i = function(e) {
1619
1519
  if (!e) {
1620
1520
  return "";
1621
1521
  }
@@ -1625,19 +1525,19 @@
1625
1525
  if (typeof e.content === "string") {
1626
1526
  return e.content;
1627
1527
  }
1628
- return e.content.map(s).join("");
1528
+ return e.content.map(i).join("");
1629
1529
  };
1630
1530
  var o = function(t) {
1631
1531
  var n = [];
1632
1532
  for (var r = 0; r < t.length; r++) {
1633
1533
  var a = t[r];
1634
- var i = false;
1534
+ var s = false;
1635
1535
  if (typeof a !== "string") {
1636
1536
  if (a.type === "tag" && a.content[0] && a.content[0].type === "tag") {
1637
1537
  // We found a tag, now find its kind
1638
1538
  if (a.content[0].content[0].content === "</") {
1639
1539
  // Closing tag
1640
- if (n.length > 0 && n[n.length - 1].tagName === s(a.content[0].content[1])) {
1540
+ if (n.length > 0 && n[n.length - 1].tagName === i(a.content[0].content[1])) {
1641
1541
  // Pop matching opening tag
1642
1542
  n.pop();
1643
1543
  }
@@ -1647,7 +1547,7 @@
1647
1547
  } else {
1648
1548
  // Opening tag
1649
1549
  n.push({
1650
- tagName: s(a.content[0].content[1]),
1550
+ tagName: i(a.content[0].content[1]),
1651
1551
  openedBraces: 0
1652
1552
  });
1653
1553
  }
@@ -1659,21 +1559,21 @@
1659
1559
  // Here we might have left a JSX context inside a tag
1660
1560
  n[n.length - 1].openedBraces--;
1661
1561
  } else {
1662
- i = true;
1562
+ s = true;
1663
1563
  }
1664
1564
  }
1665
- if (i || typeof a === "string") {
1565
+ if (s || typeof a === "string") {
1666
1566
  if (n.length > 0 && n[n.length - 1].openedBraces === 0) {
1667
1567
  // Here we are inside a tag, and not inside a JSX context.
1668
1568
  // That's plain text: drop any tokens matched.
1669
- var l = s(a);
1569
+ var l = i(a);
1670
1570
  // And merge text with adjacent text
1671
1571
  if (r < t.length - 1 && (typeof t[r + 1] === "string" || t[r + 1].type === "plain-text")) {
1672
- l += s(t[r + 1]);
1572
+ l += i(t[r + 1]);
1673
1573
  t.splice(r + 1, 1);
1674
1574
  }
1675
1575
  if (r > 0 && (typeof t[r - 1] === "string" || t[r - 1].type === "plain-text")) {
1676
- l = s(t[r - 1]) + l;
1576
+ l = i(t[r - 1]) + l;
1677
1577
  t.splice(r - 1, 1);
1678
1578
  r--;
1679
1579
  }
@@ -2010,9 +1910,9 @@
2010
1910
  };
2011
1911
  n.inside = e.languages.bash;
2012
1912
  /* Patterns in command substitution. */ var a = [ "comment", "function-name", "for-or-select", "assign-left", "parameter", "string", "environment", "function", "keyword", "builtin", "boolean", "file-descriptor", "operator", "punctuation", "number" ];
2013
- var i = r.variable[1].inside;
2014
- for (var s = 0; s < a.length; s++) {
2015
- i[a[s]] = e.languages.bash[a[s]];
1913
+ var s = r.variable[1].inside;
1914
+ for (var i = 0; i < a.length; i++) {
1915
+ s[a[i]] = e.languages.bash[a[i]];
2016
1916
  }
2017
1917
  e.languages.sh = e.languages.bash;
2018
1918
  e.languages.shell = e.languages.bash;
@@ -2031,13 +1931,13 @@
2031
1931
  var a = /(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*/.source.replace(/<PLAIN>/g, (function() {
2032
1932
  return /[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source;
2033
1933
  }));
2034
- var i = /"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;
1934
+ var s = /"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;
2035
1935
  /**
2036
1936
  *
2037
1937
  * @param {string} value
2038
1938
  * @param {string} [flags]
2039
1939
  * @returns {RegExp}
2040
- */ function s(e, t) {
1940
+ */ function i(e, t) {
2041
1941
  t = (t || "").replace(/m/g, "") + "m";
2042
1942
  // add m flag
2043
1943
  var n = /([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<<prop>>/g, (function() {
@@ -2060,7 +1960,7 @@
2060
1960
  pattern: RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source.replace(/<<prop>>/g, (function() {
2061
1961
  return r;
2062
1962
  })).replace(/<<key>>/g, (function() {
2063
- return "(?:" + a + "|" + i + ")";
1963
+ return "(?:" + a + "|" + s + ")";
2064
1964
  }))),
2065
1965
  lookbehind: true,
2066
1966
  greedy: true,
@@ -2072,27 +1972,27 @@
2072
1972
  alias: "important"
2073
1973
  },
2074
1974
  datetime: {
2075
- pattern: s(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),
1975
+ pattern: i(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),
2076
1976
  lookbehind: true,
2077
1977
  alias: "number"
2078
1978
  },
2079
1979
  boolean: {
2080
- pattern: s(/false|true/.source, "i"),
1980
+ pattern: i(/false|true/.source, "i"),
2081
1981
  lookbehind: true,
2082
1982
  alias: "important"
2083
1983
  },
2084
1984
  null: {
2085
- pattern: s(/null|~/.source, "i"),
1985
+ pattern: i(/null|~/.source, "i"),
2086
1986
  lookbehind: true,
2087
1987
  alias: "important"
2088
1988
  },
2089
1989
  string: {
2090
- pattern: s(i),
1990
+ pattern: i(s),
2091
1991
  lookbehind: true,
2092
1992
  greedy: true
2093
1993
  },
2094
1994
  number: {
2095
- pattern: s(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source, "i"),
1995
+ pattern: i(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source, "i"),
2096
1996
  lookbehind: true
2097
1997
  },
2098
1998
  tag: n,
@@ -2155,12 +2055,604 @@
2155
2055
  operator: /[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,
2156
2056
  punctuation: /[;[\]()`,.]/
2157
2057
  };
2058
+ a.languages.c = a.languages.extend("clike", {
2059
+ comment: {
2060
+ pattern: /\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,
2061
+ greedy: true
2062
+ },
2063
+ string: {
2064
+ // https://en.cppreference.com/w/c/language/string_literal
2065
+ pattern: /"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,
2066
+ greedy: true
2067
+ },
2068
+ "class-name": {
2069
+ pattern: /(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,
2070
+ lookbehind: true
2071
+ },
2072
+ keyword: /\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,
2073
+ function: /\b[a-z_]\w*(?=\s*\()/i,
2074
+ number: /(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,
2075
+ operator: />>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/
2076
+ });
2077
+ a.languages.insertBefore("c", "string", {
2078
+ char: {
2079
+ // https://en.cppreference.com/w/c/language/character_constant
2080
+ pattern: /'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,
2081
+ greedy: true
2082
+ }
2083
+ });
2084
+ a.languages.insertBefore("c", "string", {
2085
+ macro: {
2086
+ // allow for multiline macro definitions
2087
+ // spaces after the # character compile fine with gcc
2088
+ pattern: /(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,
2089
+ lookbehind: true,
2090
+ greedy: true,
2091
+ alias: "property",
2092
+ inside: {
2093
+ string: [ {
2094
+ // highlight the path of the include statement as a string
2095
+ pattern: /^(#\s*include\s*)<[^>]+>/,
2096
+ lookbehind: true
2097
+ }, a.languages.c["string"] ],
2098
+ char: a.languages.c["char"],
2099
+ comment: a.languages.c["comment"],
2100
+ "macro-name": [ {
2101
+ pattern: /(^#\s*define\s+)\w+\b(?!\()/i,
2102
+ lookbehind: true
2103
+ }, {
2104
+ pattern: /(^#\s*define\s+)\w+\b(?=\()/i,
2105
+ lookbehind: true,
2106
+ alias: "function"
2107
+ } ],
2108
+ // highlight macro directives as keywords
2109
+ directive: {
2110
+ pattern: /^(#\s*)[a-z]+/,
2111
+ lookbehind: true,
2112
+ alias: "keyword"
2113
+ },
2114
+ "directive-hash": /^#/,
2115
+ punctuation: /##|\\(?=[\r\n])/,
2116
+ expression: {
2117
+ pattern: /\S[\s\S]*/,
2118
+ inside: a.languages.c
2119
+ }
2120
+ }
2121
+ }
2122
+ });
2123
+ a.languages.insertBefore("c", "function", {
2124
+ // highlight predefined macros as constants
2125
+ constant: /\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/
2126
+ });
2127
+ delete a.languages.c["boolean"];
2128
+ (function(e) {
2129
+ var t = /\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/;
2130
+ var n = /\b(?!<keyword>)\w+(?:\s*\.\s*\w+)*\b/.source.replace(/<keyword>/g, (function() {
2131
+ return t.source;
2132
+ }));
2133
+ e.languages.cpp = e.languages.extend("c", {
2134
+ "class-name": [ {
2135
+ pattern: RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!<keyword>)\w+/.source.replace(/<keyword>/g, (function() {
2136
+ return t.source;
2137
+ }))),
2138
+ lookbehind: true
2139
+ },
2140
+ // This is intended to capture the class name of method implementations like:
2141
+ // void foo::bar() const {}
2142
+ // However! The `foo` in the above example could also be a namespace, so we only capture the class name if
2143
+ // it starts with an uppercase letter. This approximation should give decent results.
2144
+ /\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,
2145
+ // This will capture the class name before destructors like:
2146
+ // Foo::~Foo() {}
2147
+ /\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,
2148
+ // This also intends to capture the class name of method implementations but here the class has template
2149
+ // parameters, so it can't be a namespace (until C++ adds generic namespaces).
2150
+ /\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/ ],
2151
+ keyword: t,
2152
+ number: {
2153
+ pattern: /(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,
2154
+ greedy: true
2155
+ },
2156
+ operator: />>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,
2157
+ boolean: /\b(?:false|true)\b/
2158
+ });
2159
+ e.languages.insertBefore("cpp", "string", {
2160
+ module: {
2161
+ // https://en.cppreference.com/w/cpp/language/modules
2162
+ pattern: RegExp(/(\b(?:import|module)\s+)/.source + "(?:" +
2163
+ // header-name
2164
+ /"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source + "|" +
2165
+ // module name or partition or both
2166
+ /<mod-name>(?:\s*:\s*<mod-name>)?|:\s*<mod-name>/.source.replace(/<mod-name>/g, (function() {
2167
+ return n;
2168
+ })) + ")"),
2169
+ lookbehind: true,
2170
+ greedy: true,
2171
+ inside: {
2172
+ string: /^[<"][\s\S]+/,
2173
+ operator: /:/,
2174
+ punctuation: /\./
2175
+ }
2176
+ },
2177
+ "raw-string": {
2178
+ pattern: /R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,
2179
+ alias: "string",
2180
+ greedy: true
2181
+ }
2182
+ });
2183
+ e.languages.insertBefore("cpp", "keyword", {
2184
+ "generic-function": {
2185
+ pattern: /\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,
2186
+ inside: {
2187
+ function: /^\w+/,
2188
+ generic: {
2189
+ pattern: /<[\s\S]+/,
2190
+ alias: "class-name",
2191
+ inside: e.languages.cpp
2192
+ }
2193
+ }
2194
+ }
2195
+ });
2196
+ e.languages.insertBefore("cpp", "operator", {
2197
+ "double-colon": {
2198
+ pattern: /::/,
2199
+ alias: "punctuation"
2200
+ }
2201
+ });
2202
+ e.languages.insertBefore("cpp", "class-name", {
2203
+ // the base clause is an optional list of parent classes
2204
+ // https://en.cppreference.com/w/cpp/language/class
2205
+ "base-clause": {
2206
+ pattern: /(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,
2207
+ lookbehind: true,
2208
+ greedy: true,
2209
+ inside: e.languages.extend("cpp", {})
2210
+ }
2211
+ });
2212
+ e.languages.insertBefore("inside", "double-colon", {
2213
+ // All untokenized words that are not namespaces should be class names
2214
+ "class-name": /\b[a-z_]\w*\b(?!\s*::)/i
2215
+ }, e.languages.cpp["base-clause"]);
2216
+ })(a);
2217
+ (function(e) {
2218
+ /**
2219
+ * Replaces all placeholders "<<n>>" of given pattern with the n-th replacement (zero based).
2220
+ *
2221
+ * Note: This is a simple text based replacement. Be careful when using backreferences!
2222
+ *
2223
+ * @param {string} pattern the given pattern.
2224
+ * @param {string[]} replacements a list of replacement which can be inserted into the given pattern.
2225
+ * @returns {string} the pattern with all placeholders replaced with their corresponding replacements.
2226
+ * @example replace(/a<<0>>a/.source, [/b+/.source]) === /a(?:b+)a/.source
2227
+ */
2228
+ function t(e, t) {
2229
+ return e.replace(/<<(\d+)>>/g, (function(e, n) {
2230
+ return "(?:" + t[+n] + ")";
2231
+ }));
2232
+ }
2233
+ /**
2234
+ * @param {string} pattern
2235
+ * @param {string[]} replacements
2236
+ * @param {string} [flags]
2237
+ * @returns {RegExp}
2238
+ */ function n(e, n, r) {
2239
+ return RegExp(t(e, n), r || "");
2240
+ }
2241
+ /**
2242
+ * Creates a nested pattern where all occurrences of the string `<<self>>` are replaced with the pattern itself.
2243
+ *
2244
+ * @param {string} pattern
2245
+ * @param {number} depthLog2
2246
+ * @returns {string}
2247
+ */ function r(e, t) {
2248
+ for (var n = 0; n < t; n++) {
2249
+ e = e.replace(/<<self>>/g, (function() {
2250
+ return "(?:" + e + ")";
2251
+ }));
2252
+ }
2253
+ return e.replace(/<<self>>/g, "[^\\s\\S]");
2254
+ }
2255
+ // https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/
2256
+ var a = {
2257
+ // keywords which represent a return or variable type
2258
+ type: "bool byte char decimal double dynamic float int long object sbyte short string uint ulong ushort var void",
2259
+ // keywords which are used to declare a type
2260
+ typeDeclaration: "class enum interface record struct",
2261
+ // contextual keywords
2262
+ // ("var" and "dynamic" are missing because they are used like types)
2263
+ contextual: "add alias and ascending async await by descending from(?=\\s*(?:\\w|$)) get global group into init(?=\\s*;) join let nameof not notnull on or orderby partial remove select set unmanaged value when where with(?=\\s*{)",
2264
+ // all other keywords
2265
+ other: "abstract as base break case catch checked const continue default delegate do else event explicit extern finally fixed for foreach goto if implicit in internal is lock namespace new null operator out override params private protected public readonly ref return sealed sizeof stackalloc static switch this throw try typeof unchecked unsafe using virtual volatile while yield"
2266
+ };
2267
+ // keywords
2268
+ function s(e) {
2269
+ return "\\b(?:" + e.trim().replace(/ /g, "|") + ")\\b";
2270
+ }
2271
+ var i = s(a.typeDeclaration);
2272
+ var o = RegExp(s(a.type + " " + a.typeDeclaration + " " + a.contextual + " " + a.other));
2273
+ var l = s(a.typeDeclaration + " " + a.contextual + " " + a.other);
2274
+ var u = s(a.type + " " + a.typeDeclaration + " " + a.other);
2275
+ // types
2276
+ var c = r(/<(?:[^<>;=+\-*/%&|^]|<<self>>)*>/.source, 2);
2277
+ // the idea behind the other forbidden characters is to prevent false positives. Same for tupleElement.
2278
+ var p = r(/\((?:[^()]|<<self>>)*\)/.source, 2);
2279
+ var d = /@?\b[A-Za-z_]\w*\b/.source;
2280
+ var g = t(/<<0>>(?:\s*<<1>>)?/.source, [ d, c ]);
2281
+ var f = t(/(?!<<0>>)<<1>>(?:\s*\.\s*<<1>>)*/.source, [ l, g ]);
2282
+ var m = /\[\s*(?:,\s*)*\]/.source;
2283
+ var b = t(/<<0>>(?:\s*(?:\?\s*)?<<1>>)*(?:\s*\?)?/.source, [ f, m ]);
2284
+ var h = t(/[^,()<>[\];=+\-*/%&|^]|<<0>>|<<1>>|<<2>>/.source, [ c, p, m ]);
2285
+ var v = t(/\(<<0>>+(?:,<<0>>+)+\)/.source, [ h ]);
2286
+ var E = t(/(?:<<0>>|<<1>>)(?:\s*(?:\?\s*)?<<2>>)*(?:\s*\?)?/.source, [ v, f, m ]);
2287
+ var y = {
2288
+ keyword: o,
2289
+ punctuation: /[<>()?,.:[\]]/
2290
+ };
2291
+ // strings & characters
2292
+ // https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/lexical-structure#character-literals
2293
+ // https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/lexical-structure#string-literals
2294
+ var S = /'(?:[^\r\n'\\]|\\.|\\[Uux][\da-fA-F]{1,8})'/.source;
2295
+ // simplified pattern
2296
+ var A = /"(?:\\.|[^\\"\r\n])*"/.source;
2297
+ var k = /@"(?:""|\\[\s\S]|[^\\"])*"(?!")/.source;
2298
+ e.languages.csharp = e.languages.extend("clike", {
2299
+ string: [ {
2300
+ pattern: n(/(^|[^$\\])<<0>>/.source, [ k ]),
2301
+ lookbehind: true,
2302
+ greedy: true
2303
+ }, {
2304
+ pattern: n(/(^|[^@$\\])<<0>>/.source, [ A ]),
2305
+ lookbehind: true,
2306
+ greedy: true
2307
+ } ],
2308
+ "class-name": [ {
2309
+ // Using static
2310
+ // using static System.Math;
2311
+ pattern: n(/(\busing\s+static\s+)<<0>>(?=\s*;)/.source, [ f ]),
2312
+ lookbehind: true,
2313
+ inside: y
2314
+ }, {
2315
+ // Using alias (type)
2316
+ // using Project = PC.MyCompany.Project;
2317
+ pattern: n(/(\busing\s+<<0>>\s*=\s*)<<1>>(?=\s*;)/.source, [ d, E ]),
2318
+ lookbehind: true,
2319
+ inside: y
2320
+ }, {
2321
+ // Using alias (alias)
2322
+ // using Project = PC.MyCompany.Project;
2323
+ pattern: n(/(\busing\s+)<<0>>(?=\s*=)/.source, [ d ]),
2324
+ lookbehind: true
2325
+ }, {
2326
+ // Type declarations
2327
+ // class Foo<A, B>
2328
+ // interface Foo<out A, B>
2329
+ pattern: n(/(\b<<0>>\s+)<<1>>/.source, [ i, g ]),
2330
+ lookbehind: true,
2331
+ inside: y
2332
+ }, {
2333
+ // Single catch exception declaration
2334
+ // catch(Foo)
2335
+ // (things like catch(Foo e) is covered by variable declaration)
2336
+ pattern: n(/(\bcatch\s*\(\s*)<<0>>/.source, [ f ]),
2337
+ lookbehind: true,
2338
+ inside: y
2339
+ }, {
2340
+ // Name of the type parameter of generic constraints
2341
+ // where Foo : class
2342
+ pattern: n(/(\bwhere\s+)<<0>>/.source, [ d ]),
2343
+ lookbehind: true
2344
+ }, {
2345
+ // Casts and checks via as and is.
2346
+ // as Foo<A>, is Bar<B>
2347
+ // (things like if(a is Foo b) is covered by variable declaration)
2348
+ pattern: n(/(\b(?:is(?:\s+not)?|as)\s+)<<0>>/.source, [ b ]),
2349
+ lookbehind: true,
2350
+ inside: y
2351
+ }, {
2352
+ // Variable, field and parameter declaration
2353
+ // (Foo bar, Bar baz, Foo[,,] bay, Foo<Bar, FooBar<Bar>> bax)
2354
+ pattern: n(/\b<<0>>(?=\s+(?!<<1>>|with\s*\{)<<2>>(?:\s*[=,;:{)\]]|\s+(?:in|when)\b))/.source, [ E, u, d ]),
2355
+ inside: y
2356
+ } ],
2357
+ keyword: o,
2358
+ // https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/lexical-structure#literals
2359
+ number: /(?:\b0(?:x[\da-f_]*[\da-f]|b[01_]*[01])|(?:\B\.\d+(?:_+\d+)*|\b\d+(?:_+\d+)*(?:\.\d+(?:_+\d+)*)?)(?:e[-+]?\d+(?:_+\d+)*)?)(?:[dflmu]|lu|ul)?\b/i,
2360
+ operator: />>=?|<<=?|[-=]>|([-+&|])\1|~|\?\?=?|[-+*/%&|^!=<>]=?/,
2361
+ punctuation: /\?\.?|::|[{}[\];(),.:]/
2362
+ });
2363
+ e.languages.insertBefore("csharp", "number", {
2364
+ range: {
2365
+ pattern: /\.\./,
2366
+ alias: "operator"
2367
+ }
2368
+ });
2369
+ e.languages.insertBefore("csharp", "punctuation", {
2370
+ "named-parameter": {
2371
+ pattern: n(/([(,]\s*)<<0>>(?=\s*:)/.source, [ d ]),
2372
+ lookbehind: true,
2373
+ alias: "punctuation"
2374
+ }
2375
+ });
2376
+ e.languages.insertBefore("csharp", "class-name", {
2377
+ namespace: {
2378
+ // namespace Foo.Bar {}
2379
+ // using Foo.Bar;
2380
+ pattern: n(/(\b(?:namespace|using)\s+)<<0>>(?:\s*\.\s*<<0>>)*(?=\s*[;{])/.source, [ d ]),
2381
+ lookbehind: true,
2382
+ inside: {
2383
+ punctuation: /\./
2384
+ }
2385
+ },
2386
+ "type-expression": {
2387
+ // default(Foo), typeof(Foo<Bar>), sizeof(int)
2388
+ pattern: n(/(\b(?:default|sizeof|typeof)\s*\(\s*(?!\s))(?:[^()\s]|\s(?!\s)|<<0>>)*(?=\s*\))/.source, [ p ]),
2389
+ lookbehind: true,
2390
+ alias: "class-name",
2391
+ inside: y
2392
+ },
2393
+ "return-type": {
2394
+ // Foo<Bar> ForBar(); Foo IFoo.Bar() => 0
2395
+ // int this[int index] => 0; T IReadOnlyList<T>.this[int index] => this[index];
2396
+ // int Foo => 0; int Foo { get; set } = 0;
2397
+ pattern: n(/<<0>>(?=\s+(?:<<1>>\s*(?:=>|[({]|\.\s*this\s*\[)|this\s*\[))/.source, [ E, f ]),
2398
+ inside: y,
2399
+ alias: "class-name"
2400
+ },
2401
+ "constructor-invocation": {
2402
+ // new List<Foo<Bar[]>> { }
2403
+ pattern: n(/(\bnew\s+)<<0>>(?=\s*[[({])/.source, [ E ]),
2404
+ lookbehind: true,
2405
+ inside: y,
2406
+ alias: "class-name"
2407
+ },
2408
+ /*'explicit-implementation': {
2409
+ // int IFoo<Foo>.Bar => 0; void IFoo<Foo<Foo>>.Foo<T>();
2410
+ pattern: replace(/\b<<0>>(?=\.<<1>>)/, className, methodOrPropertyDeclaration),
2411
+ inside: classNameInside,
2412
+ alias: 'class-name'
2413
+ },*/
2414
+ "generic-method": {
2415
+ // foo<Bar>()
2416
+ pattern: n(/<<0>>\s*<<1>>(?=\s*\()/.source, [ d, c ]),
2417
+ inside: {
2418
+ function: n(/^<<0>>/.source, [ d ]),
2419
+ generic: {
2420
+ pattern: RegExp(c),
2421
+ alias: "class-name",
2422
+ inside: y
2423
+ }
2424
+ }
2425
+ },
2426
+ "type-list": {
2427
+ // The list of types inherited or of generic constraints
2428
+ // class Foo<F> : Bar, IList<FooBar>
2429
+ // where F : Bar, IList<int>
2430
+ pattern: n(/\b((?:<<0>>\s+<<1>>|record\s+<<1>>\s*<<5>>|where\s+<<2>>)\s*:\s*)(?:<<3>>|<<4>>|<<1>>\s*<<5>>|<<6>>)(?:\s*,\s*(?:<<3>>|<<4>>|<<6>>))*(?=\s*(?:where|[{;]|=>|$))/.source, [ i, g, d, E, o.source, p, /\bnew\s*\(\s*\)/.source ]),
2431
+ lookbehind: true,
2432
+ inside: {
2433
+ "record-arguments": {
2434
+ pattern: n(/(^(?!new\s*\()<<0>>\s*)<<1>>/.source, [ g, p ]),
2435
+ lookbehind: true,
2436
+ greedy: true,
2437
+ inside: e.languages.csharp
2438
+ },
2439
+ keyword: o,
2440
+ "class-name": {
2441
+ pattern: RegExp(E),
2442
+ greedy: true,
2443
+ inside: y
2444
+ },
2445
+ punctuation: /[,()]/
2446
+ }
2447
+ },
2448
+ preprocessor: {
2449
+ pattern: /(^[\t ]*)#.*/m,
2450
+ lookbehind: true,
2451
+ alias: "property",
2452
+ inside: {
2453
+ // highlight preprocessor directives as keywords
2454
+ directive: {
2455
+ pattern: /(#)\b(?:define|elif|else|endif|endregion|error|if|line|nullable|pragma|region|undef|warning)\b/,
2456
+ lookbehind: true,
2457
+ alias: "keyword"
2458
+ }
2459
+ }
2460
+ }
2461
+ });
2462
+ // attributes
2463
+ var x = A + "|" + S;
2464
+ var T = t(/\/(?![*/])|\/\/[^\r\n]*[\r\n]|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>/.source, [ x ]);
2465
+ var I = r(t(/[^"'/()]|<<0>>|\(<<self>>*\)/.source, [ T ]), 2);
2466
+ // https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/attributes/#attribute-targets
2467
+ var R = /\b(?:assembly|event|field|method|module|param|property|return|type)\b/.source;
2468
+ var w = t(/<<0>>(?:\s*\(<<1>>*\))?/.source, [ f, I ]);
2469
+ e.languages.insertBefore("csharp", "class-name", {
2470
+ attribute: {
2471
+ // Attributes
2472
+ // [Foo], [Foo(1), Bar(2, Prop = "foo")], [return: Foo(1), Bar(2)], [assembly: Foo(Bar)]
2473
+ pattern: n(/((?:^|[^\s\w>)?])\s*\[\s*)(?:<<0>>\s*:\s*)?<<1>>(?:\s*,\s*<<1>>)*(?=\s*\])/.source, [ R, w ]),
2474
+ lookbehind: true,
2475
+ greedy: true,
2476
+ inside: {
2477
+ target: {
2478
+ pattern: n(/^<<0>>(?=\s*:)/.source, [ R ]),
2479
+ alias: "keyword"
2480
+ },
2481
+ "attribute-arguments": {
2482
+ pattern: n(/\(<<0>>*\)/.source, [ I ]),
2483
+ inside: e.languages.csharp
2484
+ },
2485
+ "class-name": {
2486
+ pattern: RegExp(f),
2487
+ inside: {
2488
+ punctuation: /\./
2489
+ }
2490
+ },
2491
+ punctuation: /[:,]/
2492
+ }
2493
+ }
2494
+ });
2495
+ // string interpolation
2496
+ var N = /:[^}\r\n]+/.source;
2497
+ // multi line
2498
+ var O = r(t(/[^"'/()]|<<0>>|\(<<self>>*\)/.source, [ T ]), 2);
2499
+ var _ = t(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source, [ O, N ]);
2500
+ // single line
2501
+ var L = r(t(/[^"'/()]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>|\(<<self>>*\)/.source, [ x ]), 2);
2502
+ var F = t(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source, [ L, N ]);
2503
+ function C(t, r) {
2504
+ return {
2505
+ interpolation: {
2506
+ pattern: n(/((?:^|[^{])(?:\{\{)*)<<0>>/.source, [ t ]),
2507
+ lookbehind: true,
2508
+ inside: {
2509
+ "format-string": {
2510
+ pattern: n(/(^\{(?:(?![}:])<<0>>)*)<<1>>(?=\}$)/.source, [ r, N ]),
2511
+ lookbehind: true,
2512
+ inside: {
2513
+ punctuation: /^:/
2514
+ }
2515
+ },
2516
+ punctuation: /^\{|\}$/,
2517
+ expression: {
2518
+ pattern: /[\s\S]+/,
2519
+ alias: "language-csharp",
2520
+ inside: e.languages.csharp
2521
+ }
2522
+ }
2523
+ },
2524
+ string: /[\s\S]+/
2525
+ };
2526
+ }
2527
+ e.languages.insertBefore("csharp", "string", {
2528
+ "interpolation-string": [ {
2529
+ pattern: n(/(^|[^\\])(?:\$@|@\$)"(?:""|\\[\s\S]|\{\{|<<0>>|[^\\{"])*"/.source, [ _ ]),
2530
+ lookbehind: true,
2531
+ greedy: true,
2532
+ inside: C(_, O)
2533
+ }, {
2534
+ pattern: n(/(^|[^@\\])\$"(?:\\.|\{\{|<<0>>|[^\\"{])*"/.source, [ F ]),
2535
+ lookbehind: true,
2536
+ greedy: true,
2537
+ inside: C(F, L)
2538
+ } ],
2539
+ char: {
2540
+ pattern: RegExp(S),
2541
+ greedy: true
2542
+ }
2543
+ });
2544
+ e.languages.dotnet = e.languages.cs = e.languages.csharp;
2545
+ })(a);
2546
+ (function(e) {
2547
+ var t = e.languages.powershell = {
2548
+ comment: [ {
2549
+ pattern: /(^|[^`])<#[\s\S]*?#>/,
2550
+ lookbehind: true
2551
+ }, {
2552
+ pattern: /(^|[^`])#.*/,
2553
+ lookbehind: true
2554
+ } ],
2555
+ string: [ {
2556
+ pattern: /"(?:`[\s\S]|[^`"])*"/,
2557
+ greedy: true,
2558
+ inside: null
2559
+ }, {
2560
+ pattern: /'(?:[^']|'')*'/,
2561
+ greedy: true
2562
+ } ],
2563
+ // Matches name spaces as well as casts, attribute decorators. Force starting with letter to avoid matching array indices
2564
+ // Supports two levels of nested brackets (e.g. `[OutputType([System.Collections.Generic.List[int]])]`)
2565
+ namespace: /\[[a-z](?:\[(?:\[[^\]]*\]|[^\[\]])*\]|[^\[\]])*\]/i,
2566
+ boolean: /\$(?:false|true)\b/i,
2567
+ variable: /\$\w+\b/,
2568
+ // Cmdlets and aliases. Aliases should come last, otherwise "write" gets preferred over "write-host" for example
2569
+ // Get-Command | ?{ $_.ModuleName -match "Microsoft.PowerShell.(Util|Core|Management)" }
2570
+ // Get-Alias | ?{ $_.ReferencedCommand.Module.Name -match "Microsoft.PowerShell.(Util|Core|Management)" }
2571
+ function: [ /\b(?:Add|Approve|Assert|Backup|Block|Checkpoint|Clear|Close|Compare|Complete|Compress|Confirm|Connect|Convert|ConvertFrom|ConvertTo|Copy|Debug|Deny|Disable|Disconnect|Dismount|Edit|Enable|Enter|Exit|Expand|Export|Find|ForEach|Format|Get|Grant|Group|Hide|Import|Initialize|Install|Invoke|Join|Limit|Lock|Measure|Merge|Move|New|Open|Optimize|Out|Ping|Pop|Protect|Publish|Push|Read|Receive|Redo|Register|Remove|Rename|Repair|Request|Reset|Resize|Resolve|Restart|Restore|Resume|Revoke|Save|Search|Select|Send|Set|Show|Skip|Sort|Split|Start|Step|Stop|Submit|Suspend|Switch|Sync|Tee|Test|Trace|Unblock|Undo|Uninstall|Unlock|Unprotect|Unpublish|Unregister|Update|Use|Wait|Watch|Where|Write)-[a-z]+\b/i, /\b(?:ac|cat|chdir|clc|cli|clp|clv|compare|copy|cp|cpi|cpp|cvpa|dbp|del|diff|dir|ebp|echo|epal|epcsv|epsn|erase|fc|fl|ft|fw|gal|gbp|gc|gci|gcs|gdr|gi|gl|gm|gp|gps|group|gsv|gu|gv|gwmi|iex|ii|ipal|ipcsv|ipsn|irm|iwmi|iwr|kill|lp|ls|measure|mi|mount|move|mp|mv|nal|ndr|ni|nv|ogv|popd|ps|pushd|pwd|rbp|rd|rdr|ren|ri|rm|rmdir|rni|rnp|rp|rv|rvpa|rwmi|sal|saps|sasv|sbp|sc|select|set|shcm|si|sl|sleep|sls|sort|sp|spps|spsv|start|sv|swmi|tee|trcm|type|write)\b/i ],
2572
+ // per http://technet.microsoft.com/en-us/library/hh847744.aspx
2573
+ keyword: /\b(?:Begin|Break|Catch|Class|Continue|Data|Define|Do|DynamicParam|Else|ElseIf|End|Exit|Filter|Finally|For|ForEach|From|Function|If|InlineScript|Parallel|Param|Process|Return|Sequence|Switch|Throw|Trap|Try|Until|Using|Var|While|Workflow)\b/i,
2574
+ operator: {
2575
+ pattern: /(^|\W)(?:!|-(?:b?(?:and|x?or)|as|(?:Not)?(?:Contains|In|Like|Match)|eq|ge|gt|is(?:Not)?|Join|le|lt|ne|not|Replace|sh[lr])\b|-[-=]?|\+[+=]?|[*\/%]=?)/i,
2576
+ lookbehind: true
2577
+ },
2578
+ punctuation: /[|{}[\];(),.]/
2579
+ };
2580
+ // Variable interpolation inside strings, and nested expressions
2581
+ t.string[0].inside = {
2582
+ function: {
2583
+ // Allow for one level of nesting
2584
+ pattern: /(^|[^`])\$\((?:\$\([^\r\n()]*\)|(?!\$\()[^\r\n)])*\)/,
2585
+ lookbehind: true,
2586
+ inside: t
2587
+ },
2588
+ boolean: t.boolean,
2589
+ variable: t.variable
2590
+ };
2591
+ })(a);
2592
+ a.languages.python = {
2593
+ comment: {
2594
+ pattern: /(^|[^\\])#.*/,
2595
+ lookbehind: true,
2596
+ greedy: true
2597
+ },
2598
+ "string-interpolation": {
2599
+ pattern: /(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,
2600
+ greedy: true,
2601
+ inside: {
2602
+ interpolation: {
2603
+ // "{" <expression> <optional "!s", "!r", or "!a"> <optional ":" format specifier> "}"
2604
+ pattern: /((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,
2605
+ lookbehind: true,
2606
+ inside: {
2607
+ "format-spec": {
2608
+ pattern: /(:)[^:(){}]+(?=\}$)/,
2609
+ lookbehind: true
2610
+ },
2611
+ "conversion-option": {
2612
+ pattern: /![sra](?=[:}]$)/,
2613
+ alias: "punctuation"
2614
+ },
2615
+ rest: null
2616
+ }
2617
+ },
2618
+ string: /[\s\S]+/
2619
+ }
2620
+ },
2621
+ "triple-quoted-string": {
2622
+ pattern: /(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,
2623
+ greedy: true,
2624
+ alias: "string"
2625
+ },
2626
+ string: {
2627
+ pattern: /(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,
2628
+ greedy: true
2629
+ },
2630
+ function: {
2631
+ pattern: /((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,
2632
+ lookbehind: true
2633
+ },
2634
+ "class-name": {
2635
+ pattern: /(\bclass\s+)\w+/i,
2636
+ lookbehind: true
2637
+ },
2638
+ decorator: {
2639
+ pattern: /(^[\t ]*)@\w+(?:\.\w+)*/m,
2640
+ lookbehind: true,
2641
+ alias: [ "annotation", "punctuation" ],
2642
+ inside: {
2643
+ punctuation: /\./
2644
+ }
2645
+ },
2646
+ keyword: /\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,
2647
+ builtin: /\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,
2648
+ boolean: /\b(?:False|None|True)\b/,
2649
+ number: /\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,
2650
+ operator: /[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,
2651
+ punctuation: /[{}[\];(),.:]/
2652
+ };
2653
+ a.languages.python["string-interpolation"].inside["interpolation"].inside.rest = a.languages.python;
2654
+ a.languages.py = a.languages.python;
2158
2655
  })();
2159
- /***/ },
2160
- /***/ 9497:
2161
- /***/ e => {
2162
- "use strict";
2163
- e.exports = require("react");
2164
2656
  /***/
2165
2657
  /******/ }
2166
2658
  };
@@ -2176,17 +2668,17 @@
2176
2668
  /******/ return a.exports;
2177
2669
  /******/ }
2178
2670
  /******/ // Create a new module (and put it into the cache)
2179
- /******/ var i = t[r] = {
2671
+ /******/ var s = t[r] = {
2180
2672
  /******/ // no module.id needed
2181
2673
  /******/ // no module.loaded needed
2182
2674
  /******/ exports: {}
2183
2675
  /******/ };
2184
2676
  /******/
2185
2677
  /******/ // Execute the module function
2186
- /******/ e[r](i, i.exports, n);
2678
+ /******/ e[r](s, s.exports, n);
2187
2679
  /******/
2188
2680
  /******/ // Return the exports of the module
2189
- /******/ return i.exports;
2681
+ /******/ return s.exports;
2190
2682
  /******/ }
2191
2683
  /******/
2192
2684
  /************************************************************************/
@@ -2249,17 +2741,17 @@
2249
2741
  n.r(r);
2250
2742
  // EXPORTS
2251
2743
  n.d(r, {
2252
- default: () => /* reexport */ ae
2744
+ default: () => /* reexport */ se
2253
2745
  });
2254
- // EXTERNAL MODULE: external "react"
2255
- var e = n(9497);
2746
+ // CONCATENATED MODULE: external "react"
2747
+ const e = require("react");
2256
2748
  var t = n.n(e);
2257
2749
  // CONCATENATED MODULE: external "lodash/castArray"
2258
2750
  const a = require("lodash/castArray");
2259
- var i = n.n(a);
2751
+ var s = n.n(a);
2260
2752
  // CONCATENATED MODULE: external "lodash/flatten"
2261
- const s = require("lodash/flatten");
2262
- var o = n.n(s);
2753
+ const i = require("lodash/flatten");
2754
+ var o = n.n(i);
2263
2755
  // CONCATENATED MODULE: external "lodash/indexOf"
2264
2756
  const l = require("lodash/indexOf");
2265
2757
  var u = n.n(l);
@@ -2272,68 +2764,71 @@
2272
2764
  // CONCATENATED MODULE: external "prop-types"
2273
2765
  const f = require("prop-types");
2274
2766
  var m = n.n(f);
2767
+ // CONCATENATED MODULE: external "@splunk/react-ui/useResizeObserver"
2768
+ const b = require("@splunk/react-ui/useResizeObserver");
2769
+ var h = n.n(b);
2275
2770
  // CONCATENATED MODULE: external "styled-components"
2276
2771
  const v = require("styled-components");
2277
- var h = n.n(v);
2772
+ var E = n.n(v);
2278
2773
  // CONCATENATED MODULE: external "@splunk/themes"
2279
- const E = require("@splunk/themes");
2774
+ const y = require("@splunk/themes");
2280
2775
  // CONCATENATED MODULE: ./src/Code/CodeStyles.ts
2281
- var b = "lineHeightSpacious";
2282
- var y = "spacingLarge";
2283
- var S = h().code.withConfig({
2776
+ var S = "lineHeightSpacious";
2777
+ var A = "spacingLarge";
2778
+ var k = E().code.withConfig({
2284
2779
  displayName: "CodeStyles__StyledCode",
2285
2780
  componentId: "sc-1eq4k68-0"
2286
- })([ "font-family:", ";position:relative;z-index:1;", ";" ], E.variables.monoFontFamily, (function(e) {
2781
+ })([ "font-family:", ";position:relative;z-index:1;", ";" ], y.variables.monoFontFamily, (function(e) {
2287
2782
  var t = e.$isPlaintext;
2288
- return !t && (0, v.css)([ "color:", ";" ], E.variables.syntaxTeal);
2783
+ return !t && (0, v.css)([ "color:", ";" ], y.variables.syntaxTeal);
2289
2784
  }));
2290
- var A = h().pre.withConfig({
2785
+ var x = E().pre.withConfig({
2291
2786
  displayName: "CodeStyles__StyledPre",
2292
2787
  componentId: "sc-1eq4k68-1"
2293
- })([ "", ";", ";line-height:", ";position:relative;text-align:left;tab-size:4;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;hyphens:none;overflow-x:auto;&:focus-visible{box-shadow:", ";}", " ", ";" ], E.mixins.reset("grid"), E.mixins.typography("monoBody"), E.variables[b], E.variables.focusShadow, (function(e) {
2788
+ })([ "", ";", ";line-height:", ";position:relative;text-align:left;tab-size:4;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;hyphens:none;overflow-x:auto;&:focus-visible{box-shadow:", ";}", " ", ";" ], y.mixins.reset("grid"), y.mixins.typography("monoBody"), y.variables[S], y.variables.focusShadow, (function(e) {
2294
2789
  var t = e.$showLineNumbers, n = e.$counterReset;
2295
2790
  return t && (0, v.css)([ "grid-template-columns:min-content auto;counter-reset:linenumber ", ";" ], n);
2296
2791
  }), (function(e) {
2297
2792
  var t = e.$containerAppearance;
2298
- return t === "none" ? (0, v.css)([ "gap:", ";" ], E.variables.spacingMedium) : (0,
2299
- v.css)([ "background-color:", ";border-radius:", ";", "{margin:", ";}" ], E.variables.neutral50, E.variables.borderRadius, /* sc-sel */ S, E.variables[y]);
2793
+ return t === "none" ? (0, v.css)([ "gap:", ";" ], y.variables.spacingMedium) : (0,
2794
+ v.css)([ "background-color:", ";border-radius:", ";", "{margin:", ";}" ], y.variables.neutral50, y.variables.borderRadius, /* sc-sel */ k, y.variables[A]);
2300
2795
  }));
2301
- var T = h().span.withConfig({
2796
+ var T = E().span.withConfig({
2302
2797
  displayName: "CodeStyles__StyledIndent",
2303
2798
  componentId: "sc-1eq4k68-2"
2304
- })([ "&:not(:last-child){background-image:linear-gradient( to left,", " 1px,transparent 1px,transparent );}" ], E.variables.syntaxGray);
2799
+ })([ "&:not(:last-child){background-image:linear-gradient( to left,", " 1px,transparent 1px,transparent );}" ], y.variables.syntaxGray);
2305
2800
  var I = {
2306
- comment: E.variables.syntaxGray,
2307
- prolog: E.variables.syntaxGray,
2308
- doctype: E.variables.syntaxGray,
2309
- cdata: E.variables.syntaxGray,
2310
- punctuation: E.variables.syntaxGray,
2311
- property: E.variables.syntaxPurple,
2312
- tag: E.variables.syntaxPurple,
2313
- boolean: E.variables.syntaxPurple,
2314
- number: E.variables.syntaxPurple,
2315
- constant: E.variables.syntaxPurple,
2316
- symbol: E.variables.syntaxPurple,
2317
- deleted: E.variables.syntaxPurple,
2318
- key: E.variables.syntaxPurple,
2319
- selector: E.variables.syntaxGreen,
2320
- "attr-name": E.variables.syntaxGreen,
2321
- string: E.variables.syntaxGreen,
2322
- char: E.variables.syntaxGreen,
2323
- builtin: E.variables.syntaxGreen,
2324
- inserted: E.variables.syntaxGreen,
2325
- operator: E.variables.syntaxBrown,
2326
- entity: E.variables.syntaxBrown,
2327
- url: E.variables.syntaxBrown,
2328
- atrule: E.variables.syntaxBlue,
2329
- "attr-value": E.variables.syntaxBlue,
2330
- keyword: E.variables.syntaxBlue,
2331
- function: E.variables.syntaxRed,
2332
- regex: E.variables.syntaxOrange,
2333
- important: E.variables.syntaxOrange,
2334
- variable: E.variables.syntaxOrange
2801
+ comment: y.variables.syntaxGray,
2802
+ prolog: y.variables.syntaxGray,
2803
+ doctype: y.variables.syntaxGray,
2804
+ cdata: y.variables.syntaxGray,
2805
+ punctuation: y.variables.syntaxGray,
2806
+ property: y.variables.syntaxPurple,
2807
+ tag: y.variables.syntaxPurple,
2808
+ boolean: y.variables.syntaxPurple,
2809
+ number: y.variables.syntaxPurple,
2810
+ constant: y.variables.syntaxPurple,
2811
+ symbol: y.variables.syntaxPurple,
2812
+ deleted: y.variables.syntaxPurple,
2813
+ key: y.variables.syntaxPurple,
2814
+ selector: y.variables.syntaxGreen,
2815
+ "attr-name": y.variables.syntaxGreen,
2816
+ string: y.variables.syntaxGreen,
2817
+ char: y.variables.syntaxGreen,
2818
+ builtin: y.variables.syntaxGreen,
2819
+ inserted: y.variables.syntaxGreen,
2820
+ operator: y.variables.syntaxBrown,
2821
+ entity: y.variables.syntaxBrown,
2822
+ url: y.variables.syntaxBrown,
2823
+ atrule: y.variables.syntaxBlue,
2824
+ "attr-value": y.variables.syntaxBlue,
2825
+ keyword: y.variables.syntaxBlue,
2826
+ function: y.variables.syntaxRed,
2827
+ regex: y.variables.syntaxOrange,
2828
+ important: y.variables.syntaxOrange,
2829
+ variable: y.variables.syntaxOrange
2335
2830
  };
2336
- var O = h().span.withConfig({
2831
+ var R = E().span.withConfig({
2337
2832
  displayName: "CodeStyles__StyledToken",
2338
2833
  componentId: "sc-1eq4k68-3"
2339
2834
  })([ "color:", ";cursor:", ";opacity:", ";font-style:", ";font-weight:", ";" ], (function(e) {
@@ -2350,28 +2845,28 @@
2350
2845
  return t === "italic" ? "italic" : null;
2351
2846
  }), (function(e) {
2352
2847
  var t = e.partType;
2353
- return t === "important" || t === "bold" ? E.variables.fontWeightBold : null;
2848
+ return t === "important" || t === "bold" ? y.variables.fontWeightBold : null;
2354
2849
  }));
2355
2850
  // CONCATENATED MODULE: ./src/Code/LineHighlightsStyles.ts
2356
- var N = h().div.withConfig({
2851
+ var w = E().div.withConfig({
2357
2852
  displayName: "LineHighlightsStyles__StyledLineHighlight",
2358
2853
  componentId: "sc-1x2b02z-0"
2359
- })([ "position:absolute;left:0;height:1lh;background:", ";border-left:2px solid ", ";pointer-events:none;line-height:inherit;width:", "px;", ";" ], E.variables.notificationColorInfoWeak, E.variables.notificationColorInfo, (function(e) {
2854
+ })([ "position:absolute;left:0;height:1lh;background:", ";border-left:2px solid ", ";pointer-events:none;line-height:inherit;width:", "px;", ";" ], y.variables.notificationColorInfoWeak, y.variables.notificationColorInfo, (function(e) {
2360
2855
  var t = e.$width;
2361
2856
  return t;
2362
2857
  }), (function(e) {
2363
2858
  var t = e.$containerAppearance, n = e.$lineNum;
2364
- return t === "none" ? (0, v.css)([ "top:calc(", " * ", "em);" ], n - 1, E.variables[b]) : (0,
2365
- v.css)([ "top:calc( ", " * ", "em + ", " );" ], n - 1, E.variables[b], E.variables[y]);
2859
+ return t === "none" ? (0, v.css)([ "top:calc(", " * ", "em);" ], n - 1, y.variables[S]) : (0,
2860
+ v.css)([ "top:calc( ", " * ", "em + ", " );" ], n - 1, y.variables[S], y.variables[A]);
2366
2861
  }));
2367
2862
  // CONCATENATED MODULE: ./src/Code/LineHighlights.tsx
2368
- function x(e, t) {
2369
- return w(e) || F(e, t) || k(e, t) || R();
2863
+ function N(e, t) {
2864
+ return C(e) || F(e, t) || _(e, t) || O();
2370
2865
  }
2371
- function R() {
2866
+ function O() {
2372
2867
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2373
2868
  }
2374
- function k(e, t) {
2869
+ function _(e, t) {
2375
2870
  if (e) {
2376
2871
  if ("string" == typeof e) return L(e, t);
2377
2872
  var n = {}.toString.call(e).slice(8, -1);
@@ -2388,18 +2883,18 @@
2388
2883
  function F(e, t) {
2389
2884
  var n = null == e ? null : "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
2390
2885
  if (null != n) {
2391
- var r, a, i, s, o = [], l = !0, u = !1;
2886
+ var r, a, s, i, o = [], l = !0, u = !1;
2392
2887
  try {
2393
- if (i = (n = n.call(e)).next, 0 === t) {
2888
+ if (s = (n = n.call(e)).next, 0 === t) {
2394
2889
  if (Object(n) !== n) return;
2395
2890
  l = !1;
2396
- } else for (;!(l = (r = i.call(n)).done) && (o.push(r.value), o.length !== t); l = !0) {
2891
+ } else for (;!(l = (r = s.call(n)).done) && (o.push(r.value), o.length !== t); l = !0) {
2397
2892
  }
2398
2893
  } catch (e) {
2399
2894
  u = !0, a = e;
2400
2895
  } finally {
2401
2896
  try {
2402
- if (!l && null != n["return"] && (s = n["return"](), Object(s) !== s)) return;
2897
+ if (!l && null != n["return"] && (i = n["return"](), Object(i) !== i)) return;
2403
2898
  } finally {
2404
2899
  if (u) throw a;
2405
2900
  }
@@ -2407,21 +2902,21 @@
2407
2902
  return o;
2408
2903
  }
2409
2904
  }
2410
- function w(e) {
2905
+ function C(e) {
2411
2906
  if (Array.isArray(e)) return e;
2412
2907
  }
2413
2908
  // parseHighlightLines will turn a string like "2,4-5" into an array of ranges like [[2, 2], [4, 5]]
2414
- var C = function e(t) {
2909
+ var D = function e(t) {
2415
2910
  return t.replace(/\s+/g, "").split(",").filter(Boolean).map((function(e) {
2416
- var t = e.split("-").map(Number), n = x(t, 2), r = n[0], a = n[1];
2911
+ var t = e.split("-").map(Number), n = N(t, 2), r = n[0], a = n[1];
2417
2912
  return [ r, a || r ];
2418
2913
  }));
2419
2914
  };
2420
2915
  // Flatten the array of ranges into a single array of line numbers
2421
2916
  // example: [[2, 2], [4, 5]] will become [2, 4, 5]
2422
- var D = function e(t) {
2917
+ var P = function e(t) {
2423
2918
  var n = t.map((function(e) {
2424
- var t = x(e, 2), n = t[0], r = t[1];
2919
+ var t = N(e, 2), n = t[0], r = t[1];
2425
2920
  return Array.from({
2426
2921
  length: r - n + 1
2427
2922
  }, (function(e, t) {
@@ -2433,43 +2928,43 @@
2433
2928
  return Array.from(new Set(n));
2434
2929
  // Remove duplicates
2435
2930
  };
2436
- var P = function e(n) {
2437
- var r = n.containerAppearance, a = n.highlight, i = n.width;
2438
- var s = C(a);
2439
- var o = D(s);
2931
+ var $ = function e(n) {
2932
+ var r = n.containerAppearance, a = n.highlight, s = n.width;
2933
+ var i = D(a);
2934
+ var o = P(i);
2440
2935
 
2441
2936
  return t().createElement(t().Fragment, null, o.map((function(e) {
2442
2937
 
2443
- return t().createElement(N, {
2938
+ return t().createElement(w, {
2444
2939
  key: e,
2445
2940
  className: "line-highlight",
2446
2941
  "aria-hidden": "true",
2447
2942
  $containerAppearance: r,
2448
2943
  $lineNum: e,
2449
- $width: i
2944
+ $width: s
2450
2945
  });
2451
2946
  })));
2452
2947
  };
2453
- /* harmony default export */ const _ = P;
2948
+ /* harmony default export */ const U = $;
2454
2949
  // CONCATENATED MODULE: ./src/Code/LineNumbersStyles.ts
2455
- var $ = h().span.withConfig({
2950
+ var B = E().span.withConfig({
2456
2951
  displayName: "LineNumbersStyles__StyledLineNumberRows",
2457
2952
  componentId: "sc-1h4k3dh-0"
2458
2953
  })([ "pointer-events:none;user-select:none;", ";& > span{display:block;counter-increment:linenumber;position:relative;z-index:1;&::before{display:block;content:counter(linenumber);color:", ";text-align:right;", "}}" ], (function(e) {
2459
2954
  var t = e.$containerAppearance;
2460
- return t === "none" ? (0, v.css)([ "border-right:1px solid ", ";z-index:1;" ], E.variables.borderColor) : (0,
2461
- v.css)([ "padding:", ";background-color:", ";" ], E.variables[y], E.variables.neutral200);
2462
- }), E.variables.contentColorDefault, (function(e) {
2955
+ return t === "none" ? (0, v.css)([ "border-right:1px solid ", ";z-index:1;" ], y.variables.borderColor) : (0,
2956
+ v.css)([ "padding:", ";background-color:", ";" ], y.variables[A], y.variables.neutral200);
2957
+ }), y.variables.contentColorDefault, (function(e) {
2463
2958
  var t = e.$containerAppearance;
2464
- return t === "none" && (0, v.css)([ "padding-inline-end:", ";" ], E.variables.spacingSmall);
2959
+ return t === "none" && (0, v.css)([ "padding-inline-end:", ";" ], y.variables.spacingSmall);
2465
2960
  }));
2466
2961
  // CONCATENATED MODULE: ./src/Code/LineNumbers.tsx
2467
- function U(e) {
2468
- var n = e.containerAppearance, r = n === void 0 ? "none" : n, a = e.value, i = a === void 0 ? "" : a;
2962
+ function M(e) {
2963
+ var n = e.containerAppearance, r = n === void 0 ? "none" : n, a = e.value, s = a === void 0 ? "" : a;
2469
2964
  // Use a regex to see how many lines there are in the value, then output an
2470
2965
  // empty span for each line. The numbers themselves are handled by the CSS counter.
2471
- var s = i.match(/\n(?!$)/g);
2472
- var o = s ? s.length + 1 : 1;
2966
+ var i = s.match(/\n(?!$)/g);
2967
+ var o = i ? i.length + 1 : 1;
2473
2968
  var l = Array.from({
2474
2969
  length: o
2475
2970
  }, (function(e, n) {
@@ -2479,17 +2974,15 @@
2479
2974
  });
2480
2975
  }));
2481
2976
 
2482
- return t().createElement($, {
2977
+ return t().createElement(B, {
2483
2978
  $containerAppearance: r,
2484
2979
  "aria-hidden": true
2485
2980
  }, l);
2486
2981
  }
2487
- /* harmony default export */ const M = U;
2488
- // EXTERNAL MODULE: ./src/useResizeObserver/index.ts + 1 modules
2489
- var B = n(6283);
2982
+ /* harmony default export */ const G = M;
2490
2983
  // EXTERNAL MODULE: ./src/Code/prism/prism.empty
2491
- var G = n(74);
2492
- var j = n.n(G);
2984
+ var j = n(74);
2985
+ var H = n.n(j);
2493
2986
  // CONCATENATED MODULE: ./src/utils/updateReactRef.ts
2494
2987
  /**
2495
2988
  * Updates a React ref. Callback refs and object refs (from `createRef` and `useRef`) are supported.
@@ -2497,7 +2990,7 @@
2497
2990
  * @param ref - The React callback or object ref. Can be `null` or `undefined`.
2498
2991
  * @param current - The new value of the ref.
2499
2992
  */
2500
- function H(e, t) {
2993
+ function z(e, t) {
2501
2994
  if (e) {
2502
2995
  if (typeof e === "function") {
2503
2996
  e(t);
@@ -2510,8 +3003,8 @@
2510
3003
  }
2511
3004
  }
2512
3005
  // CONCATENATED MODULE: ./src/Code/Code.tsx
2513
- function z() {
2514
- return z = Object.assign ? Object.assign.bind() : function(e) {
3006
+ function W() {
3007
+ return W = Object.assign ? Object.assign.bind() : function(e) {
2515
3008
  for (var t = 1; t < arguments.length; t++) {
2516
3009
  var n = arguments[t];
2517
3010
  for (var r in n) {
@@ -2519,43 +3012,43 @@
2519
3012
  }
2520
3013
  }
2521
3014
  return e;
2522
- }, z.apply(null, arguments);
3015
+ }, W.apply(null, arguments);
2523
3016
  }
2524
3017
  function Y(e, t) {
2525
- return V(e) || K(e, t) || W(e, t) || X();
3018
+ return V(e) || Z(e, t) || X(e, t) || q();
2526
3019
  }
2527
- function X() {
3020
+ function q() {
2528
3021
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2529
3022
  }
2530
- function W(e, t) {
3023
+ function X(e, t) {
2531
3024
  if (e) {
2532
- if ("string" == typeof e) return q(e, t);
3025
+ if ("string" == typeof e) return K(e, t);
2533
3026
  var n = {}.toString.call(e).slice(8, -1);
2534
- return "Object" === n && e.constructor && (n = e.constructor.name), "Map" === n || "Set" === n ? Array.from(e) : "Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? q(e, t) : void 0;
3027
+ return "Object" === n && e.constructor && (n = e.constructor.name), "Map" === n || "Set" === n ? Array.from(e) : "Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? K(e, t) : void 0;
2535
3028
  }
2536
3029
  }
2537
- function q(e, t) {
3030
+ function K(e, t) {
2538
3031
  (null == t || t > e.length) && (t = e.length);
2539
3032
  for (var n = 0, r = Array(t); n < t; n++) {
2540
3033
  r[n] = e[n];
2541
3034
  }
2542
3035
  return r;
2543
3036
  }
2544
- function K(e, t) {
3037
+ function Z(e, t) {
2545
3038
  var n = null == e ? null : "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
2546
3039
  if (null != n) {
2547
- var r, a, i, s, o = [], l = !0, u = !1;
3040
+ var r, a, s, i, o = [], l = !0, u = !1;
2548
3041
  try {
2549
- if (i = (n = n.call(e)).next, 0 === t) {
3042
+ if (s = (n = n.call(e)).next, 0 === t) {
2550
3043
  if (Object(n) !== n) return;
2551
3044
  l = !1;
2552
- } else for (;!(l = (r = i.call(n)).done) && (o.push(r.value), o.length !== t); l = !0) {
3045
+ } else for (;!(l = (r = s.call(n)).done) && (o.push(r.value), o.length !== t); l = !0) {
2553
3046
  }
2554
3047
  } catch (e) {
2555
3048
  u = !0, a = e;
2556
3049
  } finally {
2557
3050
  try {
2558
- if (!l && null != n["return"] && (s = n["return"](), Object(s) !== s)) return;
3051
+ if (!l && null != n["return"] && (i = n["return"](), Object(i) !== i)) return;
2559
3052
  } finally {
2560
3053
  if (u) throw a;
2561
3054
  }
@@ -2566,13 +3059,13 @@
2566
3059
  function V(e) {
2567
3060
  if (Array.isArray(e)) return e;
2568
3061
  }
2569
- function Z(e, t) {
3062
+ function J(e, t) {
2570
3063
  if (null == e) return {};
2571
3064
  var n, r, a = Q(e, t);
2572
3065
  if (Object.getOwnPropertySymbols) {
2573
- var i = Object.getOwnPropertySymbols(e);
2574
- for (r = 0; r < i.length; r++) {
2575
- n = i[r], -1 === t.indexOf(n) && {}.propertyIsEnumerable.call(e, n) && (a[n] = e[n]);
3066
+ var s = Object.getOwnPropertySymbols(e);
3067
+ for (r = 0; r < s.length; r++) {
3068
+ n = s[r], -1 === t.indexOf(n) && {}.propertyIsEnumerable.call(e, n) && (a[n] = e[n]);
2576
3069
  }
2577
3070
  }
2578
3071
  return a;
@@ -2592,74 +3085,74 @@
2592
3085
  // auto formatting. The import below points to an empty file which is replaced at build
2593
3086
  // time, see ./prism/build-isolated-prism.js for details.
2594
3087
  // typed as 'prismjs'
2595
- var J = [ "bash", "clike", "css", "html", "json", "javascript", "js", "jsx", "typescript", "ts", "tsx", "markup", "mathml", "plain", "plaintext", "splunk-spl", "sql", "svg", "text", "txt", "xml", "yaml", "yml" ];
2596
- function ee(e) {
3088
+ var ee = [ "bash", "c", "clike", "cpp", "cs", "csharp", "css", "html", "javascript", "js", "json", "jsx", "markup", "mathml", "plain", "plaintext", "powershell", "py", "python", "sh", "shell", "splunk-spl", "sql", "svg", "text", "ts", "tsx", "txt", "typescript", "xml", "yaml", "yml" ];
3089
+ function te(e) {
2597
3090
  return [ "plain", "plaintext", "text", "txt" ].includes(e);
2598
3091
  }
2599
- function te(e, t) {
2600
- if (ee(t)) {
2601
- return j().tokenize(e, {});
3092
+ function ne(e, t) {
3093
+ if (te(t)) {
3094
+ return H().tokenize(e, {});
2602
3095
  }
2603
- return j().tokenize(e, j().languages[t]);
3096
+ return H().tokenize(e, H().languages[t]);
2604
3097
  }
2605
- var ne = {
3098
+ var re = {
2606
3099
  containerAppearance: m().oneOf([ "none", "section" ]),
2607
3100
  elementRef: m().oneOfType([ m().func, m().object ]),
2608
3101
  indentChars: m().number,
2609
- language: m().oneOf(J),
2610
- languageFallback: m().oneOf(J),
3102
+ language: m().oneOf(ee),
3103
+ languageFallback: m().oneOf(ee),
2611
3104
  lineHighlights: m().string,
2612
3105
  lineNumberStart: m().number,
2613
3106
  showIndentGuide: m().bool,
2614
3107
  showLineNumbers: m().bool,
2615
3108
  value: m().string
2616
3109
  };
2617
- function re(n) {
2618
- var r = n.containerAppearance, a = r === void 0 ? "none" : r, s = n.elementRef, l = n.indentChars, c = l === void 0 ? 4 : l, d = n.language, f = n.languageFallback, m = f === void 0 ? "javascript" : f, v = n.lineHighlights, h = n.lineNumberStart, E = n.showIndentGuide, b = E === void 0 ? true : E, y = n.showLineNumbers, I = n.value, N = I === void 0 ? "" : I, x = Z(n, [ "containerAppearance", "elementRef", "indentChars", "language", "languageFallback", "lineHighlights", "lineNumberStart", "showIndentGuide", "showLineNumbers", "value" ]);
3110
+ function ae(n) {
3111
+ var r = n.containerAppearance, a = r === void 0 ? "none" : r, i = n.elementRef, l = n.indentChars, c = l === void 0 ? 4 : l, d = n.language, f = n.languageFallback, m = f === void 0 ? "javascript" : f, b = n.lineHighlights, v = n.lineNumberStart, E = n.showIndentGuide, y = E === void 0 ? true : E, S = n.showLineNumbers, A = n.value, I = A === void 0 ? "" : A, w = J(n, [ "containerAppearance", "elementRef", "indentChars", "language", "languageFallback", "lineHighlights", "lineNumberStart", "showIndentGuide", "showLineNumbers", "value" ]);
2619
3112
  // @docs-props-type CodePropsBase
2620
- var R = (0, e.useRef)(null);
2621
- var k = (0, e.useState)(undefined), L = Y(k, 2), F = L[0], w = L[1];
2622
- var C = (0, B["default"])(R), D = C.width, P = C.height;
3113
+ var N = (0, e.useRef)(null);
3114
+ var O = (0, e.useState)(undefined), _ = Y(O, 2), L = _[0], F = _[1];
3115
+ var C = h()(N), D = C.width, P = C.height;
2623
3116
  var $ = (0, e.useCallback)((function(e) {
2624
- H(R, e);
2625
- H(s, e);
2626
- }), [ s ]);
3117
+ z(N, e);
3118
+ z(i, e);
3119
+ }), [ i ]);
2627
3120
  (0, e.useEffect)((function() {
2628
- var e = R.current;
3121
+ var e = N.current;
2629
3122
  if (e) {
2630
3123
  var t = e.scrollHeight > Math.round(P);
2631
3124
  var n = e.scrollWidth > Math.round(D);
2632
3125
  var r = t || n;
2633
- w(r ? 0 : undefined);
3126
+ F(r ? 0 : undefined);
2634
3127
  }
2635
- }), [ R, D, P ]);
2636
- var U = p()(" ", c);
2637
- var G = function e(n) {
3128
+ }), [ N, D, P ]);
3129
+ var B = p()(" ", c);
3130
+ var M = function e(n) {
2638
3131
  var r = Math.floor(n / c);
2639
3132
  var a = n % c;
2640
- var i = g()(r, (function(e) {
3133
+ var s = g()(r, (function(e) {
2641
3134
 
2642
3135
  return t().createElement(T, {
2643
3136
  key: e.toString()
2644
- }, U);
3137
+ }, B);
2645
3138
  }));
2646
3139
  if (a) {
2647
- i.push(p()(" ", a));
3140
+ s.push(p()(" ", a));
2648
3141
  }
2649
- return i;
3142
+ return s;
2650
3143
  };
2651
- var j = u()(J, d) > -1;
3144
+ var j = d ? u()(ee, d) > -1 : true;
2652
3145
  (0, e.useEffect)((function() {
2653
3146
  // a fix for SUI-5425, where the Markdown component doesn't pass a valid language in some circumstances
2654
3147
  if (false) {}
2655
3148
  }), [ j, d, m ]);
2656
- var X = j && d ? d : m;
2657
- var W = te(N, X);
2658
- var q = ee(X);
3149
+ var H = j && d ? d : m;
3150
+ var q = ne(I, H);
3151
+ var X = te(H);
2659
3152
  var K = function e(n) {
2660
- return i()(n).map((function(n, r) {
3153
+ return s()(n).map((function(n, r) {
2661
3154
  if (typeof n === "string") {
2662
- if (!b) {
3155
+ if (!y) {
2663
3156
  return n;
2664
3157
  }
2665
3158
  var a = n.split("\n");
@@ -2668,50 +3161,50 @@
2668
3161
  }
2669
3162
  return o()(a.map((function(e, n) {
2670
3163
  var a = n === 0 ? [] : [ "\n" ];
2671
- var i = e.match(/^(\s+)(.*)/);
2672
- if (!i) {
3164
+ var s = e.match(/^(\s+)(.*)/);
3165
+ if (!s) {
2673
3166
  a.push(e);
2674
3167
  } else {
2675
3168
  a.push( t().createElement("span", {
2676
3169
  key: "".concat(r.toString(), ":").concat(n.toString())
2677
- }, G(i[1].length)), i[2]);
3170
+ }, M(s[1].length)), s[2]);
2678
3171
  }
2679
3172
  return a;
2680
3173
  })));
2681
3174
  }
2682
- var i = typeof n.content === "string" ? n.content : e(n.content);
3175
+ var s = typeof n.content === "string" ? n.content : e(n.content);
2683
3176
 
2684
3177
  // eslint-disable-next-line react/no-array-index-key
2685
- return t().createElement(O, {
3178
+ return t().createElement(R, {
2686
3179
  "data-part-type": n.type,
2687
3180
  partType: n.type,
2688
3181
  key: r.toString()
2689
- }, i);
3182
+ }, s);
2690
3183
  }));
2691
3184
  };
2692
- var V = K(W);
3185
+ var Z = K(q);
2693
3186
 
2694
- return t().createElement(A, z({
3187
+ return t().createElement(x, W({
2695
3188
  "data-test": "code",
2696
3189
  ref: $,
2697
- tabIndex: F,
3190
+ tabIndex: L,
2698
3191
  $containerAppearance: a,
2699
- $showLineNumbers: y,
2700
- $counterReset: h && h - 1
2701
- }, x), y && t().createElement(M, {
3192
+ $showLineNumbers: S,
3193
+ $counterReset: v && v - 1
3194
+ }, w), S && t().createElement(G, {
2702
3195
  containerAppearance: a,
2703
- value: N
2704
- }), t().createElement(S, {
2705
- className: "language-".concat(X),
2706
- $isPlaintext: q
2707
- }, V), v && t().createElement(_, {
3196
+ value: I
3197
+ }), t().createElement(k, {
3198
+ className: "language-".concat(H),
3199
+ $isPlaintext: X
3200
+ }, Z), b && t().createElement(U, {
2708
3201
  containerAppearance: a,
2709
3202
  width: D,
2710
- highlight: v
3203
+ highlight: b
2711
3204
  }));
2712
3205
  }
2713
- re.propTypes = ne;
2714
- /* harmony default export */ const ae = re;
3206
+ ae.propTypes = re;
3207
+ /* harmony default export */ const se = ae;
2715
3208
  }) // CONCATENATED MODULE: ./src/Code/index.ts
2716
3209
  ();
2717
3210
  module.exports = r;