@linto-ai/transcript-ui-webcomponent 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3072 @@
1
+ import { p as purify } from "./index-Cf6Ri7kK.js";
2
+ var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
3
+ function getDefaultExportFromCjs(x) {
4
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
5
+ }
6
+ var prism = { exports: {} };
7
+ var hasRequiredPrism;
8
+ function requirePrism() {
9
+ if (hasRequiredPrism) return prism.exports;
10
+ hasRequiredPrism = 1;
11
+ (function(module) {
12
+ var _self = typeof window !== "undefined" ? window : typeof WorkerGlobalScope !== "undefined" && self instanceof WorkerGlobalScope ? self : {};
13
+ var Prism2 = (function(_self2) {
14
+ var lang = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i;
15
+ var uniqueId = 0;
16
+ var plainTextGrammar = {};
17
+ var _ = {
18
+ /**
19
+ * By default, Prism will attempt to highlight all code elements (by calling {@link Prism.highlightAll}) on the
20
+ * current page after the page finished loading. This might be a problem if e.g. you wanted to asynchronously load
21
+ * additional languages or plugins yourself.
22
+ *
23
+ * By setting this value to `true`, Prism will not automatically highlight all code elements on the page.
24
+ *
25
+ * You obviously have to change this value before the automatic highlighting started. To do this, you can add an
26
+ * empty Prism object into the global scope before loading the Prism script like this:
27
+ *
28
+ * ```js
29
+ * window.Prism = window.Prism || {};
30
+ * Prism.manual = true;
31
+ * // add a new <script> to load Prism's script
32
+ * ```
33
+ *
34
+ * @default false
35
+ * @type {boolean}
36
+ * @memberof Prism
37
+ * @public
38
+ */
39
+ manual: _self2.Prism && _self2.Prism.manual,
40
+ /**
41
+ * By default, if Prism is in a web worker, it assumes that it is in a worker it created itself, so it uses
42
+ * `addEventListener` to communicate with its parent instance. However, if you're using Prism manually in your
43
+ * own worker, you don't want it to do this.
44
+ *
45
+ * By setting this value to `true`, Prism will not add its own listeners to the worker.
46
+ *
47
+ * You obviously have to change this value before Prism executes. To do this, you can add an
48
+ * empty Prism object into the global scope before loading the Prism script like this:
49
+ *
50
+ * ```js
51
+ * window.Prism = window.Prism || {};
52
+ * Prism.disableWorkerMessageHandler = true;
53
+ * // Load Prism's script
54
+ * ```
55
+ *
56
+ * @default false
57
+ * @type {boolean}
58
+ * @memberof Prism
59
+ * @public
60
+ */
61
+ disableWorkerMessageHandler: _self2.Prism && _self2.Prism.disableWorkerMessageHandler,
62
+ /**
63
+ * A namespace for utility methods.
64
+ *
65
+ * All function in this namespace that are not explicitly marked as _public_ are for __internal use only__ and may
66
+ * change or disappear at any time.
67
+ *
68
+ * @namespace
69
+ * @memberof Prism
70
+ */
71
+ util: {
72
+ encode: function encode(tokens) {
73
+ if (tokens instanceof Token) {
74
+ return new Token(tokens.type, encode(tokens.content), tokens.alias);
75
+ } else if (Array.isArray(tokens)) {
76
+ return tokens.map(encode);
77
+ } else {
78
+ return tokens.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/\u00a0/g, " ");
79
+ }
80
+ },
81
+ /**
82
+ * Returns the name of the type of the given value.
83
+ *
84
+ * @param {any} o
85
+ * @returns {string}
86
+ * @example
87
+ * type(null) === 'Null'
88
+ * type(undefined) === 'Undefined'
89
+ * type(123) === 'Number'
90
+ * type('foo') === 'String'
91
+ * type(true) === 'Boolean'
92
+ * type([1, 2]) === 'Array'
93
+ * type({}) === 'Object'
94
+ * type(String) === 'Function'
95
+ * type(/abc+/) === 'RegExp'
96
+ */
97
+ type: function(o) {
98
+ return Object.prototype.toString.call(o).slice(8, -1);
99
+ },
100
+ /**
101
+ * Returns a unique number for the given object. Later calls will still return the same number.
102
+ *
103
+ * @param {Object} obj
104
+ * @returns {number}
105
+ */
106
+ objId: function(obj) {
107
+ if (!obj["__id"]) {
108
+ Object.defineProperty(obj, "__id", { value: ++uniqueId });
109
+ }
110
+ return obj["__id"];
111
+ },
112
+ /**
113
+ * Creates a deep clone of the given object.
114
+ *
115
+ * The main intended use of this function is to clone language definitions.
116
+ *
117
+ * @param {T} o
118
+ * @param {Record<number, any>} [visited]
119
+ * @returns {T}
120
+ * @template T
121
+ */
122
+ clone: function deepClone(o, visited) {
123
+ visited = visited || {};
124
+ var clone;
125
+ var id;
126
+ switch (_.util.type(o)) {
127
+ case "Object":
128
+ id = _.util.objId(o);
129
+ if (visited[id]) {
130
+ return visited[id];
131
+ }
132
+ clone = /** @type {Record<string, any>} */
133
+ {};
134
+ visited[id] = clone;
135
+ for (var key in o) {
136
+ if (o.hasOwnProperty(key)) {
137
+ clone[key] = deepClone(o[key], visited);
138
+ }
139
+ }
140
+ return (
141
+ /** @type {any} */
142
+ clone
143
+ );
144
+ case "Array":
145
+ id = _.util.objId(o);
146
+ if (visited[id]) {
147
+ return visited[id];
148
+ }
149
+ clone = [];
150
+ visited[id] = clone;
151
+ /** @type {Array} */
152
+ /** @type {any} */
153
+ o.forEach(function(v, i) {
154
+ clone[i] = deepClone(v, visited);
155
+ });
156
+ return (
157
+ /** @type {any} */
158
+ clone
159
+ );
160
+ default:
161
+ return o;
162
+ }
163
+ },
164
+ /**
165
+ * Returns the Prism language of the given element set by a `language-xxxx` or `lang-xxxx` class.
166
+ *
167
+ * If no language is set for the element or the element is `null` or `undefined`, `none` will be returned.
168
+ *
169
+ * @param {Element} element
170
+ * @returns {string}
171
+ */
172
+ getLanguage: function(element) {
173
+ while (element) {
174
+ var m = lang.exec(element.className);
175
+ if (m) {
176
+ return m[1].toLowerCase();
177
+ }
178
+ element = element.parentElement;
179
+ }
180
+ return "none";
181
+ },
182
+ /**
183
+ * Sets the Prism `language-xxxx` class of the given element.
184
+ *
185
+ * @param {Element} element
186
+ * @param {string} language
187
+ * @returns {void}
188
+ */
189
+ setLanguage: function(element, language) {
190
+ element.className = element.className.replace(RegExp(lang, "gi"), "");
191
+ element.classList.add("language-" + language);
192
+ },
193
+ /**
194
+ * Returns the script element that is currently executing.
195
+ *
196
+ * This does __not__ work for line script element.
197
+ *
198
+ * @returns {HTMLScriptElement | null}
199
+ */
200
+ currentScript: function() {
201
+ if (typeof document === "undefined") {
202
+ return null;
203
+ }
204
+ if (document.currentScript && document.currentScript.tagName === "SCRIPT" && 1 < 2) {
205
+ return (
206
+ /** @type {any} */
207
+ document.currentScript
208
+ );
209
+ }
210
+ try {
211
+ throw new Error();
212
+ } catch (err) {
213
+ var src = (/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(err.stack) || [])[1];
214
+ if (src) {
215
+ var scripts = document.getElementsByTagName("script");
216
+ for (var i in scripts) {
217
+ if (scripts[i].src == src) {
218
+ return scripts[i];
219
+ }
220
+ }
221
+ }
222
+ return null;
223
+ }
224
+ },
225
+ /**
226
+ * Returns whether a given class is active for `element`.
227
+ *
228
+ * The class can be activated if `element` or one of its ancestors has the given class and it can be deactivated
229
+ * if `element` or one of its ancestors has the negated version of the given class. The _negated version_ of the
230
+ * given class is just the given class with a `no-` prefix.
231
+ *
232
+ * Whether the class is active is determined by the closest ancestor of `element` (where `element` itself is
233
+ * closest ancestor) that has the given class or the negated version of it. If neither `element` nor any of its
234
+ * ancestors have the given class or the negated version of it, then the default activation will be returned.
235
+ *
236
+ * In the paradoxical situation where the closest ancestor contains __both__ the given class and the negated
237
+ * version of it, the class is considered active.
238
+ *
239
+ * @param {Element} element
240
+ * @param {string} className
241
+ * @param {boolean} [defaultActivation=false]
242
+ * @returns {boolean}
243
+ */
244
+ isActive: function(element, className, defaultActivation) {
245
+ var no = "no-" + className;
246
+ while (element) {
247
+ var classList = element.classList;
248
+ if (classList.contains(className)) {
249
+ return true;
250
+ }
251
+ if (classList.contains(no)) {
252
+ return false;
253
+ }
254
+ element = element.parentElement;
255
+ }
256
+ return !!defaultActivation;
257
+ }
258
+ },
259
+ /**
260
+ * This namespace contains all currently loaded languages and the some helper functions to create and modify languages.
261
+ *
262
+ * @namespace
263
+ * @memberof Prism
264
+ * @public
265
+ */
266
+ languages: {
267
+ /**
268
+ * The grammar for plain, unformatted text.
269
+ */
270
+ plain: plainTextGrammar,
271
+ plaintext: plainTextGrammar,
272
+ text: plainTextGrammar,
273
+ txt: plainTextGrammar,
274
+ /**
275
+ * Creates a deep copy of the language with the given id and appends the given tokens.
276
+ *
277
+ * If a token in `redef` also appears in the copied language, then the existing token in the copied language
278
+ * will be overwritten at its original position.
279
+ *
280
+ * ## Best practices
281
+ *
282
+ * Since the position of overwriting tokens (token in `redef` that overwrite tokens in the copied language)
283
+ * doesn't matter, they can technically be in any order. However, this can be confusing to others that trying to
284
+ * understand the language definition because, normally, the order of tokens matters in Prism grammars.
285
+ *
286
+ * Therefore, it is encouraged to order overwriting tokens according to the positions of the overwritten tokens.
287
+ * Furthermore, all non-overwriting tokens should be placed after the overwriting ones.
288
+ *
289
+ * @param {string} id The id of the language to extend. This has to be a key in `Prism.languages`.
290
+ * @param {Grammar} redef The new tokens to append.
291
+ * @returns {Grammar} The new language created.
292
+ * @public
293
+ * @example
294
+ * Prism.languages['css-with-colors'] = Prism.languages.extend('css', {
295
+ * // Prism.languages.css already has a 'comment' token, so this token will overwrite CSS' 'comment' token
296
+ * // at its original position
297
+ * 'comment': { ... },
298
+ * // CSS doesn't have a 'color' token, so this token will be appended
299
+ * 'color': /\b(?:red|green|blue)\b/
300
+ * });
301
+ */
302
+ extend: function(id, redef) {
303
+ var lang2 = _.util.clone(_.languages[id]);
304
+ for (var key in redef) {
305
+ lang2[key] = redef[key];
306
+ }
307
+ return lang2;
308
+ },
309
+ /**
310
+ * Inserts tokens _before_ another token in a language definition or any other grammar.
311
+ *
312
+ * ## Usage
313
+ *
314
+ * This helper method makes it easy to modify existing languages. For example, the CSS language definition
315
+ * not only defines CSS highlighting for CSS documents, but also needs to define highlighting for CSS embedded
316
+ * in HTML through `<style>` elements. To do this, it needs to modify `Prism.languages.markup` and add the
317
+ * appropriate tokens. However, `Prism.languages.markup` is a regular JavaScript object literal, so if you do
318
+ * this:
319
+ *
320
+ * ```js
321
+ * Prism.languages.markup.style = {
322
+ * // token
323
+ * };
324
+ * ```
325
+ *
326
+ * then the `style` token will be added (and processed) at the end. `insertBefore` allows you to insert tokens
327
+ * before existing tokens. For the CSS example above, you would use it like this:
328
+ *
329
+ * ```js
330
+ * Prism.languages.insertBefore('markup', 'cdata', {
331
+ * 'style': {
332
+ * // token
333
+ * }
334
+ * });
335
+ * ```
336
+ *
337
+ * ## Special cases
338
+ *
339
+ * If the grammars of `inside` and `insert` have tokens with the same name, the tokens in `inside`'s grammar
340
+ * will be ignored.
341
+ *
342
+ * This behavior can be used to insert tokens after `before`:
343
+ *
344
+ * ```js
345
+ * Prism.languages.insertBefore('markup', 'comment', {
346
+ * 'comment': Prism.languages.markup.comment,
347
+ * // tokens after 'comment'
348
+ * });
349
+ * ```
350
+ *
351
+ * ## Limitations
352
+ *
353
+ * The main problem `insertBefore` has to solve is iteration order. Since ES2015, the iteration order for object
354
+ * properties is guaranteed to be the insertion order (except for integer keys) but some browsers behave
355
+ * differently when keys are deleted and re-inserted. So `insertBefore` can't be implemented by temporarily
356
+ * deleting properties which is necessary to insert at arbitrary positions.
357
+ *
358
+ * To solve this problem, `insertBefore` doesn't actually insert the given tokens into the target object.
359
+ * Instead, it will create a new object and replace all references to the target object with the new one. This
360
+ * can be done without temporarily deleting properties, so the iteration order is well-defined.
361
+ *
362
+ * However, only references that can be reached from `Prism.languages` or `insert` will be replaced. I.e. if
363
+ * you hold the target object in a variable, then the value of the variable will not change.
364
+ *
365
+ * ```js
366
+ * var oldMarkup = Prism.languages.markup;
367
+ * var newMarkup = Prism.languages.insertBefore('markup', 'comment', { ... });
368
+ *
369
+ * assert(oldMarkup !== Prism.languages.markup);
370
+ * assert(newMarkup === Prism.languages.markup);
371
+ * ```
372
+ *
373
+ * @param {string} inside The property of `root` (e.g. a language id in `Prism.languages`) that contains the
374
+ * object to be modified.
375
+ * @param {string} before The key to insert before.
376
+ * @param {Grammar} insert An object containing the key-value pairs to be inserted.
377
+ * @param {Object<string, any>} [root] The object containing `inside`, i.e. the object that contains the
378
+ * object to be modified.
379
+ *
380
+ * Defaults to `Prism.languages`.
381
+ * @returns {Grammar} The new grammar object.
382
+ * @public
383
+ */
384
+ insertBefore: function(inside, before, insert, root) {
385
+ root = root || /** @type {any} */
386
+ _.languages;
387
+ var grammar = root[inside];
388
+ var ret = {};
389
+ for (var token in grammar) {
390
+ if (grammar.hasOwnProperty(token)) {
391
+ if (token == before) {
392
+ for (var newToken in insert) {
393
+ if (insert.hasOwnProperty(newToken)) {
394
+ ret[newToken] = insert[newToken];
395
+ }
396
+ }
397
+ }
398
+ if (!insert.hasOwnProperty(token)) {
399
+ ret[token] = grammar[token];
400
+ }
401
+ }
402
+ }
403
+ var old = root[inside];
404
+ root[inside] = ret;
405
+ _.languages.DFS(_.languages, function(key, value) {
406
+ if (value === old && key != inside) {
407
+ this[key] = ret;
408
+ }
409
+ });
410
+ return ret;
411
+ },
412
+ // Traverse a language definition with Depth First Search
413
+ DFS: function DFS(o, callback, type, visited) {
414
+ visited = visited || {};
415
+ var objId = _.util.objId;
416
+ for (var i in o) {
417
+ if (o.hasOwnProperty(i)) {
418
+ callback.call(o, i, o[i], type || i);
419
+ var property = o[i];
420
+ var propertyType = _.util.type(property);
421
+ if (propertyType === "Object" && !visited[objId(property)]) {
422
+ visited[objId(property)] = true;
423
+ DFS(property, callback, null, visited);
424
+ } else if (propertyType === "Array" && !visited[objId(property)]) {
425
+ visited[objId(property)] = true;
426
+ DFS(property, callback, i, visited);
427
+ }
428
+ }
429
+ }
430
+ }
431
+ },
432
+ plugins: {},
433
+ /**
434
+ * This is the most high-level function in Prism’s API.
435
+ * It fetches all the elements that have a `.language-xxxx` class and then calls {@link Prism.highlightElement} on
436
+ * each one of them.
437
+ *
438
+ * This is equivalent to `Prism.highlightAllUnder(document, async, callback)`.
439
+ *
440
+ * @param {boolean} [async=false] Same as in {@link Prism.highlightAllUnder}.
441
+ * @param {HighlightCallback} [callback] Same as in {@link Prism.highlightAllUnder}.
442
+ * @memberof Prism
443
+ * @public
444
+ */
445
+ highlightAll: function(async, callback) {
446
+ _.highlightAllUnder(document, async, callback);
447
+ },
448
+ /**
449
+ * Fetches all the descendants of `container` that have a `.language-xxxx` class and then calls
450
+ * {@link Prism.highlightElement} on each one of them.
451
+ *
452
+ * The following hooks will be run:
453
+ * 1. `before-highlightall`
454
+ * 2. `before-all-elements-highlight`
455
+ * 3. All hooks of {@link Prism.highlightElement} for each element.
456
+ *
457
+ * @param {ParentNode} container The root element, whose descendants that have a `.language-xxxx` class will be highlighted.
458
+ * @param {boolean} [async=false] Whether each element is to be highlighted asynchronously using Web Workers.
459
+ * @param {HighlightCallback} [callback] An optional callback to be invoked on each element after its highlighting is done.
460
+ * @memberof Prism
461
+ * @public
462
+ */
463
+ highlightAllUnder: function(container, async, callback) {
464
+ var env = {
465
+ callback,
466
+ container,
467
+ selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
468
+ };
469
+ _.hooks.run("before-highlightall", env);
470
+ env.elements = Array.prototype.slice.apply(env.container.querySelectorAll(env.selector));
471
+ _.hooks.run("before-all-elements-highlight", env);
472
+ for (var i = 0, element; element = env.elements[i++]; ) {
473
+ _.highlightElement(element, async === true, env.callback);
474
+ }
475
+ },
476
+ /**
477
+ * Highlights the code inside a single element.
478
+ *
479
+ * The following hooks will be run:
480
+ * 1. `before-sanity-check`
481
+ * 2. `before-highlight`
482
+ * 3. All hooks of {@link Prism.highlight}. These hooks will be run by an asynchronous worker if `async` is `true`.
483
+ * 4. `before-insert`
484
+ * 5. `after-highlight`
485
+ * 6. `complete`
486
+ *
487
+ * Some the above hooks will be skipped if the element doesn't contain any text or there is no grammar loaded for
488
+ * the element's language.
489
+ *
490
+ * @param {Element} element The element containing the code.
491
+ * It must have a class of `language-xxxx` to be processed, where `xxxx` is a valid language identifier.
492
+ * @param {boolean} [async=false] Whether the element is to be highlighted asynchronously using Web Workers
493
+ * to improve performance and avoid blocking the UI when highlighting very large chunks of code. This option is
494
+ * [disabled by default](https://prismjs.com/faq.html#why-is-asynchronous-highlighting-disabled-by-default).
495
+ *
496
+ * Note: All language definitions required to highlight the code must be included in the main `prism.js` file for
497
+ * asynchronous highlighting to work. You can build your own bundle on the
498
+ * [Download page](https://prismjs.com/download.html).
499
+ * @param {HighlightCallback} [callback] An optional callback to be invoked after the highlighting is done.
500
+ * Mostly useful when `async` is `true`, since in that case, the highlighting is done asynchronously.
501
+ * @memberof Prism
502
+ * @public
503
+ */
504
+ highlightElement: function(element, async, callback) {
505
+ var language = _.util.getLanguage(element);
506
+ var grammar = _.languages[language];
507
+ _.util.setLanguage(element, language);
508
+ var parent = element.parentElement;
509
+ if (parent && parent.nodeName.toLowerCase() === "pre") {
510
+ _.util.setLanguage(parent, language);
511
+ }
512
+ var code = element.textContent;
513
+ var env = {
514
+ element,
515
+ language,
516
+ grammar,
517
+ code
518
+ };
519
+ function insertHighlightedCode(highlightedCode) {
520
+ env.highlightedCode = highlightedCode;
521
+ _.hooks.run("before-insert", env);
522
+ env.element.innerHTML = env.highlightedCode;
523
+ _.hooks.run("after-highlight", env);
524
+ _.hooks.run("complete", env);
525
+ callback && callback.call(env.element);
526
+ }
527
+ _.hooks.run("before-sanity-check", env);
528
+ parent = env.element.parentElement;
529
+ if (parent && parent.nodeName.toLowerCase() === "pre" && !parent.hasAttribute("tabindex")) {
530
+ parent.setAttribute("tabindex", "0");
531
+ }
532
+ if (!env.code) {
533
+ _.hooks.run("complete", env);
534
+ callback && callback.call(env.element);
535
+ return;
536
+ }
537
+ _.hooks.run("before-highlight", env);
538
+ if (!env.grammar) {
539
+ insertHighlightedCode(_.util.encode(env.code));
540
+ return;
541
+ }
542
+ if (async && _self2.Worker) {
543
+ var worker = new Worker(_.filename);
544
+ worker.onmessage = function(evt) {
545
+ insertHighlightedCode(evt.data);
546
+ };
547
+ worker.postMessage(JSON.stringify({
548
+ language: env.language,
549
+ code: env.code,
550
+ immediateClose: true
551
+ }));
552
+ } else {
553
+ insertHighlightedCode(_.highlight(env.code, env.grammar, env.language));
554
+ }
555
+ },
556
+ /**
557
+ * Low-level function, only use if you know what you’re doing. It accepts a string of text as input
558
+ * and the language definitions to use, and returns a string with the HTML produced.
559
+ *
560
+ * The following hooks will be run:
561
+ * 1. `before-tokenize`
562
+ * 2. `after-tokenize`
563
+ * 3. `wrap`: On each {@link Token}.
564
+ *
565
+ * @param {string} text A string with the code to be highlighted.
566
+ * @param {Grammar} grammar An object containing the tokens to use.
567
+ *
568
+ * Usually a language definition like `Prism.languages.markup`.
569
+ * @param {string} language The name of the language definition passed to `grammar`.
570
+ * @returns {string} The highlighted HTML.
571
+ * @memberof Prism
572
+ * @public
573
+ * @example
574
+ * Prism.highlight('var foo = true;', Prism.languages.javascript, 'javascript');
575
+ */
576
+ highlight: function(text, grammar, language) {
577
+ var env = {
578
+ code: text,
579
+ grammar,
580
+ language
581
+ };
582
+ _.hooks.run("before-tokenize", env);
583
+ if (!env.grammar) {
584
+ throw new Error('The language "' + env.language + '" has no grammar.');
585
+ }
586
+ env.tokens = _.tokenize(env.code, env.grammar);
587
+ _.hooks.run("after-tokenize", env);
588
+ return Token.stringify(_.util.encode(env.tokens), env.language);
589
+ },
590
+ /**
591
+ * This is the heart of Prism, and the most low-level function you can use. It accepts a string of text as input
592
+ * and the language definitions to use, and returns an array with the tokenized code.
593
+ *
594
+ * When the language definition includes nested tokens, the function is called recursively on each of these tokens.
595
+ *
596
+ * This method could be useful in other contexts as well, as a very crude parser.
597
+ *
598
+ * @param {string} text A string with the code to be highlighted.
599
+ * @param {Grammar} grammar An object containing the tokens to use.
600
+ *
601
+ * Usually a language definition like `Prism.languages.markup`.
602
+ * @returns {TokenStream} An array of strings and tokens, a token stream.
603
+ * @memberof Prism
604
+ * @public
605
+ * @example
606
+ * let code = `var foo = 0;`;
607
+ * let tokens = Prism.tokenize(code, Prism.languages.javascript);
608
+ * tokens.forEach(token => {
609
+ * if (token instanceof Prism.Token && token.type === 'number') {
610
+ * console.log(`Found numeric literal: ${token.content}`);
611
+ * }
612
+ * });
613
+ */
614
+ tokenize: function(text, grammar) {
615
+ var rest = grammar.rest;
616
+ if (rest) {
617
+ for (var token in rest) {
618
+ grammar[token] = rest[token];
619
+ }
620
+ delete grammar.rest;
621
+ }
622
+ var tokenList = new LinkedList();
623
+ addAfter(tokenList, tokenList.head, text);
624
+ matchGrammar(text, tokenList, grammar, tokenList.head, 0);
625
+ return toArray(tokenList);
626
+ },
627
+ /**
628
+ * @namespace
629
+ * @memberof Prism
630
+ * @public
631
+ */
632
+ hooks: {
633
+ all: {},
634
+ /**
635
+ * Adds the given callback to the list of callbacks for the given hook.
636
+ *
637
+ * The callback will be invoked when the hook it is registered for is run.
638
+ * Hooks are usually directly run by a highlight function but you can also run hooks yourself.
639
+ *
640
+ * One callback function can be registered to multiple hooks and the same hook multiple times.
641
+ *
642
+ * @param {string} name The name of the hook.
643
+ * @param {HookCallback} callback The callback function which is given environment variables.
644
+ * @public
645
+ */
646
+ add: function(name, callback) {
647
+ var hooks = _.hooks.all;
648
+ hooks[name] = hooks[name] || [];
649
+ hooks[name].push(callback);
650
+ },
651
+ /**
652
+ * Runs a hook invoking all registered callbacks with the given environment variables.
653
+ *
654
+ * Callbacks will be invoked synchronously and in the order in which they were registered.
655
+ *
656
+ * @param {string} name The name of the hook.
657
+ * @param {Object<string, any>} env The environment variables of the hook passed to all callbacks registered.
658
+ * @public
659
+ */
660
+ run: function(name, env) {
661
+ var callbacks = _.hooks.all[name];
662
+ if (!callbacks || !callbacks.length) {
663
+ return;
664
+ }
665
+ for (var i = 0, callback; callback = callbacks[i++]; ) {
666
+ callback(env);
667
+ }
668
+ }
669
+ },
670
+ Token
671
+ };
672
+ _self2.Prism = _;
673
+ function Token(type, content, alias, matchedStr) {
674
+ this.type = type;
675
+ this.content = content;
676
+ this.alias = alias;
677
+ this.length = (matchedStr || "").length | 0;
678
+ }
679
+ Token.stringify = function stringify(o, language) {
680
+ if (typeof o == "string") {
681
+ return o;
682
+ }
683
+ if (Array.isArray(o)) {
684
+ var s = "";
685
+ o.forEach(function(e) {
686
+ s += stringify(e, language);
687
+ });
688
+ return s;
689
+ }
690
+ var env = {
691
+ type: o.type,
692
+ content: stringify(o.content, language),
693
+ tag: "span",
694
+ classes: ["token", o.type],
695
+ attributes: {},
696
+ language
697
+ };
698
+ var aliases = o.alias;
699
+ if (aliases) {
700
+ if (Array.isArray(aliases)) {
701
+ Array.prototype.push.apply(env.classes, aliases);
702
+ } else {
703
+ env.classes.push(aliases);
704
+ }
705
+ }
706
+ _.hooks.run("wrap", env);
707
+ var attributes = "";
708
+ for (var name in env.attributes) {
709
+ attributes += " " + name + '="' + (env.attributes[name] || "").replace(/"/g, "&quot;") + '"';
710
+ }
711
+ return "<" + env.tag + ' class="' + env.classes.join(" ") + '"' + attributes + ">" + env.content + "</" + env.tag + ">";
712
+ };
713
+ function matchPattern(pattern, pos, text, lookbehind) {
714
+ pattern.lastIndex = pos;
715
+ var match = pattern.exec(text);
716
+ if (match && lookbehind && match[1]) {
717
+ var lookbehindLength = match[1].length;
718
+ match.index += lookbehindLength;
719
+ match[0] = match[0].slice(lookbehindLength);
720
+ }
721
+ return match;
722
+ }
723
+ function matchGrammar(text, tokenList, grammar, startNode, startPos, rematch) {
724
+ for (var token in grammar) {
725
+ if (!grammar.hasOwnProperty(token) || !grammar[token]) {
726
+ continue;
727
+ }
728
+ var patterns = grammar[token];
729
+ patterns = Array.isArray(patterns) ? patterns : [patterns];
730
+ for (var j = 0; j < patterns.length; ++j) {
731
+ if (rematch && rematch.cause == token + "," + j) {
732
+ return;
733
+ }
734
+ var patternObj = patterns[j];
735
+ var inside = patternObj.inside;
736
+ var lookbehind = !!patternObj.lookbehind;
737
+ var greedy = !!patternObj.greedy;
738
+ var alias = patternObj.alias;
739
+ if (greedy && !patternObj.pattern.global) {
740
+ var flags = patternObj.pattern.toString().match(/[imsuy]*$/)[0];
741
+ patternObj.pattern = RegExp(patternObj.pattern.source, flags + "g");
742
+ }
743
+ var pattern = patternObj.pattern || patternObj;
744
+ for (var currentNode = startNode.next, pos = startPos; currentNode !== tokenList.tail; pos += currentNode.value.length, currentNode = currentNode.next) {
745
+ if (rematch && pos >= rematch.reach) {
746
+ break;
747
+ }
748
+ var str = currentNode.value;
749
+ if (tokenList.length > text.length) {
750
+ return;
751
+ }
752
+ if (str instanceof Token) {
753
+ continue;
754
+ }
755
+ var removeCount = 1;
756
+ var match;
757
+ if (greedy) {
758
+ match = matchPattern(pattern, pos, text, lookbehind);
759
+ if (!match || match.index >= text.length) {
760
+ break;
761
+ }
762
+ var from = match.index;
763
+ var to = match.index + match[0].length;
764
+ var p = pos;
765
+ p += currentNode.value.length;
766
+ while (from >= p) {
767
+ currentNode = currentNode.next;
768
+ p += currentNode.value.length;
769
+ }
770
+ p -= currentNode.value.length;
771
+ pos = p;
772
+ if (currentNode.value instanceof Token) {
773
+ continue;
774
+ }
775
+ for (var k = currentNode; k !== tokenList.tail && (p < to || typeof k.value === "string"); k = k.next) {
776
+ removeCount++;
777
+ p += k.value.length;
778
+ }
779
+ removeCount--;
780
+ str = text.slice(pos, p);
781
+ match.index -= pos;
782
+ } else {
783
+ match = matchPattern(pattern, 0, str, lookbehind);
784
+ if (!match) {
785
+ continue;
786
+ }
787
+ }
788
+ var from = match.index;
789
+ var matchStr = match[0];
790
+ var before = str.slice(0, from);
791
+ var after = str.slice(from + matchStr.length);
792
+ var reach = pos + str.length;
793
+ if (rematch && reach > rematch.reach) {
794
+ rematch.reach = reach;
795
+ }
796
+ var removeFrom = currentNode.prev;
797
+ if (before) {
798
+ removeFrom = addAfter(tokenList, removeFrom, before);
799
+ pos += before.length;
800
+ }
801
+ removeRange(tokenList, removeFrom, removeCount);
802
+ var wrapped = new Token(token, inside ? _.tokenize(matchStr, inside) : matchStr, alias, matchStr);
803
+ currentNode = addAfter(tokenList, removeFrom, wrapped);
804
+ if (after) {
805
+ addAfter(tokenList, currentNode, after);
806
+ }
807
+ if (removeCount > 1) {
808
+ var nestedRematch = {
809
+ cause: token + "," + j,
810
+ reach
811
+ };
812
+ matchGrammar(text, tokenList, grammar, currentNode.prev, pos, nestedRematch);
813
+ if (rematch && nestedRematch.reach > rematch.reach) {
814
+ rematch.reach = nestedRematch.reach;
815
+ }
816
+ }
817
+ }
818
+ }
819
+ }
820
+ }
821
+ function LinkedList() {
822
+ var head = { value: null, prev: null, next: null };
823
+ var tail = { value: null, prev: head, next: null };
824
+ head.next = tail;
825
+ this.head = head;
826
+ this.tail = tail;
827
+ this.length = 0;
828
+ }
829
+ function addAfter(list, node, value) {
830
+ var next = node.next;
831
+ var newNode = { value, prev: node, next };
832
+ node.next = newNode;
833
+ next.prev = newNode;
834
+ list.length++;
835
+ return newNode;
836
+ }
837
+ function removeRange(list, node, count) {
838
+ var next = node.next;
839
+ for (var i = 0; i < count && next !== list.tail; i++) {
840
+ next = next.next;
841
+ }
842
+ node.next = next;
843
+ next.prev = node;
844
+ list.length -= i;
845
+ }
846
+ function toArray(list) {
847
+ var array = [];
848
+ var node = list.head.next;
849
+ while (node !== list.tail) {
850
+ array.push(node.value);
851
+ node = node.next;
852
+ }
853
+ return array;
854
+ }
855
+ if (!_self2.document) {
856
+ if (!_self2.addEventListener) {
857
+ return _;
858
+ }
859
+ if (!_.disableWorkerMessageHandler) {
860
+ _self2.addEventListener("message", function(evt) {
861
+ var message = JSON.parse(evt.data);
862
+ var lang2 = message.language;
863
+ var code = message.code;
864
+ var immediateClose = message.immediateClose;
865
+ _self2.postMessage(_.highlight(code, _.languages[lang2], lang2));
866
+ if (immediateClose) {
867
+ _self2.close();
868
+ }
869
+ }, false);
870
+ }
871
+ return _;
872
+ }
873
+ var script = _.util.currentScript();
874
+ if (script) {
875
+ _.filename = script.src;
876
+ if (script.hasAttribute("data-manual")) {
877
+ _.manual = true;
878
+ }
879
+ }
880
+ function highlightAutomaticallyCallback() {
881
+ if (!_.manual) {
882
+ _.highlightAll();
883
+ }
884
+ }
885
+ if (!_.manual) {
886
+ var readyState = document.readyState;
887
+ if (readyState === "loading" || readyState === "interactive" && script && script.defer) {
888
+ document.addEventListener("DOMContentLoaded", highlightAutomaticallyCallback);
889
+ } else {
890
+ if (window.requestAnimationFrame) {
891
+ window.requestAnimationFrame(highlightAutomaticallyCallback);
892
+ } else {
893
+ window.setTimeout(highlightAutomaticallyCallback, 16);
894
+ }
895
+ }
896
+ }
897
+ return _;
898
+ })(_self);
899
+ if (module.exports) {
900
+ module.exports = Prism2;
901
+ }
902
+ if (typeof commonjsGlobal !== "undefined") {
903
+ commonjsGlobal.Prism = Prism2;
904
+ }
905
+ Prism2.languages.markup = {
906
+ "comment": {
907
+ pattern: /<!--(?:(?!<!--)[\s\S])*?-->/,
908
+ greedy: true
909
+ },
910
+ "prolog": {
911
+ pattern: /<\?[\s\S]+?\?>/,
912
+ greedy: true
913
+ },
914
+ "doctype": {
915
+ // https://www.w3.org/TR/xml/#NT-doctypedecl
916
+ pattern: /<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,
917
+ greedy: true,
918
+ inside: {
919
+ "internal-subset": {
920
+ pattern: /(^[^\[]*\[)[\s\S]+(?=\]>$)/,
921
+ lookbehind: true,
922
+ greedy: true,
923
+ inside: null
924
+ // see below
925
+ },
926
+ "string": {
927
+ pattern: /"[^"]*"|'[^']*'/,
928
+ greedy: true
929
+ },
930
+ "punctuation": /^<!|>$|[[\]]/,
931
+ "doctype-tag": /^DOCTYPE/i,
932
+ "name": /[^\s<>'"]+/
933
+ }
934
+ },
935
+ "cdata": {
936
+ pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
937
+ greedy: true
938
+ },
939
+ "tag": {
940
+ pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,
941
+ greedy: true,
942
+ inside: {
943
+ "tag": {
944
+ pattern: /^<\/?[^\s>\/]+/,
945
+ inside: {
946
+ "punctuation": /^<\/?/,
947
+ "namespace": /^[^\s>\/:]+:/
948
+ }
949
+ },
950
+ "special-attr": [],
951
+ "attr-value": {
952
+ pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,
953
+ inside: {
954
+ "punctuation": [
955
+ {
956
+ pattern: /^=/,
957
+ alias: "attr-equals"
958
+ },
959
+ {
960
+ pattern: /^(\s*)["']|["']$/,
961
+ lookbehind: true
962
+ }
963
+ ]
964
+ }
965
+ },
966
+ "punctuation": /\/?>/,
967
+ "attr-name": {
968
+ pattern: /[^\s>\/]+/,
969
+ inside: {
970
+ "namespace": /^[^\s>\/:]+:/
971
+ }
972
+ }
973
+ }
974
+ },
975
+ "entity": [
976
+ {
977
+ pattern: /&[\da-z]{1,8};/i,
978
+ alias: "named-entity"
979
+ },
980
+ /&#x?[\da-f]{1,8};/i
981
+ ]
982
+ };
983
+ Prism2.languages.markup["tag"].inside["attr-value"].inside["entity"] = Prism2.languages.markup["entity"];
984
+ Prism2.languages.markup["doctype"].inside["internal-subset"].inside = Prism2.languages.markup;
985
+ Prism2.hooks.add("wrap", function(env) {
986
+ if (env.type === "entity") {
987
+ env.attributes["title"] = env.content.replace(/&amp;/, "&");
988
+ }
989
+ });
990
+ Object.defineProperty(Prism2.languages.markup.tag, "addInlined", {
991
+ /**
992
+ * Adds an inlined language to markup.
993
+ *
994
+ * An example of an inlined language is CSS with `<style>` tags.
995
+ *
996
+ * @param {string} tagName The name of the tag that contains the inlined language. This name will be treated as
997
+ * case insensitive.
998
+ * @param {string} lang The language key.
999
+ * @example
1000
+ * addInlined('style', 'css');
1001
+ */
1002
+ value: function addInlined2(tagName, lang) {
1003
+ var includedCdataInside = {};
1004
+ includedCdataInside["language-" + lang] = {
1005
+ pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
1006
+ lookbehind: true,
1007
+ inside: Prism2.languages[lang]
1008
+ };
1009
+ includedCdataInside["cdata"] = /^<!\[CDATA\[|\]\]>$/i;
1010
+ var inside = {
1011
+ "included-cdata": {
1012
+ pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
1013
+ inside: includedCdataInside
1014
+ }
1015
+ };
1016
+ inside["language-" + lang] = {
1017
+ pattern: /[\s\S]+/,
1018
+ inside: Prism2.languages[lang]
1019
+ };
1020
+ var def = {};
1021
+ def[tagName] = {
1022
+ pattern: RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g, function() {
1023
+ return tagName;
1024
+ }), "i"),
1025
+ lookbehind: true,
1026
+ greedy: true,
1027
+ inside
1028
+ };
1029
+ Prism2.languages.insertBefore("markup", "cdata", def);
1030
+ }
1031
+ });
1032
+ Object.defineProperty(Prism2.languages.markup.tag, "addAttribute", {
1033
+ /**
1034
+ * Adds an pattern to highlight languages embedded in HTML attributes.
1035
+ *
1036
+ * An example of an inlined language is CSS with `style` attributes.
1037
+ *
1038
+ * @param {string} attrName The name of the tag that contains the inlined language. This name will be treated as
1039
+ * case insensitive.
1040
+ * @param {string} lang The language key.
1041
+ * @example
1042
+ * addAttribute('style', 'css');
1043
+ */
1044
+ value: function(attrName, lang) {
1045
+ Prism2.languages.markup.tag.inside["special-attr"].push({
1046
+ pattern: RegExp(
1047
+ /(^|["'\s])/.source + "(?:" + attrName + ")" + /\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,
1048
+ "i"
1049
+ ),
1050
+ lookbehind: true,
1051
+ inside: {
1052
+ "attr-name": /^[^\s=]+/,
1053
+ "attr-value": {
1054
+ pattern: /=[\s\S]+/,
1055
+ inside: {
1056
+ "value": {
1057
+ pattern: /(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,
1058
+ lookbehind: true,
1059
+ alias: [lang, "language-" + lang],
1060
+ inside: Prism2.languages[lang]
1061
+ },
1062
+ "punctuation": [
1063
+ {
1064
+ pattern: /^=/,
1065
+ alias: "attr-equals"
1066
+ },
1067
+ /"|'/
1068
+ ]
1069
+ }
1070
+ }
1071
+ }
1072
+ });
1073
+ }
1074
+ });
1075
+ Prism2.languages.html = Prism2.languages.markup;
1076
+ Prism2.languages.mathml = Prism2.languages.markup;
1077
+ Prism2.languages.svg = Prism2.languages.markup;
1078
+ Prism2.languages.xml = Prism2.languages.extend("markup", {});
1079
+ Prism2.languages.ssml = Prism2.languages.xml;
1080
+ Prism2.languages.atom = Prism2.languages.xml;
1081
+ Prism2.languages.rss = Prism2.languages.xml;
1082
+ (function(Prism3) {
1083
+ var string = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
1084
+ Prism3.languages.css = {
1085
+ "comment": /\/\*[\s\S]*?\*\//,
1086
+ "atrule": {
1087
+ pattern: RegExp("@[\\w-](?:" + /[^;{\s"']|\s+(?!\s)/.source + "|" + string.source + ")*?" + /(?:;|(?=\s*\{))/.source),
1088
+ inside: {
1089
+ "rule": /^@[\w-]+/,
1090
+ "selector-function-argument": {
1091
+ pattern: /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,
1092
+ lookbehind: true,
1093
+ alias: "selector"
1094
+ },
1095
+ "keyword": {
1096
+ pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/,
1097
+ lookbehind: true
1098
+ }
1099
+ // See rest below
1100
+ }
1101
+ },
1102
+ "url": {
1103
+ // https://drafts.csswg.org/css-values-3/#urls
1104
+ pattern: RegExp("\\burl\\((?:" + string.source + "|" + /(?:[^\\\r\n()"']|\\[\s\S])*/.source + ")\\)", "i"),
1105
+ greedy: true,
1106
+ inside: {
1107
+ "function": /^url/i,
1108
+ "punctuation": /^\(|\)$/,
1109
+ "string": {
1110
+ pattern: RegExp("^" + string.source + "$"),
1111
+ alias: "url"
1112
+ }
1113
+ }
1114
+ },
1115
+ "selector": {
1116
+ pattern: RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|` + string.source + ")*(?=\\s*\\{)"),
1117
+ lookbehind: true
1118
+ },
1119
+ "string": {
1120
+ pattern: string,
1121
+ greedy: true
1122
+ },
1123
+ "property": {
1124
+ pattern: /(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,
1125
+ lookbehind: true
1126
+ },
1127
+ "important": /!important\b/i,
1128
+ "function": {
1129
+ pattern: /(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,
1130
+ lookbehind: true
1131
+ },
1132
+ "punctuation": /[(){};:,]/
1133
+ };
1134
+ Prism3.languages.css["atrule"].inside.rest = Prism3.languages.css;
1135
+ var markup = Prism3.languages.markup;
1136
+ if (markup) {
1137
+ markup.tag.addInlined("style", "css");
1138
+ markup.tag.addAttribute("style", "css");
1139
+ }
1140
+ })(Prism2);
1141
+ Prism2.languages.clike = {
1142
+ "comment": [
1143
+ {
1144
+ pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
1145
+ lookbehind: true,
1146
+ greedy: true
1147
+ },
1148
+ {
1149
+ pattern: /(^|[^\\:])\/\/.*/,
1150
+ lookbehind: true,
1151
+ greedy: true
1152
+ }
1153
+ ],
1154
+ "string": {
1155
+ pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
1156
+ greedy: true
1157
+ },
1158
+ "class-name": {
1159
+ pattern: /(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,
1160
+ lookbehind: true,
1161
+ inside: {
1162
+ "punctuation": /[.\\]/
1163
+ }
1164
+ },
1165
+ "keyword": /\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,
1166
+ "boolean": /\b(?:false|true)\b/,
1167
+ "function": /\b\w+(?=\()/,
1168
+ "number": /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
1169
+ "operator": /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
1170
+ "punctuation": /[{}[\];(),.:]/
1171
+ };
1172
+ Prism2.languages.javascript = Prism2.languages.extend("clike", {
1173
+ "class-name": [
1174
+ Prism2.languages.clike["class-name"],
1175
+ {
1176
+ pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,
1177
+ lookbehind: true
1178
+ }
1179
+ ],
1180
+ "keyword": [
1181
+ {
1182
+ pattern: /((?:^|\})\s*)catch\b/,
1183
+ lookbehind: true
1184
+ },
1185
+ {
1186
+ 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/,
1187
+ lookbehind: true
1188
+ }
1189
+ ],
1190
+ // Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
1191
+ "function": /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,
1192
+ "number": {
1193
+ pattern: RegExp(
1194
+ /(^|[^\w$])/.source + "(?:" + // constant
1195
+ (/NaN|Infinity/.source + "|" + // binary integer
1196
+ /0[bB][01]+(?:_[01]+)*n?/.source + "|" + // octal integer
1197
+ /0[oO][0-7]+(?:_[0-7]+)*n?/.source + "|" + // hexadecimal integer
1198
+ /0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source + "|" + // decimal bigint
1199
+ /\d+(?:_\d+)*n/.source + "|" + // decimal number (integer or float) but no bigint
1200
+ /(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source) + ")" + /(?![\w$])/.source
1201
+ ),
1202
+ lookbehind: true
1203
+ },
1204
+ "operator": /--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/
1205
+ });
1206
+ Prism2.languages.javascript["class-name"][0].pattern = /(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;
1207
+ Prism2.languages.insertBefore("javascript", "keyword", {
1208
+ "regex": {
1209
+ pattern: RegExp(
1210
+ // lookbehind
1211
+ // eslint-disable-next-line regexp/no-dupe-characters-character-class
1212
+ /((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source + // Regex pattern:
1213
+ // There are 2 regex patterns here. The RegExp set notation proposal added support for nested character
1214
+ // classes if the `v` flag is present. Unfortunately, nested CCs are both context-free and incompatible
1215
+ // with the only syntax, so we have to define 2 different regex patterns.
1216
+ /\//.source + "(?:" + /(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source + "|" + // `v` flag syntax. This supports 3 levels of nested character classes.
1217
+ /(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source + ")" + // lookahead
1218
+ /(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source
1219
+ ),
1220
+ lookbehind: true,
1221
+ greedy: true,
1222
+ inside: {
1223
+ "regex-source": {
1224
+ pattern: /^(\/)[\s\S]+(?=\/[a-z]*$)/,
1225
+ lookbehind: true,
1226
+ alias: "language-regex",
1227
+ inside: Prism2.languages.regex
1228
+ },
1229
+ "regex-delimiter": /^\/|\/$/,
1230
+ "regex-flags": /^[a-z]+$/
1231
+ }
1232
+ },
1233
+ // This must be declared before keyword because we use "function" inside the look-forward
1234
+ "function-variable": {
1235
+ 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*=>))/,
1236
+ alias: "function"
1237
+ },
1238
+ "parameter": [
1239
+ {
1240
+ pattern: /(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,
1241
+ lookbehind: true,
1242
+ inside: Prism2.languages.javascript
1243
+ },
1244
+ {
1245
+ pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,
1246
+ lookbehind: true,
1247
+ inside: Prism2.languages.javascript
1248
+ },
1249
+ {
1250
+ pattern: /(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,
1251
+ lookbehind: true,
1252
+ inside: Prism2.languages.javascript
1253
+ },
1254
+ {
1255
+ 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*\{)/,
1256
+ lookbehind: true,
1257
+ inside: Prism2.languages.javascript
1258
+ }
1259
+ ],
1260
+ "constant": /\b[A-Z](?:[A-Z_]|\dx?)*\b/
1261
+ });
1262
+ Prism2.languages.insertBefore("javascript", "string", {
1263
+ "hashbang": {
1264
+ pattern: /^#!.*/,
1265
+ greedy: true,
1266
+ alias: "comment"
1267
+ },
1268
+ "template-string": {
1269
+ pattern: /`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,
1270
+ greedy: true,
1271
+ inside: {
1272
+ "template-punctuation": {
1273
+ pattern: /^`|`$/,
1274
+ alias: "string"
1275
+ },
1276
+ "interpolation": {
1277
+ pattern: /((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,
1278
+ lookbehind: true,
1279
+ inside: {
1280
+ "interpolation-punctuation": {
1281
+ pattern: /^\$\{|\}$/,
1282
+ alias: "punctuation"
1283
+ },
1284
+ rest: Prism2.languages.javascript
1285
+ }
1286
+ },
1287
+ "string": /[\s\S]+/
1288
+ }
1289
+ },
1290
+ "string-property": {
1291
+ pattern: /((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,
1292
+ lookbehind: true,
1293
+ greedy: true,
1294
+ alias: "property"
1295
+ }
1296
+ });
1297
+ Prism2.languages.insertBefore("javascript", "operator", {
1298
+ "literal-property": {
1299
+ pattern: /((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,
1300
+ lookbehind: true,
1301
+ alias: "property"
1302
+ }
1303
+ });
1304
+ if (Prism2.languages.markup) {
1305
+ Prism2.languages.markup.tag.addInlined("script", "javascript");
1306
+ Prism2.languages.markup.tag.addAttribute(
1307
+ /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,
1308
+ "javascript"
1309
+ );
1310
+ }
1311
+ Prism2.languages.js = Prism2.languages.javascript;
1312
+ (function() {
1313
+ if (typeof Prism2 === "undefined" || typeof document === "undefined") {
1314
+ return;
1315
+ }
1316
+ if (!Element.prototype.matches) {
1317
+ Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
1318
+ }
1319
+ var LOADING_MESSAGE = "Loading…";
1320
+ var FAILURE_MESSAGE = function(status, message) {
1321
+ return "✖ Error " + status + " while fetching file: " + message;
1322
+ };
1323
+ var FAILURE_EMPTY_MESSAGE = "✖ Error: File does not exist or is empty";
1324
+ var EXTENSIONS = {
1325
+ "js": "javascript",
1326
+ "py": "python",
1327
+ "rb": "ruby",
1328
+ "ps1": "powershell",
1329
+ "psm1": "powershell",
1330
+ "sh": "bash",
1331
+ "bat": "batch",
1332
+ "h": "c",
1333
+ "tex": "latex"
1334
+ };
1335
+ var STATUS_ATTR = "data-src-status";
1336
+ var STATUS_LOADING = "loading";
1337
+ var STATUS_LOADED = "loaded";
1338
+ var STATUS_FAILED = "failed";
1339
+ var SELECTOR = "pre[data-src]:not([" + STATUS_ATTR + '="' + STATUS_LOADED + '"]):not([' + STATUS_ATTR + '="' + STATUS_LOADING + '"])';
1340
+ function loadFile(src, success, error) {
1341
+ var xhr = new XMLHttpRequest();
1342
+ xhr.open("GET", src, true);
1343
+ xhr.onreadystatechange = function() {
1344
+ if (xhr.readyState == 4) {
1345
+ if (xhr.status < 400 && xhr.responseText) {
1346
+ success(xhr.responseText);
1347
+ } else {
1348
+ if (xhr.status >= 400) {
1349
+ error(FAILURE_MESSAGE(xhr.status, xhr.statusText));
1350
+ } else {
1351
+ error(FAILURE_EMPTY_MESSAGE);
1352
+ }
1353
+ }
1354
+ }
1355
+ };
1356
+ xhr.send(null);
1357
+ }
1358
+ function parseRange(range) {
1359
+ var m = /^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(range || "");
1360
+ if (m) {
1361
+ var start = Number(m[1]);
1362
+ var comma = m[2];
1363
+ var end = m[3];
1364
+ if (!comma) {
1365
+ return [start, start];
1366
+ }
1367
+ if (!end) {
1368
+ return [start, void 0];
1369
+ }
1370
+ return [start, Number(end)];
1371
+ }
1372
+ return void 0;
1373
+ }
1374
+ Prism2.hooks.add("before-highlightall", function(env) {
1375
+ env.selector += ", " + SELECTOR;
1376
+ });
1377
+ Prism2.hooks.add("before-sanity-check", function(env) {
1378
+ var pre = (
1379
+ /** @type {HTMLPreElement} */
1380
+ env.element
1381
+ );
1382
+ if (pre.matches(SELECTOR)) {
1383
+ env.code = "";
1384
+ pre.setAttribute(STATUS_ATTR, STATUS_LOADING);
1385
+ var code = pre.appendChild(document.createElement("CODE"));
1386
+ code.textContent = LOADING_MESSAGE;
1387
+ var src = pre.getAttribute("data-src");
1388
+ var language = env.language;
1389
+ if (language === "none") {
1390
+ var extension = (/\.(\w+)$/.exec(src) || [, "none"])[1];
1391
+ language = EXTENSIONS[extension] || extension;
1392
+ }
1393
+ Prism2.util.setLanguage(code, language);
1394
+ Prism2.util.setLanguage(pre, language);
1395
+ var autoloader = Prism2.plugins.autoloader;
1396
+ if (autoloader) {
1397
+ autoloader.loadLanguages(language);
1398
+ }
1399
+ loadFile(
1400
+ src,
1401
+ function(text) {
1402
+ pre.setAttribute(STATUS_ATTR, STATUS_LOADED);
1403
+ var range = parseRange(pre.getAttribute("data-range"));
1404
+ if (range) {
1405
+ var lines = text.split(/\r\n?|\n/g);
1406
+ var start = range[0];
1407
+ var end = range[1] == null ? lines.length : range[1];
1408
+ if (start < 0) {
1409
+ start += lines.length;
1410
+ }
1411
+ start = Math.max(0, Math.min(start - 1, lines.length));
1412
+ if (end < 0) {
1413
+ end += lines.length;
1414
+ }
1415
+ end = Math.max(0, Math.min(end, lines.length));
1416
+ text = lines.slice(start, end).join("\n");
1417
+ if (!pre.hasAttribute("data-start")) {
1418
+ pre.setAttribute("data-start", String(start + 1));
1419
+ }
1420
+ }
1421
+ code.textContent = text;
1422
+ Prism2.highlightElement(code);
1423
+ },
1424
+ function(error) {
1425
+ pre.setAttribute(STATUS_ATTR, STATUS_FAILED);
1426
+ code.textContent = error;
1427
+ }
1428
+ );
1429
+ }
1430
+ });
1431
+ Prism2.plugins.fileHighlight = {
1432
+ /**
1433
+ * Executes the File Highlight plugin for all matching `pre` elements under the given container.
1434
+ *
1435
+ * Note: Elements which are already loaded or currently loading will not be touched by this method.
1436
+ *
1437
+ * @param {ParentNode} [container=document]
1438
+ */
1439
+ highlight: function highlight(container) {
1440
+ var elements = (container || document).querySelectorAll(SELECTOR);
1441
+ for (var i = 0, element; element = elements[i++]; ) {
1442
+ Prism2.highlightElement(element);
1443
+ }
1444
+ }
1445
+ };
1446
+ var logged = false;
1447
+ Prism2.fileHighlight = function() {
1448
+ if (!logged) {
1449
+ console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead.");
1450
+ logged = true;
1451
+ }
1452
+ Prism2.plugins.fileHighlight.highlight.apply(this, arguments);
1453
+ };
1454
+ })();
1455
+ })(prism);
1456
+ return prism.exports;
1457
+ }
1458
+ var prismExports = requirePrism();
1459
+ const Prism$1 = /* @__PURE__ */ getDefaultExportFromCjs(prismExports);
1460
+ Prism.languages.markup = {
1461
+ "comment": {
1462
+ pattern: /<!--(?:(?!<!--)[\s\S])*?-->/,
1463
+ greedy: true
1464
+ },
1465
+ "prolog": {
1466
+ pattern: /<\?[\s\S]+?\?>/,
1467
+ greedy: true
1468
+ },
1469
+ "doctype": {
1470
+ // https://www.w3.org/TR/xml/#NT-doctypedecl
1471
+ pattern: /<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,
1472
+ greedy: true,
1473
+ inside: {
1474
+ "internal-subset": {
1475
+ pattern: /(^[^\[]*\[)[\s\S]+(?=\]>$)/,
1476
+ lookbehind: true,
1477
+ greedy: true,
1478
+ inside: null
1479
+ // see below
1480
+ },
1481
+ "string": {
1482
+ pattern: /"[^"]*"|'[^']*'/,
1483
+ greedy: true
1484
+ },
1485
+ "punctuation": /^<!|>$|[[\]]/,
1486
+ "doctype-tag": /^DOCTYPE/i,
1487
+ "name": /[^\s<>'"]+/
1488
+ }
1489
+ },
1490
+ "cdata": {
1491
+ pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
1492
+ greedy: true
1493
+ },
1494
+ "tag": {
1495
+ pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,
1496
+ greedy: true,
1497
+ inside: {
1498
+ "tag": {
1499
+ pattern: /^<\/?[^\s>\/]+/,
1500
+ inside: {
1501
+ "punctuation": /^<\/?/,
1502
+ "namespace": /^[^\s>\/:]+:/
1503
+ }
1504
+ },
1505
+ "special-attr": [],
1506
+ "attr-value": {
1507
+ pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,
1508
+ inside: {
1509
+ "punctuation": [
1510
+ {
1511
+ pattern: /^=/,
1512
+ alias: "attr-equals"
1513
+ },
1514
+ {
1515
+ pattern: /^(\s*)["']|["']$/,
1516
+ lookbehind: true
1517
+ }
1518
+ ]
1519
+ }
1520
+ },
1521
+ "punctuation": /\/?>/,
1522
+ "attr-name": {
1523
+ pattern: /[^\s>\/]+/,
1524
+ inside: {
1525
+ "namespace": /^[^\s>\/:]+:/
1526
+ }
1527
+ }
1528
+ }
1529
+ },
1530
+ "entity": [
1531
+ {
1532
+ pattern: /&[\da-z]{1,8};/i,
1533
+ alias: "named-entity"
1534
+ },
1535
+ /&#x?[\da-f]{1,8};/i
1536
+ ]
1537
+ };
1538
+ Prism.languages.markup["tag"].inside["attr-value"].inside["entity"] = Prism.languages.markup["entity"];
1539
+ Prism.languages.markup["doctype"].inside["internal-subset"].inside = Prism.languages.markup;
1540
+ Prism.hooks.add("wrap", function(env) {
1541
+ if (env.type === "entity") {
1542
+ env.attributes["title"] = env.content.replace(/&amp;/, "&");
1543
+ }
1544
+ });
1545
+ Object.defineProperty(Prism.languages.markup.tag, "addInlined", {
1546
+ /**
1547
+ * Adds an inlined language to markup.
1548
+ *
1549
+ * An example of an inlined language is CSS with `<style>` tags.
1550
+ *
1551
+ * @param {string} tagName The name of the tag that contains the inlined language. This name will be treated as
1552
+ * case insensitive.
1553
+ * @param {string} lang The language key.
1554
+ * @example
1555
+ * addInlined('style', 'css');
1556
+ */
1557
+ value: function addInlined(tagName, lang) {
1558
+ var includedCdataInside = {};
1559
+ includedCdataInside["language-" + lang] = {
1560
+ pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
1561
+ lookbehind: true,
1562
+ inside: Prism.languages[lang]
1563
+ };
1564
+ includedCdataInside["cdata"] = /^<!\[CDATA\[|\]\]>$/i;
1565
+ var inside = {
1566
+ "included-cdata": {
1567
+ pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
1568
+ inside: includedCdataInside
1569
+ }
1570
+ };
1571
+ inside["language-" + lang] = {
1572
+ pattern: /[\s\S]+/,
1573
+ inside: Prism.languages[lang]
1574
+ };
1575
+ var def = {};
1576
+ def[tagName] = {
1577
+ pattern: RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g, function() {
1578
+ return tagName;
1579
+ }), "i"),
1580
+ lookbehind: true,
1581
+ greedy: true,
1582
+ inside
1583
+ };
1584
+ Prism.languages.insertBefore("markup", "cdata", def);
1585
+ }
1586
+ });
1587
+ Object.defineProperty(Prism.languages.markup.tag, "addAttribute", {
1588
+ /**
1589
+ * Adds an pattern to highlight languages embedded in HTML attributes.
1590
+ *
1591
+ * An example of an inlined language is CSS with `style` attributes.
1592
+ *
1593
+ * @param {string} attrName The name of the tag that contains the inlined language. This name will be treated as
1594
+ * case insensitive.
1595
+ * @param {string} lang The language key.
1596
+ * @example
1597
+ * addAttribute('style', 'css');
1598
+ */
1599
+ value: function(attrName, lang) {
1600
+ Prism.languages.markup.tag.inside["special-attr"].push({
1601
+ pattern: RegExp(
1602
+ /(^|["'\s])/.source + "(?:" + attrName + ")" + /\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,
1603
+ "i"
1604
+ ),
1605
+ lookbehind: true,
1606
+ inside: {
1607
+ "attr-name": /^[^\s=]+/,
1608
+ "attr-value": {
1609
+ pattern: /=[\s\S]+/,
1610
+ inside: {
1611
+ "value": {
1612
+ pattern: /(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,
1613
+ lookbehind: true,
1614
+ alias: [lang, "language-" + lang],
1615
+ inside: Prism.languages[lang]
1616
+ },
1617
+ "punctuation": [
1618
+ {
1619
+ pattern: /^=/,
1620
+ alias: "attr-equals"
1621
+ },
1622
+ /"|'/
1623
+ ]
1624
+ }
1625
+ }
1626
+ }
1627
+ });
1628
+ }
1629
+ });
1630
+ Prism.languages.html = Prism.languages.markup;
1631
+ Prism.languages.mathml = Prism.languages.markup;
1632
+ Prism.languages.svg = Prism.languages.markup;
1633
+ Prism.languages.xml = Prism.languages.extend("markup", {});
1634
+ Prism.languages.ssml = Prism.languages.xml;
1635
+ Prism.languages.atom = Prism.languages.xml;
1636
+ Prism.languages.rss = Prism.languages.xml;
1637
+ (function(Prism2) {
1638
+ var string = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
1639
+ Prism2.languages.css = {
1640
+ "comment": /\/\*[\s\S]*?\*\//,
1641
+ "atrule": {
1642
+ pattern: RegExp("@[\\w-](?:" + /[^;{\s"']|\s+(?!\s)/.source + "|" + string.source + ")*?" + /(?:;|(?=\s*\{))/.source),
1643
+ inside: {
1644
+ "rule": /^@[\w-]+/,
1645
+ "selector-function-argument": {
1646
+ pattern: /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,
1647
+ lookbehind: true,
1648
+ alias: "selector"
1649
+ },
1650
+ "keyword": {
1651
+ pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/,
1652
+ lookbehind: true
1653
+ }
1654
+ // See rest below
1655
+ }
1656
+ },
1657
+ "url": {
1658
+ // https://drafts.csswg.org/css-values-3/#urls
1659
+ pattern: RegExp("\\burl\\((?:" + string.source + "|" + /(?:[^\\\r\n()"']|\\[\s\S])*/.source + ")\\)", "i"),
1660
+ greedy: true,
1661
+ inside: {
1662
+ "function": /^url/i,
1663
+ "punctuation": /^\(|\)$/,
1664
+ "string": {
1665
+ pattern: RegExp("^" + string.source + "$"),
1666
+ alias: "url"
1667
+ }
1668
+ }
1669
+ },
1670
+ "selector": {
1671
+ pattern: RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|` + string.source + ")*(?=\\s*\\{)"),
1672
+ lookbehind: true
1673
+ },
1674
+ "string": {
1675
+ pattern: string,
1676
+ greedy: true
1677
+ },
1678
+ "property": {
1679
+ pattern: /(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,
1680
+ lookbehind: true
1681
+ },
1682
+ "important": /!important\b/i,
1683
+ "function": {
1684
+ pattern: /(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,
1685
+ lookbehind: true
1686
+ },
1687
+ "punctuation": /[(){};:,]/
1688
+ };
1689
+ Prism2.languages.css["atrule"].inside.rest = Prism2.languages.css;
1690
+ var markup = Prism2.languages.markup;
1691
+ if (markup) {
1692
+ markup.tag.addInlined("style", "css");
1693
+ markup.tag.addAttribute("style", "css");
1694
+ }
1695
+ })(Prism);
1696
+ Prism.languages.clike = {
1697
+ "comment": [
1698
+ {
1699
+ pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
1700
+ lookbehind: true,
1701
+ greedy: true
1702
+ },
1703
+ {
1704
+ pattern: /(^|[^\\:])\/\/.*/,
1705
+ lookbehind: true,
1706
+ greedy: true
1707
+ }
1708
+ ],
1709
+ "string": {
1710
+ pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
1711
+ greedy: true
1712
+ },
1713
+ "class-name": {
1714
+ pattern: /(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,
1715
+ lookbehind: true,
1716
+ inside: {
1717
+ "punctuation": /[.\\]/
1718
+ }
1719
+ },
1720
+ "keyword": /\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,
1721
+ "boolean": /\b(?:false|true)\b/,
1722
+ "function": /\b\w+(?=\()/,
1723
+ "number": /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
1724
+ "operator": /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
1725
+ "punctuation": /[{}[\];(),.:]/
1726
+ };
1727
+ Prism.languages.c = Prism.languages.extend("clike", {
1728
+ "comment": {
1729
+ pattern: /\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,
1730
+ greedy: true
1731
+ },
1732
+ "string": {
1733
+ // https://en.cppreference.com/w/c/language/string_literal
1734
+ pattern: /"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,
1735
+ greedy: true
1736
+ },
1737
+ "class-name": {
1738
+ pattern: /(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,
1739
+ lookbehind: true
1740
+ },
1741
+ "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/,
1742
+ "function": /\b[a-z_]\w*(?=\s*\()/i,
1743
+ "number": /(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,
1744
+ "operator": />>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/
1745
+ });
1746
+ Prism.languages.insertBefore("c", "string", {
1747
+ "char": {
1748
+ // https://en.cppreference.com/w/c/language/character_constant
1749
+ pattern: /'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,
1750
+ greedy: true
1751
+ }
1752
+ });
1753
+ Prism.languages.insertBefore("c", "string", {
1754
+ "macro": {
1755
+ // allow for multiline macro definitions
1756
+ // spaces after the # character compile fine with gcc
1757
+ pattern: /(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,
1758
+ lookbehind: true,
1759
+ greedy: true,
1760
+ alias: "property",
1761
+ inside: {
1762
+ "string": [
1763
+ {
1764
+ // highlight the path of the include statement as a string
1765
+ pattern: /^(#\s*include\s*)<[^>]+>/,
1766
+ lookbehind: true
1767
+ },
1768
+ Prism.languages.c["string"]
1769
+ ],
1770
+ "char": Prism.languages.c["char"],
1771
+ "comment": Prism.languages.c["comment"],
1772
+ "macro-name": [
1773
+ {
1774
+ pattern: /(^#\s*define\s+)\w+\b(?!\()/i,
1775
+ lookbehind: true
1776
+ },
1777
+ {
1778
+ pattern: /(^#\s*define\s+)\w+\b(?=\()/i,
1779
+ lookbehind: true,
1780
+ alias: "function"
1781
+ }
1782
+ ],
1783
+ // highlight macro directives as keywords
1784
+ "directive": {
1785
+ pattern: /^(#\s*)[a-z]+/,
1786
+ lookbehind: true,
1787
+ alias: "keyword"
1788
+ },
1789
+ "directive-hash": /^#/,
1790
+ "punctuation": /##|\\(?=[\r\n])/,
1791
+ "expression": {
1792
+ pattern: /\S[\s\S]*/,
1793
+ inside: Prism.languages.c
1794
+ }
1795
+ }
1796
+ }
1797
+ });
1798
+ Prism.languages.insertBefore("c", "function", {
1799
+ // highlight predefined macros as constants
1800
+ "constant": /\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/
1801
+ });
1802
+ delete Prism.languages.c["boolean"];
1803
+ var prismJava = {};
1804
+ var hasRequiredPrismJava;
1805
+ function requirePrismJava() {
1806
+ if (hasRequiredPrismJava) return prismJava;
1807
+ hasRequiredPrismJava = 1;
1808
+ (function(Prism2) {
1809
+ 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/;
1810
+ var classNamePrefix = /(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source;
1811
+ var className = {
1812
+ pattern: RegExp(/(^|[^\w.])/.source + classNamePrefix + /[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),
1813
+ lookbehind: true,
1814
+ inside: {
1815
+ "namespace": {
1816
+ pattern: /^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,
1817
+ inside: {
1818
+ "punctuation": /\./
1819
+ }
1820
+ },
1821
+ "punctuation": /\./
1822
+ }
1823
+ };
1824
+ Prism2.languages.java = Prism2.languages.extend("clike", {
1825
+ "string": {
1826
+ pattern: /(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,
1827
+ lookbehind: true,
1828
+ greedy: true
1829
+ },
1830
+ "class-name": [
1831
+ className,
1832
+ {
1833
+ // variables, parameters, and constructor references
1834
+ // this to support class names (or generic parameters) which do not contain a lower case letter (also works for methods)
1835
+ pattern: RegExp(/(^|[^\w.])/.source + classNamePrefix + /[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),
1836
+ lookbehind: true,
1837
+ inside: className.inside
1838
+ },
1839
+ {
1840
+ // class names based on keyword
1841
+ // this to support class names (or generic parameters) which do not contain a lower case letter (also works for methods)
1842
+ pattern: RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source + classNamePrefix + /[A-Z]\w*\b/.source),
1843
+ lookbehind: true,
1844
+ inside: className.inside
1845
+ }
1846
+ ],
1847
+ "keyword": keywords,
1848
+ "function": [
1849
+ Prism2.languages.clike.function,
1850
+ {
1851
+ pattern: /(::\s*)[a-z_]\w*/,
1852
+ lookbehind: true
1853
+ }
1854
+ ],
1855
+ "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,
1856
+ "operator": {
1857
+ pattern: /(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,
1858
+ lookbehind: true
1859
+ },
1860
+ "constant": /\b[A-Z][A-Z_\d]+\b/
1861
+ });
1862
+ Prism2.languages.insertBefore("java", "string", {
1863
+ "triple-quoted-string": {
1864
+ // http://openjdk.java.net/jeps/355#Description
1865
+ pattern: /"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,
1866
+ greedy: true,
1867
+ alias: "string"
1868
+ },
1869
+ "char": {
1870
+ pattern: /'(?:\\.|[^'\\\r\n]){1,6}'/,
1871
+ greedy: true
1872
+ }
1873
+ });
1874
+ Prism2.languages.insertBefore("java", "class-name", {
1875
+ "annotation": {
1876
+ pattern: /(^|[^.])@\w+(?:\s*\.\s*\w+)*/,
1877
+ lookbehind: true,
1878
+ alias: "punctuation"
1879
+ },
1880
+ "generics": {
1881
+ pattern: /<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,
1882
+ inside: {
1883
+ "class-name": className,
1884
+ "keyword": keywords,
1885
+ "punctuation": /[<>(),.:]/,
1886
+ "operator": /[?&|]/
1887
+ }
1888
+ },
1889
+ "import": [
1890
+ {
1891
+ pattern: RegExp(/(\bimport\s+)/.source + classNamePrefix + /(?:[A-Z]\w*|\*)(?=\s*;)/.source),
1892
+ lookbehind: true,
1893
+ inside: {
1894
+ "namespace": className.inside.namespace,
1895
+ "punctuation": /\./,
1896
+ "operator": /\*/,
1897
+ "class-name": /\w+/
1898
+ }
1899
+ },
1900
+ {
1901
+ pattern: RegExp(/(\bimport\s+static\s+)/.source + classNamePrefix + /(?:\w+|\*)(?=\s*;)/.source),
1902
+ lookbehind: true,
1903
+ alias: "static",
1904
+ inside: {
1905
+ "namespace": className.inside.namespace,
1906
+ "static": /\b\w+$/,
1907
+ "punctuation": /\./,
1908
+ "operator": /\*/,
1909
+ "class-name": /\w+/
1910
+ }
1911
+ }
1912
+ ],
1913
+ "namespace": {
1914
+ pattern: RegExp(
1915
+ /(\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() {
1916
+ return keywords.source;
1917
+ })
1918
+ ),
1919
+ lookbehind: true,
1920
+ inside: {
1921
+ "punctuation": /\./
1922
+ }
1923
+ }
1924
+ });
1925
+ })(Prism);
1926
+ return prismJava;
1927
+ }
1928
+ requirePrismJava();
1929
+ Prism.languages.javascript = Prism.languages.extend("clike", {
1930
+ "class-name": [
1931
+ Prism.languages.clike["class-name"],
1932
+ {
1933
+ pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,
1934
+ lookbehind: true
1935
+ }
1936
+ ],
1937
+ "keyword": [
1938
+ {
1939
+ pattern: /((?:^|\})\s*)catch\b/,
1940
+ lookbehind: true
1941
+ },
1942
+ {
1943
+ 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/,
1944
+ lookbehind: true
1945
+ }
1946
+ ],
1947
+ // Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
1948
+ "function": /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,
1949
+ "number": {
1950
+ pattern: RegExp(
1951
+ /(^|[^\w$])/.source + "(?:" + // constant
1952
+ (/NaN|Infinity/.source + "|" + // binary integer
1953
+ /0[bB][01]+(?:_[01]+)*n?/.source + "|" + // octal integer
1954
+ /0[oO][0-7]+(?:_[0-7]+)*n?/.source + "|" + // hexadecimal integer
1955
+ /0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source + "|" + // decimal bigint
1956
+ /\d+(?:_\d+)*n/.source + "|" + // decimal number (integer or float) but no bigint
1957
+ /(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source) + ")" + /(?![\w$])/.source
1958
+ ),
1959
+ lookbehind: true
1960
+ },
1961
+ "operator": /--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/
1962
+ });
1963
+ Prism.languages.javascript["class-name"][0].pattern = /(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;
1964
+ Prism.languages.insertBefore("javascript", "keyword", {
1965
+ "regex": {
1966
+ pattern: RegExp(
1967
+ // lookbehind
1968
+ // eslint-disable-next-line regexp/no-dupe-characters-character-class
1969
+ /((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source + // Regex pattern:
1970
+ // There are 2 regex patterns here. The RegExp set notation proposal added support for nested character
1971
+ // classes if the `v` flag is present. Unfortunately, nested CCs are both context-free and incompatible
1972
+ // with the only syntax, so we have to define 2 different regex patterns.
1973
+ /\//.source + "(?:" + /(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source + "|" + // `v` flag syntax. This supports 3 levels of nested character classes.
1974
+ /(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source + ")" + // lookahead
1975
+ /(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source
1976
+ ),
1977
+ lookbehind: true,
1978
+ greedy: true,
1979
+ inside: {
1980
+ "regex-source": {
1981
+ pattern: /^(\/)[\s\S]+(?=\/[a-z]*$)/,
1982
+ lookbehind: true,
1983
+ alias: "language-regex",
1984
+ inside: Prism.languages.regex
1985
+ },
1986
+ "regex-delimiter": /^\/|\/$/,
1987
+ "regex-flags": /^[a-z]+$/
1988
+ }
1989
+ },
1990
+ // This must be declared before keyword because we use "function" inside the look-forward
1991
+ "function-variable": {
1992
+ 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*=>))/,
1993
+ alias: "function"
1994
+ },
1995
+ "parameter": [
1996
+ {
1997
+ pattern: /(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,
1998
+ lookbehind: true,
1999
+ inside: Prism.languages.javascript
2000
+ },
2001
+ {
2002
+ pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,
2003
+ lookbehind: true,
2004
+ inside: Prism.languages.javascript
2005
+ },
2006
+ {
2007
+ pattern: /(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,
2008
+ lookbehind: true,
2009
+ inside: Prism.languages.javascript
2010
+ },
2011
+ {
2012
+ 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*\{)/,
2013
+ lookbehind: true,
2014
+ inside: Prism.languages.javascript
2015
+ }
2016
+ ],
2017
+ "constant": /\b[A-Z](?:[A-Z_]|\dx?)*\b/
2018
+ });
2019
+ Prism.languages.insertBefore("javascript", "string", {
2020
+ "hashbang": {
2021
+ pattern: /^#!.*/,
2022
+ greedy: true,
2023
+ alias: "comment"
2024
+ },
2025
+ "template-string": {
2026
+ pattern: /`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,
2027
+ greedy: true,
2028
+ inside: {
2029
+ "template-punctuation": {
2030
+ pattern: /^`|`$/,
2031
+ alias: "string"
2032
+ },
2033
+ "interpolation": {
2034
+ pattern: /((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,
2035
+ lookbehind: true,
2036
+ inside: {
2037
+ "interpolation-punctuation": {
2038
+ pattern: /^\$\{|\}$/,
2039
+ alias: "punctuation"
2040
+ },
2041
+ rest: Prism.languages.javascript
2042
+ }
2043
+ },
2044
+ "string": /[\s\S]+/
2045
+ }
2046
+ },
2047
+ "string-property": {
2048
+ pattern: /((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,
2049
+ lookbehind: true,
2050
+ greedy: true,
2051
+ alias: "property"
2052
+ }
2053
+ });
2054
+ Prism.languages.insertBefore("javascript", "operator", {
2055
+ "literal-property": {
2056
+ pattern: /((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,
2057
+ lookbehind: true,
2058
+ alias: "property"
2059
+ }
2060
+ });
2061
+ if (Prism.languages.markup) {
2062
+ Prism.languages.markup.tag.addInlined("script", "javascript");
2063
+ Prism.languages.markup.tag.addAttribute(
2064
+ /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,
2065
+ "javascript"
2066
+ );
2067
+ }
2068
+ Prism.languages.js = Prism.languages.javascript;
2069
+ (function(Prism2) {
2070
+ var javascript = Prism2.util.clone(Prism2.languages.javascript);
2071
+ var space = /(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source;
2072
+ var braces = /(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source;
2073
+ var spread = /(?:\{<S>*\.{3}(?:[^{}]|<BRACES>)*\})/.source;
2074
+ function re(source, flags) {
2075
+ source = source.replace(/<S>/g, function() {
2076
+ return space;
2077
+ }).replace(/<BRACES>/g, function() {
2078
+ return braces;
2079
+ }).replace(/<SPREAD>/g, function() {
2080
+ return spread;
2081
+ });
2082
+ return RegExp(source, flags);
2083
+ }
2084
+ spread = re(spread).source;
2085
+ Prism2.languages.jsx = Prism2.languages.extend("markup", javascript);
2086
+ Prism2.languages.jsx.tag.pattern = re(
2087
+ /<\/?(?:[\w.:-]+(?:<S>+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\/?)?>/.source
2088
+ );
2089
+ Prism2.languages.jsx.tag.inside["tag"].pattern = /^<\/?[^\s>\/]*/;
2090
+ Prism2.languages.jsx.tag.inside["attr-value"].pattern = /=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/;
2091
+ Prism2.languages.jsx.tag.inside["tag"].inside["class-name"] = /^[A-Z]\w*(?:\.[A-Z]\w*)*$/;
2092
+ Prism2.languages.jsx.tag.inside["comment"] = javascript["comment"];
2093
+ Prism2.languages.insertBefore("inside", "attr-name", {
2094
+ "spread": {
2095
+ pattern: re(/<SPREAD>/.source),
2096
+ inside: Prism2.languages.jsx
2097
+ }
2098
+ }, Prism2.languages.jsx.tag);
2099
+ Prism2.languages.insertBefore("inside", "special-attr", {
2100
+ "script": {
2101
+ // Allow for two levels of nesting
2102
+ pattern: re(/=<BRACES>/.source),
2103
+ alias: "language-javascript",
2104
+ inside: {
2105
+ "script-punctuation": {
2106
+ pattern: /^=(?=\{)/,
2107
+ alias: "punctuation"
2108
+ },
2109
+ rest: Prism2.languages.jsx
2110
+ }
2111
+ }
2112
+ }, Prism2.languages.jsx.tag);
2113
+ var stringifyToken = function(token) {
2114
+ if (!token) {
2115
+ return "";
2116
+ }
2117
+ if (typeof token === "string") {
2118
+ return token;
2119
+ }
2120
+ if (typeof token.content === "string") {
2121
+ return token.content;
2122
+ }
2123
+ return token.content.map(stringifyToken).join("");
2124
+ };
2125
+ var walkTokens = function(tokens) {
2126
+ var openedTags = [];
2127
+ for (var i = 0; i < tokens.length; i++) {
2128
+ var token = tokens[i];
2129
+ var notTagNorBrace = false;
2130
+ if (typeof token !== "string") {
2131
+ if (token.type === "tag" && token.content[0] && token.content[0].type === "tag") {
2132
+ if (token.content[0].content[0].content === "</") {
2133
+ if (openedTags.length > 0 && openedTags[openedTags.length - 1].tagName === stringifyToken(token.content[0].content[1])) {
2134
+ openedTags.pop();
2135
+ }
2136
+ } else {
2137
+ if (token.content[token.content.length - 1].content === "/>") ;
2138
+ else {
2139
+ openedTags.push({
2140
+ tagName: stringifyToken(token.content[0].content[1]),
2141
+ openedBraces: 0
2142
+ });
2143
+ }
2144
+ }
2145
+ } else if (openedTags.length > 0 && token.type === "punctuation" && token.content === "{") {
2146
+ openedTags[openedTags.length - 1].openedBraces++;
2147
+ } else if (openedTags.length > 0 && openedTags[openedTags.length - 1].openedBraces > 0 && token.type === "punctuation" && token.content === "}") {
2148
+ openedTags[openedTags.length - 1].openedBraces--;
2149
+ } else {
2150
+ notTagNorBrace = true;
2151
+ }
2152
+ }
2153
+ if (notTagNorBrace || typeof token === "string") {
2154
+ if (openedTags.length > 0 && openedTags[openedTags.length - 1].openedBraces === 0) {
2155
+ var plainText = stringifyToken(token);
2156
+ if (i < tokens.length - 1 && (typeof tokens[i + 1] === "string" || tokens[i + 1].type === "plain-text")) {
2157
+ plainText += stringifyToken(tokens[i + 1]);
2158
+ tokens.splice(i + 1, 1);
2159
+ }
2160
+ if (i > 0 && (typeof tokens[i - 1] === "string" || tokens[i - 1].type === "plain-text")) {
2161
+ plainText = stringifyToken(tokens[i - 1]) + plainText;
2162
+ tokens.splice(i - 1, 1);
2163
+ i--;
2164
+ }
2165
+ tokens[i] = new Prism2.Token("plain-text", plainText, null, plainText);
2166
+ }
2167
+ }
2168
+ if (token.content && typeof token.content !== "string") {
2169
+ walkTokens(token.content);
2170
+ }
2171
+ }
2172
+ };
2173
+ Prism2.hooks.add("after-tokenize", function(env) {
2174
+ if (env.language !== "jsx" && env.language !== "tsx") {
2175
+ return;
2176
+ }
2177
+ walkTokens(env.tokens);
2178
+ });
2179
+ })(Prism);
2180
+ var prismTypescript = {};
2181
+ var hasRequiredPrismTypescript;
2182
+ function requirePrismTypescript() {
2183
+ if (hasRequiredPrismTypescript) return prismTypescript;
2184
+ hasRequiredPrismTypescript = 1;
2185
+ (function(Prism2) {
2186
+ Prism2.languages.typescript = Prism2.languages.extend("javascript", {
2187
+ "class-name": {
2188
+ pattern: /(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,
2189
+ lookbehind: true,
2190
+ greedy: true,
2191
+ inside: null
2192
+ // see below
2193
+ },
2194
+ "builtin": /\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/
2195
+ });
2196
+ Prism2.languages.typescript.keyword.push(
2197
+ /\b(?:abstract|declare|is|keyof|readonly|require)\b/,
2198
+ // keywords that have to be followed by an identifier
2199
+ /\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,
2200
+ // This is for `import type *, {}`
2201
+ /\btype\b(?=\s*(?:[\{*]|$))/
2202
+ );
2203
+ delete Prism2.languages.typescript["parameter"];
2204
+ delete Prism2.languages.typescript["literal-property"];
2205
+ var typeInside = Prism2.languages.extend("typescript", {});
2206
+ delete typeInside["class-name"];
2207
+ Prism2.languages.typescript["class-name"].inside = typeInside;
2208
+ Prism2.languages.insertBefore("typescript", "function", {
2209
+ "decorator": {
2210
+ pattern: /@[$\w\xA0-\uFFFF]+/,
2211
+ inside: {
2212
+ "at": {
2213
+ pattern: /^@/,
2214
+ alias: "operator"
2215
+ },
2216
+ "function": /^[\s\S]+/
2217
+ }
2218
+ },
2219
+ "generic-function": {
2220
+ // e.g. foo<T extends "bar" | "baz">( ...
2221
+ pattern: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,
2222
+ greedy: true,
2223
+ inside: {
2224
+ "function": /^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,
2225
+ "generic": {
2226
+ pattern: /<[\s\S]+/,
2227
+ // everything after the first <
2228
+ alias: "class-name",
2229
+ inside: typeInside
2230
+ }
2231
+ }
2232
+ }
2233
+ });
2234
+ Prism2.languages.ts = Prism2.languages.typescript;
2235
+ })(Prism);
2236
+ return prismTypescript;
2237
+ }
2238
+ requirePrismTypescript();
2239
+ Prism.languages.json = {
2240
+ "property": {
2241
+ pattern: /(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,
2242
+ lookbehind: true,
2243
+ greedy: true
2244
+ },
2245
+ "string": {
2246
+ pattern: /(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,
2247
+ lookbehind: true,
2248
+ greedy: true
2249
+ },
2250
+ "comment": {
2251
+ pattern: /\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,
2252
+ greedy: true
2253
+ },
2254
+ "number": /-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,
2255
+ "punctuation": /[{}[\],]/,
2256
+ "operator": /:/,
2257
+ "boolean": /\b(?:false|true)\b/,
2258
+ "null": {
2259
+ pattern: /\bnull\b/,
2260
+ alias: "keyword"
2261
+ }
2262
+ };
2263
+ Prism.languages.webmanifest = Prism.languages.json;
2264
+ (function(Prism2) {
2265
+ var envVars = "\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b";
2266
+ var commandAfterHeredoc = {
2267
+ pattern: /(^(["']?)\w+\2)[ \t]+\S.*/,
2268
+ lookbehind: true,
2269
+ alias: "punctuation",
2270
+ // this looks reasonably well in all themes
2271
+ inside: null
2272
+ // see below
2273
+ };
2274
+ var insideString = {
2275
+ "bash": commandAfterHeredoc,
2276
+ "environment": {
2277
+ pattern: RegExp("\\$" + envVars),
2278
+ alias: "constant"
2279
+ },
2280
+ "variable": [
2281
+ // [0]: Arithmetic Environment
2282
+ {
2283
+ pattern: /\$?\(\([\s\S]+?\)\)/,
2284
+ greedy: true,
2285
+ inside: {
2286
+ // If there is a $ sign at the beginning highlight $(( and )) as variable
2287
+ "variable": [
2288
+ {
2289
+ pattern: /(^\$\(\([\s\S]+)\)\)/,
2290
+ lookbehind: true
2291
+ },
2292
+ /^\$\(\(/
2293
+ ],
2294
+ "number": /\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,
2295
+ // Operators according to https://www.gnu.org/software/bash/manual/bashref.html#Shell-Arithmetic
2296
+ "operator": /--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,
2297
+ // If there is no $ sign at the beginning highlight (( and )) as punctuation
2298
+ "punctuation": /\(\(?|\)\)?|,|;/
2299
+ }
2300
+ },
2301
+ // [1]: Command Substitution
2302
+ {
2303
+ pattern: /\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,
2304
+ greedy: true,
2305
+ inside: {
2306
+ "variable": /^\$\(|^`|\)$|`$/
2307
+ }
2308
+ },
2309
+ // [2]: Brace expansion
2310
+ {
2311
+ pattern: /\$\{[^}]+\}/,
2312
+ greedy: true,
2313
+ inside: {
2314
+ "operator": /:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,
2315
+ "punctuation": /[\[\]]/,
2316
+ "environment": {
2317
+ pattern: RegExp("(\\{)" + envVars),
2318
+ lookbehind: true,
2319
+ alias: "constant"
2320
+ }
2321
+ }
2322
+ },
2323
+ /\$(?:\w+|[#?*!@$])/
2324
+ ],
2325
+ // Escape sequences from echo and printf's manuals, and escaped quotes.
2326
+ "entity": /\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/
2327
+ };
2328
+ Prism2.languages.bash = {
2329
+ "shebang": {
2330
+ pattern: /^#!\s*\/.*/,
2331
+ alias: "important"
2332
+ },
2333
+ "comment": {
2334
+ pattern: /(^|[^"{\\$])#.*/,
2335
+ lookbehind: true
2336
+ },
2337
+ "function-name": [
2338
+ // a) function foo {
2339
+ // b) foo() {
2340
+ // c) function foo() {
2341
+ // but not “foo {”
2342
+ {
2343
+ // a) and c)
2344
+ pattern: /(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,
2345
+ lookbehind: true,
2346
+ alias: "function"
2347
+ },
2348
+ {
2349
+ // b)
2350
+ pattern: /\b[\w-]+(?=\s*\(\s*\)\s*\{)/,
2351
+ alias: "function"
2352
+ }
2353
+ ],
2354
+ // Highlight variable names as variables in for and select beginnings.
2355
+ "for-or-select": {
2356
+ pattern: /(\b(?:for|select)\s+)\w+(?=\s+in\s)/,
2357
+ alias: "variable",
2358
+ lookbehind: true
2359
+ },
2360
+ // Highlight variable names as variables in the left-hand part
2361
+ // of assignments (“=” and “+=”).
2362
+ "assign-left": {
2363
+ pattern: /(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,
2364
+ inside: {
2365
+ "environment": {
2366
+ pattern: RegExp("(^|[\\s;|&]|[<>]\\()" + envVars),
2367
+ lookbehind: true,
2368
+ alias: "constant"
2369
+ }
2370
+ },
2371
+ alias: "variable",
2372
+ lookbehind: true
2373
+ },
2374
+ // Highlight parameter names as variables
2375
+ "parameter": {
2376
+ pattern: /(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,
2377
+ alias: "variable",
2378
+ lookbehind: true
2379
+ },
2380
+ "string": [
2381
+ // Support for Here-documents https://en.wikipedia.org/wiki/Here_document
2382
+ {
2383
+ pattern: /((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,
2384
+ lookbehind: true,
2385
+ greedy: true,
2386
+ inside: insideString
2387
+ },
2388
+ // Here-document with quotes around the tag
2389
+ // → No expansion (so no “inside”).
2390
+ {
2391
+ pattern: /((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,
2392
+ lookbehind: true,
2393
+ greedy: true,
2394
+ inside: {
2395
+ "bash": commandAfterHeredoc
2396
+ }
2397
+ },
2398
+ // “Normal” string
2399
+ {
2400
+ // https://www.gnu.org/software/bash/manual/html_node/Double-Quotes.html
2401
+ pattern: /(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,
2402
+ lookbehind: true,
2403
+ greedy: true,
2404
+ inside: insideString
2405
+ },
2406
+ {
2407
+ // https://www.gnu.org/software/bash/manual/html_node/Single-Quotes.html
2408
+ pattern: /(^|[^$\\])'[^']*'/,
2409
+ lookbehind: true,
2410
+ greedy: true
2411
+ },
2412
+ {
2413
+ // https://www.gnu.org/software/bash/manual/html_node/ANSI_002dC-Quoting.html
2414
+ pattern: /\$'(?:[^'\\]|\\[\s\S])*'/,
2415
+ greedy: true,
2416
+ inside: {
2417
+ "entity": insideString.entity
2418
+ }
2419
+ }
2420
+ ],
2421
+ "environment": {
2422
+ pattern: RegExp("\\$?" + envVars),
2423
+ alias: "constant"
2424
+ },
2425
+ "variable": insideString.variable,
2426
+ "function": {
2427
+ pattern: /(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,
2428
+ lookbehind: true
2429
+ },
2430
+ "keyword": {
2431
+ pattern: /(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,
2432
+ lookbehind: true
2433
+ },
2434
+ // https://www.gnu.org/software/bash/manual/html_node/Shell-Builtin-Commands.html
2435
+ "builtin": {
2436
+ pattern: /(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,
2437
+ lookbehind: true,
2438
+ // Alias added to make those easier to distinguish from strings.
2439
+ alias: "class-name"
2440
+ },
2441
+ "boolean": {
2442
+ pattern: /(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,
2443
+ lookbehind: true
2444
+ },
2445
+ "file-descriptor": {
2446
+ pattern: /\B&\d\b/,
2447
+ alias: "important"
2448
+ },
2449
+ "operator": {
2450
+ // Lots of redirections here, but not just that.
2451
+ pattern: /\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,
2452
+ inside: {
2453
+ "file-descriptor": {
2454
+ pattern: /^\d/,
2455
+ alias: "important"
2456
+ }
2457
+ }
2458
+ },
2459
+ "punctuation": /\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,
2460
+ "number": {
2461
+ pattern: /(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,
2462
+ lookbehind: true
2463
+ }
2464
+ };
2465
+ commandAfterHeredoc.inside = Prism2.languages.bash;
2466
+ var toBeCopied = [
2467
+ "comment",
2468
+ "function-name",
2469
+ "for-or-select",
2470
+ "assign-left",
2471
+ "parameter",
2472
+ "string",
2473
+ "environment",
2474
+ "function",
2475
+ "keyword",
2476
+ "builtin",
2477
+ "boolean",
2478
+ "file-descriptor",
2479
+ "operator",
2480
+ "punctuation",
2481
+ "number"
2482
+ ];
2483
+ var inside = insideString.variable[1].inside;
2484
+ for (var i = 0; i < toBeCopied.length; i++) {
2485
+ inside[toBeCopied[i]] = Prism2.languages.bash[toBeCopied[i]];
2486
+ }
2487
+ Prism2.languages.sh = Prism2.languages.bash;
2488
+ Prism2.languages.shell = Prism2.languages.bash;
2489
+ })(Prism);
2490
+ var prismPython = {};
2491
+ var hasRequiredPrismPython;
2492
+ function requirePrismPython() {
2493
+ if (hasRequiredPrismPython) return prismPython;
2494
+ hasRequiredPrismPython = 1;
2495
+ Prism.languages.python = {
2496
+ "comment": {
2497
+ pattern: /(^|[^\\])#.*/,
2498
+ lookbehind: true,
2499
+ greedy: true
2500
+ },
2501
+ "string-interpolation": {
2502
+ pattern: /(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,
2503
+ greedy: true,
2504
+ inside: {
2505
+ "interpolation": {
2506
+ // "{" <expression> <optional "!s", "!r", or "!a"> <optional ":" format specifier> "}"
2507
+ pattern: /((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,
2508
+ lookbehind: true,
2509
+ inside: {
2510
+ "format-spec": {
2511
+ pattern: /(:)[^:(){}]+(?=\}$)/,
2512
+ lookbehind: true
2513
+ },
2514
+ "conversion-option": {
2515
+ pattern: /![sra](?=[:}]$)/,
2516
+ alias: "punctuation"
2517
+ },
2518
+ rest: null
2519
+ }
2520
+ },
2521
+ "string": /[\s\S]+/
2522
+ }
2523
+ },
2524
+ "triple-quoted-string": {
2525
+ pattern: /(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,
2526
+ greedy: true,
2527
+ alias: "string"
2528
+ },
2529
+ "string": {
2530
+ pattern: /(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,
2531
+ greedy: true
2532
+ },
2533
+ "function": {
2534
+ pattern: /((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,
2535
+ lookbehind: true
2536
+ },
2537
+ "class-name": {
2538
+ pattern: /(\bclass\s+)\w+/i,
2539
+ lookbehind: true
2540
+ },
2541
+ "decorator": {
2542
+ pattern: /(^[\t ]*)@\w+(?:\.\w+)*/m,
2543
+ lookbehind: true,
2544
+ alias: ["annotation", "punctuation"],
2545
+ inside: {
2546
+ "punctuation": /\./
2547
+ }
2548
+ },
2549
+ "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/,
2550
+ "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/,
2551
+ "boolean": /\b(?:False|None|True)\b/,
2552
+ "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,
2553
+ "operator": /[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,
2554
+ "punctuation": /[{}[\];(),.:]/
2555
+ };
2556
+ Prism.languages.python["string-interpolation"].inside["interpolation"].inside.rest = Prism.languages.python;
2557
+ Prism.languages.py = Prism.languages.python;
2558
+ return prismPython;
2559
+ }
2560
+ requirePrismPython();
2561
+ (function(Prism2) {
2562
+ var anchorOrAlias = /[*&][^\s[\]{},]+/;
2563
+ var tag = /!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/;
2564
+ var properties = "(?:" + tag.source + "(?:[ ]+" + anchorOrAlias.source + ")?|" + anchorOrAlias.source + "(?:[ ]+" + tag.source + ")?)";
2565
+ var plainKey = /(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*/.source.replace(/<PLAIN>/g, function() {
2566
+ return /[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source;
2567
+ });
2568
+ var string = /"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;
2569
+ function createValuePattern(value, flags) {
2570
+ flags = (flags || "").replace(/m/g, "") + "m";
2571
+ var pattern = /([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<<prop>>/g, function() {
2572
+ return properties;
2573
+ }).replace(/<<value>>/g, function() {
2574
+ return value;
2575
+ });
2576
+ return RegExp(pattern, flags);
2577
+ }
2578
+ Prism2.languages.yaml = {
2579
+ "scalar": {
2580
+ pattern: RegExp(/([\-:]\s*(?:\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<<prop>>/g, function() {
2581
+ return properties;
2582
+ })),
2583
+ lookbehind: true,
2584
+ alias: "string"
2585
+ },
2586
+ "comment": /#.*/,
2587
+ "key": {
2588
+ pattern: RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source.replace(/<<prop>>/g, function() {
2589
+ return properties;
2590
+ }).replace(/<<key>>/g, function() {
2591
+ return "(?:" + plainKey + "|" + string + ")";
2592
+ })),
2593
+ lookbehind: true,
2594
+ greedy: true,
2595
+ alias: "atrule"
2596
+ },
2597
+ "directive": {
2598
+ pattern: /(^[ \t]*)%.+/m,
2599
+ lookbehind: true,
2600
+ alias: "important"
2601
+ },
2602
+ "datetime": {
2603
+ pattern: createValuePattern(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),
2604
+ lookbehind: true,
2605
+ alias: "number"
2606
+ },
2607
+ "boolean": {
2608
+ pattern: createValuePattern(/false|true/.source, "i"),
2609
+ lookbehind: true,
2610
+ alias: "important"
2611
+ },
2612
+ "null": {
2613
+ pattern: createValuePattern(/null|~/.source, "i"),
2614
+ lookbehind: true,
2615
+ alias: "important"
2616
+ },
2617
+ "string": {
2618
+ pattern: createValuePattern(string),
2619
+ lookbehind: true,
2620
+ greedy: true
2621
+ },
2622
+ "number": {
2623
+ pattern: createValuePattern(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source, "i"),
2624
+ lookbehind: true
2625
+ },
2626
+ "tag": tag,
2627
+ "important": anchorOrAlias,
2628
+ "punctuation": /---|[:[\]{}\-,|>?]|\.\.\./
2629
+ };
2630
+ Prism2.languages.yml = Prism2.languages.yaml;
2631
+ })(Prism);
2632
+ Prism.languages.sql = {
2633
+ "comment": {
2634
+ pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,
2635
+ lookbehind: true
2636
+ },
2637
+ "variable": [
2638
+ {
2639
+ pattern: /@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,
2640
+ greedy: true
2641
+ },
2642
+ /@[\w.$]+/
2643
+ ],
2644
+ "string": {
2645
+ pattern: /(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,
2646
+ greedy: true,
2647
+ lookbehind: true
2648
+ },
2649
+ "identifier": {
2650
+ pattern: /(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,
2651
+ greedy: true,
2652
+ lookbehind: true,
2653
+ inside: {
2654
+ "punctuation": /^`|`$/
2655
+ }
2656
+ },
2657
+ "function": /\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,
2658
+ // Should we highlight user defined functions too?
2659
+ "keyword": /\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,
2660
+ "boolean": /\b(?:FALSE|NULL|TRUE)\b/i,
2661
+ "number": /\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,
2662
+ "operator": /[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,
2663
+ "punctuation": /[;[\]()`,.]/
2664
+ };
2665
+ (function(Prism2) {
2666
+ var inner = /(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;
2667
+ function createInline(pattern) {
2668
+ pattern = pattern.replace(/<inner>/g, function() {
2669
+ return inner;
2670
+ });
2671
+ return RegExp(/((?:^|[^\\])(?:\\{2})*)/.source + "(?:" + pattern + ")");
2672
+ }
2673
+ var tableCell = /(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source;
2674
+ var tableRow = /\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g, function() {
2675
+ return tableCell;
2676
+ });
2677
+ var tableLine = /\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;
2678
+ Prism2.languages.markdown = Prism2.languages.extend("markup", {});
2679
+ Prism2.languages.insertBefore("markdown", "prolog", {
2680
+ "front-matter-block": {
2681
+ pattern: /(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,
2682
+ lookbehind: true,
2683
+ greedy: true,
2684
+ inside: {
2685
+ "punctuation": /^---|---$/,
2686
+ "front-matter": {
2687
+ pattern: /\S+(?:\s+\S+)*/,
2688
+ alias: ["yaml", "language-yaml"],
2689
+ inside: Prism2.languages.yaml
2690
+ }
2691
+ }
2692
+ },
2693
+ "blockquote": {
2694
+ // > ...
2695
+ pattern: /^>(?:[\t ]*>)*/m,
2696
+ alias: "punctuation"
2697
+ },
2698
+ "table": {
2699
+ pattern: RegExp("^" + tableRow + tableLine + "(?:" + tableRow + ")*", "m"),
2700
+ inside: {
2701
+ "table-data-rows": {
2702
+ pattern: RegExp("^(" + tableRow + tableLine + ")(?:" + tableRow + ")*$"),
2703
+ lookbehind: true,
2704
+ inside: {
2705
+ "table-data": {
2706
+ pattern: RegExp(tableCell),
2707
+ inside: Prism2.languages.markdown
2708
+ },
2709
+ "punctuation": /\|/
2710
+ }
2711
+ },
2712
+ "table-line": {
2713
+ pattern: RegExp("^(" + tableRow + ")" + tableLine + "$"),
2714
+ lookbehind: true,
2715
+ inside: {
2716
+ "punctuation": /\||:?-{3,}:?/
2717
+ }
2718
+ },
2719
+ "table-header-row": {
2720
+ pattern: RegExp("^" + tableRow + "$"),
2721
+ inside: {
2722
+ "table-header": {
2723
+ pattern: RegExp(tableCell),
2724
+ alias: "important",
2725
+ inside: Prism2.languages.markdown
2726
+ },
2727
+ "punctuation": /\|/
2728
+ }
2729
+ }
2730
+ }
2731
+ },
2732
+ "code": [
2733
+ {
2734
+ // Prefixed by 4 spaces or 1 tab and preceded by an empty line
2735
+ pattern: /((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,
2736
+ lookbehind: true,
2737
+ alias: "keyword"
2738
+ },
2739
+ {
2740
+ // ```optional language
2741
+ // code block
2742
+ // ```
2743
+ pattern: /^```[\s\S]*?^```$/m,
2744
+ greedy: true,
2745
+ inside: {
2746
+ "code-block": {
2747
+ pattern: /^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,
2748
+ lookbehind: true
2749
+ },
2750
+ "code-language": {
2751
+ pattern: /^(```).+/,
2752
+ lookbehind: true
2753
+ },
2754
+ "punctuation": /```/
2755
+ }
2756
+ }
2757
+ ],
2758
+ "title": [
2759
+ {
2760
+ // title 1
2761
+ // =======
2762
+ // title 2
2763
+ // -------
2764
+ pattern: /\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,
2765
+ alias: "important",
2766
+ inside: {
2767
+ punctuation: /==+$|--+$/
2768
+ }
2769
+ },
2770
+ {
2771
+ // # title 1
2772
+ // ###### title 6
2773
+ pattern: /(^\s*)#.+/m,
2774
+ lookbehind: true,
2775
+ alias: "important",
2776
+ inside: {
2777
+ punctuation: /^#+|#+$/
2778
+ }
2779
+ }
2780
+ ],
2781
+ "hr": {
2782
+ // ***
2783
+ // ---
2784
+ // * * *
2785
+ // -----------
2786
+ pattern: /(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,
2787
+ lookbehind: true,
2788
+ alias: "punctuation"
2789
+ },
2790
+ "list": {
2791
+ // * item
2792
+ // + item
2793
+ // - item
2794
+ // 1. item
2795
+ pattern: /(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,
2796
+ lookbehind: true,
2797
+ alias: "punctuation"
2798
+ },
2799
+ "url-reference": {
2800
+ // [id]: http://example.com "Optional title"
2801
+ // [id]: http://example.com 'Optional title'
2802
+ // [id]: http://example.com (Optional title)
2803
+ // [id]: <http://example.com> "Optional title"
2804
+ pattern: /!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,
2805
+ inside: {
2806
+ "variable": {
2807
+ pattern: /^(!?\[)[^\]]+/,
2808
+ lookbehind: true
2809
+ },
2810
+ "string": /(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,
2811
+ "punctuation": /^[\[\]!:]|[<>]/
2812
+ },
2813
+ alias: "url"
2814
+ },
2815
+ "bold": {
2816
+ // **strong**
2817
+ // __strong__
2818
+ // allow one nested instance of italic text using the same delimiter
2819
+ pattern: createInline(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),
2820
+ lookbehind: true,
2821
+ greedy: true,
2822
+ inside: {
2823
+ "content": {
2824
+ pattern: /(^..)[\s\S]+(?=..$)/,
2825
+ lookbehind: true,
2826
+ inside: {}
2827
+ // see below
2828
+ },
2829
+ "punctuation": /\*\*|__/
2830
+ }
2831
+ },
2832
+ "italic": {
2833
+ // *em*
2834
+ // _em_
2835
+ // allow one nested instance of bold text using the same delimiter
2836
+ pattern: createInline(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),
2837
+ lookbehind: true,
2838
+ greedy: true,
2839
+ inside: {
2840
+ "content": {
2841
+ pattern: /(^.)[\s\S]+(?=.$)/,
2842
+ lookbehind: true,
2843
+ inside: {}
2844
+ // see below
2845
+ },
2846
+ "punctuation": /[*_]/
2847
+ }
2848
+ },
2849
+ "strike": {
2850
+ // ~~strike through~~
2851
+ // ~strike~
2852
+ // eslint-disable-next-line regexp/strict
2853
+ pattern: createInline(/(~~?)(?:(?!~)<inner>)+\2/.source),
2854
+ lookbehind: true,
2855
+ greedy: true,
2856
+ inside: {
2857
+ "content": {
2858
+ pattern: /(^~~?)[\s\S]+(?=\1$)/,
2859
+ lookbehind: true,
2860
+ inside: {}
2861
+ // see below
2862
+ },
2863
+ "punctuation": /~~?/
2864
+ }
2865
+ },
2866
+ "code-snippet": {
2867
+ // `code`
2868
+ // ``code``
2869
+ pattern: /(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,
2870
+ lookbehind: true,
2871
+ greedy: true,
2872
+ alias: ["code", "keyword"]
2873
+ },
2874
+ "url": {
2875
+ // [example](http://example.com "Optional title")
2876
+ // [example][id]
2877
+ // [example] [id]
2878
+ pattern: createInline(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),
2879
+ lookbehind: true,
2880
+ greedy: true,
2881
+ inside: {
2882
+ "operator": /^!/,
2883
+ "content": {
2884
+ pattern: /(^\[)[^\]]+(?=\])/,
2885
+ lookbehind: true,
2886
+ inside: {}
2887
+ // see below
2888
+ },
2889
+ "variable": {
2890
+ pattern: /(^\][ \t]?\[)[^\]]+(?=\]$)/,
2891
+ lookbehind: true
2892
+ },
2893
+ "url": {
2894
+ pattern: /(^\]\()[^\s)]+/,
2895
+ lookbehind: true
2896
+ },
2897
+ "string": {
2898
+ pattern: /(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,
2899
+ lookbehind: true
2900
+ }
2901
+ }
2902
+ }
2903
+ });
2904
+ ["url", "bold", "italic", "strike"].forEach(function(token) {
2905
+ ["url", "bold", "italic", "strike", "code-snippet"].forEach(function(inside) {
2906
+ if (token !== inside) {
2907
+ Prism2.languages.markdown[token].inside.content.inside[inside] = Prism2.languages.markdown[inside];
2908
+ }
2909
+ });
2910
+ });
2911
+ Prism2.hooks.add("after-tokenize", function(env) {
2912
+ if (env.language !== "markdown" && env.language !== "md") {
2913
+ return;
2914
+ }
2915
+ function walkTokens(tokens) {
2916
+ if (!tokens || typeof tokens === "string") {
2917
+ return;
2918
+ }
2919
+ for (var i = 0, l = tokens.length; i < l; i++) {
2920
+ var token = tokens[i];
2921
+ if (token.type !== "code") {
2922
+ walkTokens(token.content);
2923
+ continue;
2924
+ }
2925
+ var codeLang = token.content[1];
2926
+ var codeBlock = token.content[3];
2927
+ if (codeLang && codeBlock && codeLang.type === "code-language" && codeBlock.type === "code-block" && typeof codeLang.content === "string") {
2928
+ var lang = codeLang.content.replace(/\b#/g, "sharp").replace(/\b\+\+/g, "pp");
2929
+ lang = (/[a-z][\w-]*/i.exec(lang) || [""])[0].toLowerCase();
2930
+ var alias = "language-" + lang;
2931
+ if (!codeBlock.alias) {
2932
+ codeBlock.alias = [alias];
2933
+ } else if (typeof codeBlock.alias === "string") {
2934
+ codeBlock.alias = [codeBlock.alias, alias];
2935
+ } else {
2936
+ codeBlock.alias.push(alias);
2937
+ }
2938
+ }
2939
+ }
2940
+ }
2941
+ walkTokens(env.tokens);
2942
+ });
2943
+ Prism2.hooks.add("wrap", function(env) {
2944
+ if (env.type !== "code-block") {
2945
+ return;
2946
+ }
2947
+ var codeLang = "";
2948
+ for (var i = 0, l = env.classes.length; i < l; i++) {
2949
+ var cls = env.classes[i];
2950
+ var match = /language-(.+)/.exec(cls);
2951
+ if (match) {
2952
+ codeLang = match[1];
2953
+ break;
2954
+ }
2955
+ }
2956
+ var grammar = Prism2.languages[codeLang];
2957
+ if (!grammar) {
2958
+ if (codeLang && codeLang !== "none" && Prism2.plugins.autoloader) {
2959
+ var id = "md-" + (/* @__PURE__ */ new Date()).valueOf() + "-" + Math.floor(Math.random() * 1e16);
2960
+ env.attributes["id"] = id;
2961
+ Prism2.plugins.autoloader.loadLanguages(codeLang, function() {
2962
+ var ele = document.getElementById(id);
2963
+ if (ele) {
2964
+ ele.innerHTML = Prism2.highlight(ele.textContent, Prism2.languages[codeLang], codeLang);
2965
+ }
2966
+ });
2967
+ }
2968
+ } else {
2969
+ env.content = Prism2.highlight(textContent(env.content), grammar, codeLang);
2970
+ }
2971
+ });
2972
+ var tagPattern = RegExp(Prism2.languages.markup.tag.pattern.source, "gi");
2973
+ var KNOWN_ENTITY_NAMES = {
2974
+ "amp": "&",
2975
+ "lt": "<",
2976
+ "gt": ">",
2977
+ "quot": '"'
2978
+ };
2979
+ var fromCodePoint = String.fromCodePoint || String.fromCharCode;
2980
+ function textContent(html) {
2981
+ var text = html.replace(tagPattern, "");
2982
+ text = text.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi, function(m, code) {
2983
+ code = code.toLowerCase();
2984
+ if (code[0] === "#") {
2985
+ var value;
2986
+ if (code[1] === "x") {
2987
+ value = parseInt(code.slice(2), 16);
2988
+ } else {
2989
+ value = Number(code.slice(1));
2990
+ }
2991
+ return fromCodePoint(value);
2992
+ } else {
2993
+ var known = KNOWN_ENTITY_NAMES[code];
2994
+ if (known) {
2995
+ return known;
2996
+ }
2997
+ return m;
2998
+ }
2999
+ });
3000
+ return text;
3001
+ }
3002
+ Prism2.languages.md = Prism2.languages.markdown;
3003
+ })(Prism);
3004
+ (function(Prism2) {
3005
+ Prism2.languages.diff = {
3006
+ "coord": [
3007
+ // Match all kinds of coord lines (prefixed by "+++", "---" or "***").
3008
+ /^(?:\*{3}|-{3}|\+{3}).*$/m,
3009
+ // Match "@@ ... @@" coord lines in unified diff.
3010
+ /^@@.*@@$/m,
3011
+ // Match coord lines in normal diff (starts with a number).
3012
+ /^\d.*$/m
3013
+ ]
3014
+ // deleted, inserted, unchanged, diff
3015
+ };
3016
+ var PREFIXES = {
3017
+ "deleted-sign": "-",
3018
+ "deleted-arrow": "<",
3019
+ "inserted-sign": "+",
3020
+ "inserted-arrow": ">",
3021
+ "unchanged": " ",
3022
+ "diff": "!"
3023
+ };
3024
+ Object.keys(PREFIXES).forEach(function(name) {
3025
+ var prefix = PREFIXES[name];
3026
+ var alias = [];
3027
+ if (!/^\w+$/.test(name)) {
3028
+ alias.push(/\w+/.exec(name)[0]);
3029
+ }
3030
+ if (name === "diff") {
3031
+ alias.push("bold");
3032
+ }
3033
+ Prism2.languages.diff[name] = {
3034
+ pattern: RegExp("^(?:[" + prefix + "].*(?:\r\n?|\n|(?![\\s\\S])))+", "m"),
3035
+ alias,
3036
+ inside: {
3037
+ "line": {
3038
+ pattern: /(.)(?=[\s\S]).*(?:\r\n?|\n)?/,
3039
+ lookbehind: true
3040
+ },
3041
+ "prefix": {
3042
+ pattern: /[\s\S]/,
3043
+ alias: /\w+/.exec(name)[0]
3044
+ }
3045
+ }
3046
+ };
3047
+ });
3048
+ Object.defineProperty(Prism2.languages.diff, "PREFIXES", {
3049
+ value: PREFIXES
3050
+ });
3051
+ })(Prism);
3052
+ const ALIASES = {
3053
+ js: "javascript",
3054
+ ts: "typescript",
3055
+ sh: "bash",
3056
+ shell: "bash",
3057
+ py: "python",
3058
+ yml: "yaml",
3059
+ html: "markup",
3060
+ xml: "markup",
3061
+ md: "markdown"
3062
+ };
3063
+ function highlightCode(code, lang) {
3064
+ const name = ALIASES[lang] ?? lang;
3065
+ const grammar = Prism$1.languages[name];
3066
+ if (!grammar) return null;
3067
+ return purify.sanitize(Prism$1.highlight(code, grammar, name));
3068
+ }
3069
+ export {
3070
+ highlightCode
3071
+ };
3072
+ //# sourceMappingURL=highlight-BmqVrDIy.js.map