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