UNPKG

react-kiwi-dropdown

Version:

A minimal, easy-to-use and highly adjustable dropdown component made with ReactJS.

1 lines 28.6 kB
{"ast":null,"code":"/* **********************************************\n Begin prism-core.js\n********************************************** */\nvar _self = typeof window !== 'undefined' ? window // if in browser\n: typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope ? self // if in worker\n: {} // if in node js\n;\n/**\n * Prism: Lightweight, robust, elegant syntax highlighting\n * MIT license http://www.opensource.org/licenses/mit-license.php/\n * @author Lea Verou http://lea.verou.me\n */\n\n\nvar Prism = function (_self) {\n // Private helper vars\n var lang = /\\blang(?:uage)?-([\\w-]+)\\b/i;\n var uniqueId = 0;\n var _ = {\n manual: _self.Prism && _self.Prism.manual,\n disableWorkerMessageHandler: _self.Prism && _self.Prism.disableWorkerMessageHandler,\n util: {\n encode: function (tokens) {\n if (tokens instanceof Token) {\n return new Token(tokens.type, _.util.encode(tokens.content), tokens.alias);\n } else if (Array.isArray(tokens)) {\n return tokens.map(_.util.encode);\n } else {\n return tokens.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/\\u00a0/g, ' ');\n }\n },\n type: function (o) {\n return Object.prototype.toString.call(o).slice(8, -1);\n },\n objId: function (obj) {\n if (!obj['__id']) {\n Object.defineProperty(obj, '__id', {\n value: ++uniqueId\n });\n }\n\n return obj['__id'];\n },\n // Deep clone a language definition (e.g. to extend it)\n clone: function deepClone(o, visited) {\n var clone,\n id,\n type = _.util.type(o);\n\n visited = visited || {};\n\n switch (type) {\n case 'Object':\n id = _.util.objId(o);\n\n if (visited[id]) {\n return visited[id];\n }\n\n clone = {};\n visited[id] = clone;\n\n for (var key in o) {\n if (o.hasOwnProperty(key)) {\n clone[key] = deepClone(o[key], visited);\n }\n }\n\n return clone;\n\n case 'Array':\n id = _.util.objId(o);\n\n if (visited[id]) {\n return visited[id];\n }\n\n clone = [];\n visited[id] = clone;\n o.forEach(function (v, i) {\n clone[i] = deepClone(v, visited);\n });\n return clone;\n\n default:\n return o;\n }\n }\n },\n languages: {\n extend: function (id, redef) {\n var lang = _.util.clone(_.languages[id]);\n\n for (var key in redef) {\n lang[key] = redef[key];\n }\n\n return lang;\n },\n\n /**\n * Insert a token before another token in a language literal\n * As this needs to recreate the object (we cannot actually insert before keys in object literals),\n * we cannot just provide an object, we need an object and a key.\n * @param inside The key (or language id) of the parent\n * @param before The key to insert before.\n * @param insert Object with the key/value pairs to insert\n * @param root The object that contains `inside`. If equal to Prism.languages, it can be omitted.\n */\n insertBefore: function (inside, before, insert, root) {\n root = root || _.languages;\n var grammar = root[inside];\n var ret = {};\n\n for (var token in grammar) {\n if (grammar.hasOwnProperty(token)) {\n if (token == before) {\n for (var newToken in insert) {\n if (insert.hasOwnProperty(newToken)) {\n ret[newToken] = insert[newToken];\n }\n }\n } // Do not insert token which also occur in insert. See #1525\n\n\n if (!insert.hasOwnProperty(token)) {\n ret[token] = grammar[token];\n }\n }\n }\n\n var old = root[inside];\n root[inside] = ret; // Update references in other language definitions\n\n _.languages.DFS(_.languages, function (key, value) {\n if (value === old && key != inside) {\n this[key] = ret;\n }\n });\n\n return ret;\n },\n // Traverse a language definition with Depth First Search\n DFS: function DFS(o, callback, type, visited) {\n visited = visited || {};\n var objId = _.util.objId;\n\n for (var i in o) {\n if (o.hasOwnProperty(i)) {\n callback.call(o, i, o[i], type || i);\n\n var property = o[i],\n propertyType = _.util.type(property);\n\n if (propertyType === 'Object' && !visited[objId(property)]) {\n visited[objId(property)] = true;\n DFS(property, callback, null, visited);\n } else if (propertyType === 'Array' && !visited[objId(property)]) {\n visited[objId(property)] = true;\n DFS(property, callback, i, visited);\n }\n }\n }\n }\n },\n plugins: {},\n highlightAll: function (async, callback) {\n _.highlightAllUnder(document, async, callback);\n },\n highlightAllUnder: function (container, async, callback) {\n var env = {\n callback: callback,\n selector: 'code[class*=\"language-\"], [class*=\"language-\"] code, code[class*=\"lang-\"], [class*=\"lang-\"] code'\n };\n\n _.hooks.run(\"before-highlightall\", env);\n\n var elements = env.elements || container.querySelectorAll(env.selector);\n\n for (var i = 0, element; element = elements[i++];) {\n _.highlightElement(element, async === true, env.callback);\n }\n },\n highlightElement: function (element, async, callback) {\n // Find language\n var language,\n grammar,\n parent = element;\n\n while (parent && !lang.test(parent.className)) {\n parent = parent.parentNode;\n }\n\n if (parent) {\n language = (parent.className.match(lang) || [, ''])[1].toLowerCase();\n grammar = _.languages[language];\n } // Set language on the element, if not present\n\n\n element.className = element.className.replace(lang, '').replace(/\\s+/g, ' ') + ' language-' + language;\n\n if (element.parentNode) {\n // Set language on the parent, for styling\n parent = element.parentNode;\n\n if (/pre/i.test(parent.nodeName)) {\n parent.className = parent.className.replace(lang, '').replace(/\\s+/g, ' ') + ' language-' + language;\n }\n }\n\n var code = element.textContent;\n var env = {\n element: element,\n language: language,\n grammar: grammar,\n code: code\n };\n\n var insertHighlightedCode = function (highlightedCode) {\n env.highlightedCode = highlightedCode;\n\n _.hooks.run('before-insert', env);\n\n env.element.innerHTML = env.highlightedCode;\n\n _.hooks.run('after-highlight', env);\n\n _.hooks.run('complete', env);\n\n callback && callback.call(env.element);\n };\n\n _.hooks.run('before-sanity-check', env);\n\n if (!env.code) {\n _.hooks.run('complete', env);\n\n return;\n }\n\n _.hooks.run('before-highlight', env);\n\n if (!env.grammar) {\n insertHighlightedCode(_.util.encode(env.code));\n return;\n }\n\n if (async && _self.Worker) {\n var worker = new Worker(_.filename);\n\n worker.onmessage = function (evt) {\n insertHighlightedCode(evt.data);\n };\n\n worker.postMessage(JSON.stringify({\n language: env.language,\n code: env.code,\n immediateClose: true\n }));\n } else {\n insertHighlightedCode(_.highlight(env.code, env.grammar, env.language));\n }\n },\n highlight: function (text, grammar, language) {\n var env = {\n code: text,\n grammar: grammar,\n language: language\n };\n\n _.hooks.run('before-tokenize', env);\n\n env.tokens = _.tokenize(env.code, env.grammar);\n\n _.hooks.run('after-tokenize', env);\n\n return Token.stringify(_.util.encode(env.tokens), env.language);\n },\n matchGrammar: function (text, strarr, grammar, index, startPos, oneshot, target) {\n for (var token in grammar) {\n if (!grammar.hasOwnProperty(token) || !grammar[token]) {\n continue;\n }\n\n if (token == target) {\n return;\n }\n\n var patterns = grammar[token];\n patterns = _.util.type(patterns) === \"Array\" ? patterns : [patterns];\n\n for (var j = 0; j < patterns.length; ++j) {\n var pattern = patterns[j],\n inside = pattern.inside,\n lookbehind = !!pattern.lookbehind,\n greedy = !!pattern.greedy,\n lookbehindLength = 0,\n alias = pattern.alias;\n\n if (greedy && !pattern.pattern.global) {\n // Without the global flag, lastIndex won't work\n var flags = pattern.pattern.toString().match(/[imuy]*$/)[0];\n pattern.pattern = RegExp(pattern.pattern.source, flags + \"g\");\n }\n\n pattern = pattern.pattern || pattern; // Don’t cache length as it changes during the loop\n\n for (var i = index, pos = startPos; i < strarr.length; pos += strarr[i].length, ++i) {\n var str = strarr[i];\n\n if (strarr.length > text.length) {\n // Something went terribly wrong, ABORT, ABORT!\n return;\n }\n\n if (str instanceof Token) {\n continue;\n }\n\n if (greedy && i != strarr.length - 1) {\n pattern.lastIndex = pos;\n var match = pattern.exec(text);\n\n if (!match) {\n break;\n }\n\n var from = match.index + (lookbehind ? match[1].length : 0),\n to = match.index + match[0].length,\n k = i,\n p = pos;\n\n for (var len = strarr.length; k < len && (p < to || !strarr[k].type && !strarr[k - 1].greedy); ++k) {\n p += strarr[k].length; // Move the index i to the element in strarr that is closest to from\n\n if (from >= p) {\n ++i;\n pos = p;\n }\n } // If strarr[i] is a Token, then the match starts inside another Token, which is invalid\n\n\n if (strarr[i] instanceof Token) {\n continue;\n } // Number of tokens to delete and replace with the new match\n\n\n delNum = k - i;\n str = text.slice(pos, p);\n match.index -= pos;\n } else {\n pattern.lastIndex = 0;\n var match = pattern.exec(str),\n delNum = 1;\n }\n\n if (!match) {\n if (oneshot) {\n break;\n }\n\n continue;\n }\n\n if (lookbehind) {\n lookbehindLength = match[1] ? match[1].length : 0;\n }\n\n var from = match.index + lookbehindLength,\n match = match[0].slice(lookbehindLength),\n to = from + match.length,\n before = str.slice(0, from),\n after = str.slice(to);\n var args = [i, delNum];\n\n if (before) {\n ++i;\n pos += before.length;\n args.push(before);\n }\n\n var wrapped = new Token(token, inside ? _.tokenize(match, inside) : match, alias, match, greedy);\n args.push(wrapped);\n\n if (after) {\n args.push(after);\n }\n\n Array.prototype.splice.apply(strarr, args);\n if (delNum != 1) _.matchGrammar(text, strarr, grammar, i, pos, true, token);\n if (oneshot) break;\n }\n }\n }\n },\n tokenize: function (text, grammar) {\n var strarr = [text];\n var rest = grammar.rest;\n\n if (rest) {\n for (var token in rest) {\n grammar[token] = rest[token];\n }\n\n delete grammar.rest;\n }\n\n _.matchGrammar(text, strarr, grammar, 0, 0, false);\n\n return strarr;\n },\n hooks: {\n all: {},\n add: function (name, callback) {\n var hooks = _.hooks.all;\n hooks[name] = hooks[name] || [];\n hooks[name].push(callback);\n },\n run: function (name, env) {\n var callbacks = _.hooks.all[name];\n\n if (!callbacks || !callbacks.length) {\n return;\n }\n\n for (var i = 0, callback; callback = callbacks[i++];) {\n callback(env);\n }\n }\n },\n Token: Token\n };\n _self.Prism = _;\n\n function Token(type, content, alias, matchedStr, greedy) {\n this.type = type;\n this.content = content;\n this.alias = alias; // Copy of the full string this token was created from\n\n this.length = (matchedStr || \"\").length | 0;\n this.greedy = !!greedy;\n }\n\n Token.stringify = function (o, language, parent) {\n if (typeof o == 'string') {\n return o;\n }\n\n if (Array.isArray(o)) {\n return o.map(function (element) {\n return Token.stringify(element, language, o);\n }).join('');\n }\n\n var env = {\n type: o.type,\n content: Token.stringify(o.content, language, parent),\n tag: 'span',\n classes: ['token', o.type],\n attributes: {},\n language: language,\n parent: parent\n };\n\n if (o.alias) {\n var aliases = Array.isArray(o.alias) ? o.alias : [o.alias];\n Array.prototype.push.apply(env.classes, aliases);\n }\n\n _.hooks.run('wrap', env);\n\n var attributes = Object.keys(env.attributes).map(function (name) {\n return name + '=\"' + (env.attributes[name] || '').replace(/\"/g, '&quot;') + '\"';\n }).join(' ');\n return '<' + env.tag + ' class=\"' + env.classes.join(' ') + '\"' + (attributes ? ' ' + attributes : '') + '>' + env.content + '</' + env.tag + '>';\n };\n\n if (!_self.document) {\n if (!_self.addEventListener) {\n // in Node.js\n return _;\n }\n\n if (!_.disableWorkerMessageHandler) {\n // In worker\n _self.addEventListener('message', function (evt) {\n var message = JSON.parse(evt.data),\n lang = message.language,\n code = message.code,\n immediateClose = message.immediateClose;\n\n _self.postMessage(_.highlight(code, _.languages[lang], lang));\n\n if (immediateClose) {\n _self.close();\n }\n }, false);\n }\n\n return _;\n } //Get current script and highlight\n\n\n var script = document.currentScript || [].slice.call(document.getElementsByTagName(\"script\")).pop();\n\n if (script) {\n _.filename = script.src;\n\n if (!_.manual && !script.hasAttribute('data-manual')) {\n if (document.readyState !== \"loading\") {\n if (window.requestAnimationFrame) {\n window.requestAnimationFrame(_.highlightAll);\n } else {\n window.setTimeout(_.highlightAll, 16);\n }\n } else {\n document.addEventListener('DOMContentLoaded', _.highlightAll);\n }\n }\n }\n\n return _;\n}(_self);\n\nif (typeof module !== 'undefined' && module.exports) {\n module.exports = Prism;\n} // hack for components to work correctly in node.js\n\n\nif (typeof global !== 'undefined') {\n global.Prism = Prism;\n}\n/* **********************************************\n Begin prism-markup.js\n********************************************** */\n\n\nPrism.languages.markup = {\n 'comment': /<!--[\\s\\S]*?-->/,\n 'prolog': /<\\?[\\s\\S]+?\\?>/,\n 'doctype': /<!DOCTYPE[\\s\\S]+?>/i,\n 'cdata': /<!\\[CDATA\\[[\\s\\S]*?]]>/i,\n 'tag': {\n pattern: /<\\/?(?!\\d)[^\\s>\\/=$<%]+(?:\\s(?:\\s*[^\\s>\\/=]+(?:\\s*=\\s*(?:\"[^\"]*\"|'[^']*'|[^\\s'\">=]+(?=[\\s>]))|(?=[\\s/>])))+)?\\s*\\/?>/i,\n greedy: true,\n inside: {\n 'tag': {\n pattern: /^<\\/?[^\\s>\\/]+/i,\n inside: {\n 'punctuation': /^<\\/?/,\n 'namespace': /^[^\\s>\\/:]+:/\n }\n },\n 'attr-value': {\n pattern: /=\\s*(?:\"[^\"]*\"|'[^']*'|[^\\s'\">=]+)/i,\n inside: {\n 'punctuation': [/^=/, {\n pattern: /^(\\s*)[\"']|[\"']$/,\n lookbehind: true\n }]\n }\n },\n 'punctuation': /\\/?>/,\n 'attr-name': {\n pattern: /[^\\s>\\/]+/,\n inside: {\n 'namespace': /^[^\\s>\\/:]+:/\n }\n }\n }\n },\n 'entity': /&#?[\\da-z]{1,8};/i\n};\nPrism.languages.markup['tag'].inside['attr-value'].inside['entity'] = Prism.languages.markup['entity']; // Plugin to make entity title show the real entity, idea by Roman Komarov\n\nPrism.hooks.add('wrap', function (env) {\n if (env.type === 'entity') {\n env.attributes['title'] = env.content.replace(/&amp;/, '&');\n }\n});\nObject.defineProperty(Prism.languages.markup.tag, 'addInlined', {\n /**\n * Adds an inlined language to markup.\n *\n * An example of an inlined language is CSS with `<style>` tags.\n *\n * @param {string} tagName The name of the tag that contains the inlined language. This name will be treated as\n * case insensitive.\n * @param {string} lang The language key.\n * @example\n * addInlined('style', 'css');\n */\n value: function addInlined(tagName, lang) {\n var includedCdataInside = {};\n includedCdataInside['language-' + lang] = {\n pattern: /(^<!\\[CDATA\\[)[\\s\\S]+?(?=\\]\\]>$)/i,\n lookbehind: true,\n inside: Prism.languages[lang]\n };\n includedCdataInside['cdata'] = /^<!\\[CDATA\\[|\\]\\]>$/i;\n var inside = {\n 'included-cdata': {\n pattern: /<!\\[CDATA\\[[\\s\\S]*?\\]\\]>/i,\n inside: includedCdataInside\n }\n };\n inside['language-' + lang] = {\n pattern: /[\\s\\S]+/,\n inside: Prism.languages[lang]\n };\n var def = {};\n def[tagName] = {\n pattern: RegExp(/(<__[\\s\\S]*?>)(?:<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\s*|[\\s\\S])*?(?=<\\/__>)/.source.replace(/__/g, tagName), 'i'),\n lookbehind: true,\n greedy: true,\n inside: inside\n };\n Prism.languages.insertBefore('markup', 'cdata', def);\n }\n});\nPrism.languages.xml = Prism.languages.extend('markup', {});\nPrism.languages.html = Prism.languages.markup;\nPrism.languages.mathml = Prism.languages.markup;\nPrism.languages.svg = Prism.languages.markup;\n/* **********************************************\n Begin prism-css.js\n********************************************** */\n\n(function (Prism) {\n var string = /(\"|')(?:\\\\(?:\\r\\n|[\\s\\S])|(?!\\1)[^\\\\\\r\\n])*\\1/;\n Prism.languages.css = {\n 'comment': /\\/\\*[\\s\\S]*?\\*\\//,\n 'atrule': {\n pattern: /@[\\w-]+?[\\s\\S]*?(?:;|(?=\\s*\\{))/i,\n inside: {\n 'rule': /@[\\w-]+/ // See rest below\n\n }\n },\n 'url': RegExp('url\\\\((?:' + string.source + '|.*?)\\\\)', 'i'),\n 'selector': RegExp('[^{}\\\\s](?:[^{};\"\\']|' + string.source + ')*?(?=\\\\s*\\\\{)'),\n 'string': {\n pattern: string,\n greedy: true\n },\n 'property': /[-_a-z\\xA0-\\uFFFF][-\\w\\xA0-\\uFFFF]*(?=\\s*:)/i,\n 'important': /!important\\b/i,\n 'function': /[-a-z0-9]+(?=\\()/i,\n 'punctuation': /[(){};:,]/\n };\n Prism.languages.css['atrule'].inside.rest = Prism.languages.css;\n var markup = Prism.languages.markup;\n\n if (markup) {\n markup.tag.addInlined('style', 'css');\n Prism.languages.insertBefore('inside', 'attr-value', {\n 'style-attr': {\n pattern: /\\s*style=(\"|')(?:\\\\[\\s\\S]|(?!\\1)[^\\\\])*\\1/i,\n inside: {\n 'attr-name': {\n pattern: /^\\s*style/i,\n inside: markup.tag.inside\n },\n 'punctuation': /^\\s*=\\s*['\"]|['\"]\\s*$/,\n 'attr-value': {\n pattern: /.+/i,\n inside: Prism.languages.css\n }\n },\n alias: 'language-css'\n }\n }, markup.tag);\n }\n})(Prism);\n/* **********************************************\n Begin prism-clike.js\n********************************************** */\n\n\nPrism.languages.clike = {\n 'comment': [{\n pattern: /(^|[^\\\\])\\/\\*[\\s\\S]*?(?:\\*\\/|$)/,\n lookbehind: true\n }, {\n pattern: /(^|[^\\\\:])\\/\\/.*/,\n lookbehind: true,\n greedy: true\n }],\n 'string': {\n pattern: /([\"'])(?:\\\\(?:\\r\\n|[\\s\\S])|(?!\\1)[^\\\\\\r\\n])*\\1/,\n greedy: true\n },\n 'class-name': {\n pattern: /((?:\\b(?:class|interface|extends|implements|trait|instanceof|new)\\s+)|(?:catch\\s+\\())[\\w.\\\\]+/i,\n lookbehind: true,\n inside: {\n punctuation: /[.\\\\]/\n }\n },\n 'keyword': /\\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\\b/,\n 'boolean': /\\b(?:true|false)\\b/,\n 'function': /\\w+(?=\\()/,\n 'number': /\\b0x[\\da-f]+\\b|(?:\\b\\d+\\.?\\d*|\\B\\.\\d+)(?:e[+-]?\\d+)?/i,\n 'operator': /--?|\\+\\+?|!=?=?|<=?|>=?|==?=?|&&?|\\|\\|?|\\?|\\*|\\/|~|\\^|%/,\n 'punctuation': /[{}[\\];(),.:]/\n};\n/* **********************************************\n Begin prism-javascript.js\n********************************************** */\n\nPrism.languages.javascript = Prism.languages.extend('clike', {\n 'class-name': [Prism.languages.clike['class-name'], {\n pattern: /(^|[^$\\w\\xA0-\\uFFFF])[_$A-Z\\xA0-\\uFFFF][$\\w\\xA0-\\uFFFF]*(?=\\.(?:prototype|constructor))/,\n lookbehind: true\n }],\n 'keyword': [{\n pattern: /((?:^|})\\s*)(?:catch|finally)\\b/,\n lookbehind: true\n }, {\n pattern: /(^|[^.])\\b(?:as|async(?=\\s*(?:function\\b|\\(|[$\\w\\xA0-\\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\\b/,\n lookbehind: true\n }],\n 'number': /\\b(?:(?:0[xX][\\dA-Fa-f]+|0[bB][01]+|0[oO][0-7]+)n?|\\d+n|NaN|Infinity)\\b|(?:\\b\\d+\\.?\\d*|\\B\\.\\d+)(?:[Ee][+-]?\\d+)?/,\n // Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)\n 'function': /[_$a-zA-Z\\xA0-\\uFFFF][$\\w\\xA0-\\uFFFF]*(?=\\s*(?:\\.\\s*(?:apply|bind|call)\\s*)?\\()/,\n 'operator': /-[-=]?|\\+[+=]?|!=?=?|<<?=?|>>?>?=?|=(?:==?|>)?|&[&=]?|\\|[|=]?|\\*\\*?=?|\\/=?|~|\\^=?|%=?|\\?|\\.{3}/\n});\nPrism.languages.javascript['class-name'][0].pattern = /(\\b(?:class|interface|extends|implements|instanceof|new)\\s+)[\\w.\\\\]+/;\nPrism.languages.insertBefore('javascript', 'keyword', {\n 'regex': {\n pattern: /((?:^|[^$\\w\\xA0-\\uFFFF.\"'\\])\\s])\\s*)\\/(\\[(?:[^\\]\\\\\\r\\n]|\\\\.)*]|\\\\.|[^/\\\\\\[\\r\\n])+\\/[gimyu]{0,5}(?=\\s*($|[\\r\\n,.;})\\]]))/,\n lookbehind: true,\n greedy: true\n },\n // This must be declared before keyword because we use \"function\" inside the look-forward\n 'function-variable': {\n pattern: /[_$a-zA-Z\\xA0-\\uFFFF][$\\w\\xA0-\\uFFFF]*(?=\\s*[=:]\\s*(?:async\\s*)?(?:\\bfunction\\b|(?:\\((?:[^()]|\\([^()]*\\))*\\)|[_$a-zA-Z\\xA0-\\uFFFF][$\\w\\xA0-\\uFFFF]*)\\s*=>))/,\n alias: 'function'\n },\n 'parameter': [{\n pattern: /(function(?:\\s+[_$A-Za-z\\xA0-\\uFFFF][$\\w\\xA0-\\uFFFF]*)?\\s*\\(\\s*)(?!\\s)(?:[^()]|\\([^()]*\\))+?(?=\\s*\\))/,\n lookbehind: true,\n inside: Prism.languages.javascript\n }, {\n pattern: /[_$a-z\\xA0-\\uFFFF][$\\w\\xA0-\\uFFFF]*(?=\\s*=>)/i,\n inside: Prism.languages.javascript\n }, {\n pattern: /(\\(\\s*)(?!\\s)(?:[^()]|\\([^()]*\\))+?(?=\\s*\\)\\s*=>)/,\n lookbehind: true,\n inside: Prism.languages.javascript\n }, {\n pattern: /((?:\\b|\\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\\w\\xA0-\\uFFFF]))(?:[_$A-Za-z\\xA0-\\uFFFF][$\\w\\xA0-\\uFFFF]*\\s*)\\(\\s*)(?!\\s)(?:[^()]|\\([^()]*\\))+?(?=\\s*\\)\\s*\\{)/,\n lookbehind: true,\n inside: Prism.languages.javascript\n }],\n 'constant': /\\b[A-Z](?:[A-Z_]|\\dx?)*\\b/\n});\nPrism.languages.insertBefore('javascript', 'string', {\n 'template-string': {\n pattern: /`(?:\\\\[\\s\\S]|\\${[^}]+}|[^\\\\`])*`/,\n greedy: true,\n inside: {\n 'interpolation': {\n pattern: /\\${[^}]+}/,\n inside: {\n 'interpolation-punctuation': {\n pattern: /^\\${|}$/,\n alias: 'punctuation'\n },\n rest: Prism.languages.javascript\n }\n },\n 'string': /[\\s\\S]+/\n }\n }\n});\n\nif (Prism.languages.markup) {\n Prism.languages.markup.tag.addInlined('script', 'javascript');\n}\n\nPrism.languages.js = Prism.languages.javascript;\n/* **********************************************\n Begin prism-file-highlight.js\n********************************************** */\n\n(function () {\n if (typeof self === 'undefined' || !self.Prism || !self.document || !document.querySelector) {\n return;\n }\n /**\n * @param {Element} [container=document]\n */\n\n\n self.Prism.fileHighlight = function (container) {\n container = container || document;\n var Extensions = {\n 'js': 'javascript',\n 'py': 'python',\n 'rb': 'ruby',\n 'ps1': 'powershell',\n 'psm1': 'powershell',\n 'sh': 'bash',\n 'bat': 'batch',\n 'h': 'c',\n 'tex': 'latex'\n };\n Array.prototype.slice.call(container.querySelectorAll('pre[data-src]')).forEach(function (pre) {\n // ignore if already loaded\n if (pre.hasAttribute('data-src-loaded')) {\n return;\n } // load current\n\n\n var src = pre.getAttribute('data-src');\n var language,\n parent = pre;\n var lang = /\\blang(?:uage)?-([\\w-]+)\\b/i;\n\n while (parent && !lang.test(parent.className)) {\n parent = parent.parentNode;\n }\n\n if (parent) {\n language = (pre.className.match(lang) || [, ''])[1];\n }\n\n if (!language) {\n var extension = (src.match(/\\.(\\w+)$/) || [, ''])[1];\n language = Extensions[extension] || extension;\n }\n\n var code = document.createElement('code');\n code.className = 'language-' + language;\n pre.textContent = '';\n code.textContent = 'Loading…';\n pre.appendChild(code);\n var xhr = new XMLHttpRequest();\n xhr.open('GET', src, true);\n\n xhr.onreadystatechange = function () {\n if (xhr.readyState == 4) {\n if (xhr.status < 400 && xhr.responseText) {\n code.textContent = xhr.responseText;\n Prism.highlightElement(code); // mark as loaded\n\n pre.setAttribute('data-src-loaded', '');\n } else if (xhr.status >= 400) {\n code.textContent = '✖ Error ' + xhr.status + ' while fetching file: ' + xhr.statusText;\n } else {\n code.textContent = '✖ Error: File does not exist or is empty';\n }\n }\n };\n\n xhr.send(null);\n });\n\n if (Prism.plugins.toolbar) {\n Prism.plugins.toolbar.registerButton('download-file', function (env) {\n var pre = env.element.parentNode;\n\n if (!pre || !/pre/i.test(pre.nodeName) || !pre.hasAttribute('data-src') || !pre.hasAttribute('data-download-link')) {\n return;\n }\n\n var src = pre.getAttribute('data-src');\n var a = document.createElement('a');\n a.textContent = pre.getAttribute('data-download-link-label') || 'Download';\n a.setAttribute('download', '');\n a.href = src;\n return a;\n });\n }\n };\n\n document.addEventListener('DOMContentLoaded', function () {\n // execute inside handler, for dropping Event as argument\n self.Prism.fileHighlight();\n });\n})();","map":null,"metadata":{},"sourceType":"script"}