@kennethmakjw/appflowy-editor-react19 0.0.1

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 (152) hide show
  1. package/README.md +306 -0
  2. package/dist/ar-SA-B3W2Oswh.cjs +8 -0
  3. package/dist/ar-SA-CaPcPWVS.js +8 -0
  4. package/dist/ca-ES-DehQhAeM.js +8 -0
  5. package/dist/ca-ES-WjpoQZs5.cjs +8 -0
  6. package/dist/ckb-KU-Cc13dwJI.cjs +8 -0
  7. package/dist/ckb-KU-DXz5rZMu.js +8 -0
  8. package/dist/components/Leaf.d.ts +3 -0
  9. package/dist/components/element/BulletedList.d.ts +3 -0
  10. package/dist/components/element/Checkbox.d.ts +3 -0
  11. package/dist/components/element/CodeBlock/index.d.ts +3 -0
  12. package/dist/components/element/CodeBlock/useDecorate.d.ts +3 -0
  13. package/dist/components/element/CodeBlock/utils.d.ts +2 -0
  14. package/dist/components/element/Divider.d.ts +3 -0
  15. package/dist/components/element/Element.d.ts +3 -0
  16. package/dist/components/element/Heading.d.ts +3 -0
  17. package/dist/components/element/Image.d.ts +3 -0
  18. package/dist/components/element/LinkPreview.d.ts +3 -0
  19. package/dist/components/element/NumberedList.d.ts +3 -0
  20. package/dist/components/element/Quote.d.ts +3 -0
  21. package/dist/components/element/Table.d.ts +3 -0
  22. package/dist/components/element/TableCell.d.ts +3 -0
  23. package/dist/components/element/TableRow.d.ts +3 -0
  24. package/dist/components/element/index.d.ts +1 -0
  25. package/dist/components/fixed-toolbar/Aa.d.ts +2 -0
  26. package/dist/components/fixed-toolbar/BIUS.d.ts +4 -0
  27. package/dist/components/fixed-toolbar/Color.d.ts +2 -0
  28. package/dist/components/fixed-toolbar/FixedToolbar.d.ts +2 -0
  29. package/dist/components/fixed-toolbar/List.d.ts +2 -0
  30. package/dist/components/fixed-toolbar/index.d.ts +1 -0
  31. package/dist/components/ui/alert.d.ts +8 -0
  32. package/dist/components/ui/button.d.ts +15 -0
  33. package/dist/components/ui/input.d.ts +3 -0
  34. package/dist/components/ui/label.d.ts +5 -0
  35. package/dist/components/ui/loading-dots.d.ts +4 -0
  36. package/dist/components/ui/popover.d.ts +12 -0
  37. package/dist/components/ui/select.d.ts +13 -0
  38. package/dist/components/ui/separator.d.ts +4 -0
  39. package/dist/components/ui/switch.d.ts +4 -0
  40. package/dist/components/ui/tooltip.d.ts +7 -0
  41. package/dist/cs-CZ-B7cFODNF.js +8 -0
  42. package/dist/cs-CZ-BiGttx8Y.cjs +8 -0
  43. package/dist/de-DE-3L1r5Sau.cjs +8 -0
  44. package/dist/de-DE-CJLJMQlm.js +8 -0
  45. package/dist/dev/App.d.ts +1 -0
  46. package/dist/dev/MarkdownDemo.d.ts +2 -0
  47. package/dist/dev/i18n.d.ts +1 -0
  48. package/dist/dev/main.d.ts +1 -0
  49. package/dist/editor/Editor.d.ts +3 -0
  50. package/dist/editor/RichText.d.ts +12 -0
  51. package/dist/editor/context.d.ts +6 -0
  52. package/dist/editor/index.d.ts +2 -0
  53. package/dist/editor/useEditor.d.ts +5 -0
  54. package/dist/editor/useKeydown.d.ts +3 -0
  55. package/dist/es-VE-IXYuj5s7.js +8 -0
  56. package/dist/es-VE-ZvJoouw6.cjs +8 -0
  57. package/dist/eu-ES-BGs4iMYs.js +8 -0
  58. package/dist/eu-ES-DjInTP04.cjs +8 -0
  59. package/dist/fa-BCkDldDE.js +8 -0
  60. package/dist/fa-BsZBNwW8.cjs +8 -0
  61. package/dist/fr-CA-BlpVaep8.cjs +8 -0
  62. package/dist/fr-CA-v0JzOPW4.js +8 -0
  63. package/dist/fr-FR-CiKan-7_.cjs +8 -0
  64. package/dist/fr-FR-DsF3n-KY.js +8 -0
  65. package/dist/he-BwXJVdkh.cjs +8 -0
  66. package/dist/he-DtMbntw2.js +8 -0
  67. package/dist/hu-HU-B6cP2C9b.cjs +8 -0
  68. package/dist/hu-HU-BIfnlWEM.js +8 -0
  69. package/dist/i18n/config.d.ts +3 -0
  70. package/dist/i18n/index.d.ts +4 -0
  71. package/dist/id-ID-AOveF0gP.js +8 -0
  72. package/dist/id-ID-cZS98QKP.cjs +8 -0
  73. package/dist/index.css +1593 -0
  74. package/dist/index.d.ts +3 -0
  75. package/dist/index.js +10266 -0
  76. package/dist/index.mjs +10250 -0
  77. package/dist/it-IT-DN-rTKuB.js +8 -0
  78. package/dist/it-IT-rGclB8nF.cjs +8 -0
  79. package/dist/ja-JP-BT23Z2YG.js +8 -0
  80. package/dist/ja-JP-DaiwUIKv.cjs +8 -0
  81. package/dist/ko-KR-CBlhTpPW.cjs +8 -0
  82. package/dist/ko-KR-DYwSdomr.js +8 -0
  83. package/dist/lib/color.d.ts +50 -0
  84. package/dist/lib/editor.d.ts +11 -0
  85. package/dist/lib/hotkeys.d.ts +66 -0
  86. package/dist/lib/list.d.ts +6 -0
  87. package/dist/lib/markdown.d.ts +3 -0
  88. package/dist/lib/mdast.d.ts +5 -0
  89. package/dist/lib/mdast.test.d.ts +1 -0
  90. package/dist/lib/transform.d.ts +7 -0
  91. package/dist/lib/utils.d.ts +9 -0
  92. package/dist/locales/ar-SA.json +17 -0
  93. package/dist/locales/ca-ES.json +17 -0
  94. package/dist/locales/ckb-KU.json +5 -0
  95. package/dist/locales/cs-CZ.json +17 -0
  96. package/dist/locales/de-DE.json +17 -0
  97. package/dist/locales/en.json +38 -0
  98. package/dist/locales/es-VE.json +17 -0
  99. package/dist/locales/eu-ES.json +17 -0
  100. package/dist/locales/fa.json +17 -0
  101. package/dist/locales/fr-CA.json +17 -0
  102. package/dist/locales/fr-FR.json +17 -0
  103. package/dist/locales/he.json +17 -0
  104. package/dist/locales/hu-HU.json +17 -0
  105. package/dist/locales/id-ID.json +17 -0
  106. package/dist/locales/it-IT.json +17 -0
  107. package/dist/locales/ja-JP.json +17 -0
  108. package/dist/locales/ko-KR.json +17 -0
  109. package/dist/locales/pl-PL.json +17 -0
  110. package/dist/locales/pt-BR.json +17 -0
  111. package/dist/locales/pt-PT.json +17 -0
  112. package/dist/locales/ru-RU.json +17 -0
  113. package/dist/locales/sv-SE.json +17 -0
  114. package/dist/locales/th-TH.json +17 -0
  115. package/dist/locales/tr-TR.json +17 -0
  116. package/dist/locales/uk-UA.json +17 -0
  117. package/dist/locales/vi-VN.json +17 -0
  118. package/dist/locales/vi.json +17 -0
  119. package/dist/locales/zh-CN.json +17 -0
  120. package/dist/locales/zh-TW.json +17 -0
  121. package/dist/markdown-BidIaSbx.cjs +3274 -0
  122. package/dist/markdown-CeG0xHLH.js +3275 -0
  123. package/dist/pl-PL-C_wxsekf.js +8 -0
  124. package/dist/pl-PL-DBrdwSfX.cjs +8 -0
  125. package/dist/plugins/index.d.ts +2 -0
  126. package/dist/plugins/withMarkdown.d.ts +2 -0
  127. package/dist/plugins/withPasted.d.ts +18 -0
  128. package/dist/pt-BR-CcIBbs5v.js +8 -0
  129. package/dist/pt-BR-CpCH-0Ym.cjs +8 -0
  130. package/dist/pt-PT-2DJTSiTI.js +8 -0
  131. package/dist/pt-PT-CuvXqmHX.cjs +8 -0
  132. package/dist/ru-RU-BcrEOraZ.cjs +8 -0
  133. package/dist/ru-RU-DZ-BGTMT.js +8 -0
  134. package/dist/sv-SE-B-1TVV6s.js +8 -0
  135. package/dist/sv-SE-EHxWN7g5.cjs +8 -0
  136. package/dist/th-TH-B2osIZz0.cjs +8 -0
  137. package/dist/th-TH-HhkGXVcg.js +8 -0
  138. package/dist/tr-TR-DKzjnjXz.js +8 -0
  139. package/dist/tr-TR-DPok6TDa.cjs +8 -0
  140. package/dist/types/element.d.ts +10 -0
  141. package/dist/types/index.d.ts +53 -0
  142. package/dist/uk-UA-CvadWbnH.cjs +8 -0
  143. package/dist/uk-UA-Us4Zq40s.js +8 -0
  144. package/dist/vi-DGchnzC4.cjs +8 -0
  145. package/dist/vi-DV4OvZ5s.js +8 -0
  146. package/dist/vi-VN-BZdQFzYv.js +8 -0
  147. package/dist/vi-VN-DzF53ZQz.cjs +8 -0
  148. package/dist/zh-CN-D7lPKvRq.js +8 -0
  149. package/dist/zh-CN-FWhRTZFL.cjs +8 -0
  150. package/dist/zh-TW-D24z6DBg.js +8 -0
  151. package/dist/zh-TW-DSEvmJwy.cjs +8 -0
  152. package/package.json +103 -0
