PageSourceSearch

https://servifast.net/dashboard/vendor/prismjs/prism.js

js servifast.net collected 2026-10-02 02:02:38 UTC 24,832 bytes, 969 lines download raw bytes

1
2/* **********************************************
3     Begin prism-core.js
4********************************************** */
5
6var _self = (typeof window !== 'undefined')
7	? window   // if in browser
8	: (
9		(typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope)
10		? self // if in worker
11		: {}   // if in node js
12	);
13
14/**
15 * Prism: Lightweight, robust, elegant syntax highlighting
16 * MIT license http://www.opensource.org/licenses/mit-license.php/
17 * @author Lea Verou http://lea.verou.me
18 */
19
20var Prism = (function (_self){
21
22// Private helper vars
23var lang = /\blang(?:uage)?-([\w-]+)\b/i;
24var uniqueId = 0;
25
26var _ = {
27	manual: _self.Prism && _self.Prism.manual,
28	disableWorkerMessageHandler: _self.Prism && _self.Prism.disableWorkerMessageHandler,
29	util: {
30		encode: function (tokens) {
31			if (tokens instanceof Token) {
32				return new Token(tokens.type, _.util.encode(tokens.content), tokens.alias);
33			} else if (Array.isArray(tokens)) {
34				return tokens.map(_.util.encode);
35			} else {
36				return tokens.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/\u00a0/g, ' ');
37			}
38		},
39
40		type: function (o) {
41			return Object.prototype.toString.call(o).slice(8, -1);
42		},
43
44		objId: function (obj) {
45			if (!obj['__id']) {
46				Object.defineProperty(obj, '__id', { value: ++uniqueId });
47			}
48			return obj['__id'];
49		},
50
51		// Deep clone a language definition (e.g. to extend it)
52		clone: function deepClone(o, visited) {
53			var clone, id, type = _.util.type(o);
54			visited = visited || {};
55
56			switch (type) {
57				case 'Object':
58					id = _.util.objId(o);
59					if (visited[id]) {
60						return visited[id];
61					}
62					clone = {};
63					visited[id] = clone;
64
65					for (var key in o) {
66						if (o.hasOwnProperty(key)) {
67							clone[key] = deepClone(o[key], visited);
68						}
69					}
70
71					return clone;
72
73				case 'Array':
74					id = _.util.objId(o);
75					if (visited[id]) {
76						return visited[id];
77					}
78					clone = [];
79					visited[id] = clone;
80
81					o.forEach(function (v, i) {
82						clone[i] = deepClone(v, visited);
83					});
84
85					return clone;
86
87				default:
88					return o;
89			}
90		}
91	},
92
93	languages: {
94		extend: function (id, redef) {
95			var lang = _.util.clone(_.languages[id]);
96
97			for (var key in redef) {
98				lang[key] = redef[key];
99			}
100
101			return lang;
102		},
103
104		/**
105		 * Insert a token before another token in a language literal
106		 * As this needs to recreate the object (we cannot actually insert before keys in object literals),
107		 * we cannot just provide an object, we need an object and a key.
108		 * @param inside The key (or language id) of the parent
109		 * @param before The key to insert before.
110		 * @param insert Object with the key/value pairs to insert
111		 * @param root The object that contains `inside`. If equal to Prism.languages, it can be omitted.
112		 */
113		insertBefore: function (inside, before, insert, root) {
114			root = root || _.languages;
115			var grammar = root[inside];
116			var ret = {};
117
118			for (var token in grammar) {
119				if (grammar.hasOwnProperty(token)) {
120
121					if (token == before) {
122						for (var newToken in insert) {
123							if (insert.hasOwnProperty(newToken)) {
124								ret[newToken] = insert[newToken];
125							}
126						}
127					}
128
129					// Do not insert token which also occur in insert. See #1525
130					if (!insert.hasOwnProperty(token)) {
131						ret[token] = grammar[token];
132					}
133				}
134			}
135
136			var old = root[inside];
137			root[inside] = ret;
138
139			// Update references in other language definitions
140			_.languages.DFS(_.languages, function(key, value) {
141				if (value === old && key != inside) {
142					this[key] = ret;
143				}
144			});
145
146			return ret;
147		},
148
149		// Traverse a language definition with Depth First Search
150		DFS: function DFS(o, callback, type, visited) {
151			visited = visited || {};
152
153			var objId = _.util.objId;
154
155			for (var i in o) {
156				if (o.hasOwnProperty(i)) {
157					callback.call(o, i, o[i], type || i);
158
159					var property = o[i],
160					    propertyType = _.util.type(property);
161
162					if (propertyType === 'Object' && !visited[objId(property)]) {
163						visited[objId(property)] = true;
164						DFS(property, callback, null, visited);
165					}
166					else if (propertyType === 'Array' && !visited[objId(property)]) {
167						visited[objId(property)] = true;
168						DFS(property, callback, i, visited);
169					}
170				}
171			}
172		}
173	},
174	plugins: {},
175
176	highlightAll: function(async, callback) {
177		_.highlightAllUnder(document, async, callback);
178	},
179
180	highlightAllUnder: function(container, async, callback) {
181		var env = {
182			callback: callback,
183			selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
184		};
185
186		_.hooks.run('before-highlightall', env);
187
188		var elements = container.querySelectorAll(env.selector);
189
190		for (var i=0, element; element = elements[i++];) {
191			_.highlightElement(element, async === true, env.callback);
192		}
193	},
194
195	highlightElement: function(element, async, callback) {
196		// Find language
197		var language = 'none', grammar, parent = element;
198
199		while (parent && !lang.test(parent.className)) {
200			parent = parent.parentNode;
201		}
202
203		if (parent) {
204			language = (parent.className.match(lang) || [,'none'])[1].toLowerCase();
205			grammar = _.languages[language];
206		}
207
208		// Set language on the element, if not present
209		element.className = element.className.replace(lang, '').replace(/\s+/g, ' ') + ' language-' + language;
210
211		if (element.parentNode) {
212			// Set language on the parent, for styling
213			parent = element.parentNode;
214
215			if (/pre/i.test(parent.nodeName)) {
216				parent.className = parent.className.replace(lang, '').replace(/\s+/g, ' ') + ' language-' + language;
217			}
218		}
219
220		var code = element.textContent;
221
222		var env = {
223			element: element,
224			language: language,
225			grammar: grammar,
226			code: code
227		};
228
229		var insertHighlightedCode = function (highlightedCode) {
230			env.highlightedCode = highlightedCode;
231
232			_.hooks.run('before-insert', env);
233
234			env.element.innerHTML = env.highlightedCode;
235
236			_.hooks.run('after-highlight', env);
237			_.hooks.run('complete', env);
238			callback && callback.call(env.element);
239		}
240
241		_.hooks.run('before-sanity-check', env);
242
243		if (!env.code) {
244			_.hooks.run('complete', env);
245			return;
246		}
247
248		_.hooks.run('before-highlight', env);
249
250		if (!env.grammar) {
251			insertHighlightedCode(_.util.encode(env.code));
252			return;
253		}
254
255		if (async && _self.Worker) {
256			var worker = new Worker(_.filename);
257
258			worker.onmessage = function(evt) {
259				insertHighlightedCode(evt.data);
260			};
261
262			worker.postMessage(JSON.stringify({
263				language: env.language,
264				code: env.code,
265				immediateClose: true
266			}));
267		}
268		else {
269			insertHighlightedCode(_.highlight(env.code, env.grammar, env.language));
270		}
271	},
272
273	highlight: function (text, grammar, language) {
274		var env = {
275			code: text,
276			grammar: grammar,
277			language: language
278		};
279		_.hooks.run('before-tokenize', env);
280		env.tokens = _.tokenize(env.code, env.grammar);
281		_.hooks.run('after-tokenize', env);
282		return Token.stringify(_.util.encode(env.tokens), env.language);
283	},
284
285	matchGrammar: function (text, strarr, grammar, index, startPos, oneshot, target) {
286		for (var token in grammar) {
287			if(!grammar.hasOwnProperty(token) || !grammar[token]) {
288				continue;
289			}
290
291			if (token == target) {
292				return;
293			}
294
295			var patterns = grammar[token];
296			patterns = (_.util.type(patterns) === "Array") ? patterns : [patterns];
297
298			for (var j = 0; j < patterns.length; ++j) {
299				var pattern = patterns[j],
300					inside = pattern.inside,
301					lookbehind = !!pattern.lookbehind,
302					greedy = !!pattern.greedy,
303					lookbehindLength = 0,
304					alias = pattern.alias;
305
306				if (greedy && !pattern.pattern.global) {
307					// Without the global flag, lastIndex won't work
308					var flags = pattern.pattern.toString().match(/[imuy]*$/)[0];
309					pattern.pattern = RegExp(pattern.pattern.source, flags + "g");
310				}
311
312				pattern = pattern.pattern || pattern;
313
314				// Don’t cache length as it changes during the loop
315				for (var i = index, pos = startPos; i < strarr.length; pos += strarr[i].length, ++i) {
316
317					var str = strarr[i];
318
319					if (strarr.length > text.length) {
320						// Something went terribly wrong, ABORT, ABORT!
321						return;
322					}
323
324					if (str instanceof Token) {
325						continue;
326					}
327
328					if (greedy && i != strarr.length - 1) {
329						pattern.lastIndex = pos;
330						var match = pattern.exec(text);
331						if (!match) {
332							break;
333						}
334
335						var from = match.index + (lookbehind ? match[1].length : 0),
336						    to = match.index + match[0].length,
337						    k = i,
338						    p = pos;
339
340						for (var len = strarr.length; k < len && (p < to || (!strarr[k].type && !strarr[k - 1].greedy)); ++k) {
341							p += strarr[k].length;
342							// Move the index i to the element in strarr that is closest to from
343							if (from >= p) {
344								++i;
345								pos = p;
346							}
347						}
348
349						// If strarr[i] is a Token, then the match starts inside another Token, which is invalid
350						if (strarr[i] instanceof Token) {
351							continue;
352						}
353
354						// Number of tokens to delete and replace with the new match
355						delNum = k - i;
356						str = text.slice(pos, p);
357						match.index -= pos;
358					} else {
359						pattern.lastIndex = 0;
360
361						var match = pattern.exec(str),
362							delNum = 1;
363					}
364
365					if (!match) {
366						if (oneshot) {
367							break;
368						}
369
370						continue;
371					}
372
373					if(lookbehind) {
374						lookbehindLength = match[1] ? match[1].length : 0;
375					}
376
377					var from = match.index + lookbehindLength,
378					    match = match[0].slice(lookbehindLength),
379					    to = from + match.length,
380					    before = str.slice(0, from),
381					    after = str.slice(to);
382
383					var args = [i, delNum];
384
385					if (before) {
386						++i;
387						pos += before.length;
388						args.push(before);
389					}
390
391					var wrapped = new Token(token, inside? _.tokenize(match, inside) : match, alias, match, greedy);
392
393					args.push(wrapped);
394
395					if (after) {
396						args.push(after);
397					}
398
399					Array.prototype.splice.apply(strarr, args);
400
401					if (delNum != 1)
402						_.matchGrammar(text, strarr, grammar, i, pos, true, token);
403
404					if (oneshot)
405						break;
406				}
407			}
408		}
409	},
410
411	tokenize: function(text, grammar) {
412		var strarr = [text];
413
414		var rest = grammar.rest;
415
416		if (rest) {
417			for (var token in rest) {
418				grammar[token] = rest[token];
419			}
420
421			delete grammar.rest;
422		}
423
424		_.matchGrammar(text, strarr, grammar, 0, 0, false);
425
426		return strarr;
427	},
428
429	hooks: {
430		all: {},
431
432		add: function (name, callback) {
433			var hooks = _.hooks.all;
434
435			hooks[name] = hooks[name] || [];
436
437			hooks[name].push(callback);
438		},
439
440		run: function (name, env) {
441			var callbacks = _.hooks.all[name];
442
443			if (!callbacks || !callbacks.length) {
444				return;
445			}
446
447			for (var i=0, callback; callback = callbacks[i++];) {
448				callback(env);
449			}
450		}
451	},
452
453	Token: Token
454};
455
456_self.Prism = _;
457
458function Token(type, content, alias, matchedStr, greedy) {
459	this.type = type;
460	this.content = content;
461	this.alias = alias;
462	// Copy of the full string this token was created from
463	this.length = (matchedStr || "").length|0;
464	this.greedy = !!greedy;
465}
466
467Token.stringify = function(o, language) {
468	if (typeof o == 'string') {
469		return o;
470	}
471
472	if (Array.isArray(o)) {
473		return o.map(function(element) {
474			return Token.stringify(element, language);
475		}).join('');
476	}
477
478	var env = {
479		type: o.type,
480		content: Token.stringify(o.content, language),
481		tag: 'span',
482		classes: ['token', o.type],
483		attributes: {},
484		language: language
485	};
486
487	if (o.alias) {
488		var aliases = Array.isArray(o.alias) ? o.alias : [o.alias];
489		Array.prototype.push.apply(env.classes, aliases);
490	}
491
492	_.hooks.run('wrap', env);
493
494	var attributes = Object.keys(env.attributes).map(function(name) {
495		return name + '="' + (env.attributes[name] || '').replace(/"/g, '&quot;') + '"';
496	}).join(' ');
497
498	return '<' + env.tag + ' class="' + env.classes.join(' ') + '"' + (attributes ? ' ' + attributes : '') + '>' + env.content + '</' + env.tag + '>';
499};
500
501if (!_self.document) {
502	if (!_self.addEventListener) {
503		// in Node.js
504		return _;
505	}
506
507	if (!_.disableWorkerMessageHandler) {
508		// In worker
509		_self.addEventListener('message', function (evt) {
510			var message = JSON.parse(evt.data),
511				lang = message.language,
512				code = message.code,
513				immediateClose = message.immediateClose;
514
515			_self.postMessage(_.highlight(code, _.languages[lang], lang));
516			if (immediateClose) {
517				_self.close();
518			}
519		}, false);
520	}
521
522	return _;
523}
524
525//Get current script and highlight
526var script = document.currentScript || [].slice.call(document.getElementsByTagName("script")).pop();
527
528if (script) {
529	_.filename = script.src;
530
531	if (!_.manual && !script.hasAttribute('data-manual')) {
532		if(document.readyState !== "loading") {
533			if (window.requestAnimationFrame) {
534				window.requestAnimationFrame(_.highlightAll);
535			} else {
536				window.setTimeout(_.highlightAll, 16);
537			}
538		}
539		else {
540			document.addEventListener('DOMContentLoaded', _.highlightAll);
541		}
542	}
543}
544
545return _;
546
547})(_self);
548
549if (typeof module !== 'undefined' && module.exports) {
550	module.exports = Prism;
551}
552
553// hack for components to work correctly in node.js
554if (typeof global !== 'undefined') {
555	global.Prism = Prism;
556}
557
558
559/* **********************************************
560     Begin prism-markup.js
561********************************************** */
562
563Prism.languages.markup = {
564	'comment': /<!--[\s\S]*?-->/,
565	'prolog': /<\?[\s\S]+?\?>/,
566	'doctype': /<!DOCTYPE[\s\S]+?>/i,
567	'cdata': /<!\[CDATA\[[\s\S]*?]]>/i,
568	'tag': {
569		pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/i,
570		greedy: true,
571		inside: {
572			'tag': {
573				pattern: /^<\/?[^\s>\/]+/i,
574				inside: {
575					'punctuation': /^<\/?/,
576					'namespace': /^[^\s>\/:]+:/
577				}
578			},
579			'attr-value': {
580				pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/i,
581				inside: {
582					'punctuation': [
583						/^=/,
584						{
585							pattern: /^(\s*)["']|["']$/,
586							lookbehind: true
587						}
588					]
589				}
590			},
591			'punctuation': /\/?>/,
592			'attr-name': {
593				pattern: /[^\s>\/]+/,
594				inside: {
595					'namespace': /^[^\s>\/:]+:/
596				}
597			}
598
599		}
600	},
601	'entity': /&#?[\da-z]{1,8};/i
602};
603
604Prism.languages.markup['tag'].inside['attr-value'].inside['entity'] =
605	Prism.languages.markup['entity'];
606
607// Plugin to make entity title show the real entity, idea by Roman Komarov
608Prism.hooks.add('wrap', function(env) {
609
610	if (env.type === 'entity') {
611		env.attributes['title'] = env.content.replace(/&amp;/, '&');
612	}
613});
614
615Object.defineProperty(Prism.languages.markup.tag, 'addInlined', {
616	/**
617	 * Adds an inlined language to markup.
618	 *
619	 * An example of an inlined language is CSS with `<style>` tags.
620	 *
621	 * @param {string} tagName The name of the tag that contains the inlined language. This name will be treated as
622	 * case insensitive.
623	 * @param {string} lang The language key.
624	 * @example
625	 * addInlined('style', 'css');
626	 */
627	value: function addInlined(tagName, lang) {
628		var includedCdataInside = {};
629		includedCdataInside['language-' + lang] = {
630			pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
631			lookbehind: true,
632			inside: Prism.languages[lang]
633		};
634		includedCdataInside['cdata'] = /^<!\[CDATA\[|\]\]>$/i;
635
636		var inside = {
637			'included-cdata': {
638				pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
639				inside: includedCdataInside
640			}
641		};
642		inside['language-' + lang] = {
643			pattern: /[\s\S]+/,
644			inside: Prism.languages[lang]
645		};
646
647		var def = {};
648		def[tagName] = {
649			pattern: RegExp(/(<__[\s\S]*?>)(?:<!\[CDATA\[[\s\S]*?\]\]>\s*|[\s\S])*?(?=<\/__>)/.source.replace(/__/g, tagName), 'i'),
650			lookbehind: true,
651			greedy: true,
652			inside: inside
653		};
654
655		Prism.languages.insertBefore('markup', 'cdata', def);
656	}
657});
658
659Prism.languages.xml = Prism.languages.extend('markup', {});
660Prism.languages.html = Prism.languages.markup;
661Prism.languages.mathml = Prism.languages.markup;
662Prism.languages.svg = Prism.languages.markup;
663
664
665/* **********************************************
666     Begin prism-css.js
667********************************************** */
668
669(function (Prism) {
670
671	var string = /("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/;
672
673	Prism.languages.css = {
674		'comment': /\/\*[\s\S]*?\*\//,
675		'atrule': {
676			pattern: /@[\w-]+[\s\S]*?(?:;|(?=\s*\{))/,
677			inside: {
678				'rule': /@[\w-]+/
679				// See rest below
680			}
681		},
682		'url': {
683			pattern: RegExp('url\\((?:' + string.source + '|[^\n\r()]*)\\)', 'i'),
684			inside: {
685				'function': /^url/i,
686				'punctuation': /^\(|\)$/
687			}
688		},
689		'selector': RegExp('[^{}\\s](?:[^{};"\']|' + string.source + ')*?(?=\\s*\\{)'),
690		'string': {
691			pattern: string,
692			greedy: true
693		},
694		'property': /[-_a-z\xA0-\uFFFF][-\w\xA0-\uFFFF]*(?=\s*:)/i,
695		'important': /!important\b/i,
696		'function': /[-a-z0-9]+(?=\()/i,
697		'punctuation': /[(){};:,]/
698	};
699
700	Prism.languages.css['atrule'].inside.rest = Prism.languages.css;
701
702	var markup = Prism.languages.markup;
703	if (markup) {
704		markup.tag.addInlined('style', 'css');
705
706		Prism.languages.insertBefore('inside', 'attr-value', {
707			'style-attr': {
708				pattern: /\s*style=("|')(?:\\[\s\S]|(?!\1)[^\\])*\1/i,
709				inside: {
710					'attr-name': {
711						pattern: /^\s*style/i,
712						inside: markup.tag.inside
713					},
714					'punctuation': /^\s*=\s*['"]|['"]\s*$/,
715					'attr-value': {
716						pattern: /.+/i,
717						inside: Prism.languages.css
718					}
719				},
720				alias: 'language-css'
721			}
722		}, markup.tag);
723	}
724
725}(Prism));
726
727
728/* **********************************************
729     Begin prism-clike.js
730********************************************** */
731
732Prism.languages.clike = {
733	'comment': [
734		{
735			pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
736			lookbehind: true
737		},
738		{
739			pattern: /(^|[^\\:])\/\/.*/,
740			lookbehind: true,
741			greedy: true
742		}
743	],
744	'string': {
745		pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
746		greedy: true
747	},
748	'class-name': {
749		pattern: /((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[\w.\\]+/i,
750		lookbehind: true,
751		inside: {
752			punctuation: /[.\\]/
753		}
754	},
755	'keyword': /\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,
756	'boolean': /\b(?:true|false)\b/,
757	'function': /\w+(?=\()/,
758	'number': /\b0x[\da-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?/i,
759	'operator': /--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,
760	'punctuation': /[{}[\];(),.:]/
761};
762
763
764/* **********************************************
765     Begin prism-javascript.js
766********************************************** */
767
768Prism.languages.javascript = Prism.languages.extend('clike', {
769	'class-name': [
770		Prism.languages.clike['class-name'],
771		{
772			pattern: /(^|[^$\w\xA0-\uFFFF])[_$A-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\.(?:prototype|constructor))/,
773			lookbehind: true
774		}
775	],
776	'keyword': [
777		{
778			pattern: /((?:^|})\s*)(?:catch|finally)\b/,
779			lookbehind: true
780		},
781		{
782			pattern: /(^|[^.])\b(?:as|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|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)\b/,
783			lookbehind: true
784		},
785	],
786	'number': /\b(?:(?:0[xX](?:[\dA-Fa-f](?:_[\dA-Fa-f])?)+|0[bB](?:[01](?:_[01])?)+|0[oO](?:[0-7](?:_[0-7])?)+)n?|(?:\d(?:_\d)?)+n|NaN|Infinity)\b|(?:\b(?:\d(?:_\d)?)+\.?(?:\d(?:_\d)?)*|\B\.(?:\d(?:_\d)?)+)(?:[Ee][+-]?(?:\d(?:_\d)?)+)?/,
787	// Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
788	'function': /#?[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,
789	'operator': /-[-=]?|\+[+=]?|!=?=?|<<?=?|>>?>?=?|=(?:==?|>)?|&[&=]?|\|[|=]?|\*\*?=?|\/=?|~|\^=?|%=?|\?|\.{3}/
790});
791
792Prism.languages.javascript['class-name'][0].pattern = /(\b(?:class|interface|extends|implements|instanceof|new)\s+)[\w.\\]+/;
793
794Prism.languages.insertBefore('javascript', 'keyword', {
795	'regex': {
796		pattern: /((?:^|[^$\w\xA0-\uFFFF."'\])\s])\s*)\/(\[(?:[^\]\\\r\n]|\\.)*]|\\.|[^/\\\[\r\n])+\/[gimyus]{0,6}(?=\s*($|[\r\n,.;})\]]))/,
797		lookbehind: true,
798		greedy: true
799	},
800	// This must be declared before keyword because we use "function" inside the look-forward
801	'function-variable': {
802		pattern: /#?[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)\s*=>))/,
803		alias: 'function'
804	},
805	'parameter': [
806		{
807			pattern: /(function(?:\s+[_$A-Za-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)?\s*\(\s*)(?!\s)(?:[^()]|\([^()]
807*\))+?(?=\s*\))/,
808			lookbehind: true,
809			inside: Prism.languages.javascript
810		},
811		{
812			pattern: /[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*=>)/i,
813			inside: Prism.languages.javascript
814		},
815		{
816			pattern: /(\(\s*)(?!\s)(?:[^()]|\([^()]*\))+?(?=\s*\)\s*=>)/,
817			lookbehind: true,
818			inside: Prism.languages.javascript
819		},
820		{
821			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]))(?:[_$A-Za-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*\s*)\(\s*)(?!\s)(?:[^()]|\([^()]*\))+?(?=\s*\)\s*\{)/,
822			lookbehind: true,
823			inside: Prism.languages.javascript
824		}
825	],
826	'constant': /\b[A-Z](?:[A-Z_]|\dx?)*\b/
827});
828
829Prism.languages.insertBefore('javascript', 'string', {
830	'template-string': {
831		pattern: /`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})+}|(?!\${)[^\\`])*`/,
832		greedy: true,
833		inside: {
834			'template-punctuation': {
835				pattern: /^`|`$/,
836				alias: 'string'
837			},
838			'interpolation': {
839				pattern: /((?:^|[^\\])(?:\\{2})*)\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})+}/,
840				lookbehind: true,
841				inside: {
842					'interpolation-punctuation': {
843						pattern: /^\${|}$/,
844						alias: 'punctuation'
845					},
846					rest: Prism.languages.javascript
847				}
848			},
849			'string': /[\s\S]+/
850		}
851	}
852});
853
854if (Prism.languages.markup) {
855	Prism.languages.markup.tag.addInlined('script', 'javascript');
856}
857
858Prism.languages.js = Prism.languages.javascript;
859
860
861/* **********************************************
862     Begin prism-file-highlight.js
863********************************************** */
864
865(function () {
866	if (typeof self === 'undefined' || !self.Prism || !self.document || !document.querySelector) {
867		return;
868	}
869
870	/**
871	 * @param {Element} [container=document]
872	 */
873	self.Prism.fileHighlight = function(container) {
874		container = container || document;
875
876		var Extensions = {
877			'js': 'javascript',
878			'py': 'python',
879			'rb': 'ruby',
880			'ps1': 'powershell',
881			'psm1': 'powershell',
882			'sh': 'bash',
883			'bat': 'batch',
884			'h': 'c',
885			'tex': 'latex'
886		};
887
888		Array.prototype.slice.call(container.querySelectorAll('pre[data-src]')).forEach(function (pre) {
889			// ignore if already loaded
890			if (pre.hasAttribute('data-src-loaded')) {
891				return;
892			}
893
894			// load current
895			var src = pre.getAttribute('data-src');
896
897			var language, parent = pre;
898			var lang = /\blang(?:uage)?-([\w-]+)\b/i;
899			while (parent && !lang.test(parent.className)) {
900				parent = parent.parentNode;
901			}
902
903			if (parent) {
904				language = (pre.className.match(lang) || [, ''])[1];
905			}
906
907			if (!language) {
908				var extension = (src.match(/\.(\w+)$/) || [, ''])[1];
909				language = Extensions[extension] || extension;
910			}
911
912			var code = document.createElement('code');
913			code.className = 'language-' + language;
914
915			pre.textContent = '';
916
917			code.textContent = 'Loading…';
918
919			pre.appendChild(code);
920
921			var xhr = new XMLHttpRequest();
922
923			xhr.open('GET', src, true);
924
925			xhr.onreadystatechange = function () {
926				if (xhr.readyState == 4) {
927
928					if (xhr.status < 400 && xhr.responseText) {
929						code.textContent = xhr.responseText;
930
931						Prism.highlightElement(code);
932						// mark as loaded
933						pre.setAttribute('data-src-loaded', '');
934					}
935					else if (xhr.status >= 400) {
936						code.textContent = '✖ Error ' + xhr.status + ' while fetching file: ' + xhr.statusText;
937					}
938					else {
939						code.textContent = '✖ Error: File does not exist or is empty';
940					}
941				}
942			};
943
944			xhr.send(null);
945		});
946
947		if (Prism.plugins.toolbar) {
948			Prism.plugins.toolbar.registerButton('download-file', function (env) {
949				var pre = env.element.parentNode;
950				if (!pre || !/pre/i.test(pre.nodeName) || !pre.hasAttribute('data-src') || !pre.hasAttribute('data-download-link')) {
951					return;
952				}
953				var src = pre.getAttribute('data-src');
954				var a = document.createElement('a');
955				a.textContent = pre.getAttribute('data-download-link-label') || 'Download';
956				a.setAttribute('download', '');
957				a.href = src;
958				return a;
959			});
960		}
961
962	};
963
964	document.addEventListener('DOMContentLoaded', function () {
965		// execute inside handler, for dropping Event as argument
966		self.Prism.fileHighlight();
967	});
968
969})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.