@meridianlabs/log-viewer 0.3.272 → 0.3.275

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 (168) hide show
  1. package/lib/AnsiDisplayRich-302CIkEj.js +1431 -0
  2. package/lib/AnsiDisplayRich-302CIkEj.js.map +1 -0
  3. package/lib/ToolButton-BmBvTvKO.js +124 -0
  4. package/lib/ToolButton-BmBvTvKO.js.map +1 -0
  5. package/lib/e2e/content-trust.spec.d.ts +2 -0
  6. package/lib/e2e/content-trust.spec.d.ts.map +1 -0
  7. package/lib/e2e/expandable-panel-sticky-toggle.spec.d.ts +2 -0
  8. package/lib/e2e/expandable-panel-sticky-toggle.spec.d.ts.map +1 -0
  9. package/lib/e2e/fixtures/log-list-scenario.d.ts +37 -1
  10. package/lib/e2e/fixtures/log-list-scenario.d.ts.map +1 -1
  11. package/lib/e2e/fixtures/serve-eval-file.d.ts +20 -0
  12. package/lib/e2e/fixtures/serve-eval-file.d.ts.map +1 -0
  13. package/lib/e2e/log-location-trust.spec.d.ts +2 -0
  14. package/lib/e2e/log-location-trust.spec.d.ts.map +1 -0
  15. package/lib/e2e/sample-activity.spec.d.ts +10 -0
  16. package/lib/e2e/sample-activity.spec.d.ts.map +1 -0
  17. package/lib/e2e/scanner-glob.spec.d.ts +2 -0
  18. package/lib/e2e/scanner-glob.spec.d.ts.map +1 -0
  19. package/lib/e2e/timeline-axis-bounds.spec.d.ts +2 -0
  20. package/lib/e2e/timeline-axis-bounds.spec.d.ts.map +1 -0
  21. package/lib/e2e/zip-reader.spec.d.ts +2 -0
  22. package/lib/e2e/zip-reader.spec.d.ts.map +1 -0
  23. package/lib/index.js +27678 -45828
  24. package/lib/index.js.map +1 -1
  25. package/lib/markdownPipeline-BeMkkZRz.js +8575 -0
  26. package/lib/markdownPipeline-BeMkkZRz.js.map +1 -0
  27. package/lib/markdownText-z5R6PHwt.js +105 -0
  28. package/lib/markdownText-z5R6PHwt.js.map +1 -0
  29. package/lib/prismHighlighter-D-PZtkPX.js +1927 -0
  30. package/lib/prismHighlighter-D-PZtkPX.js.map +1 -0
  31. package/lib/rolldown-runtime-B-lAHAz2.js +37 -0
  32. package/lib/src/app/App.d.ts.map +1 -1
  33. package/lib/src/app/flow/FlowButton.d.ts +2 -1
  34. package/lib/src/app/flow/FlowButton.d.ts.map +1 -1
  35. package/lib/src/app/flow/FlowPanel.d.ts.map +1 -1
  36. package/lib/src/app/log-list/grid/LogListGrid.d.ts.map +1 -1
  37. package/lib/src/app/log-list/grid/columns/hooks.d.ts.map +1 -1
  38. package/lib/src/app/log-view/LogSampleDetailView.d.ts.map +1 -1
  39. package/lib/src/app/log-view/LogView.d.ts.map +1 -1
  40. package/lib/src/app/log-view/tabs/ConfigCard.d.ts.map +1 -1
  41. package/lib/src/app/log-view/tabs/InfoTab.d.ts +1 -0
  42. package/lib/src/app/log-view/tabs/InfoTab.d.ts.map +1 -1
  43. package/lib/src/app/log-view/tabs/JsonTab.d.ts +9 -1
  44. package/lib/src/app/log-view/tabs/JsonTab.d.ts.map +1 -1
  45. package/lib/src/app/log-view/tabs/ModelsTab.d.ts +1 -0
  46. package/lib/src/app/log-view/tabs/ModelsTab.d.ts.map +1 -1
  47. package/lib/src/app/log-view/tabs/SamplesTab.d.ts +1 -1
  48. package/lib/src/app/log-view/tabs/SamplesTab.d.ts.map +1 -1
  49. package/lib/src/app/log-view/tabs/TaskTab.d.ts +1 -0
  50. package/lib/src/app/log-view/tabs/TaskTab.d.ts.map +1 -1
  51. package/lib/src/app/log-view/tabs/timeline/HistoryList.d.ts +3 -2
  52. package/lib/src/app/log-view/tabs/timeline/HistoryList.d.ts.map +1 -1
  53. package/lib/src/app/log-view/tabs/timeline/OpenSampleLink.d.ts +24 -0
  54. package/lib/src/app/log-view/tabs/timeline/OpenSampleLink.d.ts.map +1 -0
  55. package/lib/src/app/log-view/tabs/timeline/TimelineChart.d.ts +3 -2
  56. package/lib/src/app/log-view/tabs/timeline/TimelineChart.d.ts.map +1 -1
  57. package/lib/src/app/log-view/tabs/timeline/TimelineTab.d.ts +6 -36
  58. package/lib/src/app/log-view/tabs/timeline/TimelineTab.d.ts.map +1 -1
  59. package/lib/src/app/log-view/tabs/timeline/timelineAxis.d.ts +11 -0
  60. package/lib/src/app/log-view/tabs/timeline/timelineAxis.d.ts.map +1 -0
  61. package/lib/src/app/log-view/title-view/ScoreGrid.d.ts.map +1 -1
  62. package/lib/src/app/log-view/title-view/SecondaryBar.d.ts.map +1 -1
  63. package/lib/src/app/log-view/useTimelineNavigation.d.ts +24 -0
  64. package/lib/src/app/log-view/useTimelineNavigation.d.ts.map +1 -0
  65. package/lib/src/app/navbar/ViewSegmentedControl.d.ts.map +1 -1
  66. package/lib/src/app/routing/AppRouter.d.ts.map +1 -1
  67. package/lib/src/app/routing/logNavigation.d.ts +1 -0
  68. package/lib/src/app/routing/logNavigation.d.ts.map +1 -1
  69. package/lib/src/app/routing/sampleNavigation.d.ts +4 -1
  70. package/lib/src/app/routing/sampleNavigation.d.ts.map +1 -1
  71. package/lib/src/app/routing/url.d.ts.map +1 -1
  72. package/lib/src/app/samples/SampleDisplay.d.ts.map +1 -1
  73. package/lib/src/app/samples/SampleNavbar.d.ts +3 -0
  74. package/lib/src/app/samples/SampleNavbar.d.ts.map +1 -1
  75. package/lib/src/app/samples/SampleSummaryView.d.ts.map +1 -1
  76. package/lib/src/app/samples/descriptor/samplesDescriptor.d.ts.map +1 -1
  77. package/lib/src/app/samples/descriptor/score/BooleanScoreDescriptor.d.ts.map +1 -1
  78. package/lib/src/app/samples/descriptor/score/CategoricalScoreDescriptor.d.ts.map +1 -1
  79. package/lib/src/app/samples/descriptor/score/PassFailScoreDescriptor.d.ts.map +1 -1
  80. package/lib/src/app/samples/event/SampleEventView.d.ts.map +1 -1
  81. package/lib/src/app/samples/header-v2/ScorePanel.d.ts.map +1 -1
  82. package/lib/src/app/samples/header-v2/ScoreValueDisplay.d.ts.map +1 -1
  83. package/lib/src/app/samples/header-v2/scoreTone.d.ts.map +1 -1
  84. package/lib/src/app/samples/list/SampleList.d.ts.map +1 -1
  85. package/lib/src/app/samples/print/SamplePrintView.d.ts.map +1 -1
  86. package/lib/src/app/samples/sample-tools/filters.d.ts.map +1 -1
  87. package/lib/src/app/samples/sample-tools/sample-filter/completions.d.ts.map +1 -1
  88. package/lib/src/app/samples/status/status.d.ts +1 -1
  89. package/lib/src/app/samples-panel/SampleDetailView.d.ts.map +1 -1
  90. package/lib/src/app/samples-panel/SamplesPanel.d.ts.map +1 -1
  91. package/lib/src/app/shared/contentTrust.d.ts +14 -0
  92. package/lib/src/app/shared/contentTrust.d.ts.map +1 -0
  93. package/lib/src/app/shared/data-grid/DataGrid.d.ts +8 -3
  94. package/lib/src/app/shared/data-grid/DataGrid.d.ts.map +1 -1
  95. package/lib/src/app/shared/openInNewTab.d.ts +7 -1
  96. package/lib/src/app/shared/openInNewTab.d.ts.map +1 -1
  97. package/lib/src/app/shared/samples-grid/SamplesGrid.d.ts +3 -1
  98. package/lib/src/app/shared/samples-grid/SamplesGrid.d.ts.map +1 -1
  99. package/lib/src/app/shared/samples-grid/cells.d.ts.map +1 -1
  100. package/lib/src/app/shared/samples-grid/columns.d.ts.map +1 -1
  101. package/lib/src/app/shared/samples-grid/types.d.ts +1 -0
  102. package/lib/src/app/shared/samples-grid/types.d.ts.map +1 -1
  103. package/lib/src/app_config/LogLocationGate.d.ts +12 -0
  104. package/lib/src/app_config/LogLocationGate.d.ts.map +1 -0
  105. package/lib/src/app_config/appConfig.d.ts +14 -0
  106. package/lib/src/app_config/appConfig.d.ts.map +1 -1
  107. package/lib/src/app_config/index.d.ts +2 -1
  108. package/lib/src/app_config/index.d.ts.map +1 -1
  109. package/lib/src/app_config/logLocationTrust.d.ts +28 -0
  110. package/lib/src/app_config/logLocationTrust.d.ts.map +1 -0
  111. package/lib/src/app_config/resolveBackend.d.ts +9 -0
  112. package/lib/src/app_config/resolveBackend.d.ts.map +1 -1
  113. package/lib/src/client/api/static-http/fetch.d.ts +3 -1
  114. package/lib/src/client/api/static-http/fetch.d.ts.map +1 -1
  115. package/lib/src/client/api/types.d.ts +9 -3
  116. package/lib/src/client/api/types.d.ts.map +1 -1
  117. package/lib/src/client/api/view-server/api-view-server.d.ts.map +1 -1
  118. package/lib/src/client/api/view-server/request.d.ts +0 -4
  119. package/lib/src/client/api/view-server/request.d.ts.map +1 -1
  120. package/lib/src/client/database/schema.d.ts +3 -5
  121. package/lib/src/client/database/schema.d.ts.map +1 -1
  122. package/lib/src/client/database/service.d.ts +1 -0
  123. package/lib/src/client/database/service.d.ts.map +1 -1
  124. package/lib/src/client/remote/decompression.d.ts +1 -1
  125. package/lib/src/client/remote/remoteLogFile.d.ts.map +1 -1
  126. package/lib/src/client/remote/remotePendingSampleData.d.ts.map +1 -1
  127. package/lib/src/client/remote/remoteZipFile.d.ts +4 -19
  128. package/lib/src/client/remote/remoteZipFile.d.ts.map +1 -1
  129. package/lib/src/client/remote/zstd-decoder.d.ts +20 -0
  130. package/lib/src/client/remote/zstd-decoder.d.ts.map +1 -0
  131. package/lib/src/client/remote/zstd-worker-code.d.ts +1 -1
  132. package/lib/src/client/remote/zstd-worker-code.d.ts.map +1 -1
  133. package/lib/src/client/remote/zstd-worker.d.ts +23 -8
  134. package/lib/src/client/remote/zstd-worker.d.ts.map +1 -1
  135. package/lib/src/client/utils/derive.d.ts +3 -0
  136. package/lib/src/client/utils/derive.d.ts.map +1 -1
  137. package/lib/src/client/utils/normalize.d.ts +19 -3
  138. package/lib/src/client/utils/normalize.d.ts.map +1 -1
  139. package/lib/src/components/CodePanel.d.ts.map +1 -1
  140. package/lib/src/constants.d.ts +1 -0
  141. package/lib/src/constants.d.ts.map +1 -1
  142. package/lib/src/log_data/fetchEngine.d.ts +13 -2
  143. package/lib/src/log_data/fetchEngine.d.ts.map +1 -1
  144. package/lib/src/log_data/logsContent.d.ts +3 -2
  145. package/lib/src/log_data/logsContent.d.ts.map +1 -1
  146. package/lib/src/log_data/runningSampleQuery.d.ts.map +1 -1
  147. package/lib/src/log_data/sampleSummaries.d.ts.map +1 -1
  148. package/lib/src/log_data/samplesListing.d.ts +3 -0
  149. package/lib/src/log_data/samplesListing.d.ts.map +1 -1
  150. package/lib/src/state/actions.d.ts.map +1 -1
  151. package/lib/src/state/hooks.d.ts +1 -0
  152. package/lib/src/state/hooks.d.ts.map +1 -1
  153. package/lib/src/test/nodeBlobWorker.d.ts +2 -0
  154. package/lib/src/test/nodeBlobWorker.d.ts.map +1 -0
  155. package/lib/src/utils/format.d.ts +0 -6
  156. package/lib/src/utils/format.d.ts.map +1 -1
  157. package/lib/src-s8Cexy_j.js +9977 -0
  158. package/lib/src-s8Cexy_j.js.map +1 -0
  159. package/lib/styles/index.css +2840 -1492
  160. package/lib/type-CI-Mc4Kw.js +29 -0
  161. package/lib/type-CI-Mc4Kw.js.map +1 -0
  162. package/package.json +27 -28
  163. package/lib/src/app/log-view/useShowTimeline.d.ts +0 -24
  164. package/lib/src/app/log-view/useShowTimeline.d.ts.map +0 -1
  165. package/lib/src/utils/html.d.ts +0 -6
  166. package/lib/src/utils/html.d.ts.map +0 -1
  167. package/lib/src/utils/markdown.d.ts +0 -16
  168. package/lib/src/utils/markdown.d.ts.map +0 -1