@@ -0,0 +1,3274 @@
1
+ "use strict";
2
+ var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
3
+ function getDefaultExportFromCjs(x) {
4
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
5
+ }
6
+ var prism = { exports: {} };
7
+ var hasRequiredPrism;
8
+ function requirePrism() {
9
+ if (hasRequiredPrism) return prism.exports;
10
+ hasRequiredPrism = 1;
11
+ (function(module2) {
12
+ var _self = typeof window !== "undefined" ? window : typeof WorkerGlobalScope !== "undefined" && self instanceof WorkerGlobalScope ? self : {};
13
+ /**
14
+ * Prism: Lightweight, robust, elegant syntax highlighting
15
+ *
16
+ * @license MIT <https://opensource.org/licenses/MIT>
17
+ * @author Lea Verou <https://lea.verou.me>
18
+ * @namespace
19
+ * @public
20
+ */
21
+ var Prism2 = function(_self2) {
22
+ var lang = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i;
23
+ var uniqueId = 0;
24
+ var plainTextGrammar = {};
25
+ var _ = {
26
+ /**
27
+ * By default, Prism will attempt to highlight all code elements (by calling {@link Prism.highlightAll}) on the
28
+ * current page after the page finished loading. This might be a problem if e.g. you wanted to asynchronously load
29
+ * additional languages or plugins yourself.
30
+ *
31
+ * By setting this value to `true`, Prism will not automatically highlight all code elements on the page.
32
+ *
33
+ * You obviously have to change this value before the automatic highlighting started. To do this, you can add an
34
+ * empty Prism object into the global scope before loading the Prism script like this:
35
+ *
36
+ * ```js
37
+ * window.Prism = window.Prism || {};
38
+ * Prism.manual = true;
39
+ * // add a new <script> to load Prism's script
40
+ * ```
41
+ *
42
+ * @default false
43
+ * @type {boolean}
44
+ * @memberof Prism
45
+ * @public
46
+ */
47
+ manual: _self2.Prism && _self2.Prism.manual,
48
+ /**
49
+ * By default, if Prism is in a web worker, it assumes that it is in a worker it created itself, so it uses
50
+ * `addEventListener` to communicate with its parent instance. However, if you're using Prism manually in your
51
+ * own worker, you don't want it to do this.
52
+ *
53
+ * By setting this value to `true`, Prism will not add its own listeners to the worker.
54
+ *
55
+ * You obviously have to change this value before Prism executes. To do this, you can add an
56
+ * empty Prism object into the global scope before loading the Prism script like this:
57
+ *
58
+ * ```js
59
+ * window.Prism = window.Prism || {};
60
+ * Prism.disableWorkerMessageHandler = true;
61
+ * // Load Prism's script
62
+ * ```
63
+ *
64
+ * @default false
65
+ * @type {boolean}
66
+ * @memberof Prism
67
+ * @public
68
+ */
69
+ disableWorkerMessageHandler: _self2.Prism && _self2.Prism.disableWorkerMessageHandler,
70
+ /**
71
+ * A namespace for utility methods.
72
+ *
73
+ * All function in this namespace that are not explicitly marked as _public_ are for __internal use only__ and may
74
+ * change or disappear at any time.
75
+ *
76
+ * @namespace
77
+ * @memberof Prism
78
+ */
79
+ util: {
80
+ encode: function encode(tokens) {
81
+ if (tokens instanceof Token) {
82
+ return new Token(tokens.type, encode(tokens.content), tokens.alias);
83
+ } else if (Array.isArray(tokens)) {
84
+ return tokens.map(encode);
85
+ } else {
86
+ return tokens.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/\u00a0/g, " ");
87
+ }
88
+ },
89
+ /**
90
+ * Returns the name of the type of the given value.
91
+ *
92
+ * @param {any} o
93
+ * @returns {string}
94
+ * @example
95
+ * type(null) === 'Null'
96
+ * type(undefined) === 'Undefined'
97
+ * type(123) === 'Number'
98
+ * type('foo') === 'String'
99
+ * type(true) === 'Boolean'
100
+ * type([1, 2]) === 'Array'
101
+ * type({}) === 'Object'
102
+ * type(String) === 'Function'
103
+ * type(/abc+/) === 'RegExp'
104
+ */
105
+ type: function(o) {
106
+ return Object.prototype.toString.call(o).slice(8, -1);
107
+ },
108
+ /**
109
+ * Returns a unique number for the given object. Later calls will still return the same number.
110
+ *
111
+ * @param {Object} obj
112
+ * @returns {number}
113
+ */
114
+ objId: function(obj) {
115
+ if (!obj["__id"]) {
116
+ Object.defineProperty(obj, "__id", { value: ++uniqueId });
117
+ }
118
+ return obj["__id"];
119
+ },
120
+ /**
121
+ * Creates a deep clone of the given object.
122
+ *
123
+ * The main intended use of this function is to clone language definitions.
124
+ *
125
+ * @param {T} o
126
+ * @param {Record<number, any>} [visited]
127
+ * @returns {T}
128
+ * @template T
129
+ */
130
+ clone: function deepClone(o, visited) {
131
+ visited = visited || {};
132
+ var clone;
133
+ var id;
134
+ switch (_.util.type(o)) {
135
+ case "Object":
136
+ id = _.util.objId(o);
137
+ if (visited[id]) {
138
+ return visited[id];
139
+ }
140
+ clone = /** @type {Record<string, any>} */
141
+ {};
142
+ visited[id] = clone;
143
+ for (var key in o) {
144
+ if (o.hasOwnProperty(key)) {
145
+ clone[key] = deepClone(o[key], visited);
146
+ }
147
+ }
148
+ return (
149
+ /** @type {any} */
150
+ clone
151
+ );
152
+ case "Array":
153
+ id = _.util.objId(o);
154
+ if (visited[id]) {
155
+ return visited[id];
156
+ }
157
+ clone = [];
158
+ visited[id] = clone;
159
+ /** @type {Array} */
160
+ /** @type {any} */
161
+ o.forEach(function(v, i) {
162
+ clone[i] = deepClone(v, visited);
163
+ });
164
+ return (
165
+ /** @type {any} */
166
+ clone
167
+ );
168
+ default:
169
+ return o;
170
+ }
171
+ },
172
+ /**
173
+ * Returns the Prism language of the given element set by a `language-xxxx` or `lang-xxxx` class.
174
+ *
175
+ * If no language is set for the element or the element is `null` or `undefined`, `none` will be returned.
176
+ *
177
+ * @param {Element} element
178
+ * @returns {string}
179
+ */
180
+ getLanguage: function(element) {
181
+ while (element) {
182
+ var m = lang.exec(element.className);
183
+ if (m) {
184
+ return m[1].toLowerCase();
185
+ }
186
+ element = element.parentElement;
187
+ }
188
+ return "none";
189
+ },
190
+ /**
191
+ * Sets the Prism `language-xxxx` class of the given element.
192
+ *
193
+ * @param {Element} element
194
+ * @param {string} language
195
+ * @returns {void}
196
+ */
197
+ setLanguage: function(element, language) {
198
+ element.className = element.className.replace(RegExp(lang, "gi"), "");
199
+ element.classList.add("language-" + language);
200
+ },
201
+ /**
202
+ * Returns the script element that is currently executing.
203
+ *
204
+ * This does __not__ work for line script element.
205
+ *
206
+ * @returns {HTMLScriptElement | null}
207
+ */
208
+ currentScript: function() {
209
+ if (typeof document === "undefined") {
210
+ return null;
211
+ }
212
+ if (document.currentScript && document.currentScript.tagName === "SCRIPT" && 1 < 2) {
213
+ return (
214
+ /** @type {any} */
215
+ document.currentScript
216
+ );
217
+ }
218
+ try {
219
+ throw new Error();
220
+ } catch (err) {
221
+ var src = (/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(err.stack) || [])[1];
222
+ if (src) {
223
+ var scripts = document.getElementsByTagName("script");
224
+ for (var i in scripts) {
225
+ if (scripts[i].src == src) {
226
+ return scripts[i];
227
+ }
228
+ }
229
+ }
230
+ return null;
231
+ }
232
+ },
233
+ /**
234
+ * Returns whether a given class is active for `element`.
235
+ *
236
+ * The class can be activated if `element` or one of its ancestors has the given class and it can be deactivated
237
+ * if `element` or one of its ancestors has the negated version of the given class. The _negated version_ of the
238
+ * given class is just the given class with a `no-` prefix.
239
+ *
240
+ * Whether the class is active is determined by the closest ancestor of `element` (where `element` itself is
241
+ * closest ancestor) that has the given class or the negated version of it. If neither `element` nor any of its
242
+ * ancestors have the given class or the negated version of it, then the default activation will be returned.
243
+ *
244
+ * In the paradoxical situation where the closest ancestor contains __both__ the given class and the negated
245
+ * version of it, the class is considered active.
246
+ *
247
+ * @param {Element} element
248
+ * @param {string} className
249
+ * @param {boolean} [defaultActivation=false]
250
+ * @returns {boolean}
251
+ */
252
+ isActive: function(element, className, defaultActivation) {
253
+ var no = "no-" + className;
254
+ while (element) {
255
+ var classList = element.classList;
256
+ if (classList.contains(className)) {
257
+ return true;
258
+ }
259
+ if (classList.contains(no)) {
260
+ return false;
261
+ }
262
+ element = element.parentElement;
263
+ }
264
+ return !!defaultActivation;
265
+ }
266
+ },
267
+ /**
268
+ * This namespace contains all currently loaded languages and the some helper functions to create and modify languages.
269
+ *
270
+ * @namespace
271
+ * @memberof Prism
272
+ * @public
273
+ */
274
+ languages: {
275
+ /**
276
+ * The grammar for plain, unformatted text.
277
+ */
278
+ plain: plainTextGrammar,
279
+ plaintext: plainTextGrammar,
280
+ text: plainTextGrammar,
281
+ txt: plainTextGrammar,
282
+ /**
283
+ * Creates a deep copy of the language with the given id and appends the given tokens.
284
+ *
285
+ * If a token in `redef` also appears in the copied language, then the existing token in the copied language
286
+ * will be overwritten at its original position.
287
+ *
288
+ * ## Best practices
289
+ *
290
+ * Since the position of overwriting tokens (token in `redef` that overwrite tokens in the copied language)
291
+ * doesn't matter, they can technically be in any order. However, this can be confusing to others that trying to
292
+ * understand the language definition because, normally, the order of tokens matters in Prism grammars.
293
+ *
294
+ * Therefore, it is encouraged to order overwriting tokens according to the positions of the overwritten tokens.
295
+ * Furthermore, all non-overwriting tokens should be placed after the overwriting ones.
296
+ *
297
+ * @param {string} id The id of the language to extend. This has to be a key in `Prism.languages`.
298
+ * @param {Grammar} redef The new tokens to append.
299
+ * @returns {Grammar} The new language created.
300
+ * @public
301
+ * @example
302
+ * Prism.languages['css-with-colors'] = Prism.languages.extend('css', {
303
+ * // Prism.languages.css already has a 'comment' token, so this token will overwrite CSS' 'comment' token
304
+ * // at its original position
305
+ * 'comment': { ... },
306
+ * // CSS doesn't have a 'color' token, so this token will be appended
307
+ * 'color': /\b(?:red|green|blue)\b/
308
+ * });
309
+ */
310
+ extend: function(id, redef) {
311
+ var lang2 = _.util.clone(_.languages[id]);
312
+ for (var key in redef) {
313
+ lang2[key] = redef[key];
314
+ }
315
+ return lang2;
316
+ },
317
+ /**
318
+ * Inserts tokens _before_ another token in a language definition or any other grammar.
319
+ *
320
+ * ## Usage
321
+ *
322
+ * This helper method makes it easy to modify existing languages. For example, the CSS language definition
323
+ * not only defines CSS highlighting for CSS documents, but also needs to define highlighting for CSS embedded
324
+ * in HTML through `<style>` elements. To do this, it needs to modify `Prism.languages.markup` and add the
325
+ * appropriate tokens. However, `Prism.languages.markup` is a regular JavaScript object literal, so if you do
326
+ * this:
327
+ *
328
+ * ```js
329
+ * Prism.languages.markup.style = {
330
+ * // token
331
+ * };
332
+ * ```
333
+ *
334
+ * then the `style` token will be added (and processed) at the end. `insertBefore` allows you to insert tokens
335
+ * before existing tokens. For the CSS example above, you would use it like this:
336
+ *
337
+ * ```js
338
+ * Prism.languages.insertBefore('markup', 'cdata', {
339
+ * 'style': {
340
+ * // token
341
+ * }
342
+ * });
343
+ * ```
344
+ *
345
+ * ## Special cases
346
+ *
347
+ * If the grammars of `inside` and `insert` have tokens with the same name, the tokens in `inside`'s grammar
348
+ * will be ignored.
349
+ *
350
+ * This behavior can be used to insert tokens after `before`:
351
+ *
352
+ * ```js
353
+ * Prism.languages.insertBefore('markup', 'comment', {
354
+ * 'comment': Prism.languages.markup.comment,
355
+ * // tokens after 'comment'
356
+ * });
357
+ * ```
358
+ *
359
+ * ## Limitations
360
+ *
361
+ * The main problem `insertBefore` has to solve is iteration order. Since ES2015, the iteration order for object
362
+ * properties is guaranteed to be the insertion order (except for integer keys) but some browsers behave
363
+ * differently when keys are deleted and re-inserted. So `insertBefore` can't be implemented by temporarily
364
+ * deleting properties which is necessary to insert at arbitrary positions.
365
+ *
366
+ * To solve this problem, `insertBefore` doesn't actually insert the given tokens into the target object.
367
+ * Instead, it will create a new object and replace all references to the target object with the new one. This
368
+ * can be done without temporarily deleting properties, so the iteration order is well-defined.
369
+ *
370
+ * However, only references that can be reached from `Prism.languages` or `insert` will be replaced. I.e. if
371
+ * you hold the target object in a variable, then the value of the variable will not change.
372
+ *
373
+ * ```js
374
+ * var oldMarkup = Prism.languages.markup;
375
+ * var newMarkup = Prism.languages.insertBefore('markup', 'comment', { ... });
376
+ *
377
+ * assert(oldMarkup !== Prism.languages.markup);
378
+ * assert(newMarkup === Prism.languages.markup);
379
+ * ```
380
+ *
381
+ * @param {string} inside The property of `root` (e.g. a language id in `Prism.languages`) that contains the
382
+ * object to be modified.
383
+ * @param {string} before The key to insert before.
384
+ * @param {Grammar} insert An object containing the key-value pairs to be inserted.
385
+ * @param {Object<string, any>} [root] The object containing `inside`, i.e. the object that contains the
386
+ * object to be modified.
387
+ *
388
+ * Defaults to `Prism.languages`.
389
+ * @returns {Grammar} The new grammar object.
390
+ * @public
391
+ */
392
+ insertBefore: function(inside, before, insert, root) {
393
+ root = root || /** @type {any} */
394
+ _.languages;
395
+ var grammar = root[inside];
396
+ var ret = {};
397
+ for (var token in grammar) {
398
+ if (grammar.hasOwnProperty(token)) {
399
+ if (token == before) {
400
+ for (var newToken in insert) {
401
+ if (insert.hasOwnProperty(newToken)) {
402
+ ret[newToken] = insert[newToken];
403
+ }
404
+ }
405
+ }
406
+ if (!insert.hasOwnProperty(token)) {
407
+ ret[token] = grammar[token];
408
+ }
409
+ }
410
+ }
411
+ var old = root[inside];
412
+ root[inside] = ret;
413
+ _.languages.DFS(_.languages, function(key, value) {
414
+ if (value === old && key != inside) {
415
+ this[key] = ret;
416
+ }
417
+ });
418
+ return ret;
419
+ },
420
+ // Traverse a language definition with Depth First Search
421
+ DFS: function DFS(o, callback, type, visited) {
422
+ visited = visited || {};
423
+ var objId = _.util.objId;
424
+ for (var i in o) {
425
+ if (o.hasOwnProperty(i)) {
426
+ callback.call(o, i, o[i], type || i);
427
+ var property = o[i];
428
+ var propertyType = _.util.type(property);
429
+ if (propertyType === "Object" && !visited[objId(property)]) {
430
+ visited[objId(property)] = true;
431
+ DFS(property, callback, null, visited);
432
+ } else if (propertyType === "Array" && !visited[objId(property)]) {
433
+ visited[objId(property)] = true;
434
+ DFS(property, callback, i, visited);
435
+ }
436
+ }
437
+ }
438
+ }
439
+ },
440
+ plugins: {},
441
+ /**
442
+ * This is the most high-level function in Prism’s API.
443
+ * It fetches all the elements that have a `.language-xxxx` class and then calls {@link Prism.highlightElement} on
444
+ * each one of them.
445
+ *
446
+ * This is equivalent to `Prism.highlightAllUnder(document, async, callback)`.
447
+ *
448
+ * @param {boolean} [async=false] Same as in {@link Prism.highlightAllUnder}.
449
+ * @param {HighlightCallback} [callback] Same as in {@link Prism.highlightAllUnder}.
450
+ * @memberof Prism
451
+ * @public
452
+ */
453
+ highlightAll: function(async, callback) {
454
+ _.highlightAllUnder(document, async, callback);
455
+ },
456
+ /**
457
+ * Fetches all the descendants of `container` that have a `.language-xxxx` class and then calls
458
+ * {@link Prism.highlightElement} on each one of them.
459
+ *
460
+ * The following hooks will be run:
461
+ * 1. `before-highlightall`
462
+ * 2. `before-all-elements-highlight`
463
+ * 3. All hooks of {@link Prism.highlightElement} for each element.
464
+ *
465
+ * @param {ParentNode} container The root element, whose descendants that have a `.language-xxxx` class will be highlighted.
466
+ * @param {boolean} [async=false] Whether each element is to be highlighted asynchronously using Web Workers.
467
+ * @param {HighlightCallback} [callback] An optional callback to be invoked on each element after its highlighting is done.
468
+ * @memberof Prism
469
+ * @public
470
+ */
471
+ highlightAllUnder: function(container, async, callback) {
472
+ var env = {
473
+ callback,
474
+ container,
475
+ selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
476
+ };
477
+ _.hooks.run("before-highlightall", env);
478
+ env.elements = Array.prototype.slice.apply(env.container.querySelectorAll(env.selector));
479
+ _.hooks.run("before-all-elements-highlight", env);
480
+ for (var i = 0, element; element = env.elements[i++]; ) {
481
+ _.highlightElement(element, async === true, env.callback);
482
+ }
483
+ },
484
+ /**
485
+ * Highlights the code inside a single element.
486
+ *
487
+ * The following hooks will be run:
488
+ * 1. `before-sanity-check`
489
+ * 2. `before-highlight`
490
+ * 3. All hooks of {@link Prism.highlight}. These hooks will be run by an asynchronous worker if `async` is `true`.
491
+ * 4. `before-insert`
492
+ * 5. `after-highlight`
493
+ * 6. `complete`
494
+ *
495
+ * Some the above hooks will be skipped if the element doesn't contain any text or there is no grammar loaded for
496
+ * the element's language.
497
+ *
498
+ * @param {Element} element The element containing the code.
499
+ * It must have a class of `language-xxxx` to be processed, where `xxxx` is a valid language identifier.
500
+ * @param {boolean} [async=false] Whether the element is to be highlighted asynchronously using Web Workers
501
+ * to improve performance and avoid blocking the UI when highlighting very large chunks of code. This option is
502
+ * [disabled by default](https://prismjs.com/faq.html#why-is-asynchronous-highlighting-disabled-by-default).
503
+ *
504
+ * Note: All language definitions required to highlight the code must be included in the main `prism.js` file for
505
+ * asynchronous highlighting to work. You can build your own bundle on the
506
+ * [Download page](https://prismjs.com/download.html).
507
+ * @param {HighlightCallback} [callback] An optional callback to be invoked after the highlighting is done.
508
+ * Mostly useful when `async` is `true`, since in that case, the highlighting is done asynchronously.
509
+ * @memberof Prism
510
+ * @public
511
+ */
512
+ highlightElement: function(element, async, callback) {
513
+ var language = _.util.getLanguage(element);
514
+ var grammar = _.languages[language];
515
+ _.util.setLanguage(element, language);
516
+ var parent = element.parentElement;
517
+ if (parent && parent.nodeName.toLowerCase() === "pre") {
518
+ _.util.setLanguage(parent, language);
519
+ }
520
+ var code = element.textContent;
521
+ var env = {
522
+ element,
523
+ language,
524
+ grammar,
525
+ code
526
+ };
527
+ function insertHighlightedCode(highlightedCode) {
528
+ env.highlightedCode = highlightedCode;
529
+ _.hooks.run("before-insert", env);
530
+ env.element.innerHTML = env.highlightedCode;
531
+ _.hooks.run("after-highlight", env);
532
+ _.hooks.run("complete", env);
533
+ callback && callback.call(env.element);
534
+ }
535
+ _.hooks.run("before-sanity-check", env);
536
+ parent = env.element.parentElement;
537
+ if (parent && parent.nodeName.toLowerCase() === "pre" && !parent.hasAttribute("tabindex")) {
538
+ parent.setAttribute("tabindex", "0");
539
+ }
540
+ if (!env.code) {
541
+ _.hooks.run("complete", env);
542
+ callback && callback.call(env.element);
543
+ return;
544
+ }
545
+ _.hooks.run("before-highlight", env);
546
+ if (!env.grammar) {
547
+ insertHighlightedCode(_.util.encode(env.code));
548
+ return;
549
+ }
550
+ if (async && _self2.Worker) {
551
+ var worker = new Worker(_.filename);
552
+ worker.onmessage = function(evt) {
553
+ insertHighlightedCode(evt.data);
554
+ };
555
+ worker.postMessage(JSON.stringify({
556
+ language: env.language,
557
+ code: env.code,
558
+ immediateClose: true
559
+ }));
560
+ } else {
561
+ insertHighlightedCode(_.highlight(env.code, env.grammar, env.language));
562
+ }
563
+ },
564
+ /**
565
+ * Low-level function, only use if you know what you’re doing. It accepts a string of text as input
566
+ * and the language definitions to use, and returns a string with the HTML produced.
567
+ *
568
+ * The following hooks will be run:
569
+ * 1. `before-tokenize`
570
+ * 2. `after-tokenize`
571
+ * 3. `wrap`: On each {@link Token}.
572
+ *
573
+ * @param {string} text A string with the code to be highlighted.
574
+ * @param {Grammar} grammar An object containing the tokens to use.
575
+ *
576
+ * Usually a language definition like `Prism.languages.markup`.
577
+ * @param {string} language The name of the language definition passed to `grammar`.
578
+ * @returns {string} The highlighted HTML.
579
+ * @memberof Prism
580
+ * @public
581
+ * @example
582
+ * Prism.highlight('var foo = true;', Prism.languages.javascript, 'javascript');
583
+ */
584
+ highlight: function(text, grammar, language) {
585
+ var env = {
586
+ code: text,
587
+ grammar,
588
+ language
589
+ };
590
+ _.hooks.run("before-tokenize", env);
591
+ if (!env.grammar) {
592
+ throw new Error('The language "' + env.language + '" has no grammar.');
593
+ }
594
+ env.tokens = _.tokenize(env.code, env.grammar);
595
+ _.hooks.run("after-tokenize", env);
596
+ return Token.stringify(_.util.encode(env.tokens), env.language);
597
+ },
598
+ /**
599
+ * This is the heart of Prism, and the most low-level function you can use. It accepts a string of text as input
600
+ * and the language definitions to use, and returns an array with the tokenized code.
601
+ *
602
+ * When the language definition includes nested tokens, the function is called recursively on each of these tokens.
603
+ *
604
+ * This method could be useful in other contexts as well, as a very crude parser.
605
+ *
606
+ * @param {string} text A string with the code to be highlighted.
607
+ * @param {Grammar} grammar An object containing the tokens to use.
608
+ *
609
+ * Usually a language definition like `Prism.languages.markup`.
610
+ * @returns {TokenStream} An array of strings and tokens, a token stream.
611
+ * @memberof Prism
612
+ * @public
613
+ * @example
614
+ * let code = `var foo = 0;`;
615
+ * let tokens = Prism.tokenize(code, Prism.languages.javascript);
616
+ * tokens.forEach(token => {
617
+ * if (token instanceof Prism.Token && token.type === 'number') {
618
+ * console.log(`Found numeric literal: ${token.content}`);
619
+ * }
620
+ * });
621
+ */
622
+ tokenize: function(text, grammar) {
623
+ var rest = grammar.rest;
624
+ if (rest) {
625
+ for (var token in rest) {
626
+ grammar[token] = rest[token];
627
+ }
628
+ delete grammar.rest;
629
+ }
630
+ var tokenList = new LinkedList();
631
+ addAfter(tokenList, tokenList.head, text);
632
+ matchGrammar(text, tokenList, grammar, tokenList.head, 0);
633
+ return toArray(tokenList);
634
+ },
635
+ /**
636
+ * @namespace
637
+ * @memberof Prism
638
+ * @public
639
+ */
640
+ hooks: {
641
+ all: {},
642
+ /**
643
+ * Adds the given callback to the list of callbacks for the given hook.
644
+ *
645
+ * The callback will be invoked when the hook it is registered for is run.
646
+ * Hooks are usually directly run by a highlight function but you can also run hooks yourself.
647
+ *
648
+ * One callback function can be registered to multiple hooks and the same hook multiple times.
649
+ *
650
+ * @param {string} name The name of the hook.
651
+ * @param {HookCallback} callback The callback function which is given environment variables.
652
+ * @public
653
+ */
654
+ add: function(name, callback) {
655
+ var hooks = _.hooks.all;
656
+ hooks[name] = hooks[name] || [];
657
+ hooks[name].push(callback);
658
+ },
659
+ /**
660
+ * Runs a hook invoking all registered callbacks with the given environment variables.
661
+ *
662
+ * Callbacks will be invoked synchronously and in the order in which they were registered.
663
+ *
664
+ * @param {string} name The name of the hook.
665
+ * @param {Object<string, any>} env The environment variables of the hook passed to all callbacks registered.
666
+ * @public
667
+ */
668
+ run: function(name, env) {
669
+ var callbacks = _.hooks.all[name];
670
+ if (!callbacks || !callbacks.length) {
671
+ return;
672
+ }
673
+ for (var i = 0, callback; callback = callbacks[i++]; ) {
674
+ callback(env);
675
+ }
676
+ }
677
+ },
678
+ Token
679
+ };
680
+ _self2.Prism = _;
681
+ function Token(type, content, alias, matchedStr) {
682
+ this.type = type;
683
+ this.content = content;
684
+ this.alias = alias;
685
+ this.length = (matchedStr || "").length | 0;
686
+ }
687
+ Token.stringify = function stringify(o, language) {
688
+ if (typeof o == "string") {
689
+ return o;
690
+ }
691
+ if (Array.isArray(o)) {
692
+ var s = "";
693
+ o.forEach(function(e) {
694
+ s += stringify(e, language);
695
+ });
696
+ return s;
697
+ }
698
+ var env = {
699
+ type: o.type,
700
+ content: stringify(o.content, language),
701
+ tag: "span",
702
+ classes: ["token", o.type],
703
+ attributes: {},
704
+ language
705
+ };
706
+ var aliases = o.alias;
707
+ if (aliases) {
708
+ if (Array.isArray(aliases)) {
709
+ Array.prototype.push.apply(env.classes, aliases);
710
+ } else {
711
+ env.classes.push(aliases);
712
+ }
713
+ }
714
+ _.hooks.run("wrap", env);
715
+ var attributes = "";
716
+ for (var name in env.attributes) {
717
+ attributes += " " + name + '="' + (env.attributes[name] || "").replace(/"/g, "&quot;") + '"';
718
+ }
719
+ return "<" + env.tag + ' class="' + env.classes.join(" ") + '"' + attributes + ">" + env.content + "</" + env.tag + ">";
720
+ };
721
+ function matchPattern(pattern, pos, text, lookbehind) {
722
+ pattern.lastIndex = pos;
723
+ var match = pattern.exec(text);
724
+ if (match && lookbehind && match[1]) {
725
+ var lookbehindLength = match[1].length;
726
+ match.index += lookbehindLength;
727
+ match[0] = match[0].slice(lookbehindLength);
728
+ }
729
+ return match;
730
+ }
731
+ function matchGrammar(text, tokenList, grammar, startNode, startPos, rematch) {
732
+ for (var token in grammar) {
733
+ if (!grammar.hasOwnProperty(token) || !grammar[token]) {
734
+ continue;
735
+ }
736
+ var patterns = grammar[token];
737
+ patterns = Array.isArray(patterns) ? patterns : [patterns];
738
+ for (var j = 0; j < patterns.length; ++j) {
739
+ if (rematch && rematch.cause == token + "," + j) {
740
+ return;
741
+ }
742
+ var patternObj = patterns[j];
743
+ var inside = patternObj.inside;
744
+ var lookbehind = !!patternObj.lookbehind;
745
+ var greedy = !!patternObj.greedy;
746
+ var alias = patternObj.alias;
747
+ if (greedy && !patternObj.pattern.global) {
748
+ var flags = patternObj.pattern.toString().match(/[imsuy]*$/)[0];
749
+ patternObj.pattern = RegExp(patternObj.pattern.source, flags + "g");
750
+ }
751
+ var pattern = patternObj.pattern || patternObj;
752
+ for (var currentNode = startNode.next, pos = startPos; currentNode !== tokenList.tail; pos += currentNode.value.length, currentNode = currentNode.next) {
753
+ if (rematch && pos >= rematch.reach) {
754
+ break;
755
+ }
756
+ var str = currentNode.value;
757
+ if (tokenList.length > text.length) {
758
+ return;
759
+ }
760
+ if (str instanceof Token) {
761
+ continue;
762
+ }
763
+ var removeCount = 1;
764
+ var match;
765
+ if (greedy) {
766
+ match = matchPattern(pattern, pos, text, lookbehind);
767
+ if (!match || match.index >= text.length) {
768
+ break;
769
+ }
770
+ var from = match.index;
771
+ var to = match.index + match[0].length;
772
+ var p = pos;
773
+ p += currentNode.value.length;
774
+ while (from >= p) {
775
+ currentNode = currentNode.next;
776
+ p += currentNode.value.length;
777
+ }
778
+ p -= currentNode.value.length;
779
+ pos = p;
780
+ if (currentNode.value instanceof Token) {
781
+ continue;
782
+ }
783
+ for (var k = currentNode; k !== tokenList.tail && (p < to || typeof k.value === "string"); k = k.next) {
784
+ removeCount++;
785
+ p += k.value.length;
786
+ }
787
+ removeCount--;
788
+ str = text.slice(pos, p);
789
+ match.index -= pos;
790
+ } else {
791
+ match = matchPattern(pattern, 0, str, lookbehind);
792
+ if (!match) {
793
+ continue;
794
+ }
795
+ }
796
+ var from = match.index;
797
+ var matchStr = match[0];
798
+ var before = str.slice(0, from);
799
+ var after = str.slice(from + matchStr.length);
800
+ var reach = pos + str.length;
801
+ if (rematch && reach > rematch.reach) {
802
+ rematch.reach = reach;
803
+ }
804
+ var removeFrom = currentNode.prev;
805
+ if (before) {
806
+ removeFrom = addAfter(tokenList, removeFrom, before);
807
+ pos += before.length;
808
+ }
809
+ removeRange(tokenList, removeFrom, removeCount);
810
+ var wrapped = new Token(token, inside ? _.tokenize(matchStr, inside) : matchStr, alias, matchStr);
811
+ currentNode = addAfter(tokenList, removeFrom, wrapped);
812
+ if (after) {
813
+ addAfter(tokenList, currentNode, after);
814
+ }
815
+ if (removeCount > 1) {
816
+ var nestedRematch = {
817
+ cause: token + "," + j,
818
+ reach
819
+ };
820
+ matchGrammar(text, tokenList, grammar, currentNode.prev, pos, nestedRematch);
821
+ if (rematch && nestedRematch.reach > rematch.reach) {
822
+ rematch.reach = nestedRematch.reach;
823
+ }
824
+ }
825
+ }
826
+ }
827
+ }
828
+ }
829
+ function LinkedList() {
830
+ var head = { value: null, prev: null, next: null };
831
+ var tail = { value: null, prev: head, next: null };
832
+ head.next = tail;
833
+ this.head = head;
834
+ this.tail = tail;
835
+ this.length = 0;
836
+ }
837
+ function addAfter(list, node, value) {
838
+ var next = node.next;
839
+ var newNode = { value, prev: node, next };
840
+ node.next = newNode;
841
+ next.prev = newNode;
842
+ list.length++;
843
+ return newNode;
844
+ }
845
+ function removeRange(list, node, count) {
846
+ var next = node.next;
847
+ for (var i = 0; i < count && next !== list.tail; i++) {
848
+ next = next.next;
849
+ }
850
+ node.next = next;
851
+ next.prev = node;
852
+ list.length -= i;
853
+ }
854
+ function toArray(list) {
855
+ var array = [];
856
+ var node = list.head.next;
857
+ while (node !== list.tail) {
858
+ array.push(node.value);
859
+ node = node.next;
860
+ }
861
+ return array;
862
+ }
863
+ if (!_self2.document) {
864
+ if (!_self2.addEventListener) {
865
+ return _;
866
+ }
867
+ if (!_.disableWorkerMessageHandler) {
868
+ _self2.addEventListener("message", function(evt) {
869
+ var message = JSON.parse(evt.data);
870
+ var lang2 = message.language;
871
+ var code = message.code;
872
+ var immediateClose = message.immediateClose;
873
+ _self2.postMessage(_.highlight(code, _.languages[lang2], lang2));
874
+ if (immediateClose) {
875
+ _self2.close();
876
+ }
877
+ }, false);
878
+ }
879
+ return _;
880
+ }
881
+ var script = _.util.currentScript();
882
+ if (script) {
883
+ _.filename = script.src;
884
+ if (script.hasAttribute("data-manual")) {
885
+ _.manual = true;
886
+ }
887
+ }
888
+ function highlightAutomaticallyCallback() {
889
+ if (!_.manual) {
890
+ _.highlightAll();
891
+ }
892
+ }
893
+ if (!_.manual) {
894
+ var readyState = document.readyState;
895
+ if (readyState === "loading" || readyState === "interactive" && script && script.defer) {
896
+ document.addEventListener("DOMContentLoaded", highlightAutomaticallyCallback);
897
+ } else {
898
+ if (window.requestAnimationFrame) {
899
+ window.requestAnimationFrame(highlightAutomaticallyCallback);
900
+ } else {
901
+ window.setTimeout(highlightAutomaticallyCallback, 16);
902
+ }
903
+ }
904
+ }
905
+ return _;
906
+ }(_self);
907
+ if (module2.exports) {
908
+ module2.exports = Prism2;
909
+ }
910
+ if (typeof commonjsGlobal !== "undefined") {
911
+ commonjsGlobal.Prism = Prism2;
912
+ }
913
+ Prism2.languages.markup = {
914
+ "comment": {
915
+ pattern: /<!--(?:(?!<!--)[\s\S])*?-->/,
916
+ greedy: true
917
+ },
918
+ "prolog": {
919
+ pattern: /<\?[\s\S]+?\?>/,
920
+ greedy: true
921
+ },
922
+ "doctype": {
923
+ // https://www.w3.org/TR/xml/#NT-doctypedecl
924
+ pattern: /<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,
925
+ greedy: true,
926
+ inside: {
927
+ "internal-subset": {
928
+ pattern: /(^[^\[]*\[)[\s\S]+(?=\]>$)/,
929
+ lookbehind: true,
930
+ greedy: true,
931
+ inside: null
932
+ // see below
933
+ },
934
+ "string": {
935
+ pattern: /"[^"]*"|'[^']*'/,
936
+ greedy: true
937
+ },
938
+ "punctuation": /^<!|>$|[[\]]/,
939
+ "doctype-tag": /^DOCTYPE/i,
940
+ "name": /[^\s<>'"]+/
941
+ }
942
+ },
943
+ "cdata": {
944
+ pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
945
+ greedy: true
946
+ },
947
+ "tag": {
948
+ pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,
949
+ greedy: true,
950
+ inside: {
951
+ "tag": {
952
+ pattern: /^<\/?[^\s>\/]+/,
953
+ inside: {
954
+ "punctuation": /^<\/?/,
955
+ "namespace": /^[^\s>\/:]+:/
956
+ }
957
+ },
958
+ "special-attr": [],
959
+ "attr-value": {
960
+ pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,
961
+ inside: {
962
+ "punctuation": [
963
+ {
964
+ pattern: /^=/,
965
+ alias: "attr-equals"
966
+ },
967
+ {
968
+ pattern: /^(\s*)["']|["']$/,
969
+ lookbehind: true
970
+ }
971
+ ]
972
+ }
973
+ },
974
+ "punctuation": /\/?>/,
975
+ "attr-name": {
976
+ pattern: /[^\s>\/]+/,
977
+ inside: {
978
+ "namespace": /^[^\s>\/:]+:/
979
+ }
980
+ }
981
+ }
982
+ },
983
+ "entity": [
984
+ {
985
+ pattern: /&[\da-z]{1,8};/i,
986
+ alias: "named-entity"
987
+ },
988
+ /&#x?[\da-f]{1,8};/i
989
+ ]
990
+ };
991
+ Prism2.languages.markup["tag"].inside["attr-value"].inside["entity"] = Prism2.languages.markup["entity"];
992
+ Prism2.languages.markup["doctype"].inside["internal-subset"].inside = Prism2.languages.markup;
993
+ Prism2.hooks.add("wrap", function(env) {
994
+ if (env.type === "entity") {
995
+ env.attributes["title"] = env.content.replace(/&amp;/, "&");
996
+ }
997
+ });
998
+ Object.defineProperty(Prism2.languages.markup.tag, "addInlined", {
999
+ /**
1000
+ * Adds an inlined language to markup.
1001
+ *
1002
+ * An example of an inlined language is CSS with `<style>` tags.
1003
+ *
1004
+ * @param {string} tagName The name of the tag that contains the inlined language. This name will be treated as
1005
+ * case insensitive.
1006
+ * @param {string} lang The language key.
1007
+ * @example
1008
+ * addInlined('style', 'css');
1009
+ */
1010
+ value: function addInlined(tagName, lang) {
1011
+ var includedCdataInside = {};
1012
+ includedCdataInside["language-" + lang] = {
1013
+ pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
1014
+ lookbehind: true,
1015
+ inside: Prism2.languages[lang]
1016
+ };
1017
+ includedCdataInside["cdata"] = /^<!\[CDATA\[|\]\]>$/i;
1018
+ var inside = {
1019
+ "included-cdata": {
1020
+ pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
1021
+ inside: includedCdataInside
1022
+ }
1023
+ };
1024
+ inside["language-" + lang] = {
1025
+ pattern: /[\s\S]+/,
1026
+ inside: Prism2.languages[lang]
1027
+ };
1028
+ var def = {};
1029
+ def[tagName] = {
1030
+ pattern: RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g, function() {
1031
+ return tagName;
1032
+ }), "i"),
1033
+ lookbehind: true,
1034
+ greedy: true,
1035
+ inside
1036
+ };
1037
+ Prism2.languages.insertBefore("markup", "cdata", def);
1038
+ }
1039
+ });
1040
+ Object.defineProperty(Prism2.languages.markup.tag, "addAttribute", {
1041
+ /**
1042
+ * Adds an pattern to highlight languages embedded in HTML attributes.
1043
+ *
1044
+ * An example of an inlined language is CSS with `style` attributes.
1045
+ *
1046
+ * @param {string} attrName The name of the tag that contains the inlined language. This name will be treated as
1047
+ * case insensitive.
1048
+ * @param {string} lang The language key.
1049
+ * @example
1050
+ * addAttribute('style', 'css');
1051
+ */
1052
+ value: function(attrName, lang) {
1053
+ Prism2.languages.markup.tag.inside["special-attr"].push({
1054
+ pattern: RegExp(
1055
+ /(^|["'\s])/.source + "(?:" + attrName + ")" + /\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,
1056
+ "i"
1057
+ ),
1058
+ lookbehind: true,
1059
+ inside: {
1060
+ "attr-name": /^[^\s=]+/,
1061
+ "attr-value": {
1062
+ pattern: /=[\s\S]+/,
1063
+ inside: {
1064
+ "value": {
1065
+ pattern: /(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,
1066
+ lookbehind: true,
1067
+ alias: [lang, "language-" + lang],
1068
+ inside: Prism2.languages[lang]
1069
+ },
1070
+ "punctuation": [
1071
+ {
1072
+ pattern: /^=/,
1073
+ alias: "attr-equals"
1074
+ },
1075
+ /"|'/
1076
+ ]
1077
+ }
1078
+ }
1079
+ }
1080
+ });
1081
+ }
1082
+ });
1083
+ Prism2.languages.html = Prism2.languages.markup;
1084
+ Prism2.languages.mathml = Prism2.languages.markup;
1085
+ Prism2.languages.svg = Prism2.languages.markup;
1086
+ Prism2.languages.xml = Prism2.languages.extend("markup", {});
1087
+ Prism2.languages.ssml = Prism2.languages.xml;
1088
+ Prism2.languages.atom = Prism2.languages.xml;
1089
+ Prism2.languages.rss = Prism2.languages.xml;
1090
+ (function(Prism3) {
1091
+ var string = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
1092
+ Prism3.languages.css = {
1093
+ "comment": /\/\*[\s\S]*?\*\//,
1094
+ "atrule": {
1095
+ pattern: RegExp("@[\\w-](?:" + /[^;{\s"']|\s+(?!\s)/.source + "|" + string.source + ")*?" + /(?:;|(?=\s*\{))/.source),
1096
+ inside: {
1097
+ "rule": /^@[\w-]+/,
1098
+ "selector-function-argument": {
1099
+ pattern: /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,
1100
+ lookbehind: true,
1101
+ alias: "selector"
1102
+ },
1103
+ "keyword": {
1104
+ pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/,
1105
+ lookbehind: true
1106
+ }
1107
+ // See rest below
1108
+ }
1109
+ },
1110
+ "url": {
1111
+ // https://drafts.csswg.org/css-values-3/#urls
1112
+ pattern: RegExp("\\burl\\((?:" + string.source + "|" + /(?:[^\\\r\n()"']|\\[\s\S])*/.source + ")\\)", "i"),
1113
+ greedy: true,
1114
+ inside: {
1115
+ "function": /^url/i,
1116
+ "punctuation": /^\(|\)$/,
1117
+ "string": {
1118
+ pattern: RegExp("^" + string.source + "$"),
1119
+ alias: "url"
1120
+ }
1121
+ }
1122
+ },
1123
+ "selector": {
1124
+ pattern: RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|` + string.source + ")*(?=\\s*\\{)"),
1125
+ lookbehind: true
1126
+ },
1127
+ "string": {
1128
+ pattern: string,
1129
+ greedy: true
1130
+ },
1131
+ "property": {
1132
+ pattern: /(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,
1133
+ lookbehind: true
1134
+ },
1135
+ "important": /!important\b/i,
1136
+ "function": {
1137
+ pattern: /(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,
1138
+ lookbehind: true
1139
+ },
1140
+ "punctuation": /[(){};:,]/
1141
+ };
1142
+ Prism3.languages.css["atrule"].inside.rest = Prism3.languages.css;
1143
+ var markup = Prism3.languages.markup;
1144
+ if (markup) {
1145
+ markup.tag.addInlined("style", "css");
1146
+ markup.tag.addAttribute("style", "css");
1147
+ }
1148
+ })(Prism2);
1149
+ Prism2.languages.clike = {
1150
+ "comment": [
1151
+ {
1152
+ pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
1153
+ lookbehind: true,
1154
+ greedy: true
1155
+ },
1156
+ {
1157
+ pattern: /(^|[^\\:])\/\/.*/,
1158
+ lookbehind: true,
1159
+ greedy: true
1160
+ }
1161
+ ],
1162
+ "string": {
1163
+ pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
1164
+ greedy: true
1165
+ },
1166
+ "class-name": {
1167
+ pattern: /(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,
1168
+ lookbehind: true,
1169
+ inside: {
1170
+ "punctuation": /[.\\]/
1171
+ }
1172
+ },
1173
+ "keyword": /\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,
1174
+ "boolean": /\b(?:false|true)\b/,
1175
+ "function": /\b\w+(?=\()/,
1176
+ "number": /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
1177
+ "operator": /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
1178
+ "punctuation": /[{}[\];(),.:]/
1179
+ };
1180
+ Prism2.languages.javascript = Prism2.languages.extend("clike", {
1181
+ "class-name": [
1182
+ Prism2.languages.clike["class-name"],
1183
+ {
1184
+ pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,
1185
+ lookbehind: true
1186
+ }
1187
+ ],
1188
+ "keyword": [
1189
+ {
1190
+ pattern: /((?:^|\})\s*)catch\b/,
1191
+ lookbehind: true
1192
+ },
1193
+ {
1194
+ 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/,
1195
+ lookbehind: true
1196
+ }
1197
+ ],
1198
+ // Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
1199
+ "function": /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,
1200
+ "number": {
1201
+ pattern: RegExp(
1202
+ /(^|[^\w$])/.source + "(?:" + // constant
1203
+ (/NaN|Infinity/.source + "|" + // binary integer
1204
+ /0[bB][01]+(?:_[01]+)*n?/.source + "|" + // octal integer
1205
+ /0[oO][0-7]+(?:_[0-7]+)*n?/.source + "|" + // hexadecimal integer
1206
+ /0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source + "|" + // decimal bigint
1207
+ /\d+(?:_\d+)*n/.source + "|" + // decimal number (integer or float) but no bigint
1208
+ /(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source) + ")" + /(?![\w$])/.source
1209
+ ),
1210
+ lookbehind: true
1211
+ },
1212
+ "operator": /--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/
1213
+ });
1214
+ Prism2.languages.javascript["class-name"][0].pattern = /(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;
1215
+ Prism2.languages.insertBefore("javascript", "keyword", {
1216
+ "regex": {
1217
+ pattern: RegExp(
1218
+ // lookbehind
1219
+ // eslint-disable-next-line regexp/no-dupe-characters-character-class
1220
+ /((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source + // Regex pattern:
1221
+ // There are 2 regex patterns here. The RegExp set notation proposal added support for nested character
1222
+ // classes if the `v` flag is present. Unfortunately, nested CCs are both context-free and incompatible
1223
+ // with the only syntax, so we have to define 2 different regex patterns.
1224
+ /\//.source + "(?:" + /(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source + "|" + // `v` flag syntax. This supports 3 levels of nested character classes.
1225
+ /(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source + ")" + // lookahead
1226
+ /(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source
1227
+ ),
1228
+ lookbehind: true,
1229
+ greedy: true,
1230
+ inside: {
1231
+ "regex-source": {
1232
+ pattern: /^(\/)[\s\S]+(?=\/[a-z]*$)/,
1233
+ lookbehind: true,
1234
+ alias: "language-regex",
1235
+ inside: Prism2.languages.regex
1236
+ },
1237
+ "regex-delimiter": /^\/|\/$/,
1238
+ "regex-flags": /^[a-z]+$/
1239
+ }
1240
+ },
1241
+ // This must be declared before keyword because we use "function" inside the look-forward
1242
+ "function-variable": {
1243
+ 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*=>))/,
1244
+ alias: "function"
1245
+ },
1246
+ "parameter": [
1247
+ {
1248
+ pattern: /(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,
1249
+ lookbehind: true,
1250
+ inside: Prism2.languages.javascript
1251
+ },
1252
+ {
1253
+ pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,
1254
+ lookbehind: true,
1255
+ inside: Prism2.languages.javascript
1256
+ },
1257
+ {
1258
+ pattern: /(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,
1259
+ lookbehind: true,
1260
+ inside: Prism2.languages.javascript
1261
+ },
1262
+ {
1263
+ 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*\{)/,
1264
+ lookbehind: true,
1265
+ inside: Prism2.languages.javascript
1266
+ }
1267
+ ],
1268
+ "constant": /\b[A-Z](?:[A-Z_]|\dx?)*\b/
1269
+ });
1270
+ Prism2.languages.insertBefore("javascript", "string", {
1271
+ "hashbang": {
1272
+ pattern: /^#!.*/,
1273
+ greedy: true,
1274
+ alias: "comment"
1275
+ },
1276
+ "template-string": {
1277
+ pattern: /`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,
1278
+ greedy: true,
1279
+ inside: {
1280
+ "template-punctuation": {
1281
+ pattern: /^`|`$/,
1282
+ alias: "string"
1283
+ },
1284
+ "interpolation": {
1285
+ pattern: /((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,
1286
+ lookbehind: true,
1287
+ inside: {
1288
+ "interpolation-punctuation": {
1289
+ pattern: /^\$\{|\}$/,
1290
+ alias: "punctuation"
1291
+ },
1292
+ rest: Prism2.languages.javascript
1293
+ }
1294
+ },
1295
+ "string": /[\s\S]+/
1296
+ }
1297
+ },
1298
+ "string-property": {
1299
+ pattern: /((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,
1300
+ lookbehind: true,
1301
+ greedy: true,
1302
+ alias: "property"
1303
+ }
1304
+ });
1305
+ Prism2.languages.insertBefore("javascript", "operator", {
1306
+ "literal-property": {
1307
+ pattern: /((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,
1308
+ lookbehind: true,
1309
+ alias: "property"
1310
+ }
1311
+ });
1312
+ if (Prism2.languages.markup) {
1313
+ Prism2.languages.markup.tag.addInlined("script", "javascript");
1314
+ Prism2.languages.markup.tag.addAttribute(
1315
+ /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,
1316
+ "javascript"
1317
+ );
1318
+ }
1319
+ Prism2.languages.js = Prism2.languages.javascript;
1320
+ (function() {
1321
+ if (typeof Prism2 === "undefined" || typeof document === "undefined") {
1322
+ return;
1323
+ }
1324
+ if (!Element.prototype.matches) {
1325
+ Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
1326
+ }
1327
+ var LOADING_MESSAGE = "Loading…";
1328
+ var FAILURE_MESSAGE = function(status, message) {
1329
+ return "✖ Error " + status + " while fetching file: " + message;
1330
+ };
1331
+ var FAILURE_EMPTY_MESSAGE = "✖ Error: File does not exist or is empty";
1332
+ var EXTENSIONS = {
1333
+ "js": "javascript",
1334
+ "py": "python",
1335
+ "rb": "ruby",
1336
+ "ps1": "powershell",
1337
+ "psm1": "powershell",
1338
+ "sh": "bash",
1339
+ "bat": "batch",
1340
+ "h": "c",
1341
+ "tex": "latex"
1342
+ };
1343
+ var STATUS_ATTR = "data-src-status";
1344
+ var STATUS_LOADING = "loading";
1345
+ var STATUS_LOADED = "loaded";
1346
+ var STATUS_FAILED = "failed";
1347
+ var SELECTOR = "pre[data-src]:not([" + STATUS_ATTR + '="' + STATUS_LOADED + '"]):not([' + STATUS_ATTR + '="' + STATUS_LOADING + '"])';
1348
+ function loadFile(src, success, error) {
1349
+ var xhr = new XMLHttpRequest();
1350
+ xhr.open("GET", src, true);
1351
+ xhr.onreadystatechange = function() {
1352
+ if (xhr.readyState == 4) {
1353
+ if (xhr.status < 400 && xhr.responseText) {
1354
+ success(xhr.responseText);
1355
+ } else {
1356
+ if (xhr.status >= 400) {
1357
+ error(FAILURE_MESSAGE(xhr.status, xhr.statusText));
1358
+ } else {
1359
+ error(FAILURE_EMPTY_MESSAGE);
1360
+ }
1361
+ }
1362
+ }
1363
+ };
1364
+ xhr.send(null);
1365
+ }
1366
+ function parseRange(range) {
1367
+ var m = /^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(range || "");
1368
+ if (m) {
1369
+ var start = Number(m[1]);
1370
+ var comma = m[2];
1371
+ var end = m[3];
1372
+ if (!comma) {
1373
+ return [start, start];
1374
+ }
1375
+ if (!end) {
1376
+ return [start, void 0];
1377
+ }
1378
+ return [start, Number(end)];
1379
+ }
1380
+ return void 0;
1381
+ }
1382
+ Prism2.hooks.add("before-highlightall", function(env) {
1383
+ env.selector += ", " + SELECTOR;
1384
+ });
1385
+ Prism2.hooks.add("before-sanity-check", function(env) {
1386
+ var pre = (
1387
+ /** @type {HTMLPreElement} */
1388
+ env.element
1389
+ );
1390
+ if (pre.matches(SELECTOR)) {
1391
+ env.code = "";
1392
+ pre.setAttribute(STATUS_ATTR, STATUS_LOADING);
1393
+ var code = pre.appendChild(document.createElement("CODE"));
1394
+ code.textContent = LOADING_MESSAGE;
1395
+ var src = pre.getAttribute("data-src");
1396
+ var language = env.language;
1397
+ if (language === "none") {
1398
+ var extension = (/\.(\w+)$/.exec(src) || [, "none"])[1];
1399
+ language = EXTENSIONS[extension] || extension;
1400
+ }
1401
+ Prism2.util.setLanguage(code, language);
1402
+ Prism2.util.setLanguage(pre, language);
1403
+ var autoloader = Prism2.plugins.autoloader;
1404
+ if (autoloader) {
1405
+ autoloader.loadLanguages(language);
1406
+ }
1407
+ loadFile(
1408
+ src,
1409
+ function(text) {
1410
+ pre.setAttribute(STATUS_ATTR, STATUS_LOADED);
1411
+ var range = parseRange(pre.getAttribute("data-range"));
1412
+ if (range) {
1413
+ var lines = text.split(/\r\n?|\n/g);
1414
+ var start = range[0];
1415
+ var end = range[1] == null ? lines.length : range[1];
1416
+ if (start < 0) {
1417
+ start += lines.length;
1418
+ }
1419
+ start = Math.max(0, Math.min(start - 1, lines.length));
1420
+ if (end < 0) {
1421
+ end += lines.length;
1422
+ }
1423
+ end = Math.max(0, Math.min(end, lines.length));
1424
+ text = lines.slice(start, end).join("\n");
1425
+ if (!pre.hasAttribute("data-start")) {
1426
+ pre.setAttribute("data-start", String(start + 1));
1427
+ }
1428
+ }
1429
+ code.textContent = text;
1430
+ Prism2.highlightElement(code);
1431
+ },
1432
+ function(error) {
1433
+ pre.setAttribute(STATUS_ATTR, STATUS_FAILED);
1434
+ code.textContent = error;
1435
+ }
1436
+ );
1437
+ }
1438
+ });
1439
+ Prism2.plugins.fileHighlight = {
1440
+ /**
1441
+ * Executes the File Highlight plugin for all matching `pre` elements under the given container.
1442
+ *
1443
+ * Note: Elements which are already loaded or currently loading will not be touched by this method.
1444
+ *
1445
+ * @param {ParentNode} [container=document]
1446
+ */
1447
+ highlight: function highlight(container) {
1448
+ var elements = (container || document).querySelectorAll(SELECTOR);
1449
+ for (var i = 0, element; element = elements[i++]; ) {
1450
+ Prism2.highlightElement(element);
1451
+ }
1452
+ }
1453
+ };
1454
+ var logged = false;
1455
+ Prism2.fileHighlight = function() {
1456
+ if (!logged) {
1457
+ console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead.");
1458
+ logged = true;
1459
+ }
1460
+ Prism2.plugins.fileHighlight.highlight.apply(this, arguments);
1461
+ };
1462
+ })();
1463
+ })(prism);
1464
+ return prism.exports;
1465
+ }
1466
+ var prismExports = requirePrism();
1467
+ const Prism$1 = /* @__PURE__ */ getDefaultExportFromCjs(prismExports);
1468
+ var prismTypescript = {};
1469
+ var hasRequiredPrismTypescript;
1470
+ function requirePrismTypescript() {
1471
+ if (hasRequiredPrismTypescript) return prismTypescript;
1472
+ hasRequiredPrismTypescript = 1;
1473
+ (function(Prism2) {
1474
+ Prism2.languages.typescript = Prism2.languages.extend("javascript", {
1475
+ "class-name": {
1476
+ pattern: /(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,
1477
+ lookbehind: true,
1478
+ greedy: true,
1479
+ inside: null
1480
+ // see below
1481
+ },
1482
+ "builtin": /\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/
1483
+ });
1484
+ Prism2.languages.typescript.keyword.push(
1485
+ /\b(?:abstract|declare|is|keyof|readonly|require)\b/,
1486
+ // keywords that have to be followed by an identifier
1487
+ /\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,
1488
+ // This is for `import type *, {}`
1489
+ /\btype\b(?=\s*(?:[\{*]|$))/
1490
+ );
1491
+ delete Prism2.languages.typescript["parameter"];
1492
+ delete Prism2.languages.typescript["literal-property"];
1493
+ var typeInside = Prism2.languages.extend("typescript", {});
1494
+ delete typeInside["class-name"];
1495
+ Prism2.languages.typescript["class-name"].inside = typeInside;
1496
+ Prism2.languages.insertBefore("typescript", "function", {
1497
+ "decorator": {
1498
+ pattern: /@[$\w\xA0-\uFFFF]+/,
1499
+ inside: {
1500
+ "at": {
1501
+ pattern: /^@/,
1502
+ alias: "operator"
1503
+ },
1504
+ "function": /^[\s\S]+/
1505
+ }
1506
+ },
1507
+ "generic-function": {
1508
+ // e.g. foo<T extends "bar" | "baz">( ...
1509
+ pattern: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,
1510
+ greedy: true,
1511
+ inside: {
1512
+ "function": /^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,
1513
+ "generic": {
1514
+ pattern: /<[\s\S]+/,
1515
+ // everything after the first <
1516
+ alias: "class-name",
1517
+ inside: typeInside
1518
+ }
1519
+ }
1520
+ }
1521
+ });
1522
+ Prism2.languages.ts = Prism2.languages.typescript;
1523
+ })(Prism);
1524
+ return prismTypescript;
1525
+ }
1526
+ requirePrismTypescript();
1527
+ Prism.languages.javascript = Prism.languages.extend("clike", {
1528
+ "class-name": [
1529
+ Prism.languages.clike["class-name"],
1530
+ {
1531
+ pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,
1532
+ lookbehind: true
1533
+ }
1534
+ ],
1535
+ "keyword": [
1536
+ {
1537
+ pattern: /((?:^|\})\s*)catch\b/,
1538
+ lookbehind: true
1539
+ },
1540
+ {
1541
+ 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/,
1542
+ lookbehind: true
1543
+ }
1544
+ ],
1545
+ // Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
1546
+ "function": /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,
1547
+ "number": {
1548
+ pattern: RegExp(
1549
+ /(^|[^\w$])/.source + "(?:" + // constant
1550
+ (/NaN|Infinity/.source + "|" + // binary integer
1551
+ /0[bB][01]+(?:_[01]+)*n?/.source + "|" + // octal integer
1552
+ /0[oO][0-7]+(?:_[0-7]+)*n?/.source + "|" + // hexadecimal integer
1553
+ /0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source + "|" + // decimal bigint
1554
+ /\d+(?:_\d+)*n/.source + "|" + // decimal number (integer or float) but no bigint
1555
+ /(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source) + ")" + /(?![\w$])/.source
1556
+ ),
1557
+ lookbehind: true
1558
+ },
1559
+ "operator": /--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/
1560
+ });
1561
+ Prism.languages.javascript["class-name"][0].pattern = /(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;
1562
+ Prism.languages.insertBefore("javascript", "keyword", {
1563
+ "regex": {
1564
+ pattern: RegExp(
1565
+ // lookbehind
1566
+ // eslint-disable-next-line regexp/no-dupe-characters-character-class
1567
+ /((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source + // Regex pattern:
1568
+ // There are 2 regex patterns here. The RegExp set notation proposal added support for nested character
1569
+ // classes if the `v` flag is present. Unfortunately, nested CCs are both context-free and incompatible
1570
+ // with the only syntax, so we have to define 2 different regex patterns.
1571
+ /\//.source + "(?:" + /(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source + "|" + // `v` flag syntax. This supports 3 levels of nested character classes.
1572
+ /(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source + ")" + // lookahead
1573
+ /(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source
1574
+ ),
1575
+ lookbehind: true,
1576
+ greedy: true,
1577
+ inside: {
1578
+ "regex-source": {
1579
+ pattern: /^(\/)[\s\S]+(?=\/[a-z]*$)/,
1580
+ lookbehind: true,
1581
+ alias: "language-regex",
1582
+ inside: Prism.languages.regex
1583
+ },
1584
+ "regex-delimiter": /^\/|\/$/,
1585
+ "regex-flags": /^[a-z]+$/
1586
+ }
1587
+ },
1588
+ // This must be declared before keyword because we use "function" inside the look-forward
1589
+ "function-variable": {
1590
+ 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*=>))/,
1591
+ alias: "function"
1592
+ },
1593
+ "parameter": [
1594
+ {
1595
+ pattern: /(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,
1596
+ lookbehind: true,
1597
+ inside: Prism.languages.javascript
1598
+ },
1599
+ {
1600
+ pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,
1601
+ lookbehind: true,
1602
+ inside: Prism.languages.javascript
1603
+ },
1604
+ {
1605
+ pattern: /(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,
1606
+ lookbehind: true,
1607
+ inside: Prism.languages.javascript
1608
+ },
1609
+ {
1610
+ 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*\{)/,
1611
+ lookbehind: true,
1612
+ inside: Prism.languages.javascript
1613
+ }
1614
+ ],
1615
+ "constant": /\b[A-Z](?:[A-Z_]|\dx?)*\b/
1616
+ });
1617
+ Prism.languages.insertBefore("javascript", "string", {
1618
+ "hashbang": {
1619
+ pattern: /^#!.*/,
1620
+ greedy: true,
1621
+ alias: "comment"
1622
+ },
1623
+ "template-string": {
1624
+ pattern: /`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,
1625
+ greedy: true,
1626
+ inside: {
1627
+ "template-punctuation": {
1628
+ pattern: /^`|`$/,
1629
+ alias: "string"
1630
+ },
1631
+ "interpolation": {
1632
+ pattern: /((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,
1633
+ lookbehind: true,
1634
+ inside: {
1635
+ "interpolation-punctuation": {
1636
+ pattern: /^\$\{|\}$/,
1637
+ alias: "punctuation"
1638
+ },
1639
+ rest: Prism.languages.javascript
1640
+ }
1641
+ },
1642
+ "string": /[\s\S]+/
1643
+ }
1644
+ },
1645
+ "string-property": {
1646
+ pattern: /((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,
1647
+ lookbehind: true,
1648
+ greedy: true,
1649
+ alias: "property"
1650
+ }
1651
+ });
1652
+ Prism.languages.insertBefore("javascript", "operator", {
1653
+ "literal-property": {
1654
+ pattern: /((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,
1655
+ lookbehind: true,
1656
+ alias: "property"
1657
+ }
1658
+ });
1659
+ if (Prism.languages.markup) {
1660
+ Prism.languages.markup.tag.addInlined("script", "javascript");
1661
+ Prism.languages.markup.tag.addAttribute(
1662
+ /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,
1663
+ "javascript"
1664
+ );
1665
+ }
1666
+ Prism.languages.js = Prism.languages.javascript;
1667
+ var prismPython = {};
1668
+ var hasRequiredPrismPython;
1669
+ function requirePrismPython() {
1670
+ if (hasRequiredPrismPython) return prismPython;
1671
+ hasRequiredPrismPython = 1;
1672
+ Prism.languages.python = {
1673
+ "comment": {
1674
+ pattern: /(^|[^\\])#.*/,
1675
+ lookbehind: true,
1676
+ greedy: true
1677
+ },
1678
+ "string-interpolation": {
1679
+ pattern: /(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,
1680
+ greedy: true,
1681
+ inside: {
1682
+ "interpolation": {
1683
+ // "{" <expression> <optional "!s", "!r", or "!a"> <optional ":" format specifier> "}"
1684
+ pattern: /((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,
1685
+ lookbehind: true,
1686
+ inside: {
1687
+ "format-spec": {
1688
+ pattern: /(:)[^:(){}]+(?=\}$)/,
1689
+ lookbehind: true
1690
+ },
1691
+ "conversion-option": {
1692
+ pattern: /![sra](?=[:}]$)/,
1693
+ alias: "punctuation"
1694
+ },
1695
+ rest: null
1696
+ }
1697
+ },
1698
+ "string": /[\s\S]+/
1699
+ }
1700
+ },
1701
+ "triple-quoted-string": {
1702
+ pattern: /(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,
1703
+ greedy: true,
1704
+ alias: "string"
1705
+ },
1706
+ "string": {
1707
+ pattern: /(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,
1708
+ greedy: true
1709
+ },
1710
+ "function": {
1711
+ pattern: /((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,
1712
+ lookbehind: true
1713
+ },
1714
+ "class-name": {
1715
+ pattern: /(\bclass\s+)\w+/i,
1716
+ lookbehind: true
1717
+ },
1718
+ "decorator": {
1719
+ pattern: /(^[\t ]*)@\w+(?:\.\w+)*/m,
1720
+ lookbehind: true,
1721
+ alias: ["annotation", "punctuation"],
1722
+ inside: {
1723
+ "punctuation": /\./
1724
+ }
1725
+ },
1726
+ "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/,
1727
+ "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/,
1728
+ "boolean": /\b(?:False|None|True)\b/,
1729
+ "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,
1730
+ "operator": /[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,
1731
+ "punctuation": /[{}[\];(),.:]/
1732
+ };
1733
+ Prism.languages.python["string-interpolation"].inside["interpolation"].inside.rest = Prism.languages.python;
1734
+ Prism.languages.py = Prism.languages.python;
1735
+ return prismPython;
1736
+ }
1737
+ requirePrismPython();
1738
+ var prismJava = {};
1739
+ var hasRequiredPrismJava;
1740
+ function requirePrismJava() {
1741
+ if (hasRequiredPrismJava) return prismJava;
1742
+ hasRequiredPrismJava = 1;
1743
+ (function(Prism2) {
1744
+ var keywords = /\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/;
1745
+ var classNamePrefix = /(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source;
1746
+ var className = {
1747
+ pattern: RegExp(/(^|[^\w.])/.source + classNamePrefix + /[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),
1748
+ lookbehind: true,
1749
+ inside: {
1750
+ "namespace": {
1751
+ pattern: /^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,
1752
+ inside: {
1753
+ "punctuation": /\./
1754
+ }
1755
+ },
1756
+ "punctuation": /\./
1757
+ }
1758
+ };
1759
+ Prism2.languages.java = Prism2.languages.extend("clike", {
1760
+ "string": {
1761
+ pattern: /(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,
1762
+ lookbehind: true,
1763
+ greedy: true
1764
+ },
1765
+ "class-name": [
1766
+ className,
1767
+ {
1768
+ // variables, parameters, and constructor references
1769
+ // this to support class names (or generic parameters) which do not contain a lower case letter (also works for methods)
1770
+ pattern: RegExp(/(^|[^\w.])/.source + classNamePrefix + /[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),
1771
+ lookbehind: true,
1772
+ inside: className.inside
1773
+ },
1774
+ {
1775
+ // class names based on keyword
1776
+ // this to support class names (or generic parameters) which do not contain a lower case letter (also works for methods)
1777
+ pattern: RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source + classNamePrefix + /[A-Z]\w*\b/.source),
1778
+ lookbehind: true,
1779
+ inside: className.inside
1780
+ }
1781
+ ],
1782
+ "keyword": keywords,
1783
+ "function": [
1784
+ Prism2.languages.clike.function,
1785
+ {
1786
+ pattern: /(::\s*)[a-z_]\w*/,
1787
+ lookbehind: true
1788
+ }
1789
+ ],
1790
+ "number": /\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,
1791
+ "operator": {
1792
+ pattern: /(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,
1793
+ lookbehind: true
1794
+ },
1795
+ "constant": /\b[A-Z][A-Z_\d]+\b/
1796
+ });
1797
+ Prism2.languages.insertBefore("java", "string", {
1798
+ "triple-quoted-string": {
1799
+ // http://openjdk.java.net/jeps/355#Description
1800
+ pattern: /"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,
1801
+ greedy: true,
1802
+ alias: "string"
1803
+ },
1804
+ "char": {
1805
+ pattern: /'(?:\\.|[^'\\\r\n]){1,6}'/,
1806
+ greedy: true
1807
+ }
1808
+ });
1809
+ Prism2.languages.insertBefore("java", "class-name", {
1810
+ "annotation": {
1811
+ pattern: /(^|[^.])@\w+(?:\s*\.\s*\w+)*/,
1812
+ lookbehind: true,
1813
+ alias: "punctuation"
1814
+ },
1815
+ "generics": {
1816
+ pattern: /<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,
1817
+ inside: {
1818
+ "class-name": className,
1819
+ "keyword": keywords,
1820
+ "punctuation": /[<>(),.:]/,
1821
+ "operator": /[?&|]/
1822
+ }
1823
+ },
1824
+ "import": [
1825
+ {
1826
+ pattern: RegExp(/(\bimport\s+)/.source + classNamePrefix + /(?:[A-Z]\w*|\*)(?=\s*;)/.source),
1827
+ lookbehind: true,
1828
+ inside: {
1829
+ "namespace": className.inside.namespace,
1830
+ "punctuation": /\./,
1831
+ "operator": /\*/,
1832
+ "class-name": /\w+/
1833
+ }
1834
+ },
1835
+ {
1836
+ pattern: RegExp(/(\bimport\s+static\s+)/.source + classNamePrefix + /(?:\w+|\*)(?=\s*;)/.source),
1837
+ lookbehind: true,
1838
+ alias: "static",
1839
+ inside: {
1840
+ "namespace": className.inside.namespace,
1841
+ "static": /\b\w+$/,
1842
+ "punctuation": /\./,
1843
+ "operator": /\*/,
1844
+ "class-name": /\w+/
1845
+ }
1846
+ }
1847
+ ],
1848
+ "namespace": {
1849
+ pattern: RegExp(
1850
+ /(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!<keyword>)[a-z]\w*(?:\.[a-z]\w*)*\.?/.source.replace(/<keyword>/g, function() {
1851
+ return keywords.source;
1852
+ })
1853
+ ),
1854
+ lookbehind: true,
1855
+ inside: {
1856
+ "punctuation": /\./
1857
+ }
1858
+ }
1859
+ });
1860
+ })(Prism);
1861
+ return prismJava;
1862
+ }
1863
+ requirePrismJava();
1864
+ Prism.languages.c = Prism.languages.extend("clike", {
1865
+ "comment": {
1866
+ pattern: /\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,
1867
+ greedy: true
1868
+ },
1869
+ "string": {
1870
+ // https://en.cppreference.com/w/c/language/string_literal
1871
+ pattern: /"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,
1872
+ greedy: true
1873
+ },
1874
+ "class-name": {
1875
+ pattern: /(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,
1876
+ lookbehind: true
1877
+ },
1878
+ "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/,
1879
+ "function": /\b[a-z_]\w*(?=\s*\()/i,
1880
+ "number": /(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,
1881
+ "operator": />>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/
1882
+ });
1883
+ Prism.languages.insertBefore("c", "string", {
1884
+ "char": {
1885
+ // https://en.cppreference.com/w/c/language/character_constant
1886
+ pattern: /'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,
1887
+ greedy: true
1888
+ }
1889
+ });
1890
+ Prism.languages.insertBefore("c", "string", {
1891
+ "macro": {
1892
+ // allow for multiline macro definitions
1893
+ // spaces after the # character compile fine with gcc
1894
+ pattern: /(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,
1895
+ lookbehind: true,
1896
+ greedy: true,
1897
+ alias: "property",
1898
+ inside: {
1899
+ "string": [
1900
+ {
1901
+ // highlight the path of the include statement as a string
1902
+ pattern: /^(#\s*include\s*)<[^>]+>/,
1903
+ lookbehind: true
1904
+ },
1905
+ Prism.languages.c["string"]
1906
+ ],
1907
+ "char": Prism.languages.c["char"],
1908
+ "comment": Prism.languages.c["comment"],
1909
+ "macro-name": [
1910
+ {
1911
+ pattern: /(^#\s*define\s+)\w+\b(?!\()/i,
1912
+ lookbehind: true
1913
+ },
1914
+ {
1915
+ pattern: /(^#\s*define\s+)\w+\b(?=\()/i,
1916
+ lookbehind: true,
1917
+ alias: "function"
1918
+ }
1919
+ ],
1920
+ // highlight macro directives as keywords
1921
+ "directive": {
1922
+ pattern: /^(#\s*)[a-z]+/,
1923
+ lookbehind: true,
1924
+ alias: "keyword"
1925
+ },
1926
+ "directive-hash": /^#/,
1927
+ "punctuation": /##|\\(?=[\r\n])/,
1928
+ "expression": {
1929
+ pattern: /\S[\s\S]*/,
1930
+ inside: Prism.languages.c
1931
+ }
1932
+ }
1933
+ }
1934
+ });
1935
+ Prism.languages.insertBefore("c", "function", {
1936
+ // highlight predefined macros as constants
1937
+ "constant": /\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/
1938
+ });
1939
+ delete Prism.languages.c["boolean"];
1940
+ var prismCpp = {};
1941
+ var hasRequiredPrismCpp;
1942
+ function requirePrismCpp() {
1943
+ if (hasRequiredPrismCpp) return prismCpp;
1944
+ hasRequiredPrismCpp = 1;
1945
+ (function(Prism2) {
1946
+ var keyword = /\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/;
1947
+ var modName = /\b(?!<keyword>)\w+(?:\s*\.\s*\w+)*\b/.source.replace(/<keyword>/g, function() {
1948
+ return keyword.source;
1949
+ });
1950
+ Prism2.languages.cpp = Prism2.languages.extend("c", {
1951
+ "class-name": [
1952
+ {
1953
+ pattern: RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!<keyword>)\w+/.source.replace(/<keyword>/g, function() {
1954
+ return keyword.source;
1955
+ })),
1956
+ lookbehind: true
1957
+ },
1958
+ // This is intended to capture the class name of method implementations like:
1959
+ // void foo::bar() const {}
1960
+ // However! The `foo` in the above example could also be a namespace, so we only capture the class name if
1961
+ // it starts with an uppercase letter. This approximation should give decent results.
1962
+ /\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,
1963
+ // This will capture the class name before destructors like:
1964
+ // Foo::~Foo() {}
1965
+ /\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,
1966
+ // This also intends to capture the class name of method implementations but here the class has template
1967
+ // parameters, so it can't be a namespace (until C++ adds generic namespaces).
1968
+ /\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/
1969
+ ],
1970
+ "keyword": keyword,
1971
+ "number": {
1972
+ pattern: /(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,
1973
+ greedy: true
1974
+ },
1975
+ "operator": />>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,
1976
+ "boolean": /\b(?:false|true)\b/
1977
+ });
1978
+ Prism2.languages.insertBefore("cpp", "string", {
1979
+ "module": {
1980
+ // https://en.cppreference.com/w/cpp/language/modules
1981
+ pattern: RegExp(
1982
+ /(\b(?:import|module)\s+)/.source + "(?:" + // header-name
1983
+ /"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source + "|" + // module name or partition or both
1984
+ /<mod-name>(?:\s*:\s*<mod-name>)?|:\s*<mod-name>/.source.replace(/<mod-name>/g, function() {
1985
+ return modName;
1986
+ }) + ")"
1987
+ ),
1988
+ lookbehind: true,
1989
+ greedy: true,
1990
+ inside: {
1991
+ "string": /^[<"][\s\S]+/,
1992
+ "operator": /:/,
1993
+ "punctuation": /\./
1994
+ }
1995
+ },
1996
+ "raw-string": {
1997
+ pattern: /R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,
1998
+ alias: "string",
1999
+ greedy: true
2000
+ }
2001
+ });
2002
+ Prism2.languages.insertBefore("cpp", "keyword", {
2003
+ "generic-function": {
2004
+ pattern: /\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,
2005
+ inside: {
2006
+ "function": /^\w+/,
2007
+ "generic": {
2008
+ pattern: /<[\s\S]+/,
2009
+ alias: "class-name",
2010
+ inside: Prism2.languages.cpp
2011
+ }
2012
+ }
2013
+ }
2014
+ });
2015
+ Prism2.languages.insertBefore("cpp", "operator", {
2016
+ "double-colon": {
2017
+ pattern: /::/,
2018
+ alias: "punctuation"
2019
+ }
2020
+ });
2021
+ Prism2.languages.insertBefore("cpp", "class-name", {
2022
+ // the base clause is an optional list of parent classes
2023
+ // https://en.cppreference.com/w/cpp/language/class
2024
+ "base-clause": {
2025
+ pattern: /(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,
2026
+ lookbehind: true,
2027
+ greedy: true,
2028
+ inside: Prism2.languages.extend("cpp", {})
2029
+ }
2030
+ });
2031
+ Prism2.languages.insertBefore("inside", "double-colon", {
2032
+ // All untokenized words that are not namespaces should be class names
2033
+ "class-name": /\b[a-z_]\w*\b(?!\s*::)/i
2034
+ }, Prism2.languages.cpp["base-clause"]);
2035
+ })(Prism);
2036
+ return prismCpp;
2037
+ }
2038
+ requirePrismCpp();
2039
+ var prismCsharp = {};
2040
+ var hasRequiredPrismCsharp;
2041
+ function requirePrismCsharp() {
2042
+ if (hasRequiredPrismCsharp) return prismCsharp;
2043
+ hasRequiredPrismCsharp = 1;
2044
+ (function(Prism2) {
2045
+ function replace(pattern, replacements) {
2046
+ return pattern.replace(/<<(\d+)>>/g, function(m, index) {
2047
+ return "(?:" + replacements[+index] + ")";
2048
+ });
2049
+ }
2050
+ function re(pattern, replacements, flags) {
2051
+ return RegExp(replace(pattern, replacements), "");
2052
+ }
2053
+ function nested(pattern, depthLog2) {
2054
+ for (var i = 0; i < depthLog2; i++) {
2055
+ pattern = pattern.replace(/<<self>>/g, function() {
2056
+ return "(?:" + pattern + ")";
2057
+ });
2058
+ }
2059
+ return pattern.replace(/<<self>>/g, "[^\\s\\S]");
2060
+ }
2061
+ var keywordKinds = {
2062
+ // keywords which represent a return or variable type
2063
+ type: "bool byte char decimal double dynamic float int long object sbyte short string uint ulong ushort var void",
2064
+ // keywords which are used to declare a type
2065
+ typeDeclaration: "class enum interface record struct",
2066
+ // contextual keywords
2067
+ // ("var" and "dynamic" are missing because they are used like types)
2068
+ 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*{)",
2069
+ // all other keywords
2070
+ 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"
2071
+ };
2072
+ function keywordsToPattern(words) {
2073
+ return "\\b(?:" + words.trim().replace(/ /g, "|") + ")\\b";
2074
+ }
2075
+ var typeDeclarationKeywords = keywordsToPattern(keywordKinds.typeDeclaration);
2076
+ var keywords = RegExp(keywordsToPattern(keywordKinds.type + " " + keywordKinds.typeDeclaration + " " + keywordKinds.contextual + " " + keywordKinds.other));
2077
+ var nonTypeKeywords = keywordsToPattern(keywordKinds.typeDeclaration + " " + keywordKinds.contextual + " " + keywordKinds.other);
2078
+ var nonContextualKeywords = keywordsToPattern(keywordKinds.type + " " + keywordKinds.typeDeclaration + " " + keywordKinds.other);
2079
+ var generic = nested(/<(?:[^<>;=+\-*/%&|^]|<<self>>)*>/.source, 2);
2080
+ var nestedRound = nested(/\((?:[^()]|<<self>>)*\)/.source, 2);
2081
+ var name = /@?\b[A-Za-z_]\w*\b/.source;
2082
+ var genericName = replace(/<<0>>(?:\s*<<1>>)?/.source, [name, generic]);
2083
+ var identifier = replace(/(?!<<0>>)<<1>>(?:\s*\.\s*<<1>>)*/.source, [nonTypeKeywords, genericName]);
2084
+ var array = /\[\s*(?:,\s*)*\]/.source;
2085
+ var typeExpressionWithoutTuple = replace(/<<0>>(?:\s*(?:\?\s*)?<<1>>)*(?:\s*\?)?/.source, [identifier, array]);
2086
+ var tupleElement = replace(/[^,()<>[\];=+\-*/%&|^]|<<0>>|<<1>>|<<2>>/.source, [generic, nestedRound, array]);
2087
+ var tuple = replace(/\(<<0>>+(?:,<<0>>+)+\)/.source, [tupleElement]);
2088
+ var typeExpression = replace(/(?:<<0>>|<<1>>)(?:\s*(?:\?\s*)?<<2>>)*(?:\s*\?)?/.source, [tuple, identifier, array]);
2089
+ var typeInside = {
2090
+ "keyword": keywords,
2091
+ "punctuation": /[<>()?,.:[\]]/
2092
+ };
2093
+ var character = /'(?:[^\r\n'\\]|\\.|\\[Uux][\da-fA-F]{1,8})'/.source;
2094
+ var regularString = /"(?:\\.|[^\\"\r\n])*"/.source;
2095
+ var verbatimString = /@"(?:""|\\[\s\S]|[^\\"])*"(?!")/.source;
2096
+ Prism2.languages.csharp = Prism2.languages.extend("clike", {
2097
+ "string": [
2098
+ {
2099
+ pattern: re(/(^|[^$\\])<<0>>/.source, [verbatimString]),
2100
+ lookbehind: true,
2101
+ greedy: true
2102
+ },
2103
+ {
2104
+ pattern: re(/(^|[^@$\\])<<0>>/.source, [regularString]),
2105
+ lookbehind: true,
2106
+ greedy: true
2107
+ }
2108
+ ],
2109
+ "class-name": [
2110
+ {
2111
+ // Using static
2112
+ // using static System.Math;
2113
+ pattern: re(/(\busing\s+static\s+)<<0>>(?=\s*;)/.source, [identifier]),
2114
+ lookbehind: true,
2115
+ inside: typeInside
2116
+ },
2117
+ {
2118
+ // Using alias (type)
2119
+ // using Project = PC.MyCompany.Project;
2120
+ pattern: re(/(\busing\s+<<0>>\s*=\s*)<<1>>(?=\s*;)/.source, [name, typeExpression]),
2121
+ lookbehind: true,
2122
+ inside: typeInside
2123
+ },
2124
+ {
2125
+ // Using alias (alias)
2126
+ // using Project = PC.MyCompany.Project;
2127
+ pattern: re(/(\busing\s+)<<0>>(?=\s*=)/.source, [name]),
2128
+ lookbehind: true
2129
+ },
2130
+ {
2131
+ // Type declarations
2132
+ // class Foo<A, B>
2133
+ // interface Foo<out A, B>
2134
+ pattern: re(/(\b<<0>>\s+)<<1>>/.source, [typeDeclarationKeywords, genericName]),
2135
+ lookbehind: true,
2136
+ inside: typeInside
2137
+ },
2138
+ {
2139
+ // Single catch exception declaration
2140
+ // catch(Foo)
2141
+ // (things like catch(Foo e) is covered by variable declaration)
2142
+ pattern: re(/(\bcatch\s*\(\s*)<<0>>/.source, [identifier]),
2143
+ lookbehind: true,
2144
+ inside: typeInside
2145
+ },
2146
+ {
2147
+ // Name of the type parameter of generic constraints
2148
+ // where Foo : class
2149
+ pattern: re(/(\bwhere\s+)<<0>>/.source, [name]),
2150
+ lookbehind: true
2151
+ },
2152
+ {
2153
+ // Casts and checks via as and is.
2154
+ // as Foo<A>, is Bar<B>
2155
+ // (things like if(a is Foo b) is covered by variable declaration)
2156
+ pattern: re(/(\b(?:is(?:\s+not)?|as)\s+)<<0>>/.source, [typeExpressionWithoutTuple]),
2157
+ lookbehind: true,
2158
+ inside: typeInside
2159
+ },
2160
+ {
2161
+ // Variable, field and parameter declaration
2162
+ // (Foo bar, Bar baz, Foo[,,] bay, Foo<Bar, FooBar<Bar>> bax)
2163
+ pattern: re(/\b<<0>>(?=\s+(?!<<1>>|with\s*\{)<<2>>(?:\s*[=,;:{)\]]|\s+(?:in|when)\b))/.source, [typeExpression, nonContextualKeywords, name]),
2164
+ inside: typeInside
2165
+ }
2166
+ ],
2167
+ "keyword": keywords,
2168
+ // https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/lexical-structure#literals
2169
+ "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,
2170
+ "operator": />>=?|<<=?|[-=]>|([-+&|])\1|~|\?\?=?|[-+*/%&|^!=<>]=?/,
2171
+ "punctuation": /\?\.?|::|[{}[\];(),.:]/
2172
+ });
2173
+ Prism2.languages.insertBefore("csharp", "number", {
2174
+ "range": {
2175
+ pattern: /\.\./,
2176
+ alias: "operator"
2177
+ }
2178
+ });
2179
+ Prism2.languages.insertBefore("csharp", "punctuation", {
2180
+ "named-parameter": {
2181
+ pattern: re(/([(,]\s*)<<0>>(?=\s*:)/.source, [name]),
2182
+ lookbehind: true,
2183
+ alias: "punctuation"
2184
+ }
2185
+ });
2186
+ Prism2.languages.insertBefore("csharp", "class-name", {
2187
+ "namespace": {
2188
+ // namespace Foo.Bar {}
2189
+ // using Foo.Bar;
2190
+ pattern: re(/(\b(?:namespace|using)\s+)<<0>>(?:\s*\.\s*<<0>>)*(?=\s*[;{])/.source, [name]),
2191
+ lookbehind: true,
2192
+ inside: {
2193
+ "punctuation": /\./
2194
+ }
2195
+ },
2196
+ "type-expression": {
2197
+ // default(Foo), typeof(Foo<Bar>), sizeof(int)
2198
+ pattern: re(/(\b(?:default|sizeof|typeof)\s*\(\s*(?!\s))(?:[^()\s]|\s(?!\s)|<<0>>)*(?=\s*\))/.source, [nestedRound]),
2199
+ lookbehind: true,
2200
+ alias: "class-name",
2201
+ inside: typeInside
2202
+ },
2203
+ "return-type": {
2204
+ // Foo<Bar> ForBar(); Foo IFoo.Bar() => 0
2205
+ // int this[int index] => 0; T IReadOnlyList<T>.this[int index] => this[index];
2206
+ // int Foo => 0; int Foo { get; set } = 0;
2207
+ pattern: re(/<<0>>(?=\s+(?:<<1>>\s*(?:=>|[({]|\.\s*this\s*\[)|this\s*\[))/.source, [typeExpression, identifier]),
2208
+ inside: typeInside,
2209
+ alias: "class-name"
2210
+ },
2211
+ "constructor-invocation": {
2212
+ // new List<Foo<Bar[]>> { }
2213
+ pattern: re(/(\bnew\s+)<<0>>(?=\s*[[({])/.source, [typeExpression]),
2214
+ lookbehind: true,
2215
+ inside: typeInside,
2216
+ alias: "class-name"
2217
+ },
2218
+ /*'explicit-implementation': {
2219
+ // int IFoo<Foo>.Bar => 0; void IFoo<Foo<Foo>>.Foo<T>();
2220
+ pattern: replace(/\b<<0>>(?=\.<<1>>)/, className, methodOrPropertyDeclaration),
2221
+ inside: classNameInside,
2222
+ alias: 'class-name'
2223
+ },*/
2224
+ "generic-method": {
2225
+ // foo<Bar>()
2226
+ pattern: re(/<<0>>\s*<<1>>(?=\s*\()/.source, [name, generic]),
2227
+ inside: {
2228
+ "function": re(/^<<0>>/.source, [name]),
2229
+ "generic": {
2230
+ pattern: RegExp(generic),
2231
+ alias: "class-name",
2232
+ inside: typeInside
2233
+ }
2234
+ }
2235
+ },
2236
+ "type-list": {
2237
+ // The list of types inherited or of generic constraints
2238
+ // class Foo<F> : Bar, IList<FooBar>
2239
+ // where F : Bar, IList<int>
2240
+ pattern: re(
2241
+ /\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,
2242
+ [typeDeclarationKeywords, genericName, name, typeExpression, keywords.source, nestedRound, /\bnew\s*\(\s*\)/.source]
2243
+ ),
2244
+ lookbehind: true,
2245
+ inside: {
2246
+ "record-arguments": {
2247
+ pattern: re(/(^(?!new\s*\()<<0>>\s*)<<1>>/.source, [genericName, nestedRound]),
2248
+ lookbehind: true,
2249
+ greedy: true,
2250
+ inside: Prism2.languages.csharp
2251
+ },
2252
+ "keyword": keywords,
2253
+ "class-name": {
2254
+ pattern: RegExp(typeExpression),
2255
+ greedy: true,
2256
+ inside: typeInside
2257
+ },
2258
+ "punctuation": /[,()]/
2259
+ }
2260
+ },
2261
+ "preprocessor": {
2262
+ pattern: /(^[\t ]*)#.*/m,
2263
+ lookbehind: true,
2264
+ alias: "property",
2265
+ inside: {
2266
+ // highlight preprocessor directives as keywords
2267
+ "directive": {
2268
+ pattern: /(#)\b(?:define|elif|else|endif|endregion|error|if|line|nullable|pragma|region|undef|warning)\b/,
2269
+ lookbehind: true,
2270
+ alias: "keyword"
2271
+ }
2272
+ }
2273
+ }
2274
+ });
2275
+ var regularStringOrCharacter = regularString + "|" + character;
2276
+ var regularStringCharacterOrComment = replace(/\/(?![*/])|\/\/[^\r\n]*[\r\n]|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>/.source, [regularStringOrCharacter]);
2277
+ var roundExpression = nested(replace(/[^"'/()]|<<0>>|\(<<self>>*\)/.source, [regularStringCharacterOrComment]), 2);
2278
+ var attrTarget = /\b(?:assembly|event|field|method|module|param|property|return|type)\b/.source;
2279
+ var attr = replace(/<<0>>(?:\s*\(<<1>>*\))?/.source, [identifier, roundExpression]);
2280
+ Prism2.languages.insertBefore("csharp", "class-name", {
2281
+ "attribute": {
2282
+ // Attributes
2283
+ // [Foo], [Foo(1), Bar(2, Prop = "foo")], [return: Foo(1), Bar(2)], [assembly: Foo(Bar)]
2284
+ pattern: re(/((?:^|[^\s\w>)?])\s*\[\s*)(?:<<0>>\s*:\s*)?<<1>>(?:\s*,\s*<<1>>)*(?=\s*\])/.source, [attrTarget, attr]),
2285
+ lookbehind: true,
2286
+ greedy: true,
2287
+ inside: {
2288
+ "target": {
2289
+ pattern: re(/^<<0>>(?=\s*:)/.source, [attrTarget]),
2290
+ alias: "keyword"
2291
+ },
2292
+ "attribute-arguments": {
2293
+ pattern: re(/\(<<0>>*\)/.source, [roundExpression]),
2294
+ inside: Prism2.languages.csharp
2295
+ },
2296
+ "class-name": {
2297
+ pattern: RegExp(identifier),
2298
+ inside: {
2299
+ "punctuation": /\./
2300
+ }
2301
+ },
2302
+ "punctuation": /[:,]/
2303
+ }
2304
+ }
2305
+ });
2306
+ var formatString = /:[^}\r\n]+/.source;
2307
+ var mInterpolationRound = nested(replace(/[^"'/()]|<<0>>|\(<<self>>*\)/.source, [regularStringCharacterOrComment]), 2);
2308
+ var mInterpolation = replace(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source, [mInterpolationRound, formatString]);
2309
+ var sInterpolationRound = nested(replace(/[^"'/()]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>|\(<<self>>*\)/.source, [regularStringOrCharacter]), 2);
2310
+ var sInterpolation = replace(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source, [sInterpolationRound, formatString]);
2311
+ function createInterpolationInside(interpolation, interpolationRound) {
2312
+ return {
2313
+ "interpolation": {
2314
+ pattern: re(/((?:^|[^{])(?:\{\{)*)<<0>>/.source, [interpolation]),
2315
+ lookbehind: true,
2316
+ inside: {
2317
+ "format-string": {
2318
+ pattern: re(/(^\{(?:(?![}:])<<0>>)*)<<1>>(?=\}$)/.source, [interpolationRound, formatString]),
2319
+ lookbehind: true,
2320
+ inside: {
2321
+ "punctuation": /^:/
2322
+ }
2323
+ },
2324
+ "punctuation": /^\{|\}$/,
2325
+ "expression": {
2326
+ pattern: /[\s\S]+/,
2327
+ alias: "language-csharp",
2328
+ inside: Prism2.languages.csharp
2329
+ }
2330
+ }
2331
+ },
2332
+ "string": /[\s\S]+/
2333
+ };
2334
+ }
2335
+ Prism2.languages.insertBefore("csharp", "string", {
2336
+ "interpolation-string": [
2337
+ {
2338
+ pattern: re(/(^|[^\\])(?:\$@|@\$)"(?:""|\\[\s\S]|\{\{|<<0>>|[^\\{"])*"/.source, [mInterpolation]),
2339
+ lookbehind: true,
2340
+ greedy: true,
2341
+ inside: createInterpolationInside(mInterpolation, mInterpolationRound)
2342
+ },
2343
+ {
2344
+ pattern: re(/(^|[^@\\])\$"(?:\\.|\{\{|<<0>>|[^\\"{])*"/.source, [sInterpolation]),
2345
+ lookbehind: true,
2346
+ greedy: true,
2347
+ inside: createInterpolationInside(sInterpolation, sInterpolationRound)
2348
+ }
2349
+ ],
2350
+ "char": {
2351
+ pattern: RegExp(character),
2352
+ greedy: true
2353
+ }
2354
+ });
2355
+ Prism2.languages.dotnet = Prism2.languages.cs = Prism2.languages.csharp;
2356
+ })(Prism);
2357
+ return prismCsharp;
2358
+ }
2359
+ requirePrismCsharp();
2360
+ Prism.languages.go = Prism.languages.extend("clike", {
2361
+ "string": {
2362
+ pattern: /(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,
2363
+ lookbehind: true,
2364
+ greedy: true
2365
+ },
2366
+ "keyword": /\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,
2367
+ "boolean": /\b(?:_|false|iota|nil|true)\b/,
2368
+ "number": [
2369
+ // binary and octal integers
2370
+ /\b0(?:b[01_]+|o[0-7_]+)i?\b/i,
2371
+ // hexadecimal integers and floats
2372
+ /\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,
2373
+ // decimal integers and floats
2374
+ /(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i
2375
+ ],
2376
+ "operator": /[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,
2377
+ "builtin": /\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/
2378
+ });
2379
+ Prism.languages.insertBefore("go", "string", {
2380
+ "char": {
2381
+ pattern: /'(?:\\.|[^'\\\r\n]){0,10}'/,
2382
+ greedy: true
2383
+ }
2384
+ });
2385
+ delete Prism.languages.go["class-name"];
2386
+ var prismRust = {};
2387
+ var hasRequiredPrismRust;
2388
+ function requirePrismRust() {
2389
+ if (hasRequiredPrismRust) return prismRust;
2390
+ hasRequiredPrismRust = 1;
2391
+ (function(Prism2) {
2392
+ var multilineComment = /\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|<self>)*\*\//.source;
2393
+ for (var i = 0; i < 2; i++) {
2394
+ multilineComment = multilineComment.replace(/<self>/g, function() {
2395
+ return multilineComment;
2396
+ });
2397
+ }
2398
+ multilineComment = multilineComment.replace(/<self>/g, function() {
2399
+ return /[^\s\S]/.source;
2400
+ });
2401
+ Prism2.languages.rust = {
2402
+ "comment": [
2403
+ {
2404
+ pattern: RegExp(/(^|[^\\])/.source + multilineComment),
2405
+ lookbehind: true,
2406
+ greedy: true
2407
+ },
2408
+ {
2409
+ pattern: /(^|[^\\:])\/\/.*/,
2410
+ lookbehind: true,
2411
+ greedy: true
2412
+ }
2413
+ ],
2414
+ "string": {
2415
+ pattern: /b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,
2416
+ greedy: true
2417
+ },
2418
+ "char": {
2419
+ pattern: /b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,
2420
+ greedy: true
2421
+ },
2422
+ "attribute": {
2423
+ pattern: /#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,
2424
+ greedy: true,
2425
+ alias: "attr-name",
2426
+ inside: {
2427
+ "string": null
2428
+ // see below
2429
+ }
2430
+ },
2431
+ // Closure params should not be confused with bitwise OR |
2432
+ "closure-params": {
2433
+ pattern: /([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,
2434
+ lookbehind: true,
2435
+ greedy: true,
2436
+ inside: {
2437
+ "closure-punctuation": {
2438
+ pattern: /^\||\|$/,
2439
+ alias: "punctuation"
2440
+ },
2441
+ rest: null
2442
+ // see below
2443
+ }
2444
+ },
2445
+ "lifetime-annotation": {
2446
+ pattern: /'\w+/,
2447
+ alias: "symbol"
2448
+ },
2449
+ "fragment-specifier": {
2450
+ pattern: /(\$\w+:)[a-z]+/,
2451
+ lookbehind: true,
2452
+ alias: "punctuation"
2453
+ },
2454
+ "variable": /\$\w+/,
2455
+ "function-definition": {
2456
+ pattern: /(\bfn\s+)\w+/,
2457
+ lookbehind: true,
2458
+ alias: "function"
2459
+ },
2460
+ "type-definition": {
2461
+ pattern: /(\b(?:enum|struct|trait|type|union)\s+)\w+/,
2462
+ lookbehind: true,
2463
+ alias: "class-name"
2464
+ },
2465
+ "module-declaration": [
2466
+ {
2467
+ pattern: /(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,
2468
+ lookbehind: true,
2469
+ alias: "namespace"
2470
+ },
2471
+ {
2472
+ pattern: /(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,
2473
+ lookbehind: true,
2474
+ alias: "namespace",
2475
+ inside: {
2476
+ "punctuation": /::/
2477
+ }
2478
+ }
2479
+ ],
2480
+ "keyword": [
2481
+ // https://github.com/rust-lang/reference/blob/master/src/keywords.md
2482
+ /\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,
2483
+ // primitives and str
2484
+ // https://doc.rust-lang.org/stable/rust-by-example/primitives.html
2485
+ /\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/
2486
+ ],
2487
+ // functions can technically start with an upper-case letter, but this will introduce a lot of false positives
2488
+ // and Rust's naming conventions recommend snake_case anyway.
2489
+ // https://doc.rust-lang.org/1.0.0/style/style/naming/README.html
2490
+ "function": /\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,
2491
+ "macro": {
2492
+ pattern: /\b\w+!/,
2493
+ alias: "property"
2494
+ },
2495
+ "constant": /\b[A-Z_][A-Z_\d]+\b/,
2496
+ "class-name": /\b[A-Z]\w*\b/,
2497
+ "namespace": {
2498
+ pattern: /(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,
2499
+ inside: {
2500
+ "punctuation": /::/
2501
+ }
2502
+ },
2503
+ // Hex, oct, bin, dec numbers with visual separators and type suffix
2504
+ "number": /\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,
2505
+ "boolean": /\b(?:false|true)\b/,
2506
+ "punctuation": /->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,
2507
+ "operator": /[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?=?|[@?]/
2508
+ };
2509
+ Prism2.languages.rust["closure-params"].inside.rest = Prism2.languages.rust;
2510
+ Prism2.languages.rust["attribute"].inside["string"] = Prism2.languages.rust["string"];
2511
+ })(Prism);
2512
+ return prismRust;
2513
+ }
2514
+ requirePrismRust();
2515
+ var prismPhp = {};
2516
+ var hasRequiredPrismPhp;
2517
+ function requirePrismPhp() {
2518
+ if (hasRequiredPrismPhp) return prismPhp;
2519
+ hasRequiredPrismPhp = 1;
2520
+ (function(Prism2) {
2521
+ var comment = /\/\*[\s\S]*?\*\/|\/\/.*|#(?!\[).*/;
2522
+ var constant = [
2523
+ {
2524
+ pattern: /\b(?:false|true)\b/i,
2525
+ alias: "boolean"
2526
+ },
2527
+ {
2528
+ pattern: /(::\s*)\b[a-z_]\w*\b(?!\s*\()/i,
2529
+ greedy: true,
2530
+ lookbehind: true
2531
+ },
2532
+ {
2533
+ pattern: /(\b(?:case|const)\s+)\b[a-z_]\w*(?=\s*[;=])/i,
2534
+ greedy: true,
2535
+ lookbehind: true
2536
+ },
2537
+ /\b(?:null)\b/i,
2538
+ /\b[A-Z_][A-Z0-9_]*\b(?!\s*\()/
2539
+ ];
2540
+ var number = /\b0b[01]+(?:_[01]+)*\b|\b0o[0-7]+(?:_[0-7]+)*\b|\b0x[\da-f]+(?:_[\da-f]+)*\b|(?:\b\d+(?:_\d+)*\.?(?:\d+(?:_\d+)*)?|\B\.\d+)(?:e[+-]?\d+)?/i;
2541
+ var operator = /<?=>|\?\?=?|\.{3}|\??->|[!=]=?=?|::|\*\*=?|--|\+\+|&&|\|\||<<|>>|[?~]|[/^|%*&<>.+-]=?/;
2542
+ var punctuation = /[{}\[\](),:;]/;
2543
+ Prism2.languages.php = {
2544
+ "delimiter": {
2545
+ pattern: /\?>$|^<\?(?:php(?=\s)|=)?/i,
2546
+ alias: "important"
2547
+ },
2548
+ "comment": comment,
2549
+ "variable": /\$+(?:\w+\b|(?=\{))/,
2550
+ "package": {
2551
+ pattern: /(namespace\s+|use\s+(?:function\s+)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,
2552
+ lookbehind: true,
2553
+ inside: {
2554
+ "punctuation": /\\/
2555
+ }
2556
+ },
2557
+ "class-name-definition": {
2558
+ pattern: /(\b(?:class|enum|interface|trait)\s+)\b[a-z_]\w*(?!\\)\b/i,
2559
+ lookbehind: true,
2560
+ alias: "class-name"
2561
+ },
2562
+ "function-definition": {
2563
+ pattern: /(\bfunction\s+)[a-z_]\w*(?=\s*\()/i,
2564
+ lookbehind: true,
2565
+ alias: "function"
2566
+ },
2567
+ "keyword": [
2568
+ {
2569
+ pattern: /(\(\s*)\b(?:array|bool|boolean|float|int|integer|object|string)\b(?=\s*\))/i,
2570
+ alias: "type-casting",
2571
+ greedy: true,
2572
+ lookbehind: true
2573
+ },
2574
+ {
2575
+ pattern: /([(,?]\s*)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|object|self|static|string)\b(?=\s*\$)/i,
2576
+ alias: "type-hint",
2577
+ greedy: true,
2578
+ lookbehind: true
2579
+ },
2580
+ {
2581
+ pattern: /(\)\s*:\s*(?:\?\s*)?)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|never|object|self|static|string|void)\b/i,
2582
+ alias: "return-type",
2583
+ greedy: true,
2584
+ lookbehind: true
2585
+ },
2586
+ {
2587
+ pattern: /\b(?:array(?!\s*\()|bool|float|int|iterable|mixed|object|string|void)\b/i,
2588
+ alias: "type-declaration",
2589
+ greedy: true
2590
+ },
2591
+ {
2592
+ pattern: /(\|\s*)(?:false|null)\b|\b(?:false|null)(?=\s*\|)/i,
2593
+ alias: "type-declaration",
2594
+ greedy: true,
2595
+ lookbehind: true
2596
+ },
2597
+ {
2598
+ pattern: /\b(?:parent|self|static)(?=\s*::)/i,
2599
+ alias: "static-context",
2600
+ greedy: true
2601
+ },
2602
+ {
2603
+ // yield from
2604
+ pattern: /(\byield\s+)from\b/i,
2605
+ lookbehind: true
2606
+ },
2607
+ // `class` is always a keyword unlike other keywords
2608
+ /\bclass\b/i,
2609
+ {
2610
+ // https://www.php.net/manual/en/reserved.keywords.php
2611
+ //
2612
+ // keywords cannot be preceded by "->"
2613
+ // the complex lookbehind means `(?<!(?:->|::)\s*)`
2614
+ pattern: /((?:^|[^\s>:]|(?:^|[^-])>|(?:^|[^:]):)\s*)\b(?:abstract|and|array|as|break|callable|case|catch|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|enum|eval|exit|extends|final|finally|fn|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|match|namespace|never|new|or|parent|print|private|protected|public|readonly|require|require_once|return|self|static|switch|throw|trait|try|unset|use|var|while|xor|yield|__halt_compiler)\b/i,
2615
+ lookbehind: true
2616
+ }
2617
+ ],
2618
+ "argument-name": {
2619
+ pattern: /([(,]\s*)\b[a-z_]\w*(?=\s*:(?!:))/i,
2620
+ lookbehind: true
2621
+ },
2622
+ "class-name": [
2623
+ {
2624
+ pattern: /(\b(?:extends|implements|instanceof|new(?!\s+self|\s+static))\s+|\bcatch\s*\()\b[a-z_]\w*(?!\\)\b/i,
2625
+ greedy: true,
2626
+ lookbehind: true
2627
+ },
2628
+ {
2629
+ pattern: /(\|\s*)\b[a-z_]\w*(?!\\)\b/i,
2630
+ greedy: true,
2631
+ lookbehind: true
2632
+ },
2633
+ {
2634
+ pattern: /\b[a-z_]\w*(?!\\)\b(?=\s*\|)/i,
2635
+ greedy: true
2636
+ },
2637
+ {
2638
+ pattern: /(\|\s*)(?:\\?\b[a-z_]\w*)+\b/i,
2639
+ alias: "class-name-fully-qualified",
2640
+ greedy: true,
2641
+ lookbehind: true,
2642
+ inside: {
2643
+ "punctuation": /\\/
2644
+ }
2645
+ },
2646
+ {
2647
+ pattern: /(?:\\?\b[a-z_]\w*)+\b(?=\s*\|)/i,
2648
+ alias: "class-name-fully-qualified",
2649
+ greedy: true,
2650
+ inside: {
2651
+ "punctuation": /\\/
2652
+ }
2653
+ },
2654
+ {
2655
+ pattern: /(\b(?:extends|implements|instanceof|new(?!\s+self\b|\s+static\b))\s+|\bcatch\s*\()(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,
2656
+ alias: "class-name-fully-qualified",
2657
+ greedy: true,
2658
+ lookbehind: true,
2659
+ inside: {
2660
+ "punctuation": /\\/
2661
+ }
2662
+ },
2663
+ {
2664
+ pattern: /\b[a-z_]\w*(?=\s*\$)/i,
2665
+ alias: "type-declaration",
2666
+ greedy: true
2667
+ },
2668
+ {
2669
+ pattern: /(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,
2670
+ alias: ["class-name-fully-qualified", "type-declaration"],
2671
+ greedy: true,
2672
+ inside: {
2673
+ "punctuation": /\\/
2674
+ }
2675
+ },
2676
+ {
2677
+ pattern: /\b[a-z_]\w*(?=\s*::)/i,
2678
+ alias: "static-context",
2679
+ greedy: true
2680
+ },
2681
+ {
2682
+ pattern: /(?:\\?\b[a-z_]\w*)+(?=\s*::)/i,
2683
+ alias: ["class-name-fully-qualified", "static-context"],
2684
+ greedy: true,
2685
+ inside: {
2686
+ "punctuation": /\\/
2687
+ }
2688
+ },
2689
+ {
2690
+ pattern: /([(,?]\s*)[a-z_]\w*(?=\s*\$)/i,
2691
+ alias: "type-hint",
2692
+ greedy: true,
2693
+ lookbehind: true
2694
+ },
2695
+ {
2696
+ pattern: /([(,?]\s*)(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,
2697
+ alias: ["class-name-fully-qualified", "type-hint"],
2698
+ greedy: true,
2699
+ lookbehind: true,
2700
+ inside: {
2701
+ "punctuation": /\\/
2702
+ }
2703
+ },
2704
+ {
2705
+ pattern: /(\)\s*:\s*(?:\?\s*)?)\b[a-z_]\w*(?!\\)\b/i,
2706
+ alias: "return-type",
2707
+ greedy: true,
2708
+ lookbehind: true
2709
+ },
2710
+ {
2711
+ pattern: /(\)\s*:\s*(?:\?\s*)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,
2712
+ alias: ["class-name-fully-qualified", "return-type"],
2713
+ greedy: true,
2714
+ lookbehind: true,
2715
+ inside: {
2716
+ "punctuation": /\\/
2717
+ }
2718
+ }
2719
+ ],
2720
+ "constant": constant,
2721
+ "function": {
2722
+ pattern: /(^|[^\\\w])\\?[a-z_](?:[\w\\]*\w)?(?=\s*\()/i,
2723
+ lookbehind: true,
2724
+ inside: {
2725
+ "punctuation": /\\/
2726
+ }
2727
+ },
2728
+ "property": {
2729
+ pattern: /(->\s*)\w+/,
2730
+ lookbehind: true
2731
+ },
2732
+ "number": number,
2733
+ "operator": operator,
2734
+ "punctuation": punctuation
2735
+ };
2736
+ var string_interpolation = {
2737
+ pattern: /\{\$(?:\{(?:\{[^{}]+\}|[^{}]+)\}|[^{}])+\}|(^|[^\\{])\$+(?:\w+(?:\[[^\r\n\[\]]+\]|->\w+)?)/,
2738
+ lookbehind: true,
2739
+ inside: Prism2.languages.php
2740
+ };
2741
+ var string = [
2742
+ {
2743
+ pattern: /<<<'([^']+)'[\r\n](?:.*[\r\n])*?\1;/,
2744
+ alias: "nowdoc-string",
2745
+ greedy: true,
2746
+ inside: {
2747
+ "delimiter": {
2748
+ pattern: /^<<<'[^']+'|[a-z_]\w*;$/i,
2749
+ alias: "symbol",
2750
+ inside: {
2751
+ "punctuation": /^<<<'?|[';]$/
2752
+ }
2753
+ }
2754
+ }
2755
+ },
2756
+ {
2757
+ pattern: /<<<(?:"([^"]+)"[\r\n](?:.*[\r\n])*?\1;|([a-z_]\w*)[\r\n](?:.*[\r\n])*?\2;)/i,
2758
+ alias: "heredoc-string",
2759
+ greedy: true,
2760
+ inside: {
2761
+ "delimiter": {
2762
+ pattern: /^<<<(?:"[^"]+"|[a-z_]\w*)|[a-z_]\w*;$/i,
2763
+ alias: "symbol",
2764
+ inside: {
2765
+ "punctuation": /^<<<"?|[";]$/
2766
+ }
2767
+ },
2768
+ "interpolation": string_interpolation
2769
+ }
2770
+ },
2771
+ {
2772
+ pattern: /`(?:\\[\s\S]|[^\\`])*`/,
2773
+ alias: "backtick-quoted-string",
2774
+ greedy: true
2775
+ },
2776
+ {
2777
+ pattern: /'(?:\\[\s\S]|[^\\'])*'/,
2778
+ alias: "single-quoted-string",
2779
+ greedy: true
2780
+ },
2781
+ {
2782
+ pattern: /"(?:\\[\s\S]|[^\\"])*"/,
2783
+ alias: "double-quoted-string",
2784
+ greedy: true,
2785
+ inside: {
2786
+ "interpolation": string_interpolation
2787
+ }
2788
+ }
2789
+ ];
2790
+ Prism2.languages.insertBefore("php", "variable", {
2791
+ "string": string,
2792
+ "attribute": {
2793
+ pattern: /#\[(?:[^"'\/#]|\/(?![*/])|\/\/.*$|#(?!\[).*$|\/\*(?:[^*]|\*(?!\/))*\*\/|"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*')+\](?=\s*[a-z$#])/im,
2794
+ greedy: true,
2795
+ inside: {
2796
+ "attribute-content": {
2797
+ pattern: /^(#\[)[\s\S]+(?=\]$)/,
2798
+ lookbehind: true,
2799
+ // inside can appear subset of php
2800
+ inside: {
2801
+ "comment": comment,
2802
+ "string": string,
2803
+ "attribute-class-name": [
2804
+ {
2805
+ pattern: /([^:]|^)\b[a-z_]\w*(?!\\)\b/i,
2806
+ alias: "class-name",
2807
+ greedy: true,
2808
+ lookbehind: true
2809
+ },
2810
+ {
2811
+ pattern: /([^:]|^)(?:\\?\b[a-z_]\w*)+/i,
2812
+ alias: [
2813
+ "class-name",
2814
+ "class-name-fully-qualified"
2815
+ ],
2816
+ greedy: true,
2817
+ lookbehind: true,
2818
+ inside: {
2819
+ "punctuation": /\\/
2820
+ }
2821
+ }
2822
+ ],
2823
+ "constant": constant,
2824
+ "number": number,
2825
+ "operator": operator,
2826
+ "punctuation": punctuation
2827
+ }
2828
+ },
2829
+ "delimiter": {
2830
+ pattern: /^#\[|\]$/,
2831
+ alias: "punctuation"
2832
+ }
2833
+ }
2834
+ }
2835
+ });
2836
+ Prism2.hooks.add("before-tokenize", function(env) {
2837
+ if (!/<\?/.test(env.code)) {
2838
+ return;
2839
+ }
2840
+ var phpPattern = /<\?(?:[^"'/#]|\/(?![*/])|("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|(?:\/\/|#(?!\[))(?:[^?\n\r]|\?(?!>))*(?=$|\?>|[\r\n])|#\[|\/\*(?:[^*]|\*(?!\/))*(?:\*\/|$))*?(?:\?>|$)/g;
2841
+ Prism2.languages["markup-templating"].buildPlaceholders(env, "php", phpPattern);
2842
+ });
2843
+ Prism2.hooks.add("after-tokenize", function(env) {
2844
+ Prism2.languages["markup-templating"].tokenizePlaceholders(env, "php");
2845
+ });
2846
+ })(Prism);
2847
+ return prismPhp;
2848
+ }
2849
+ requirePrismPhp();
2850
+ var prismRuby = {};
2851
+ var hasRequiredPrismRuby;
2852
+ function requirePrismRuby() {
2853
+ if (hasRequiredPrismRuby) return prismRuby;
2854
+ hasRequiredPrismRuby = 1;
2855
+ (function(Prism2) {
2856
+ Prism2.languages.ruby = Prism2.languages.extend("clike", {
2857
+ "comment": {
2858
+ pattern: /#.*|^=begin\s[\s\S]*?^=end/m,
2859
+ greedy: true
2860
+ },
2861
+ "class-name": {
2862
+ pattern: /(\b(?:class|module)\s+|\bcatch\s+\()[\w.\\]+|\b[A-Z_]\w*(?=\s*\.\s*new\b)/,
2863
+ lookbehind: true,
2864
+ inside: {
2865
+ "punctuation": /[.\\]/
2866
+ }
2867
+ },
2868
+ "keyword": /\b(?:BEGIN|END|alias|and|begin|break|case|class|def|define_method|defined|do|each|else|elsif|end|ensure|extend|for|if|in|include|module|new|next|nil|not|or|prepend|private|protected|public|raise|redo|require|rescue|retry|return|self|super|then|throw|undef|unless|until|when|while|yield)\b/,
2869
+ "operator": /\.{2,3}|&\.|===|<?=>|[!=]?~|(?:&&|\|\||<<|>>|\*\*|[+\-*/%<>!^&|=])=?|[?:]/,
2870
+ "punctuation": /[(){}[\].,;]/
2871
+ });
2872
+ Prism2.languages.insertBefore("ruby", "operator", {
2873
+ "double-colon": {
2874
+ pattern: /::/,
2875
+ alias: "punctuation"
2876
+ }
2877
+ });
2878
+ var interpolation = {
2879
+ pattern: /((?:^|[^\\])(?:\\{2})*)#\{(?:[^{}]|\{[^{}]*\})*\}/,
2880
+ lookbehind: true,
2881
+ inside: {
2882
+ "content": {
2883
+ pattern: /^(#\{)[\s\S]+(?=\}$)/,
2884
+ lookbehind: true,
2885
+ inside: Prism2.languages.ruby
2886
+ },
2887
+ "delimiter": {
2888
+ pattern: /^#\{|\}$/,
2889
+ alias: "punctuation"
2890
+ }
2891
+ }
2892
+ };
2893
+ delete Prism2.languages.ruby.function;
2894
+ var percentExpression = "(?:" + [
2895
+ /([^a-zA-Z0-9\s{(\[<=])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,
2896
+ /\((?:[^()\\]|\\[\s\S]|\((?:[^()\\]|\\[\s\S])*\))*\)/.source,
2897
+ /\{(?:[^{}\\]|\\[\s\S]|\{(?:[^{}\\]|\\[\s\S])*\})*\}/.source,
2898
+ /\[(?:[^\[\]\\]|\\[\s\S]|\[(?:[^\[\]\\]|\\[\s\S])*\])*\]/.source,
2899
+ /<(?:[^<>\\]|\\[\s\S]|<(?:[^<>\\]|\\[\s\S])*>)*>/.source
2900
+ ].join("|") + ")";
2901
+ var symbolName = /(?:"(?:\\.|[^"\\\r\n])*"|(?:\b[a-zA-Z_]\w*|[^\s\0-\x7F]+)[?!]?|\$.)/.source;
2902
+ Prism2.languages.insertBefore("ruby", "keyword", {
2903
+ "regex-literal": [
2904
+ {
2905
+ pattern: RegExp(/%r/.source + percentExpression + /[egimnosux]{0,6}/.source),
2906
+ greedy: true,
2907
+ inside: {
2908
+ "interpolation": interpolation,
2909
+ "regex": /[\s\S]+/
2910
+ }
2911
+ },
2912
+ {
2913
+ pattern: /(^|[^/])\/(?!\/)(?:\[[^\r\n\]]+\]|\\.|[^[/\\\r\n])+\/[egimnosux]{0,6}(?=\s*(?:$|[\r\n,.;})#]))/,
2914
+ lookbehind: true,
2915
+ greedy: true,
2916
+ inside: {
2917
+ "interpolation": interpolation,
2918
+ "regex": /[\s\S]+/
2919
+ }
2920
+ }
2921
+ ],
2922
+ "variable": /[@$]+[a-zA-Z_]\w*(?:[?!]|\b)/,
2923
+ "symbol": [
2924
+ {
2925
+ pattern: RegExp(/(^|[^:]):/.source + symbolName),
2926
+ lookbehind: true,
2927
+ greedy: true
2928
+ },
2929
+ {
2930
+ pattern: RegExp(/([\r\n{(,][ \t]*)/.source + symbolName + /(?=:(?!:))/.source),
2931
+ lookbehind: true,
2932
+ greedy: true
2933
+ }
2934
+ ],
2935
+ "method-definition": {
2936
+ pattern: /(\bdef\s+)\w+(?:\s*\.\s*\w+)?/,
2937
+ lookbehind: true,
2938
+ inside: {
2939
+ "function": /\b\w+$/,
2940
+ "keyword": /^self\b/,
2941
+ "class-name": /^\w+/,
2942
+ "punctuation": /\./
2943
+ }
2944
+ }
2945
+ });
2946
+ Prism2.languages.insertBefore("ruby", "string", {
2947
+ "string-literal": [
2948
+ {
2949
+ pattern: RegExp(/%[qQiIwWs]?/.source + percentExpression),
2950
+ greedy: true,
2951
+ inside: {
2952
+ "interpolation": interpolation,
2953
+ "string": /[\s\S]+/
2954
+ }
2955
+ },
2956
+ {
2957
+ pattern: /("|')(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|(?!\1)[^\\#\r\n])*\1/,
2958
+ greedy: true,
2959
+ inside: {
2960
+ "interpolation": interpolation,
2961
+ "string": /[\s\S]+/
2962
+ }
2963
+ },
2964
+ {
2965
+ pattern: /<<[-~]?([a-z_]\w*)[\r\n](?:.*[\r\n])*?[\t ]*\1/i,
2966
+ alias: "heredoc-string",
2967
+ greedy: true,
2968
+ inside: {
2969
+ "delimiter": {
2970
+ pattern: /^<<[-~]?[a-z_]\w*|\b[a-z_]\w*$/i,
2971
+ inside: {
2972
+ "symbol": /\b\w+/,
2973
+ "punctuation": /^<<[-~]?/
2974
+ }
2975
+ },
2976
+ "interpolation": interpolation,
2977
+ "string": /[\s\S]+/
2978
+ }
2979
+ },
2980
+ {
2981
+ pattern: /<<[-~]?'([a-z_]\w*)'[\r\n](?:.*[\r\n])*?[\t ]*\1/i,
2982
+ alias: "heredoc-string",
2983
+ greedy: true,
2984
+ inside: {
2985
+ "delimiter": {
2986
+ pattern: /^<<[-~]?'[a-z_]\w*'|\b[a-z_]\w*$/i,
2987
+ inside: {
2988
+ "symbol": /\b\w+/,
2989
+ "punctuation": /^<<[-~]?'|'$/
2990
+ }
2991
+ },
2992
+ "string": /[\s\S]+/
2993
+ }
2994
+ }
2995
+ ],
2996
+ "command-literal": [
2997
+ {
2998
+ pattern: RegExp(/%x/.source + percentExpression),
2999
+ greedy: true,
3000
+ inside: {
3001
+ "interpolation": interpolation,
3002
+ "command": {
3003
+ pattern: /[\s\S]+/,
3004
+ alias: "string"
3005
+ }
3006
+ }
3007
+ },
3008
+ {
3009
+ pattern: /`(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|[^\\`#\r\n])*`/,
3010
+ greedy: true,
3011
+ inside: {
3012
+ "interpolation": interpolation,
3013
+ "command": {
3014
+ pattern: /[\s\S]+/,
3015
+ alias: "string"
3016
+ }
3017
+ }
3018
+ }
3019
+ ]
3020
+ });
3021
+ delete Prism2.languages.ruby.string;
3022
+ Prism2.languages.insertBefore("ruby", "number", {
3023
+ "builtin": /\b(?:Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Fixnum|Float|Hash|IO|Integer|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|Stat|String|Struct|Symbol|TMS|Thread|ThreadGroup|Time|TrueClass)\b/,
3024
+ "constant": /\b[A-Z][A-Z0-9_]*(?:[?!]|\b)/
3025
+ });
3026
+ Prism2.languages.rb = Prism2.languages.ruby;
3027
+ })(Prism);
3028
+ return prismRuby;
3029
+ }
3030
+ requirePrismRuby();
3031
+ Prism.languages.swift = {
3032
+ "comment": {
3033
+ // Nested comments are supported up to 2 levels
3034
+ pattern: /(^|[^\\:])(?:\/\/.*|\/\*(?:[^/*]|\/(?!\*)|\*(?!\/)|\/\*(?:[^*]|\*(?!\/))*\*\/)*\*\/)/,
3035
+ lookbehind: true,
3036
+ greedy: true
3037
+ },
3038
+ "string-literal": [
3039
+ // https://docs.swift.org/swift-book/LanguageGuide/StringsAndCharacters.html
3040
+ {
3041
+ pattern: RegExp(
3042
+ /(^|[^"#])/.source + "(?:" + /"(?:\\(?:\((?:[^()]|\([^()]*\))*\)|\r\n|[^(])|[^\\\r\n"])*"/.source + "|" + /"""(?:\\(?:\((?:[^()]|\([^()]*\))*\)|[^(])|[^\\"]|"(?!""))*"""/.source + ")" + /(?!["#])/.source
3043
+ ),
3044
+ lookbehind: true,
3045
+ greedy: true,
3046
+ inside: {
3047
+ "interpolation": {
3048
+ pattern: /(\\\()(?:[^()]|\([^()]*\))*(?=\))/,
3049
+ lookbehind: true,
3050
+ inside: null
3051
+ // see below
3052
+ },
3053
+ "interpolation-punctuation": {
3054
+ pattern: /^\)|\\\($/,
3055
+ alias: "punctuation"
3056
+ },
3057
+ "punctuation": /\\(?=[\r\n])/,
3058
+ "string": /[\s\S]+/
3059
+ }
3060
+ },
3061
+ {
3062
+ pattern: RegExp(
3063
+ /(^|[^"#])(#+)/.source + "(?:" + /"(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|\r\n|[^#])|[^\\\r\n])*?"/.source + "|" + /"""(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|[^#])|[^\\])*?"""/.source + ")\\2"
3064
+ ),
3065
+ lookbehind: true,
3066
+ greedy: true,
3067
+ inside: {
3068
+ "interpolation": {
3069
+ pattern: /(\\#+\()(?:[^()]|\([^()]*\))*(?=\))/,
3070
+ lookbehind: true,
3071
+ inside: null
3072
+ // see below
3073
+ },
3074
+ "interpolation-punctuation": {
3075
+ pattern: /^\)|\\#+\($/,
3076
+ alias: "punctuation"
3077
+ },
3078
+ "string": /[\s\S]+/
3079
+ }
3080
+ }
3081
+ ],
3082
+ "directive": {
3083
+ // directives with conditions
3084
+ pattern: RegExp(
3085
+ /#/.source + "(?:" + (/(?:elseif|if)\b/.source + "(?:[ ]*" + /(?:![ \t]*)?(?:\b\w+\b(?:[ \t]*\((?:[^()]|\([^()]*\))*\))?|\((?:[^()]|\([^()]*\))*\))(?:[ \t]*(?:&&|\|\|))?/.source + ")+") + "|" + /(?:else|endif)\b/.source + ")"
3086
+ ),
3087
+ alias: "property",
3088
+ inside: {
3089
+ "directive-name": /^#\w+/,
3090
+ "boolean": /\b(?:false|true)\b/,
3091
+ "number": /\b\d+(?:\.\d+)*\b/,
3092
+ "operator": /!|&&|\|\||[<>]=?/,
3093
+ "punctuation": /[(),]/
3094
+ }
3095
+ },
3096
+ "literal": {
3097
+ pattern: /#(?:colorLiteral|column|dsohandle|file(?:ID|Literal|Path)?|function|imageLiteral|line)\b/,
3098
+ alias: "constant"
3099
+ },
3100
+ "other-directive": {
3101
+ pattern: /#\w+\b/,
3102
+ alias: "property"
3103
+ },
3104
+ "attribute": {
3105
+ pattern: /@\w+/,
3106
+ alias: "atrule"
3107
+ },
3108
+ "function-definition": {
3109
+ pattern: /(\bfunc\s+)\w+/,
3110
+ lookbehind: true,
3111
+ alias: "function"
3112
+ },
3113
+ "label": {
3114
+ // https://docs.swift.org/swift-book/LanguageGuide/ControlFlow.html#ID141
3115
+ pattern: /\b(break|continue)\s+\w+|\b[a-zA-Z_]\w*(?=\s*:\s*(?:for|repeat|while)\b)/,
3116
+ lookbehind: true,
3117
+ alias: "important"
3118
+ },
3119
+ "keyword": /\b(?:Any|Protocol|Self|Type|actor|as|assignment|associatedtype|associativity|async|await|break|case|catch|class|continue|convenience|default|defer|deinit|didSet|do|dynamic|else|enum|extension|fallthrough|fileprivate|final|for|func|get|guard|higherThan|if|import|in|indirect|infix|init|inout|internal|is|isolated|lazy|left|let|lowerThan|mutating|none|nonisolated|nonmutating|open|operator|optional|override|postfix|precedencegroup|prefix|private|protocol|public|repeat|required|rethrows|return|right|safe|self|set|some|static|struct|subscript|super|switch|throw|throws|try|typealias|unowned|unsafe|var|weak|where|while|willSet)\b/,
3120
+ "boolean": /\b(?:false|true)\b/,
3121
+ "nil": {
3122
+ pattern: /\bnil\b/,
3123
+ alias: "constant"
3124
+ },
3125
+ "short-argument": /\$\d+\b/,
3126
+ "omit": {
3127
+ pattern: /\b_\b/,
3128
+ alias: "keyword"
3129
+ },
3130
+ "number": /\b(?:[\d_]+(?:\.[\de_]+)?|0x[a-f0-9_]+(?:\.[a-f0-9p_]+)?|0b[01_]+|0o[0-7_]+)\b/i,
3131
+ // A class name must start with an upper-case letter and be either 1 letter long or contain a lower-case letter.
3132
+ "class-name": /\b[A-Z](?:[A-Z_\d]*[a-z]\w*)?\b/,
3133
+ "function": /\b[a-z_]\w*(?=\s*\()/i,
3134
+ "constant": /\b(?:[A-Z_]{2,}|k[A-Z][A-Za-z_]+)\b/,
3135
+ // Operators are generic in Swift. Developers can even create new operators (e.g. +++).
3136
+ // https://docs.swift.org/swift-book/ReferenceManual/zzSummaryOfTheGrammar.html#ID481
3137
+ // This regex only supports ASCII operators.
3138
+ "operator": /[-+*/%=!<>&|^~?]+|\.[.\-+*/%=!<>&|^~?]+/,
3139
+ "punctuation": /[{}[\]();,.:\\]/
3140
+ };
3141
+ Prism.languages.swift["string-literal"].forEach(function(rule) {
3142
+ rule.inside["interpolation"].inside = Prism.languages.swift;
3143
+ });
3144
+ (function(Prism2) {
3145
+ Prism2.languages.kotlin = Prism2.languages.extend("clike", {
3146
+ "keyword": {
3147
+ // The lookbehind prevents wrong highlighting of e.g. kotlin.properties.get
3148
+ pattern: /(^|[^.])\b(?:abstract|actual|annotation|as|break|by|catch|class|companion|const|constructor|continue|crossinline|data|do|dynamic|else|enum|expect|external|final|finally|for|fun|get|if|import|in|infix|init|inline|inner|interface|internal|is|lateinit|noinline|null|object|open|operator|out|override|package|private|protected|public|reified|return|sealed|set|super|suspend|tailrec|this|throw|to|try|typealias|val|var|vararg|when|where|while)\b/,
3149
+ lookbehind: true
3150
+ },
3151
+ "function": [
3152
+ {
3153
+ pattern: /(?:`[^\r\n`]+`|\b\w+)(?=\s*\()/,
3154
+ greedy: true
3155
+ },
3156
+ {
3157
+ pattern: /(\.)(?:`[^\r\n`]+`|\w+)(?=\s*\{)/,
3158
+ lookbehind: true,
3159
+ greedy: true
3160
+ }
3161
+ ],
3162
+ "number": /\b(?:0[xX][\da-fA-F]+(?:_[\da-fA-F]+)*|0[bB][01]+(?:_[01]+)*|\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?(?:[eE][+-]?\d+(?:_\d+)*)?[fFL]?)\b/,
3163
+ "operator": /\+[+=]?|-[-=>]?|==?=?|!(?:!|==?)?|[\/*%<>]=?|[?:]:?|\.\.|&&|\|\||\b(?:and|inv|or|shl|shr|ushr|xor)\b/
3164
+ });
3165
+ delete Prism2.languages.kotlin["class-name"];
3166
+ var interpolationInside = {
3167
+ "interpolation-punctuation": {
3168
+ pattern: /^\$\{?|\}$/,
3169
+ alias: "punctuation"
3170
+ },
3171
+ "expression": {
3172
+ pattern: /[\s\S]+/,
3173
+ inside: Prism2.languages.kotlin
3174
+ }
3175
+ };
3176
+ Prism2.languages.insertBefore("kotlin", "string", {
3177
+ // https://kotlinlang.org/spec/expressions.html#string-interpolation-expressions
3178
+ "string-literal": [
3179
+ {
3180
+ pattern: /"""(?:[^$]|\$(?:(?!\{)|\{[^{}]*\}))*?"""/,
3181
+ alias: "multiline",
3182
+ inside: {
3183
+ "interpolation": {
3184
+ pattern: /\$(?:[a-z_]\w*|\{[^{}]*\})/i,
3185
+ inside: interpolationInside
3186
+ },
3187
+ "string": /[\s\S]+/
3188
+ }
3189
+ },
3190
+ {
3191
+ pattern: /"(?:[^"\\\r\n$]|\\.|\$(?:(?!\{)|\{[^{}]*\}))*"/,
3192
+ alias: "singleline",
3193
+ inside: {
3194
+ "interpolation": {
3195
+ pattern: /((?:^|[^\\])(?:\\{2})*)\$(?:[a-z_]\w*|\{[^{}]*\})/i,
3196
+ lookbehind: true,
3197
+ inside: interpolationInside
3198
+ },
3199
+ "string": /[\s\S]+/
3200
+ }
3201
+ }
3202
+ ],
3203
+ "char": {
3204
+ // https://kotlinlang.org/spec/expressions.html#character-literals
3205
+ pattern: /'(?:[^'\\\r\n]|\\(?:.|u[a-fA-F0-9]{0,4}))'/,
3206
+ greedy: true
3207
+ }
3208
+ });
3209
+ delete Prism2.languages.kotlin["string"];
3210
+ Prism2.languages.insertBefore("kotlin", "keyword", {
3211
+ "annotation": {
3212
+ pattern: /\B@(?:\w+:)?(?:[A-Z]\w*|\[[^\]]+\])/,
3213
+ alias: "builtin"
3214
+ }
3215
+ });
3216
+ Prism2.languages.insertBefore("kotlin", "function", {
3217
+ "label": {
3218
+ pattern: /\b\w+@|@\w+\b/,
3219
+ alias: "symbol"
3220
+ }
3221
+ });
3222
+ Prism2.languages.kt = Prism2.languages.kotlin;
3223
+ Prism2.languages.kts = Prism2.languages.kotlin;
3224
+ })(Prism);
3225
+ Prism.languages.scala = Prism.languages.extend("java", {
3226
+ "triple-quoted-string": {
3227
+ pattern: /"""[\s\S]*?"""/,
3228
+ greedy: true,
3229
+ alias: "string"
3230
+ },
3231
+ "string": {
3232
+ pattern: /("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,
3233
+ greedy: true
3234
+ },
3235
+ "keyword": /<-|=>|\b(?:abstract|case|catch|class|def|derives|do|else|enum|extends|extension|final|finally|for|forSome|given|if|implicit|import|infix|inline|lazy|match|new|null|object|opaque|open|override|package|private|protected|return|sealed|self|super|this|throw|trait|transparent|try|type|using|val|var|while|with|yield)\b/,
3236
+ "number": /\b0x(?:[\da-f]*\.)?[\da-f]+|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e\d+)?[dfl]?/i,
3237
+ "builtin": /\b(?:Any|AnyRef|AnyVal|Boolean|Byte|Char|Double|Float|Int|Long|Nothing|Short|String|Unit)\b/,
3238
+ "symbol": /'[^\d\s\\]\w*/
3239
+ });
3240
+ Prism.languages.insertBefore("scala", "triple-quoted-string", {
3241
+ "string-interpolation": {
3242
+ pattern: /\b[a-z]\w*(?:"""(?:[^$]|\$(?:[^{]|\{(?:[^{}]|\{[^{}]*\})*\}))*?"""|"(?:[^$"\r\n]|\$(?:[^{]|\{(?:[^{}]|\{[^{}]*\})*\}))*")/i,
3243
+ greedy: true,
3244
+ inside: {
3245
+ "id": {
3246
+ pattern: /^\w+/,
3247
+ greedy: true,
3248
+ alias: "function"
3249
+ },
3250
+ "escape": {
3251
+ pattern: /\\\$"|\$[$"]/,
3252
+ greedy: true,
3253
+ alias: "symbol"
3254
+ },
3255
+ "interpolation": {
3256
+ pattern: /\$(?:\w+|\{(?:[^{}]|\{[^{}]*\})*\})/,
3257
+ greedy: true,
3258
+ inside: {
3259
+ "punctuation": /^\$\{?|\}$/,
3260
+ "expression": {
3261
+ pattern: /[\s\S]+/,
3262
+ inside: Prism.languages.scala
3263
+ }
3264
+ }
3265
+ },
3266
+ "string": /[\s\S]+/
3267
+ }
3268
+ }
3269
+ });
3270
+ delete Prism.languages.scala["class-name"];
3271
+ delete Prism.languages.scala["function"];
3272
+ delete Prism.languages.scala["constant"];
3273
+ exports.Prism = Prism$1;
3274
+ exports.getDefaultExportFromCjs = getDefaultExportFromCjs;