@bigbinary/neeto-molecules 3.2.2 → 3.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/dist/BrowserSupport.js +2 -1
  2. package/dist/BrowserSupport.js.map +1 -1
  3. package/dist/Builder.js +3 -3
  4. package/dist/Builder.js.map +1 -1
  5. package/dist/DownloadMobileAppCallout.js +2 -1
  6. package/dist/DownloadMobileAppCallout.js.map +1 -1
  7. package/dist/EmailForm.js +2 -1
  8. package/dist/EmailForm.js.map +1 -1
  9. package/dist/FloatingActionMenu.js +2 -1
  10. package/dist/FloatingActionMenu.js.map +1 -1
  11. package/dist/IconPicker.js +916 -4
  12. package/dist/IconPicker.js.map +1 -1
  13. package/dist/IpRestriction.js +3093 -7
  14. package/dist/IpRestriction.js.map +1 -1
  15. package/dist/KeyboardShortcuts.js +2 -1
  16. package/dist/KeyboardShortcuts.js.map +1 -1
  17. package/dist/MenuBar.js +1804 -12
  18. package/dist/MenuBar.js.map +1 -1
  19. package/dist/NeetoWidget.js +1957 -3
  20. package/dist/NeetoWidget.js.map +1 -1
  21. package/dist/PhoneNumber.js +12 -4
  22. package/dist/PhoneNumber.js.map +1 -1
  23. package/dist/SendToFields.js +1919 -1
  24. package/dist/SendToFields.js.map +1 -1
  25. package/dist/ShareViaEmail.js +2 -1
  26. package/dist/ShareViaEmail.js.map +1 -1
  27. package/dist/ShareViaLink.js +860 -2
  28. package/dist/ShareViaLink.js.map +1 -1
  29. package/dist/_commonjsHelpers-1c8beb5f.js +4 -0
  30. package/dist/_commonjsHelpers-1c8beb5f.js.map +1 -0
  31. package/dist/cjs/BrowserSupport.js +3 -3
  32. package/dist/cjs/BrowserSupport.js.map +1 -1
  33. package/dist/cjs/Builder.js +3 -3
  34. package/dist/cjs/Builder.js.map +1 -1
  35. package/dist/cjs/DownloadMobileAppCallout.js +3 -3
  36. package/dist/cjs/DownloadMobileAppCallout.js.map +1 -1
  37. package/dist/cjs/EmailForm.js +2 -1
  38. package/dist/cjs/EmailForm.js.map +1 -1
  39. package/dist/cjs/FloatingActionMenu.js +2 -1
  40. package/dist/cjs/FloatingActionMenu.js.map +1 -1
  41. package/dist/cjs/IconPicker.js +920 -5
  42. package/dist/cjs/IconPicker.js.map +1 -1
  43. package/dist/cjs/IpRestriction.js +3101 -15
  44. package/dist/cjs/IpRestriction.js.map +1 -1
  45. package/dist/cjs/KeyboardShortcuts.js +3 -3
  46. package/dist/cjs/KeyboardShortcuts.js.map +1 -1
  47. package/dist/cjs/MenuBar.js +1807 -10
  48. package/dist/cjs/MenuBar.js.map +1 -1
  49. package/dist/cjs/NeetoWidget.js +1958 -5
  50. package/dist/cjs/NeetoWidget.js.map +1 -1
  51. package/dist/cjs/PhoneNumber.js +12 -4
  52. package/dist/cjs/PhoneNumber.js.map +1 -1
  53. package/dist/cjs/SendToFields.js +1921 -3
  54. package/dist/cjs/SendToFields.js.map +1 -1
  55. package/dist/cjs/ShareViaEmail.js +2 -1
  56. package/dist/cjs/ShareViaEmail.js.map +1 -1
  57. package/dist/cjs/ShareViaLink.js +860 -3
  58. package/dist/cjs/ShareViaLink.js.map +1 -1
  59. package/dist/cjs/_commonjsHelpers-68cdf74f.js +6 -0
  60. package/dist/cjs/_commonjsHelpers-68cdf74f.js.map +1 -0
  61. package/dist/cjs/platform-628b3bd8.js +1252 -0
  62. package/dist/cjs/platform-628b3bd8.js.map +1 -0
  63. package/dist/platform-e221afea.js +1250 -0
  64. package/dist/platform-e221afea.js.map +1 -0
  65. package/package.json +14 -16
@@ -17,8 +17,8 @@ import Typography from '@bigbinary/neetoui/Typography';
17
17
  import PageLoader from './PageLoader.js';
18
18
  import Select from '@bigbinary/neetoui/Select';
19
19
  import CopyToClipboardButton from './CopyToClipboardButton.js';
20
- import Prism from 'prismjs';
21
- import 'prismjs/themes/prism-tomorrow.css';
20
+ import { c as commonjsGlobal } from './_commonjsHelpers-1c8beb5f.js';
21
+ import { n } from './inject-css-c86de496.js';
22
22
  import { Formik, Form } from 'formik';
23
23
  import Pane from '@bigbinary/neetoui/Pane';
24
24
  import Input from '@bigbinary/neetoui/formik/Input';
@@ -31,7 +31,6 @@ import withT from '@bigbinary/neeto-commons-frontend/react-utils/withT';
31
31
  import Switch from '@bigbinary/neetoui/Switch';
32
32
  import Tooltip from '@bigbinary/neetoui/Tooltip';
33
33
  import '@babel/runtime/helpers/objectWithoutProperties';
34
- import './inject-css-c86de496.js';
35
34
  import '@bigbinary/neeto-commons-frontend/utils/general';
36
35
  import '@bigbinary/neeto-icons/Copy';
37
36
  import '@bigbinary/neeto-icons/Check';
@@ -163,6 +162,1961 @@ var ChatWidgetBody = function ChatWidgetBody(_ref) {
163
162
  }));
164
163
  };
165
164
 
