2 * TinyMCE version 6.6.2 (2023-08-09)
8 var global$2 = tinymce.util.Tools.resolve('tinymce.PluginManager');
10 const isNullable = a => a === null || a === undefined;
11 const isNonNullable = a => !isNullable(a);
15 const constant = value => {
22 constructor(tag, value) {
27 return new Optional(true, value);
30 return Optional.singletonNone;
32 fold(onNone, onSome) {
34 return onSome(this.value);
47 return Optional.some(mapper(this.value));
49 return Optional.none();
54 return binder(this.value);
56 return Optional.none();
60 return this.tag && predicate(this.value);
63 return !this.tag || predicate(this.value);
66 if (!this.tag || predicate(this.value)) {
69 return Optional.none();
73 return this.tag ? this.value : replacement;
76 return this.tag ? this : replacement;
79 return this.tag ? this.value : thunk();
82 return this.tag ? this : thunk();
86 throw new Error(message !== null && message !== void 0 ? message : 'Called getOrDie on None');
92 return isNonNullable(value) ? Optional.some(value) : Optional.none();
95 return this.tag ? this.value : null;
106 return this.tag ? [this.value] : [];
109 return this.tag ? `some(${ this.value })` : 'none()';
112 Optional.singletonNone = new Optional(false);
114 const get$1 = (xs, i) => i >= 0 && i < xs.length ? Optional.some(xs[i]) : Optional.none();
115 const head = xs => get$1(xs, 0);
117 var global$1 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');
119 const Global = typeof window !== 'undefined' ? window : Function('return this;')();
121 const prismjs = function (global, module, exports) {
122 const oldprism = window.Prism;
123 window.Prism = { manual: true };
124 var _self = typeof window !== 'undefined' ? window : typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope ? self : {};
125 var Prism = function (_self) {
126 var lang = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i;
128 var plainTextGrammar = {};
130 manual: _self.Prism && _self.Prism.manual,
131 disableWorkerMessageHandler: _self.Prism && _self.Prism.disableWorkerMessageHandler,
133 encode: function encode(tokens) {
134 if (tokens instanceof Token) {
135 return new Token(tokens.type, encode(tokens.content), tokens.alias);
136 } else if (Array.isArray(tokens)) {
137 return tokens.map(encode);
139 return tokens.replace(/&/g, '&').replace(/</g, '<').replace(/\u00a0/g, ' ');
143 return Object.prototype.toString.call(o).slice(8, -1);
145 objId: function (obj) {
147 Object.defineProperty(obj, '__id', { value: ++uniqueId });
151 clone: function deepClone(o, visited) {
152 visited = visited || {};
155 switch (_.util.type(o)) {
157 id = _.util.objId(o);
164 if (o.hasOwnProperty(key)) {
165 clone[key] = deepClone(o[key], visited);
170 id = _.util.objId(o);
176 o.forEach(function (v, i) {
177 clone[i] = deepClone(v, visited);
184 getLanguage: function (element) {
186 var m = lang.exec(element.className);
188 return m[1].toLowerCase();
190 element = element.parentElement;
194 setLanguage: function (element, language) {
195 element.className = element.className.replace(RegExp(lang, 'gi'), '');
196 element.classList.add('language-' + language);
198 currentScript: function () {
199 if (typeof document === 'undefined') {
202 if ('currentScript' in document && 1 < 2) {
203 return document.currentScript;
208 var src = (/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(err.stack) || [])[1];
210 var scripts = document.getElementsByTagName('script');
211 for (var i in scripts) {
212 if (scripts[i].src == src) {
220 isActive: function (element, className, defaultActivation) {
221 var no = 'no-' + className;
223 var classList = element.classList;
224 if (classList.contains(className)) {
227 if (classList.contains(no)) {
230 element = element.parentElement;
232 return !!defaultActivation;
236 plain: plainTextGrammar,
237 plaintext: plainTextGrammar,
238 text: plainTextGrammar,
239 txt: plainTextGrammar,
240 extend: function (id, redef) {
241 var lang = _.util.clone(_.languages[id]);
242 for (var key in redef) {
243 lang[key] = redef[key];
247 insertBefore: function (inside, before, insert, root) {
248 root = root || _.languages;
249 var grammar = root[inside];
251 for (var token in grammar) {
252 if (grammar.hasOwnProperty(token)) {
253 if (token == before) {
254 for (var newToken in insert) {
255 if (insert.hasOwnProperty(newToken)) {
256 ret[newToken] = insert[newToken];
260 if (!insert.hasOwnProperty(token)) {
261 ret[token] = grammar[token];
265 var old = root[inside];
267 _.languages.DFS(_.languages, function (key, value) {
268 if (value === old && key != inside) {
274 DFS: function DFS(o, callback, type, visited) {
275 visited = visited || {};
276 var objId = _.util.objId;
278 if (o.hasOwnProperty(i)) {
279 callback.call(o, i, o[i], type || i);
281 var propertyType = _.util.type(property);
282 if (propertyType === 'Object' && !visited[objId(property)]) {
283 visited[objId(property)] = true;
284 DFS(property, callback, null, visited);
285 } else if (propertyType === 'Array' && !visited[objId(property)]) {
286 visited[objId(property)] = true;
287 DFS(property, callback, i, visited);
294 highlightAll: function (async, callback) {
295 _.highlightAllUnder(document, async, callback);
297 highlightAllUnder: function (container, async, callback) {
300 container: container,
301 selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
303 _.hooks.run('before-highlightall', env);
304 env.elements = Array.prototype.slice.apply(env.container.querySelectorAll(env.selector));
305 _.hooks.run('before-all-elements-highlight', env);
306 for (var i = 0, element; element = env.elements[i++];) {
307 _.highlightElement(element, async === true, env.callback);
310 highlightElement: function (element, async, callback) {
311 var language = _.util.getLanguage(element);
312 var grammar = _.languages[language];
313 _.util.setLanguage(element, language);
314 var parent = element.parentElement;
315 if (parent && parent.nodeName.toLowerCase() === 'pre') {
316 _.util.setLanguage(parent, language);
318 var code = element.textContent;
325 function insertHighlightedCode(highlightedCode) {
326 env.highlightedCode = highlightedCode;
327 _.hooks.run('before-insert', env);
328 env.element.innerHTML = env.highlightedCode;
329 _.hooks.run('after-highlight', env);
330 _.hooks.run('complete', env);
331 callback && callback.call(env.element);
333 _.hooks.run('before-sanity-check', env);
334 parent = env.element.parentElement;
335 if (parent && parent.nodeName.toLowerCase() === 'pre' && !parent.hasAttribute('tabindex')) {
336 parent.setAttribute('tabindex', '0');
339 _.hooks.run('complete', env);
340 callback && callback.call(env.element);
343 _.hooks.run('before-highlight', env);
345 insertHighlightedCode(_.util.encode(env.code));
348 if (async && _self.Worker) {
349 var worker = new Worker(_.filename);
350 worker.onmessage = function (evt) {
351 insertHighlightedCode(evt.data);
353 worker.postMessage(JSON.stringify({
354 language: env.language,
359 insertHighlightedCode(_.highlight(env.code, env.grammar, env.language));
362 highlight: function (text, grammar, language) {
368 _.hooks.run('before-tokenize', env);
370 throw new Error('The language "' + env.language + '" has no grammar.');
372 env.tokens = _.tokenize(env.code, env.grammar);
373 _.hooks.run('after-tokenize', env);
374 return Token.stringify(_.util.encode(env.tokens), env.language);
376 tokenize: function (text, grammar) {
377 var rest = grammar.rest;
379 for (var token in rest) {
380 grammar[token] = rest[token];
384 var tokenList = new LinkedList();
385 addAfter(tokenList, tokenList.head, text);
386 matchGrammar(text, tokenList, grammar, tokenList.head, 0);
387 return toArray(tokenList);
391 add: function (name, callback) {
392 var hooks = _.hooks.all;
393 hooks[name] = hooks[name] || [];
394 hooks[name].push(callback);
396 run: function (name, env) {
397 var callbacks = _.hooks.all[name];
398 if (!callbacks || !callbacks.length) {
401 for (var i = 0, callback; callback = callbacks[i++];) {
409 function Token(type, content, alias, matchedStr) {
411 this.content = content;
413 this.length = (matchedStr || '').length | 0;
415 Token.stringify = function stringify(o, language) {
416 if (typeof o == 'string') {
419 if (Array.isArray(o)) {
421 o.forEach(function (e) {
422 s += stringify(e, language);
428 content: stringify(o.content, language),
437 var aliases = o.alias;
439 if (Array.isArray(aliases)) {
440 Array.prototype.push.apply(env.classes, aliases);
442 env.classes.push(aliases);
445 _.hooks.run('wrap', env);
447 for (var name in env.attributes) {
448 attributes += ' ' + name + '="' + (env.attributes[name] || '').replace(/"/g, '"') + '"';
450 return '<' + env.tag + ' class="' + env.classes.join(' ') + '"' + attributes + '>' + env.content + '</' + env.tag + '>';
452 function matchPattern(pattern, pos, text, lookbehind) {
453 pattern.lastIndex = pos;
454 var match = pattern.exec(text);
455 if (match && lookbehind && match[1]) {
456 var lookbehindLength = match[1].length;
457 match.index += lookbehindLength;
458 match[0] = match[0].slice(lookbehindLength);
462 function matchGrammar(text, tokenList, grammar, startNode, startPos, rematch) {
463 for (var token in grammar) {
464 if (!grammar.hasOwnProperty(token) || !grammar[token]) {
467 var patterns = grammar[token];
468 patterns = Array.isArray(patterns) ? patterns : [patterns];
469 for (var j = 0; j < patterns.length; ++j) {
470 if (rematch && rematch.cause == token + ',' + j) {
473 var patternObj = patterns[j];
474 var inside = patternObj.inside;
475 var lookbehind = !!patternObj.lookbehind;
476 var greedy = !!patternObj.greedy;
477 var alias = patternObj.alias;
478 if (greedy && !patternObj.pattern.global) {
479 var flags = patternObj.pattern.toString().match(/[imsuy]*$/)[0];
480 patternObj.pattern = RegExp(patternObj.pattern.source, flags + 'g');
482 var pattern = patternObj.pattern || patternObj;
483 for (var currentNode = startNode.next, pos = startPos; currentNode !== tokenList.tail; pos += currentNode.value.length, currentNode = currentNode.next) {
484 if (rematch && pos >= rematch.reach) {
487 var str = currentNode.value;
488 if (tokenList.length > text.length) {
491 if (str instanceof Token) {
497 match = matchPattern(pattern, pos, text, lookbehind);
498 if (!match || match.index >= text.length) {
501 var from = match.index;
502 var to = match.index + match[0].length;
504 p += currentNode.value.length;
506 currentNode = currentNode.next;
507 p += currentNode.value.length;
509 p -= currentNode.value.length;
511 if (currentNode.value instanceof Token) {
514 for (var k = currentNode; k !== tokenList.tail && (p < to || typeof k.value === 'string'); k = k.next) {
519 str = text.slice(pos, p);
522 match = matchPattern(pattern, 0, str, lookbehind);
527 var from = match.index;
528 var matchStr = match[0];
529 var before = str.slice(0, from);
530 var after = str.slice(from + matchStr.length);
531 var reach = pos + str.length;
532 if (rematch && reach > rematch.reach) {
533 rematch.reach = reach;
535 var removeFrom = currentNode.prev;
537 removeFrom = addAfter(tokenList, removeFrom, before);
538 pos += before.length;
540 removeRange(tokenList, removeFrom, removeCount);
541 var wrapped = new Token(token, inside ? _.tokenize(matchStr, inside) : matchStr, alias, matchStr);
542 currentNode = addAfter(tokenList, removeFrom, wrapped);
544 addAfter(tokenList, currentNode, after);
546 if (removeCount > 1) {
547 var nestedRematch = {
548 cause: token + ',' + j,
551 matchGrammar(text, tokenList, grammar, currentNode.prev, pos, nestedRematch);
552 if (rematch && nestedRematch.reach > rematch.reach) {
553 rematch.reach = nestedRematch.reach;
560 function LinkedList() {
576 function addAfter(list, node, value) {
577 var next = node.next;
588 function removeRange(list, node, count) {
589 var next = node.next;
590 for (var i = 0; i < count && next !== list.tail; i++) {
597 function toArray(list) {
599 var node = list.head.next;
600 while (node !== list.tail) {
601 array.push(node.value);
606 if (!_self.document) {
607 if (!_self.addEventListener) {
610 if (!_.disableWorkerMessageHandler) {
611 _self.addEventListener('message', function (evt) {
612 var message = JSON.parse(evt.data);
613 var lang = message.language;
614 var code = message.code;
615 var immediateClose = message.immediateClose;
616 _self.postMessage(_.highlight(code, _.languages[lang], lang));
617 if (immediateClose) {
624 var script = _.util.currentScript();
626 _.filename = script.src;
627 if (script.hasAttribute('data-manual')) {
631 function highlightAutomaticallyCallback() {
637 var readyState = document.readyState;
638 if (readyState === 'loading' || readyState === 'interactive' && script && script.defer) {
639 document.addEventListener('DOMContentLoaded', highlightAutomaticallyCallback);
641 if (window.requestAnimationFrame) {
642 window.requestAnimationFrame(highlightAutomaticallyCallback);
644 window.setTimeout(highlightAutomaticallyCallback, 16);
650 if (typeof module !== 'undefined' && module.exports) {
651 module.exports = Prism;
653 if (typeof global !== 'undefined') {
654 global.Prism = Prism;
656 Prism.languages.clike = {
659 pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
664 pattern: /(^|[^\\:])\/\/.*/,
670 pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
674 pattern: /(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,
676 inside: { 'punctuation': /[.\\]/ }
678 'keyword': /\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,
679 'boolean': /\b(?:false|true)\b/,
680 'function': /\b\w+(?=\()/,
681 'number': /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
682 'operator': /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
683 'punctuation': /[{}[\];(),.:]/
686 function getPlaceholder(language, index) {
687 return '___' + language.toUpperCase() + index + '___';
689 Object.defineProperties(Prism.languages['markup-templating'] = {}, {
691 value: function (env, language, placeholderPattern, replaceFilter) {
692 if (env.language !== language) {
695 var tokenStack = env.tokenStack = [];
696 env.code = env.code.replace(placeholderPattern, function (match) {
697 if (typeof replaceFilter === 'function' && !replaceFilter(match)) {
700 var i = tokenStack.length;
702 while (env.code.indexOf(placeholder = getPlaceholder(language, i)) !== -1) {
705 tokenStack[i] = match;
708 env.grammar = Prism.languages.markup;
711 tokenizePlaceholders: {
712 value: function (env, language) {
713 if (env.language !== language || !env.tokenStack) {
716 env.grammar = Prism.languages[language];
718 var keys = Object.keys(env.tokenStack);
719 function walkTokens(tokens) {
720 for (var i = 0; i < tokens.length; i++) {
721 if (j >= keys.length) {
724 var token = tokens[i];
725 if (typeof token === 'string' || token.content && typeof token.content === 'string') {
727 var t = env.tokenStack[k];
728 var s = typeof token === 'string' ? token : token.content;
729 var placeholder = getPlaceholder(language, k);
730 var index = s.indexOf(placeholder);
733 var before = s.substring(0, index);
734 var middle = new Prism.Token(language, Prism.tokenize(t, env.grammar), 'language-' + language, t);
735 var after = s.substring(index + placeholder.length);
736 var replacement = [];
738 replacement.push.apply(replacement, walkTokens([before]));
740 replacement.push(middle);
742 replacement.push.apply(replacement, walkTokens([after]));
744 if (typeof token === 'string') {
745 tokens.splice.apply(tokens, [
748 ].concat(replacement));
750 token.content = replacement;
753 } else if (token.content) {
754 walkTokens(token.content);
759 walkTokens(env.tokens);
764 Prism.languages.c = Prism.languages.extend('clike', {
766 pattern: /\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,
770 pattern: /"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,
774 pattern: /(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,
777 'keyword': /\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,
778 'function': /\b[a-z_]\w*(?=\s*\()/i,
779 'number': /(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,
780 'operator': />>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/
782 Prism.languages.insertBefore('c', 'string', {
784 pattern: /'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,
788 Prism.languages.insertBefore('c', 'string', {
790 pattern: /(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,
797 pattern: /^(#\s*include\s*)<[^>]+>/,
800 Prism.languages.c['string']
802 'char': Prism.languages.c['char'],
803 'comment': Prism.languages.c['comment'],
806 pattern: /(^#\s*define\s+)\w+\b(?!\()/i,
810 pattern: /(^#\s*define\s+)\w+\b(?=\()/i,
816 pattern: /^(#\s*)[a-z]+/,
820 'directive-hash': /^#/,
821 'punctuation': /##|\\(?=[\r\n])/,
823 pattern: /\S[\s\S]*/,
824 inside: Prism.languages.c
829 Prism.languages.insertBefore('c', 'function', { 'constant': /\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/ });
830 delete Prism.languages.c['boolean'];
832 var keyword = /\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/;
833 var modName = /\b(?!<keyword>)\w+(?:\s*\.\s*\w+)*\b/.source.replace(/<keyword>/g, function () {
834 return keyword.source;
836 Prism.languages.cpp = Prism.languages.extend('c', {
839 pattern: RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!<keyword>)\w+/.source.replace(/<keyword>/g, function () {
840 return keyword.source;
844 /\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,
845 /\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,
846 /\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/
850 pattern: /(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,
853 'operator': />>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,
854 'boolean': /\b(?:false|true)\b/
856 Prism.languages.insertBefore('cpp', 'string', {
858 pattern: RegExp(/(\b(?:import|module)\s+)/.source + '(?:' + /"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source + '|' + /<mod-name>(?:\s*:\s*<mod-name>)?|:\s*<mod-name>/.source.replace(/<mod-name>/g, function () {
864 'string': /^[<"][\s\S]+/,
870 pattern: /R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,
875 Prism.languages.insertBefore('cpp', 'keyword', {
876 'generic-function': {
877 pattern: /\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,
883 inside: Prism.languages.cpp
888 Prism.languages.insertBefore('cpp', 'operator', {
894 Prism.languages.insertBefore('cpp', 'class-name', {
896 pattern: /(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,
899 inside: Prism.languages.extend('cpp', {})
902 Prism.languages.insertBefore('inside', 'double-colon', { 'class-name': /\b[a-z_]\w*\b(?!\s*::)/i }, Prism.languages.cpp['base-clause']);
905 function replace(pattern, replacements) {
906 return pattern.replace(/<<(\d+)>>/g, function (m, index) {
907 return '(?:' + replacements[+index] + ')';
910 function re(pattern, replacements, flags) {
911 return RegExp(replace(pattern, replacements), flags || '');
913 function nested(pattern, depthLog2) {
914 for (var i = 0; i < depthLog2; i++) {
915 pattern = pattern.replace(/<<self>>/g, function () {
916 return '(?:' + pattern + ')';
919 return pattern.replace(/<<self>>/g, '[^\\s\\S]');
922 type: 'bool byte char decimal double dynamic float int long object sbyte short string uint ulong ushort var void',
923 typeDeclaration: 'class enum interface record struct',
924 contextual: 'add alias and ascending async await by descending from(?=\\s*(?:\\w|$)) get global group into init(?=\\s*;) join let nameof not notnull on or orderby partial remove select set unmanaged value when where with(?=\\s*{)',
925 other: 'abstract as base break case catch checked const continue default delegate do else event explicit extern finally fixed for foreach goto if implicit in internal is lock namespace new null operator out override params private protected public readonly ref return sealed sizeof stackalloc static switch this throw try typeof unchecked unsafe using virtual volatile while yield'
927 function keywordsToPattern(words) {
928 return '\\b(?:' + words.trim().replace(/ /g, '|') + ')\\b';
930 var typeDeclarationKeywords = keywordsToPattern(keywordKinds.typeDeclaration);
931 var keywords = RegExp(keywordsToPattern(keywordKinds.type + ' ' + keywordKinds.typeDeclaration + ' ' + keywordKinds.contextual + ' ' + keywordKinds.other));
932 var nonTypeKeywords = keywordsToPattern(keywordKinds.typeDeclaration + ' ' + keywordKinds.contextual + ' ' + keywordKinds.other);
933 var nonContextualKeywords = keywordsToPattern(keywordKinds.type + ' ' + keywordKinds.typeDeclaration + ' ' + keywordKinds.other);
934 var generic = nested(/<(?:[^<>;=+\-*/%&|^]|<<self>>)*>/.source, 2);
935 var nestedRound = nested(/\((?:[^()]|<<self>>)*\)/.source, 2);
936 var name = /@?\b[A-Za-z_]\w*\b/.source;
937 var genericName = replace(/<<0>>(?:\s*<<1>>)?/.source, [
941 var identifier = replace(/(?!<<0>>)<<1>>(?:\s*\.\s*<<1>>)*/.source, [
945 var array = /\[\s*(?:,\s*)*\]/.source;
946 var typeExpressionWithoutTuple = replace(/<<0>>(?:\s*(?:\?\s*)?<<1>>)*(?:\s*\?)?/.source, [
950 var tupleElement = replace(/[^,()<>[\];=+\-*/%&|^]|<<0>>|<<1>>|<<2>>/.source, [
955 var tuple = replace(/\(<<0>>+(?:,<<0>>+)+\)/.source, [tupleElement]);
956 var typeExpression = replace(/(?:<<0>>|<<1>>)(?:\s*(?:\?\s*)?<<2>>)*(?:\s*\?)?/.source, [
963 'punctuation': /[<>()?,.:[\]]/
965 var character = /'(?:[^\r\n'\\]|\\.|\\[Uux][\da-fA-F]{1,8})'/.source;
966 var regularString = /"(?:\\.|[^\\"\r\n])*"/.source;
967 var verbatimString = /@"(?:""|\\[\s\S]|[^\\"])*"(?!")/.source;
968 Prism.languages.csharp = Prism.languages.extend('clike', {
971 pattern: re(/(^|[^$\\])<<0>>/.source, [verbatimString]),
976 pattern: re(/(^|[^@$\\])<<0>>/.source, [regularString]),
983 pattern: re(/(\busing\s+static\s+)<<0>>(?=\s*;)/.source, [identifier]),
988 pattern: re(/(\busing\s+<<0>>\s*=\s*)<<1>>(?=\s*;)/.source, [
996 pattern: re(/(\busing\s+)<<0>>(?=\s*=)/.source, [name]),
1000 pattern: re(/(\b<<0>>\s+)<<1>>/.source, [
1001 typeDeclarationKeywords,
1008 pattern: re(/(\bcatch\s*\(\s*)<<0>>/.source, [identifier]),
1013 pattern: re(/(\bwhere\s+)<<0>>/.source, [name]),
1017 pattern: re(/(\b(?:is(?:\s+not)?|as)\s+)<<0>>/.source, [typeExpressionWithoutTuple]),
1022 pattern: re(/\b<<0>>(?=\s+(?!<<1>>|with\s*\{)<<2>>(?:\s*[=,;:{)\]]|\s+(?:in|when)\b))/.source, [
1024 nonContextualKeywords,
1030 'keyword': keywords,
1031 'number': /(?:\b0(?:x[\da-f_]*[\da-f]|b[01_]*[01])|(?:\B\.\d+(?:_+\d+)*|\b\d+(?:_+\d+)*(?:\.\d+(?:_+\d+)*)?)(?:e[-+]?\d+(?:_+\d+)*)?)(?:[dflmu]|lu|ul)?\b/i,
1032 'operator': />>=?|<<=?|[-=]>|([-+&|])\1|~|\?\?=?|[-+*/%&|^!=<>]=?/,
1033 'punctuation': /\?\.?|::|[{}[\];(),.:]/
1035 Prism.languages.insertBefore('csharp', 'number', {
1041 Prism.languages.insertBefore('csharp', 'punctuation', {
1042 'named-parameter': {
1043 pattern: re(/([(,]\s*)<<0>>(?=\s*:)/.source, [name]),
1045 alias: 'punctuation'
1048 Prism.languages.insertBefore('csharp', 'class-name', {
1050 pattern: re(/(\b(?:namespace|using)\s+)<<0>>(?:\s*\.\s*<<0>>)*(?=\s*[;{])/.source, [name]),
1052 inside: { 'punctuation': /\./ }
1054 'type-expression': {
1055 pattern: re(/(\b(?:default|sizeof|typeof)\s*\(\s*(?!\s))(?:[^()\s]|\s(?!\s)|<<0>>)*(?=\s*\))/.source, [nestedRound]),
1057 alias: 'class-name',
1061 pattern: re(/<<0>>(?=\s+(?:<<1>>\s*(?:=>|[({]|\.\s*this\s*\[)|this\s*\[))/.source, [
1068 'constructor-invocation': {
1069 pattern: re(/(\bnew\s+)<<0>>(?=\s*[[({])/.source, [typeExpression]),
1075 pattern: re(/<<0>>\s*<<1>>(?=\s*\()/.source, [
1080 'function': re(/^<<0>>/.source, [name]),
1082 pattern: RegExp(generic),
1083 alias: 'class-name',
1089 pattern: re(/\b((?:<<0>>\s+<<1>>|record\s+<<1>>\s*<<5>>|where\s+<<2>>)\s*:\s*)(?:<<3>>|<<4>>|<<1>>\s*<<5>>|<<6>>)(?:\s*,\s*(?:<<3>>|<<4>>|<<6>>))*(?=\s*(?:where|[{;]|=>|$))/.source, [
1090 typeDeclarationKeywords,
1096 /\bnew\s*\(\s*\)/.source
1100 'record-arguments': {
1101 pattern: re(/(^(?!new\s*\()<<0>>\s*)<<1>>/.source, [
1107 inside: Prism.languages.csharp
1109 'keyword': keywords,
1111 pattern: RegExp(typeExpression),
1115 'punctuation': /[,()]/
1119 pattern: /(^[\t ]*)#.*/m,
1124 pattern: /(#)\b(?:define|elif|else|endif|endregion|error|if|line|nullable|pragma|region|undef|warning)\b/,
1131 var regularStringOrCharacter = regularString + '|' + character;
1132 var regularStringCharacterOrComment = replace(/\/(?![*/])|\/\/[^\r\n]*[\r\n]|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>/.source, [regularStringOrCharacter]);
1133 var roundExpression = nested(replace(/[^"'/()]|<<0>>|\(<<self>>*\)/.source, [regularStringCharacterOrComment]), 2);
1134 var attrTarget = /\b(?:assembly|event|field|method|module|param|property|return|type)\b/.source;
1135 var attr = replace(/<<0>>(?:\s*\(<<1>>*\))?/.source, [
1139 Prism.languages.insertBefore('csharp', 'class-name', {
1141 pattern: re(/((?:^|[^\s\w>)?])\s*\[\s*)(?:<<0>>\s*:\s*)?<<1>>(?:\s*,\s*<<1>>)*(?=\s*\])/.source, [
1149 pattern: re(/^<<0>>(?=\s*:)/.source, [attrTarget]),
1152 'attribute-arguments': {
1153 pattern: re(/\(<<0>>*\)/.source, [roundExpression]),
1154 inside: Prism.languages.csharp
1157 pattern: RegExp(identifier),
1158 inside: { 'punctuation': /\./ }
1160 'punctuation': /[:,]/
1164 var formatString = /:[^}\r\n]+/.source;
1165 var mInterpolationRound = nested(replace(/[^"'/()]|<<0>>|\(<<self>>*\)/.source, [regularStringCharacterOrComment]), 2);
1166 var mInterpolation = replace(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source, [
1167 mInterpolationRound,
1170 var sInterpolationRound = nested(replace(/[^"'/()]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>|\(<<self>>*\)/.source, [regularStringOrCharacter]), 2);
1171 var sInterpolation = replace(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source, [
1172 sInterpolationRound,
1175 function createInterpolationInside(interpolation, interpolationRound) {
1178 pattern: re(/((?:^|[^{])(?:\{\{)*)<<0>>/.source, [interpolation]),
1182 pattern: re(/(^\{(?:(?![}:])<<0>>)*)<<1>>(?=\}$)/.source, [
1187 inside: { 'punctuation': /^:/ }
1189 'punctuation': /^\{|\}$/,
1192 alias: 'language-csharp',
1193 inside: Prism.languages.csharp
1200 Prism.languages.insertBefore('csharp', 'string', {
1201 'interpolation-string': [
1203 pattern: re(/(^|[^\\])(?:\$@|@\$)"(?:""|\\[\s\S]|\{\{|<<0>>|[^\\{"])*"/.source, [mInterpolation]),
1206 inside: createInterpolationInside(mInterpolation, mInterpolationRound)
1209 pattern: re(/(^|[^@\\])\$"(?:\\.|\{\{|<<0>>|[^\\"{])*"/.source, [sInterpolation]),
1212 inside: createInterpolationInside(sInterpolation, sInterpolationRound)
1216 pattern: RegExp(character),
1220 Prism.languages.dotnet = Prism.languages.cs = Prism.languages.csharp;
1223 var string = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
1224 Prism.languages.css = {
1225 'comment': /\/\*[\s\S]*?\*\//,
1227 pattern: RegExp('@[\\w-](?:' + /[^;{\s"']|\s+(?!\s)/.source + '|' + string.source + ')*?' + /(?:;|(?=\s*\{))/.source),
1230 'selector-function-argument': {
1231 pattern: /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,
1236 pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/,
1242 pattern: RegExp('\\burl\\((?:' + string.source + '|' + /(?:[^\\\r\n()"']|\\[\s\S])*/.source + ')\\)', 'i'),
1245 'function': /^url/i,
1246 'punctuation': /^\(|\)$/,
1248 pattern: RegExp('^' + string.source + '$'),
1254 pattern: RegExp('(^|[{}\\s])[^{}\\s](?:[^{};"\'\\s]|\\s+(?![\\s{])|' + string.source + ')*(?=\\s*\\{)'),
1262 pattern: /(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,
1265 'important': /!important\b/i,
1267 pattern: /(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,
1270 'punctuation': /[(){};:,]/
1272 Prism.languages.css['atrule'].inside.rest = Prism.languages.css;
1273 var markup = Prism.languages.markup;
1275 markup.tag.addInlined('style', 'css');
1276 markup.tag.addAttribute('style', 'css');
1280 var keywords = /\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/;
1281 var classNamePrefix = /(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source;
1283 pattern: RegExp(/(^|[^\w.])/.source + classNamePrefix + /[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),
1287 pattern: /^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,
1288 inside: { 'punctuation': /\./ }
1293 Prism.languages.java = Prism.languages.extend('clike', {
1295 pattern: /(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,
1302 pattern: RegExp(/(^|[^\w.])/.source + classNamePrefix + /[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),
1304 inside: className.inside
1307 pattern: RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source + classNamePrefix + /[A-Z]\w*\b/.source),
1309 inside: className.inside
1312 'keyword': keywords,
1314 Prism.languages.clike.function,
1316 pattern: /(::\s*)[a-z_]\w*/,
1320 'number': /\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,
1322 pattern: /(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,
1325 'constant': /\b[A-Z][A-Z_\d]+\b/
1327 Prism.languages.insertBefore('java', 'string', {
1328 'triple-quoted-string': {
1329 pattern: /"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,
1334 pattern: /'(?:\\.|[^'\\\r\n]){1,6}'/,
1338 Prism.languages.insertBefore('java', 'class-name', {
1340 pattern: /(^|[^.])@\w+(?:\s*\.\s*\w+)*/,
1342 alias: 'punctuation'
1345 pattern: /<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,
1347 'class-name': className,
1348 'keyword': keywords,
1349 'punctuation': /[<>(),.:]/,
1355 pattern: RegExp(/(\bimport\s+)/.source + classNamePrefix + /(?:[A-Z]\w*|\*)(?=\s*;)/.source),
1358 'namespace': className.inside.namespace,
1359 'punctuation': /\./,
1365 pattern: RegExp(/(\bimport\s+static\s+)/.source + classNamePrefix + /(?:\w+|\*)(?=\s*;)/.source),
1369 'namespace': className.inside.namespace,
1371 'punctuation': /\./,
1378 pattern: RegExp(/(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!<keyword>)[a-z]\w*(?:\.[a-z]\w*)*\.?/.source.replace(/<keyword>/g, function () {
1379 return keywords.source;
1382 inside: { 'punctuation': /\./ }
1386 Prism.languages.javascript = Prism.languages.extend('clike', {
1388 Prism.languages.clike['class-name'],
1390 pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,
1396 pattern: /((?:^|\})\s*)catch\b/,
1400 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/,
1404 'function': /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,
1406 pattern: RegExp(/(^|[^\w$])/.source + '(?:' + (/NaN|Infinity/.source + '|' + /0[bB][01]+(?:_[01]+)*n?/.source + '|' + /0[oO][0-7]+(?:_[0-7]+)*n?/.source + '|' + /0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source + '|' + /\d+(?:_\d+)*n/.source + '|' + /(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source) + ')' + /(?![\w$])/.source),
1409 'operator': /--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/
1411 Prism.languages.javascript['class-name'][0].pattern = /(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;
1412 Prism.languages.insertBefore('javascript', 'keyword', {
1414 pattern: RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source + /\//.source + '(?:' + /(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source + '|' + /(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source + ')' + /(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),
1419 pattern: /^(\/)[\s\S]+(?=\/[a-z]*$)/,
1421 alias: 'language-regex',
1422 inside: Prism.languages.regex
1424 'regex-delimiter': /^\/|\/$/,
1425 'regex-flags': /^[a-z]+$/
1428 'function-variable': {
1429 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*=>))/,
1434 pattern: /(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,
1436 inside: Prism.languages.javascript
1439 pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,
1441 inside: Prism.languages.javascript
1444 pattern: /(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,
1446 inside: Prism.languages.javascript
1449 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*\{)/,
1451 inside: Prism.languages.javascript
1454 'constant': /\b[A-Z](?:[A-Z_]|\dx?)*\b/
1456 Prism.languages.insertBefore('javascript', 'string', {
1462 'template-string': {
1463 pattern: /`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,
1466 'template-punctuation': {
1471 pattern: /((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,
1474 'interpolation-punctuation': {
1475 pattern: /^\$\{|\}$/,
1476 alias: 'punctuation'
1478 rest: Prism.languages.javascript
1484 'string-property': {
1485 pattern: /((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,
1491 Prism.languages.insertBefore('javascript', 'operator', {
1492 'literal-property': {
1493 pattern: /((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,
1498 if (Prism.languages.markup) {
1499 Prism.languages.markup.tag.addInlined('script', 'javascript');
1500 Prism.languages.markup.tag.addAttribute(/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, 'javascript');
1502 Prism.languages.js = Prism.languages.javascript;
1503 Prism.languages.markup = {
1505 pattern: /<!--(?:(?!<!--)[\s\S])*?-->/,
1509 pattern: /<\?[\s\S]+?\?>/,
1513 pattern: /<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,
1516 'internal-subset': {
1517 pattern: /(^[^\[]*\[)[\s\S]+(?=\]>$)/,
1523 pattern: /"[^"]*"|'[^']*'/,
1526 'punctuation': /^<!|>$|[[\]]/,
1527 'doctype-tag': /^DOCTYPE/i,
1528 'name': /[^\s<>'"]+/
1532 pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
1536 pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,
1540 pattern: /^<\/?[^\s>\/]+/,
1542 'punctuation': /^<\/?/,
1543 'namespace': /^[^\s>\/:]+:/
1548 pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,
1553 alias: 'attr-equals'
1556 pattern: /^(\s*)["']|["']$/,
1562 'punctuation': /\/?>/,
1564 pattern: /[^\s>\/]+/,
1565 inside: { 'namespace': /^[^\s>\/:]+:/ }
1571 pattern: /&[\da-z]{1,8};/i,
1572 alias: 'named-entity'
1574 /&#x?[\da-f]{1,8};/i
1577 Prism.languages.markup['tag'].inside['attr-value'].inside['entity'] = Prism.languages.markup['entity'];
1578 Prism.languages.markup['doctype'].inside['internal-subset'].inside = Prism.languages.markup;
1579 Prism.hooks.add('wrap', function (env) {
1580 if (env.type === 'entity') {
1581 env.attributes['title'] = env.content.replace(/&/, '&');
1584 Object.defineProperty(Prism.languages.markup.tag, 'addInlined', {
1585 value: function addInlined(tagName, lang) {
1586 var includedCdataInside = {};
1587 includedCdataInside['language-' + lang] = {
1588 pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
1590 inside: Prism.languages[lang]
1592 includedCdataInside['cdata'] = /^<!\[CDATA\[|\]\]>$/i;
1595 pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
1596 inside: includedCdataInside
1599 inside['language-' + lang] = {
1601 inside: Prism.languages[lang]
1605 pattern: RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g, function () {
1612 Prism.languages.insertBefore('markup', 'cdata', def);
1615 Object.defineProperty(Prism.languages.markup.tag, 'addAttribute', {
1616 value: function (attrName, lang) {
1617 Prism.languages.markup.tag.inside['special-attr'].push({
1618 pattern: RegExp(/(^|["'\s])/.source + '(?:' + attrName + ')' + /\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source, 'i'),
1621 'attr-name': /^[^\s=]+/,
1623 pattern: /=[\s\S]+/,
1626 pattern: /(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,
1632 inside: Prism.languages[lang]
1637 alias: 'attr-equals'
1647 Prism.languages.html = Prism.languages.markup;
1648 Prism.languages.mathml = Prism.languages.markup;
1649 Prism.languages.svg = Prism.languages.markup;
1650 Prism.languages.xml = Prism.languages.extend('markup', {});
1651 Prism.languages.ssml = Prism.languages.xml;
1652 Prism.languages.atom = Prism.languages.xml;
1653 Prism.languages.rss = Prism.languages.xml;
1655 var comment = /\/\*[\s\S]*?\*\/|\/\/.*|#(?!\[).*/;
1658 pattern: /\b(?:false|true)\b/i,
1662 pattern: /(::\s*)\b[a-z_]\w*\b(?!\s*\()/i,
1667 pattern: /(\b(?:case|const)\s+)\b[a-z_]\w*(?=\s*[;=])/i,
1672 /\b[A-Z_][A-Z0-9_]*\b(?!\s*\()/
1674 var number = /\b0b[01]+(?:_[01]+)*\b|\b0o[0-7]+(?:_[0-7]+)*\b|\b0x[\da-f]+(?:_[\da-f]+)*\b|(?:\b\d+(?:_\d+)*\.?(?:\d+(?:_\d+)*)?|\B\.\d+)(?:e[+-]?\d+)?/i;
1675 var operator = /<?=>|\?\?=?|\.{3}|\??->|[!=]=?=?|::|\*\*=?|--|\+\+|&&|\|\||<<|>>|[?~]|[/^|%*&<>.+-]=?/;
1676 var punctuation = /[{}\[\](),:;]/;
1677 Prism.languages.php = {
1679 pattern: /\?>$|^<\?(?:php(?=\s)|=)?/i,
1683 'variable': /\$+(?:\w+\b|(?=\{))/,
1685 pattern: /(namespace\s+|use\s+(?:function\s+)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,
1687 inside: { 'punctuation': /\\/ }
1689 'class-name-definition': {
1690 pattern: /(\b(?:class|enum|interface|trait)\s+)\b[a-z_]\w*(?!\\)\b/i,
1694 'function-definition': {
1695 pattern: /(\bfunction\s+)[a-z_]\w*(?=\s*\()/i,
1701 pattern: /(\(\s*)\b(?:array|bool|boolean|float|int|integer|object|string)\b(?=\s*\))/i,
1702 alias: 'type-casting',
1707 pattern: /([(,?]\s*)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|object|self|static|string)\b(?=\s*\$)/i,
1713 pattern: /(\)\s*:\s*(?:\?\s*)?)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|never|object|self|static|string|void)\b/i,
1714 alias: 'return-type',
1719 pattern: /\b(?:array(?!\s*\()|bool|float|int|iterable|mixed|object|string|void)\b/i,
1720 alias: 'type-declaration',
1724 pattern: /(\|\s*)(?:false|null)\b|\b(?:false|null)(?=\s*\|)/i,
1725 alias: 'type-declaration',
1730 pattern: /\b(?:parent|self|static)(?=\s*::)/i,
1731 alias: 'static-context',
1735 pattern: /(\byield\s+)from\b/i,
1740 pattern: /((?:^|[^\s>:]|(?:^|[^-])>|(?:^|[^:]):)\s*)\b(?:abstract|and|array|as|break|callable|case|catch|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|enum|eval|exit|extends|final|finally|fn|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|match|namespace|never|new|or|parent|print|private|protected|public|readonly|require|require_once|return|self|static|switch|throw|trait|try|unset|use|var|while|xor|yield|__halt_compiler)\b/i,
1745 pattern: /([(,]\s*)\b[a-z_]\w*(?=\s*:(?!:))/i,
1750 pattern: /(\b(?:extends|implements|instanceof|new(?!\s+self|\s+static))\s+|\bcatch\s*\()\b[a-z_]\w*(?!\\)\b/i,
1755 pattern: /(\|\s*)\b[a-z_]\w*(?!\\)\b/i,
1760 pattern: /\b[a-z_]\w*(?!\\)\b(?=\s*\|)/i,
1764 pattern: /(\|\s*)(?:\\?\b[a-z_]\w*)+\b/i,
1765 alias: 'class-name-fully-qualified',
1768 inside: { 'punctuation': /\\/ }
1771 pattern: /(?:\\?\b[a-z_]\w*)+\b(?=\s*\|)/i,
1772 alias: 'class-name-fully-qualified',
1774 inside: { 'punctuation': /\\/ }
1777 pattern: /(\b(?:extends|implements|instanceof|new(?!\s+self\b|\s+static\b))\s+|\bcatch\s*\()(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,
1778 alias: 'class-name-fully-qualified',
1781 inside: { 'punctuation': /\\/ }
1784 pattern: /\b[a-z_]\w*(?=\s*\$)/i,
1785 alias: 'type-declaration',
1789 pattern: /(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,
1791 'class-name-fully-qualified',
1795 inside: { 'punctuation': /\\/ }
1798 pattern: /\b[a-z_]\w*(?=\s*::)/i,
1799 alias: 'static-context',
1803 pattern: /(?:\\?\b[a-z_]\w*)+(?=\s*::)/i,
1805 'class-name-fully-qualified',
1809 inside: { 'punctuation': /\\/ }
1812 pattern: /([(,?]\s*)[a-z_]\w*(?=\s*\$)/i,
1818 pattern: /([(,?]\s*)(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,
1820 'class-name-fully-qualified',
1825 inside: { 'punctuation': /\\/ }
1828 pattern: /(\)\s*:\s*(?:\?\s*)?)\b[a-z_]\w*(?!\\)\b/i,
1829 alias: 'return-type',
1834 pattern: /(\)\s*:\s*(?:\?\s*)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,
1836 'class-name-fully-qualified',
1841 inside: { 'punctuation': /\\/ }
1844 'constant': constant,
1846 pattern: /(^|[^\\\w])\\?[a-z_](?:[\w\\]*\w)?(?=\s*\()/i,
1848 inside: { 'punctuation': /\\/ }
1851 pattern: /(->\s*)\w+/,
1855 'operator': operator,
1856 'punctuation': punctuation
1858 var string_interpolation = {
1859 pattern: /\{\$(?:\{(?:\{[^{}]+\}|[^{}]+)\}|[^{}])+\}|(^|[^\\{])\$+(?:\w+(?:\[[^\r\n\[\]]+\]|->\w+)?)/,
1861 inside: Prism.languages.php
1865 pattern: /<<<'([^']+)'[\r\n](?:.*[\r\n])*?\1;/,
1866 alias: 'nowdoc-string',
1870 pattern: /^<<<'[^']+'|[a-z_]\w*;$/i,
1872 inside: { 'punctuation': /^<<<'?|[';]$/ }
1877 pattern: /<<<(?:"([^"]+)"[\r\n](?:.*[\r\n])*?\1;|([a-z_]\w*)[\r\n](?:.*[\r\n])*?\2;)/i,
1878 alias: 'heredoc-string',
1882 pattern: /^<<<(?:"[^"]+"|[a-z_]\w*)|[a-z_]\w*;$/i,
1884 inside: { 'punctuation': /^<<<"?|[";]$/ }
1886 'interpolation': string_interpolation
1890 pattern: /`(?:\\[\s\S]|[^\\`])*`/,
1891 alias: 'backtick-quoted-string',
1895 pattern: /'(?:\\[\s\S]|[^\\'])*'/,
1896 alias: 'single-quoted-string',
1900 pattern: /"(?:\\[\s\S]|[^\\"])*"/,
1901 alias: 'double-quoted-string',
1903 inside: { 'interpolation': string_interpolation }
1906 Prism.languages.insertBefore('php', 'variable', {
1909 pattern: /#\[(?:[^"'\/#]|\/(?![*/])|\/\/.*$|#(?!\[).*$|\/\*(?:[^*]|\*(?!\/))*\*\/|"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*')+\](?=\s*[a-z$#])/im,
1912 'attribute-content': {
1913 pattern: /^(#\[)[\s\S]+(?=\]$)/,
1918 'attribute-class-name': [
1920 pattern: /([^:]|^)\b[a-z_]\w*(?!\\)\b/i,
1921 alias: 'class-name',
1926 pattern: /([^:]|^)(?:\\?\b[a-z_]\w*)+/i,
1929 'class-name-fully-qualified'
1933 inside: { 'punctuation': /\\/ }
1936 'constant': constant,
1938 'operator': operator,
1939 'punctuation': punctuation
1943 pattern: /^#\[|\]$/,
1944 alias: 'punctuation'
1949 Prism.hooks.add('before-tokenize', function (env) {
1950 if (!/<\?/.test(env.code)) {
1953 var phpPattern = /<\?(?:[^"'/#]|\/(?![*/])|("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|(?:\/\/|#(?!\[))(?:[^?\n\r]|\?(?!>))*(?=$|\?>|[\r\n])|#\[|\/\*(?:[^*]|\*(?!\/))*(?:\*\/|$))*?(?:\?>|$)/g;
1954 Prism.languages['markup-templating'].buildPlaceholders(env, 'php', phpPattern);
1956 Prism.hooks.add('after-tokenize', function (env) {
1957 Prism.languages['markup-templating'].tokenizePlaceholders(env, 'php');
1960 Prism.languages.python = {
1962 pattern: /(^|[^\\])#.*/,
1966 'string-interpolation': {
1967 pattern: /(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,
1971 pattern: /((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,
1975 pattern: /(:)[^:(){}]+(?=\}$)/,
1978 'conversion-option': {
1979 pattern: /![sra](?=[:}]$)/,
1980 alias: 'punctuation'
1988 'triple-quoted-string': {
1989 pattern: /(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,
1994 pattern: /(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,
1998 pattern: /((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,
2002 pattern: /(\bclass\s+)\w+/i,
2006 pattern: /(^[\t ]*)@\w+(?:\.\w+)*/m,
2012 inside: { 'punctuation': /\./ }
2014 'keyword': /\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,
2015 'builtin': /\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,
2016 'boolean': /\b(?:False|None|True)\b/,
2017 'number': /\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,
2018 'operator': /[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,
2019 'punctuation': /[{}[\];(),.:]/
2021 Prism.languages.python['string-interpolation'].inside['interpolation'].inside.rest = Prism.languages.python;
2022 Prism.languages.py = Prism.languages.python;
2024 Prism.languages.ruby = Prism.languages.extend('clike', {
2026 pattern: /#.*|^=begin\s[\s\S]*?^=end/m,
2030 pattern: /(\b(?:class|module)\s+|\bcatch\s+\()[\w.\\]+|\b[A-Z_]\w*(?=\s*\.\s*new\b)/,
2032 inside: { 'punctuation': /[.\\]/ }
2034 'keyword': /\b(?:BEGIN|END|alias|and|begin|break|case|class|def|define_method|defined|do|each|else|elsif|end|ensure|extend|for|if|in|include|module|new|next|nil|not|or|prepend|private|protected|public|raise|redo|require|rescue|retry|return|self|super|then|throw|undef|unless|until|when|while|yield)\b/,
2035 'operator': /\.{2,3}|&\.|===|<?=>|[!=]?~|(?:&&|\|\||<<|>>|\*\*|[+\-*/%<>!^&|=])=?|[?:]/,
2036 'punctuation': /[(){}[\].,;]/
2038 Prism.languages.insertBefore('ruby', 'operator', {
2041 alias: 'punctuation'
2044 var interpolation = {
2045 pattern: /((?:^|[^\\])(?:\\{2})*)#\{(?:[^{}]|\{[^{}]*\})*\}/,
2049 pattern: /^(#\{)[\s\S]+(?=\}$)/,
2051 inside: Prism.languages.ruby
2054 pattern: /^#\{|\}$/,
2055 alias: 'punctuation'
2059 delete Prism.languages.ruby.function;
2060 var percentExpression = '(?:' + [
2061 /([^a-zA-Z0-9\s{(\[<=])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,
2062 /\((?:[^()\\]|\\[\s\S]|\((?:[^()\\]|\\[\s\S])*\))*\)/.source,
2063 /\{(?:[^{}\\]|\\[\s\S]|\{(?:[^{}\\]|\\[\s\S])*\})*\}/.source,
2064 /\[(?:[^\[\]\\]|\\[\s\S]|\[(?:[^\[\]\\]|\\[\s\S])*\])*\]/.source,
2065 /<(?:[^<>\\]|\\[\s\S]|<(?:[^<>\\]|\\[\s\S])*>)*>/.source
2067 var symbolName = /(?:"(?:\\.|[^"\\\r\n])*"|(?:\b[a-zA-Z_]\w*|[^\s\0-\x7F]+)[?!]?|\$.)/.source;
2068 Prism.languages.insertBefore('ruby', 'keyword', {
2071 pattern: RegExp(/%r/.source + percentExpression + /[egimnosux]{0,6}/.source),
2074 'interpolation': interpolation,
2079 pattern: /(^|[^/])\/(?!\/)(?:\[[^\r\n\]]+\]|\\.|[^[/\\\r\n])+\/[egimnosux]{0,6}(?=\s*(?:$|[\r\n,.;})#]))/,
2083 'interpolation': interpolation,
2088 'variable': /[@$]+[a-zA-Z_]\w*(?:[?!]|\b)/,
2091 pattern: RegExp(/(^|[^:]):/.source + symbolName),
2096 pattern: RegExp(/([\r\n{(,][ \t]*)/.source + symbolName + /(?=:(?!:))/.source),
2101 'method-definition': {
2102 pattern: /(\bdef\s+)\w+(?:\s*\.\s*\w+)?/,
2105 'function': /\b\w+$/,
2106 'keyword': /^self\b/,
2107 'class-name': /^\w+/,
2112 Prism.languages.insertBefore('ruby', 'string', {
2115 pattern: RegExp(/%[qQiIwWs]?/.source + percentExpression),
2118 'interpolation': interpolation,
2123 pattern: /("|')(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|(?!\1)[^\\#\r\n])*\1/,
2126 'interpolation': interpolation,
2131 pattern: /<<[-~]?([a-z_]\w*)[\r\n](?:.*[\r\n])*?[\t ]*\1/i,
2132 alias: 'heredoc-string',
2136 pattern: /^<<[-~]?[a-z_]\w*|\b[a-z_]\w*$/i,
2139 'punctuation': /^<<[-~]?/
2142 'interpolation': interpolation,
2147 pattern: /<<[-~]?'([a-z_]\w*)'[\r\n](?:.*[\r\n])*?[\t ]*\1/i,
2148 alias: 'heredoc-string',
2152 pattern: /^<<[-~]?'[a-z_]\w*'|\b[a-z_]\w*$/i,
2155 'punctuation': /^<<[-~]?'|'$/
2162 'command-literal': [
2164 pattern: RegExp(/%x/.source + percentExpression),
2167 'interpolation': interpolation,
2175 pattern: /`(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|[^\\`#\r\n])*`/,
2178 'interpolation': interpolation,
2187 delete Prism.languages.ruby.string;
2188 Prism.languages.insertBefore('ruby', 'number', {
2189 'builtin': /\b(?:Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Fixnum|Float|Hash|IO|Integer|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|Stat|String|Struct|Symbol|TMS|Thread|ThreadGroup|Time|TrueClass)\b/,
2190 'constant': /\b[A-Z][A-Z0-9_]*(?:[?!]|\b)/
2192 Prism.languages.rb = Prism.languages.ruby;
2194 window.Prism = oldprism;
2196 }(undefined, undefined);
2198 const option = name => editor => editor.options.get(name);
2199 const register$2 = editor => {
2200 const registerOption = editor.options.register;
2201 registerOption('codesample_languages', { processor: 'object[]' });
2202 registerOption('codesample_global_prismjs', {
2203 processor: 'boolean',
2207 const getLanguages$1 = option('codesample_languages');
2208 const useGlobalPrismJS = option('codesample_global_prismjs');
2210 const get = editor => Global.Prism && useGlobalPrismJS(editor) ? Global.Prism : prismjs;
2212 const isCodeSample = elm => {
2213 return isNonNullable(elm) && elm.nodeName === 'PRE' && elm.className.indexOf('language-') !== -1;
2216 const getSelectedCodeSample = editor => {
2217 const node = editor.selection ? editor.selection.getNode() : null;
2218 return isCodeSample(node) ? Optional.some(node) : Optional.none();
2220 const insertCodeSample = (editor, language, code) => {
2221 const dom = editor.dom;
2222 editor.undoManager.transact(() => {
2223 const node = getSelectedCodeSample(editor);
2224 code = global$1.DOM.encode(code);
2225 return node.fold(() => {
2226 editor.insertContent('<pre id="__new" class="language-' + language + '">' + code + '</pre>');
2227 const newPre = dom.select('#__new')[0];
2228 dom.setAttrib(newPre, 'id', null);
2229 editor.selection.select(newPre);
2231 dom.setAttrib(n, 'class', 'language-' + language);
2233 get(editor).highlightElement(n);
2234 editor.selection.select(n);
2238 const getCurrentCode = editor => {
2239 const node = getSelectedCodeSample(editor);
2240 return node.bind(n => Optional.from(n.textContent)).getOr('');
2243 const getLanguages = editor => {
2244 const defaultLanguages = [
2286 const customLanguages = getLanguages$1(editor);
2287 return customLanguages ? customLanguages : defaultLanguages;
2289 const getCurrentLanguage = (editor, fallback) => {
2290 const node = getSelectedCodeSample(editor);
2291 return node.fold(() => fallback, n => {
2292 const matches = n.className.match(/language-(\w+)/);
2293 return matches ? matches[1] : fallback;
2297 const open = editor => {
2298 const languages = getLanguages(editor);
2299 const defaultLanguage = head(languages).fold(constant(''), l => l.value);
2300 const currentLanguage = getCurrentLanguage(editor, defaultLanguage);
2301 const currentCode = getCurrentCode(editor);
2302 editor.windowManager.open({
2303 title: 'Insert/Edit Code Sample',
2335 language: currentLanguage,
2339 const data = api.getData();
2340 insertCodeSample(editor, data.language, data.code);
2346 const register$1 = editor => {
2347 editor.addCommand('codesample', () => {
2348 const node = editor.selection.getNode();
2349 if (editor.selection.isCollapsed() || isCodeSample(node)) {
2352 editor.formatter.toggle('code');
2357 const blank = r => s => s.replace(r, '');
2358 const trim = blank(/^\s+|\s+$/g);
2360 var global = tinymce.util.Tools.resolve('tinymce.util.Tools');
2362 const setup = editor => {
2363 editor.on('PreProcess', e => {
2364 const dom = editor.dom;
2365 const pres = dom.select('pre[contenteditable=false]', e.node);
2366 global.each(global.grep(pres, isCodeSample), elm => {
2367 const code = elm.textContent;
2368 dom.setAttrib(elm, 'class', trim(dom.getAttrib(elm, 'class')));
2369 dom.setAttrib(elm, 'contentEditable', null);
2370 dom.setAttrib(elm, 'data-mce-highlighted', null);
2372 while (child = elm.firstChild) {
2373 elm.removeChild(child);
2375 const codeElm = dom.add(elm, 'code');
2376 codeElm.textContent = code;
2379 editor.on('SetContent', () => {
2380 const dom = editor.dom;
2381 const unprocessedCodeSamples = global.grep(dom.select('pre'), elm => {
2382 return isCodeSample(elm) && dom.getAttrib(elm, 'data-mce-highlighted') !== 'true';
2384 if (unprocessedCodeSamples.length) {
2385 editor.undoManager.transact(() => {
2386 global.each(unprocessedCodeSamples, elm => {
2388 global.each(dom.select('br', elm), elm => {
2389 dom.replace(editor.getDoc().createTextNode('\n'), elm);
2391 elm.innerHTML = dom.encode((_a = elm.textContent) !== null && _a !== void 0 ? _a : '');
2392 get(editor).highlightElement(elm);
2393 dom.setAttrib(elm, 'data-mce-highlighted', true);
2394 elm.className = trim(elm.className);
2399 editor.on('PreInit', () => {
2400 editor.parser.addNodeFilter('pre', nodes => {
2402 for (let i = 0, l = nodes.length; i < l; i++) {
2403 const node = nodes[i];
2404 const isCodeSample = ((_a = node.attr('class')) !== null && _a !== void 0 ? _a : '').indexOf('language-') !== -1;
2406 node.attr('contenteditable', 'false');
2407 node.attr('data-mce-highlighted', 'false');
2414 const onSetupEditable = (editor, onChanged = noop) => api => {
2415 const nodeChanged = () => {
2416 api.setEnabled(editor.selection.isEditable());
2419 editor.on('NodeChange', nodeChanged);
2422 editor.off('NodeChange', nodeChanged);
2425 const isCodeSampleSelection = editor => {
2426 const node = editor.selection.getStart();
2427 return editor.dom.is(node, 'pre[class*="language-"]');
2429 const register = editor => {
2430 const onAction = () => editor.execCommand('codesample');
2431 editor.ui.registry.addToggleButton('codesample', {
2432 icon: 'code-sample',
2433 tooltip: 'Insert/edit code sample',
2435 onSetup: onSetupEditable(editor, api => {
2436 api.setActive(isCodeSampleSelection(editor));
2439 editor.ui.registry.addMenuItem('codesample', {
2440 text: 'Code sample...',
2441 icon: 'code-sample',
2443 onSetup: onSetupEditable(editor)
2447 var Plugin = () => {
2448 global$2.add('codesample', editor => {
2453 editor.on('dblclick', ev => {
2454 if (isCodeSample(ev.target)) {