@@ -0,0 +1,1927 @@
1
+ import { t as __commonJSMin } from "./rolldown-runtime-B-lAHAz2.js";
2
+ import "./src-s8Cexy_j.js";
3
+ import { r as isRecord } from "./type-CI-Mc4Kw.js";
4
+ //#region ../../packages/react/src/hooks/prismManual.ts
5
+ var existing = Reflect.get(globalThis, "Prism");
6
+ if (isRecord(existing)) existing.manual = true;
7
+ else Reflect.set(globalThis, "Prism", { manual: true });
8
+ /**
9
+ * Prism: Lightweight, robust, elegant syntax highlighting
10
+ *
11
+ * @license MIT <https://opensource.org/licenses/MIT>
12
+ * @author Lea Verou <https://lea.verou.me>
13
+ * @namespace
14
+ * @public
15
+ */
16
+ //#endregion
17
+ //#region ../../node_modules/.pnpm/prismjs@1.30.0/node_modules/prismjs/components/prism-bash.js
18
+ var import_prism = (/* @__PURE__ */ __commonJSMin(((exports, module) => {
19
+ var Prism = function(_self) {
20
+ var lang = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i;
21
+ var uniqueId = 0;
22
+ var plainTextGrammar = {};
23
+ var _ = {
24
+ /**
25
+ * By default, Prism will attempt to highlight all code elements (by calling {@link Prism.highlightAll}) on the
26
+ * current page after the page finished loading. This might be a problem if e.g. you wanted to asynchronously load
27
+ * additional languages or plugins yourself.
28
+ *
29
+ * By setting this value to `true`, Prism will not automatically highlight all code elements on the page.
30
+ *
31
+ * You obviously have to change this value before the automatic highlighting started. To do this, you can add an
32
+ * empty Prism object into the global scope before loading the Prism script like this:
33
+ *
34
+ * ```js
35
+ * window.Prism = window.Prism || {};
36
+ * Prism.manual = true;
37
+ * // add a new <script> to load Prism's script
38
+ * ```
39
+ *
40
+ * @default false
41
+ * @type {boolean}
42
+ * @memberof Prism
43
+ * @public
44
+ */
45
+ manual: _self.Prism && _self.Prism.manual,
46
+ /**
47
+ * By default, if Prism is in a web worker, it assumes that it is in a worker it created itself, so it uses
48
+ * `addEventListener` to communicate with its parent instance. However, if you're using Prism manually in your
49
+ * own worker, you don't want it to do this.
50
+ *
51
+ * By setting this value to `true`, Prism will not add its own listeners to the worker.
52
+ *
53
+ * You obviously have to change this value before Prism executes. To do this, you can add an
54
+ * empty Prism object into the global scope before loading the Prism script like this:
55
+ *
56
+ * ```js
57
+ * window.Prism = window.Prism || {};
58
+ * Prism.disableWorkerMessageHandler = true;
59
+ * // Load Prism's script
60
+ * ```
61
+ *
62
+ * @default false
63
+ * @type {boolean}
64
+ * @memberof Prism
65
+ * @public
66
+ */
67
+ disableWorkerMessageHandler: _self.Prism && _self.Prism.disableWorkerMessageHandler,
68
+ /**
69
+ * A namespace for utility methods.
70
+ *
71
+ * All function in this namespace that are not explicitly marked as _public_ are for __internal use only__ and may
72
+ * change or disappear at any time.
73
+ *
74
+ * @namespace
75
+ * @memberof Prism
76
+ */
77
+ util: {
78
+ encode: function encode(tokens) {
79
+ if (tokens instanceof Token) return new Token(tokens.type, encode(tokens.content), tokens.alias);
80
+ else if (Array.isArray(tokens)) return tokens.map(encode);
81
+ else return tokens.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/\u00a0/g, " ");
82
+ },
83
+ /**
84
+ * Returns the name of the type of the given value.
85
+ *
86
+ * @param {any} o
87
+ * @returns {string}
88
+ * @example
89
+ * type(null) === 'Null'
90
+ * type(undefined) === 'Undefined'
91
+ * type(123) === 'Number'
92
+ * type('foo') === 'String'
93
+ * type(true) === 'Boolean'
94
+ * type([1, 2]) === 'Array'
95
+ * type({}) === 'Object'
96
+ * type(String) === 'Function'
97
+ * type(/abc+/) === 'RegExp'
98
+ */
99
+ type: function(o) {
100
+ return Object.prototype.toString.call(o).slice(8, -1);
101
+ },
102
+ /**
103
+ * Returns a unique number for the given object. Later calls will still return the same number.
104
+ *
105
+ * @param {Object} obj
106
+ * @returns {number}
107
+ */
108
+ objId: function(obj) {
109
+ if (!obj["__id"]) Object.defineProperty(obj, "__id", { value: ++uniqueId });
110
+ return obj["__id"];
111
+ },
112
+ /**
113
+ * Creates a deep clone of the given object.
114
+ *
115
+ * The main intended use of this function is to clone language definitions.
116
+ *
117
+ * @param {T} o
118
+ * @param {Record<number, any>} [visited]
119
+ * @returns {T}
120
+ * @template T
121
+ */
122
+ clone: function deepClone(o, visited) {
123
+ visited = visited || {};
124
+ var clone;
125
+ var id;
126
+ switch (_.util.type(o)) {
127
+ case "Object":
128
+ id = _.util.objId(o);
129
+ if (visited[id]) return visited[id];
130
+ clone = {};
131
+ visited[id] = clone;
132
+ for (var key in o) if (o.hasOwnProperty(key)) clone[key] = deepClone(o[key], visited);
133
+ return clone;
134
+ case "Array":
135
+ id = _.util.objId(o);
136
+ if (visited[id]) return visited[id];
137
+ clone = [];
138
+ visited[id] = clone;
139
+ o.forEach(function(v, i) {
140
+ clone[i] = deepClone(v, visited);
141
+ });
142
+ return clone;
143
+ default: return o;
144
+ }
145
+ },
146
+ /**
147
+ * Returns the Prism language of the given element set by a `language-xxxx` or `lang-xxxx` class.
148
+ *
149
+ * If no language is set for the element or the element is `null` or `undefined`, `none` will be returned.
150
+ *
151
+ * @param {Element} element
152
+ * @returns {string}
153
+ */
154
+ getLanguage: function(element) {
155
+ while (element) {
156
+ var m = lang.exec(element.className);
157
+ if (m) return m[1].toLowerCase();
158
+ element = element.parentElement;
159
+ }
160
+ return "none";
161
+ },
162
+ /**
163
+ * Sets the Prism `language-xxxx` class of the given element.
164
+ *
165
+ * @param {Element} element
166
+ * @param {string} language
167
+ * @returns {void}
168
+ */
169
+ setLanguage: function(element, language) {
170
+ element.className = element.className.replace(RegExp(lang, "gi"), "");
171
+ element.classList.add("language-" + language);
172
+ },
173
+ /**
174
+ * Returns the script element that is currently executing.
175
+ *
176
+ * This does __not__ work for line script element.
177
+ *
178
+ * @returns {HTMLScriptElement | null}
179
+ */
180
+ currentScript: function() {
181
+ if (typeof document === "undefined") return null;
182
+ if (document.currentScript && document.currentScript.tagName === "SCRIPT" && true) return document.currentScript;
183
+ try {
184
+ throw new Error();
185
+ } catch (err) {
186
+ var src = (/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(err.stack) || [])[1];
187
+ if (src) {
188
+ var scripts = document.getElementsByTagName("script");
189
+ for (var i in scripts) if (scripts[i].src == src) return scripts[i];
190
+ }
191
+ return null;
192
+ }
193
+ },
194
+ /**
195
+ * Returns whether a given class is active for `element`.
196
+ *
197
+ * The class can be activated if `element` or one of its ancestors has the given class and it can be deactivated
198
+ * if `element` or one of its ancestors has the negated version of the given class. The _negated version_ of the
199
+ * given class is just the given class with a `no-` prefix.
200
+ *
201
+ * Whether the class is active is determined by the closest ancestor of `element` (where `element` itself is
202
+ * closest ancestor) that has the given class or the negated version of it. If neither `element` nor any of its
203
+ * ancestors have the given class or the negated version of it, then the default activation will be returned.
204
+ *
205
+ * In the paradoxical situation where the closest ancestor contains __both__ the given class and the negated
206
+ * version of it, the class is considered active.
207
+ *
208
+ * @param {Element} element
209
+ * @param {string} className
210
+ * @param {boolean} [defaultActivation=false]
211
+ * @returns {boolean}
212
+ */
213
+ isActive: function(element, className, defaultActivation) {
214
+ var no = "no-" + className;
215
+ while (element) {
216
+ var classList = element.classList;
217
+ if (classList.contains(className)) return true;
218
+ if (classList.contains(no)) return false;
219
+ element = element.parentElement;
220
+ }
221
+ return !!defaultActivation;
222
+ }
223
+ },
224
+ /**
225
+ * This namespace contains all currently loaded languages and the some helper functions to create and modify languages.
226
+ *
227
+ * @namespace
228
+ * @memberof Prism
229
+ * @public
230
+ */
231
+ languages: {
232
+ /**
233
+ * The grammar for plain, unformatted text.
234
+ */
235
+ plain: plainTextGrammar,
236
+ plaintext: plainTextGrammar,
237
+ text: plainTextGrammar,
238
+ txt: plainTextGrammar,
239
+ /**
240
+ * Creates a deep copy of the language with the given id and appends the given tokens.
241
+ *
242
+ * If a token in `redef` also appears in the copied language, then the existing token in the copied language
243
+ * will be overwritten at its original position.
244
+ *
245
+ * ## Best practices
246
+ *
247
+ * Since the position of overwriting tokens (token in `redef` that overwrite tokens in the copied language)
248
+ * doesn't matter, they can technically be in any order. However, this can be confusing to others that trying to
249
+ * understand the language definition because, normally, the order of tokens matters in Prism grammars.
250
+ *
251
+ * Therefore, it is encouraged to order overwriting tokens according to the positions of the overwritten tokens.
252
+ * Furthermore, all non-overwriting tokens should be placed after the overwriting ones.
253
+ *
254
+ * @param {string} id The id of the language to extend. This has to be a key in `Prism.languages`.
255
+ * @param {Grammar} redef The new tokens to append.
256
+ * @returns {Grammar} The new language created.
257
+ * @public
258
+ * @example
259
+ * Prism.languages['css-with-colors'] = Prism.languages.extend('css', {
260
+ * // Prism.languages.css already has a 'comment' token, so this token will overwrite CSS' 'comment' token
261
+ * // at its original position
262
+ * 'comment': { ... },
263
+ * // CSS doesn't have a 'color' token, so this token will be appended
264
+ * 'color': /\b(?:red|green|blue)\b/
265
+ * });
266
+ */
267
+ extend: function(id, redef) {
268
+ var lang = _.util.clone(_.languages[id]);
269
+ for (var key in redef) lang[key] = redef[key];
270
+ return lang;
271
+ },
272
+ /**
273
+ * Inserts tokens _before_ another token in a language definition or any other grammar.
274
+ *
275
+ * ## Usage
276
+ *
277
+ * This helper method makes it easy to modify existing languages. For example, the CSS language definition
278
+ * not only defines CSS highlighting for CSS documents, but also needs to define highlighting for CSS embedded
279
+ * in HTML through `<style>` elements. To do this, it needs to modify `Prism.languages.markup` and add the
280
+ * appropriate tokens. However, `Prism.languages.markup` is a regular JavaScript object literal, so if you do
281
+ * this:
282
+ *
283
+ * ```js
284
+ * Prism.languages.markup.style = {
285
+ * // token
286
+ * };
287
+ * ```
288
+ *
289
+ * then the `style` token will be added (and processed) at the end. `insertBefore` allows you to insert tokens
290
+ * before existing tokens. For the CSS example above, you would use it like this:
291
+ *
292
+ * ```js
293
+ * Prism.languages.insertBefore('markup', 'cdata', {
294
+ * 'style': {
295
+ * // token
296
+ * }
297
+ * });
298
+ * ```
299
+ *
300
+ * ## Special cases
301
+ *
302
+ * If the grammars of `inside` and `insert` have tokens with the same name, the tokens in `inside`'s grammar
303
+ * will be ignored.
304
+ *
305
+ * This behavior can be used to insert tokens after `before`:
306
+ *
307
+ * ```js
308
+ * Prism.languages.insertBefore('markup', 'comment', {
309
+ * 'comment': Prism.languages.markup.comment,
310
+ * // tokens after 'comment'
311
+ * });
312
+ * ```
313
+ *
314
+ * ## Limitations
315
+ *
316
+ * The main problem `insertBefore` has to solve is iteration order. Since ES2015, the iteration order for object
317
+ * properties is guaranteed to be the insertion order (except for integer keys) but some browsers behave
318
+ * differently when keys are deleted and re-inserted. So `insertBefore` can't be implemented by temporarily
319
+ * deleting properties which is necessary to insert at arbitrary positions.
320
+ *
321
+ * To solve this problem, `insertBefore` doesn't actually insert the given tokens into the target object.
322
+ * Instead, it will create a new object and replace all references to the target object with the new one. This
323
+ * can be done without temporarily deleting properties, so the iteration order is well-defined.
324
+ *
325
+ * However, only references that can be reached from `Prism.languages` or `insert` will be replaced. I.e. if
326
+ * you hold the target object in a variable, then the value of the variable will not change.
327
+ *
328
+ * ```js
329
+ * var oldMarkup = Prism.languages.markup;
330
+ * var newMarkup = Prism.languages.insertBefore('markup', 'comment', { ... });
331
+ *
332
+ * assert(oldMarkup !== Prism.languages.markup);
333
+ * assert(newMarkup === Prism.languages.markup);
334
+ * ```
335
+ *
336
+ * @param {string} inside The property of `root` (e.g. a language id in `Prism.languages`) that contains the
337
+ * object to be modified.
338
+ * @param {string} before The key to insert before.
339
+ * @param {Grammar} insert An object containing the key-value pairs to be inserted.
340
+ * @param {Object<string, any>} [root] The object containing `inside`, i.e. the object that contains the
341
+ * object to be modified.
342
+ *
343
+ * Defaults to `Prism.languages`.
344
+ * @returns {Grammar} The new grammar object.
345
+ * @public
346
+ */
347
+ insertBefore: function(inside, before, insert, root) {
348
+ root = root || _.languages;
349
+ var grammar = root[inside];
350
+ /** @type {Grammar} */
351
+ var ret = {};
352
+ for (var token in grammar) if (grammar.hasOwnProperty(token)) {
353
+ if (token == before) {
354
+ for (var newToken in insert) if (insert.hasOwnProperty(newToken)) ret[newToken] = insert[newToken];
355
+ }
356
+ if (!insert.hasOwnProperty(token)) ret[token] = grammar[token];
357
+ }
358
+ var old = root[inside];
359
+ root[inside] = ret;
360
+ _.languages.DFS(_.languages, function(key, value) {
361
+ if (value === old && key != inside) this[key] = ret;
362
+ });
363
+ return ret;
364
+ },
365
+ DFS: function DFS(o, callback, type, visited) {
366
+ visited = visited || {};
367
+ var objId = _.util.objId;
368
+ for (var i in o) if (o.hasOwnProperty(i)) {
369
+ callback.call(o, i, o[i], type || i);
370
+ var property = o[i];
371
+ var propertyType = _.util.type(property);
372
+ if (propertyType === "Object" && !visited[objId(property)]) {
373
+ visited[objId(property)] = true;
374
+ DFS(property, callback, null, visited);
375
+ } else if (propertyType === "Array" && !visited[objId(property)]) {
376
+ visited[objId(property)] = true;
377
+ DFS(property, callback, i, visited);
378
+ }
379
+ }
380
+ }
381
+ },
382
+ plugins: {},
383
+ /**
384
+ * This is the most high-level function in Prism’s API.
385
+ * It fetches all the elements that have a `.language-xxxx` class and then calls {@link Prism.highlightElement} on
386
+ * each one of them.
387
+ *
388
+ * This is equivalent to `Prism.highlightAllUnder(document, async, callback)`.
389
+ *
390
+ * @param {boolean} [async=false] Same as in {@link Prism.highlightAllUnder}.
391
+ * @param {HighlightCallback} [callback] Same as in {@link Prism.highlightAllUnder}.
392
+ * @memberof Prism
393
+ * @public
394
+ */
395
+ highlightAll: function(async, callback) {
396
+ _.highlightAllUnder(document, async, callback);
397
+ },
398
+ /**
399
+ * Fetches all the descendants of `container` that have a `.language-xxxx` class and then calls
400
+ * {@link Prism.highlightElement} on each one of them.
401
+ *
402
+ * The following hooks will be run:
403
+ * 1. `before-highlightall`
404
+ * 2. `before-all-elements-highlight`
405
+ * 3. All hooks of {@link Prism.highlightElement} for each element.
406
+ *
407
+ * @param {ParentNode} container The root element, whose descendants that have a `.language-xxxx` class will be highlighted.
408
+ * @param {boolean} [async=false] Whether each element is to be highlighted asynchronously using Web Workers.
409
+ * @param {HighlightCallback} [callback] An optional callback to be invoked on each element after its highlighting is done.
410
+ * @memberof Prism
411
+ * @public
412
+ */
413
+ highlightAllUnder: function(container, async, callback) {
414
+ var env = {
415
+ callback,
416
+ container,
417
+ selector: "code[class*=\"language-\"], [class*=\"language-\"] code, code[class*=\"lang-\"], [class*=\"lang-\"] code"
418
+ };
419
+ _.hooks.run("before-highlightall", env);
420
+ env.elements = Array.prototype.slice.apply(env.container.querySelectorAll(env.selector));
421
+ _.hooks.run("before-all-elements-highlight", env);
422
+ for (var i = 0, element; element = env.elements[i++];) _.highlightElement(element, async === true, env.callback);
423
+ },
424
+ /**
425
+ * Highlights the code inside a single element.
426
+ *
427
+ * The following hooks will be run:
428
+ * 1. `before-sanity-check`
429
+ * 2. `before-highlight`
430
+ * 3. All hooks of {@link Prism.highlight}. These hooks will be run by an asynchronous worker if `async` is `true`.
431
+ * 4. `before-insert`
432
+ * 5. `after-highlight`
433
+ * 6. `complete`
434
+ *
435
+ * Some the above hooks will be skipped if the element doesn't contain any text or there is no grammar loaded for
436
+ * the element's language.
437
+ *
438
+ * @param {Element} element The element containing the code.
439
+ * It must have a class of `language-xxxx` to be processed, where `xxxx` is a valid language identifier.
440
+ * @param {boolean} [async=false] Whether the element is to be highlighted asynchronously using Web Workers
441
+ * to improve performance and avoid blocking the UI when highlighting very large chunks of code. This option is
442
+ * [disabled by default](https://prismjs.com/faq.html#why-is-asynchronous-highlighting-disabled-by-default).
443
+ *
444
+ * Note: All language definitions required to highlight the code must be included in the main `prism.js` file for
445
+ * asynchronous highlighting to work. You can build your own bundle on the
446
+ * [Download page](https://prismjs.com/download.html).
447
+ * @param {HighlightCallback} [callback] An optional callback to be invoked after the highlighting is done.
448
+ * Mostly useful when `async` is `true`, since in that case, the highlighting is done asynchronously.
449
+ * @memberof Prism
450
+ * @public
451
+ */
452
+ highlightElement: function(element, async, callback) {
453
+ var language = _.util.getLanguage(element);
454
+ var grammar = _.languages[language];
455
+ _.util.setLanguage(element, language);
456
+ var parent = element.parentElement;
457
+ if (parent && parent.nodeName.toLowerCase() === "pre") _.util.setLanguage(parent, language);
458
+ var env = {
459
+ element,
460
+ language,
461
+ grammar,
462
+ code: element.textContent
463
+ };
464
+ function insertHighlightedCode(highlightedCode) {
465
+ env.highlightedCode = highlightedCode;
466
+ _.hooks.run("before-insert", env);
467
+ env.element.innerHTML = env.highlightedCode;
468
+ _.hooks.run("after-highlight", env);
469
+ _.hooks.run("complete", env);
470
+ callback && callback.call(env.element);
471
+ }
472
+ _.hooks.run("before-sanity-check", env);
473
+ parent = env.element.parentElement;
474
+ if (parent && parent.nodeName.toLowerCase() === "pre" && !parent.hasAttribute("tabindex")) parent.setAttribute("tabindex", "0");
475
+ if (!env.code) {
476
+ _.hooks.run("complete", env);
477
+ callback && callback.call(env.element);
478
+ return;
479
+ }
480
+ _.hooks.run("before-highlight", env);
481
+ if (!env.grammar) {
482
+ insertHighlightedCode(_.util.encode(env.code));
483
+ return;
484
+ }
485
+ if (async && _self.Worker) {
486
+ var worker = new Worker(_.filename);
487
+ worker.onmessage = function(evt) {
488
+ insertHighlightedCode(evt.data);
489
+ };
490
+ worker.postMessage(JSON.stringify({
491
+ language: env.language,
492
+ code: env.code,
493
+ immediateClose: true
494
+ }));
495
+ } else insertHighlightedCode(_.highlight(env.code, env.grammar, env.language));
496
+ },
497
+ /**
498
+ * Low-level function, only use if you know what you’re doing. It accepts a string of text as input
499
+ * and the language definitions to use, and returns a string with the HTML produced.
500
+ *
501
+ * The following hooks will be run:
502
+ * 1. `before-tokenize`
503
+ * 2. `after-tokenize`
504
+ * 3. `wrap`: On each {@link Token}.
505
+ *
506
+ * @param {string} text A string with the code to be highlighted.
507
+ * @param {Grammar} grammar An object containing the tokens to use.
508
+ *
509
+ * Usually a language definition like `Prism.languages.markup`.
510
+ * @param {string} language The name of the language definition passed to `grammar`.
511
+ * @returns {string} The highlighted HTML.
512
+ * @memberof Prism
513
+ * @public
514
+ * @example
515
+ * Prism.highlight('var foo = true;', Prism.languages.javascript, 'javascript');
516
+ */
517
+ highlight: function(text, grammar, language) {
518
+ var env = {
519
+ code: text,
520
+ grammar,
521
+ language
522
+ };
523
+ _.hooks.run("before-tokenize", env);
524
+ if (!env.grammar) throw new Error("The language \"" + env.language + "\" has no grammar.");
525
+ env.tokens = _.tokenize(env.code, env.grammar);
526
+ _.hooks.run("after-tokenize", env);
527
+ return Token.stringify(_.util.encode(env.tokens), env.language);
528
+ },
529
+ /**
530
+ * This is the heart of Prism, and the most low-level function you can use. It accepts a string of text as input
531
+ * and the language definitions to use, and returns an array with the tokenized code.
532
+ *
533
+ * When the language definition includes nested tokens, the function is called recursively on each of these tokens.
534
+ *
535
+ * This method could be useful in other contexts as well, as a very crude parser.
536
+ *
537
+ * @param {string} text A string with the code to be highlighted.
538
+ * @param {Grammar} grammar An object containing the tokens to use.
539
+ *
540
+ * Usually a language definition like `Prism.languages.markup`.
541
+ * @returns {TokenStream} An array of strings and tokens, a token stream.
542
+ * @memberof Prism
543
+ * @public
544
+ * @example
545
+ * let code = `var foo = 0;`;
546
+ * let tokens = Prism.tokenize(code, Prism.languages.javascript);
547
+ * tokens.forEach(token => {
548
+ * if (token instanceof Prism.Token && token.type === 'number') {
549
+ * console.log(`Found numeric literal: ${token.content}`);
550
+ * }
551
+ * });
552
+ */
553
+ tokenize: function(text, grammar) {
554
+ var rest = grammar.rest;
555
+ if (rest) {
556
+ for (var token in rest) grammar[token] = rest[token];
557
+ delete grammar.rest;
558
+ }
559
+ var tokenList = new LinkedList();
560
+ addAfter(tokenList, tokenList.head, text);
561
+ matchGrammar(text, tokenList, grammar, tokenList.head, 0);
562
+ return toArray(tokenList);
563
+ },
564
+ /**
565
+ * @namespace
566
+ * @memberof Prism
567
+ * @public
568
+ */
569
+ hooks: {
570
+ all: {},
571
+ /**
572
+ * Adds the given callback to the list of callbacks for the given hook.
573
+ *
574
+ * The callback will be invoked when the hook it is registered for is run.
575
+ * Hooks are usually directly run by a highlight function but you can also run hooks yourself.
576
+ *
577
+ * One callback function can be registered to multiple hooks and the same hook multiple times.
578
+ *
579
+ * @param {string} name The name of the hook.
580
+ * @param {HookCallback} callback The callback function which is given environment variables.
581
+ * @public
582
+ */
583
+ add: function(name, callback) {
584
+ var hooks = _.hooks.all;
585
+ hooks[name] = hooks[name] || [];
586
+ hooks[name].push(callback);
587
+ },
588
+ /**
589
+ * Runs a hook invoking all registered callbacks with the given environment variables.
590
+ *
591
+ * Callbacks will be invoked synchronously and in the order in which they were registered.
592
+ *
593
+ * @param {string} name The name of the hook.
594
+ * @param {Object<string, any>} env The environment variables of the hook passed to all callbacks registered.
595
+ * @public
596
+ */
597
+ run: function(name, env) {
598
+ var callbacks = _.hooks.all[name];
599
+ if (!callbacks || !callbacks.length) return;
600
+ for (var i = 0, callback; callback = callbacks[i++];) callback(env);
601
+ }
602
+ },
603
+ Token
604
+ };
605
+ _self.Prism = _;
606
+ /**
607
+ * Creates a new token.
608
+ *
609
+ * @param {string} type See {@link Token#type type}
610
+ * @param {string | TokenStream} content See {@link Token#content content}
611
+ * @param {string|string[]} [alias] The alias(es) of the token.
612
+ * @param {string} [matchedStr=""] A copy of the full string this token was created from.
613
+ * @class
614
+ * @global
615
+ * @public
616
+ */
617
+ function Token(type, content, alias, matchedStr) {
618
+ /**
619
+ * The type of the token.
620
+ *
621
+ * This is usually the key of a pattern in a {@link Grammar}.
622
+ *
623
+ * @type {string}
624
+ * @see GrammarToken
625
+ * @public
626
+ */
627
+ this.type = type;
628
+ /**
629
+ * The strings or tokens contained by this token.
630
+ *
631
+ * This will be a token stream if the pattern matched also defined an `inside` grammar.
632
+ *
633
+ * @type {string | TokenStream}
634
+ * @public
635
+ */
636
+ this.content = content;
637
+ /**
638
+ * The alias(es) of the token.
639
+ *
640
+ * @type {string|string[]}
641
+ * @see GrammarToken
642
+ * @public
643
+ */
644
+ this.alias = alias;
645
+ this.length = (matchedStr || "").length | 0;
646
+ }
647
+ /**
648
+ * A token stream is an array of strings and {@link Token Token} objects.
649
+ *
650
+ * Token streams have to fulfill a few properties that are assumed by most functions (mostly internal ones) that process
651
+ * them.
652
+ *
653
+ * 1. No adjacent strings.
654
+ * 2. No empty strings.
655
+ *
656
+ * The only exception here is the token stream that only contains the empty string and nothing else.
657
+ *
658
+ * @typedef {Array<string | Token>} TokenStream
659
+ * @global
660
+ * @public
661
+ */
662
+ /**
663
+ * Converts the given token or token stream to an HTML representation.
664
+ *
665
+ * The following hooks will be run:
666
+ * 1. `wrap`: On each {@link Token}.
667
+ *
668
+ * @param {string | Token | TokenStream} o The token or token stream to be converted.
669
+ * @param {string} language The name of current language.
670
+ * @returns {string} The HTML representation of the token or token stream.
671
+ * @memberof Token
672
+ * @static
673
+ */
674
+ Token.stringify = function stringify(o, language) {
675
+ if (typeof o == "string") return o;
676
+ if (Array.isArray(o)) {
677
+ var s = "";
678
+ o.forEach(function(e) {
679
+ s += stringify(e, language);
680
+ });
681
+ return s;
682
+ }
683
+ var env = {
684
+ type: o.type,
685
+ content: stringify(o.content, language),
686
+ tag: "span",
687
+ classes: ["token", o.type],
688
+ attributes: {},
689
+ language
690
+ };
691
+ var aliases = o.alias;
692
+ if (aliases) {
693
+ if (Array.isArray(aliases)) Array.prototype.push.apply(env.classes, aliases);
694
+ else env.classes.push(aliases);
695
+ }
696
+ _.hooks.run("wrap", env);
697
+ var attributes = "";
698
+ for (var name in env.attributes) attributes += " " + name + "=\"" + (env.attributes[name] || "").replace(/"/g, "&quot;") + "\"";
699
+ return "<" + env.tag + " class=\"" + env.classes.join(" ") + "\"" + attributes + ">" + env.content + "</" + env.tag + ">";
700
+ };
701
+ /**
702
+ * @param {RegExp} pattern
703
+ * @param {number} pos
704
+ * @param {string} text
705
+ * @param {boolean} lookbehind
706
+ * @returns {RegExpExecArray | null}
707
+ */
708
+ function matchPattern(pattern, pos, text, lookbehind) {
709
+ pattern.lastIndex = pos;
710
+ var match = pattern.exec(text);
711
+ if (match && lookbehind && match[1]) {
712
+ var lookbehindLength = match[1].length;
713
+ match.index += lookbehindLength;
714
+ match[0] = match[0].slice(lookbehindLength);
715
+ }
716
+ return match;
717
+ }
718
+ /**
719
+ * @param {string} text
720
+ * @param {LinkedList<string | Token>} tokenList
721
+ * @param {any} grammar
722
+ * @param {LinkedListNode<string | Token>} startNode
723
+ * @param {number} startPos
724
+ * @param {RematchOptions} [rematch]
725
+ * @returns {void}
726
+ * @private
727
+ *
728
+ * @typedef RematchOptions
729
+ * @property {string} cause
730
+ * @property {number} reach
731
+ */
732
+ function matchGrammar(text, tokenList, grammar, startNode, startPos, rematch) {
733
+ for (var token in grammar) {
734
+ if (!grammar.hasOwnProperty(token) || !grammar[token]) continue;
735
+ var patterns = grammar[token];
736
+ patterns = Array.isArray(patterns) ? patterns : [patterns];
737
+ for (var j = 0; j < patterns.length; ++j) {
738
+ if (rematch && rematch.cause == token + "," + j) return;
739
+ var patternObj = patterns[j];
740
+ var inside = patternObj.inside;
741
+ var lookbehind = !!patternObj.lookbehind;
742
+ var greedy = !!patternObj.greedy;
743
+ var alias = patternObj.alias;
744
+ if (greedy && !patternObj.pattern.global) {
745
+ var flags = patternObj.pattern.toString().match(/[imsuy]*$/)[0];
746
+ patternObj.pattern = RegExp(patternObj.pattern.source, flags + "g");
747
+ }
748
+ /** @type {RegExp} */
749
+ var pattern = patternObj.pattern || patternObj;
750
+ for (var currentNode = startNode.next, pos = startPos; currentNode !== tokenList.tail; pos += currentNode.value.length, currentNode = currentNode.next) {
751
+ if (rematch && pos >= rematch.reach) break;
752
+ var str = currentNode.value;
753
+ if (tokenList.length > text.length) return;
754
+ if (str instanceof Token) continue;
755
+ var removeCount = 1;
756
+ var match;
757
+ if (greedy) {
758
+ match = matchPattern(pattern, pos, text, lookbehind);
759
+ if (!match || match.index >= text.length) break;
760
+ var from = match.index;
761
+ var to = match.index + match[0].length;
762
+ var p = pos;
763
+ p += currentNode.value.length;
764
+ while (from >= p) {
765
+ currentNode = currentNode.next;
766
+ p += currentNode.value.length;
767
+ }
768
+ p -= currentNode.value.length;
769
+ pos = p;
770
+ if (currentNode.value instanceof Token) continue;
771
+ for (var k = currentNode; k !== tokenList.tail && (p < to || typeof k.value === "string"); k = k.next) {
772
+ removeCount++;
773
+ p += k.value.length;
774
+ }
775
+ removeCount--;
776
+ str = text.slice(pos, p);
777
+ match.index -= pos;
778
+ } else {
779
+ match = matchPattern(pattern, 0, str, lookbehind);
780
+ if (!match) continue;
781
+ }
782
+ var from = match.index;
783
+ var matchStr = match[0];
784
+ var before = str.slice(0, from);
785
+ var after = str.slice(from + matchStr.length);
786
+ var reach = pos + str.length;
787
+ if (rematch && reach > rematch.reach) rematch.reach = reach;
788
+ var removeFrom = currentNode.prev;
789
+ if (before) {
790
+ removeFrom = addAfter(tokenList, removeFrom, before);
791
+ pos += before.length;
792
+ }
793
+ removeRange(tokenList, removeFrom, removeCount);
794
+ var wrapped = new Token(token, inside ? _.tokenize(matchStr, inside) : matchStr, alias, matchStr);
795
+ currentNode = addAfter(tokenList, removeFrom, wrapped);
796
+ if (after) addAfter(tokenList, currentNode, after);
797
+ if (removeCount > 1) {
798
+ /** @type {RematchOptions} */
799
+ var nestedRematch = {
800
+ cause: token + "," + j,
801
+ reach
802
+ };
803
+ matchGrammar(text, tokenList, grammar, currentNode.prev, pos, nestedRematch);
804
+ if (rematch && nestedRematch.reach > rematch.reach) rematch.reach = nestedRematch.reach;
805
+ }
806
+ }
807
+ }
808
+ }
809
+ }
810
+ /**
811
+ * @typedef LinkedListNode
812
+ * @property {T} value
813
+ * @property {LinkedListNode<T> | null} prev The previous node.
814
+ * @property {LinkedListNode<T> | null} next The next node.
815
+ * @template T
816
+ * @private
817
+ */
818
+ /**
819
+ * @template T
820
+ * @private
821
+ */
822
+ function LinkedList() {
823
+ /** @type {LinkedListNode<T>} */
824
+ var head = {
825
+ value: null,
826
+ prev: null,
827
+ next: null
828
+ };
829
+ /** @type {LinkedListNode<T>} */
830
+ var tail = {
831
+ value: null,
832
+ prev: head,
833
+ next: null
834
+ };
835
+ head.next = tail;
836
+ /** @type {LinkedListNode<T>} */
837
+ this.head = head;
838
+ /** @type {LinkedListNode<T>} */
839
+ this.tail = tail;
840
+ this.length = 0;
841
+ }
842
+ /**
843
+ * Adds a new node with the given value to the list.
844
+ *
845
+ * @param {LinkedList<T>} list
846
+ * @param {LinkedListNode<T>} node
847
+ * @param {T} value
848
+ * @returns {LinkedListNode<T>} The added node.
849
+ * @template T
850
+ */
851
+ function addAfter(list, node, value) {
852
+ var next = node.next;
853
+ var newNode = {
854
+ value,
855
+ prev: node,
856
+ next
857
+ };
858
+ node.next = newNode;
859
+ next.prev = newNode;
860
+ list.length++;
861
+ return newNode;
862
+ }
863
+ /**
864
+ * Removes `count` nodes after the given node. The given node will not be removed.
865
+ *
866
+ * @param {LinkedList<T>} list
867
+ * @param {LinkedListNode<T>} node
868
+ * @param {number} count
869
+ * @template T
870
+ */
871
+ function removeRange(list, node, count) {
872
+ var next = node.next;
873
+ for (var i = 0; i < count && next !== list.tail; i++) next = next.next;
874
+ node.next = next;
875
+ next.prev = node;
876
+ list.length -= i;
877
+ }
878
+ /**
879
+ * @param {LinkedList<T>} list
880
+ * @returns {T[]}
881
+ * @template T
882
+ */
883
+ function toArray(list) {
884
+ var array = [];
885
+ var node = list.head.next;
886
+ while (node !== list.tail) {
887
+ array.push(node.value);
888
+ node = node.next;
889
+ }
890
+ return array;
891
+ }
892
+ if (!_self.document) {
893
+ if (!_self.addEventListener) return _;
894
+ if (!_.disableWorkerMessageHandler) _self.addEventListener("message", function(evt) {
895
+ var message = JSON.parse(evt.data);
896
+ var lang = message.language;
897
+ var code = message.code;
898
+ var immediateClose = message.immediateClose;
899
+ _self.postMessage(_.highlight(code, _.languages[lang], lang));
900
+ if (immediateClose) _self.close();
901
+ }, false);
902
+ return _;
903
+ }
904
+ var script = _.util.currentScript();
905
+ if (script) {
906
+ _.filename = script.src;
907
+ if (script.hasAttribute("data-manual")) _.manual = true;
908
+ }
909
+ function highlightAutomaticallyCallback() {
910
+ if (!_.manual) _.highlightAll();
911
+ }
912
+ if (!_.manual) {
913
+ var readyState = document.readyState;
914
+ if (readyState === "loading" || readyState === "interactive" && script && script.defer) document.addEventListener("DOMContentLoaded", highlightAutomaticallyCallback);
915
+ else if (window.requestAnimationFrame) window.requestAnimationFrame(highlightAutomaticallyCallback);
916
+ else window.setTimeout(highlightAutomaticallyCallback, 16);
917
+ }
918
+ return _;
919
+ }(typeof window !== "undefined" ? window : typeof WorkerGlobalScope !== "undefined" && self instanceof WorkerGlobalScope ? self : {});
920
+ if (typeof module !== "undefined" && module.exports) module.exports = Prism;
921
+ if (typeof global !== "undefined") global.Prism = Prism;
922
+ /**
923
+ * The expansion of a simple `RegExp` literal to support additional properties.
924
+ *
925
+ * @typedef GrammarToken
926
+ * @property {RegExp} pattern The regular expression of the token.
927
+ * @property {boolean} [lookbehind=false] If `true`, then the first capturing group of `pattern` will (effectively)
928
+ * behave as a lookbehind group meaning that the captured text will not be part of the matched text of the new token.
929
+ * @property {boolean} [greedy=false] Whether the token is greedy.
930
+ * @property {string|string[]} [alias] An optional alias or list of aliases.
931
+ * @property {Grammar} [inside] The nested grammar of this token.
932
+ *
933
+ * The `inside` grammar will be used to tokenize the text value of each token of this kind.
934
+ *
935
+ * This can be used to make nested and even recursive language definitions.
936
+ *
937
+ * Note: This can cause infinite recursion. Be careful when you embed different languages or even the same language into
938
+ * each another.
939
+ * @global
940
+ * @public
941
+ */
942
+ /**
943
+ * @typedef Grammar
944
+ * @type {Object<string, RegExp | GrammarToken | Array<RegExp | GrammarToken>>}
945
+ * @property {Grammar} [rest] An optional grammar object that will be appended to this grammar.
946
+ * @global
947
+ * @public
948
+ */
949
+ /**
950
+ * A function which will invoked after an element was successfully highlighted.
951
+ *
952
+ * @callback HighlightCallback
953
+ * @param {Element} element The element successfully highlighted.
954
+ * @returns {void}
955
+ * @global
956
+ * @public
957
+ */
958
+ /**
959
+ * @callback HookCallback
960
+ * @param {Object<string, any>} env The environment variables of the hook.
961
+ * @returns {void}
962
+ * @global
963
+ * @public
964
+ */
965
+ Prism.languages.markup = {
966
+ "comment": {
967
+ pattern: /<!--(?:(?!<!--)[\s\S])*?-->/,
968
+ greedy: true
969
+ },
970
+ "prolog": {
971
+ pattern: /<\?[\s\S]+?\?>/,
972
+ greedy: true
973
+ },
974
+ "doctype": {
975
+ pattern: /<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,
976
+ greedy: true,
977
+ inside: {
978
+ "internal-subset": {
979
+ pattern: /(^[^\[]*\[)[\s\S]+(?=\]>$)/,
980
+ lookbehind: true,
981
+ greedy: true,
982
+ inside: null
983
+ },
984
+ "string": {
985
+ pattern: /"[^"]*"|'[^']*'/,
986
+ greedy: true
987
+ },
988
+ "punctuation": /^<!|>$|[[\]]/,
989
+ "doctype-tag": /^DOCTYPE/i,
990
+ "name": /[^\s<>'"]+/
991
+ }
992
+ },
993
+ "cdata": {
994
+ pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
995
+ greedy: true
996
+ },
997
+ "tag": {
998
+ pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,
999
+ greedy: true,
1000
+ inside: {
1001
+ "tag": {
1002
+ pattern: /^<\/?[^\s>\/]+/,
1003
+ inside: {
1004
+ "punctuation": /^<\/?/,
1005
+ "namespace": /^[^\s>\/:]+:/
1006
+ }
1007
+ },
1008
+ "special-attr": [],
1009
+ "attr-value": {
1010
+ pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,
1011
+ inside: { "punctuation": [{
1012
+ pattern: /^=/,
1013
+ alias: "attr-equals"
1014
+ }, {
1015
+ pattern: /^(\s*)["']|["']$/,
1016
+ lookbehind: true
1017
+ }] }
1018
+ },
1019
+ "punctuation": /\/?>/,
1020
+ "attr-name": {
1021
+ pattern: /[^\s>\/]+/,
1022
+ inside: { "namespace": /^[^\s>\/:]+:/ }
1023
+ }
1024
+ }
1025
+ },
1026
+ "entity": [{
1027
+ pattern: /&[\da-z]{1,8};/i,
1028
+ alias: "named-entity"
1029
+ }, /&#x?[\da-f]{1,8};/i]
1030
+ };
1031
+ Prism.languages.markup["tag"].inside["attr-value"].inside["entity"] = Prism.languages.markup["entity"];
1032
+ Prism.languages.markup["doctype"].inside["internal-subset"].inside = Prism.languages.markup;
1033
+ Prism.hooks.add("wrap", function(env) {
1034
+ if (env.type === "entity") env.attributes["title"] = env.content.replace(/&amp;/, "&");
1035
+ });
1036
+ Object.defineProperty(Prism.languages.markup.tag, "addInlined", {
1037
+ /**
1038
+ * Adds an inlined language to markup.
1039
+ *
1040
+ * An example of an inlined language is CSS with `<style>` tags.
1041
+ *
1042
+ * @param {string} tagName The name of the tag that contains the inlined language. This name will be treated as
1043
+ * case insensitive.
1044
+ * @param {string} lang The language key.
1045
+ * @example
1046
+ * addInlined('style', 'css');
1047
+ */
1048
+ value: function addInlined(tagName, lang) {
1049
+ var includedCdataInside = {};
1050
+ includedCdataInside["language-" + lang] = {
1051
+ pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
1052
+ lookbehind: true,
1053
+ inside: Prism.languages[lang]
1054
+ };
1055
+ includedCdataInside["cdata"] = /^<!\[CDATA\[|\]\]>$/i;
1056
+ var inside = { "included-cdata": {
1057
+ pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
1058
+ inside: includedCdataInside
1059
+ } };
1060
+ inside["language-" + lang] = {
1061
+ pattern: /[\s\S]+/,
1062
+ inside: Prism.languages[lang]
1063
+ };
1064
+ var def = {};
1065
+ def[tagName] = {
1066
+ pattern: RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g, function() {
1067
+ return tagName;
1068
+ }), "i"),
1069
+ lookbehind: true,
1070
+ greedy: true,
1071
+ inside
1072
+ };
1073
+ Prism.languages.insertBefore("markup", "cdata", def);
1074
+ } });
1075
+ Object.defineProperty(Prism.languages.markup.tag, "addAttribute", {
1076
+ /**
1077
+ * Adds an pattern to highlight languages embedded in HTML attributes.
1078
+ *
1079
+ * An example of an inlined language is CSS with `style` attributes.
1080
+ *
1081
+ * @param {string} attrName The name of the tag that contains the inlined language. This name will be treated as
1082
+ * case insensitive.
1083
+ * @param {string} lang The language key.
1084
+ * @example
1085
+ * addAttribute('style', 'css');
1086
+ */
1087
+ value: function(attrName, lang) {
1088
+ Prism.languages.markup.tag.inside["special-attr"].push({
1089
+ pattern: RegExp(/(^|["'\s])/.source + "(?:" + attrName + ")" + /\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source, "i"),
1090
+ lookbehind: true,
1091
+ inside: {
1092
+ "attr-name": /^[^\s=]+/,
1093
+ "attr-value": {
1094
+ pattern: /=[\s\S]+/,
1095
+ inside: {
1096
+ "value": {
1097
+ pattern: /(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,
1098
+ lookbehind: true,
1099
+ alias: [lang, "language-" + lang],
1100
+ inside: Prism.languages[lang]
1101
+ },
1102
+ "punctuation": [{
1103
+ pattern: /^=/,
1104
+ alias: "attr-equals"
1105
+ }, /"|'/]
1106
+ }
1107
+ }
1108
+ }
1109
+ });
1110
+ } });
1111
+ Prism.languages.html = Prism.languages.markup;
1112
+ Prism.languages.mathml = Prism.languages.markup;
1113
+ Prism.languages.svg = Prism.languages.markup;
1114
+ Prism.languages.xml = Prism.languages.extend("markup", {});
1115
+ Prism.languages.ssml = Prism.languages.xml;
1116
+ Prism.languages.atom = Prism.languages.xml;
1117
+ Prism.languages.rss = Prism.languages.xml;
1118
+ (function(Prism) {
1119
+ var string = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
1120
+ Prism.languages.css = {
1121
+ "comment": /\/\*[\s\S]*?\*\//,
1122
+ "atrule": {
1123
+ pattern: RegExp("@[\\w-](?:" + /[^;{\s"']|\s+(?!\s)/.source + "|" + string.source + ")*?" + /(?:;|(?=\s*\{))/.source),
1124
+ inside: {
1125
+ "rule": /^@[\w-]+/,
1126
+ "selector-function-argument": {
1127
+ pattern: /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,
1128
+ lookbehind: true,
1129
+ alias: "selector"
1130
+ },
1131
+ "keyword": {
1132
+ pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/,
1133
+ lookbehind: true
1134
+ }
1135
+ }
1136
+ },
1137
+ "url": {
1138
+ pattern: RegExp("\\burl\\((?:" + string.source + "|" + /(?:[^\\\r\n()"']|\\[\s\S])*/.source + ")\\)", "i"),
1139
+ greedy: true,
1140
+ inside: {
1141
+ "function": /^url/i,
1142
+ "punctuation": /^\(|\)$/,
1143
+ "string": {
1144
+ pattern: RegExp("^" + string.source + "$"),
1145
+ alias: "url"
1146
+ }
1147
+ }
1148
+ },
1149
+ "selector": {
1150
+ pattern: RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|" + string.source + ")*(?=\\s*\\{)"),
1151
+ lookbehind: true
1152
+ },
1153
+ "string": {
1154
+ pattern: string,
1155
+ greedy: true
1156
+ },
1157
+ "property": {
1158
+ pattern: /(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,
1159
+ lookbehind: true
1160
+ },
1161
+ "important": /!important\b/i,
1162
+ "function": {
1163
+ pattern: /(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,
1164
+ lookbehind: true
1165
+ },
1166
+ "punctuation": /[(){};:,]/
1167
+ };
1168
+ Prism.languages.css["atrule"].inside.rest = Prism.languages.css;
1169
+ var markup = Prism.languages.markup;
1170
+ if (markup) {
1171
+ markup.tag.addInlined("style", "css");
1172
+ markup.tag.addAttribute("style", "css");
1173
+ }
1174
+ })(Prism);
1175
+ Prism.languages.clike = {
1176
+ "comment": [{
1177
+ pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
1178
+ lookbehind: true,
1179
+ greedy: true
1180
+ }, {
1181
+ pattern: /(^|[^\\:])\/\/.*/,
1182
+ lookbehind: true,
1183
+ greedy: true
1184
+ }],
1185
+ "string": {
1186
+ pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
1187
+ greedy: true
1188
+ },
1189
+ "class-name": {
1190
+ pattern: /(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,
1191
+ lookbehind: true,
1192
+ inside: { "punctuation": /[.\\]/ }
1193
+ },
1194
+ "keyword": /\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,
1195
+ "boolean": /\b(?:false|true)\b/,
1196
+ "function": /\b\w+(?=\()/,
1197
+ "number": /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
1198
+ "operator": /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
1199
+ "punctuation": /[{}[\];(),.:]/
1200
+ };
1201
+ Prism.languages.javascript = Prism.languages.extend("clike", {
1202
+ "class-name": [Prism.languages.clike["class-name"], {
1203
+ pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,
1204
+ lookbehind: true
1205
+ }],
1206
+ "keyword": [{
1207
+ pattern: /((?:^|\})\s*)catch\b/,
1208
+ lookbehind: true
1209
+ }, {
1210
+ pattern: /(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,
1211
+ lookbehind: true
1212
+ }],
1213
+ "function": /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,
1214
+ "number": {
1215
+ pattern: RegExp(/(^|[^\w$])/.source + "(?:" + (/NaN|Infinity/.source + "|" + /0[bB][01]+(?:_[01]+)*n?/.source + "|" + /0[oO][0-7]+(?:_[0-7]+)*n?/.source + "|" + /0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source + "|" + /\d+(?:_\d+)*n/.source + "|" + /(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source) + ")" + /(?![\w$])/.source),
1216
+ lookbehind: true
1217
+ },
1218
+ "operator": /--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/
1219
+ });
1220
+ Prism.languages.javascript["class-name"][0].pattern = /(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;
1221
+ Prism.languages.insertBefore("javascript", "keyword", {
1222
+ "regex": {
1223
+ pattern: RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source + /\//.source + "(?:" + /(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source + "|" + /(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source + ")" + /(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),
1224
+ lookbehind: true,
1225
+ greedy: true,
1226
+ inside: {
1227
+ "regex-source": {
1228
+ pattern: /^(\/)[\s\S]+(?=\/[a-z]*$)/,
1229
+ lookbehind: true,
1230
+ alias: "language-regex",
1231
+ inside: Prism.languages.regex
1232
+ },
1233
+ "regex-delimiter": /^\/|\/$/,
1234
+ "regex-flags": /^[a-z]+$/
1235
+ }
1236
+ },
1237
+ "function-variable": {
1238
+ pattern: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,
1239
+ alias: "function"
1240
+ },
1241
+ "parameter": [
1242
+ {
1243
+ pattern: /(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,
1244
+ lookbehind: true,
1245
+ inside: Prism.languages.javascript
1246
+ },
1247
+ {
1248
+ pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,
1249
+ lookbehind: true,
1250
+ inside: Prism.languages.javascript
1251
+ },
1252
+ {
1253
+ pattern: /(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,
1254
+ lookbehind: true,
1255
+ inside: Prism.languages.javascript
1256
+ },
1257
+ {
1258
+ pattern: /((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,
1259
+ lookbehind: true,
1260
+ inside: Prism.languages.javascript
1261
+ }
1262
+ ],
1263
+ "constant": /\b[A-Z](?:[A-Z_]|\dx?)*\b/
1264
+ });
1265
+ Prism.languages.insertBefore("javascript", "string", {
1266
+ "hashbang": {
1267
+ pattern: /^#!.*/,
1268
+ greedy: true,
1269
+ alias: "comment"
1270
+ },
1271
+ "template-string": {
1272
+ pattern: /`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,
1273
+ greedy: true,
1274
+ inside: {
1275
+ "template-punctuation": {
1276
+ pattern: /^`|`$/,
1277
+ alias: "string"
1278
+ },
1279
+ "interpolation": {
1280
+ pattern: /((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,
1281
+ lookbehind: true,
1282
+ inside: {
1283
+ "interpolation-punctuation": {
1284
+ pattern: /^\$\{|\}$/,
1285
+ alias: "punctuation"
1286
+ },
1287
+ rest: Prism.languages.javascript
1288
+ }
1289
+ },
1290
+ "string": /[\s\S]+/
1291
+ }
1292
+ },
1293
+ "string-property": {
1294
+ pattern: /((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,
1295
+ lookbehind: true,
1296
+ greedy: true,
1297
+ alias: "property"
1298
+ }
1299
+ });
1300
+ Prism.languages.insertBefore("javascript", "operator", { "literal-property": {
1301
+ pattern: /((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,
1302
+ lookbehind: true,
1303
+ alias: "property"
1304
+ } });
1305
+ if (Prism.languages.markup) {
1306
+ Prism.languages.markup.tag.addInlined("script", "javascript");
1307
+ Prism.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source, "javascript");
1308
+ }
1309
+ Prism.languages.js = Prism.languages.javascript;
1310
+ (function() {
1311
+ if (typeof Prism === "undefined" || typeof document === "undefined") return;
1312
+ if (!Element.prototype.matches) Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
1313
+ var LOADING_MESSAGE = "Loading…";
1314
+ var FAILURE_MESSAGE = function(status, message) {
1315
+ return "✖ Error " + status + " while fetching file: " + message;
1316
+ };
1317
+ var FAILURE_EMPTY_MESSAGE = "✖ Error: File does not exist or is empty";
1318
+ var EXTENSIONS = {
1319
+ "js": "javascript",
1320
+ "py": "python",
1321
+ "rb": "ruby",
1322
+ "ps1": "powershell",
1323
+ "psm1": "powershell",
1324
+ "sh": "bash",
1325
+ "bat": "batch",
1326
+ "h": "c",
1327
+ "tex": "latex"
1328
+ };
1329
+ var STATUS_ATTR = "data-src-status";
1330
+ var STATUS_LOADING = "loading";
1331
+ var STATUS_LOADED = "loaded";
1332
+ var STATUS_FAILED = "failed";
1333
+ var SELECTOR = "pre[data-src]:not([" + STATUS_ATTR + "=\"" + STATUS_LOADED + "\"]):not([" + STATUS_ATTR + "=\"" + STATUS_LOADING + "\"])";
1334
+ /**
1335
+ * Loads the given file.
1336
+ *
1337
+ * @param {string} src The URL or path of the source file to load.
1338
+ * @param {(result: string) => void} success
1339
+ * @param {(reason: string) => void} error
1340
+ */
1341
+ function loadFile(src, success, error) {
1342
+ var xhr = new XMLHttpRequest();
1343
+ xhr.open("GET", src, true);
1344
+ xhr.onreadystatechange = function() {
1345
+ if (xhr.readyState == 4) {
1346
+ if (xhr.status < 400 && xhr.responseText) success(xhr.responseText);
1347
+ else if (xhr.status >= 400) error(FAILURE_MESSAGE(xhr.status, xhr.statusText));
1348
+ else error(FAILURE_EMPTY_MESSAGE);
1349
+ }
1350
+ };
1351
+ xhr.send(null);
1352
+ }
1353
+ /**
1354
+ * Parses the given range.
1355
+ *
1356
+ * This returns a range with inclusive ends.
1357
+ *
1358
+ * @param {string | null | undefined} range
1359
+ * @returns {[number, number | undefined] | undefined}
1360
+ */
1361
+ function parseRange(range) {
1362
+ var m = /^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(range || "");
1363
+ if (m) {
1364
+ var start = Number(m[1]);
1365
+ var comma = m[2];
1366
+ var end = m[3];
1367
+ if (!comma) return [start, start];
1368
+ if (!end) return [start, void 0];
1369
+ return [start, Number(end)];
1370
+ }
1371
+ }
1372
+ Prism.hooks.add("before-highlightall", function(env) {
1373
+ env.selector += ", " + SELECTOR;
1374
+ });
1375
+ Prism.hooks.add("before-sanity-check", function(env) {
1376
+ var pre = env.element;
1377
+ if (pre.matches(SELECTOR)) {
1378
+ env.code = "";
1379
+ pre.setAttribute(STATUS_ATTR, STATUS_LOADING);
1380
+ var code = pre.appendChild(document.createElement("CODE"));
1381
+ code.textContent = LOADING_MESSAGE;
1382
+ var src = pre.getAttribute("data-src");
1383
+ var language = env.language;
1384
+ if (language === "none") {
1385
+ var extension = (/\.(\w+)$/.exec(src) || [, "none"])[1];
1386
+ language = EXTENSIONS[extension] || extension;
1387
+ }
1388
+ Prism.util.setLanguage(code, language);
1389
+ Prism.util.setLanguage(pre, language);
1390
+ var autoloader = Prism.plugins.autoloader;
1391
+ if (autoloader) autoloader.loadLanguages(language);
1392
+ loadFile(src, function(text) {
1393
+ pre.setAttribute(STATUS_ATTR, STATUS_LOADED);
1394
+ var range = parseRange(pre.getAttribute("data-range"));
1395
+ if (range) {
1396
+ var lines = text.split(/\r\n?|\n/g);
1397
+ var start = range[0];
1398
+ var end = range[1] == null ? lines.length : range[1];
1399
+ if (start < 0) start += lines.length;
1400
+ start = Math.max(0, Math.min(start - 1, lines.length));
1401
+ if (end < 0) end += lines.length;
1402
+ end = Math.max(0, Math.min(end, lines.length));
1403
+ text = lines.slice(start, end).join("\n");
1404
+ if (!pre.hasAttribute("data-start")) pre.setAttribute("data-start", String(start + 1));
1405
+ }
1406
+ code.textContent = text;
1407
+ Prism.highlightElement(code);
1408
+ }, function(error) {
1409
+ pre.setAttribute(STATUS_ATTR, STATUS_FAILED);
1410
+ code.textContent = error;
1411
+ });
1412
+ }
1413
+ });
1414
+ Prism.plugins.fileHighlight = {
1415
+ /**
1416
+ * Executes the File Highlight plugin for all matching `pre` elements under the given container.
1417
+ *
1418
+ * Note: Elements which are already loaded or currently loading will not be touched by this method.
1419
+ *
1420
+ * @param {ParentNode} [container=document]
1421
+ */
1422
+ highlight: function highlight(container) {
1423
+ var elements = (container || document).querySelectorAll(SELECTOR);
1424
+ for (var i = 0, element; element = elements[i++];) Prism.highlightElement(element);
1425
+ } };
1426
+ var logged = false;
1427
+ /** @deprecated Use `Prism.plugins.fileHighlight.highlight` instead. */
1428
+ Prism.fileHighlight = function() {
1429
+ if (!logged) {
1430
+ console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead.");
1431
+ logged = true;
1432
+ }
1433
+ Prism.plugins.fileHighlight.highlight.apply(this, arguments);
1434
+ };
1435
+ })();
1436
+ })))();
1437
+ (function(Prism) {
1438
+ var envVars = "\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b";
1439
+ var commandAfterHeredoc = {
1440
+ pattern: /(^(["']?)\w+\2)[ \t]+\S.*/,
1441
+ lookbehind: true,
1442
+ alias: "punctuation",
1443
+ inside: null
1444
+ };
1445
+ var insideString = {
1446
+ "bash": commandAfterHeredoc,
1447
+ "environment": {
1448
+ pattern: RegExp("\\$" + envVars),
1449
+ alias: "constant"
1450
+ },
1451
+ "variable": [
1452
+ {
1453
+ pattern: /\$?\(\([\s\S]+?\)\)/,
1454
+ greedy: true,
1455
+ inside: {
1456
+ "variable": [{
1457
+ pattern: /(^\$\(\([\s\S]+)\)\)/,
1458
+ lookbehind: true
1459
+ }, /^\$\(\(/],
1460
+ "number": /\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,
1461
+ "operator": /--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,
1462
+ "punctuation": /\(\(?|\)\)?|,|;/
1463
+ }
1464
+ },
1465
+ {
1466
+ pattern: /\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,
1467
+ greedy: true,
1468
+ inside: { "variable": /^\$\(|^`|\)$|`$/ }
1469
+ },
1470
+ {
1471
+ pattern: /\$\{[^}]+\}/,
1472
+ greedy: true,
1473
+ inside: {
1474
+ "operator": /:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,
1475
+ "punctuation": /[\[\]]/,
1476
+ "environment": {
1477
+ pattern: RegExp("(\\{)" + envVars),
1478
+ lookbehind: true,
1479
+ alias: "constant"
1480
+ }
1481
+ }
1482
+ },
1483
+ /\$(?:\w+|[#?*!@$])/
1484
+ ],
1485
+ "entity": /\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/
1486
+ };
1487
+ Prism.languages.bash = {
1488
+ "shebang": {
1489
+ pattern: /^#!\s*\/.*/,
1490
+ alias: "important"
1491
+ },
1492
+ "comment": {
1493
+ pattern: /(^|[^"{\\$])#.*/,
1494
+ lookbehind: true
1495
+ },
1496
+ "function-name": [{
1497
+ pattern: /(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,
1498
+ lookbehind: true,
1499
+ alias: "function"
1500
+ }, {
1501
+ pattern: /\b[\w-]+(?=\s*\(\s*\)\s*\{)/,
1502
+ alias: "function"
1503
+ }],
1504
+ "for-or-select": {
1505
+ pattern: /(\b(?:for|select)\s+)\w+(?=\s+in\s)/,
1506
+ alias: "variable",
1507
+ lookbehind: true
1508
+ },
1509
+ "assign-left": {
1510
+ pattern: /(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,
1511
+ inside: { "environment": {
1512
+ pattern: RegExp("(^|[\\s;|&]|[<>]\\()" + envVars),
1513
+ lookbehind: true,
1514
+ alias: "constant"
1515
+ } },
1516
+ alias: "variable",
1517
+ lookbehind: true
1518
+ },
1519
+ "parameter": {
1520
+ pattern: /(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,
1521
+ alias: "variable",
1522
+ lookbehind: true
1523
+ },
1524
+ "string": [
1525
+ {
1526
+ pattern: /((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,
1527
+ lookbehind: true,
1528
+ greedy: true,
1529
+ inside: insideString
1530
+ },
1531
+ {
1532
+ pattern: /((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,
1533
+ lookbehind: true,
1534
+ greedy: true,
1535
+ inside: { "bash": commandAfterHeredoc }
1536
+ },
1537
+ {
1538
+ pattern: /(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,
1539
+ lookbehind: true,
1540
+ greedy: true,
1541
+ inside: insideString
1542
+ },
1543
+ {
1544
+ pattern: /(^|[^$\\])'[^']*'/,
1545
+ lookbehind: true,
1546
+ greedy: true
1547
+ },
1548
+ {
1549
+ pattern: /\$'(?:[^'\\]|\\[\s\S])*'/,
1550
+ greedy: true,
1551
+ inside: { "entity": insideString.entity }
1552
+ }
1553
+ ],
1554
+ "environment": {
1555
+ pattern: RegExp("\\$?" + envVars),
1556
+ alias: "constant"
1557
+ },
1558
+ "variable": insideString.variable,
1559
+ "function": {
1560
+ pattern: /(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,
1561
+ lookbehind: true
1562
+ },
1563
+ "keyword": {
1564
+ pattern: /(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,
1565
+ lookbehind: true
1566
+ },
1567
+ "builtin": {
1568
+ pattern: /(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,
1569
+ lookbehind: true,
1570
+ alias: "class-name"
1571
+ },
1572
+ "boolean": {
1573
+ pattern: /(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,
1574
+ lookbehind: true
1575
+ },
1576
+ "file-descriptor": {
1577
+ pattern: /\B&\d\b/,
1578
+ alias: "important"
1579
+ },
1580
+ "operator": {
1581
+ pattern: /\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,
1582
+ inside: { "file-descriptor": {
1583
+ pattern: /^\d/,
1584
+ alias: "important"
1585
+ } }
1586
+ },
1587
+ "punctuation": /\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,
1588
+ "number": {
1589
+ pattern: /(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,
1590
+ lookbehind: true
1591
+ }
1592
+ };
1593
+ commandAfterHeredoc.inside = Prism.languages.bash;
1594
+ var toBeCopied = [
1595
+ "comment",
1596
+ "function-name",
1597
+ "for-or-select",
1598
+ "assign-left",
1599
+ "parameter",
1600
+ "string",
1601
+ "environment",
1602
+ "function",
1603
+ "keyword",
1604
+ "builtin",
1605
+ "boolean",
1606
+ "file-descriptor",
1607
+ "operator",
1608
+ "punctuation",
1609
+ "number"
1610
+ ];
1611
+ var inside = insideString.variable[1].inside;
1612
+ for (var i = 0; i < toBeCopied.length; i++) inside[toBeCopied[i]] = Prism.languages.bash[toBeCopied[i]];
1613
+ Prism.languages.sh = Prism.languages.bash;
1614
+ Prism.languages.shell = Prism.languages.bash;
1615
+ })(Prism);
1616
+ //#endregion
1617
+ //#region ../../node_modules/.pnpm/prismjs@1.30.0/node_modules/prismjs/components/prism-clike.js
1618
+ Prism.languages.clike = {
1619
+ "comment": [{
1620
+ pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
1621
+ lookbehind: true,
1622
+ greedy: true
1623
+ }, {
1624
+ pattern: /(^|[^\\:])\/\/.*/,
1625
+ lookbehind: true,
1626
+ greedy: true
1627
+ }],
1628
+ "string": {
1629
+ pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
1630
+ greedy: true
1631
+ },
1632
+ "class-name": {
1633
+ pattern: /(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,
1634
+ lookbehind: true,
1635
+ inside: { "punctuation": /[.\\]/ }
1636
+ },
1637
+ "keyword": /\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,
1638
+ "boolean": /\b(?:false|true)\b/,
1639
+ "function": /\b\w+(?=\()/,
1640
+ "number": /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
1641
+ "operator": /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
1642
+ "punctuation": /[{}[\];(),.:]/
1643
+ };
1644
+ //#endregion
1645
+ //#region ../../node_modules/.pnpm/prismjs@1.30.0/node_modules/prismjs/components/prism-javascript.js
1646
+ Prism.languages.javascript = Prism.languages.extend("clike", {
1647
+ "class-name": [Prism.languages.clike["class-name"], {
1648
+ pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,
1649
+ lookbehind: true
1650
+ }],
1651
+ "keyword": [{
1652
+ pattern: /((?:^|\})\s*)catch\b/,
1653
+ lookbehind: true
1654
+ }, {
1655
+ pattern: /(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,
1656
+ lookbehind: true
1657
+ }],
1658
+ "function": /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,
1659
+ "number": {
1660
+ pattern: RegExp(/(^|[^\w$])/.source + "(?:" + (/NaN|Infinity/.source + "|" + /0[bB][01]+(?:_[01]+)*n?/.source + "|" + /0[oO][0-7]+(?:_[0-7]+)*n?/.source + "|" + /0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source + "|" + /\d+(?:_\d+)*n/.source + "|" + /(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source) + ")" + /(?![\w$])/.source),
1661
+ lookbehind: true
1662
+ },
1663
+ "operator": /--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/
1664
+ });
1665
+ Prism.languages.javascript["class-name"][0].pattern = /(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;
1666
+ Prism.languages.insertBefore("javascript", "keyword", {
1667
+ "regex": {
1668
+ pattern: RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source + /\//.source + "(?:" + /(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source + "|" + /(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source + ")" + /(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),
1669
+ lookbehind: true,
1670
+ greedy: true,
1671
+ inside: {
1672
+ "regex-source": {
1673
+ pattern: /^(\/)[\s\S]+(?=\/[a-z]*$)/,
1674
+ lookbehind: true,
1675
+ alias: "language-regex",
1676
+ inside: Prism.languages.regex
1677
+ },
1678
+ "regex-delimiter": /^\/|\/$/,
1679
+ "regex-flags": /^[a-z]+$/
1680
+ }
1681
+ },
1682
+ "function-variable": {
1683
+ pattern: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,
1684
+ alias: "function"
1685
+ },
1686
+ "parameter": [
1687
+ {
1688
+ pattern: /(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,
1689
+ lookbehind: true,
1690
+ inside: Prism.languages.javascript
1691
+ },
1692
+ {
1693
+ pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,
1694
+ lookbehind: true,
1695
+ inside: Prism.languages.javascript
1696
+ },
1697
+ {
1698
+ pattern: /(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,
1699
+ lookbehind: true,
1700
+ inside: Prism.languages.javascript
1701
+ },
1702
+ {
1703
+ pattern: /((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,
1704
+ lookbehind: true,
1705
+ inside: Prism.languages.javascript
1706
+ }
1707
+ ],
1708
+ "constant": /\b[A-Z](?:[A-Z_]|\dx?)*\b/
1709
+ });
1710
+ Prism.languages.insertBefore("javascript", "string", {
1711
+ "hashbang": {
1712
+ pattern: /^#!.*/,
1713
+ greedy: true,
1714
+ alias: "comment"
1715
+ },
1716
+ "template-string": {
1717
+ pattern: /`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,
1718
+ greedy: true,
1719
+ inside: {
1720
+ "template-punctuation": {
1721
+ pattern: /^`|`$/,
1722
+ alias: "string"
1723
+ },
1724
+ "interpolation": {
1725
+ pattern: /((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,
1726
+ lookbehind: true,
1727
+ inside: {
1728
+ "interpolation-punctuation": {
1729
+ pattern: /^\$\{|\}$/,
1730
+ alias: "punctuation"
1731
+ },
1732
+ rest: Prism.languages.javascript
1733
+ }
1734
+ },
1735
+ "string": /[\s\S]+/
1736
+ }
1737
+ },
1738
+ "string-property": {
1739
+ pattern: /((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,
1740
+ lookbehind: true,
1741
+ greedy: true,
1742
+ alias: "property"
1743
+ }
1744
+ });
1745
+ Prism.languages.insertBefore("javascript", "operator", { "literal-property": {
1746
+ pattern: /((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,
1747
+ lookbehind: true,
1748
+ alias: "property"
1749
+ } });
1750
+ if (Prism.languages.markup) {
1751
+ Prism.languages.markup.tag.addInlined("script", "javascript");
1752
+ Prism.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source, "javascript");
1753
+ }
1754
+ Prism.languages.js = Prism.languages.javascript;
1755
+ //#endregion
1756
+ //#region ../../node_modules/.pnpm/prismjs@1.30.0/node_modules/prismjs/components/prism-json.js
1757
+ Prism.languages.json = {
1758
+ "property": {
1759
+ pattern: /(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,
1760
+ lookbehind: true,
1761
+ greedy: true
1762
+ },
1763
+ "string": {
1764
+ pattern: /(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,
1765
+ lookbehind: true,
1766
+ greedy: true
1767
+ },
1768
+ "comment": {
1769
+ pattern: /\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,
1770
+ greedy: true
1771
+ },
1772
+ "number": /-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,
1773
+ "punctuation": /[{}[\],]/,
1774
+ "operator": /:/,
1775
+ "boolean": /\b(?:false|true)\b/,
1776
+ "null": {
1777
+ pattern: /\bnull\b/,
1778
+ alias: "keyword"
1779
+ }
1780
+ };
1781
+ Prism.languages.webmanifest = Prism.languages.json;
1782
+ //#endregion
1783
+ //#region ../../node_modules/.pnpm/prismjs@1.30.0/node_modules/prismjs/components/prism-python.js
1784
+ Prism.languages.python = {
1785
+ "comment": {
1786
+ pattern: /(^|[^\\])#.*/,
1787
+ lookbehind: true,
1788
+ greedy: true
1789
+ },
1790
+ "string-interpolation": {
1791
+ pattern: /(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,
1792
+ greedy: true,
1793
+ inside: {
1794
+ "interpolation": {
1795
+ pattern: /((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,
1796
+ lookbehind: true,
1797
+ inside: {
1798
+ "format-spec": {
1799
+ pattern: /(:)[^:(){}]+(?=\}$)/,
1800
+ lookbehind: true
1801
+ },
1802
+ "conversion-option": {
1803
+ pattern: /![sra](?=[:}]$)/,
1804
+ alias: "punctuation"
1805
+ },
1806
+ rest: null
1807
+ }
1808
+ },
1809
+ "string": /[\s\S]+/
1810
+ }
1811
+ },
1812
+ "triple-quoted-string": {
1813
+ pattern: /(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,
1814
+ greedy: true,
1815
+ alias: "string"
1816
+ },
1817
+ "string": {
1818
+ pattern: /(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,
1819
+ greedy: true
1820
+ },
1821
+ "function": {
1822
+ pattern: /((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,
1823
+ lookbehind: true
1824
+ },
1825
+ "class-name": {
1826
+ pattern: /(\bclass\s+)\w+/i,
1827
+ lookbehind: true
1828
+ },
1829
+ "decorator": {
1830
+ pattern: /(^[\t ]*)@\w+(?:\.\w+)*/m,
1831
+ lookbehind: true,
1832
+ alias: ["annotation", "punctuation"],
1833
+ inside: { "punctuation": /\./ }
1834
+ },
1835
+ "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/,
1836
+ "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/,
1837
+ "boolean": /\b(?:False|None|True)\b/,
1838
+ "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,
1839
+ "operator": /[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,
1840
+ "punctuation": /[{}[\];(),.:]/
1841
+ };
1842
+ Prism.languages.python["string-interpolation"].inside["interpolation"].inside.rest = Prism.languages.python;
1843
+ Prism.languages.py = Prism.languages.python;
1844
+ //#endregion
1845
+ //#region ../../node_modules/.pnpm/prismjs@1.30.0/node_modules/prismjs/components/prism-yaml.js
1846
+ (function(Prism) {
1847
+ var anchorOrAlias = /[*&][^\s[\]{},]+/;
1848
+ var tag = /!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/;
1849
+ var properties = "(?:" + tag.source + "(?:[ ]+" + anchorOrAlias.source + ")?|" + anchorOrAlias.source + "(?:[ ]+" + tag.source + ")?)";
1850
+ var plainKey = /(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*/.source.replace(/<PLAIN>/g, function() {
1851
+ return /[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source;
1852
+ });
1853
+ var string = /"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;
1854
+ /**
1855
+ *
1856
+ * @param {string} value
1857
+ * @param {string} [flags]
1858
+ * @returns {RegExp}
1859
+ */
1860
+ function createValuePattern(value, flags) {
1861
+ flags = (flags || "").replace(/m/g, "") + "m";
1862
+ var pattern = /([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<<prop>>/g, function() {
1863
+ return properties;
1864
+ }).replace(/<<value>>/g, function() {
1865
+ return value;
1866
+ });
1867
+ return RegExp(pattern, flags);
1868
+ }
1869
+ Prism.languages.yaml = {
1870
+ "scalar": {
1871
+ pattern: RegExp(/([\-:]\s*(?:\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<<prop>>/g, function() {
1872
+ return properties;
1873
+ })),
1874
+ lookbehind: true,
1875
+ alias: "string"
1876
+ },
1877
+ "comment": /#.*/,
1878
+ "key": {
1879
+ pattern: RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source.replace(/<<prop>>/g, function() {
1880
+ return properties;
1881
+ }).replace(/<<key>>/g, function() {
1882
+ return "(?:" + plainKey + "|" + string + ")";
1883
+ })),
1884
+ lookbehind: true,
1885
+ greedy: true,
1886
+ alias: "atrule"
1887
+ },
1888
+ "directive": {
1889
+ pattern: /(^[ \t]*)%.+/m,
1890
+ lookbehind: true,
1891
+ alias: "important"
1892
+ },
1893
+ "datetime": {
1894
+ pattern: createValuePattern(/\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),
1895
+ lookbehind: true,
1896
+ alias: "number"
1897
+ },
1898
+ "boolean": {
1899
+ pattern: createValuePattern(/false|true/.source, "i"),
1900
+ lookbehind: true,
1901
+ alias: "important"
1902
+ },
1903
+ "null": {
1904
+ pattern: createValuePattern(/null|~/.source, "i"),
1905
+ lookbehind: true,
1906
+ alias: "important"
1907
+ },
1908
+ "string": {
1909
+ pattern: createValuePattern(string),
1910
+ lookbehind: true,
1911
+ greedy: true
1912
+ },
1913
+ "number": {
1914
+ pattern: createValuePattern(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source, "i"),
1915
+ lookbehind: true
1916
+ },
1917
+ "tag": tag,
1918
+ "important": anchorOrAlias,
1919
+ "punctuation": /---|[:[\]{}\-,|>?]|\.\.\./
1920
+ };
1921
+ Prism.languages.yml = Prism.languages.yaml;
1922
+ })(Prism);
1923
+ //#endregion
1924
+ var highlightElement = import_prism.highlightElement;
1925
+ export { highlightElement };
1926
+
1927
+ //# sourceMappingURL=prismHighlighter-D-PZtkPX.js.map