165
+ var prism = {exports: {}};
166
+
167
+ (function (module) {
168
+ /* **********************************************
169
+ Begin prism-core.js
170
+ ********************************************** */
171
+
172
+ /// <reference lib="WebWorker"/>
173
+
174
+ var _self = (typeof window !== 'undefined')
175
+ ? window // if in browser
176
+ : (
177
+ (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope)
178
+ ? self // if in worker
179
+ : {} // if in node js
180
+ );
181
+
182
+ /**
183
+ * Prism: Lightweight, robust, elegant syntax highlighting
184
+ *
185
+ * @license MIT <https://opensource.org/licenses/MIT>
186
+ * @author Lea Verou <https://lea.verou.me>
187
+ * @namespace
188
+ * @public
189
+ */
190
+ var Prism = (function (_self) {
191
+
192
+ // Private helper vars
193
+ var lang = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i;
194
+ var uniqueId = 0;
195
+
196
+ // The grammar object for plaintext
197
+ var plainTextGrammar = {};
198
+
199
+
200
+ var _ = {
201
+ /**
202
+ * By default, Prism will attempt to highlight all code elements (by calling {@link Prism.highlightAll}) on the
203
+ * current page after the page finished loading. This might be a problem if e.g. you wanted to asynchronously load
204
+ * additional languages or plugins yourself.
205
+ *
206
+ * By setting this value to `true`, Prism will not automatically highlight all code elements on the page.
207
+ *
208
+ * You obviously have to change this value before the automatic highlighting started. To do this, you can add an
209
+ * empty Prism object into the global scope before loading the Prism script like this:
210
+ *
211
+ * ```js
212
+ * window.Prism = window.Prism || {};
213
+ * Prism.manual = true;
214
+ * // add a new <script> to load Prism's script
215
+ * ```
216
+ *
217
+ * @default false
218
+ * @type {boolean}
219
+ * @memberof Prism
220
+ * @public
221
+ */
222
+ manual: _self.Prism && _self.Prism.manual,
223
+ /**
224
+ * By default, if Prism is in a web worker, it assumes that it is in a worker it created itself, so it uses
225
+ * `addEventListener` to communicate with its parent instance. However, if you're using Prism manually in your
226
+ * own worker, you don't want it to do this.
227
+ *
228
+ * By setting this value to `true`, Prism will not add its own listeners to the worker.
229
+ *
230
+ * You obviously have to change this value before Prism executes. To do this, you can add an
231
+ * empty Prism object into the global scope before loading the Prism script like this:
232
+ *
233
+ * ```js
234
+ * window.Prism = window.Prism || {};
235
+ * Prism.disableWorkerMessageHandler = true;
236
+ * // Load Prism's script
237
+ * ```
238
+ *
239
+ * @default false
240
+ * @type {boolean}
241
+ * @memberof Prism
242
+ * @public
243
+ */
244
+ disableWorkerMessageHandler: _self.Prism && _self.Prism.disableWorkerMessageHandler,
245
+
246
+ /**
247
+ * A namespace for utility methods.
248
+ *
249
+ * All function in this namespace that are not explicitly marked as _public_ are for __internal use only__ and may
250
+ * change or disappear at any time.
251
+ *
252
+ * @namespace
253
+ * @memberof Prism
254
+ */
255
+ util: {
256
+ encode: function encode(tokens) {
257
+ if (tokens instanceof Token) {
258
+ return new Token(tokens.type, encode(tokens.content), tokens.alias);
259
+ } else if (Array.isArray(tokens)) {
260
+ return tokens.map(encode);
261
+ } else {
262
+ return tokens.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/\u00a0/g, ' ');
263
+ }
264
+ },
265
+
266
+ /**
267
+ * Returns the name of the type of the given value.
268
+ *
269
+ * @param {any} o
270
+ * @returns {string}
271
+ * @example
272
+ * type(null) === 'Null'
273
+ * type(undefined) === 'Undefined'
274
+ * type(123) === 'Number'
275
+ * type('foo') === 'String'
276
+ * type(true) === 'Boolean'
277
+ * type([1, 2]) === 'Array'
278
+ * type({}) === 'Object'
279
+ * type(String) === 'Function'
280
+ * type(/abc+/) === 'RegExp'
281
+ */
282
+ type: function (o) {
283
+ return Object.prototype.toString.call(o).slice(8, -1);
284
+ },
285
+
286
+ /**
287
+ * Returns a unique number for the given object. Later calls will still return the same number.
288
+ *
289
+ * @param {Object} obj
290
+ * @returns {number}
291
+ */
292
+ objId: function (obj) {
293
+ if (!obj['__id']) {
294
+ Object.defineProperty(obj, '__id', { value: ++uniqueId });
295
+ }
296
+ return obj['__id'];
297
+ },
298
+
299
+ /**
300
+ * Creates a deep clone of the given object.
301
+ *
302
+ * The main intended use of this function is to clone language definitions.
303
+ *
304
+ * @param {T} o
305
+ * @param {Record<number, any>} [visited]
306
+ * @returns {T}
307
+ * @template T
308
+ */
309
+ clone: function deepClone(o, visited) {
310
+ visited = visited || {};
311
+
312
+ var clone; var id;
313
+ switch (_.util.type(o)) {
314
+ case 'Object':
315
+ id = _.util.objId(o);
316
+ if (visited[id]) {
317
+ return visited[id];
318
+ }
319
+ clone = /** @type {Record<string, any>} */ ({});
320
+ visited[id] = clone;
321
+
322
+ for (var key in o) {
323
+ if (o.hasOwnProperty(key)) {
324
+ clone[key] = deepClone(o[key], visited);
325
+ }
326
+ }
327
+
328
+ return /** @type {any} */ (clone);
329
+
330
+ case 'Array':
331
+ id = _.util.objId(o);
332
+ if (visited[id]) {
333
+ return visited[id];
334
+ }
335
+ clone = [];
336
+ visited[id] = clone;
337
+
338
+ (/** @type {Array} */(/** @type {any} */(o))).forEach(function (v, i) {
339
+ clone[i] = deepClone(v, visited);
340
+ });
341
+
342
+ return /** @type {any} */ (clone);
343
+
344
+ default:
345
+ return o;
346
+ }
347
+ },
348
+
349
+ /**
350
+ * Returns the Prism language of the given element set by a `language-xxxx` or `lang-xxxx` class.
351
+ *
352
+ * If no language is set for the element or the element is `null` or `undefined`, `none` will be returned.
353
+ *
354
+ * @param {Element} element
355
+ * @returns {string}
356
+ */
357
+ getLanguage: function (element) {
358
+ while (element) {
359
+ var m = lang.exec(element.className);
360
+ if (m) {
361
+ return m[1].toLowerCase();
362
+ }
363
+ element = element.parentElement;
364
+ }
365
+ return 'none';
366
+ },
367
+
368
+ /**
369
+ * Sets the Prism `language-xxxx` class of the given element.
370
+ *
371
+ * @param {Element} element
372
+ * @param {string} language
373
+ * @returns {void}
374
+ */
375
+ setLanguage: function (element, language) {
376
+ // remove all `language-xxxx` classes
377
+ // (this might leave behind a leading space)
378
+ element.className = element.className.replace(RegExp(lang, 'gi'), '');
379
+
380
+ // add the new `language-xxxx` class
381
+ // (using `classList` will automatically clean up spaces for us)
382
+ element.classList.add('language-' + language);
383
+ },
384
+
385
+ /**
386
+ * Returns the script element that is currently executing.
387
+ *
388
+ * This does __not__ work for line script element.
389
+ *
390
+ * @returns {HTMLScriptElement | null}
391
+ */
392
+ currentScript: function () {
393
+ if (typeof document === 'undefined') {
394
+ return null;
395
+ }
396
+ if ('currentScript' in document && 1 < 2 /* hack to trip TS' flow analysis */) {
397
+ return /** @type {any} */ (document.currentScript);
398
+ }
399
+
400
+ // IE11 workaround
401
+ // we'll get the src of the current script by parsing IE11's error stack trace
402
+ // this will not work for inline scripts
403
+
404
+ try {
405
+ throw new Error();
406
+ } catch (err) {
407
+ // Get file src url from stack. Specifically works with the format of stack traces in IE.
408
+ // A stack will look like this:
409
+ //
410
+ // Error
411
+ // at _.util.currentScript (http://localhost/components/prism-core.js:119:5)
412
+ // at Global code (http://localhost/components/prism-core.js:606:1)
413
+
414
+ var src = (/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(err.stack) || [])[1];
415
+ if (src) {
416
+ var scripts = document.getElementsByTagName('script');
417
+ for (var i in scripts) {
418
+ if (scripts[i].src == src) {
419
+ return scripts[i];
420
+ }
421
+ }
422
+ }
423
+ return null;
424
+ }
425
+ },
426
+
427
+ /**
428
+ * Returns whether a given class is active for `element`.
429
+ *
430
+ * The class can be activated if `element` or one of its ancestors has the given class and it can be deactivated
431
+ * if `element` or one of its ancestors has the negated version of the given class. The _negated version_ of the
432
+ * given class is just the given class with a `no-` prefix.
433
+ *
434
+ * Whether the class is active is determined by the closest ancestor of `element` (where `element` itself is
435
+ * closest ancestor) that has the given class or the negated version of it. If neither `element` nor any of its
436
+ * ancestors have the given class or the negated version of it, then the default activation will be returned.
437
+ *
438
+ * In the paradoxical situation where the closest ancestor contains __both__ the given class and the negated
439
+ * version of it, the class is considered active.
440
+ *
441
+ * @param {Element} element
442
+ * @param {string} className
443
+ * @param {boolean} [defaultActivation=false]
444
+ * @returns {boolean}
445
+ */
446
+ isActive: function (element, className, defaultActivation) {
447
+ var no = 'no-' + className;
448
+
449
+ while (element) {
450
+ var classList = element.classList;
451
+ if (classList.contains(className)) {
452
+ return true;
453
+ }
454
+ if (classList.contains(no)) {
455
+ return false;
456
+ }
457
+ element = element.parentElement;
458
+ }
459
+ return !!defaultActivation;
460
+ }
461
+ },
462
+
463
+ /**
464
+ * This namespace contains all currently loaded languages and the some helper functions to create and modify languages.
465
+ *
466
+ * @namespace
467
+ * @memberof Prism
468
+ * @public
469
+ */
470
+ languages: {
471
+ /**
472
+ * The grammar for plain, unformatted text.
473
+ */
474
+ plain: plainTextGrammar,
475
+ plaintext: plainTextGrammar,
476
+ text: plainTextGrammar,
477
+ txt: plainTextGrammar,
478
+
479
+ /**
480
+ * Creates a deep copy of the language with the given id and appends the given tokens.
481
+ *
482
+ * If a token in `redef` also appears in the copied language, then the existing token in the copied language
483
+ * will be overwritten at its original position.
484
+ *
485
+ * ## Best practices
486
+ *
487
+ * Since the position of overwriting tokens (token in `redef` that overwrite tokens in the copied language)
488
+ * doesn't matter, they can technically be in any order. However, this can be confusing to others that trying to
489
+ * understand the language definition because, normally, the order of tokens matters in Prism grammars.
490
+ *
491
+ * Therefore, it is encouraged to order overwriting tokens according to the positions of the overwritten tokens.
492
+ * Furthermore, all non-overwriting tokens should be placed after the overwriting ones.
493
+ *
494
+ * @param {string} id The id of the language to extend. This has to be a key in `Prism.languages`.
495
+ * @param {Grammar} redef The new tokens to append.
496
+ * @returns {Grammar} The new language created.
497
+ * @public
498
+ * @example
499
+ * Prism.languages['css-with-colors'] = Prism.languages.extend('css', {
500
+ * // Prism.languages.css already has a 'comment' token, so this token will overwrite CSS' 'comment' token
501
+ * // at its original position
502
+ * 'comment': { ... },
503
+ * // CSS doesn't have a 'color' token, so this token will be appended
504
+ * 'color': /\b(?:red|green|blue)\b/
505
+ * });
506
+ */
507
+ extend: function (id, redef) {
508
+ var lang = _.util.clone(_.languages[id]);
509
+
510
+ for (var key in redef) {
511
+ lang[key] = redef[key];
512
+ }
513
+
514
+ return lang;
515
+ },
516
+
517
+ /**
518
+ * Inserts tokens _before_ another token in a language definition or any other grammar.
519
+ *
520
+ * ## Usage
521
+ *
522
+ * This helper method makes it easy to modify existing languages. For example, the CSS language definition
523
+ * not only defines CSS highlighting for CSS documents, but also needs to define highlighting for CSS embedded
524
+ * in HTML through `<style>` elements. To do this, it needs to modify `Prism.languages.markup` and add the
525
+ * appropriate tokens. However, `Prism.languages.markup` is a regular JavaScript object literal, so if you do
526
+ * this:
527
+ *
528
+ * ```js
529
+ * Prism.languages.markup.style = {
530
+ * // token
531
+ * };
532
+ * ```
533
+ *
534
+ * then the `style` token will be added (and processed) at the end. `insertBefore` allows you to insert tokens
535
+ * before existing tokens. For the CSS example above, you would use it like this:
536
+ *
537
+ * ```js
538
+ * Prism.languages.insertBefore('markup', 'cdata', {
539
+ * 'style': {
540
+ * // token
541
+ * }
542
+ * });
543
+ * ```
544
+ *
545
+ * ## Special cases
546
+ *
547
+ * If the grammars of `inside` and `insert` have tokens with the same name, the tokens in `inside`'s grammar
548
+ * will be ignored.
549
+ *
550
+ * This behavior can be used to insert tokens after `before`:
551
+ *
552
+ * ```js
553
+ * Prism.languages.insertBefore('markup', 'comment', {
554
+ * 'comment': Prism.languages.markup.comment,
555
+ * // tokens after 'comment'
556
+ * });
557
+ * ```
558
+ *
559
+ * ## Limitations
560
+ *
561
+ * The main problem `insertBefore` has to solve is iteration order. Since ES2015, the iteration order for object
562
+ * properties is guaranteed to be the insertion order (except for integer keys) but some browsers behave
563
+ * differently when keys are deleted and re-inserted. So `insertBefore` can't be implemented by temporarily
564
+ * deleting properties which is necessary to insert at arbitrary positions.
565
+ *
566
+ * To solve this problem, `insertBefore` doesn't actually insert the given tokens into the target object.
567
+ * Instead, it will create a new object and replace all references to the target object with the new one. This
568
+ * can be done without temporarily deleting properties, so the iteration order is well-defined.
569
+ *
570
+ * However, only references that can be reached from `Prism.languages` or `insert` will be replaced. I.e. if
571
+ * you hold the target object in a variable, then the value of the variable will not change.
572
+ *
573
+ * ```js
574
+ * var oldMarkup = Prism.languages.markup;
575
+ * var newMarkup = Prism.languages.insertBefore('markup', 'comment', { ... });
576
+ *
577
+ * assert(oldMarkup !== Prism.languages.markup);
578
+ * assert(newMarkup === Prism.languages.markup);
579
+ * ```
580
+ *
581
+ * @param {string} inside The property of `root` (e.g. a language id in `Prism.languages`) that contains the
582
+ * object to be modified.
583
+ * @param {string} before The key to insert before.
584
+ * @param {Grammar} insert An object containing the key-value pairs to be inserted.
585
+ * @param {Object<string, any>} [root] The object containing `inside`, i.e. the object that contains the
586
+ * object to be modified.
587
+ *
588
+ * Defaults to `Prism.languages`.
589
+ * @returns {Grammar} The new grammar object.
590
+ * @public
591
+ */
592
+ insertBefore: function (inside, before, insert, root) {
593
+ root = root || /** @type {any} */ (_.languages);
594
+ var grammar = root[inside];
595
+ /** @type {Grammar} */
596
+ var ret = {};
597
+
598
+ for (var token in grammar) {
599
+ if (grammar.hasOwnProperty(token)) {
600
+
601
+ if (token == before) {
602
+ for (var newToken in insert) {
603
+ if (insert.hasOwnProperty(newToken)) {
604
+ ret[newToken] = insert[newToken];
605
+ }
606
+ }
607
+ }
608
+
609
+ // Do not insert token which also occur in insert. See #1525
610
+ if (!insert.hasOwnProperty(token)) {
611
+ ret[token] = grammar[token];
612
+ }
613
+ }
614
+ }
615
+
616
+ var old = root[inside];
617
+ root[inside] = ret;
618
+
619
+ // Update references in other language definitions
620
+ _.languages.DFS(_.languages, function (key, value) {
621
+ if (value === old && key != inside) {
622
+ this[key] = ret;
623
+ }
624
+ });
625
+
626
+ return ret;
627
+ },
628
+
629
+ // Traverse a language definition with Depth First Search
630
+ DFS: function DFS(o, callback, type, visited) {
631
+ visited = visited || {};
632
+
633
+ var objId = _.util.objId;
634
+
635
+ for (var i in o) {
636
+ if (o.hasOwnProperty(i)) {
637
+ callback.call(o, i, o[i], type || i);
638
+
639
+ var property = o[i];
640
+ var propertyType = _.util.type(property);
641
+
642
+ if (propertyType === 'Object' && !visited[objId(property)]) {
643
+ visited[objId(property)] = true;
644
+ DFS(property, callback, null, visited);
645
+ } else if (propertyType === 'Array' && !visited[objId(property)]) {
646
+ visited[objId(property)] = true;
647
+ DFS(property, callback, i, visited);
648
+ }
649
+ }
650
+ }
651
+ }
652
+ },
653
+
654
+ plugins: {},
655
+
656
+ /**
657
+ * This is the most high-level function in Prism’s API.
658
+ * It fetches all the elements that have a `.language-xxxx` class and then calls {@link Prism.highlightElement} on
659
+ * each one of them.
660
+ *
661
+ * This is equivalent to `Prism.highlightAllUnder(document, async, callback)`.
662
+ *
663
+ * @param {boolean} [async=false] Same as in {@link Prism.highlightAllUnder}.
664
+ * @param {HighlightCallback} [callback] Same as in {@link Prism.highlightAllUnder}.
665
+ * @memberof Prism
666
+ * @public
667
+ */
668
+ highlightAll: function (async, callback) {
669
+ _.highlightAllUnder(document, async, callback);
670
+ },
671
+
672
+ /**
673
+ * Fetches all the descendants of `container` that have a `.language-xxxx` class and then calls
674
+ * {@link Prism.highlightElement} on each one of them.
675
+ *
676
+ * The following hooks will be run:
677
+ * 1. `before-highlightall`
678
+ * 2. `before-all-elements-highlight`
679
+ * 3. All hooks of {@link Prism.highlightElement} for each element.
680
+ *
681
+ * @param {ParentNode} container The root element, whose descendants that have a `.language-xxxx` class will be highlighted.
682
+ * @param {boolean} [async=false] Whether each element is to be highlighted asynchronously using Web Workers.
683
+ * @param {HighlightCallback} [callback] An optional callback to be invoked on each element after its highlighting is done.
684
+ * @memberof Prism
685
+ * @public
686
+ */
687
+ highlightAllUnder: function (container, async, callback) {
688
+ var env = {
689
+ callback: callback,
690
+ container: container,
691
+ selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
692
+ };
693
+
694
+ _.hooks.run('before-highlightall', env);
695
+
696
+ env.elements = Array.prototype.slice.apply(env.container.querySelectorAll(env.selector));
697
+
698
+ _.hooks.run('before-all-elements-highlight', env);
699
+
700
+ for (var i = 0, element; (element = env.elements[i++]);) {
701
+ _.highlightElement(element, async === true, env.callback);
702
+ }
703
+ },
704
+
705
+ /**
706
+ * Highlights the code inside a single element.
707
+ *
708
+ * The following hooks will be run:
709
+ * 1. `before-sanity-check`
710
+ * 2. `before-highlight`
711
+ * 3. All hooks of {@link Prism.highlight}. These hooks will be run by an asynchronous worker if `async` is `true`.
712
+ * 4. `before-insert`
713
+ * 5. `after-highlight`
714
+ * 6. `complete`
715
+ *
716
+ * Some the above hooks will be skipped if the element doesn't contain any text or there is no grammar loaded for
717
+ * the element's language.
718
+ *
719
+ * @param {Element} element The element containing the code.
720
+ * It must have a class of `language-xxxx` to be processed, where `xxxx` is a valid language identifier.
721
+ * @param {boolean} [async=false] Whether the element is to be highlighted asynchronously using Web Workers
722
+ * to improve performance and avoid blocking the UI when highlighting very large chunks of code. This option is
723
+ * [disabled by default](https://prismjs.com/faq.html#why-is-asynchronous-highlighting-disabled-by-default).
724
+ *
725
+ * Note: All language definitions required to highlight the code must be included in the main `prism.js` file for
726
+ * asynchronous highlighting to work. You can build your own bundle on the
727
+ * [Download page](https://prismjs.com/download.html).
728
+ * @param {HighlightCallback} [callback] An optional callback to be invoked after the highlighting is done.
729
+ * Mostly useful when `async` is `true`, since in that case, the highlighting is done asynchronously.
730
+ * @memberof Prism
731
+ * @public
732
+ */
733
+ highlightElement: function (element, async, callback) {
734
+ // Find language
735
+ var language = _.util.getLanguage(element);
736
+ var grammar = _.languages[language];
737
+
738
+ // Set language on the element, if not present
739
+ _.util.setLanguage(element, language);
740
+
741
+ // Set language on the parent, for styling
742
+ var parent = element.parentElement;
743
+ if (parent && parent.nodeName.toLowerCase() === 'pre') {
744
+ _.util.setLanguage(parent, language);
745
+ }
746
+
747
+ var code = element.textContent;
748
+
749
+ var env = {
750
+ element: element,
751
+ language: language,
752
+ grammar: grammar,
753
+ code: code
754
+ };
755
+
756
+ function insertHighlightedCode(highlightedCode) {
757
+ env.highlightedCode = highlightedCode;
758
+
759
+ _.hooks.run('before-insert', env);
760
+
761
+ env.element.innerHTML = env.highlightedCode;
762
+
763
+ _.hooks.run('after-highlight', env);
764
+ _.hooks.run('complete', env);
765
+ callback && callback.call(env.element);
766
+ }
767
+
768
+ _.hooks.run('before-sanity-check', env);
769
+
770
+ // plugins may change/add the parent/element
771
+ parent = env.element.parentElement;
772
+ if (parent && parent.nodeName.toLowerCase() === 'pre' && !parent.hasAttribute('tabindex')) {
773
+ parent.setAttribute('tabindex', '0');
774
+ }
775
+
776
+ if (!env.code) {
777
+ _.hooks.run('complete', env);
778
+ callback && callback.call(env.element);
779
+ return;
780
+ }
781
+
782
+ _.hooks.run('before-highlight', env);
783
+
784
+ if (!env.grammar) {
785
+ insertHighlightedCode(_.util.encode(env.code));
786
+ return;
787
+ }
788
+
789
+ if (async && _self.Worker) {
790
+ var worker = new Worker(_.filename);
791
+
792
+ worker.onmessage = function (evt) {
793
+ insertHighlightedCode(evt.data);
794
+ };
795
+
796
+ worker.postMessage(JSON.stringify({
797
+ language: env.language,
798
+ code: env.code,
799
+ immediateClose: true
800
+ }));
801
+ } else {
802
+ insertHighlightedCode(_.highlight(env.code, env.grammar, env.language));
803
+ }
804
+ },
805
+
806
+ /**
807
+ * Low-level function, only use if you know what you’re doing. It accepts a string of text as input
808
+ * and the language definitions to use, and returns a string with the HTML produced.
809
+ *
810
+ * The following hooks will be run:
811
+ * 1. `before-tokenize`
812
+ * 2. `after-tokenize`
813
+ * 3. `wrap`: On each {@link Token}.
814
+ *
815
+ * @param {string} text A string with the code to be highlighted.
816
+ * @param {Grammar} grammar An object containing the tokens to use.
817
+ *
818
+ * Usually a language definition like `Prism.languages.markup`.
819
+ * @param {string} language The name of the language definition passed to `grammar`.
820
+ * @returns {string} The highlighted HTML.
821
+ * @memberof Prism
822
+ * @public
823
+ * @example
824
+ * Prism.highlight('var foo = true;', Prism.languages.javascript, 'javascript');
825
+ */
826
+ highlight: function (text, grammar, language) {
827
+ var env = {
828
+ code: text,
829
+ grammar: grammar,
830
+ language: language
831
+ };
832
+ _.hooks.run('before-tokenize', env);
833
+ if (!env.grammar) {
834
+ throw new Error('The language "' + env.language + '" has no grammar.');
835
+ }
836
+ env.tokens = _.tokenize(env.code, env.grammar);
837
+ _.hooks.run('after-tokenize', env);
838
+ return Token.stringify(_.util.encode(env.tokens), env.language);
839
+ },
840
+
841
+ /**
842
+ * This is the heart of Prism, and the most low-level function you can use. It accepts a string of text as input
843
+ * and the language definitions to use, and returns an array with the tokenized code.
844
+ *
845
+ * When the language definition includes nested tokens, the function is called recursively on each of these tokens.
846
+ *
847
+ * This method could be useful in other contexts as well, as a very crude parser.
848
+ *
849
+ * @param {string} text A string with the code to be highlighted.
850
+ * @param {Grammar} grammar An object containing the tokens to use.
851
+ *
852
+ * Usually a language definition like `Prism.languages.markup`.
853
+ * @returns {TokenStream} An array of strings and tokens, a token stream.
854
+ * @memberof Prism
855
+ * @public
856
+ * @example
857
+ * let code = `var foo = 0;`;
858
+ * let tokens = Prism.tokenize(code, Prism.languages.javascript);
859
+ * tokens.forEach(token => {
860
+ * if (token instanceof Prism.Token && token.type === 'number') {
861
+ * console.log(`Found numeric literal: ${token.content}`);
862
+ * }
863
+ * });
864
+ */
865
+ tokenize: function (text, grammar) {
866
+ var rest = grammar.rest;
867
+ if (rest) {
868
+ for (var token in rest) {
869
+ grammar[token] = rest[token];
870
+ }
871
+
872
+ delete grammar.rest;
873
+ }
874
+
875
+ var tokenList = new LinkedList();
876
+ addAfter(tokenList, tokenList.head, text);
877
+
878
+ matchGrammar(text, tokenList, grammar, tokenList.head, 0);
879
+
880
+ return toArray(tokenList);
881
+ },
882
+
883
+ /**
884
+ * @namespace
885
+ * @memberof Prism
886
+ * @public
887
+ */
888
+ hooks: {
889
+ all: {},
890
+
891
+ /**
892
+ * Adds the given callback to the list of callbacks for the given hook.
893
+ *
894
+ * The callback will be invoked when the hook it is registered for is run.
895
+ * Hooks are usually directly run by a highlight function but you can also run hooks yourself.
896
+ *
897
+ * One callback function can be registered to multiple hooks and the same hook multiple times.
898
+ *
899
+ * @param {string} name The name of the hook.
900
+ * @param {HookCallback} callback The callback function which is given environment variables.
901
+ * @public
902
+ */
903
+ add: function (name, callback) {
904
+ var hooks = _.hooks.all;
905
+
906
+ hooks[name] = hooks[name] || [];
907
+
908
+ hooks[name].push(callback);
909
+ },
910
+
911
+ /**
912
+ * Runs a hook invoking all registered callbacks with the given environment variables.
913
+ *
914
+ * Callbacks will be invoked synchronously and in the order in which they were registered.
915
+ *
916
+ * @param {string} name The name of the hook.
917
+ * @param {Object<string, any>} env The environment variables of the hook passed to all callbacks registered.
918
+ * @public
919
+ */
920
+ run: function (name, env) {
921
+ var callbacks = _.hooks.all[name];
922
+
923
+ if (!callbacks || !callbacks.length) {
924
+ return;
925
+ }
926
+
927
+ for (var i = 0, callback; (callback = callbacks[i++]);) {
928
+ callback(env);
929
+ }
930
+ }
931
+ },
932
+
933
+ Token: Token
934
+ };
935
+ _self.Prism = _;
936
+
937
+
938
+ // Typescript note:
939
+ // The following can be used to import the Token type in JSDoc:
940
+ //
941
+ // @typedef {InstanceType<import("./prism-core")["Token"]>} Token
942
+
943
+ /**
944
+ * Creates a new token.
945
+ *
946
+ * @param {string} type See {@link Token#type type}
947
+ * @param {string | TokenStream} content See {@link Token#content content}
948
+ * @param {string|string[]} [alias] The alias(es) of the token.
949
+ * @param {string} [matchedStr=""] A copy of the full string this token was created from.
950
+ * @class
951
+ * @global
952
+ * @public
953
+ */
954
+ function Token(type, content, alias, matchedStr) {
955
+ /**
956
+ * The type of the token.
957
+ *
958
+ * This is usually the key of a pattern in a {@link Grammar}.
959
+ *
960
+ * @type {string}
961
+ * @see GrammarToken
962
+ * @public
963
+ */
964
+ this.type = type;
965
+ /**
966
+ * The strings or tokens contained by this token.
967
+ *
968
+ * This will be a token stream if the pattern matched also defined an `inside` grammar.
969
+ *
970
+ * @type {string | TokenStream}
971
+ * @public
972
+ */
973
+ this.content = content;
974
+ /**
975
+ * The alias(es) of the token.
976
+ *
977
+ * @type {string|string[]}
978
+ * @see GrammarToken
979
+ * @public
980
+ */
981
+ this.alias = alias;
982
+ // Copy of the full string this token was created from
983
+ this.length = (matchedStr || '').length | 0;
984
+ }
985
+
986
+ /**
987
+ * A token stream is an array of strings and {@link Token Token} objects.
988
+ *
989
+ * Token streams have to fulfill a few properties that are assumed by most functions (mostly internal ones) that process
990
+ * them.
991
+ *
992
+ * 1. No adjacent strings.
993
+ * 2. No empty strings.
994
+ *
995
+ * The only exception here is the token stream that only contains the empty string and nothing else.
996
+ *
997
+ * @typedef {Array<string | Token>} TokenStream
998
+ * @global
999
+ * @public
1000
+ */
1001
+
1002
+ /**
1003
+ * Converts the given token or token stream to an HTML representation.
1004
+ *
1005
+ * The following hooks will be run:
1006
+ * 1. `wrap`: On each {@link Token}.
1007
+ *
1008
+ * @param {string | Token | TokenStream} o The token or token stream to be converted.
1009
+ * @param {string} language The name of current language.
1010
+ * @returns {string} The HTML representation of the token or token stream.
1011
+ * @memberof Token
1012
+ * @static
1013
+ */
1014
+ Token.stringify = function stringify(o, language) {
1015
+ if (typeof o == 'string') {
1016
+ return o;
1017
+ }
1018
+ if (Array.isArray(o)) {
1019
+ var s = '';
1020
+ o.forEach(function (e) {
1021
+ s += stringify(e, language);
1022
+ });
1023
+ return s;
1024
+ }
1025
+
1026
+ var env = {
1027
+ type: o.type,
1028
+ content: stringify(o.content, language),
1029
+ tag: 'span',
1030
+ classes: ['token', o.type],
1031
+ attributes: {},
1032
+ language: language
1033
+ };
1034
+
1035
+ var aliases = o.alias;
1036
+ if (aliases) {
1037
+ if (Array.isArray(aliases)) {
1038
+ Array.prototype.push.apply(env.classes, aliases);
1039
+ } else {
1040
+ env.classes.push(aliases);
1041
+ }
1042
+ }
1043
+
1044
+ _.hooks.run('wrap', env);
1045
+
1046
+ var attributes = '';
1047
+ for (var name in env.attributes) {
1048
+ attributes += ' ' + name + '="' + (env.attributes[name] || '').replace(/"/g, '&quot;') + '"';
1049
+ }
1050
+
1051
+ return '<' + env.tag + ' class="' + env.classes.join(' ') + '"' + attributes + '>' + env.content + '</' + env.tag + '>';
1052
+ };
1053
+
1054
+ /**
1055
+ * @param {RegExp} pattern
1056
+ * @param {number} pos
1057
+ * @param {string} text
1058
+ * @param {boolean} lookbehind
1059
+ * @returns {RegExpExecArray | null}
1060
+ */
1061
+ function matchPattern(pattern, pos, text, lookbehind) {
1062
+ pattern.lastIndex = pos;
1063
+ var match = pattern.exec(text);
1064
+ if (match && lookbehind && match[1]) {
1065
+ // change the match to remove the text matched by the Prism lookbehind group
1066
+ var lookbehindLength = match[1].length;
1067
+ match.index += lookbehindLength;
1068
+ match[0] = match[0].slice(lookbehindLength);
1069
+ }
1070
+ return match;
1071
+ }
1072
+
1073
+ /**
1074
+ * @param {string} text
1075
+ * @param {LinkedList<string | Token>} tokenList
1076
+ * @param {any} grammar
1077
+ * @param {LinkedListNode<string | Token>} startNode
1078
+ * @param {number} startPos
1079
+ * @param {RematchOptions} [rematch]
1080
+ * @returns {void}
1081
+ * @private
1082
+ *
1083
+ * @typedef RematchOptions
1084
+ * @property {string} cause
1085
+ * @property {number} reach
1086
+ */
1087
+ function matchGrammar(text, tokenList, grammar, startNode, startPos, rematch) {
1088
+ for (var token in grammar) {
1089
+ if (!grammar.hasOwnProperty(token) || !grammar[token]) {
1090
+ continue;
1091
+ }
1092
+
1093
+ var patterns = grammar[token];
1094
+ patterns = Array.isArray(patterns) ? patterns : [patterns];
1095
+
1096
+ for (var j = 0; j < patterns.length; ++j) {
1097
+ if (rematch && rematch.cause == token + ',' + j) {
1098
+ return;
1099
+ }
1100
+
1101
+ var patternObj = patterns[j];
1102
+ var inside = patternObj.inside;
1103
+ var lookbehind = !!patternObj.lookbehind;
1104
+ var greedy = !!patternObj.greedy;
1105
+ var alias = patternObj.alias;
1106
+
1107
+ if (greedy && !patternObj.pattern.global) {
1108
+ // Without the global flag, lastIndex won't work
1109
+ var flags = patternObj.pattern.toString().match(/[imsuy]*$/)[0];
1110
+ patternObj.pattern = RegExp(patternObj.pattern.source, flags + 'g');
1111
+ }
1112
+
1113
+ /** @type {RegExp} */
1114
+ var pattern = patternObj.pattern || patternObj;
1115
+
1116
+ for ( // iterate the token list and keep track of the current token/string position
1117
+ var currentNode = startNode.next, pos = startPos;
1118
+ currentNode !== tokenList.tail;
1119
+ pos += currentNode.value.length, currentNode = currentNode.next
1120
+ ) {
1121
+
1122
+ if (rematch && pos >= rematch.reach) {
1123
+ break;
1124
+ }
1125
+
1126
+ var str = currentNode.value;
1127
+
1128
+ if (tokenList.length > text.length) {
1129
+ // Something went terribly wrong, ABORT, ABORT!
1130
+ return;
1131
+ }
1132
+
1133
+ if (str instanceof Token) {
1134
+ continue;
1135
+ }
1136
+
1137
+ var removeCount = 1; // this is the to parameter of removeBetween
1138
+ var match;
1139
+
1140
+ if (greedy) {
1141
+ match = matchPattern(pattern, pos, text, lookbehind);
1142
+ if (!match || match.index >= text.length) {
1143
+ break;
1144
+ }
1145
+
1146
+ var from = match.index;
1147
+ var to = match.index + match[0].length;
1148
+ var p = pos;
1149
+
1150
+ // find the node that contains the match
1151
+ p += currentNode.value.length;
1152
+ while (from >= p) {
1153
+ currentNode = currentNode.next;
1154
+ p += currentNode.value.length;
1155
+ }
1156
+ // adjust pos (and p)
1157
+ p -= currentNode.value.length;
1158
+ pos = p;
1159
+
1160
+ // the current node is a Token, then the match starts inside another Token, which is invalid
1161
+ if (currentNode.value instanceof Token) {
1162
+ continue;
1163
+ }
1164
+
1165
+ // find the last node which is affected by this match
1166
+ for (
1167
+ var k = currentNode;
1168
+ k !== tokenList.tail && (p < to || typeof k.value === 'string');
1169
+ k = k.next
1170
+ ) {
1171
+ removeCount++;
1172
+ p += k.value.length;
1173
+ }
1174
+ removeCount--;
1175
+
1176
+ // replace with the new match
1177
+ str = text.slice(pos, p);
1178
+ match.index -= pos;
1179
+ } else {
1180
+ match = matchPattern(pattern, 0, str, lookbehind);
1181
+ if (!match) {
1182
+ continue;
1183
+ }
1184
+ }
1185
+
1186
+ // eslint-disable-next-line no-redeclare
1187
+ var from = match.index;
1188
+ var matchStr = match[0];
1189
+ var before = str.slice(0, from);
1190
+ var after = str.slice(from + matchStr.length);
1191
+
1192
+ var reach = pos + str.length;
1193
+ if (rematch && reach > rematch.reach) {
1194
+ rematch.reach = reach;
1195
+ }
1196
+
1197
+ var removeFrom = currentNode.prev;
1198
+
1199
+ if (before) {
1200
+ removeFrom = addAfter(tokenList, removeFrom, before);
1201
+ pos += before.length;
1202
+ }
1203
+
1204
+ removeRange(tokenList, removeFrom, removeCount);
1205
+
1206
+ var wrapped = new Token(token, inside ? _.tokenize(matchStr, inside) : matchStr, alias, matchStr);
1207
+ currentNode = addAfter(tokenList, removeFrom, wrapped);
1208
+
1209
+ if (after) {
1210
+ addAfter(tokenList, currentNode, after);
1211
+ }
1212
+
1213
+ if (removeCount > 1) {
1214
+ // at least one Token object was removed, so we have to do some rematching
1215
+ // this can only happen if the current pattern is greedy
1216
+
1217
+ /** @type {RematchOptions} */
1218
+ var nestedRematch = {
1219
+ cause: token + ',' + j,
1220
+ reach: reach
1221
+ };
1222
+ matchGrammar(text, tokenList, grammar, currentNode.prev, pos, nestedRematch);
1223
+
1224
+ // the reach might have been extended because of the rematching
1225
+ if (rematch && nestedRematch.reach > rematch.reach) {
1226
+ rematch.reach = nestedRematch.reach;
1227
+ }
1228
+ }
1229
+ }
1230
+ }
1231
+ }
1232
+ }
1233
+
1234
+ /**
1235
+ * @typedef LinkedListNode
1236
+ * @property {T} value
1237
+ * @property {LinkedListNode<T> | null} prev The previous node.
1238
+ * @property {LinkedListNode<T> | null} next The next node.
1239
+ * @template T
1240
+ * @private
1241
+ */
1242
+
1243
+ /**
1244
+ * @template T
1245
+ * @private
1246
+ */
1247
+ function LinkedList() {
1248
+ /** @type {LinkedListNode<T>} */
1249
+ var head = { value: null, prev: null, next: null };
1250
+ /** @type {LinkedListNode<T>} */
1251
+ var tail = { value: null, prev: head, next: null };
1252
+ head.next = tail;
1253
+
1254
+ /** @type {LinkedListNode<T>} */
1255
+ this.head = head;
1256
+ /** @type {LinkedListNode<T>} */
1257
+ this.tail = tail;
1258
+ this.length = 0;
1259
+ }
1260
+
1261
+ /**
1262
+ * Adds a new node with the given value to the list.
1263
+ *
1264
+ * @param {LinkedList<T>} list
1265
+ * @param {LinkedListNode<T>} node
1266
+ * @param {T} value
1267
+ * @returns {LinkedListNode<T>} The added node.
1268
+ * @template T
1269
+ */
1270
+ function addAfter(list, node, value) {
1271
+ // assumes that node != list.tail && values.length >= 0
1272
+ var next = node.next;
1273
+
1274
+ var newNode = { value: value, prev: node, next: next };
1275
+ node.next = newNode;
1276
+ next.prev = newNode;
1277
+ list.length++;
1278
+
1279
+ return newNode;
1280
+ }
1281
+ /**
1282
+ * Removes `count` nodes after the given node. The given node will not be removed.
1283
+ *
1284
+ * @param {LinkedList<T>} list
1285
+ * @param {LinkedListNode<T>} node
1286
+ * @param {number} count
1287
+ * @template T
1288
+ */
1289
+ function removeRange(list, node, count) {
1290
+ var next = node.next;
1291
+ for (var i = 0; i < count && next !== list.tail; i++) {
1292
+ next = next.next;
1293
+ }
1294
+ node.next = next;
1295
+ next.prev = node;
1296
+ list.length -= i;
1297
+ }
1298
+ /**
1299
+ * @param {LinkedList<T>} list
1300
+ * @returns {T[]}
1301
+ * @template T
1302
+ */
1303
+ function toArray(list) {
1304
+ var array = [];
1305
+ var node = list.head.next;
1306
+ while (node !== list.tail) {
1307
+ array.push(node.value);
1308
+ node = node.next;
1309
+ }
1310
+ return array;
1311
+ }
1312
+
1313
+
1314
+ if (!_self.document) {
1315
+ if (!_self.addEventListener) {
1316
+ // in Node.js
1317
+ return _;
1318
+ }
1319
+
1320
+ if (!_.disableWorkerMessageHandler) {
1321
+ // In worker
1322
+ _self.addEventListener('message', function (evt) {
1323
+ var message = JSON.parse(evt.data);
1324
+ var lang = message.language;
1325
+ var code = message.code;
1326
+ var immediateClose = message.immediateClose;
1327
+
1328
+ _self.postMessage(_.highlight(code, _.languages[lang], lang));
1329
+ if (immediateClose) {
1330
+ _self.close();
1331
+ }
1332
+ }, false);
1333
+ }
1334
+
1335
+ return _;
1336
+ }
1337
+
1338
+ // Get current script and highlight
1339
+ var script = _.util.currentScript();
1340
+
1341
+ if (script) {
1342
+ _.filename = script.src;
1343
+
1344
+ if (script.hasAttribute('data-manual')) {
1345
+ _.manual = true;
1346
+ }
1347
+ }
1348
+
1349
+ function highlightAutomaticallyCallback() {
1350
+ if (!_.manual) {
1351
+ _.highlightAll();
1352
+ }
1353
+ }
1354
+
1355
+ if (!_.manual) {
1356
+ // If the document state is "loading", then we'll use DOMContentLoaded.
1357
+ // If the document state is "interactive" and the prism.js script is deferred, then we'll also use the
1358
+ // DOMContentLoaded event because there might be some plugins or languages which have also been deferred and they
1359
+ // might take longer one animation frame to execute which can create a race condition where only some plugins have
1360
+ // been loaded when Prism.highlightAll() is executed, depending on how fast resources are loaded.
1361
+ // See https://github.com/PrismJS/prism/issues/2102
1362
+ var readyState = document.readyState;
1363
+ if (readyState === 'loading' || readyState === 'interactive' && script && script.defer) {
1364
+ document.addEventListener('DOMContentLoaded', highlightAutomaticallyCallback);
1365
+ } else {
1366
+ if (window.requestAnimationFrame) {
1367
+ window.requestAnimationFrame(highlightAutomaticallyCallback);
1368
+ } else {
1369
+ window.setTimeout(highlightAutomaticallyCallback, 16);
1370
+ }
1371
+ }
1372
+ }
1373
+
1374
+ return _;
1375
+
1376
+ }(_self));
1377
+
1378
+ if (module.exports) {
1379
+ module.exports = Prism;
1380
+ }
1381
+
1382
+ // hack for components to work correctly in node.js
1383
+ if (typeof commonjsGlobal !== 'undefined') {
1384
+ commonjsGlobal.Prism = Prism;
1385
+ }
1386
+
1387
+ // some additional documentation/types
1388
+
1389
+ /**
1390
+ * The expansion of a simple `RegExp` literal to support additional properties.
1391
+ *
1392
+ * @typedef GrammarToken
1393
+ * @property {RegExp} pattern The regular expression of the token.
1394
+ * @property {boolean} [lookbehind=false] If `true`, then the first capturing group of `pattern` will (effectively)
1395
+ * behave as a lookbehind group meaning that the captured text will not be part of the matched text of the new token.
1396
+ * @property {boolean} [greedy=false] Whether the token is greedy.
1397
+ * @property {string|string[]} [alias] An optional alias or list of aliases.
1398
+ * @property {Grammar} [inside] The nested grammar of this token.
1399
+ *
1400
+ * The `inside` grammar will be used to tokenize the text value of each token of this kind.
1401
+ *
1402
+ * This can be used to make nested and even recursive language definitions.
1403
+ *
1404
+ * Note: This can cause infinite recursion. Be careful when you embed different languages or even the same language into
1405
+ * each another.
1406
+ * @global
1407
+ * @public
1408
+ */
1409
+
1410
+ /**
1411
+ * @typedef Grammar
1412
+ * @type {Object<string, RegExp | GrammarToken | Array<RegExp | GrammarToken>>}
1413
+ * @property {Grammar} [rest] An optional grammar object that will be appended to this grammar.
1414
+ * @global
1415
+ * @public
1416
+ */
1417
+
1418
+ /**
1419
+ * A function which will invoked after an element was successfully highlighted.
1420
+ *
1421
+ * @callback HighlightCallback
1422
+ * @param {Element} element The element successfully highlighted.
1423
+ * @returns {void}
1424
+ * @global
1425
+ * @public
1426
+ */
1427
+
1428
+ /**
1429
+ * @callback HookCallback
1430
+ * @param {Object<string, any>} env The environment variables of the hook.
1431
+ * @returns {void}
1432
+ * @global
1433
+ * @public
1434
+ */
1435
+
1436
+
1437
+ /* **********************************************
1438
+ Begin prism-markup.js
1439
+ ********************************************** */
1440
+
1441
+ Prism.languages.markup = {
1442
+ 'comment': {
1443
+ pattern: /<!--(?:(?!<!--)[\s\S])*?-->/,
1444
+ greedy: true
1445
+ },
1446
+ 'prolog': {
1447
+ pattern: /<\?[\s\S]+?\?>/,
1448
+ greedy: true
1449
+ },
1450
+ 'doctype': {
1451
+ // https://www.w3.org/TR/xml/#NT-doctypedecl
1452
+ pattern: /<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,
1453
+ greedy: true,
1454
+ inside: {
1455
+ 'internal-subset': {
1456
+ pattern: /(^[^\[]*\[)[\s\S]+(?=\]>$)/,
1457
+ lookbehind: true,
1458
+ greedy: true,
1459
+ inside: null // see below
1460
+ },
1461
+ 'string': {
1462
+ pattern: /"[^"]*"|'[^']*'/,
1463
+ greedy: true
1464
+ },
1465
+ 'punctuation': /^<!|>$|[[\]]/,
1466
+ 'doctype-tag': /^DOCTYPE/i,
1467
+ 'name': /[^\s<>'"]+/
1468
+ }
1469
+ },
1470
+ 'cdata': {
1471
+ pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
1472
+ greedy: true
1473
+ },
1474
+ 'tag': {
1475
+ pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,
1476
+ greedy: true,
1477
+ inside: {
1478
+ 'tag': {
1479
+ pattern: /^<\/?[^\s>\/]+/,
1480
+ inside: {
1481
+ 'punctuation': /^<\/?/,
1482
+ 'namespace': /^[^\s>\/:]+:/
1483
+ }
1484
+ },
1485
+ 'special-attr': [],
1486
+ 'attr-value': {
1487
+ pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,
1488
+ inside: {
1489
+ 'punctuation': [
1490
+ {
1491
+ pattern: /^=/,
1492
+ alias: 'attr-equals'
1493
+ },
1494
+ {
1495
+ pattern: /^(\s*)["']|["']$/,
1496
+ lookbehind: true
1497
+ }
1498
+ ]
1499
+ }
1500
+ },
1501
+ 'punctuation': /\/?>/,
1502
+ 'attr-name': {
1503
+ pattern: /[^\s>\/]+/,
1504
+ inside: {
1505
+ 'namespace': /^[^\s>\/:]+:/
1506
+ }
1507
+ }
1508
+
1509
+ }
1510
+ },
1511
+ 'entity': [
1512
+ {
1513
+ pattern: /&[\da-z]{1,8};/i,
1514
+ alias: 'named-entity'
1515
+ },
1516
+ /&#x?[\da-f]{1,8};/i
1517
+ ]
1518
+ };
1519
+
1520
+ Prism.languages.markup['tag'].inside['attr-value'].inside['entity'] =
1521
+ Prism.languages.markup['entity'];
1522
+ Prism.languages.markup['doctype'].inside['internal-subset'].inside = Prism.languages.markup;
1523
+
1524
+ // Plugin to make entity title show the real entity, idea by Roman Komarov
1525
+ Prism.hooks.add('wrap', function (env) {
1526
+
1527
+ if (env.type === 'entity') {
1528
+ env.attributes['title'] = env.content.replace(/&amp;/, '&');
1529
+ }
1530
+ });
1531
+
1532
+ Object.defineProperty(Prism.languages.markup.tag, 'addInlined', {
1533
+ /**
1534
+ * Adds an inlined language to markup.
1535
+ *
1536
+ * An example of an inlined language is CSS with `<style>` tags.
1537
+ *
1538
+ * @param {string} tagName The name of the tag that contains the inlined language. This name will be treated as
1539
+ * case insensitive.
1540
+ * @param {string} lang The language key.
1541
+ * @example
1542
+ * addInlined('style', 'css');
1543
+ */
1544
+ value: function addInlined(tagName, lang) {
1545
+ var includedCdataInside = {};
1546
+ includedCdataInside['language-' + lang] = {
1547
+ pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
1548
+ lookbehind: true,
1549
+ inside: Prism.languages[lang]
1550
+ };
1551
+ includedCdataInside['cdata'] = /^<!\[CDATA\[|\]\]>$/i;
1552
+
1553
+ var inside = {
1554
+ 'included-cdata': {
1555
+ pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
1556
+ inside: includedCdataInside
1557
+ }
1558
+ };
1559
+ inside['language-' + lang] = {
1560
+ pattern: /[\s\S]+/,
1561
+ inside: Prism.languages[lang]
1562
+ };
1563
+
1564
+ var def = {};
1565
+ def[tagName] = {
1566
+ pattern: RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g, function () { return tagName; }), 'i'),
1567
+ lookbehind: true,
1568
+ greedy: true,
1569
+ inside: inside
1570
+ };
1571
+
1572
+ Prism.languages.insertBefore('markup', 'cdata', def);
1573
+ }
1574
+ });
1575
+ Object.defineProperty(Prism.languages.markup.tag, 'addAttribute', {
1576
+ /**
1577
+ * Adds an pattern to highlight languages embedded in HTML attributes.
1578
+ *
1579
+ * An example of an inlined language is CSS with `style` attributes.
1580
+ *
1581
+ * @param {string} attrName The name of the tag that contains the inlined language. This name will be treated as
1582
+ * case insensitive.
1583
+ * @param {string} lang The language key.
1584
+ * @example
1585
+ * addAttribute('style', 'css');
1586
+ */
1587
+ value: function (attrName, lang) {
1588
+ Prism.languages.markup.tag.inside['special-attr'].push({
1589
+ pattern: RegExp(
1590
+ /(^|["'\s])/.source + '(?:' + attrName + ')' + /\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,
1591
+ 'i'
1592
+ ),
1593
+ lookbehind: true,
1594
+ inside: {
1595
+ 'attr-name': /^[^\s=]+/,
1596
+ 'attr-value': {
1597
+ pattern: /=[\s\S]+/,
1598
+ inside: {
1599
+ 'value': {
1600
+ pattern: /(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,
1601
+ lookbehind: true,
1602
+ alias: [lang, 'language-' + lang],
1603
+ inside: Prism.languages[lang]
1604
+ },
1605
+ 'punctuation': [
1606
+ {
1607
+ pattern: /^=/,
1608
+ alias: 'attr-equals'
1609
+ },
1610
+ /"|'/
1611
+ ]
1612
+ }
1613
+ }
1614
+ }
1615
+ });
1616
+ }
1617
+ });
1618
+
1619
+ Prism.languages.html = Prism.languages.markup;
1620
+ Prism.languages.mathml = Prism.languages.markup;
1621
+ Prism.languages.svg = Prism.languages.markup;
1622
+
1623
+ Prism.languages.xml = Prism.languages.extend('markup', {});
1624
+ Prism.languages.ssml = Prism.languages.xml;
1625
+ Prism.languages.atom = Prism.languages.xml;
1626
+ Prism.languages.rss = Prism.languages.xml;
1627
+
1628
+
1629
+ /* **********************************************
1630
+ Begin prism-css.js
1631
+ ********************************************** */
1632
+
1633
+ (function (Prism) {
1634
+
1635
+ var string = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
1636
+
1637
+ Prism.languages.css = {
1638
+ 'comment': /\/\*[\s\S]*?\*\//,
1639
+ 'atrule': {
1640
+ pattern: RegExp('@[\\w-](?:' + /[^;{\s"']|\s+(?!\s)/.source + '|' + string.source + ')*?' + /(?:;|(?=\s*\{))/.source),
1641
+ inside: {
1642
+ 'rule': /^@[\w-]+/,
1643
+ 'selector-function-argument': {
1644
+ pattern: /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,
1645
+ lookbehind: true,
1646
+ alias: 'selector'
1647
+ },
1648
+ 'keyword': {
1649
+ pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/,
1650
+ lookbehind: true
1651
+ }
1652
+ // See rest below
1653
+ }
1654
+ },
1655
+ 'url': {
1656
+ // https://drafts.csswg.org/css-values-3/#urls
1657
+ pattern: RegExp('\\burl\\((?:' + string.source + '|' + /(?:[^\\\r\n()"']|\\[\s\S])*/.source + ')\\)', 'i'),
1658
+ greedy: true,
1659
+ inside: {
1660
+ 'function': /^url/i,
1661
+ 'punctuation': /^\(|\)$/,
1662
+ 'string': {
1663
+ pattern: RegExp('^' + string.source + '$'),
1664
+ alias: 'url'
1665
+ }
1666
+ }
1667
+ },
1668
+ 'selector': {
1669
+ pattern: RegExp('(^|[{}\\s])[^{}\\s](?:[^{};"\'\\s]|\\s+(?![\\s{])|' + string.source + ')*(?=\\s*\\{)'),
1670
+ lookbehind: true
1671
+ },
1672
+ 'string': {
1673
+ pattern: string,
1674
+ greedy: true
1675
+ },
1676
+ 'property': {
1677
+ pattern: /(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,
1678
+ lookbehind: true
1679
+ },
1680
+ 'important': /!important\b/i,
1681
+ 'function': {
1682
+ pattern: /(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,
1683
+ lookbehind: true
1684
+ },
1685
+ 'punctuation': /[(){};:,]/
1686
+ };
1687
+
1688
+ Prism.languages.css['atrule'].inside.rest = Prism.languages.css;
1689
+
1690
+ var markup = Prism.languages.markup;
1691
+ if (markup) {
1692
+ markup.tag.addInlined('style', 'css');
1693
+ markup.tag.addAttribute('style', 'css');
1694
+ }
1695
+
1696
+ }(Prism));
1697
+
1698
+
1699
+ /* **********************************************
1700
+ Begin prism-clike.js
1701
+ ********************************************** */
1702
+
1703
+ Prism.languages.clike = {
1704
+ 'comment': [
1705
+ {
1706
+ pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
1707
+ lookbehind: true,
1708
+ greedy: true
1709
+ },
1710
+ {
1711
+ pattern: /(^|[^\\:])\/\/.*/,
1712
+ lookbehind: true,
1713
+ greedy: true
1714
+ }
1715
+ ],
1716
+ 'string': {
1717
+ pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
1718
+ greedy: true
1719
+ },
1720
+ 'class-name': {
1721
+ pattern: /(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,
1722
+ lookbehind: true,
1723
+ inside: {
1724
+ 'punctuation': /[.\\]/
1725
+ }
1726
+ },
1727
+ 'keyword': /\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,
1728
+ 'boolean': /\b(?:false|true)\b/,
1729
+ 'function': /\b\w+(?=\()/,
1730
+ 'number': /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
1731
+ 'operator': /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
1732
+ 'punctuation': /[{}[\];(),.:]/
1733
+ };
1734
+
1735
+
1736
+ /* **********************************************
1737
+ Begin prism-javascript.js
1738
+ ********************************************** */
1739
+
1740
+ Prism.languages.javascript = Prism.languages.extend('clike', {
1741
+ 'class-name': [
1742
+ Prism.languages.clike['class-name'],
1743
+ {
1744
+ pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,
1745
+ lookbehind: true
1746
+ }
1747
+ ],
1748
+ 'keyword': [
1749
+ {
1750
+ pattern: /((?:^|\})\s*)catch\b/,
1751
+ lookbehind: true
1752
+ },
1753
+ {
1754
+ 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/,
1755
+ lookbehind: true
1756
+ },
1757
+ ],
1758
+ // Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
1759
+ 'function': /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,
1760
+ 'number': {
1761
+ pattern: RegExp(
1762
+ /(^|[^\w$])/.source +
1763
+ '(?:' +
1764
+ (
1765
+ // constant
1766
+ /NaN|Infinity/.source +
1767
+ '|' +
1768
+ // binary integer
1769
+ /0[bB][01]+(?:_[01]+)*n?/.source +
1770
+ '|' +
1771
+ // octal integer
1772
+ /0[oO][0-7]+(?:_[0-7]+)*n?/.source +
1773
+ '|' +
1774
+ // hexadecimal integer
1775
+ /0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source +
1776
+ '|' +
1777
+ // decimal bigint
1778
+ /\d+(?:_\d+)*n/.source +
1779
+ '|' +
1780
+ // decimal number (integer or float) but no bigint
1781
+ /(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source
1782
+ ) +
1783
+ ')' +
1784
+ /(?![\w$])/.source
1785
+ ),
1786
+ lookbehind: true
1787
+ },
1788
+ 'operator': /--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/
1789
+ });
1790
+
1791
+ Prism.languages.javascript['class-name'][0].pattern = /(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;
1792
+
1793
+ Prism.languages.insertBefore('javascript', 'keyword', {
1794
+ 'regex': {
1795
+ pattern: RegExp(
1796
+ // lookbehind
1797
+ // eslint-disable-next-line regexp/no-dupe-characters-character-class
1798
+ /((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source +
1799
+ // Regex pattern:
1800
+ // There are 2 regex patterns here. The RegExp set notation proposal added support for nested character
1801
+ // classes if the `v` flag is present. Unfortunately, nested CCs are both context-free and incompatible
1802
+ // with the only syntax, so we have to define 2 different regex patterns.
1803
+ /\//.source +
1804
+ '(?:' +
1805
+ /(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source +
1806
+ '|' +
1807
+ // `v` flag syntax. This supports 3 levels of nested character classes.
1808
+ /(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source +
1809
+ ')' +
1810
+ // lookahead
1811
+ /(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source
1812
+ ),
1813
+ lookbehind: true,
1814
+ greedy: true,
1815
+ inside: {
1816
+ 'regex-source': {
1817
+ pattern: /^(\/)[\s\S]+(?=\/[a-z]*$)/,
1818
+ lookbehind: true,
1819
+ alias: 'language-regex',
1820
+ inside: Prism.languages.regex
1821
+ },
1822
+ 'regex-delimiter': /^\/|\/$/,
1823
+ 'regex-flags': /^[a-z]+$/,
1824
+ }
1825
+ },
1826
+ // This must be declared before keyword because we use "function" inside the look-forward
1827
+ 'function-variable': {
1828
+ 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*=>))/,
1829
+ alias: 'function'
1830
+ },
1831
+ 'parameter': [
1832
+ {
1833
+ pattern: /(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,
1834
+ lookbehind: true,
1835
+ inside: Prism.languages.javascript
1836
+ },
1837
+ {
1838
+ pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,
1839
+ lookbehind: true,
1840
+ inside: Prism.languages.javascript
1841
+ },
1842
+ {
1843
+ pattern: /(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,
1844
+ lookbehind: true,
1845
+ inside: Prism.languages.javascript
1846
+ },
1847
+ {
1848
+ 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*\{)/,
1849
+ lookbehind: true,
1850
+ inside: Prism.languages.javascript
1851
+ }
1852
+ ],
1853
+ 'constant': /\b[A-Z](?:[A-Z_]|\dx?)*\b/
1854
+ });
1855
+
1856
+ Prism.languages.insertBefore('javascript', 'string', {
1857
+ 'hashbang': {
1858
+ pattern: /^#!.*/,
1859
+ greedy: true,
1860
+ alias: 'comment'
1861
+ },
1862
+ 'template-string': {
1863
+ pattern: /`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,
1864
+ greedy: true,
1865
+ inside: {
1866
+ 'template-punctuation': {
1867
+ pattern: /^`|`$/,
1868
+ alias: 'string'
1869
+ },
1870
+ 'interpolation': {
1871
+ pattern: /((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,
1872
+ lookbehind: true,
1873
+ inside: {
1874
+ 'interpolation-punctuation': {
1875
+ pattern: /^\$\{|\}$/,
1876
+ alias: 'punctuation'
1877
+ },
1878
+ rest: Prism.languages.javascript
1879
+ }
1880
+ },
1881
+ 'string': /[\s\S]+/
1882
+ }
1883
+ },
1884
+ 'string-property': {
1885
+ pattern: /((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,
1886
+ lookbehind: true,
1887
+ greedy: true,
1888
+ alias: 'property'
1889
+ }
1890
+ });
1891
+
1892
+ Prism.languages.insertBefore('javascript', 'operator', {
1893
+ 'literal-property': {
1894
+ pattern: /((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,
1895
+ lookbehind: true,
1896
+ alias: 'property'
1897
+ },
1898
+ });
1899
+
1900
+ if (Prism.languages.markup) {
1901
+ Prism.languages.markup.tag.addInlined('script', 'javascript');
1902
+
1903
+ // add attribute support for all DOM events.
1904
+ // https://developer.mozilla.org/en-US/docs/Web/Events#Standard_events
1905
+ Prism.languages.markup.tag.addAttribute(
1906
+ /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,
1907
+ 'javascript'
1908
+ );
1909
+ }
1910
+
1911
+ Prism.languages.js = Prism.languages.javascript;
1912
+
1913
+
1914
+ /* **********************************************
1915
+ Begin prism-file-highlight.js
1916
+ ********************************************** */
1917
+
1918
+ (function () {
1919
+
1920
+ if (typeof Prism === 'undefined' || typeof document === 'undefined') {
1921
+ return;
1922
+ }
1923
+
1924
+ // https://developer.mozilla.org/en-US/docs/Web/API/Element/matches#Polyfill
1925
+ if (!Element.prototype.matches) {
1926
+ Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
1927
+ }
1928
+
1929
+ var LOADING_MESSAGE = 'Loading…';
1930
+ var FAILURE_MESSAGE = function (status, message) {
1931
+ return '✖ Error ' + status + ' while fetching file: ' + message;
1932
+ };
1933
+ var FAILURE_EMPTY_MESSAGE = '✖ Error: File does not exist or is empty';
1934
+
1935
+ var EXTENSIONS = {
1936
+ 'js': 'javascript',
1937
+ 'py': 'python',
1938
+ 'rb': 'ruby',
1939
+ 'ps1': 'powershell',
1940
+ 'psm1': 'powershell',
1941
+ 'sh': 'bash',
1942
+ 'bat': 'batch',
1943
+ 'h': 'c',
1944
+ 'tex': 'latex'
1945
+ };
1946
+
1947
+ var STATUS_ATTR = 'data-src-status';
1948
+ var STATUS_LOADING = 'loading';
1949
+ var STATUS_LOADED = 'loaded';
1950
+ var STATUS_FAILED = 'failed';
1951
+
1952
+ var SELECTOR = 'pre[data-src]:not([' + STATUS_ATTR + '="' + STATUS_LOADED + '"])'
1953
+ + ':not([' + STATUS_ATTR + '="' + STATUS_LOADING + '"])';
1954
+
1955
+ /**
1956
+ * Loads the given file.
1957
+ *
1958
+ * @param {string} src The URL or path of the source file to load.
1959
+ * @param {(result: string) => void} success
1960
+ * @param {(reason: string) => void} error
1961
+ */
1962
+ function loadFile(src, success, error) {
1963
+ var xhr = new XMLHttpRequest();
1964
+ xhr.open('GET', src, true);
1965
+ xhr.onreadystatechange = function () {
1966
+ if (xhr.readyState == 4) {
1967
+ if (xhr.status < 400 && xhr.responseText) {
1968
+ success(xhr.responseText);
1969
+ } else {
1970
+ if (xhr.status >= 400) {
1971
+ error(FAILURE_MESSAGE(xhr.status, xhr.statusText));
1972
+ } else {
1973
+ error(FAILURE_EMPTY_MESSAGE);
1974
+ }
1975
+ }
1976
+ }
1977
+ };
1978
+ xhr.send(null);
1979
+ }
1980
+
1981
+ /**
1982
+ * Parses the given range.
1983
+ *
1984
+ * This returns a range with inclusive ends.
1985
+ *
1986
+ * @param {string | null | undefined} range
1987
+ * @returns {[number, number | undefined] | undefined}
1988
+ */
1989
+ function parseRange(range) {
1990
+ var m = /^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(range || '');
1991
+ if (m) {
1992
+ var start = Number(m[1]);
1993
+ var comma = m[2];
1994
+ var end = m[3];
1995
+
1996
+ if (!comma) {
1997
+ return [start, start];
1998
+ }
1999
+ if (!end) {
2000
+ return [start, undefined];
2001
+ }
2002
+ return [start, Number(end)];
2003
+ }
2004
+ return undefined;
2005
+ }
2006
+
2007
+ Prism.hooks.add('before-highlightall', function (env) {
2008
+ env.selector += ', ' + SELECTOR;
2009
+ });
2010
+
2011
+ Prism.hooks.add('before-sanity-check', function (env) {
2012
+ var pre = /** @type {HTMLPreElement} */ (env.element);
2013
+ if (pre.matches(SELECTOR)) {
2014
+ env.code = ''; // fast-path the whole thing and go to complete
2015
+
2016
+ pre.setAttribute(STATUS_ATTR, STATUS_LOADING); // mark as loading
2017
+
2018
+ // add code element with loading message
2019
+ var code = pre.appendChild(document.createElement('CODE'));
2020
+ code.textContent = LOADING_MESSAGE;
2021
+
2022
+ var src = pre.getAttribute('data-src');
2023
+
2024
+ var language = env.language;
2025
+ if (language === 'none') {
2026
+ // the language might be 'none' because there is no language set;
2027
+ // in this case, we want to use the extension as the language
2028
+ var extension = (/\.(\w+)$/.exec(src) || [, 'none'])[1];
2029
+ language = EXTENSIONS[extension] || extension;
2030
+ }
2031
+
2032
+ // set language classes
2033
+ Prism.util.setLanguage(code, language);
2034
+ Prism.util.setLanguage(pre, language);
2035
+
2036
+ // preload the language
2037
+ var autoloader = Prism.plugins.autoloader;
2038
+ if (autoloader) {
2039
+ autoloader.loadLanguages(language);
2040
+ }
2041
+
2042
+ // load file
2043
+ loadFile(
2044
+ src,
2045
+ function (text) {
2046
+ // mark as loaded
2047
+ pre.setAttribute(STATUS_ATTR, STATUS_LOADED);
2048
+
2049
+ // handle data-range
2050
+ var range = parseRange(pre.getAttribute('data-range'));
2051
+ if (range) {
2052
+ var lines = text.split(/\r\n?|\n/g);
2053
+
2054
+ // the range is one-based and inclusive on both ends
2055
+ var start = range[0];
2056
+ var end = range[1] == null ? lines.length : range[1];
2057
+
2058
+ if (start < 0) { start += lines.length; }
2059
+ start = Math.max(0, Math.min(start - 1, lines.length));
2060
+ if (end < 0) { end += lines.length; }
2061
+ end = Math.max(0, Math.min(end, lines.length));
2062
+
2063
+ text = lines.slice(start, end).join('\n');
2064
+
2065
+ // add data-start for line numbers
2066
+ if (!pre.hasAttribute('data-start')) {
2067
+ pre.setAttribute('data-start', String(start + 1));
2068
+ }
2069
+ }
2070
+
2071
+ // highlight code
2072
+ code.textContent = text;
2073
+ Prism.highlightElement(code);
2074
+ },
2075
+ function (error) {
2076
+ // mark as failed
2077
+ pre.setAttribute(STATUS_ATTR, STATUS_FAILED);
2078
+
2079
+ code.textContent = error;
2080
+ }
2081
+ );
2082
+ }
2083
+ });
2084
+
2085
+ Prism.plugins.fileHighlight = {
2086
+ /**
2087
+ * Executes the File Highlight plugin for all matching `pre` elements under the given container.
2088
+ *
2089
+ * Note: Elements which are already loaded or currently loading will not be touched by this method.
2090
+ *
2091
+ * @param {ParentNode} [container=document]
2092
+ */
2093
+ highlight: function highlight(container) {
2094
+ var elements = (container || document).querySelectorAll(SELECTOR);
2095
+
2096
+ for (var i = 0, element; (element = elements[i++]);) {
2097
+ Prism.highlightElement(element);
2098
+ }
2099
+ }
2100
+ };
2101
+
2102
+ var logged = false;
2103
+ /** @deprecated Use `Prism.plugins.fileHighlight.highlight` instead. */
2104
+ Prism.fileHighlight = function () {
2105
+ if (!logged) {
2106
+ console.warn('Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead.');
2107
+ logged = true;
2108
+ }
2109
+ Prism.plugins.fileHighlight.highlight.apply(this, arguments);
2110
+ };
2111
+
2112
+ }());
2113
+ } (prism));
2114
+
2115
+ var Prism = prism.exports;
2116
+
2117
+ var css = "code[class*=language-],pre[class*=language-]{word-wrap:normal;background:none;color:#ccc;font-family:Consolas,Monaco,Andale Mono,Ubuntu Mono,monospace;font-size:1em;-webkit-hyphens:none;hyphens:none;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;text-align:left;white-space:pre;word-break:normal;word-spacing:normal}pre[class*=language-]{margin:.5em 0;overflow:auto;padding:1em}:not(pre)>code[class*=language-],pre[class*=language-]{background:#2d2d2d}:not(pre)>code[class*=language-]{border-radius:.3em;padding:.1em;white-space:normal}.token.block-comment,.token.cdata,.token.comment,.token.doctype,.token.prolog{color:#999}.token.punctuation{color:#ccc}.token.attr-name,.token.deleted,.token.namespace,.token.tag{color:#e2777a}.token.function-name{color:#6196cc}.token.boolean,.token.function,.token.number{color:#f08d49}.token.class-name,.token.constant,.token.property,.token.symbol{color:#f8c555}.token.atrule,.token.builtin,.token.important,.token.keyword,.token.selector{color:#cc99cd}.token.attr-value,.token.char,.token.regex,.token.string,.token.variable{color:#7ec699}.token.entity,.token.operator,.token.url{color:#67cdcc}.token.bold,.token.important{font-weight:700}.token.italic{font-style:italic}.token.entity{cursor:help}.token.inserted{color:green}";
2118
+ n(css,{});
2119
+
166
2120
  var SyntaxHighlighter = function SyntaxHighlighter(_ref) {
167
2121
  var className = _ref.className,
168
2122
  code = _ref.code,