workflow-editor 0.9.83-dwtmp1 → 0.9.84-dw-tmp1

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