diff --git a/docs/assets/css/main-min.css b/docs/assets/css/main-min.css index a625721d..e64ad8d4 100644 --- a/docs/assets/css/main-min.css +++ b/docs/assets/css/main-min.css @@ -1045,7 +1045,7 @@ mark { } .easyloader-box p { - margin: 0 15px; + margin: 10px 25px; color: white } @@ -1063,8 +1063,15 @@ mark { justify-content: center } + +.easyloader-mask a{ + margin-top:50px; + text-align: center; +} + .video_play { - bottom: -100% + bottom: -100%; + } .easyloader-btn { @@ -1072,8 +1079,8 @@ mark { display: flex; flex-direction: row; justify-content: space-around; - bottom: 6%; - width: 100% + bottom: 7%; + width: 100%; } .easyloader-btn a { diff --git a/docs/assets/img/faq/Updater_FW20200114_A2_BTV231_01.webp b/docs/assets/img/faq/Updater_FW20200114_A2_BTV231_01.webp new file mode 100644 index 00000000..7bf0ee04 Binary files /dev/null and b/docs/assets/img/faq/Updater_FW20200114_A2_BTV231_01.webp differ diff --git a/docs/assets/img/faq/Updater_FW20200114_A2_BTV231_02.webp b/docs/assets/img/faq/Updater_FW20200114_A2_BTV231_02.webp new file mode 100644 index 00000000..e7a4ae39 Binary files /dev/null and b/docs/assets/img/faq/Updater_FW20200114_A2_BTV231_02.webp differ diff --git a/docs/assets/img/faq/ch552/ch552_01.webp b/docs/assets/img/faq/ch552/ch552_01.webp deleted file mode 100644 index d75efb18..00000000 Binary files a/docs/assets/img/faq/ch552/ch552_01.webp and /dev/null differ diff --git a/docs/assets/img/faq/ch552/ch552_02.webp b/docs/assets/img/faq/ch552/ch552_02.webp deleted file mode 100644 index dad89db5..00000000 Binary files a/docs/assets/img/faq/ch552/ch552_02.webp and /dev/null differ diff --git a/docs/assets/js/docify.js b/docs/assets/js/docify.js index 8b05f8d0..287ff480 100644 --- a/docs/assets/js/docify.js +++ b/docs/assets/js/docify.js @@ -1,5134 +1,5134 @@ (function () { - /** - * Create a cached version of a pure function. - */ - function cached(fn) { - var cache = Object.create(null); - return function (str) { - var key = isPrimitive(str) ? str : JSON.stringify(str); - var hit = cache[key]; - return hit || (cache[key] = fn(str)) + /** + * Create a cached version of a pure function. + */ + function cached(fn) { + var cache = Object.create(null); + return function (str) { + var key = isPrimitive(str) ? str : JSON.stringify(str); + var hit = cache[key]; + return hit || (cache[key] = fn(str)) + } + } + + /** + * Hyphenate a camelCase string. + */ + var hyphenate = cached(function (str) { + return str.replace(/([A-Z])/g, function (m) { return '-' + m.toLowerCase(); }) + }); + + var hasOwn = Object.prototype.hasOwnProperty; + + /** + * Simple Object.assign polyfill + */ + var merge = + Object.assign || + function (to) { + var arguments$1 = arguments; + + for (var i = 1; i < arguments.length; i++) { + var from = Object(arguments$1[i]); + + for (var key in from) { + if (hasOwn.call(from, key)) { + to[key] = from[key]; + } + } + } + + return to + }; + + /** + * Check if value is primitive + */ + function isPrimitive(value) { + return typeof value === 'string' || typeof value === 'number' + } + + /** + * Perform no operation. + */ + function noop() {} + + /** + * Check if value is function + */ + function isFn(obj) { + return typeof obj === 'function' + } + + function config () { + var config = merge( + { + el: '#app', + repo: '', + maxLevel: 6, + subMaxLevel: 0, + loadSidebar: null, + loadNavbar: null, + homepage: 'README.md', + coverpage: '', + basePath: '', + auto2top: false, + name: '', + themeColor: '', + nameLink: window.location.pathname, + autoHeader: false, + executeScript: null, + noEmoji: false, + ga: '', + ext: '.md', + mergeNavbar: false, + formatUpdated: '', + externalLinkTarget: '_blank', + routerMode: 'hash', + noCompileLinks: [], + relativePath: false + }, + window.$docsify + ); + + var script = + document.currentScript || + [].slice + .call(document.getElementsByTagName('script')) + .filter(function (n) { return /docsify\./.test(n.src); })[0]; + + if (script) { + for (var prop in config) { + if (hasOwn.call(config, prop)) { + var val = script.getAttribute('data-' + hyphenate(prop)); + + if (isPrimitive(val)) { + config[prop] = val === '' ? true : val; + } + } + } + + if (config.loadSidebar === true) { + config.loadSidebar = '_sidebar' + config.ext; + } + if (config.loadNavbar === true) { + config.loadNavbar = '_navbar' + config.ext; + } + if (config.coverpage === true) { + config.coverpage = '_coverpage' + config.ext; + } + if (config.repo === true) { + config.repo = ''; + } + if (config.name === true) { + config.name = ''; } } - - /** - * Hyphenate a camelCase string. - */ - var hyphenate = cached(function (str) { - return str.replace(/([A-Z])/g, function (m) { return '-' + m.toLowerCase(); }) + + window.$docsify = config; + + return config + } + + function initLifecycle(vm) { + var hooks = [ + 'init', + 'mounted', + 'beforeEach', + 'afterEach', + 'doneEach', + 'ready' + ]; + + vm._hooks = {}; + vm._lifecycle = {}; + hooks.forEach(function (hook) { + var arr = (vm._hooks[hook] = []); + vm._lifecycle[hook] = function (fn) { return arr.push(fn); }; }); - - var hasOwn = Object.prototype.hasOwnProperty; - - /** - * Simple Object.assign polyfill - */ - var merge = - Object.assign || - function (to) { - var arguments$1 = arguments; - - for (var i = 1; i < arguments.length; i++) { - var from = Object(arguments$1[i]); - - for (var key in from) { - if (hasOwn.call(from, key)) { - to[key] = from[key]; - } - } - } - - return to - }; - - /** - * Check if value is primitive - */ - function isPrimitive(value) { - return typeof value === 'string' || typeof value === 'number' - } - - /** - * Perform no operation. - */ - function noop() {} - - /** - * Check if value is function - */ - function isFn(obj) { - return typeof obj === 'function' - } - - function config () { - var config = merge( - { - el: '#app', - repo: '', - maxLevel: 6, - subMaxLevel: 0, - loadSidebar: null, - loadNavbar: null, - homepage: 'README.md', - coverpage: '', - basePath: '', - auto2top: false, - name: '', - themeColor: '', - nameLink: window.location.pathname, - autoHeader: false, - executeScript: null, - noEmoji: false, - ga: '', - ext: '.md', - mergeNavbar: false, - formatUpdated: '', - externalLinkTarget: '_blank', - routerMode: 'hash', - noCompileLinks: [], - relativePath: false - }, - window.$docsify - ); - - var script = - document.currentScript || - [].slice - .call(document.getElementsByTagName('script')) - .filter(function (n) { return /docsify\./.test(n.src); })[0]; - - if (script) { - for (var prop in config) { - if (hasOwn.call(config, prop)) { - var val = script.getAttribute('data-' + hyphenate(prop)); - - if (isPrimitive(val)) { - config[prop] = val === '' ? true : val; - } - } - } - - if (config.loadSidebar === true) { - config.loadSidebar = '_sidebar' + config.ext; - } - if (config.loadNavbar === true) { - config.loadNavbar = '_navbar' + config.ext; - } - if (config.coverpage === true) { - config.coverpage = '_coverpage' + config.ext; - } - if (config.repo === true) { - config.repo = ''; - } - if (config.name === true) { - config.name = ''; - } - } - - window.$docsify = config; - - return config - } - - function initLifecycle(vm) { - var hooks = [ - 'init', - 'mounted', - 'beforeEach', - 'afterEach', - 'doneEach', - 'ready' - ]; - - vm._hooks = {}; - vm._lifecycle = {}; - hooks.forEach(function (hook) { - var arr = (vm._hooks[hook] = []); - vm._lifecycle[hook] = function (fn) { return arr.push(fn); }; - }); - } - - function callHook(vm, hook, data, next) { - if ( next === void 0 ) next = noop; - - var queue = vm._hooks[hook]; - - var step = function (index) { - var hook = queue[index]; - if (index >= queue.length) { - next(data); - } else if (typeof hook === 'function') { - if (hook.length === 2) { - hook(data, function (result) { - data = result; - step(index + 1); - }); - } else { - var result = hook(data); - data = result === undefined ? data : result; + } + + function callHook(vm, hook, data, next) { + if ( next === void 0 ) next = noop; + + var queue = vm._hooks[hook]; + + var step = function (index) { + var hook = queue[index]; + if (index >= queue.length) { + next(data); + } else if (typeof hook === 'function') { + if (hook.length === 2) { + hook(data, function (result) { + data = result; step(index + 1); - } + }); } else { + var result = hook(data); + data = result === undefined ? data : result; step(index + 1); } - }; - - step(0); - } - - var inBrowser = !false; - - var isMobile = inBrowser && document.body.clientWidth <= 600; - - /** - * @see https://github.com/MoOx/pjax/blob/master/lib/is-supported.js - */ - var supportsPushState = - inBrowser && - (function () { - // Borrowed wholesale from https://github.com/defunkt/jquery-pjax - return ( - window.history && - window.history.pushState && - window.history.replaceState && - // PushState isn’t reliable on iOS until 5. - !navigator.userAgent.match( - /((iPod|iPhone|iPad).+\bOS\s+[1-4]\D|WebApps\/.+CFNetwork)/ - ) - ) - })(); - - var cacheNode = {}; - - /** - * Get Node - * @param {String|Element} el - * @param {Boolean} noCache - * @return {Element} - */ - function getNode(el, noCache) { - if ( noCache === void 0 ) noCache = false; - - if (typeof el === 'string') { - if (typeof window.Vue !== 'undefined') { - return find(el) - } - el = noCache ? find(el) : cacheNode[el] || (cacheNode[el] = find(el)); - } - - return el - } - - var $ = inBrowser && document; - - var body = inBrowser && $.body; - - var head = inBrowser && $.head; - - /** - * Find element - * @example - * find('nav') => document.querySelector('nav') - * find(nav, 'a') => nav.querySelector('a') - */ - function find(el, node) { - if(el == null) return; - return node ? el.querySelector(node) : $.querySelector(el) - } - - /** - * Find all elements - * @example - * findAll('a') => [].slice.call(document.querySelectorAll('a')) - * findAll(nav, 'a') => [].slice.call(nav.querySelectorAll('a')) - */ - function findAll(el, node) { - return [].slice.call( - node ? el.querySelectorAll(node) : $.querySelectorAll(el) - ) - } - - function create(node, tpl) { - node = $.createElement(node); - if (tpl) { - node.innerHTML = tpl; - } - return node - } - - function appendTo(target, el) { - return target.appendChild(el) - } - - function before(target, el) { - if(target == null) return; - return target.insertBefore(el, target.children[0]) - } - - function on(el, type, handler) { - if(el == null) return; - isFn(type) ? - window.addEventListener(el, type) : - el.addEventListener(type, handler); - } - - function off(el, type, handler) { - isFn(type) ? - window.removeEventListener(el, type) : - el.removeEventListener(type, handler); - } - - /** - * Toggle class - * - * @example - * toggleClass(el, 'active') => el.classList.toggle('active') - * toggleClass(el, 'add', 'active') => el.classList.add('active') - */ - function toggleClass(el, type, val) { - el && el.classList[val ? type : 'toggle'](val || type); - } - - function style(content) { - appendTo(head, create('style', content)); - } - - - var dom = Object.freeze({ - getNode: getNode, - $: $, - body: body, - head: head, - find: find, - findAll: findAll, - create: create, - appendTo: appendTo, - before: before, - on: on, - off: off, - toggleClass: toggleClass, - style: style - }); - - /** - * Render github corner - * @param {Object} data - * @return {String} - */ - function corner(data) { - if (!data) { - return '' - } - if (!/\/\//.test(data)) { - data = 'https://github.com/' + data; - } - data = data.replace(/^git\+/, ''); - - return ( - "" + - '' + - '' - ) - } - - /** - * Render main content - */ - function main(config) { - var aside = - '' + - ''; - return ( - ("
") + - '
' + - '
' + - '
' + - '
' - ) - - // return ( - // (isMobile ? (aside + "
") : ("
" + aside)) + - // '
' + - // '
' + - // '
' + - // '
' - // ) - } - - /** - * Cover Page - */ - function cover() { - var SL = ', 100%, 85%'; - var bgc = - 'linear-gradient(to left bottom, ' + - "hsl(" + (Math.floor(Math.random() * 255) + SL) + ") 0%," + - "hsl(" + (Math.floor(Math.random() * 255) + SL) + ") 100%)"; - - return ( - "
" + - '
' + - '
' + - '
' - ) - } - - /** - * Render tree - * @param {Array} tree - * @param {String} tpl - * @return {String} - */ - function tree(toc, tpl) { - if ( tpl === void 0 ) tpl = ''; - - if (!toc || !toc.length) { - return '' - } - var innerHTML = ''; - toc.forEach(function (node) { - innerHTML += "
  • " + (node.title) + "
  • "; - if (node.children) { - innerHTML += tree(node.children, tpl); - } - }); - return tpl.replace('{inner}', innerHTML) - } - - function helper(className, content) { - return ("

    " + (content.slice(5).trim()) + "

    ") - } - - function theme(color) { - return ("") - } - - var barEl; - var timeId; - - /** - * Init progress component - */ - function init() { - var div = create('div'); - - div.classList.add('progress'); - appendTo(body, div); - barEl = div; - } - /** - * Render progress bar - */ - function progressbar (ref) { - var loaded = ref.loaded; - var total = ref.total; - var step = ref.step; - - var num; - - !barEl && init(); - - if (step) { - num = parseInt(barEl.style.width || 0, 10) + step; - num = num > 80 ? 80 : num; } else { - num = Math.floor(loaded / total * 100); + step(index + 1); } - - barEl.style.opacity = 1; - barEl.style.width = num >= 95 ? '100%' : num + '%'; - - if (num >= 95) { - clearTimeout(timeId); - timeId = setTimeout(function (_) { - barEl.style.opacity = 0; - barEl.style.width = '0%'; - }, 200); - } - } - - var cache = {}; - - /** - * Simple ajax get - * @param {string} url - * @param {boolean} [hasBar=false] has progress bar - * @return { then(resolve, reject), abort } - */ - function get(url, hasBar, headers) { - if ( hasBar === void 0 ) hasBar = false; - if ( headers === void 0 ) headers = {}; - - var xhr = new XMLHttpRequest(); - var on = function () { - xhr.addEventListener.apply(xhr, arguments); - }; - var cached$$1 = cache[url]; - - if (cached$$1) { - return {then: function (cb) { return cb(cached$$1.content, cached$$1.opt); }, abort: noop} - } - - xhr.open('GET', url); - for (var i in headers) { - if (hasOwn.call(headers, i)) { - xhr.setRequestHeader(i, headers[i]); - } - } - xhr.send(); - - return { - then: function (success, error) { - if ( error === void 0 ) error = noop; - - if (hasBar) { - var id = setInterval( - function (_) { return progressbar({ - step: Math.floor(Math.random() * 5 + 1) - }); }, - 500 - ); - - on('progress', progressbar); - on('loadend', function (evt) { - progressbar(evt); - clearInterval(id); - }); - } - - on('error', error); - on('load', function (ref) { - var target = ref.target; - - if (target.status >= 400) { - error(target); - } else { - var result = (cache[url] = { - content: target.response, - opt: { - updatedAt: xhr.getResponseHeader('last-modified') - } - }); - - success(result.content, result.opt); - } - }); - }, - abort: function (_) { return xhr.readyState !== 4 && xhr.abort(); } - } - } - - function replaceVar(block, color) { - block.innerHTML = block.innerHTML.replace( - /var\(\s*--theme-color.*?\)/g, - color - ); - } - - function cssVars (color) { - // Variable support - if (window.CSS && window.CSS.supports && window.CSS.supports('(--v:red)')) { - return - } - - var styleBlocks = findAll('style:not(.inserted),link'); - [].forEach.call(styleBlocks, function (block) { - if (block.nodeName === 'STYLE') { - replaceVar(block, color); - } else if (block.nodeName === 'LINK') { - var href = block.getAttribute('href'); - - if (!/\.css$/.test(href)) { - return - } - - get(href).then(function (res) { - var style$$1 = create('style', res); - - head.appendChild(style$$1); - replaceVar(style$$1, color); - }); - } - }); - } - - var RGX = /([^{]*?)\w(?=\})/g; - - var dict = { - YYYY: 'getFullYear', - YY: 'getYear', - MM: function (d) { - return d.getMonth() + 1; - }, - DD: 'getDate', - HH: 'getHours', - mm: 'getMinutes', - ss: 'getSeconds' }; - - function tinydate (str) { - var parts=[], offset=0; - str.replace(RGX, function (key, _, idx) { - // save preceding string - parts.push(str.substring(offset, idx - 1)); - offset = idx += key.length + 1; - // save function - parts.push(function(d){ - return ('00' + (typeof dict[key]==='string' ? d[dict[key]]() : dict[key](d))).slice(-key.length); - }); - }); - - if (offset !== str.length) { - parts.push(str.substring(offset)); - } - - return function (arg) { - var out='', i=0, d=arg||new Date(); - for (; i document.querySelector('nav') + * find(nav, 'a') => nav.querySelector('a') + */ + function find(el, node) { + if(el == null) return; + return node ? el.querySelector(node) : $.querySelector(el) + } + + /** + * Find all elements + * @example + * findAll('a') => [].slice.call(document.querySelectorAll('a')) + * findAll(nav, 'a') => [].slice.call(nav.querySelectorAll('a')) + */ + function findAll(el, node) { + return [].slice.call( + node ? el.querySelectorAll(node) : $.querySelectorAll(el) + ) + } + + function create(node, tpl) { + node = $.createElement(node); + if (tpl) { + node.innerHTML = tpl; } - - var marked = createCommonjsModule(function (module, exports) { - /** - * marked - a markdown parser - * Copyright (c) 2011-2018, Christopher Jeffrey. (MIT Licensed) - * https://github.com/markedjs/marked - */ - - (function(root) { - var block = { - newline: /^\n+/, - code: /^( {4}[^\n]+\n*)+/, - fences: noop, - hr: /^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/, - heading: /^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/, - nptable: noop, - blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/, - list: /^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/, - html: '^ {0,3}(?:' // optional indentation - + '<(script|pre|style)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)' // (1) - + '|comment[^\\n]*(\\n+|$)' // (2) - + '|<\\?[\\s\\S]*?\\?>\\n*' // (3) - + '|\\n*' // (4) - + '|\\n*' // (5) - + '|)[\\s\\S]*?(?:\\n{2,}|$)' // (6) - + '|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=\\h*\\n)[\\s\\S]*?(?:\\n{2,}|$)' // (7) open tag - + '|(?=\\h*\\n)[\\s\\S]*?(?:\\n{2,}|$)' // (7) closing tag - + ')', - def: /^ {0,3}\[(label)\]: *\n? *]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/, - table: noop, - lheading: /^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/, - paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading| {0,3}>|<\/?(?:tag)(?: +|\n|\/?>)|<(?:script|pre|style|!--))[^\n]+)*)/, - text: /^[^\n]+/ - }; - - block._label = /(?!\s*\])(?:\\[\[\]]|[^\[\]])+/; - block._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/; - block.def = edit(block.def) - .replace('label', block._label) - .replace('title', block._title) - .getRegex(); - - block.bullet = /(?:[*+-]|\d+\.)/; - block.item = /^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/; - block.item = edit(block.item, 'gm') - .replace(/bull/g, block.bullet) - .getRegex(); - - block.list = edit(block.list) - .replace(/bull/g, block.bullet) - .replace('hr', '\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))') - .replace('def', '\\n+(?=' + block.def.source + ')') - .getRegex(); - - block._tag = 'address|article|aside|base|basefont|blockquote|body|caption' - + '|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption' - + '|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe' - + '|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option' - + '|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr' - + '|track|ul'; - block._comment = //; - block.html = edit(block.html, 'i') - .replace('comment', block._comment) - .replace('tag', block._tag) - .replace('attribute', / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/) - .getRegex(); - - block.paragraph = edit(block.paragraph) - .replace('hr', block.hr) - .replace('heading', block.heading) - .replace('lheading', block.lheading) - .replace('tag', block._tag) // pars can be interrupted by type (6) html blocks - .getRegex(); - - block.blockquote = edit(block.blockquote) - .replace('paragraph', block.paragraph) - .getRegex(); - - /** - * Normal Block Grammar - */ - - block.normal = merge({}, block); - - /** - * GFM Block Grammar - */ - - block.gfm = merge({}, block.normal, { - fences: /^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\n? *\1 *(?:\n+|$)/, - paragraph: /^/, - heading: /^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/ + return node + } + + function appendTo(target, el) { + return target.appendChild(el) + } + + function before(target, el) { + if(target == null) return; + return target.insertBefore(el, target.children[0]) + } + + function on(el, type, handler) { + if(el == null) return; + isFn(type) ? + window.addEventListener(el, type) : + el.addEventListener(type, handler); + } + + function off(el, type, handler) { + isFn(type) ? + window.removeEventListener(el, type) : + el.removeEventListener(type, handler); + } + + /** + * Toggle class + * + * @example + * toggleClass(el, 'active') => el.classList.toggle('active') + * toggleClass(el, 'add', 'active') => el.classList.add('active') + */ + function toggleClass(el, type, val) { + el && el.classList[val ? type : 'toggle'](val || type); + } + + function style(content) { + appendTo(head, create('style', content)); + } + + + var dom = Object.freeze({ + getNode: getNode, + $: $, + body: body, + head: head, + find: find, + findAll: findAll, + create: create, + appendTo: appendTo, + before: before, + on: on, + off: off, + toggleClass: toggleClass, + style: style + }); + + /** + * Render github corner + * @param {Object} data + * @return {String} + */ + function corner(data) { + if (!data) { + return '' + } + if (!/\/\//.test(data)) { + data = 'https://github.com/' + data; + } + data = data.replace(/^git\+/, ''); + + return ( + "" + + '' + + '' + ) + } + + /** + * Render main content + */ + function main(config) { + var aside = + '' + + ''; + return ( + ("
    ") + + '
    ' + + '
    ' + + '
    ' + + '
    ' + ) + + // return ( + // (isMobile ? (aside + "
    ") : ("
    " + aside)) + + // '
    ' + + // '
    ' + + // '
    ' + + // '
    ' + // ) + } + + /** + * Cover Page + */ + function cover() { + var SL = ', 100%, 85%'; + var bgc = + 'linear-gradient(to left bottom, ' + + "hsl(" + (Math.floor(Math.random() * 255) + SL) + ") 0%," + + "hsl(" + (Math.floor(Math.random() * 255) + SL) + ") 100%)"; + + return ( + "
    " + + '
    ' + + '
    ' + + '
    ' + ) + } + + /** + * Render tree + * @param {Array} tree + * @param {String} tpl + * @return {String} + */ + function tree(toc, tpl) { + if ( tpl === void 0 ) tpl = '
      {inner}
    '; + + if (!toc || !toc.length) { + return '' + } + var innerHTML = ''; + toc.forEach(function (node) { + innerHTML += "
  • " + (node.title) + "
  • "; + if (node.children) { + innerHTML += tree(node.children, tpl); + } }); - - block.gfm.paragraph = edit(block.paragraph) - .replace('(?!', '(?!' - + block.gfm.fences.source.replace('\\1', '\\2') + '|' - + block.list.source.replace('\\1', '\\3') + '|') - .getRegex(); - - /** - * GFM + Tables Block Grammar - */ - - block.tables = merge({}, block.gfm, { - nptable: /^ *([^|\n ].*\|.*)\n *([-:]+ *\|[-| :]*)(?:\n((?:.*[^>\n ].*(?:\n|$))*)\n*|$)/, - table: /^ *\|(.+)\n *\|?( *[-:]+[-| :]*)(?:\n((?: *[^>\n ].*(?:\n|$))*)\n*|$)/ - }); - - /** - * Pedantic grammar - */ - - block.pedantic = merge({}, block.normal, { - html: edit( - '^ *(?:comment *(?:\\n|\\s*$)' - + '|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)' // closed tag - + '|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))') - .replace('comment', block._comment) - .replace(/tag/g, '(?!(?:' - + 'a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub' - + '|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)' - + '\\b)\\w+(?!:|[^\\w\\s@]*@)\\b') - .getRegex(), - def: /^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/ - }); - - /** - * Block Lexer - */ - - function Lexer(options) { - this.tokens = []; - this.tokens.links = Object.create(null); - this.options = options || marked.defaults; - this.rules = block.normal; - - if (this.options.pedantic) { - this.rules = block.pedantic; - } else if (this.options.gfm) { - if (this.options.tables) { - this.rules = block.tables; - } else { - this.rules = block.gfm; - } + return tpl.replace('{inner}', innerHTML) + } + + function helper(className, content) { + return ("

    " + (content.slice(5).trim()) + "

    ") + } + + function theme(color) { + return ("") + } + + var barEl; + var timeId; + + /** + * Init progress component + */ + function init() { + var div = create('div'); + + div.classList.add('progress'); + appendTo(body, div); + barEl = div; + } + /** + * Render progress bar + */ + function progressbar (ref) { + var loaded = ref.loaded; + var total = ref.total; + var step = ref.step; + + var num; + + !barEl && init(); + + if (step) { + num = parseInt(barEl.style.width || 0, 10) + step; + num = num > 80 ? 80 : num; + } else { + num = Math.floor(loaded / total * 100); + } + + barEl.style.opacity = 1; + barEl.style.width = num >= 95 ? '100%' : num + '%'; + + if (num >= 95) { + clearTimeout(timeId); + timeId = setTimeout(function (_) { + barEl.style.opacity = 0; + barEl.style.width = '0%'; + }, 200); + } + } + + var cache = {}; + + /** + * Simple ajax get + * @param {string} url + * @param {boolean} [hasBar=false] has progress bar + * @return { then(resolve, reject), abort } + */ + function get(url, hasBar, headers) { + if ( hasBar === void 0 ) hasBar = false; + if ( headers === void 0 ) headers = {}; + + var xhr = new XMLHttpRequest(); + var on = function () { + xhr.addEventListener.apply(xhr, arguments); + }; + var cached$$1 = cache[url]; + + if (cached$$1) { + return {then: function (cb) { return cb(cached$$1.content, cached$$1.opt); }, abort: noop} + } + + xhr.open('GET', url); + for (var i in headers) { + if (hasOwn.call(headers, i)) { + xhr.setRequestHeader(i, headers[i]); } } - - /** - * Expose Block Rules - */ - - Lexer.rules = block; - - /** - * Static Lex Method - */ - - Lexer.lex = function(src, options) { - var lexer = new Lexer(options); - return lexer.lex(src); - }; - - /** - * Preprocessing - */ - - Lexer.prototype.lex = function(src) { - src = src - .replace(/\r\n|\r/g, '\n') - .replace(/\t/g, ' ') - .replace(/\u00a0/g, ' ') - .replace(/\u2424/g, '\n'); - - return this.token(src, true); - }; - - /** - * Lexing - */ - - Lexer.prototype.token = function(src, top) { - var this$1 = this; - - src = src.replace(/^ +$/gm, ''); - var next, - loose, - cap, - bull, - b, - item, - listStart, - listItems, - t, - space, - i, - tag, - l, - isordered, - istask, - ischecked; - - while (src) { - // newline - if (cap = this$1.rules.newline.exec(src)) { - src = src.substring(cap[0].length); - if (cap[0].length > 1) { - this$1.tokens.push({ - type: 'space' - }); - } - } - - // code - if (cap = this$1.rules.code.exec(src)) { - src = src.substring(cap[0].length); - cap = cap[0].replace(/^ {4}/gm, ''); - this$1.tokens.push({ - type: 'code', - text: !this$1.options.pedantic - ? rtrim(cap, '\n') - : cap + xhr.send(); + + return { + then: function (success, error) { + if ( error === void 0 ) error = noop; + + if (hasBar) { + var id = setInterval( + function (_) { return progressbar({ + step: Math.floor(Math.random() * 5 + 1) + }); }, + 500 + ); + + on('progress', progressbar); + on('loadend', function (evt) { + progressbar(evt); + clearInterval(id); }); - continue; } - - // fences (gfm) - if (cap = this$1.rules.fences.exec(src)) { - src = src.substring(cap[0].length); - this$1.tokens.push({ - type: 'code', - lang: cap[2], - text: cap[3] || '' - }); - continue; - } - - // heading - if (cap = this$1.rules.heading.exec(src)) { - src = src.substring(cap[0].length); - this$1.tokens.push({ - type: 'heading', - depth: cap[1].length, - text: cap[2] - }); - continue; - } - - // table no leading pipe (gfm) - if (top && (cap = this$1.rules.nptable.exec(src))) { - item = { - type: 'table', - header: splitCells(cap[1].replace(/^ *| *\| *$/g, '')), - align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */), - cells: cap[3] ? cap[3].replace(/\n$/, '').split('\n') : [] - }; - - if (item.header.length === item.align.length) { - src = src.substring(cap[0].length); - - for (i = 0; i < item.align.length; i++) { - if (/^ *-+: *$/.test(item.align[i])) { - item.align[i] = 'right'; - } else if (/^ *:-+: *$/.test(item.align[i])) { - item.align[i] = 'center'; - } else if (/^ *:-+ *$/.test(item.align[i])) { - item.align[i] = 'left'; - } else { - item.align[i] = null; + + on('error', error); + on('load', function (ref) { + var target = ref.target; + + if (target.status >= 400) { + error(target); + } else { + var result = (cache[url] = { + content: target.response, + opt: { + updatedAt: xhr.getResponseHeader('last-modified') } - } - - for (i = 0; i < item.cells.length; i++) { - item.cells[i] = splitCells(item.cells[i], item.header.length); - } - - this$1.tokens.push(item); - - continue; + }); + + success(result.content, result.opt); } + }); + }, + abort: function (_) { return xhr.readyState !== 4 && xhr.abort(); } + } + } + + function replaceVar(block, color) { + block.innerHTML = block.innerHTML.replace( + /var\(\s*--theme-color.*?\)/g, + color + ); + } + + function cssVars (color) { + // Variable support + if (window.CSS && window.CSS.supports && window.CSS.supports('(--v:red)')) { + return + } + + var styleBlocks = findAll('style:not(.inserted),link'); + [].forEach.call(styleBlocks, function (block) { + if (block.nodeName === 'STYLE') { + replaceVar(block, color); + } else if (block.nodeName === 'LINK') { + var href = block.getAttribute('href'); + + if (!/\.css$/.test(href)) { + return } - - // hr - if (cap = this$1.rules.hr.exec(src)) { - src = src.substring(cap[0].length); - this$1.tokens.push({ - type: 'hr' + + get(href).then(function (res) { + var style$$1 = create('style', res); + + head.appendChild(style$$1); + replaceVar(style$$1, color); + }); + } + }); + } + + var RGX = /([^{]*?)\w(?=\})/g; + + var dict = { + YYYY: 'getFullYear', + YY: 'getYear', + MM: function (d) { + return d.getMonth() + 1; + }, + DD: 'getDate', + HH: 'getHours', + mm: 'getMinutes', + ss: 'getSeconds' + }; + + function tinydate (str) { + var parts=[], offset=0; + str.replace(RGX, function (key, _, idx) { + // save preceding string + parts.push(str.substring(offset, idx - 1)); + offset = idx += key.length + 1; + // save function + parts.push(function(d){ + return ('00' + (typeof dict[key]==='string' ? d[dict[key]]() : dict[key](d))).slice(-key.length); }); - continue; - } - - // blockquote - if (cap = this$1.rules.blockquote.exec(src)) { - src = src.substring(cap[0].length); - - this$1.tokens.push({ - type: 'blockquote_start' - }); - - cap = cap[0].replace(/^ *> ?/gm, ''); - - // Pass `top` to keep the current - // "toplevel" state. This is exactly - // how markdown.pl works. - this$1.token(cap, top); - + }); + + if (offset !== str.length) { + parts.push(str.substring(offset)); + } + + return function (arg) { + var out='', i=0, d=arg||new Date(); + for (; i ?(paragraph|[^\n]*)(?:\n|$))+/, + list: /^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/, + html: '^ {0,3}(?:' // optional indentation + + '<(script|pre|style)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)' // (1) + + '|comment[^\\n]*(\\n+|$)' // (2) + + '|<\\?[\\s\\S]*?\\?>\\n*' // (3) + + '|\\n*' // (4) + + '|\\n*' // (5) + + '|)[\\s\\S]*?(?:\\n{2,}|$)' // (6) + + '|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=\\h*\\n)[\\s\\S]*?(?:\\n{2,}|$)' // (7) open tag + + '|(?=\\h*\\n)[\\s\\S]*?(?:\\n{2,}|$)' // (7) closing tag + + ')', + def: /^ {0,3}\[(label)\]: *\n? *]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/, + table: noop, + lheading: /^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/, + paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading| {0,3}>|<\/?(?:tag)(?: +|\n|\/?>)|<(?:script|pre|style|!--))[^\n]+)*)/, + text: /^[^\n]+/ + }; + + block._label = /(?!\s*\])(?:\\[\[\]]|[^\[\]])+/; + block._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/; + block.def = edit(block.def) + .replace('label', block._label) + .replace('title', block._title) + .getRegex(); + + block.bullet = /(?:[*+-]|\d+\.)/; + block.item = /^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/; + block.item = edit(block.item, 'gm') + .replace(/bull/g, block.bullet) + .getRegex(); + + block.list = edit(block.list) + .replace(/bull/g, block.bullet) + .replace('hr', '\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))') + .replace('def', '\\n+(?=' + block.def.source + ')') + .getRegex(); + + block._tag = 'address|article|aside|base|basefont|blockquote|body|caption' + + '|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption' + + '|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe' + + '|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option' + + '|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr' + + '|track|ul'; + block._comment = //; + block.html = edit(block.html, 'i') + .replace('comment', block._comment) + .replace('tag', block._tag) + .replace('attribute', / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/) + .getRegex(); + + block.paragraph = edit(block.paragraph) + .replace('hr', block.hr) + .replace('heading', block.heading) + .replace('lheading', block.lheading) + .replace('tag', block._tag) // pars can be interrupted by type (6) html blocks + .getRegex(); + + block.blockquote = edit(block.blockquote) + .replace('paragraph', block.paragraph) + .getRegex(); + + /** + * Normal Block Grammar + */ + + block.normal = merge({}, block); + + /** + * GFM Block Grammar + */ + + block.gfm = merge({}, block.normal, { + fences: /^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\n? *\1 *(?:\n+|$)/, + paragraph: /^/, + heading: /^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/ + }); + + block.gfm.paragraph = edit(block.paragraph) + .replace('(?!', '(?!' + + block.gfm.fences.source.replace('\\1', '\\2') + '|' + + block.list.source.replace('\\1', '\\3') + '|') + .getRegex(); + + /** + * GFM + Tables Block Grammar + */ + + block.tables = merge({}, block.gfm, { + nptable: /^ *([^|\n ].*\|.*)\n *([-:]+ *\|[-| :]*)(?:\n((?:.*[^>\n ].*(?:\n|$))*)\n*|$)/, + table: /^ *\|(.+)\n *\|?( *[-:]+[-| :]*)(?:\n((?: *[^>\n ].*(?:\n|$))*)\n*|$)/ + }); + + /** + * Pedantic grammar + */ + + block.pedantic = merge({}, block.normal, { + html: edit( + '^ *(?:comment *(?:\\n|\\s*$)' + + '|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)' // closed tag + + '|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))') + .replace('comment', block._comment) + .replace(/tag/g, '(?!(?:' + + 'a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub' + + '|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)' + + '\\b)\\w+(?!:|[^\\w\\s@]*@)\\b') + .getRegex(), + def: /^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/ + }); + + /** + * Block Lexer + */ + + function Lexer(options) { + this.tokens = []; + this.tokens.links = Object.create(null); + this.options = options || marked.defaults; + this.rules = block.normal; + + if (this.options.pedantic) { + this.rules = block.pedantic; + } else if (this.options.gfm) { + if (this.options.tables) { + this.rules = block.tables; + } else { + this.rules = block.gfm; + } + } + } + + /** + * Expose Block Rules + */ + + Lexer.rules = block; + + /** + * Static Lex Method + */ + + Lexer.lex = function(src, options) { + var lexer = new Lexer(options); + return lexer.lex(src); + }; + + /** + * Preprocessing + */ + + Lexer.prototype.lex = function(src) { + src = src + .replace(/\r\n|\r/g, '\n') + .replace(/\t/g, ' ') + .replace(/\u00a0/g, ' ') + .replace(/\u2424/g, '\n'); + + return this.token(src, true); + }; + + /** + * Lexing + */ + + Lexer.prototype.token = function(src, top) { + var this$1 = this; + + src = src.replace(/^ +$/gm, ''); + var next, + loose, + cap, + bull, + b, + item, + listStart, + listItems, + t, + space, + i, + tag, + l, + isordered, + istask, + ischecked; + + while (src) { + // newline + if (cap = this$1.rules.newline.exec(src)) { + src = src.substring(cap[0].length); + if (cap[0].length > 1) { this$1.tokens.push({ - type: 'blockquote_end' + type: 'space' }); - - continue; } - - // list - if (cap = this$1.rules.list.exec(src)) { + } + + // code + if (cap = this$1.rules.code.exec(src)) { + src = src.substring(cap[0].length); + cap = cap[0].replace(/^ {4}/gm, ''); + this$1.tokens.push({ + type: 'code', + text: !this$1.options.pedantic + ? rtrim(cap, '\n') + : cap + }); + continue; + } + + // fences (gfm) + if (cap = this$1.rules.fences.exec(src)) { + src = src.substring(cap[0].length); + this$1.tokens.push({ + type: 'code', + lang: cap[2], + text: cap[3] || '' + }); + continue; + } + + // heading + if (cap = this$1.rules.heading.exec(src)) { + src = src.substring(cap[0].length); + this$1.tokens.push({ + type: 'heading', + depth: cap[1].length, + text: cap[2] + }); + continue; + } + + // table no leading pipe (gfm) + if (top && (cap = this$1.rules.nptable.exec(src))) { + item = { + type: 'table', + header: splitCells(cap[1].replace(/^ *| *\| *$/g, '')), + align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */), + cells: cap[3] ? cap[3].replace(/\n$/, '').split('\n') : [] + }; + + if (item.header.length === item.align.length) { src = src.substring(cap[0].length); - bull = cap[2]; - isordered = bull.length > 1; - - listStart = { - type: 'list_start', - ordered: isordered, - start: isordered ? +bull : '', - loose: false - }; - - this$1.tokens.push(listStart); - - // Get each top-level item. - cap = cap[0].match(this$1.rules.item); - - listItems = []; - next = false; - l = cap.length; - i = 0; - - for (; i < l; i++) { - item = cap[i]; - - // Remove the list item's bullet - // so it is seen as the next token. - space = item.length; - item = item.replace(/^ *([*+-]|\d+\.) +/, ''); - - // Outdent whatever the - // list item contains. Hacky. - if (~item.indexOf('\n ')) { - space -= item.length; - item = !this$1.options.pedantic - ? item.replace(new RegExp('^ {1,' + space + '}', 'gm'), '') - : item.replace(/^ {1,4}/gm, ''); - } - - // Determine whether the next list item belongs here. - // Backpedal if it does not belong in this list. - if (this$1.options.smartLists && i !== l - 1) { - b = block.bullet.exec(cap[i + 1])[0]; - if (bull !== b && !(bull.length > 1 && b.length > 1)) { - src = cap.slice(i + 1).join('\n') + src; - i = l - 1; - } - } - - // Determine whether item is loose or not. - // Use: /(^|\n)(?! )[^\n]+\n\n(?!\s*$)/ - // for discount behavior. - loose = next || /\n\n(?!\s*$)/.test(item); - if (i !== l - 1) { - next = item.charAt(item.length - 1) === '\n'; - if (!loose) { loose = next; } - } - - if (loose) { - listStart.loose = true; - } - - // Check for task list items - istask = /^\[[ xX]\] /.test(item); - ischecked = undefined; - if (istask) { - ischecked = item[1] !== ' '; - item = item.replace(/^\[[ xX]\] +/, ''); + + for (i = 0; i < item.align.length; i++) { + if (/^ *-+: *$/.test(item.align[i])) { + item.align[i] = 'right'; + } else if (/^ *:-+: *$/.test(item.align[i])) { + item.align[i] = 'center'; + } else if (/^ *:-+ *$/.test(item.align[i])) { + item.align[i] = 'left'; + } else { + item.align[i] = null; } - - t = { - type: 'list_item_start', - task: istask, - checked: ischecked, - loose: loose - }; - - listItems.push(t); - this$1.tokens.push(t); - - // Recurse. - this$1.token(item, false); - - this$1.tokens.push({ - type: 'list_item_end' - }); } - - if (listStart.loose) { - l = listItems.length; - i = 0; - for (; i < l; i++) { - listItems[i].loose = true; - } + + for (i = 0; i < item.cells.length; i++) { + item.cells[i] = splitCells(item.cells[i], item.header.length); } - - this$1.tokens.push({ - type: 'list_end' - }); - + + this$1.tokens.push(item); + continue; } - - // html - if (cap = this$1.rules.html.exec(src)) { - src = src.substring(cap[0].length); + } + + // hr + if (cap = this$1.rules.hr.exec(src)) { + src = src.substring(cap[0].length); + this$1.tokens.push({ + type: 'hr' + }); + continue; + } + + // blockquote + if (cap = this$1.rules.blockquote.exec(src)) { + src = src.substring(cap[0].length); + + this$1.tokens.push({ + type: 'blockquote_start' + }); + + cap = cap[0].replace(/^ *> ?/gm, ''); + + // Pass `top` to keep the current + // "toplevel" state. This is exactly + // how markdown.pl works. + this$1.token(cap, top); + + this$1.tokens.push({ + type: 'blockquote_end' + }); + + continue; + } + + // list + if (cap = this$1.rules.list.exec(src)) { + src = src.substring(cap[0].length); + bull = cap[2]; + isordered = bull.length > 1; + + listStart = { + type: 'list_start', + ordered: isordered, + start: isordered ? +bull : '', + loose: false + }; + + this$1.tokens.push(listStart); + + // Get each top-level item. + cap = cap[0].match(this$1.rules.item); + + listItems = []; + next = false; + l = cap.length; + i = 0; + + for (; i < l; i++) { + item = cap[i]; + + // Remove the list item's bullet + // so it is seen as the next token. + space = item.length; + item = item.replace(/^ *([*+-]|\d+\.) +/, ''); + + // Outdent whatever the + // list item contains. Hacky. + if (~item.indexOf('\n ')) { + space -= item.length; + item = !this$1.options.pedantic + ? item.replace(new RegExp('^ {1,' + space + '}', 'gm'), '') + : item.replace(/^ {1,4}/gm, ''); + } + + // Determine whether the next list item belongs here. + // Backpedal if it does not belong in this list. + if (this$1.options.smartLists && i !== l - 1) { + b = block.bullet.exec(cap[i + 1])[0]; + if (bull !== b && !(bull.length > 1 && b.length > 1)) { + src = cap.slice(i + 1).join('\n') + src; + i = l - 1; + } + } + + // Determine whether item is loose or not. + // Use: /(^|\n)(?! )[^\n]+\n\n(?!\s*$)/ + // for discount behavior. + loose = next || /\n\n(?!\s*$)/.test(item); + if (i !== l - 1) { + next = item.charAt(item.length - 1) === '\n'; + if (!loose) { loose = next; } + } + + if (loose) { + listStart.loose = true; + } + + // Check for task list items + istask = /^\[[ xX]\] /.test(item); + ischecked = undefined; + if (istask) { + ischecked = item[1] !== ' '; + item = item.replace(/^\[[ xX]\] +/, ''); + } + + t = { + type: 'list_item_start', + task: istask, + checked: ischecked, + loose: loose + }; + + listItems.push(t); + this$1.tokens.push(t); + + // Recurse. + this$1.token(item, false); + this$1.tokens.push({ - type: this$1.options.sanitize - ? 'paragraph' - : 'html', - pre: !this$1.options.sanitizer - && (cap[1] === 'pre' || cap[1] === 'script' || cap[1] === 'style'), - text: cap[0] + type: 'list_item_end' }); - continue; } - - // def - if (top && (cap = this$1.rules.def.exec(src))) { - src = src.substring(cap[0].length); - if (cap[3]) { cap[3] = cap[3].substring(1, cap[3].length - 1); } - tag = cap[1].toLowerCase().replace(/\s+/g, ' '); - if (!this$1.tokens.links[tag]) { - this$1.tokens.links[tag] = { - href: cap[2], - title: cap[3] - }; + + if (listStart.loose) { + l = listItems.length; + i = 0; + for (; i < l; i++) { + listItems[i].loose = true; } - continue; } - - // table (gfm) - if (top && (cap = this$1.rules.table.exec(src))) { - item = { - type: 'table', - header: splitCells(cap[1].replace(/^ *| *\| *$/g, '')), - align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */), - cells: cap[3] ? cap[3].replace(/(?: *\| *)?\n$/, '').split('\n') : [] + + this$1.tokens.push({ + type: 'list_end' + }); + + continue; + } + + // html + if (cap = this$1.rules.html.exec(src)) { + src = src.substring(cap[0].length); + this$1.tokens.push({ + type: this$1.options.sanitize + ? 'paragraph' + : 'html', + pre: !this$1.options.sanitizer + && (cap[1] === 'pre' || cap[1] === 'script' || cap[1] === 'style'), + text: cap[0] + }); + continue; + } + + // def + if (top && (cap = this$1.rules.def.exec(src))) { + src = src.substring(cap[0].length); + if (cap[3]) { cap[3] = cap[3].substring(1, cap[3].length - 1); } + tag = cap[1].toLowerCase().replace(/\s+/g, ' '); + if (!this$1.tokens.links[tag]) { + this$1.tokens.links[tag] = { + href: cap[2], + title: cap[3] }; - - if (item.header.length === item.align.length) { - src = src.substring(cap[0].length); - - for (i = 0; i < item.align.length; i++) { - if (/^ *-+: *$/.test(item.align[i])) { - item.align[i] = 'right'; - } else if (/^ *:-+: *$/.test(item.align[i])) { - item.align[i] = 'center'; - } else if (/^ *:-+ *$/.test(item.align[i])) { - item.align[i] = 'left'; - } else { - item.align[i] = null; - } + } + continue; + } + + // table (gfm) + if (top && (cap = this$1.rules.table.exec(src))) { + item = { + type: 'table', + header: splitCells(cap[1].replace(/^ *| *\| *$/g, '')), + align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */), + cells: cap[3] ? cap[3].replace(/(?: *\| *)?\n$/, '').split('\n') : [] + }; + + if (item.header.length === item.align.length) { + src = src.substring(cap[0].length); + + for (i = 0; i < item.align.length; i++) { + if (/^ *-+: *$/.test(item.align[i])) { + item.align[i] = 'right'; + } else if (/^ *:-+: *$/.test(item.align[i])) { + item.align[i] = 'center'; + } else if (/^ *:-+ *$/.test(item.align[i])) { + item.align[i] = 'left'; + } else { + item.align[i] = null; } - - for (i = 0; i < item.cells.length; i++) { - item.cells[i] = splitCells( - item.cells[i].replace(/^ *\| *| *\| *$/g, ''), - item.header.length); - } - - this$1.tokens.push(item); - - continue; + } + + for (i = 0; i < item.cells.length; i++) { + item.cells[i] = splitCells( + item.cells[i].replace(/^ *\| *| *\| *$/g, ''), + item.header.length); } - } - - // lheading - if (cap = this$1.rules.lheading.exec(src)) { - src = src.substring(cap[0].length); - this$1.tokens.push({ - type: 'heading', - depth: cap[2] === '=' ? 1 : 2, - text: cap[1] - }); + + this$1.tokens.push(item); + continue; } - - // top-level paragraph - if (top && (cap = this$1.rules.paragraph.exec(src))) { - src = src.substring(cap[0].length); - this$1.tokens.push({ - type: 'paragraph', - text: cap[1].charAt(cap[1].length - 1) === '\n' - ? cap[1].slice(0, -1) - : cap[1] - }); - continue; - } - - // text - if (cap = this$1.rules.text.exec(src)) { - // Top-level should never reach here. - src = src.substring(cap[0].length); - this$1.tokens.push({ - type: 'text', - text: cap[0] - }); - continue; - } - - if (src) { - throw new Error('Infinite loop on byte: ' + src.charCodeAt(0)); - } + } + + // lheading + if (cap = this$1.rules.lheading.exec(src)) { + src = src.substring(cap[0].length); + this$1.tokens.push({ + type: 'heading', + depth: cap[2] === '=' ? 1 : 2, + text: cap[1] + }); + continue; + } + + // top-level paragraph + if (top && (cap = this$1.rules.paragraph.exec(src))) { + src = src.substring(cap[0].length); + this$1.tokens.push({ + type: 'paragraph', + text: cap[1].charAt(cap[1].length - 1) === '\n' + ? cap[1].slice(0, -1) + : cap[1] + }); + continue; + } + + // text + if (cap = this$1.rules.text.exec(src)) { + // Top-level should never reach here. + src = src.substring(cap[0].length); + this$1.tokens.push({ + type: 'text', + text: cap[0] + }); + continue; + } + + if (src) { + throw new Error('Infinite loop on byte: ' + src.charCodeAt(0)); } - - return this.tokens; - }; - - /** - * Inline-Level Grammar - */ - - var inline = { - escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, - autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/, - url: noop, - tag: '^comment' - + '|^' // self-closing tag - + '|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>' // open tag - + '|^<\\?[\\s\\S]*?\\?>' // processing instruction, e.g. - + '|^' // declaration, e.g. - + '|^', // CDATA section - link: /^!?\[(label)\]\(href(?:\s+(title))?\s*\)/, - reflink: /^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/, - nolink: /^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/, - strong: /^__([^\s])__(?!_)|^\*\*([^\s])\*\*(?!\*)|^__([^\s][\s\S]*?[^\s])__(?!_)|^\*\*([^\s][\s\S]*?[^\s])\*\*(?!\*)/, - em: /^_([^\s_])_(?!_)|^\*([^\s*"<\[])\*(?!\*)|^_([^\s][\s\S]*?[^\s_])_(?!_)|^_([^\s_][\s\S]*?[^\s])_(?!_)|^\*([^\s"<\[][\s\S]*?[^\s*])\*(?!\*)|^\*([^\s*"<\[][\s\S]*?[^\s])\*(?!\*)/, - code: /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, - br: /^( {2,}|\\)\n(?!\s*$)/, - del: noop, - text: /^(`+|[^`])[\s\S]*?(?=[\\?@\[\]\\^_`{|}~])/g; - - inline._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/; - inline._email = /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/; - inline.autolink = edit(inline.autolink) - .replace('scheme', inline._scheme) - .replace('email', inline._email) - .getRegex(); - - inline._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/; - - inline.tag = edit(inline.tag) - .replace('comment', block._comment) - .replace('attribute', inline._attribute) - .getRegex(); - - inline._label = /(?:\[[^\[\]]*\]|\\[\[\]]?|`[^`]*`|[^\[\]\\])*?/; - inline._href = /\s*(<(?:\\[<>]?|[^\s<>\\])*>|(?:\\[()]?|\([^\s\x00-\x1f\\]*\)|[^\s\x00-\x1f()\\])*?)/; - inline._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/; - - inline.link = edit(inline.link) + } + + return this.tokens; + }; + + /** + * Inline-Level Grammar + */ + + var inline = { + escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, + autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/, + url: noop, + tag: '^comment' + + '|^' // self-closing tag + + '|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>' // open tag + + '|^<\\?[\\s\\S]*?\\?>' // processing instruction, e.g. + + '|^' // declaration, e.g. + + '|^', // CDATA section + link: /^!?\[(label)\]\(href(?:\s+(title))?\s*\)/, + reflink: /^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/, + nolink: /^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/, + strong: /^__([^\s])__(?!_)|^\*\*([^\s])\*\*(?!\*)|^__([^\s][\s\S]*?[^\s])__(?!_)|^\*\*([^\s][\s\S]*?[^\s])\*\*(?!\*)/, + em: /^_([^\s_])_(?!_)|^\*([^\s*"<\[])\*(?!\*)|^_([^\s][\s\S]*?[^\s_])_(?!_)|^_([^\s_][\s\S]*?[^\s])_(?!_)|^\*([^\s"<\[][\s\S]*?[^\s*])\*(?!\*)|^\*([^\s*"<\[][\s\S]*?[^\s])\*(?!\*)/, + code: /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, + br: /^( {2,}|\\)\n(?!\s*$)/, + del: noop, + text: /^(`+|[^`])[\s\S]*?(?=[\\?@\[\]\\^_`{|}~])/g; + + inline._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/; + inline._email = /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/; + inline.autolink = edit(inline.autolink) + .replace('scheme', inline._scheme) + .replace('email', inline._email) + .getRegex(); + + inline._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/; + + inline.tag = edit(inline.tag) + .replace('comment', block._comment) + .replace('attribute', inline._attribute) + .getRegex(); + + inline._label = /(?:\[[^\[\]]*\]|\\[\[\]]?|`[^`]*`|[^\[\]\\])*?/; + inline._href = /\s*(<(?:\\[<>]?|[^\s<>\\])*>|(?:\\[()]?|\([^\s\x00-\x1f\\]*\)|[^\s\x00-\x1f()\\])*?)/; + inline._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/; + + inline.link = edit(inline.link) + .replace('label', inline._label) + .replace('href', inline._href) + .replace('title', inline._title) + .getRegex(); + + inline.reflink = edit(inline.reflink) + .replace('label', inline._label) + .getRegex(); + + /** + * Normal Inline Grammar + */ + + inline.normal = merge({}, inline); + + /** + * Pedantic Inline Grammar + */ + + inline.pedantic = merge({}, inline.normal, { + strong: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/, + em: /^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/, + link: edit(/^!?\[(label)\]\((.*?)\)/) .replace('label', inline._label) - .replace('href', inline._href) - .replace('title', inline._title) - .getRegex(); - - inline.reflink = edit(inline.reflink) + .getRegex(), + reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/) .replace('label', inline._label) - .getRegex(); - - /** - * Normal Inline Grammar - */ - - inline.normal = merge({}, inline); - - /** - * Pedantic Inline Grammar - */ - - inline.pedantic = merge({}, inline.normal, { - strong: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/, - em: /^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/, - link: edit(/^!?\[(label)\]\((.*?)\)/) - .replace('label', inline._label) - .getRegex(), - reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/) - .replace('label', inline._label) - .getRegex() - }); - - /** - * GFM Inline Grammar - */ - - inline.gfm = merge({}, inline.normal, { - escape: edit(inline.escape).replace('])', '~|])').getRegex(), - _extended_email: /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/, - url: /^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, - _backpedal: /(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/, - del: /^~+(?=\S)([\s\S]*?\S)~+/, - text: edit(inline.text) - .replace(']|', '~]|') - .replace('|$', '|https?://|ftp://|www\\.|[a-zA-Z0-9.!#$%&\'*+/=?^_`{\\|}~-]+@|$') - .getRegex() - }); - - inline.gfm.url = edit(inline.gfm.url) - .replace('email', inline.gfm._extended_email) - .getRegex(); - /** - * GFM + Line Breaks Inline Grammar - */ - - inline.breaks = merge({}, inline.gfm, { - br: edit(inline.br).replace('{2,}', '*').getRegex(), - text: edit(inline.gfm.text).replace('{2,}', '*').getRegex() - }); - - /** - * Inline Lexer & Compiler - */ - - function InlineLexer(links, options) { - this.options = options || marked.defaults; - this.links = links; - this.rules = inline.normal; - this.renderer = this.options.renderer || new Renderer(); - this.renderer.options = this.options; - - if (!this.links) { - throw new Error('Tokens array requires a `links` property.'); + .getRegex() + }); + + /** + * GFM Inline Grammar + */ + + inline.gfm = merge({}, inline.normal, { + escape: edit(inline.escape).replace('])', '~|])').getRegex(), + _extended_email: /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/, + url: /^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, + _backpedal: /(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/, + del: /^~+(?=\S)([\s\S]*?\S)~+/, + text: edit(inline.text) + .replace(']|', '~]|') + .replace('|$', '|https?://|ftp://|www\\.|[a-zA-Z0-9.!#$%&\'*+/=?^_`{\\|}~-]+@|$') + .getRegex() + }); + + inline.gfm.url = edit(inline.gfm.url) + .replace('email', inline.gfm._extended_email) + .getRegex(); + /** + * GFM + Line Breaks Inline Grammar + */ + + inline.breaks = merge({}, inline.gfm, { + br: edit(inline.br).replace('{2,}', '*').getRegex(), + text: edit(inline.gfm.text).replace('{2,}', '*').getRegex() + }); + + /** + * Inline Lexer & Compiler + */ + + function InlineLexer(links, options) { + this.options = options || marked.defaults; + this.links = links; + this.rules = inline.normal; + this.renderer = this.options.renderer || new Renderer(); + this.renderer.options = this.options; + + if (!this.links) { + throw new Error('Tokens array requires a `links` property.'); + } + + if (this.options.pedantic) { + this.rules = inline.pedantic; + } else if (this.options.gfm) { + if (this.options.breaks) { + this.rules = inline.breaks; + } else { + this.rules = inline.gfm; + } + } + } + + /** + * Expose Inline Rules + */ + + InlineLexer.rules = inline; + + /** + * Static Lexing/Compiling Method + */ + + InlineLexer.output = function(src, links, options) { + var inline = new InlineLexer(links, options); + return inline.output(src); + }; + + /** + * Lexing/Compiling + */ + + InlineLexer.prototype.output = function(src) { + var this$1 = this; + + var out = '', + link, + text, + href, + title, + cap, + prevCapZero; + + while (src) { + // escape + if (cap = this$1.rules.escape.exec(src)) { + src = src.substring(cap[0].length); + out += cap[1]; + continue; } - - if (this.options.pedantic) { - this.rules = inline.pedantic; - } else if (this.options.gfm) { - if (this.options.breaks) { - this.rules = inline.breaks; + + // autolink + if (cap = this$1.rules.autolink.exec(src)) { + src = src.substring(cap[0].length); + if (cap[2] === '@') { + text = escape(this$1.mangle(cap[1])); + href = 'mailto:' + text; } else { - this.rules = inline.gfm; + text = escape(cap[1]); + href = text; } + out += this$1.renderer.link(href, null, text); + continue; } - } - - /** - * Expose Inline Rules - */ - - InlineLexer.rules = inline; - - /** - * Static Lexing/Compiling Method - */ - - InlineLexer.output = function(src, links, options) { - var inline = new InlineLexer(links, options); - return inline.output(src); - }; - - /** - * Lexing/Compiling - */ - - InlineLexer.prototype.output = function(src) { - var this$1 = this; - - var out = '', - link, - text, - href, - title, - cap, - prevCapZero; - - while (src) { - // escape - if (cap = this$1.rules.escape.exec(src)) { - src = src.substring(cap[0].length); - out += cap[1]; - continue; - } - - // autolink - if (cap = this$1.rules.autolink.exec(src)) { - src = src.substring(cap[0].length); - if (cap[2] === '@') { - text = escape(this$1.mangle(cap[1])); - href = 'mailto:' + text; + + // url (gfm) + if (!this$1.inLink && (cap = this$1.rules.url.exec(src))) { + if (cap[2] === '@') { + text = escape(cap[0]); + href = 'mailto:' + text; + } else { + // do extended autolink path validation + do { + prevCapZero = cap[0]; + cap[0] = this$1.rules._backpedal.exec(cap[0])[0]; + } while (prevCapZero !== cap[0]); + text = escape(cap[0]); + if (cap[1] === 'www.') { + href = 'http://' + text; } else { - text = escape(cap[1]); href = text; } - out += this$1.renderer.link(href, null, text); - continue; - } - - // url (gfm) - if (!this$1.inLink && (cap = this$1.rules.url.exec(src))) { - if (cap[2] === '@') { - text = escape(cap[0]); - href = 'mailto:' + text; - } else { - // do extended autolink path validation - do { - prevCapZero = cap[0]; - cap[0] = this$1.rules._backpedal.exec(cap[0])[0]; - } while (prevCapZero !== cap[0]); - text = escape(cap[0]); - if (cap[1] === 'www.') { - href = 'http://' + text; - } else { - href = text; - } - } - src = src.substring(cap[0].length); - out += this$1.renderer.link(href, null, text); - continue; - } - - // tag - if (cap = this$1.rules.tag.exec(src)) { - if (!this$1.inLink && /^/i.test(cap[0])) { - this$1.inLink = false; - } - if (!this$1.inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(cap[0])) { - this$1.inRawBlock = true; - } else if (this$1.inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(cap[0])) { - this$1.inRawBlock = false; - } - - src = src.substring(cap[0].length); - out += this$1.options.sanitize - ? this$1.options.sanitizer - ? this$1.options.sanitizer(cap[0]) - : escape(cap[0]) - : cap[0]; - continue; - } - - // link - if (cap = this$1.rules.link.exec(src)) { - src = src.substring(cap[0].length); - this$1.inLink = true; - href = cap[2]; - if (this$1.options.pedantic) { - link = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(href); - - if (link) { - href = link[1]; - title = link[3]; - } else { - title = ''; - } - } else { - title = cap[3] ? cap[3].slice(1, -1) : ''; - } - href = href.trim().replace(/^<([\s\S]*)>$/, '$1'); - out += this$1.outputLink(cap, { - href: InlineLexer.escapes(href), - title: InlineLexer.escapes(title) - }); - this$1.inLink = false; - continue; - } - - // reflink, nolink - if ((cap = this$1.rules.reflink.exec(src)) - || (cap = this$1.rules.nolink.exec(src))) { - src = src.substring(cap[0].length); - link = (cap[2] || cap[1]).replace(/\s+/g, ' '); - link = this$1.links[link.toLowerCase()]; - if (!link || !link.href) { - out += cap[0].charAt(0); - src = cap[0].substring(1) + src; - continue; - } - this$1.inLink = true; - out += this$1.outputLink(cap, link); - this$1.inLink = false; - continue; - } - - // strong - if (cap = this$1.rules.strong.exec(src)) { - src = src.substring(cap[0].length); - out += this$1.renderer.strong(this$1.output(cap[4] || cap[3] || cap[2] || cap[1])); - continue; - } - - // em - if (cap = this$1.rules.em.exec(src)) { - src = src.substring(cap[0].length); - out += this$1.renderer.em(this$1.output(cap[6] || cap[5] || cap[4] || cap[3] || cap[2] || cap[1])); - continue; - } - - // code - if (cap = this$1.rules.code.exec(src)) { - src = src.substring(cap[0].length); - out += this$1.renderer.codespan(escape(cap[2].trim(), true)); - continue; - } - - // br - if (cap = this$1.rules.br.exec(src)) { - src = src.substring(cap[0].length); - out += this$1.renderer.br(); - continue; - } - - // del (gfm) - if (cap = this$1.rules.del.exec(src)) { - src = src.substring(cap[0].length); - out += this$1.renderer.del(this$1.output(cap[1])); - continue; - } - - // text - if (cap = this$1.rules.text.exec(src)) { - src = src.substring(cap[0].length); - if (this$1.inRawBlock) { - out += this$1.renderer.text(cap[0]); - } else { - out += this$1.renderer.text(escape(this$1.smartypants(cap[0]))); - } - continue; - } - - if (src) { - throw new Error('Infinite loop on byte: ' + src.charCodeAt(0)); } + src = src.substring(cap[0].length); + out += this$1.renderer.link(href, null, text); + continue; } - - return out; - }; - - InlineLexer.escapes = function(text) { - return text ? text.replace(InlineLexer.rules._escapes, '$1') : text; - }; - - /** - * Compile Link - */ - - InlineLexer.prototype.outputLink = function(cap, link) { - var href = link.href, - title = link.title ? escape(link.title) : null; - - return cap[0].charAt(0) !== '!' - ? this.renderer.link(href, title, this.output(cap[1])) - : this.renderer.image(href, title, escape(cap[1])); - }; - - /** - * Smartypants Transformations - */ - - InlineLexer.prototype.smartypants = function(text) { - if (!this.options.smartypants) { return text; } - return text - // em-dashes - .replace(/---/g, '\u2014') - // en-dashes - .replace(/--/g, '\u2013') - // opening singles - .replace(/(^|[-\u2014/(\[{"\s])'/g, '$1\u2018') - // closing singles & apostrophes - .replace(/'/g, '\u2019') - // opening doubles - .replace(/(^|[-\u2014/(\[{\u2018\s])"/g, '$1\u201c') - // closing doubles - .replace(/"/g, '\u201d') - // ellipses - .replace(/\.{3}/g, '\u2026'); - }; - - /** - * Mangle Links - */ - - InlineLexer.prototype.mangle = function(text) { - if (!this.options.mangle) { return text; } - var out = '', - l = text.length, - i = 0, - ch; - - for (; i < l; i++) { - ch = text.charCodeAt(i); - if (Math.random() > 0.5) { - ch = 'x' + ch.toString(16); + + // tag + if (cap = this$1.rules.tag.exec(src)) { + if (!this$1.inLink && /^/i.test(cap[0])) { + this$1.inLink = false; } - out += '&#' + ch + ';'; + if (!this$1.inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(cap[0])) { + this$1.inRawBlock = true; + } else if (this$1.inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(cap[0])) { + this$1.inRawBlock = false; + } + + src = src.substring(cap[0].length); + out += this$1.options.sanitize + ? this$1.options.sanitizer + ? this$1.options.sanitizer(cap[0]) + : escape(cap[0]) + : cap[0]; + continue; + } + + // link + if (cap = this$1.rules.link.exec(src)) { + src = src.substring(cap[0].length); + this$1.inLink = true; + href = cap[2]; + if (this$1.options.pedantic) { + link = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(href); + + if (link) { + href = link[1]; + title = link[3]; + } else { + title = ''; + } + } else { + title = cap[3] ? cap[3].slice(1, -1) : ''; + } + href = href.trim().replace(/^<([\s\S]*)>$/, '$1'); + out += this$1.outputLink(cap, { + href: InlineLexer.escapes(href), + title: InlineLexer.escapes(title) + }); + this$1.inLink = false; + continue; + } + + // reflink, nolink + if ((cap = this$1.rules.reflink.exec(src)) + || (cap = this$1.rules.nolink.exec(src))) { + src = src.substring(cap[0].length); + link = (cap[2] || cap[1]).replace(/\s+/g, ' '); + link = this$1.links[link.toLowerCase()]; + if (!link || !link.href) { + out += cap[0].charAt(0); + src = cap[0].substring(1) + src; + continue; + } + this$1.inLink = true; + out += this$1.outputLink(cap, link); + this$1.inLink = false; + continue; + } + + // strong + if (cap = this$1.rules.strong.exec(src)) { + src = src.substring(cap[0].length); + out += this$1.renderer.strong(this$1.output(cap[4] || cap[3] || cap[2] || cap[1])); + continue; + } + + // em + if (cap = this$1.rules.em.exec(src)) { + src = src.substring(cap[0].length); + out += this$1.renderer.em(this$1.output(cap[6] || cap[5] || cap[4] || cap[3] || cap[2] || cap[1])); + continue; + } + + // code + if (cap = this$1.rules.code.exec(src)) { + src = src.substring(cap[0].length); + out += this$1.renderer.codespan(escape(cap[2].trim(), true)); + continue; + } + + // br + if (cap = this$1.rules.br.exec(src)) { + src = src.substring(cap[0].length); + out += this$1.renderer.br(); + continue; + } + + // del (gfm) + if (cap = this$1.rules.del.exec(src)) { + src = src.substring(cap[0].length); + out += this$1.renderer.del(this$1.output(cap[1])); + continue; + } + + // text + if (cap = this$1.rules.text.exec(src)) { + src = src.substring(cap[0].length); + if (this$1.inRawBlock) { + out += this$1.renderer.text(cap[0]); + } else { + out += this$1.renderer.text(escape(this$1.smartypants(cap[0]))); + } + continue; + } + + if (src) { + throw new Error('Infinite loop on byte: ' + src.charCodeAt(0)); } - - return out; - }; - - /** - * Renderer - */ - - function Renderer(options) { - this.options = options || marked.defaults; } - - Renderer.prototype.code = function(code, lang, escaped) { - if (this.options.highlight) { - var out = this.options.highlight(code, lang); - if (out != null && out !== code) { - escaped = true; - code = out; - } + + return out; + }; + + InlineLexer.escapes = function(text) { + return text ? text.replace(InlineLexer.rules._escapes, '$1') : text; + }; + + /** + * Compile Link + */ + + InlineLexer.prototype.outputLink = function(cap, link) { + var href = link.href, + title = link.title ? escape(link.title) : null; + + return cap[0].charAt(0) !== '!' + ? this.renderer.link(href, title, this.output(cap[1])) + : this.renderer.image(href, title, escape(cap[1])); + }; + + /** + * Smartypants Transformations + */ + + InlineLexer.prototype.smartypants = function(text) { + if (!this.options.smartypants) { return text; } + return text + // em-dashes + .replace(/---/g, '\u2014') + // en-dashes + .replace(/--/g, '\u2013') + // opening singles + .replace(/(^|[-\u2014/(\[{"\s])'/g, '$1\u2018') + // closing singles & apostrophes + .replace(/'/g, '\u2019') + // opening doubles + .replace(/(^|[-\u2014/(\[{\u2018\s])"/g, '$1\u201c') + // closing doubles + .replace(/"/g, '\u201d') + // ellipses + .replace(/\.{3}/g, '\u2026'); + }; + + /** + * Mangle Links + */ + + InlineLexer.prototype.mangle = function(text) { + if (!this.options.mangle) { return text; } + var out = '', + l = text.length, + i = 0, + ch; + + for (; i < l; i++) { + ch = text.charCodeAt(i); + if (Math.random() > 0.5) { + ch = 'x' + ch.toString(16); } - - if (!lang) { - return '
    '
    -          + (escaped ? code : escape(code, true))
    -          + '
    '; + out += '&#' + ch + ';'; + } + + return out; + }; + + /** + * Renderer + */ + + function Renderer(options) { + this.options = options || marked.defaults; + } + + Renderer.prototype.code = function(code, lang, escaped) { + if (this.options.highlight) { + var out = this.options.highlight(code, lang); + if (out != null && out !== code) { + escaped = true; + code = out; } - - return '
    '
    +    }
    +  
    +    if (!lang) {
    +      return '
    '
             + (escaped ? code : escape(code, true))
    -        + '
    \n'; - }; - - Renderer.prototype.blockquote = function(quote) { - return '
    \n' + quote + '
    \n'; - }; - - Renderer.prototype.html = function(html) { - return html; - }; - - Renderer.prototype.heading = function(text, level, raw) { - if (this.options.headerIds) { - return '' - + text - + '\n'; - } - // ignore IDs - return '' + text + '\n'; - }; - - Renderer.prototype.hr = function() { - return this.options.xhtml ? '
    \n' : '
    \n'; - }; - - Renderer.prototype.list = function(body, ordered, start) { - var type = ordered ? 'ol' : 'ul', - startatt = (ordered && start !== 1) ? (' start="' + start + '"') : ''; - return '<' + type + startatt + '>\n' + body + '\n'; - }; - - Renderer.prototype.listitem = function(text) { - return '
  • ' + text + '
  • \n'; - }; - - Renderer.prototype.checkbox = function(checked) { - return ' '; - }; - - Renderer.prototype.paragraph = function(text) { - return '

    ' + text + '

    \n'; - }; - - Renderer.prototype.table = function(header, body) { - if (body) { body = '' + body + ''; } - - return '\n' - + '\n' - + header - + '\n' - + body - + '
    \n'; - }; - - Renderer.prototype.tablerow = function(content) { - return '\n' + content + '\n'; - }; - - Renderer.prototype.tablecell = function(content, flags) { - var type = flags.header ? 'th' : 'td'; - var tag = flags.align - ? '<' + type + ' align="' + flags.align + '">' - : '<' + type + '>'; - return tag + content + '\n'; - }; - - // span level renderer - Renderer.prototype.strong = function(text) { - return '' + text + ''; - }; - - Renderer.prototype.em = function(text) { - return '' + text + ''; - }; - - Renderer.prototype.codespan = function(text) { - return '' + text + ''; - }; - - Renderer.prototype.br = function() { - return this.options.xhtml ? '
    ' : '
    '; - }; - - Renderer.prototype.del = function(text) { - return '' + text + ''; - }; - - Renderer.prototype.link = function(href, title, text) { - if (this.options.sanitize) { - try { - var prot = decodeURIComponent(unescape(href)) - .replace(/[^\w:]/g, '') - .toLowerCase(); - } catch (e) { - return text; - } - if (prot.indexOf('javascript:') === 0 || prot.indexOf('vbscript:') === 0 || prot.indexOf('data:') === 0) { - return text; - } - } - if (this.options.baseUrl && !originIndependentUrl.test(href)) { - href = resolveUrl(this.options.baseUrl, href); - } + + '
    '; + } + + return '
    '
    +      + (escaped ? code : escape(code, true))
    +      + '
    \n'; + }; + + Renderer.prototype.blockquote = function(quote) { + return '
    \n' + quote + '
    \n'; + }; + + Renderer.prototype.html = function(html) { + return html; + }; + + Renderer.prototype.heading = function(text, level, raw) { + if (this.options.headerIds) { + return '' + + text + + '\n'; + } + // ignore IDs + return '' + text + '\n'; + }; + + Renderer.prototype.hr = function() { + return this.options.xhtml ? '
    \n' : '
    \n'; + }; + + Renderer.prototype.list = function(body, ordered, start) { + var type = ordered ? 'ol' : 'ul', + startatt = (ordered && start !== 1) ? (' start="' + start + '"') : ''; + return '<' + type + startatt + '>\n' + body + '\n'; + }; + + Renderer.prototype.listitem = function(text) { + return '
  • ' + text + '
  • \n'; + }; + + Renderer.prototype.checkbox = function(checked) { + return ' '; + }; + + Renderer.prototype.paragraph = function(text) { + return '

    ' + text + '

    \n'; + }; + + Renderer.prototype.table = function(header, body) { + if (body) { body = '' + body + ''; } + + return '\n' + + '\n' + + header + + '\n' + + body + + '
    \n'; + }; + + Renderer.prototype.tablerow = function(content) { + return '\n' + content + '\n'; + }; + + Renderer.prototype.tablecell = function(content, flags) { + var type = flags.header ? 'th' : 'td'; + var tag = flags.align + ? '<' + type + ' align="' + flags.align + '">' + : '<' + type + '>'; + return tag + content + '\n'; + }; + + // span level renderer + Renderer.prototype.strong = function(text) { + return '' + text + ''; + }; + + Renderer.prototype.em = function(text) { + return '' + text + ''; + }; + + Renderer.prototype.codespan = function(text) { + return '' + text + ''; + }; + + Renderer.prototype.br = function() { + return this.options.xhtml ? '
    ' : '
    '; + }; + + Renderer.prototype.del = function(text) { + return '' + text + ''; + }; + + Renderer.prototype.link = function(href, title, text) { + if (this.options.sanitize) { try { - href = encodeURI(href).replace(/%25/g, '%'); + var prot = decodeURIComponent(unescape(href)) + .replace(/[^\w:]/g, '') + .toLowerCase(); } catch (e) { return text; } - var out = '
    '; - return out; - }; - - Renderer.prototype.image = function(href, title, text) { - if (this.options.baseUrl && !originIndependentUrl.test(href)) { - href = resolveUrl(this.options.baseUrl, href); - } - var out = '' + text + '' : '>'; - return out; - }; - - Renderer.prototype.text = function(text) { - return text; - }; - - /** - * TextRenderer - * returns only the textual part of the token - */ - - function TextRenderer() {} - - // no need for block level renderers - - TextRenderer.prototype.strong = - TextRenderer.prototype.em = - TextRenderer.prototype.codespan = - TextRenderer.prototype.del = - TextRenderer.prototype.text = function (text) { - return text; - }; - - TextRenderer.prototype.link = - TextRenderer.prototype.image = function(href, title, text) { - return '' + text; - }; - - TextRenderer.prototype.br = function() { - return ''; - }; - - /** - * Parsing & Compiling - */ - - function Parser(options) { - this.tokens = []; - this.token = null; - this.options = options || marked.defaults; - this.options.renderer = this.options.renderer || new Renderer(); - this.renderer = this.options.renderer; - this.renderer.options = this.options; } - - /** - * Static Parse Method - */ - - Parser.parse = function(src, options) { - var parser = new Parser(options); - return parser.parse(src); - }; - - /** - * Parse Loop - */ - - Parser.prototype.parse = function(src) { - var this$1 = this; - - this.inline = new InlineLexer(src.links, this.options); - // use an InlineLexer with a TextRenderer to extract pure text - this.inlineText = new InlineLexer( - src.links, - merge({}, this.options, {renderer: new TextRenderer()}) - ); - this.tokens = src.reverse(); - - var out = ''; - while (this.next()) { - out += this$1.tok(); + if (this.options.baseUrl && !originIndependentUrl.test(href)) { + href = resolveUrl(this.options.baseUrl, href); + } + try { + href = encodeURI(href).replace(/%25/g, '%'); + } catch (e) { + return text; + } + var out = ''; + return out; + }; + + Renderer.prototype.image = function(href, title, text) { + if (this.options.baseUrl && !originIndependentUrl.test(href)) { + href = resolveUrl(this.options.baseUrl, href); + } + var out = '' + text + '' : '>'; + return out; + }; + + Renderer.prototype.text = function(text) { + return text; + }; + + /** + * TextRenderer + * returns only the textual part of the token + */ + + function TextRenderer() {} + + // no need for block level renderers + + TextRenderer.prototype.strong = + TextRenderer.prototype.em = + TextRenderer.prototype.codespan = + TextRenderer.prototype.del = + TextRenderer.prototype.text = function (text) { + return text; + }; + + TextRenderer.prototype.link = + TextRenderer.prototype.image = function(href, title, text) { + return '' + text; + }; + + TextRenderer.prototype.br = function() { + return ''; + }; + + /** + * Parsing & Compiling + */ + + function Parser(options) { + this.tokens = []; + this.token = null; + this.options = options || marked.defaults; + this.options.renderer = this.options.renderer || new Renderer(); + this.renderer = this.options.renderer; + this.renderer.options = this.options; + } + + /** + * Static Parse Method + */ + + Parser.parse = function(src, options) { + var parser = new Parser(options); + return parser.parse(src); + }; + + /** + * Parse Loop + */ + + Parser.prototype.parse = function(src) { + var this$1 = this; + + this.inline = new InlineLexer(src.links, this.options); + // use an InlineLexer with a TextRenderer to extract pure text + this.inlineText = new InlineLexer( + src.links, + merge({}, this.options, {renderer: new TextRenderer()}) + ); + this.tokens = src.reverse(); + + var out = ''; + while (this.next()) { + out += this$1.tok(); + } + + return out; + }; + + /** + * Next Token + */ + + Parser.prototype.next = function() { + return this.token = this.tokens.pop(); + }; + + /** + * Preview Next Token + */ + + Parser.prototype.peek = function() { + return this.tokens[this.tokens.length - 1] || 0; + }; + + /** + * Parse Text Tokens + */ + + Parser.prototype.parseText = function() { + var this$1 = this; + + var body = this.token.text; + + while (this.peek().type === 'text') { + body += '\n' + this$1.next().text; + } + + return this.inline.output(body); + }; + + /** + * Parse Current Token + */ + + Parser.prototype.tok = function() { + var this$1 = this; + + switch (this.token.type) { + case 'space': { + return ''; } - - return out; - }; - - /** - * Next Token - */ - - Parser.prototype.next = function() { - return this.token = this.tokens.pop(); - }; - - /** - * Preview Next Token - */ - - Parser.prototype.peek = function() { - return this.tokens[this.tokens.length - 1] || 0; - }; - - /** - * Parse Text Tokens - */ - - Parser.prototype.parseText = function() { - var this$1 = this; - - var body = this.token.text; - - while (this.peek().type === 'text') { - body += '\n' + this$1.next().text; + case 'hr': { + return this.renderer.hr(); } - - return this.inline.output(body); - }; - - /** - * Parse Current Token - */ - - Parser.prototype.tok = function() { - var this$1 = this; - - switch (this.token.type) { - case 'space': { - return ''; + case 'heading': { + return this.renderer.heading( + this.inline.output(this.token.text), + this.token.depth, + unescape(this.inlineText.output(this.token.text))); + } + case 'code': { + return this.renderer.code(this.token.text, + this.token.lang, + this.token.escaped); + } + case 'table': { + var header = '', + body = '', + i, + row, + cell, + j; + + // header + cell = ''; + for (i = 0; i < this.token.header.length; i++) { + cell += this$1.renderer.tablecell( + this$1.inline.output(this$1.token.header[i]), + { header: true, align: this$1.token.align[i] } + ); } - case 'hr': { - return this.renderer.hr(); - } - case 'heading': { - return this.renderer.heading( - this.inline.output(this.token.text), - this.token.depth, - unescape(this.inlineText.output(this.token.text))); - } - case 'code': { - return this.renderer.code(this.token.text, - this.token.lang, - this.token.escaped); - } - case 'table': { - var header = '', - body = '', - i, - row, - cell, - j; - - // header + header += this.renderer.tablerow(cell); + + for (i = 0; i < this.token.cells.length; i++) { + row = this$1.token.cells[i]; + cell = ''; - for (i = 0; i < this.token.header.length; i++) { + for (j = 0; j < row.length; j++) { cell += this$1.renderer.tablecell( - this$1.inline.output(this$1.token.header[i]), - { header: true, align: this$1.token.align[i] } + this$1.inline.output(row[j]), + { header: false, align: this$1.token.align[j] } ); } - header += this.renderer.tablerow(cell); - - for (i = 0; i < this.token.cells.length; i++) { - row = this$1.token.cells[i]; - - cell = ''; - for (j = 0; j < row.length; j++) { - cell += this$1.renderer.tablecell( - this$1.inline.output(row[j]), - { header: false, align: this$1.token.align[j] } - ); - } - - body += this$1.renderer.tablerow(cell); - } - return this.renderer.table(header, body); + + body += this$1.renderer.tablerow(cell); } - case 'blockquote_start': { - body = ''; - - while (this.next().type !== 'blockquote_end') { - body += this$1.tok(); - } - - return this.renderer.blockquote(body); + return this.renderer.table(header, body); + } + case 'blockquote_start': { + body = ''; + + while (this.next().type !== 'blockquote_end') { + body += this$1.tok(); } - case 'list_start': { - body = ''; - var ordered = this.token.ordered, - start = this.token.start; - - while (this.next().type !== 'list_end') { - body += this$1.tok(); - } - - return this.renderer.list(body, ordered, start); + + return this.renderer.blockquote(body); + } + case 'list_start': { + body = ''; + var ordered = this.token.ordered, + start = this.token.start; + + while (this.next().type !== 'list_end') { + body += this$1.tok(); } - case 'list_item_start': { - body = ''; - var loose = this.token.loose; - - if (this.token.task) { - body += this.renderer.checkbox(this.token.checked); - } - - while (this.next().type !== 'list_item_end') { - body += !loose && this$1.token.type === 'text' - ? this$1.parseText() - : this$1.tok(); - } - - return this.renderer.listitem(body); + + return this.renderer.list(body, ordered, start); + } + case 'list_item_start': { + body = ''; + var loose = this.token.loose; + + if (this.token.task) { + body += this.renderer.checkbox(this.token.checked); } - case 'html': { - // TODO parse inline content if parameter markdown=1 - return this.renderer.html(this.token.text); - } - case 'paragraph': { - return this.renderer.paragraph(this.inline.output(this.token.text)); - } - case 'text': { - return this.renderer.paragraph(this.parseText()); + + while (this.next().type !== 'list_item_end') { + body += !loose && this$1.token.type === 'text' + ? this$1.parseText() + : this$1.tok(); } + + return this.renderer.listitem(body); + } + case 'html': { + // TODO parse inline content if parameter markdown=1 + return this.renderer.html(this.token.text); + } + case 'paragraph': { + return this.renderer.paragraph(this.inline.output(this.token.text)); + } + case 'text': { + return this.renderer.paragraph(this.parseText()); + } + } + }; + + /** + * Helpers + */ + + function escape(html, encode) { + if (encode) { + if (escape.escapeTest.test(html)) { + return html.replace(escape.escapeReplace, function (ch) { return escape.replacements[ch] }); + } + } else { + if (escape.escapeTestNoEncode.test(html)) { + return html.replace(escape.escapeReplaceNoEncode, function (ch) { return escape.replacements[ch] }); + } + } + + return html; + } + + escape.escapeTest = /[&<>"']/; + escape.escapeReplace = /[&<>"']/g; + escape.replacements = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''' + }; + + escape.escapeTestNoEncode = /[<>"']|&(?!#?\w+;)/; + escape.escapeReplaceNoEncode = /[<>"']|&(?!#?\w+;)/g; + + function unescape(html) { + // explicitly match decimal, hex, and named HTML entities + return html.replace(/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig, function(_, n) { + n = n.toLowerCase(); + if (n === 'colon') { return ':'; } + if (n.charAt(0) === '#') { + return n.charAt(1) === 'x' + ? String.fromCharCode(parseInt(n.substring(2), 16)) + : String.fromCharCode(+n.substring(1)); + } + return ''; + }); + } + + function edit(regex, opt) { + regex = regex.source || regex; + opt = opt || ''; + return { + replace: function(name, val) { + val = val.source || val; + val = val.replace(/(^|[^\[])\^/g, '$1'); + regex = regex.replace(name, val); + return this; + }, + getRegex: function() { + return new RegExp(regex, opt); } }; - - /** - * Helpers - */ - - function escape(html, encode) { - if (encode) { - if (escape.escapeTest.test(html)) { - return html.replace(escape.escapeReplace, function (ch) { return escape.replacements[ch] }); - } + } + + function resolveUrl(base, href) { + if (!baseUrls[' ' + base]) { + // we can ignore everything in base after the last slash of its path component, + // but we might need to add _that_ + // https://tools.ietf.org/html/rfc3986#section-3 + if (/^[^:]+:\/*[^/]*$/.test(base)) { + baseUrls[' ' + base] = base + '/'; } else { - if (escape.escapeTestNoEncode.test(html)) { - return html.replace(escape.escapeReplaceNoEncode, function (ch) { return escape.replacements[ch] }); - } - } - - return html; - } - - escape.escapeTest = /[&<>"']/; - escape.escapeReplace = /[&<>"']/g; - escape.replacements = { - '&': '&', - '<': '<', - '>': '>', - '"': '"', - "'": ''' - }; - - escape.escapeTestNoEncode = /[<>"']|&(?!#?\w+;)/; - escape.escapeReplaceNoEncode = /[<>"']|&(?!#?\w+;)/g; - - function unescape(html) { - // explicitly match decimal, hex, and named HTML entities - return html.replace(/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig, function(_, n) { - n = n.toLowerCase(); - if (n === 'colon') { return ':'; } - if (n.charAt(0) === '#') { - return n.charAt(1) === 'x' - ? String.fromCharCode(parseInt(n.substring(2), 16)) - : String.fromCharCode(+n.substring(1)); - } - return ''; - }); - } - - function edit(regex, opt) { - regex = regex.source || regex; - opt = opt || ''; - return { - replace: function(name, val) { - val = val.source || val; - val = val.replace(/(^|[^\[])\^/g, '$1'); - regex = regex.replace(name, val); - return this; - }, - getRegex: function() { - return new RegExp(regex, opt); - } - }; - } - - function resolveUrl(base, href) { - if (!baseUrls[' ' + base]) { - // we can ignore everything in base after the last slash of its path component, - // but we might need to add _that_ - // https://tools.ietf.org/html/rfc3986#section-3 - if (/^[^:]+:\/*[^/]*$/.test(base)) { - baseUrls[' ' + base] = base + '/'; - } else { - baseUrls[' ' + base] = rtrim(base, '/', true); - } - } - base = baseUrls[' ' + base]; - - if (href.slice(0, 2) === '//') { - return base.replace(/:[\s\S]*/, ':') + href; - } else if (href.charAt(0) === '/') { - return base.replace(/(:\/*[^/]*)[\s\S]*/, '$1') + href; - } else { - return base + href; + baseUrls[' ' + base] = rtrim(base, '/', true); } } - var baseUrls = {}; - var originIndependentUrl = /^$|^[a-z][a-z0-9+.-]*:|^[?#]/i; - - function noop() {} - noop.exec = noop; - - function merge(obj) { - var arguments$1 = arguments; - - var i = 1, - target, - key; - - for (; i < arguments.length; i++) { - target = arguments$1[i]; - for (key in target) { - if (Object.prototype.hasOwnProperty.call(target, key)) { - obj[key] = target[key]; + base = baseUrls[' ' + base]; + + if (href.slice(0, 2) === '//') { + return base.replace(/:[\s\S]*/, ':') + href; + } else if (href.charAt(0) === '/') { + return base.replace(/(:\/*[^/]*)[\s\S]*/, '$1') + href; + } else { + return base + href; + } + } + var baseUrls = {}; + var originIndependentUrl = /^$|^[a-z][a-z0-9+.-]*:|^[?#]/i; + + function noop() {} + noop.exec = noop; + + function merge(obj) { + var arguments$1 = arguments; + + var i = 1, + target, + key; + + for (; i < arguments.length; i++) { + target = arguments$1[i]; + for (key in target) { + if (Object.prototype.hasOwnProperty.call(target, key)) { + obj[key] = target[key]; + } + } + } + + return obj; + } + + function splitCells(tableRow, count) { + // ensure that every cell-delimiting pipe has a space + // before it to distinguish it from an escaped pipe + var row = tableRow.replace(/\|/g, function (match, offset, str) { + var escaped = false, + curr = offset; + while (--curr >= 0 && str[curr] === '\\') { escaped = !escaped; } + if (escaped) { + // odd number of slashes means | is escaped + // so we leave it alone + return '|'; + } else { + // add space before unescaped | + return ' |'; } - } - } - - return obj; + }), + cells = row.split(/ \|/), + i = 0; + + if (cells.length > count) { + cells.splice(count); + } else { + while (cells.length < count) { cells.push(''); } } - - function splitCells(tableRow, count) { - // ensure that every cell-delimiting pipe has a space - // before it to distinguish it from an escaped pipe - var row = tableRow.replace(/\|/g, function (match, offset, str) { - var escaped = false, - curr = offset; - while (--curr >= 0 && str[curr] === '\\') { escaped = !escaped; } - if (escaped) { - // odd number of slashes means | is escaped - // so we leave it alone - return '|'; - } else { - // add space before unescaped | - return ' |'; - } - }), - cells = row.split(/ \|/), + + for (; i < cells.length; i++) { + // leading or trailing whitespace is ignored per the gfm spec + cells[i] = cells[i].trim().replace(/\\\|/g, '|'); + } + return cells; + } + + // Remove trailing 'c's. Equivalent to str.replace(/c*$/, ''). + // /c*$/ is vulnerable to REDOS. + // invert: Remove suffix of non-c chars instead. Default falsey. + function rtrim(str, c, invert) { + if (str.length === 0) { + return ''; + } + + // Length of suffix matching the invert condition. + var suffLen = 0; + + // Step left until we fail to match the invert condition. + while (suffLen < str.length) { + var currChar = str.charAt(str.length - suffLen - 1); + if (currChar === c && !invert) { + suffLen++; + } else if (currChar !== c && invert) { + suffLen++; + } else { + break; + } + } + + return str.substr(0, str.length - suffLen); + } + + /** + * Marked + */ + + function marked(src, opt, callback) { + // throw error in case of non string input + if (typeof src === 'undefined' || src === null) { + throw new Error('marked(): input parameter is undefined or null'); + } + if (typeof src !== 'string') { + throw new Error('marked(): input parameter is of type ' + + Object.prototype.toString.call(src) + ', string expected'); + } + + if (callback || typeof opt === 'function') { + if (!callback) { + callback = opt; + opt = null; + } + + opt = merge({}, marked.defaults, opt || {}); + + var highlight = opt.highlight, + tokens, + pending, i = 0; - - if (cells.length > count) { - cells.splice(count); - } else { - while (cells.length < count) { cells.push(''); } + + try { + tokens = Lexer.lex(src, opt); + } catch (e) { + return callback(e); } - - for (; i < cells.length; i++) { - // leading or trailing whitespace is ignored per the gfm spec - cells[i] = cells[i].trim().replace(/\\\|/g, '|'); - } - return cells; - } - - // Remove trailing 'c's. Equivalent to str.replace(/c*$/, ''). - // /c*$/ is vulnerable to REDOS. - // invert: Remove suffix of non-c chars instead. Default falsey. - function rtrim(str, c, invert) { - if (str.length === 0) { - return ''; - } - - // Length of suffix matching the invert condition. - var suffLen = 0; - - // Step left until we fail to match the invert condition. - while (suffLen < str.length) { - var currChar = str.charAt(str.length - suffLen - 1); - if (currChar === c && !invert) { - suffLen++; - } else if (currChar !== c && invert) { - suffLen++; - } else { - break; - } - } - - return str.substr(0, str.length - suffLen); - } - - /** - * Marked - */ - - function marked(src, opt, callback) { - // throw error in case of non string input - if (typeof src === 'undefined' || src === null) { - throw new Error('marked(): input parameter is undefined or null'); - } - if (typeof src !== 'string') { - throw new Error('marked(): input parameter is of type ' - + Object.prototype.toString.call(src) + ', string expected'); - } - - if (callback || typeof opt === 'function') { - if (!callback) { - callback = opt; - opt = null; - } - - opt = merge({}, marked.defaults, opt || {}); - - var highlight = opt.highlight, - tokens, - pending, - i = 0; - - try { - tokens = Lexer.lex(src, opt); - } catch (e) { - return callback(e); - } - - pending = tokens.length; - - var done = function(err) { - if (err) { - opt.highlight = highlight; - return callback(err); - } - - var out; - - try { - out = Parser.parse(tokens, opt); - } catch (e) { - err = e; - } - + + pending = tokens.length; + + var done = function(err) { + if (err) { opt.highlight = highlight; - - return err - ? callback(err) - : callback(null, out); - }; - - if (!highlight || highlight.length < 3) { - return done(); + return callback(err); } - - delete opt.highlight; - - if (!pending) { return done(); } - - for (; i < tokens.length; i++) { - (function(token) { - if (token.type !== 'code') { + + var out; + + try { + out = Parser.parse(tokens, opt); + } catch (e) { + err = e; + } + + opt.highlight = highlight; + + return err + ? callback(err) + : callback(null, out); + }; + + if (!highlight || highlight.length < 3) { + return done(); + } + + delete opt.highlight; + + if (!pending) { return done(); } + + for (; i < tokens.length; i++) { + (function(token) { + if (token.type !== 'code') { + return --pending || done(); + } + return highlight(token.text, token.lang, function(err, code) { + if (err) { return done(err); } + if (code == null || code === token.text) { return --pending || done(); } - return highlight(token.text, token.lang, function(err, code) { - if (err) { return done(err); } - if (code == null || code === token.text) { - return --pending || done(); + token.text = code; + token.escaped = true; + --pending || done(); + }); + })(tokens[i]); + } + + return; + } + try { + if (opt) { opt = merge({}, marked.defaults, opt); } + return Parser.parse(Lexer.lex(src, opt), opt); + } catch (e) { + e.message += '\nPlease report this to https://github.com/markedjs/marked.'; + if ((opt || marked.defaults).silent) { + return '

    An error occurred:

    '
    +          + escape(e.message + '', true)
    +          + '
    '; + } + throw e; + } + } + + /** + * Options + */ + + marked.options = + marked.setOptions = function(opt) { + merge(marked.defaults, opt); + return marked; + }; + + marked.getDefaults = function () { + return { + baseUrl: null, + breaks: false, + gfm: true, + headerIds: true, + headerPrefix: '', + highlight: null, + langPrefix: 'language-', + mangle: true, + pedantic: false, + renderer: new Renderer(), + sanitize: false, + sanitizer: null, + silent: false, + smartLists: false, + smartypants: false, + tables: true, + xhtml: false + }; + }; + + marked.defaults = marked.getDefaults(); + + /** + * Expose + */ + + marked.Parser = Parser; + marked.parser = Parser.parse; + + marked.Renderer = Renderer; + marked.TextRenderer = TextRenderer; + + marked.Lexer = Lexer; + marked.lexer = Lexer.lex; + + marked.InlineLexer = InlineLexer; + marked.inlineLexer = InlineLexer.output; + + marked.parse = marked; + + { + module.exports = marked; + } + })(commonjsGlobal || (typeof window !== 'undefined' ? window : commonjsGlobal)); + }); + + var prism = createCommonjsModule(function (module) { + /* ********************************************** + Begin prism-core.js + ********************************************** */ + + var _self = (typeof window !== 'undefined') + ? window // if in browser + : ( + (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) + ? self // if in worker + : {} // if in node js + ); + + /** + * Prism: Lightweight, robust, elegant syntax highlighting + * MIT license http://www.opensource.org/licenses/mit-license.php/ + * @author Lea Verou http://lea.verou.me + */ + + var Prism = (function(){ + + // Private helper vars + var lang = /\blang(?:uage)?-([\w-]+)\b/i; + var uniqueId = 0; + + var _ = _self.Prism = { + manual: _self.Prism && _self.Prism.manual, + disableWorkerMessageHandler: _self.Prism && _self.Prism.disableWorkerMessageHandler, + util: { + encode: function (tokens) { + if (tokens instanceof Token) { + return new Token(tokens.type, _.util.encode(tokens.content), tokens.alias); + } else if (_.util.type(tokens) === 'Array') { + return tokens.map(_.util.encode); + } else { + return tokens.replace(/&/g, '&').replace(/ text.length) { + // Something went terribly wrong, ABORT, ABORT! + return; + } + + if (str instanceof Token) { + continue; + } + + if (greedy && i != strarr.length - 1) { + pattern.lastIndex = pos; + var match = pattern.exec(text); + if (!match) { + break; + } + + var from = match.index + (lookbehind ? match[1].length : 0), + to = match.index + match[0].length, + k = i, + p = pos; + + for (var len = strarr.length; k < len && (p < to || (!strarr[k].type && !strarr[k - 1].greedy)); ++k) { + p += strarr[k].length; + // Move the index i to the element in strarr that is closest to from + if (from >= p) { + ++i; + pos = p; + } + } + + // If strarr[i] is a Token, then the match starts inside another Token, which is invalid + if (strarr[i] instanceof Token) { + continue; + } + + // Number of tokens to delete and replace with the new match + delNum = k - i; + str = text.slice(pos, p); + match.index -= pos; + } else { + pattern.lastIndex = 0; + + var match = pattern.exec(str), + delNum = 1; + } + + if (!match) { + if (oneshot) { + break; + } + + continue; + } + + if(lookbehind) { + lookbehindLength = match[1] ? match[1].length : 0; + } + + var from = match.index + lookbehindLength, + match = match[0].slice(lookbehindLength), + to = from + match.length, + before = str.slice(0, from), + after = str.slice(to); + + var args = [i, delNum]; + + if (before) { + ++i; + pos += before.length; + args.push(before); + } + + var wrapped = new Token(token, inside? _.tokenize(match, inside) : match, alias, match, greedy); + + args.push(wrapped); + + if (after) { + args.push(after); + } + + Array.prototype.splice.apply(strarr, args); + + if (delNum != 1) + { _.matchGrammar(text, strarr, grammar, i, pos, true, token); } + + if (oneshot) + { break; } + } + } + } + }, + + tokenize: function(text, grammar, language) { + var strarr = [text]; + + var rest = grammar.rest; + + if (rest) { + for (var token in rest) { + grammar[token] = rest[token]; + } + + delete grammar.rest; + } + + _.matchGrammar(text, strarr, grammar, 0, 0, false); + + return strarr; + }, + + hooks: { + all: {}, + + add: function (name, callback) { + var hooks = _.hooks.all; + + hooks[name] = hooks[name] || []; + + hooks[name].push(callback); + }, + + run: function (name, env) { + var callbacks = _.hooks.all[name]; + + if (!callbacks || !callbacks.length) { + return; + } + + for (var i=0, callback; callback = callbacks[i++];) { + callback(env); + } + } } - try { - if (opt) { opt = merge({}, marked.defaults, opt); } - return Parser.parse(Lexer.lex(src, opt), opt); - } catch (e) { - e.message += '\nPlease report this to https://github.com/markedjs/marked.'; - if ((opt || marked.defaults).silent) { - return '

    An error occurred:

    '
    -            + escape(e.message + '', true)
    -            + '
    '; - } - throw e; + }; + + var Token = _.Token = function(type, content, alias, matchedStr, greedy) { + this.type = type; + this.content = content; + this.alias = alias; + // Copy of the full string this token was created from + this.length = (matchedStr || "").length|0; + this.greedy = !!greedy; + }; + + Token.stringify = function(o, language, parent) { + if (typeof o == 'string') { + return o; } - } - - /** - * Options - */ - - marked.options = - marked.setOptions = function(opt) { - merge(marked.defaults, opt); - return marked; - }; - - marked.getDefaults = function () { - return { - baseUrl: null, - breaks: false, - gfm: true, - headerIds: true, - headerPrefix: '', - highlight: null, - langPrefix: 'language-', - mangle: true, - pedantic: false, - renderer: new Renderer(), - sanitize: false, - sanitizer: null, - silent: false, - smartLists: false, - smartypants: false, - tables: true, - xhtml: false + + if (_.util.type(o) === 'Array') { + return o.map(function(element) { + return Token.stringify(element, language, o); + }).join(''); + } + + var env = { + type: o.type, + content: Token.stringify(o.content, language, parent), + tag: 'span', + classes: ['token', o.type], + attributes: {}, + language: language, + parent: parent }; - }; - - marked.defaults = marked.getDefaults(); - - /** - * Expose - */ - - marked.Parser = Parser; - marked.parser = Parser.parse; - - marked.Renderer = Renderer; - marked.TextRenderer = TextRenderer; - - marked.Lexer = Lexer; - marked.lexer = Lexer.lex; - - marked.InlineLexer = InlineLexer; - marked.inlineLexer = InlineLexer.output; - - marked.parse = marked; - - { - module.exports = marked; - } - })(commonjsGlobal || (typeof window !== 'undefined' ? window : commonjsGlobal)); - }); - - var prism = createCommonjsModule(function (module) { - /* ********************************************** - Begin prism-core.js - ********************************************** */ - - var _self = (typeof window !== 'undefined') - ? window // if in browser - : ( - (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) - ? self // if in worker - : {} // if in node js - ); - - /** - * Prism: Lightweight, robust, elegant syntax highlighting - * MIT license http://www.opensource.org/licenses/mit-license.php/ - * @author Lea Verou http://lea.verou.me - */ - - var Prism = (function(){ - - // Private helper vars - var lang = /\blang(?:uage)?-([\w-]+)\b/i; - var uniqueId = 0; - - var _ = _self.Prism = { - manual: _self.Prism && _self.Prism.manual, - disableWorkerMessageHandler: _self.Prism && _self.Prism.disableWorkerMessageHandler, - util: { - encode: function (tokens) { - if (tokens instanceof Token) { - return new Token(tokens.type, _.util.encode(tokens.content), tokens.alias); - } else if (_.util.type(tokens) === 'Array') { - return tokens.map(_.util.encode); - } else { - return tokens.replace(/&/g, '&').replace(/ text.length) { - // Something went terribly wrong, ABORT, ABORT! - return; - } - - if (str instanceof Token) { - continue; - } - - if (greedy && i != strarr.length - 1) { - pattern.lastIndex = pos; - var match = pattern.exec(text); - if (!match) { - break; - } - - var from = match.index + (lookbehind ? match[1].length : 0), - to = match.index + match[0].length, - k = i, - p = pos; - - for (var len = strarr.length; k < len && (p < to || (!strarr[k].type && !strarr[k - 1].greedy)); ++k) { - p += strarr[k].length; - // Move the index i to the element in strarr that is closest to from - if (from >= p) { - ++i; - pos = p; - } - } - - // If strarr[i] is a Token, then the match starts inside another Token, which is invalid - if (strarr[i] instanceof Token) { - continue; - } - - // Number of tokens to delete and replace with the new match - delNum = k - i; - str = text.slice(pos, p); - match.index -= pos; - } else { - pattern.lastIndex = 0; - - var match = pattern.exec(str), - delNum = 1; - } - - if (!match) { - if (oneshot) { - break; - } - - continue; - } - - if(lookbehind) { - lookbehindLength = match[1] ? match[1].length : 0; - } - - var from = match.index + lookbehindLength, - match = match[0].slice(lookbehindLength), - to = from + match.length, - before = str.slice(0, from), - after = str.slice(to); - - var args = [i, delNum]; - - if (before) { - ++i; - pos += before.length; - args.push(before); - } - - var wrapped = new Token(token, inside? _.tokenize(match, inside) : match, alias, match, greedy); - - args.push(wrapped); - - if (after) { - args.push(after); - } - - Array.prototype.splice.apply(strarr, args); - - if (delNum != 1) - { _.matchGrammar(text, strarr, grammar, i, pos, true, token); } - - if (oneshot) - { break; } - } - } - } - }, - - tokenize: function(text, grammar, language) { - var strarr = [text]; - - var rest = grammar.rest; - - if (rest) { - for (var token in rest) { - grammar[token] = rest[token]; - } - - delete grammar.rest; - } - - _.matchGrammar(text, strarr, grammar, 0, 0, false); - - return strarr; - }, - - hooks: { - all: {}, - - add: function (name, callback) { - var hooks = _.hooks.all; - - hooks[name] = hooks[name] || []; - - hooks[name].push(callback); - }, - - run: function (name, env) { - var callbacks = _.hooks.all[name]; - - if (!callbacks || !callbacks.length) { - return; - } - - for (var i=0, callback; callback = callbacks[i++];) { - callback(env); - } - } - } - }; - - var Token = _.Token = function(type, content, alias, matchedStr, greedy) { - this.type = type; - this.content = content; - this.alias = alias; - // Copy of the full string this token was created from - this.length = (matchedStr || "").length|0; - this.greedy = !!greedy; - }; - - Token.stringify = function(o, language, parent) { - if (typeof o == 'string') { - return o; - } - - if (_.util.type(o) === 'Array') { - return o.map(function(element) { - return Token.stringify(element, language, o); - }).join(''); - } - - var env = { - type: o.type, - content: Token.stringify(o.content, language, parent), - tag: 'span', - classes: ['token', o.type], - attributes: {}, - language: language, - parent: parent - }; - - if (o.alias) { - var aliases = _.util.type(o.alias) === 'Array' ? o.alias : [o.alias]; - Array.prototype.push.apply(env.classes, aliases); - } - - _.hooks.run('wrap', env); - - var attributes = Object.keys(env.attributes).map(function(name) { - return name + '="' + (env.attributes[name] || '').replace(/"/g, '"') + '"'; - }).join(' '); - - return '<' + env.tag + ' class="' + env.classes.join(' ') + '"' + (attributes ? ' ' + attributes : '') + '>' + env.content + ''; - - }; - - if (!_self.document) { - if (!_self.addEventListener) { - // in Node.js - return _self.Prism; - } - - if (!_.disableWorkerMessageHandler) { - // In worker - _self.addEventListener('message', function (evt) { - var message = JSON.parse(evt.data), - lang = message.language, - code = message.code, - immediateClose = message.immediateClose; - - _self.postMessage(_.highlight(code, _.languages[lang], lang)); - if (immediateClose) { - _self.close(); - } - }, false); - } - - return _self.Prism; - } - - //Get current script and highlight - var script = document.currentScript || [].slice.call(document.getElementsByTagName("script")).pop(); - - if (script) { - _.filename = script.src; - - if (!_.manual && !script.hasAttribute('data-manual')) { - if(document.readyState !== "loading") { - if (window.requestAnimationFrame) { - window.requestAnimationFrame(_.highlightAll); - } else { - window.setTimeout(_.highlightAll, 16); - } - } - else { - document.addEventListener('DOMContentLoaded', _.highlightAll); - } - } - } - - return _self.Prism; - - })(); - - if ('object' !== 'undefined' && module.exports) { - module.exports = Prism; - } - - // hack for components to work correctly in node.js - if (typeof commonjsGlobal !== 'undefined') { - commonjsGlobal.Prism = Prism; - } - - - /* ********************************************** - Begin prism-markup.js - ********************************************** */ - - Prism.languages.markup = { - 'comment': //, - 'prolog': /<\?[\s\S]+?\?>/, - 'doctype': //i, - 'cdata': //i, - 'tag': { - pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+))?)*\s*\/?>/i, - greedy: true, - inside: { - 'tag': { - pattern: /^<\/?[^\s>\/]+/i, - inside: { - 'punctuation': /^<\/?/, - 'namespace': /^[^\s>\/:]+:/ - } - }, - 'attr-value': { - pattern: /=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+)/i, - inside: { - 'punctuation': [ - /^=/, - { - pattern: /(^|[^\\])["']/, - lookbehind: true - } - ] - } - }, - 'punctuation': /\/?>/, - 'attr-name': { - pattern: /[^\s>\/]+/, - inside: { - 'namespace': /^[^\s>\/:]+:/ - } - } - - } - }, - 'entity': /&#?[\da-z]{1,8};/i - }; - - Prism.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 - Prism.hooks.add('wrap', function(env) { - - if (env.type === 'entity') { - env.attributes['title'] = env.content.replace(/&/, '&'); - } - }); - - Prism.languages.xml = Prism.languages.markup; - Prism.languages.html = Prism.languages.markup; - Prism.languages.mathml = Prism.languages.markup; - Prism.languages.svg = Prism.languages.markup; - - - /* ********************************************** - Begin prism-css.js - ********************************************** */ - - Prism.languages.css = { - 'comment': /\/\*[\s\S]*?\*\//, - 'atrule': { - pattern: /@[\w-]+?.*?(?:;|(?=\s*\{))/i, - inside: { - 'rule': /@[\w-]+/ - // See rest below - } - }, - 'url': /url\((?:(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1|.*?)\)/i, - 'selector': /[^{}\s][^{};]*?(?=\s*\{)/, - 'string': { - pattern: /("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/, - greedy: true - }, - 'property': /[-_a-z\xA0-\uFFFF][-\w\xA0-\uFFFF]*(?=\s*:)/i, - 'important': /\B!important\b/i, - 'function': /[-a-z0-9]+(?=\()/i, - 'punctuation': /[(){};:]/ - }; - - Prism.languages.css['atrule'].inside.rest = Prism.languages.css; - - if (Prism.languages.markup) { - Prism.languages.insertBefore('markup', 'tag', { - 'style': { - pattern: /()[\s\S]*?(?=<\/style>)/i, - lookbehind: true, - inside: Prism.languages.css, - alias: 'language-css', - greedy: true - } - }); - - Prism.languages.insertBefore('inside', 'attr-value', { - 'style-attr': { - pattern: /\s*style=("|')(?:\\[\s\S]|(?!\1)[^\\])*\1/i, - inside: { - 'attr-name': { - pattern: /^\s*style/i, - inside: Prism.languages.markup.tag.inside - }, - 'punctuation': /^\s*=\s*['"]|['"]\s*$/, - 'attr-value': { - pattern: /.+/i, - inside: Prism.languages.css - } - }, - alias: 'language-css' - } - }, Prism.languages.markup.tag); - } - - /* ********************************************** - Begin prism-clike.js - ********************************************** */ - - Prism.languages.clike = { - 'comment': [ - { - pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/, - lookbehind: true - }, - { - pattern: /(^|[^\\:])\/\/.*/, - lookbehind: true, - greedy: true - } - ], - 'string': { - pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/, - greedy: true - }, - 'class-name': { - pattern: /((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[\w.\\]+/i, - lookbehind: true, - inside: { - punctuation: /[.\\]/ - } - }, - 'keyword': /\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/, - 'boolean': /\b(?:true|false)\b/, - 'function': /[a-z0-9_]+(?=\()/i, - 'number': /\b0x[\da-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?/i, - 'operator': /--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/, - 'punctuation': /[{}[\];(),.:]/ - }; - - - /* ********************************************** - Begin prism-javascript.js - ********************************************** */ - - Prism.languages.javascript = Prism.languages.extend('clike', { - 'keyword': /\b(?: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|var|void|while|with|yield)\b/, - 'number': /\b(?:0[xX][\dA-Fa-f]+|0[bB][01]+|0[oO][0-7]+|NaN|Infinity)\b|(?:\b\d+\.?\d*|\B\.\d+)(?:[Ee][+-]?\d+)?/, - // Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444) - 'function': /[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*\()/i, - 'operator': /-[-=]?|\+[+=]?|!=?=?|<>?>?=?|=(?:==?|>)?|&[&=]?|\|[|=]?|\*\*?=?|\/=?|~|\^=?|%=?|\?|\.{3}/ - }); - - Prism.languages.insertBefore('javascript', 'keyword', { - 'regex': { - pattern: /((?:^|[^$\w\xA0-\uFFFF."'\])\s])\s*)\/(\[[^\]\r\n]+]|\\.|[^/\\\[\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})\]]))/, - lookbehind: true, - greedy: true - }, - // This must be declared before keyword because we use "function" inside the look-forward - 'function-variable': { - pattern: /[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*=\s*(?:function\b|(?:\([^()]*\)|[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)\s*=>))/i, - alias: 'function' - }, - 'constant': /\b[A-Z][A-Z\d_]*\b/ - }); - - Prism.languages.insertBefore('javascript', 'string', { - 'template-string': { - pattern: /`(?:\\[\s\S]|\${[^}]+}|[^\\`])*`/, - greedy: true, - inside: { - 'interpolation': { - pattern: /\${[^}]+}/, - inside: { - 'interpolation-punctuation': { - pattern: /^\${|}$/, - alias: 'punctuation' - }, - rest: null // See below - } - }, - 'string': /[\s\S]+/ - } - } - }); - Prism.languages.javascript['template-string'].inside['interpolation'].inside.rest = Prism.languages.javascript; - - if (Prism.languages.markup) { - Prism.languages.insertBefore('markup', 'tag', { - 'script': { - pattern: /()[\s\S]*?(?=<\/script>)/i, - lookbehind: true, - inside: Prism.languages.javascript, - alias: 'language-javascript', - greedy: true - } - }); - } - - Prism.languages.js = Prism.languages.javascript; - - - /* ********************************************** - Begin prism-file-highlight.js - ********************************************** */ - - (function () { - if (typeof self === 'undefined' || !self.Prism || !self.document || !document.querySelector) { - return; - } - - self.Prism.fileHighlight = function() { - - var Extensions = { - 'js': 'javascript', - 'py': 'python', - 'rb': 'ruby', - 'ps1': 'powershell', - 'psm1': 'powershell', - 'sh': 'bash', - 'bat': 'batch', - 'h': 'c', - 'tex': 'latex' - }; - - Array.prototype.slice.call(document.querySelectorAll('pre[data-src]')).forEach(function (pre) { - var src = pre.getAttribute('data-src'); - - var language, parent = pre; - var lang = /\blang(?:uage)?-([\w-]+)\b/i; - while (parent && !lang.test(parent.className)) { - parent = parent.parentNode; - } - - if (parent) { - language = (pre.className.match(lang) || [, ''])[1]; - } - - if (!language) { - var extension = (src.match(/\.(\w+)$/) || [, ''])[1]; - language = Extensions[extension] || extension; - } - - var code = document.createElement('code'); - code.className = 'language-' + language; - - pre.textContent = ''; - - code.textContent = 'Loading…'; - - pre.appendChild(code); - - var xhr = new XMLHttpRequest(); - - xhr.open('GET', src, true); - - xhr.onreadystatechange = function () { - if (xhr.readyState == 4) { - - if (xhr.status < 400 && xhr.responseText) { - code.textContent = xhr.responseText; - - Prism.highlightElement(code); - } - else if (xhr.status >= 400) { - code.textContent = '✖ Error ' + xhr.status + ' while fetching file: ' + xhr.statusText; - } - else { - code.textContent = '✖ Error: File does not exist or is empty'; - } - } - }; - - xhr.send(null); - }); - - if (Prism.plugins.toolbar) { - Prism.plugins.toolbar.registerButton('download-file', function (env) { - var pre = env.element.parentNode; - if (!pre || !/pre/i.test(pre.nodeName) || !pre.hasAttribute('data-src') || !pre.hasAttribute('data-download-link')) { - return; - } - var src = pre.getAttribute('data-src'); - var a = document.createElement('a'); - a.textContent = pre.getAttribute('data-download-link-label') || 'Download'; - a.setAttribute('download', ''); - a.href = src; - return a; - }); - } - - }; - - document.addEventListener('DOMContentLoaded', self.Prism.fileHighlight); - - })(); - }); - - /** - * Gen toc tree - * @link https://github.com/killercup/grock/blob/5280ae63e16c5739e9233d9009bc235ed7d79a50/styles/solarized/assets/js/behavior.coffee#L54-L81 - * @param {Array} toc - * @param {Number} maxLevel - * @return {Array} - */ - function genTree(toc, maxLevel) { - var headlines = []; - var last = {}; - - toc.forEach(function (headline) { - var level = headline.level || 1; - var len = level - 1; - - if (level > maxLevel) { - return - } - if (last[len]) { - last[len].children = (last[len].children || []).concat(headline); - } else { - headlines.push(headline); - } - last[level] = headline; + + if (o.alias) { + var aliases = _.util.type(o.alias) === 'Array' ? o.alias : [o.alias]; + Array.prototype.push.apply(env.classes, aliases); + } + + _.hooks.run('wrap', env); + + var attributes = Object.keys(env.attributes).map(function(name) { + return name + '="' + (env.attributes[name] || '').replace(/"/g, '"') + '"'; + }).join(' '); + + return '<' + env.tag + ' class="' + env.classes.join(' ') + '"' + (attributes ? ' ' + attributes : '') + '>' + env.content + ''; + + }; + + if (!_self.document) { + if (!_self.addEventListener) { + // in Node.js + return _self.Prism; + } + + if (!_.disableWorkerMessageHandler) { + // In worker + _self.addEventListener('message', function (evt) { + var message = JSON.parse(evt.data), + lang = message.language, + code = message.code, + immediateClose = message.immediateClose; + + _self.postMessage(_.highlight(code, _.languages[lang], lang)); + if (immediateClose) { + _self.close(); + } + }, false); + } + + return _self.Prism; + } + + //Get current script and highlight + var script = document.currentScript || [].slice.call(document.getElementsByTagName("script")).pop(); + + if (script) { + _.filename = script.src; + + if (!_.manual && !script.hasAttribute('data-manual')) { + if(document.readyState !== "loading") { + if (window.requestAnimationFrame) { + window.requestAnimationFrame(_.highlightAll); + } else { + window.setTimeout(_.highlightAll, 16); + } + } + else { + document.addEventListener('DOMContentLoaded', _.highlightAll); + } + } + } + + return _self.Prism; + + })(); + + if ('object' !== 'undefined' && module.exports) { + module.exports = Prism; + } + + // hack for components to work correctly in node.js + if (typeof commonjsGlobal !== 'undefined') { + commonjsGlobal.Prism = Prism; + } + + + /* ********************************************** + Begin prism-markup.js + ********************************************** */ + + Prism.languages.markup = { + 'comment': //, + 'prolog': /<\?[\s\S]+?\?>/, + 'doctype': //i, + 'cdata': //i, + 'tag': { + pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+))?)*\s*\/?>/i, + greedy: true, + inside: { + 'tag': { + pattern: /^<\/?[^\s>\/]+/i, + inside: { + 'punctuation': /^<\/?/, + 'namespace': /^[^\s>\/:]+:/ + } + }, + 'attr-value': { + pattern: /=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+)/i, + inside: { + 'punctuation': [ + /^=/, + { + pattern: /(^|[^\\])["']/, + lookbehind: true + } + ] + } + }, + 'punctuation': /\/?>/, + 'attr-name': { + pattern: /[^\s>\/]+/, + inside: { + 'namespace': /^[^\s>\/:]+:/ + } + } + + } + }, + 'entity': /&#?[\da-z]{1,8};/i + }; + + Prism.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 + Prism.hooks.add('wrap', function(env) { + + if (env.type === 'entity') { + env.attributes['title'] = env.content.replace(/&/, '&'); + } + }); + + Prism.languages.xml = Prism.languages.markup; + Prism.languages.html = Prism.languages.markup; + Prism.languages.mathml = Prism.languages.markup; + Prism.languages.svg = Prism.languages.markup; + + + /* ********************************************** + Begin prism-css.js + ********************************************** */ + + Prism.languages.css = { + 'comment': /\/\*[\s\S]*?\*\//, + 'atrule': { + pattern: /@[\w-]+?.*?(?:;|(?=\s*\{))/i, + inside: { + 'rule': /@[\w-]+/ + // See rest below + } + }, + 'url': /url\((?:(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1|.*?)\)/i, + 'selector': /[^{}\s][^{};]*?(?=\s*\{)/, + 'string': { + pattern: /("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/, + greedy: true + }, + 'property': /[-_a-z\xA0-\uFFFF][-\w\xA0-\uFFFF]*(?=\s*:)/i, + 'important': /\B!important\b/i, + 'function': /[-a-z0-9]+(?=\()/i, + 'punctuation': /[(){};:]/ + }; + + Prism.languages.css['atrule'].inside.rest = Prism.languages.css; + + if (Prism.languages.markup) { + Prism.languages.insertBefore('markup', 'tag', { + 'style': { + pattern: /()[\s\S]*?(?=<\/style>)/i, + lookbehind: true, + inside: Prism.languages.css, + alias: 'language-css', + greedy: true + } }); - - return headlines - } - - var cache$1 = {}; - var re = /[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g; - - function lower(string) { - return string.toLowerCase() - } - - function slugify(str) { - if (typeof str !== 'string') { - return '' + + Prism.languages.insertBefore('inside', 'attr-value', { + 'style-attr': { + pattern: /\s*style=("|')(?:\\[\s\S]|(?!\1)[^\\])*\1/i, + inside: { + 'attr-name': { + pattern: /^\s*style/i, + inside: Prism.languages.markup.tag.inside + }, + 'punctuation': /^\s*=\s*['"]|['"]\s*$/, + 'attr-value': { + pattern: /.+/i, + inside: Prism.languages.css + } + }, + alias: 'language-css' + } + }, Prism.languages.markup.tag); + } + + /* ********************************************** + Begin prism-clike.js + ********************************************** */ + + Prism.languages.clike = { + 'comment': [ + { + pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/, + lookbehind: true + }, + { + pattern: /(^|[^\\:])\/\/.*/, + lookbehind: true, + greedy: true + } + ], + 'string': { + pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/, + greedy: true + }, + 'class-name': { + pattern: /((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[\w.\\]+/i, + lookbehind: true, + inside: { + punctuation: /[.\\]/ + } + }, + 'keyword': /\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/, + 'boolean': /\b(?:true|false)\b/, + 'function': /[a-z0-9_]+(?=\()/i, + 'number': /\b0x[\da-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?/i, + 'operator': /--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/, + 'punctuation': /[{}[\];(),.:]/ + }; + + + /* ********************************************** + Begin prism-javascript.js + ********************************************** */ + + Prism.languages.javascript = Prism.languages.extend('clike', { + 'keyword': /\b(?: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|var|void|while|with|yield)\b/, + 'number': /\b(?:0[xX][\dA-Fa-f]+|0[bB][01]+|0[oO][0-7]+|NaN|Infinity)\b|(?:\b\d+\.?\d*|\B\.\d+)(?:[Ee][+-]?\d+)?/, + // Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444) + 'function': /[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*\()/i, + 'operator': /-[-=]?|\+[+=]?|!=?=?|<>?>?=?|=(?:==?|>)?|&[&=]?|\|[|=]?|\*\*?=?|\/=?|~|\^=?|%=?|\?|\.{3}/ + }); + + Prism.languages.insertBefore('javascript', 'keyword', { + 'regex': { + pattern: /((?:^|[^$\w\xA0-\uFFFF."'\])\s])\s*)\/(\[[^\]\r\n]+]|\\.|[^/\\\[\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})\]]))/, + lookbehind: true, + greedy: true + }, + // This must be declared before keyword because we use "function" inside the look-forward + 'function-variable': { + pattern: /[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*=\s*(?:function\b|(?:\([^()]*\)|[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)\s*=>))/i, + alias: 'function' + }, + 'constant': /\b[A-Z][A-Z\d_]*\b/ + }); + + Prism.languages.insertBefore('javascript', 'string', { + 'template-string': { + pattern: /`(?:\\[\s\S]|\${[^}]+}|[^\\`])*`/, + greedy: true, + inside: { + 'interpolation': { + pattern: /\${[^}]+}/, + inside: { + 'interpolation-punctuation': { + pattern: /^\${|}$/, + alias: 'punctuation' + }, + rest: null // See below + } + }, + 'string': /[\s\S]+/ + } } - - var slug = str - .trim() - .replace(/[A-Z]+/g, lower) - .replace(/<[^>\d]+>/g, '') - .replace(re, '') - .replace(/\s/g, '-') - .replace(/-+/g, '-') - .replace(/^(\d)/, '_$1'); - var count = cache$1[slug]; - - count = hasOwn.call(cache$1, slug) ? count + 1 : 0; - cache$1[slug] = count; - - if (count) { - slug = slug + '-' + count; - } - - return slug - } - - slugify.clear = function () { - cache$1 = {}; - }; - - function replace(m, $1) { - return '' + $1 + '' - } - - function emojify(text) { - return text - .replace(/<(pre|template|code)[^>]*?>[\s\S]+?<\/(pre|template|code)>/g, function (m) { return m.replace(/:/g, '__colon__'); }) - .replace(/:(\w+?):/ig, (inBrowser && window.emojify) || replace) - .replace(/__colon__/g, ':') - } - - var decode = decodeURIComponent; - var encode = encodeURIComponent; - - function parseQuery(query) { - var res = {}; - - query = query.trim().replace(/^(\?|#|&)/, ''); - - if (!query) { - return res - } - - // Simple parse - query.split('&').forEach(function (param) { - var parts = param.replace(/\+/g, ' ').split('='); - - res[parts[0]] = parts[1] && decode(parts[1]); + }); + Prism.languages.javascript['template-string'].inside['interpolation'].inside.rest = Prism.languages.javascript; + + if (Prism.languages.markup) { + Prism.languages.insertBefore('markup', 'tag', { + 'script': { + pattern: /()[\s\S]*?(?=<\/script>)/i, + lookbehind: true, + inside: Prism.languages.javascript, + alias: 'language-javascript', + greedy: true + } }); - + } + + Prism.languages.js = Prism.languages.javascript; + + + /* ********************************************** + Begin prism-file-highlight.js + ********************************************** */ + + (function () { + if (typeof self === 'undefined' || !self.Prism || !self.document || !document.querySelector) { + return; + } + + self.Prism.fileHighlight = function() { + + var Extensions = { + 'js': 'javascript', + 'py': 'python', + 'rb': 'ruby', + 'ps1': 'powershell', + 'psm1': 'powershell', + 'sh': 'bash', + 'bat': 'batch', + 'h': 'c', + 'tex': 'latex' + }; + + Array.prototype.slice.call(document.querySelectorAll('pre[data-src]')).forEach(function (pre) { + var src = pre.getAttribute('data-src'); + + var language, parent = pre; + var lang = /\blang(?:uage)?-([\w-]+)\b/i; + while (parent && !lang.test(parent.className)) { + parent = parent.parentNode; + } + + if (parent) { + language = (pre.className.match(lang) || [, ''])[1]; + } + + if (!language) { + var extension = (src.match(/\.(\w+)$/) || [, ''])[1]; + language = Extensions[extension] || extension; + } + + var code = document.createElement('code'); + code.className = 'language-' + language; + + pre.textContent = ''; + + code.textContent = 'Loading…'; + + pre.appendChild(code); + + var xhr = new XMLHttpRequest(); + + xhr.open('GET', src, true); + + xhr.onreadystatechange = function () { + if (xhr.readyState == 4) { + + if (xhr.status < 400 && xhr.responseText) { + code.textContent = xhr.responseText; + + Prism.highlightElement(code); + } + else if (xhr.status >= 400) { + code.textContent = '✖ Error ' + xhr.status + ' while fetching file: ' + xhr.statusText; + } + else { + code.textContent = '✖ Error: File does not exist or is empty'; + } + } + }; + + xhr.send(null); + }); + + if (Prism.plugins.toolbar) { + Prism.plugins.toolbar.registerButton('download-file', function (env) { + var pre = env.element.parentNode; + if (!pre || !/pre/i.test(pre.nodeName) || !pre.hasAttribute('data-src') || !pre.hasAttribute('data-download-link')) { + return; + } + var src = pre.getAttribute('data-src'); + var a = document.createElement('a'); + a.textContent = pre.getAttribute('data-download-link-label') || 'Download'; + a.setAttribute('download', ''); + a.href = src; + return a; + }); + } + + }; + + document.addEventListener('DOMContentLoaded', self.Prism.fileHighlight); + + })(); + }); + + /** + * Gen toc tree + * @link https://github.com/killercup/grock/blob/5280ae63e16c5739e9233d9009bc235ed7d79a50/styles/solarized/assets/js/behavior.coffee#L54-L81 + * @param {Array} toc + * @param {Number} maxLevel + * @return {Array} + */ + function genTree(toc, maxLevel) { + var headlines = []; + var last = {}; + + toc.forEach(function (headline) { + var level = headline.level || 1; + var len = level - 1; + + if (level > maxLevel) { + return + } + if (last[len]) { + last[len].children = (last[len].children || []).concat(headline); + } else { + headlines.push(headline); + } + last[level] = headline; + }); + + return headlines + } + + var cache$1 = {}; + var re = /[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g; + + function lower(string) { + return string.toLowerCase() + } + + function slugify(str) { + if (typeof str !== 'string') { + return '' + } + + var slug = str + .trim() + .replace(/[A-Z]+/g, lower) + .replace(/<[^>\d]+>/g, '') + .replace(re, '') + .replace(/\s/g, '-') + .replace(/-+/g, '-') + .replace(/^(\d)/, '_$1'); + var count = cache$1[slug]; + + count = hasOwn.call(cache$1, slug) ? count + 1 : 0; + cache$1[slug] = count; + + if (count) { + slug = slug + '-' + count; + } + + return slug + } + + slugify.clear = function () { + cache$1 = {}; + }; + + function replace(m, $1) { + return '' + $1 + '' + } + + function emojify(text) { + return text + .replace(/<(pre|template|code)[^>]*?>[\s\S]+?<\/(pre|template|code)>/g, function (m) { return m.replace(/:/g, '__colon__'); }) + .replace(/:(\w+?):/ig, (inBrowser && window.emojify) || replace) + .replace(/__colon__/g, ':') + } + + var decode = decodeURIComponent; + var encode = encodeURIComponent; + + function parseQuery(query) { + var res = {}; + + query = query.trim().replace(/^(\?|#|&)/, ''); + + if (!query) { return res } - - function stringifyQuery(obj, ignores) { - if ( ignores === void 0 ) ignores = []; - - var qs = []; - - for (var key in obj) { - if (ignores.indexOf(key) > -1) { - continue - } - qs.push( - obj[key] ? - ((encode(key)) + "=" + (encode(obj[key]))).toLowerCase() : - encode(key) - ); + + // Simple parse + query.split('&').forEach(function (param) { + var parts = param.replace(/\+/g, ' ').split('='); + + res[parts[0]] = parts[1] && decode(parts[1]); + }); + + return res + } + + function stringifyQuery(obj, ignores) { + if ( ignores === void 0 ) ignores = []; + + var qs = []; + + for (var key in obj) { + if (ignores.indexOf(key) > -1) { + continue } - - return qs.length ? ("?" + (qs.join('&'))) : '' + qs.push( + obj[key] ? + ((encode(key)) + "=" + (encode(obj[key]))).toLowerCase() : + encode(key) + ); } - - var isAbsolutePath = cached(function (path) { - return /(:|(\/{2}))/g.test(path) - }); - - var getParentPath = cached(function (path) { - return /\/$/g.test(path) ? - path : - (path = path.match(/(\S*\/)[^/]+$/)) ? path[1] : '' - }); - - var cleanPath = cached(function (path) { - return path.replace(/^\/+/, '/').replace(/([^:])\/{2,}/g, '$1/') - }); - - var resolvePath = cached(function (path) { - var segments = path.replace(/^\//, '').split('/'); - var resolved = []; - for (var i = 0, len = segments.length; i < len; i++) { - var segment = segments[i]; - if (segment === '..') { - resolved.pop(); - } else if (segment !== '.') { - resolved.push(segment); - } + + return qs.length ? ("?" + (qs.join('&'))) : '' + } + + var isAbsolutePath = cached(function (path) { + return /(:|(\/{2}))/g.test(path) + }); + + var getParentPath = cached(function (path) { + return /\/$/g.test(path) ? + path : + (path = path.match(/(\S*\/)[^/]+$/)) ? path[1] : '' + }); + + var cleanPath = cached(function (path) { + return path.replace(/^\/+/, '/').replace(/([^:])\/{2,}/g, '$1/') + }); + + var resolvePath = cached(function (path) { + var segments = path.replace(/^\//, '').split('/'); + var resolved = []; + for (var i = 0, len = segments.length; i < len; i++) { + var segment = segments[i]; + if (segment === '..') { + resolved.pop(); + } else if (segment !== '.') { + resolved.push(segment); } - return '/' + resolved.join('/') - }); - - function getPath() { - var args = [], len = arguments.length; - while ( len-- ) args[ len ] = arguments[ len ]; - - return cleanPath(args.join('/')) } - - var replaceSlug = cached(function (path) { - return path.replace('#', '?id=') - }); - - Prism.languages['markup-templating'] = {}; - - Object.defineProperties(Prism.languages['markup-templating'], { - buildPlaceholders: { - // Tokenize all inline templating expressions matching placeholderPattern - // If the replaceFilter function is provided, it will be called with every match. - // If it returns false, the match will not be replaced. - value: function (env, language, placeholderPattern, replaceFilter) { - if (env.language !== language) { - return; - } - - env.tokenStack = []; - - env.code = env.code.replace(placeholderPattern, function(match) { - if (typeof replaceFilter === 'function' && !replaceFilter(match)) { - return match; - } - var i = env.tokenStack.length; - // Check for existing strings - while (env.code.indexOf('___' + language.toUpperCase() + i + '___') !== -1) - { ++i; } - - // Create a sparse array - env.tokenStack[i] = match; - - return '___' + language.toUpperCase() + i + '___'; - }); - - // Switch the grammar to markup - env.grammar = Prism.languages.markup; - } - }, - tokenizePlaceholders: { - // Replace placeholders with proper tokens after tokenizing - value: function (env, language) { - if (env.language !== language || !env.tokenStack) { - return; - } - - // Switch the grammar back - env.grammar = Prism.languages[language]; - - var j = 0; - var keys = Object.keys(env.tokenStack); - var walkTokens = function (tokens) { - if (j >= keys.length) { - return; - } - for (var i = 0; i < tokens.length; i++) { - var token = tokens[i]; - if (typeof token === 'string' || (token.content && typeof token.content === 'string')) { - var k = keys[j]; - var t = env.tokenStack[k]; - var s = typeof token === 'string' ? token : token.content; - - var index = s.indexOf('___' + language.toUpperCase() + k + '___'); - if (index > -1) { - ++j; - var before = s.substring(0, index); - var middle = new Prism.Token(language, Prism.tokenize(t, env.grammar, language), 'language-' + language, t); - var after = s.substring(index + ('___' + language.toUpperCase() + k + '___').length); - var replacement; - if (before || after) { - replacement = [before, middle, after].filter(function (v) { return !!v; }); - walkTokens(replacement); - } else { - replacement = middle; - } - if (typeof token === 'string') { - Array.prototype.splice.apply(tokens, [i, 1].concat(replacement)); - } else { - token.content = replacement; - } - - if (j >= keys.length) { - break; - } - } - } else if (token.content && typeof token.content !== 'string') { - walkTokens(token.content); - } - } - }; - - walkTokens(env.tokens); - } - } - }); - - // See https://github.com/PrismJS/prism/pull/1367 - var cachedLinks = {}; - - function getAndRemoveConfig(str) { - if ( str === void 0 ) str = ''; - - var config = {}; - - if (str) { - str = str - .replace(/^'/, '') - .replace(/'$/, '') - .replace(/(?:^|\s):([\w-]+)=?([\w-]+)?/g, function (m, key, value) { - config[key] = (value && value.replace(/"/g, '')) || true; - return '' - }) - .trim(); - } - - return {str: str, config: config} - } - - var compileMedia = { - markdown: function markdown(url) { - return { - url: url - } - }, - mermaid: function mermaid(url) { - return { - url: url - } - }, - iframe: function iframe(url, title) { - return { - html: ("") - } - }, - video: function video(url, title) { - return { - html: ("") - } - }, - audio: function audio(url, title) { - return { - html: ("") - } - }, - code: function code(url, title) { - var lang = url.match(/\.(\w+)$/); - - lang = title || (lang && lang[1]); - if (lang === 'md') { - lang = 'markdown'; - } - - return { - url: url, - lang: lang - } - } - }; - - var Compiler = function Compiler(config, router) { - var this$1 = this; - - this.config = config; - this.router = router; - this.cacheTree = {}; - this.toc = []; - this.cacheTOC = {}; - this.linkTarget = config.externalLinkTarget || '_blank'; - this.contentBase = router.getBasePath(); - - var renderer = this._initRenderer(); - var compile; - var mdConf = config.markdown || {}; - - if (isFn(mdConf)) { - compile = mdConf(marked, renderer); - } else { - marked.setOptions( - merge(mdConf, { - renderer: merge(renderer, mdConf.renderer) - }) - ); - compile = marked; - } - - this._marked = compile; - this.compile = function (text) { - var isCached = true; - var result = cached(function (_) { - isCached = false; - var html = ''; - - if (!text) { - return text + return '/' + resolved.join('/') + }); + + function getPath() { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + return cleanPath(args.join('/')) + } + + var replaceSlug = cached(function (path) { + return path.replace('#', '?id=') + }); + + Prism.languages['markup-templating'] = {}; + + Object.defineProperties(Prism.languages['markup-templating'], { + buildPlaceholders: { + // Tokenize all inline templating expressions matching placeholderPattern + // If the replaceFilter function is provided, it will be called with every match. + // If it returns false, the match will not be replaced. + value: function (env, language, placeholderPattern, replaceFilter) { + if (env.language !== language) { + return; + } + + env.tokenStack = []; + + env.code = env.code.replace(placeholderPattern, function(match) { + if (typeof replaceFilter === 'function' && !replaceFilter(match)) { + return match; + } + var i = env.tokenStack.length; + // Check for existing strings + while (env.code.indexOf('___' + language.toUpperCase() + i + '___') !== -1) + { ++i; } + + // Create a sparse array + env.tokenStack[i] = match; + + return '___' + language.toUpperCase() + i + '___'; + }); + + // Switch the grammar to markup + env.grammar = Prism.languages.markup; } - - if (isPrimitive(text)) { - html = compile(text); - } else { - html = compile.parser(text); + }, + tokenizePlaceholders: { + // Replace placeholders with proper tokens after tokenizing + value: function (env, language) { + if (env.language !== language || !env.tokenStack) { + return; + } + + // Switch the grammar back + env.grammar = Prism.languages[language]; + + var j = 0; + var keys = Object.keys(env.tokenStack); + var walkTokens = function (tokens) { + if (j >= keys.length) { + return; + } + for (var i = 0; i < tokens.length; i++) { + var token = tokens[i]; + if (typeof token === 'string' || (token.content && typeof token.content === 'string')) { + var k = keys[j]; + var t = env.tokenStack[k]; + var s = typeof token === 'string' ? token : token.content; + + var index = s.indexOf('___' + language.toUpperCase() + k + '___'); + if (index > -1) { + ++j; + var before = s.substring(0, index); + var middle = new Prism.Token(language, Prism.tokenize(t, env.grammar, language), 'language-' + language, t); + var after = s.substring(index + ('___' + language.toUpperCase() + k + '___').length); + var replacement; + if (before || after) { + replacement = [before, middle, after].filter(function (v) { return !!v; }); + walkTokens(replacement); + } else { + replacement = middle; + } + if (typeof token === 'string') { + Array.prototype.splice.apply(tokens, [i, 1].concat(replacement)); + } else { + token.content = replacement; + } + + if (j >= keys.length) { + break; + } + } + } else if (token.content && typeof token.content !== 'string') { + walkTokens(token.content); + } + } + }; + + walkTokens(env.tokens); } - - html = config.noEmoji ? html : emojify(html); - slugify.clear(); - - return html - })(text); - - var curFileName = this$1.router.parse().file; - - if (isCached) { - this$1.toc = this$1.cacheTOC[curFileName]; + } + }); + + // See https://github.com/PrismJS/prism/pull/1367 + var cachedLinks = {}; + + function getAndRemoveConfig(str) { + if ( str === void 0 ) str = ''; + + var config = {}; + + if (str) { + str = str + .replace(/^'/, '') + .replace(/'$/, '') + .replace(/(?:^|\s):([\w-]+)=?([\w-]+)?/g, function (m, key, value) { + config[key] = (value && value.replace(/"/g, '')) || true; + return '' + }) + .trim(); + } + + return {str: str, config: config} + } + + var compileMedia = { + markdown: function markdown(url) { + return { + url: url + } + }, + mermaid: function mermaid(url) { + return { + url: url + } + }, + iframe: function iframe(url, title) { + return { + html: ("") + } + }, + video: function video(url, title) { + return { + html: ("") + } + }, + audio: function audio(url, title) { + return { + html: ("") + } + }, + code: function code(url, title) { + var lang = url.match(/\.(\w+)$/); + + lang = title || (lang && lang[1]); + if (lang === 'md') { + lang = 'markdown'; + } + + return { + url: url, + lang: lang + } + } + }; + + var Compiler = function Compiler(config, router) { + var this$1 = this; + + this.config = config; + this.router = router; + this.cacheTree = {}; + this.toc = []; + this.cacheTOC = {}; + this.linkTarget = config.externalLinkTarget || '_blank'; + this.contentBase = router.getBasePath(); + + var renderer = this._initRenderer(); + var compile; + var mdConf = config.markdown || {}; + + if (isFn(mdConf)) { + compile = mdConf(marked, renderer); + } else { + marked.setOptions( + merge(mdConf, { + renderer: merge(renderer, mdConf.renderer) + }) + ); + compile = marked; + } + + this._marked = compile; + this.compile = function (text) { + var isCached = true; + var result = cached(function (_) { + isCached = false; + var html = ''; + + if (!text) { + return text + } + + if (isPrimitive(text)) { + html = compile(text); } else { - this$1.cacheTOC[curFileName] = [].concat( this$1.toc ); + html = compile.parser(text); } - - return result - }; + + html = config.noEmoji ? html : emojify(html); + slugify.clear(); + + return html + })(text); + + var curFileName = this$1.router.parse().file; + + if (isCached) { + this$1.toc = this$1.cacheTOC[curFileName]; + } else { + this$1.cacheTOC[curFileName] = [].concat( this$1.toc ); + } + + return result }; - - Compiler.prototype.compileEmbed = function compileEmbed (href, title) { + }; + + Compiler.prototype.compileEmbed = function compileEmbed (href, title) { + var ref = getAndRemoveConfig(title); + var str = ref.str; + var config = ref.config; + var embed; + title = str; + + if (config.include) { + if (!isAbsolutePath(href)) { + href = getPath( + this.contentBase, + getParentPath(this.router.getCurrentPath()), + href + ); + } + + var media; + if (config.type && (media = compileMedia[config.type])) { + embed = media.call(this, href, title); + embed.type = config.type; + } else { + var type = 'code'; + if (/\.(md|markdown)/.test(href)) { + type = 'markdown'; + } else if (/\.mmd/.test(href)) { + type = 'mermaid'; + } else if (/\.html?/.test(href)) { + type = 'iframe'; + } else if (/\.(mp4|ogg)/.test(href)) { + type = 'video'; + } else if (/\.mp3/.test(href)) { + type = 'audio'; + } + embed = compileMedia[type].call(this, href, title); + embed.type = type; + } + embed.fragment = config.fragment; + + return embed + } + }; + + Compiler.prototype._matchNotCompileLink = function _matchNotCompileLink (link) { + var links = this.config.noCompileLinks || []; + + for (var i = 0; i < links.length; i++) { + var n = links[i]; + var re = cachedLinks[n] || (cachedLinks[n] = new RegExp(("^" + n + "$"))); + + if (re.test(link)) { + return link + } + } + }; + + Compiler.prototype._initRenderer = function _initRenderer () { + var renderer = new marked.Renderer(); + var ref = this; + var linkTarget = ref.linkTarget; + var router = ref.router; + var contentBase = ref.contentBase; + var _self = this; + var origin = {}; + + /** + * Render anchor tag + * @link https://github.com/markedjs/marked#overriding-renderer-methods + */ + origin.heading = renderer.heading = function (text, level) { + var ref = getAndRemoveConfig(text); + var str = ref.str; + var config = ref.config; + var nextToc = {level: level, title: str}; + + if (/{docsify-ignore}/g.test(str)) { + str = str.replace('{docsify-ignore}', ''); + nextToc.title = str; + nextToc.ignoreSubHeading = true; + } + + if (/{docsify-ignore-all}/g.test(str)) { + str = str.replace('{docsify-ignore-all}', ''); + nextToc.title = str; + nextToc.ignoreAllSubs = true; + } + + var slug = slugify(config.id || str); + var url = router.toURL(router.getCurrentPath(), {id: slug}); + nextToc.slug = url; + _self.toc.push(nextToc); + + return ("
    " + str + "") + }; + // Highlight code + origin.code = renderer.code = function (code, lang) { + if ( lang === void 0 ) lang = ''; + + code = code.replace(/@DOCSIFY_QM@/g, '`'); + var hl = prism.highlight( + code, + prism.languages[lang] || prism.languages.markup + ); + + return ("
    " + hl + "
    ") + }; + origin.link = renderer.link = function (href, title, text) { + if ( title === void 0 ) title = ''; + + var attrs = ''; + var ref = getAndRemoveConfig(title); var str = ref.str; var config = ref.config; - var embed; title = str; - - if (config.include) { - if (!isAbsolutePath(href)) { - href = getPath( - this.contentBase, - getParentPath(this.router.getCurrentPath()), - href - ); + + if ( + !isAbsolutePath(href) && + !_self._matchNotCompileLink(href) && + !config.ignore + ) { + if (href === _self.config.homepage) { + href = 'README'; } - - var media; - if (config.type && (media = compileMedia[config.type])) { - embed = media.call(this, href, title); - embed.type = config.type; - } else { - var type = 'code'; - if (/\.(md|markdown)/.test(href)) { - type = 'markdown'; - } else if (/\.mmd/.test(href)) { - type = 'mermaid'; - } else if (/\.html?/.test(href)) { - type = 'iframe'; - } else if (/\.(mp4|ogg)/.test(href)) { - type = 'video'; - } else if (/\.mp3/.test(href)) { - type = 'audio'; - } - embed = compileMedia[type].call(this, href, title); - embed.type = type; - } - embed.fragment = config.fragment; - - return embed - } - }; - - Compiler.prototype._matchNotCompileLink = function _matchNotCompileLink (link) { - var links = this.config.noCompileLinks || []; - - for (var i = 0; i < links.length; i++) { - var n = links[i]; - var re = cachedLinks[n] || (cachedLinks[n] = new RegExp(("^" + n + "$"))); - - if (re.test(link)) { - return link - } - } - }; - - Compiler.prototype._initRenderer = function _initRenderer () { - var renderer = new marked.Renderer(); - var ref = this; - var linkTarget = ref.linkTarget; - var router = ref.router; - var contentBase = ref.contentBase; - var _self = this; - var origin = {}; - - /** - * Render anchor tag - * @link https://github.com/markedjs/marked#overriding-renderer-methods - */ - origin.heading = renderer.heading = function (text, level) { - var ref = getAndRemoveConfig(text); - var str = ref.str; - var config = ref.config; - var nextToc = {level: level, title: str}; - - if (/{docsify-ignore}/g.test(str)) { - str = str.replace('{docsify-ignore}', ''); - nextToc.title = str; - nextToc.ignoreSubHeading = true; - } - - if (/{docsify-ignore-all}/g.test(str)) { - str = str.replace('{docsify-ignore-all}', ''); - nextToc.title = str; - nextToc.ignoreAllSubs = true; - } - - var slug = slugify(config.id || str); - var url = router.toURL(router.getCurrentPath(), {id: slug}); - nextToc.slug = url; - _self.toc.push(nextToc); - - return ("" + str + "") - }; - // Highlight code - origin.code = renderer.code = function (code, lang) { - if ( lang === void 0 ) lang = ''; - - code = code.replace(/@DOCSIFY_QM@/g, '`'); - var hl = prism.highlight( - code, - prism.languages[lang] || prism.languages.markup - ); - - return ("
    " + hl + "
    ") - }; - origin.link = renderer.link = function (href, title, text) { - if ( title === void 0 ) title = ''; - - var attrs = ''; - - var ref = getAndRemoveConfig(title); - var str = ref.str; - var config = ref.config; - title = str; - - if ( - !isAbsolutePath(href) && - !_self._matchNotCompileLink(href) && - !config.ignore - ) { - if (href === _self.config.homepage) { - href = 'README'; - } - href = router.toURL(href, null, router.getCurrentPath()); - } else { - attrs += href.indexOf('mailto:') === 0 ? '' : (" target=\"" + linkTarget + "\""); - } - - if (config.target) { - attrs += ' target=' + config.target; - } - - if (config.disabled) { - attrs += ' disabled'; - href = 'javascript:void(0)'; - } - - if (title) { - attrs += " title=\"" + title + "\""; - } - - return ("" + text + "") - }; - origin.paragraph = renderer.paragraph = function (text) { - var result; - if (/^!>/.test(text)) { - result = helper('tip', text); - } else if (/^\?>/.test(text)) { - result = helper('warn', text); - } else { - result = "

    " + text + "

    "; - } - return result - }; - origin.image = renderer.image = function (href, title, text) { - var url = href; - var attrs = ''; - - var ref = getAndRemoveConfig(title); - var str = ref.str; - var config = ref.config; - title = str; - - if (config['no-zoom']) { - attrs += ' data-no-zoom'; - } - - if (title) { - attrs += " title=\"" + title + "\""; - } - - var size = config.size; - if (size) { - var sizes = size.split('x'); - if (sizes[1]) { - attrs += 'width=' + sizes[0] + ' height=' + sizes[1]; - } else { - attrs += 'width=' + sizes[0]; - } - } - - if (!isAbsolutePath(href)) { - url = getPath(contentBase, getParentPath(router.getCurrentPath()), href); - } - - return ("\""") - }; - origin.list = renderer.list = function (body, ordered, start) { - var isTaskList = /
  • /.test(body.split('class="task-list"')[0]); - var isStartReq = start && start > 1; - var tag = ordered ? 'ol' : 'ul'; - var tagAttrs = [ - (isTaskList ? 'class="task-list"' : ''), - (isStartReq ? ("start=\"" + start + "\"") : '') - ].join(' ').trim(); - - return ("<" + tag + " " + tagAttrs + ">" + body + "") - }; - origin.listitem = renderer.listitem = function (text) { - var isTaskItem = /^(]*>)/.test(text); - var html = isTaskItem ? ("
  • ") : ("
  • " + text + "
  • "); - - return html - }; - - renderer.origin = origin; - - return renderer - }; - - /** - * Compile sidebar - */ - Compiler.prototype.sidebar = function sidebar (text, level) { - var ref = this; - var toc = ref.toc; - var currentPath = this.router.getCurrentPath(); - var html = ''; - - if (text) { - html = this.compile(text); + href = router.toURL(href, null, router.getCurrentPath()); } else { - for (var i = 0; i < toc.length; i++) { - if (toc[i].ignoreSubHeading) { - var deletedHeaderLevel = toc[i].level; - toc.splice(i, 1); - // Remove headers who are under current header - for (var j = i; deletedHeaderLevel < toc[j].level && j < toc.length; j++) { - toc.splice(j, 1) && j-- && i++; - } - i--; - } + attrs += href.indexOf('mailto:') === 0 ? '' : (" target=\"" + linkTarget + "\""); + } + + if (config.target) { + attrs += ' target=' + config.target; + } + + if (config.disabled) { + attrs += ' disabled'; + href = 'javascript:void(0)'; + } + + if (title) { + attrs += " title=\"" + title + "\""; + } + + return ("" + text + "") + }; + origin.paragraph = renderer.paragraph = function (text) { + var result; + if (/^!>/.test(text)) { + result = helper('tip', text); + } else if (/^\?>/.test(text)) { + result = helper('warn', text); + } else { + result = "

    " + text + "

    "; + } + return result + }; + origin.image = renderer.image = function (href, title, text) { + var url = href; + var attrs = ''; + + var ref = getAndRemoveConfig(title); + var str = ref.str; + var config = ref.config; + title = str; + + if (config['no-zoom']) { + attrs += ' data-no-zoom'; + } + + if (title) { + attrs += " title=\"" + title + "\""; + } + + var size = config.size; + if (size) { + var sizes = size.split('x'); + if (sizes[1]) { + attrs += 'width=' + sizes[0] + ' height=' + sizes[1]; + } else { + attrs += 'width=' + sizes[0]; } - var tree$$1 = this.cacheTree[currentPath] || genTree(toc, level); - html = tree(tree$$1, '
      {inner}
    '); - this.cacheTree[currentPath] = tree$$1; } - - // return html - return ''; - }; - - /** - * Compile sub sidebar - */ - Compiler.prototype.subSidebar = function subSidebar (level) { - if (!level) { - this.toc = []; - return + + if (!isAbsolutePath(href)) { + url = getPath(contentBase, getParentPath(router.getCurrentPath()), href); } - var currentPath = this.router.getCurrentPath(); - var ref = this; - var cacheTree = ref.cacheTree; - var toc = ref.toc; - - toc[0] && toc[0].ignoreAllSubs && toc.splice(0); - toc[0] && toc[0].level === 1 && toc.shift(); - - for (var i = 0; i < toc.length; i++) { - toc[i].ignoreSubHeading && toc.splice(i, 1) && i--; - } - var tree$$1 = cacheTree[currentPath] || genTree(toc, level); - - cacheTree[currentPath] = tree$$1; - this.toc = []; - return tree(tree$$1) + + return ("\""") }; - - Compiler.prototype.article = function article (text) { - return this.compile(text) + origin.list = renderer.list = function (body, ordered, start) { + var isTaskList = /
  • /.test(body.split('class="task-list"')[0]); + var isStartReq = start && start > 1; + var tag = ordered ? 'ol' : 'ul'; + var tagAttrs = [ + (isTaskList ? 'class="task-list"' : ''), + (isStartReq ? ("start=\"" + start + "\"") : '') + ].join(' ').trim(); + + return ("<" + tag + " " + tagAttrs + ">" + body + "") }; - - /** - * Compile cover page - */ - Compiler.prototype.cover = function cover$$1 (text) { - var cacheToc = this.toc.slice(); - var html = this.compile(text); - - this.toc = cacheToc.slice(); - + origin.listitem = renderer.listitem = function (text) { + var isTaskItem = /^(]*>)/.test(text); + var html = isTaskItem ? ("
  • ") : ("
  • " + text + "
  • "); + return html }; - - var title = $.title; - /** - * Toggle button - */ - function btn(el) { - var toggle = function (_) { return body.classList.toggle('close'); }; - - el = getNode(el); - if (el == null) { - return - } - on(el, 'click', function (e) { - e.stopPropagation(); - toggle(); - }); - - isMobile && - on( - body, - 'click', - function (_) { return body.classList.contains('close') && toggle(); } - ); - } - - function collapse(el) { - el = getNode(el); - if (el == null) { - return - } - on(el, 'click', function (ref) { - var target = ref.target; - - if ( - target.nodeName === 'A' && - target.nextSibling && - target.nextSibling.classList.contains('app-sub-sidebar') - ) { - toggleClass(target.parentNode, 'collapse'); + + renderer.origin = origin; + + return renderer + }; + + /** + * Compile sidebar + */ + Compiler.prototype.sidebar = function sidebar (text, level) { + var ref = this; + var toc = ref.toc; + var currentPath = this.router.getCurrentPath(); + var html = ''; + + if (text) { + html = this.compile(text); + } else { + for (var i = 0; i < toc.length; i++) { + if (toc[i].ignoreSubHeading) { + var deletedHeaderLevel = toc[i].level; + toc.splice(i, 1); + // Remove headers who are under current header + for (var j = i; deletedHeaderLevel < toc[j].level && j < toc.length; j++) { + toc.splice(j, 1) && j-- && i++; + } + i--; } - }); - } - - function sticky() { - var cover = getNode('section.cover'); - if (!cover) { - return } - var coverHeight = cover.getBoundingClientRect().height; - - if (window.pageYOffset >= coverHeight || cover.classList.contains('hidden')) { - toggleClass(body, 'add', 'sticky'); + var tree$$1 = this.cacheTree[currentPath] || genTree(toc, level); + html = tree(tree$$1, '
      {inner}
    '); + this.cacheTree[currentPath] = tree$$1; + } + + // return html + return ''; + }; + + /** + * Compile sub sidebar + */ + Compiler.prototype.subSidebar = function subSidebar (level) { + if (!level) { + this.toc = []; + return + } + var currentPath = this.router.getCurrentPath(); + var ref = this; + var cacheTree = ref.cacheTree; + var toc = ref.toc; + + toc[0] && toc[0].ignoreAllSubs && toc.splice(0); + toc[0] && toc[0].level === 1 && toc.shift(); + + for (var i = 0; i < toc.length; i++) { + toc[i].ignoreSubHeading && toc.splice(i, 1) && i--; + } + var tree$$1 = cacheTree[currentPath] || genTree(toc, level); + + cacheTree[currentPath] = tree$$1; + this.toc = []; + return tree(tree$$1) + }; + + Compiler.prototype.article = function article (text) { + return this.compile(text) + }; + + /** + * Compile cover page + */ + Compiler.prototype.cover = function cover$$1 (text) { + var cacheToc = this.toc.slice(); + var html = this.compile(text); + + this.toc = cacheToc.slice(); + + return html + }; + + var title = $.title; + /** + * Toggle button + */ + function btn(el) { + var toggle = function (_) { return body.classList.toggle('close'); }; + + el = getNode(el); + if (el == null) { + return + } + on(el, 'click', function (e) { + e.stopPropagation(); + toggle(); + }); + + isMobile && + on( + body, + 'click', + function (_) { return body.classList.contains('close') && toggle(); } + ); + } + + function collapse(el) { + el = getNode(el); + if (el == null) { + return + } + on(el, 'click', function (ref) { + var target = ref.target; + + if ( + target.nodeName === 'A' && + target.nextSibling && + target.nextSibling.classList.contains('app-sub-sidebar') + ) { + toggleClass(target.parentNode, 'collapse'); + } + }); + } + + function sticky() { + var cover = getNode('section.cover'); + if (!cover) { + return + } + var coverHeight = cover.getBoundingClientRect().height; + + if (window.pageYOffset >= coverHeight || cover.classList.contains('hidden')) { + toggleClass(body, 'add', 'sticky'); + } else { + toggleClass(body, 'remove', 'sticky'); + } + } + + /** + * Get and active link + * @param {object} router + * @param {string|element} el + * @param {Boolean} isParent acitve parent + * @param {Boolean} autoTitle auto set title + * @return {element} + */ + function getAndActive(router, el, isParent, autoTitle) { + el = getNode(el); + var links = []; + if (el != null) { + links = findAll(el, 'a'); + } + var hash = decodeURI(router.toURL(router.getCurrentPath())); + var target; + + links.sort(function (a, b) { return b.href.length - a.href.length; }).forEach(function (a) { + var href = a.getAttribute('href'); + var node = isParent ? a.parentNode : a; + + if (hash.indexOf(href) === 0 && !target) { + target = a; + toggleClass(node, 'add', 'active'); } else { - toggleClass(body, 'remove', 'sticky'); + toggleClass(node, 'remove', 'active'); } + }); + + if (autoTitle) { + $.title = target ? (target.title || ((target.innerText) + " - " + title)) : title; } - - /** - * Get and active link - * @param {object} router - * @param {string|element} el - * @param {Boolean} isParent acitve parent - * @param {Boolean} autoTitle auto set title - * @return {element} - */ - function getAndActive(router, el, isParent, autoTitle) { - el = getNode(el); - var links = []; - if (el != null) { - links = findAll(el, 'a'); - } - var hash = decodeURI(router.toURL(router.getCurrentPath())); - var target; - - links.sort(function (a, b) { return b.href.length - a.href.length; }).forEach(function (a) { - var href = a.getAttribute('href'); - var node = isParent ? a.parentNode : a; - - if (hash.indexOf(href) === 0 && !target) { - target = a; - toggleClass(node, 'add', 'active'); - } else { - toggleClass(node, 'remove', 'active'); + + return target + } + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) { descriptor.writable = true; } Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) { defineProperties(Constructor.prototype, protoProps); } if (staticProps) { defineProperties(Constructor, staticProps); } return Constructor; }; }(); + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var Tweezer = function () { + function Tweezer() { + var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + _classCallCheck(this, Tweezer); + + this.duration = opts.duration || 1000; + this.ease = opts.easing || this._defaultEase; + this.start = opts.start; + this.end = opts.end; + + this.frame = null; + this.next = null; + this.isRunning = false; + this.events = {}; + this.direction = this.start < this.end ? 'up' : 'down'; + } + + _createClass(Tweezer, [{ + key: 'begin', + value: function begin() { + if (!this.isRunning && this.next !== this.end) { + this.frame = window.requestAnimationFrame(this._tick.bind(this)); } - }); - - if (autoTitle) { - $.title = target ? (target.title || ((target.innerText) + " - " + title)) : title; + return this; } - - return target - } - - var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) { descriptor.writable = true; } Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) { defineProperties(Constructor.prototype, protoProps); } if (staticProps) { defineProperties(Constructor, staticProps); } return Constructor; }; }(); - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var Tweezer = function () { - function Tweezer() { - var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - - _classCallCheck(this, Tweezer); - - this.duration = opts.duration || 1000; - this.ease = opts.easing || this._defaultEase; - this.start = opts.start; - this.end = opts.end; - - this.frame = null; - this.next = null; + }, { + key: 'stop', + value: function stop() { + window.cancelAnimationFrame(this.frame); this.isRunning = false; - this.events = {}; - this.direction = this.start < this.end ? 'up' : 'down'; + this.frame = null; + this.timeStart = null; + this.next = null; + return this; } - - _createClass(Tweezer, [{ - key: 'begin', - value: function begin() { - if (!this.isRunning && this.next !== this.end) { - this.frame = window.requestAnimationFrame(this._tick.bind(this)); - } - return this; - } - }, { - key: 'stop', - value: function stop() { - window.cancelAnimationFrame(this.frame); - this.isRunning = false; - this.frame = null; - this.timeStart = null; - this.next = null; - return this; - } - }, { - key: 'on', - value: function on(name, handler) { - this.events[name] = this.events[name] || []; - this.events[name].push(handler); - return this; - } - }, { - key: 'emit', - value: function emit(name, val) { - var _this = this; - - var e = this.events[name]; - e && e.forEach(function (handler) { - return handler.call(_this, val); - }); - } - }, { - key: '_tick', - value: function _tick(currentTime) { - this.isRunning = true; - - var lastTick = this.next || this.start; - - if (!this.timeStart) { this.timeStart = currentTime; } - this.timeElapsed = currentTime - this.timeStart; - this.next = Math.round(this.ease(this.timeElapsed, this.start, this.end - this.start, this.duration)); - - if (this._shouldTick(lastTick)) { - this.emit('tick', this.next); - this.frame = window.requestAnimationFrame(this._tick.bind(this)); - } else { - this.emit('tick', this.end); - this.emit('done', null); - } - } - }, { - key: '_shouldTick', - value: function _shouldTick(lastTick) { - return { - up: this.next < this.end && lastTick <= this.next, - down: this.next > this.end && lastTick >= this.next - }[this.direction]; - } - }, { - key: '_defaultEase', - value: function _defaultEase(t, b, c, d) { - if ((t /= d / 2) < 1) { return c / 2 * t * t + b; } - return -c / 2 * (--t * (t - 2) - 1) + b; - } - }]); - - return Tweezer; - }(); - - var nav = {}; - var hoverOver = false; - var scroller = null; - var enableScrollEvent = true; - var coverHeight = 0; - - function scrollTo(el) { - if (scroller) { - scroller.stop(); + }, { + key: 'on', + value: function on(name, handler) { + this.events[name] = this.events[name] || []; + this.events[name].push(handler); + return this; } - enableScrollEvent = false; - scroller = new Tweezer({ - start: window.pageYOffset, - end: el.getBoundingClientRect().top + window.pageYOffset, - duration: 500 - }) - .on('tick', function (v) { return window.scrollTo(0, v); }) - .on('done', function () { - enableScrollEvent = true; - scroller = null; - }) - .begin(); - } - - function highlight(path) { - if (!enableScrollEvent) { - return + }, { + key: 'emit', + value: function emit(name, val) { + var _this = this; + + var e = this.events[name]; + e && e.forEach(function (handler) { + return handler.call(_this, val); + }); } - var sidebar = getNode('.sidebar'); - var anchors = findAll('.anchor'); - var wrap = find(sidebar, '.sidebar-nav'); - var active = find(sidebar, 'li.active'); - var doc = document.documentElement; - var top = ((doc && doc.scrollTop) || document.body.scrollTop) - coverHeight; - var last; - - for (var i = 0, len = anchors.length; i < len; i += 1) { - var node = anchors[i]; - - if (node.offsetTop > top) { - if (!last) { - last = node; - } - break + }, { + key: '_tick', + value: function _tick(currentTime) { + this.isRunning = true; + + var lastTick = this.next || this.start; + + if (!this.timeStart) { this.timeStart = currentTime; } + this.timeElapsed = currentTime - this.timeStart; + this.next = Math.round(this.ease(this.timeElapsed, this.start, this.end - this.start, this.duration)); + + if (this._shouldTick(lastTick)) { + this.emit('tick', this.next); + this.frame = window.requestAnimationFrame(this._tick.bind(this)); } else { + this.emit('tick', this.end); + this.emit('done', null); + } + } + }, { + key: '_shouldTick', + value: function _shouldTick(lastTick) { + return { + up: this.next < this.end && lastTick <= this.next, + down: this.next > this.end && lastTick >= this.next + }[this.direction]; + } + }, { + key: '_defaultEase', + value: function _defaultEase(t, b, c, d) { + if ((t /= d / 2) < 1) { return c / 2 * t * t + b; } + return -c / 2 * (--t * (t - 2) - 1) + b; + } + }]); + + return Tweezer; + }(); + + var nav = {}; + var hoverOver = false; + var scroller = null; + var enableScrollEvent = true; + var coverHeight = 0; + + function scrollTo(el) { + if (scroller) { + scroller.stop(); + } + enableScrollEvent = false; + scroller = new Tweezer({ + start: window.pageYOffset, + end: el.getBoundingClientRect().top + window.pageYOffset, + duration: 500 + }) + .on('tick', function (v) { return window.scrollTo(0, v); }) + .on('done', function () { + enableScrollEvent = true; + scroller = null; + }) + .begin(); + } + + function highlight(path) { + if (!enableScrollEvent) { + return + } + var sidebar = getNode('.sidebar'); + var anchors = findAll('.anchor'); + var wrap = find(sidebar, '.sidebar-nav'); + var active = find(sidebar, 'li.active'); + var doc = document.documentElement; + var top = ((doc && doc.scrollTop) || document.body.scrollTop) - coverHeight; + var last; + + for (var i = 0, len = anchors.length; i < len; i += 1) { + var node = anchors[i]; + + if (node.offsetTop > top) { + if (!last) { last = node; } - } - if (!last) { - return - } - var li = nav[getNavKey(decodeURIComponent(path), last.getAttribute('data-id'))]; - - if (!li || li === active) { - return - } - - active && active.classList.remove('active'); - li.classList.add('active'); - active = li; - - // Scroll into view - // https://github.com/vuejs/vuejs.org/blob/master/themes/vue/source/js/common.js#L282-L297 - if (!hoverOver && body.classList.contains('sticky')) { - var height = sidebar.clientHeight; - var curOffset = 0; - var cur = active.offsetTop + active.clientHeight + 40; - var isInView = - active.offsetTop >= wrap.scrollTop && cur <= wrap.scrollTop + height; - var notThan = cur - curOffset < height; - var top$1 = isInView ? wrap.scrollTop : notThan ? curOffset : cur - height; - - sidebar.scrollTop = top$1; + break + } else { + last = node; } } - - function getNavKey(path, id) { - return (path + "?id=" + id) + if (!last) { + return } - - function scrollActiveSidebar(router) { - var cover = find('.cover.show'); - coverHeight = cover ? cover.offsetHeight : 0; - - var sidebar = getNode('.sidebar'); - var lis = []; - if (sidebar != null) { - lis = findAll(sidebar, 'li'); + var li = nav[getNavKey(decodeURIComponent(path), last.getAttribute('data-id'))]; + + if (!li || li === active) { + return + } + + active && active.classList.remove('active'); + li.classList.add('active'); + active = li; + + // Scroll into view + // https://github.com/vuejs/vuejs.org/blob/master/themes/vue/source/js/common.js#L282-L297 + if (!hoverOver && body.classList.contains('sticky')) { + var height = sidebar.clientHeight; + var curOffset = 0; + var cur = active.offsetTop + active.clientHeight + 40; + var isInView = + active.offsetTop >= wrap.scrollTop && cur <= wrap.scrollTop + height; + var notThan = cur - curOffset < height; + var top$1 = isInView ? wrap.scrollTop : notThan ? curOffset : cur - height; + + sidebar.scrollTop = top$1; + } + } + + function getNavKey(path, id) { + return (path + "?id=" + id) + } + + function scrollActiveSidebar(router) { + var cover = find('.cover.show'); + coverHeight = cover ? cover.offsetHeight : 0; + + var sidebar = getNode('.sidebar'); + var lis = []; + if (sidebar != null) { + lis = findAll(sidebar, 'li'); + } + + for (var i = 0, len = lis.length; i < len; i += 1) { + var li = lis[i]; + var a = li.querySelector('a'); + if (!a) { + continue } - - for (var i = 0, len = lis.length; i < len; i += 1) { - var li = lis[i]; - var a = li.querySelector('a'); - if (!a) { - continue - } - var href = a.getAttribute('href'); - - if (href !== '/') { - var ref = router.parse(href); - var id = ref.query.id; - var path$1 = ref.path; - if (id) { - href = getNavKey(path$1, id); - } - } - - if (href) { - nav[decodeURIComponent(href)] = li; + var href = a.getAttribute('href'); + + if (href !== '/') { + var ref = router.parse(href); + var id = ref.query.id; + var path$1 = ref.path; + if (id) { + href = getNavKey(path$1, id); } } - - if (isMobile) { - return + + if (href) { + nav[decodeURIComponent(href)] = li; } - var path = router.getCurrentPath(); - off('scroll', function () { return highlight(path); }); - on('scroll', function () { return highlight(path); }); - on(sidebar, 'mouseover', function () { - hoverOver = true; - }); - on(sidebar, 'mouseleave', function () { - hoverOver = false; - }); } - - function scrollIntoView(path, id) { - if (!id) { - return - } - - var section = find('#' + id); - section && scrollTo(section); - - var li = nav[getNavKey(path, id)]; - var sidebar = getNode('.sidebar'); - var active = find(sidebar, 'li.active'); - active && active.classList.remove('active'); - li && li.classList.add('active'); + + if (isMobile) { + return } - - var scrollEl = $.scrollingElement || $.documentElement; - - function scroll2Top(offset) { - if ( offset === void 0 ) offset = 0; - - scrollEl.scrollTop = offset === true ? 0 : Number(offset); + var path = router.getCurrentPath(); + off('scroll', function () { return highlight(path); }); + on('scroll', function () { return highlight(path); }); + on(sidebar, 'mouseover', function () { + hoverOver = true; + }); + on(sidebar, 'mouseleave', function () { + hoverOver = false; + }); + } + + function scrollIntoView(path, id) { + if (!id) { + return } - - var cached$1 = {}; - - function walkFetchEmbed(ref, cb) { - var embedTokens = ref.embedTokens; - var compile = ref.compile; - var fetch = ref.fetch; - - var token; - var step = 0; - var count = 1; - - if (!embedTokens.length) { - return cb({}) - } - - while ((token = embedTokens[step++])) { - var next = (function (token) { - return function (text) { - var embedToken; - if (text) { - if (token.embed.type === 'markdown') { - embedToken = compile.lexer(text); - } else if (token.embed.type === 'code') { - if (token.embed.fragment) { - var fragment = token.embed.fragment; - var pattern = new RegExp(("(?:###|\\/\\/\\/)\\s*\\[" + fragment + "\\]([\\s\\S]*)(?:###|\\/\\/\\/)\\s*\\[" + fragment + "\\]")); - text = ((text.match(pattern) || [])[1] || '').trim(); - } - embedToken = compile.lexer( - '```' + - token.embed.lang + - '\n' + - text.replace(/`/g, '@DOCSIFY_QM@') + - '\n```\n' - ); - } else if (token.embed.type === 'mermaid') { - embedToken = [ - {type: 'html', text: ("
    \n" + text + "\n
    ")} - ]; - embedToken.links = {}; - } else { - embedToken = [{type: 'html', text: text}]; - embedToken.links = {}; + + var section = find('#' + id); + section && scrollTo(section); + + var li = nav[getNavKey(path, id)]; + var sidebar = getNode('.sidebar'); + var active = find(sidebar, 'li.active'); + active && active.classList.remove('active'); + li && li.classList.add('active'); + } + + var scrollEl = $.scrollingElement || $.documentElement; + + function scroll2Top(offset) { + if ( offset === void 0 ) offset = 0; + + scrollEl.scrollTop = offset === true ? 0 : Number(offset); + } + + var cached$1 = {}; + + function walkFetchEmbed(ref, cb) { + var embedTokens = ref.embedTokens; + var compile = ref.compile; + var fetch = ref.fetch; + + var token; + var step = 0; + var count = 1; + + if (!embedTokens.length) { + return cb({}) + } + + while ((token = embedTokens[step++])) { + var next = (function (token) { + return function (text) { + var embedToken; + if (text) { + if (token.embed.type === 'markdown') { + embedToken = compile.lexer(text); + } else if (token.embed.type === 'code') { + if (token.embed.fragment) { + var fragment = token.embed.fragment; + var pattern = new RegExp(("(?:###|\\/\\/\\/)\\s*\\[" + fragment + "\\]([\\s\\S]*)(?:###|\\/\\/\\/)\\s*\\[" + fragment + "\\]")); + text = ((text.match(pattern) || [])[1] || '').trim(); } - } - cb({token: token, embedToken: embedToken}); - if (++count >= step) { - cb({}); + embedToken = compile.lexer( + '```' + + token.embed.lang + + '\n' + + text.replace(/`/g, '@DOCSIFY_QM@') + + '\n```\n' + ); + } else if (token.embed.type === 'mermaid') { + embedToken = [ + {type: 'html', text: ("
    \n" + text + "\n
    ")} + ]; + embedToken.links = {}; + } else { + embedToken = [{type: 'html', text: text}]; + embedToken.links = {}; } } - })(token); - - if (token.embed.url) { - { - get(token.embed.url).then(next); + cb({token: token, embedToken: embedToken}); + if (++count >= step) { + cb({}); } - } else { - next(token.embed.html); } + })(token); + + if (token.embed.url) { + { + get(token.embed.url).then(next); + } + } else { + next(token.embed.html); } } - - function prerenderEmbed(ref, done) { - var compiler = ref.compiler; - var raw = ref.raw; if ( raw === void 0 ) raw = ''; - var fetch = ref.fetch; - - var hit = cached$1[raw]; - if (hit) { - var copy = hit.slice(); - copy.links = hit.links; - return done(copy) - } - - var compile = compiler._marked; - var tokens = compile.lexer(raw); - var embedTokens = []; - var linkRE = compile.InlineLexer.rules.link; - var links = tokens.links; - - tokens.forEach(function (token, index) { - if (token.type === 'paragraph') { - token.text = token.text.replace( - new RegExp(linkRE.source, 'g'), - function (src, filename, href, title) { - var embed = compiler.compileEmbed(href, title); - - if (embed) { - embedTokens.push({ - index: index, - embed: embed - }); - } - - return src + } + + function prerenderEmbed(ref, done) { + var compiler = ref.compiler; + var raw = ref.raw; if ( raw === void 0 ) raw = ''; + var fetch = ref.fetch; + + var hit = cached$1[raw]; + if (hit) { + var copy = hit.slice(); + copy.links = hit.links; + return done(copy) + } + + var compile = compiler._marked; + var tokens = compile.lexer(raw); + var embedTokens = []; + var linkRE = compile.InlineLexer.rules.link; + var links = tokens.links; + + tokens.forEach(function (token, index) { + if (token.type === 'paragraph') { + token.text = token.text.replace( + new RegExp(linkRE.source, 'g'), + function (src, filename, href, title) { + var embed = compiler.compileEmbed(href, title); + + if (embed) { + embedTokens.push({ + index: index, + embed: embed + }); } - ); - } - }); - - var moveIndex = 0; - walkFetchEmbed({compile: compile, embedTokens: embedTokens, fetch: fetch}, function (ref) { - var embedToken = ref.embedToken; - var token = ref.token; - - if (token) { - var index = token.index + moveIndex; - - merge(links, embedToken.links); - - tokens = tokens - .slice(0, index) - .concat(embedToken, tokens.slice(index + 1)); - moveIndex += embedToken.length - 1; - } else { - cached$1[raw] = tokens.concat(); - tokens.links = cached$1[raw].links = links; - done(tokens); - } - }); + + return src + } + ); + } + }); + + var moveIndex = 0; + walkFetchEmbed({compile: compile, embedTokens: embedTokens, fetch: fetch}, function (ref) { + var embedToken = ref.embedToken; + var token = ref.token; + + if (token) { + var index = token.index + moveIndex; + + merge(links, embedToken.links); + + tokens = tokens + .slice(0, index) + .concat(embedToken, tokens.slice(index + 1)); + moveIndex += embedToken.length - 1; + } else { + cached$1[raw] = tokens.concat(); + tokens.links = cached$1[raw].links = links; + done(tokens); + } + }); + } + + function executeScript() { + var script = findAll('.markdown-section>script') + .filter(function (s) { return !/template/.test(s.type); })[0]; + if (!script) { + return false } - - function executeScript() { - var script = findAll('.markdown-section>script') - .filter(function (s) { return !/template/.test(s.type); })[0]; - if (!script) { - return false - } - var code = script.innerText.trim(); - if (!code) { - return false - } - + var code = script.innerText.trim(); + if (!code) { + return false + } + + setTimeout(function (_) { + window.__EXECUTE_RESULT__ = new Function(code)(); + }, 0); + } + + function formatUpdated(html, updated, fn) { + updated = + typeof fn === 'function' ? + fn(updated) : + typeof fn === 'string' ? + tinydate(fn)(new Date(updated)) : + updated; + + return html.replace(/{docsify-updated}/g, updated) + } + + function renderMain(html) { + if (!html) { + html = '

    404 - Not found

    '; + } + + this._renderTo('.markdown-section', html); + // Render sidebar with the TOC + !this.config.loadSidebar && this._renderSidebar(); + + // Execute script + if ( + this.config.executeScript !== false && + typeof window.Vue !== 'undefined' && + !executeScript() + ) { setTimeout(function (_) { - window.__EXECUTE_RESULT__ = new Function(code)(); + var vueVM = window.__EXECUTE_RESULT__; + vueVM && vueVM.$destroy && vueVM.$destroy(); + window.__EXECUTE_RESULT__ = new window.Vue().$mount('#main'); }, 0); + } else { + this.config.executeScript && executeScript(); } - - function formatUpdated(html, updated, fn) { - updated = - typeof fn === 'function' ? - fn(updated) : - typeof fn === 'string' ? - tinydate(fn)(new Date(updated)) : - updated; - - return html.replace(/{docsify-updated}/g, updated) + } + + function renderNameLink(vm) { + var el = getNode('.app-name-link'); + var nameLink = vm.config.nameLink; + var path = vm.route.path; + + if (!el) { + return } - - function renderMain(html) { - if (!html) { - html = '

    404 - Not found

    '; + + if (isPrimitive(vm.config.nameLink)) { + el.setAttribute('href', nameLink); + } else if (typeof nameLink === 'object') { + var match = Object.keys(nameLink).filter(function (key) { return path.indexOf(key) > -1; })[0]; + + el.setAttribute('href', nameLink[match]); + } + } + + function renderMixin(proto) { + proto._renderTo = function (el, content, replace) { + var node = getNode(el); + if (node) { + node[replace ? 'outerHTML' : 'innerHTML'] = content; } - - this._renderTo('.markdown-section', html); - // Render sidebar with the TOC - !this.config.loadSidebar && this._renderSidebar(); - - // Execute script - if ( - this.config.executeScript !== false && - typeof window.Vue !== 'undefined' && - !executeScript() - ) { - setTimeout(function (_) { - var vueVM = window.__EXECUTE_RESULT__; - vueVM && vueVM.$destroy && vueVM.$destroy(); - window.__EXECUTE_RESULT__ = new window.Vue().$mount('#main'); - }, 0); + }; + + proto._renderSidebar = function (text) { + var ref = this.config; + var maxLevel = ref.maxLevel; + var subMaxLevel = ref.subMaxLevel; + var loadSidebar = ref.loadSidebar; + + this._renderTo('.sidebar-nav', this.compiler.sidebar(text, maxLevel)); + var activeEl = getAndActive(this.router, '.sidebar-nav', true, true); + if (loadSidebar && activeEl) { + activeEl.parentNode.innerHTML += + this.compiler.subSidebar(subMaxLevel) || ''; } else { - this.config.executeScript && executeScript(); + // Reset toc + this.compiler.subSidebar(); } - } - - function renderNameLink(vm) { - var el = getNode('.app-name-link'); - var nameLink = vm.config.nameLink; - var path = vm.route.path; - - if (!el) { - return - } - - if (isPrimitive(vm.config.nameLink)) { - el.setAttribute('href', nameLink); - } else if (typeof nameLink === 'object') { - var match = Object.keys(nameLink).filter(function (key) { return path.indexOf(key) > -1; })[0]; - - el.setAttribute('href', nameLink[match]); - } - } - - function renderMixin(proto) { - proto._renderTo = function (el, content, replace) { - var node = getNode(el); - if (node) { - node[replace ? 'outerHTML' : 'innerHTML'] = content; + // Bind event + this._bindEventOnRendered(activeEl); + }; + + proto._bindEventOnRendered = function (activeEl) { + var ref = this.config; + var autoHeader = ref.autoHeader; + var auto2top = ref.auto2top; + + scrollActiveSidebar(this.router); + + if (autoHeader && activeEl) { + var main$$1 = getNode('#main'); + var firstNode = main$$1.children[0]; + if (firstNode && firstNode.tagName !== 'H1') { + var h1 = create('h1'); + h1.innerText = activeEl.innerText; + before(main$$1, h1); } - }; - - proto._renderSidebar = function (text) { - var ref = this.config; - var maxLevel = ref.maxLevel; - var subMaxLevel = ref.subMaxLevel; - var loadSidebar = ref.loadSidebar; - - this._renderTo('.sidebar-nav', this.compiler.sidebar(text, maxLevel)); - var activeEl = getAndActive(this.router, '.sidebar-nav', true, true); - if (loadSidebar && activeEl) { - activeEl.parentNode.innerHTML += - this.compiler.subSidebar(subMaxLevel) || ''; + } + + auto2top && scroll2Top(auto2top); + }; + + // proto._renderNav = function (text) { + // text && this._renderTo('nav', this.compiler.compile(text)); + // if (this.config.loadNavbar) { + // getAndActive(this.router, 'nav'); + // } + // }; + + proto._renderMain = function (text, opt, next) { + var this$1 = this; + if ( opt === void 0 ) opt = {}; + + if (!text) { + return renderMain.call(this, text) + } + + callHook(this, 'beforeEach', text, function (result) { + var html; + var callback = function () { + if (opt.updatedAt) { + html = formatUpdated(html, opt.updatedAt, this$1.config.formatUpdated); + } + + callHook(this$1, 'afterEach', html, function (text) { completeLoading();return renderMain.call(this$1, text); }); + }; + if (this$1.isHTML) { + html = this$1.result = text; + callback(); + next(); } else { - // Reset toc - this.compiler.subSidebar(); - } - // Bind event - this._bindEventOnRendered(activeEl); - }; - - proto._bindEventOnRendered = function (activeEl) { - var ref = this.config; - var autoHeader = ref.autoHeader; - var auto2top = ref.auto2top; - - scrollActiveSidebar(this.router); - - if (autoHeader && activeEl) { - var main$$1 = getNode('#main'); - var firstNode = main$$1.children[0]; - if (firstNode && firstNode.tagName !== 'H1') { - var h1 = create('h1'); - h1.innerText = activeEl.innerText; - before(main$$1, h1); - } - } - - auto2top && scroll2Top(auto2top); - }; - - proto._renderNav = function (text) { - text && this._renderTo('nav', this.compiler.compile(text)); - if (this.config.loadNavbar) { - getAndActive(this.router, 'nav'); - } - }; - - proto._renderMain = function (text, opt, next) { - var this$1 = this; - if ( opt === void 0 ) opt = {}; - - if (!text) { - return renderMain.call(this, text) - } - - callHook(this, 'beforeEach', text, function (result) { - var html; - var callback = function () { - if (opt.updatedAt) { - html = formatUpdated(html, opt.updatedAt, this$1.config.formatUpdated); + prerenderEmbed( + { + compiler: this$1.compiler, + raw: result + }, + function (tokens) { + html = this$1.compiler.compile(tokens); + callback(); + next(); } - - callHook(this$1, 'afterEach', html, function (text) { completeLoading();return renderMain.call(this$1, text); }); - }; - if (this$1.isHTML) { - html = this$1.result = text; - callback(); - next(); - } else { - prerenderEmbed( - { - compiler: this$1.compiler, - raw: result - }, - function (tokens) { - html = this$1.compiler.compile(tokens); - callback(); - next(); - } - ); - } - }); - }; - - proto._renderCover = function (text, coverOnly) { - var el = getNode('.cover'); - - toggleClass(getNode('main'), coverOnly ? 'add' : 'remove', 'hidden'); - if (!text) { - toggleClass(el, 'remove', 'show'); - return + ); } - toggleClass(el, 'add', 'show'); - - var html = this.coverIsHTML ? text : this.compiler.cover(text); - - var m = html - .trim() - .match('

    ([^<]*?)

    $'); - - if (m) { - if (m[2] === 'color') { - el.style.background = m[1] + (m[3] || ''); - } else { - var path = m[1]; - - toggleClass(el, 'add', 'has-mask'); - if (!isAbsolutePath(m[1])) { - path = getPath(this.router.getBasePath(), m[1]); - } - el.style.backgroundImage = "url(" + path + ")"; - el.style.backgroundSize = 'cover'; - el.style.backgroundPosition = 'center center'; - } - html = html.replace(m[0], ''); - } - - this._renderTo('.cover-main', html); - sticky(); - }; - - proto._updateRender = function () { - // Render name link - renderNameLink(this); - }; - } - - function initRender(vm) { - var config = vm.config; - - // Init markdown compiler - vm.compiler = new Compiler(config, vm.router); - if (inBrowser) { - window.__current_docsify_compiler__ = vm.compiler; - } - - var id = config.el || '#app'; - var navEl = find('nav') || create('nav'); - - var el = find(id); - var html = ''; - var navAppendToTarget = body; - - if (el) { - if (config.repo) { - html += corner(config.repo); - } - if (config.coverpage) { - html += cover(); - } - - if (config.logo) { - var isBase64 = /^data:image/.test(config.logo); - var isExternal = /(?:http[s]?:)?\/\//.test(config.logo); - var isRelative = /^\./.test(config.logo); - - if (!isBase64 && !isExternal && !isRelative) { - config.logo = getPath(vm.router.getBasePath(), config.logo); - } - } - - html += main(config); - // Render main app - vm._renderTo(el, html, true); - } else { - vm.rendered = true; - } - - if (config.mergeNavbar && isMobile) { - navAppendToTarget = find('.sidebar'); - } else { - navEl.classList.add('app-nav'); - - if (!config.repo) { - navEl.classList.add('no-badge'); - } - } - - // Add nav - if (config.loadNavbar) { - before(navAppendToTarget, navEl); - } - - if (config.themeColor) { - $.head.appendChild( - create('div', theme(config.themeColor)).firstElementChild - ); - // Polyfll - cssVars(config.themeColor); - } - vm._updateRender(); - toggleClass(body, 'ready'); - } - - var cached$2 = {}; - - function getAlias(path, alias, last) { - var match = Object.keys(alias).filter(function (key) { - var re = cached$2[key] || (cached$2[key] = new RegExp(("^" + key + "$"))); - return re.test(path) && path !== last - })[0]; - - return match ? - getAlias(path.replace(cached$2[match], alias[match]), alias, path) : - path - } - - function getFileName(path, ext) { - return new RegExp(("\\.(" + (ext.replace(/^\./, '')) + "|html)$"), 'g').test(path) ? - path : - /\/$/g.test(path) ? (path + "README" + ext) : ("" + path + ext) - } - - var History = function History(config) { - this.config = config; - }; - - History.prototype.getBasePath = function getBasePath () { - return this.config.basePath - }; - - History.prototype.getFile = function getFile (path, isRelative) { - if ( path === void 0 ) path = this.getCurrentPath(); - - var ref = this; - var config = ref.config; - var base = this.getBasePath(); - var ext = typeof config.ext === 'string' ? config.ext : '.md'; - - path = config.alias ? getAlias(path, config.alias) : path; - path = getFileName(path, ext); - path = path === ("/README" + ext) ? config.homepage || path : path; - path = isAbsolutePath(path) ? path : getPath(base, path); - - if (isRelative) { - path = path.replace(new RegExp(("^" + base)), ''); - } - - return path - }; - - History.prototype.onchange = function onchange (cb) { - if ( cb === void 0 ) cb = noop; - - cb(); - }; - - History.prototype.getCurrentPath = function getCurrentPath () {}; - - History.prototype.normalize = function normalize () {}; - - History.prototype.parse = function parse () {}; - - History.prototype.toURL = function toURL (path, params, currentRoute) { - var local = currentRoute && path[0] === '#'; - var route = this.parse(replaceSlug(path)); - - route.query = merge({}, route.query, params); - path = route.path + stringifyQuery(route.query); - path = path.replace(/\.md(\?)|\.md$/, '$1'); - - if (local) { - var idIndex = currentRoute.indexOf('?'); - path = - (idIndex > 0 ? currentRoute.substring(0, idIndex) : currentRoute) + path; - } - - if (this.config.relativePath && path.indexOf('/') !== 0) { - var currentDir = currentRoute.substring(0, currentRoute.lastIndexOf('/') + 1); - return cleanPath(resolvePath(currentDir + path)) - } - return cleanPath('/' + path) - }; - - function replaceHash(path) { - var i = location.href.indexOf('#'); - location.replace(location.href.slice(0, i >= 0 ? i : 0) + '#' + path); - } - - var HashHistory = (function (History$$1) { - function HashHistory(config) { - History$$1.call(this, config); - this.mode = 'hash'; - } - - if ( History$$1 ) HashHistory.__proto__ = History$$1; - HashHistory.prototype = Object.create( History$$1 && History$$1.prototype ); - HashHistory.prototype.constructor = HashHistory; - - HashHistory.prototype.getBasePath = function getBasePath () { - var path = window.location.pathname || ''; - var base = this.config.basePath; - - return /^(\/|https?:)/g.test(base) ? base : cleanPath(path + '/' + base) - }; - - HashHistory.prototype.getCurrentPath = function getCurrentPath () { - // We can't use location.hash here because it's not - // consistent across browsers - Firefox will pre-decode it! - var href = location.href; - var index = href.indexOf('#'); - return index === -1 ? '' : href.slice(index + 1) - }; - - HashHistory.prototype.onchange = function onchange (cb) { - if ( cb === void 0 ) cb = noop; - - on('hashchange', cb); - }; - - HashHistory.prototype.normalize = function normalize () { - var path = this.getCurrentPath(); - - path = replaceSlug(path); - - if (path.charAt(0) === '/') { - return replaceHash(path) - } - replaceHash('/' + path); - }; - - /** - * Parse the url - * @param {string} [path=location.herf] - * @return {object} { path, query } - */ - HashHistory.prototype.parse = function parse (path) { - if ( path === void 0 ) path = location.href; - - var query = ''; - - var hashIndex = path.indexOf('#'); - if (hashIndex >= 0) { - path = path.slice(hashIndex + 1); - } - - var queryIndex = path.indexOf('?'); - if (queryIndex >= 0) { - query = path.slice(queryIndex + 1); - path = path.slice(0, queryIndex); - } - - return { - path: path, - file: this.getFile(path, true), - query: parseQuery(query) - } - }; - - HashHistory.prototype.toURL = function toURL (path, params, currentRoute) { - return '#' + History$$1.prototype.toURL.call(this, path, params, currentRoute) - }; - - return HashHistory; - }(History)); - - var HTML5History = (function (History$$1) { - function HTML5History(config) { - History$$1.call(this, config); - this.mode = 'history'; - } - - if ( History$$1 ) HTML5History.__proto__ = History$$1; - HTML5History.prototype = Object.create( History$$1 && History$$1.prototype ); - HTML5History.prototype.constructor = HTML5History; - - HTML5History.prototype.getCurrentPath = function getCurrentPath () { - var base = this.getBasePath(); - var path = window.location.pathname; - - if (base && path.indexOf(base) === 0) { - path = path.slice(base.length); - } - - return (path || '/') + window.location.search + window.location.hash - }; - - HTML5History.prototype.onchange = function onchange (cb) { - if ( cb === void 0 ) cb = noop; - - on('click', function (e) { - var el = e.target.tagName === 'A' ? e.target : e.target.parentNode; - - if (el.tagName === 'A' && !/_blank/.test(el.target)) { - e.preventDefault(); - var url = el.href; - window.history.pushState({key: url}, '', url); - cb(); - } - }); - - on('popstate', cb); - }; - - /** - * Parse the url - * @param {string} [path=location.href] - * @return {object} { path, query } - */ - HTML5History.prototype.parse = function parse (path) { - if ( path === void 0 ) path = location.href; - - var query = ''; - - var queryIndex = path.indexOf('?'); - if (queryIndex >= 0) { - query = path.slice(queryIndex + 1); - path = path.slice(0, queryIndex); - } - - var base = getPath(location.origin); - var baseIndex = path.indexOf(base); - - if (baseIndex > -1) { - path = path.slice(baseIndex + base.length); - } - - return { - path: path, - file: this.getFile(path), - query: parseQuery(query) - } - }; - - return HTML5History; - }(History)); - - function routerMixin(proto) { - proto.route = {}; - } - - var lastRoute = {}; - - function updateRender(vm) { - vm.router.normalize(); - vm.route = vm.router.parse(); - body.setAttribute('data-page', vm.route.file); - } - - function initRouter(vm) { - var config = vm.config; - var mode = config.routerMode || 'hash'; - var router; - - if (mode === 'history' && supportsPushState) { - router = new HTML5History(config); - } else { - router = new HashHistory(config); - } - - vm.router = router; - updateRender(vm); - lastRoute = vm.route; - - router.onchange(function (_) { - updateRender(vm); - vm._updateRender(); - - if (lastRoute.path === vm.route.path) { - vm.$resetEvents(); - return - } - - vm.$fetch(); - lastRoute = vm.route; }); + }; + + // proto._renderCover = function (text, coverOnly) { + // var el = getNode('.cover'); + + // toggleClass(getNode('main'), coverOnly ? 'add' : 'remove', 'hidden'); + // if (!text) { + // toggleClass(el, 'remove', 'show'); + // return + // } + // toggleClass(el, 'add', 'show'); + + // var html = this.coverIsHTML ? text : this.compiler.cover(text); + + // var m = html + // .trim() + // .match('

    ([^<]*?)

    $'); + + // if (m) { + // if (m[2] === 'color') { + // el.style.background = m[1] + (m[3] || ''); + // } else { + // var path = m[1]; + + // toggleClass(el, 'add', 'has-mask'); + // if (!isAbsolutePath(m[1])) { + // path = getPath(this.router.getBasePath(), m[1]); + // } + // el.style.backgroundImage = "url(" + path + ")"; + // el.style.backgroundSize = 'cover'; + // el.style.backgroundPosition = 'center center'; + // } + // html = html.replace(m[0], ''); + // } + + // this._renderTo('.cover-main', html); + // sticky(); + // }; + + proto._updateRender = function () { + // Render name link + renderNameLink(this); + }; + } + + function initRender(vm) { + var config = vm.config; + + // Init markdown compiler + vm.compiler = new Compiler(config, vm.router); + if (inBrowser) { + window.__current_docsify_compiler__ = vm.compiler; } - - function eventMixin(proto) { - proto.$resetEvents = function () { - scrollIntoView(this.route.path, this.route.query.id); - - if (this.config.loadNavbar) { - getAndActive(this.router, 'nav'); + + var id = config.el || '#app'; + var navEl = find('nav') || create('nav'); + + var el = find(id); + var html = ''; + var navAppendToTarget = body; + + if (el) { + if (config.repo) { + html += corner(config.repo); + } + if (config.coverpage) { + html += cover(); + } + + if (config.logo) { + var isBase64 = /^data:image/.test(config.logo); + var isExternal = /(?:http[s]?:)?\/\//.test(config.logo); + var isRelative = /^\./.test(config.logo); + + if (!isBase64 && !isExternal && !isRelative) { + config.logo = getPath(vm.router.getBasePath(), config.logo); } - }; + } + + html += main(config); + // Render main app + vm._renderTo(el, html, true); + } else { + vm.rendered = true; } - - function initEvent(vm) { - // Bind toggle button - btn('button.sidebar-toggle', vm.router); - collapse('.sidebar', vm.router); - // Bind sticky effect - if (vm.config.coverpage) { - !isMobile && on('scroll', sticky); - } else { - body.classList.add('sticky'); + + if (config.mergeNavbar && isMobile) { + navAppendToTarget = find('.sidebar'); + } else { + navEl.classList.add('app-nav'); + + if (!config.repo) { + navEl.classList.add('no-badge'); } } - - function loadNested(path, qs, file, next, vm, first) { - path = first ? path : path.replace(/\/$/, ''); - path = getParentPath(path); - - if (!path) { + + // Add nav + if (config.loadNavbar) { + before(navAppendToTarget, navEl); + } + + if (config.themeColor) { + $.head.appendChild( + create('div', theme(config.themeColor)).firstElementChild + ); + // Polyfll + cssVars(config.themeColor); + } + vm._updateRender(); + toggleClass(body, 'ready'); + } + + var cached$2 = {}; + + function getAlias(path, alias, last) { + var match = Object.keys(alias).filter(function (key) { + var re = cached$2[key] || (cached$2[key] = new RegExp(("^" + key + "$"))); + return re.test(path) && path !== last + })[0]; + + return match ? + getAlias(path.replace(cached$2[match], alias[match]), alias, path) : + path + } + + function getFileName(path, ext) { + return new RegExp(("\\.(" + (ext.replace(/^\./, '')) + "|html)$"), 'g').test(path) ? + path : + /\/$/g.test(path) ? (path + "README" + ext) : ("" + path + ext) + } + + var History = function History(config) { + this.config = config; + }; + + History.prototype.getBasePath = function getBasePath () { + return this.config.basePath + }; + + History.prototype.getFile = function getFile (path, isRelative) { + if ( path === void 0 ) path = this.getCurrentPath(); + + var ref = this; + var config = ref.config; + var base = this.getBasePath(); + var ext = typeof config.ext === 'string' ? config.ext : '.md'; + + path = config.alias ? getAlias(path, config.alias) : path; + path = getFileName(path, ext); + path = path === ("/README" + ext) ? config.homepage || path : path; + path = isAbsolutePath(path) ? path : getPath(base, path); + + if (isRelative) { + path = path.replace(new RegExp(("^" + base)), ''); + } + + return path + }; + + History.prototype.onchange = function onchange (cb) { + if ( cb === void 0 ) cb = noop; + + cb(); + }; + + History.prototype.getCurrentPath = function getCurrentPath () {}; + + History.prototype.normalize = function normalize () {}; + + History.prototype.parse = function parse () {}; + + History.prototype.toURL = function toURL (path, params, currentRoute) { + var local = currentRoute && path[0] === '#'; + var route = this.parse(replaceSlug(path)); + + route.query = merge({}, route.query, params); + path = route.path + stringifyQuery(route.query); + path = path.replace(/\.md(\?)|\.md$/, '$1'); + + if (local) { + var idIndex = currentRoute.indexOf('?'); + path = + (idIndex > 0 ? currentRoute.substring(0, idIndex) : currentRoute) + path; + } + + if (this.config.relativePath && path.indexOf('/') !== 0) { + var currentDir = currentRoute.substring(0, currentRoute.lastIndexOf('/') + 1); + return cleanPath(resolvePath(currentDir + path)) + } + return cleanPath('/' + path) + }; + + function replaceHash(path) { + var i = location.href.indexOf('#'); + location.replace(location.href.slice(0, i >= 0 ? i : 0) + '#' + path); + } + + var HashHistory = (function (History$$1) { + function HashHistory(config) { + History$$1.call(this, config); + this.mode = 'hash'; + } + + if ( History$$1 ) HashHistory.__proto__ = History$$1; + HashHistory.prototype = Object.create( History$$1 && History$$1.prototype ); + HashHistory.prototype.constructor = HashHistory; + + HashHistory.prototype.getBasePath = function getBasePath () { + var path = window.location.pathname || ''; + var base = this.config.basePath; + + return /^(\/|https?:)/g.test(base) ? base : cleanPath(path + '/' + base) + }; + + HashHistory.prototype.getCurrentPath = function getCurrentPath () { + // We can't use location.hash here because it's not + // consistent across browsers - Firefox will pre-decode it! + var href = location.href; + var index = href.indexOf('#'); + return index === -1 ? '' : href.slice(index + 1) + }; + + HashHistory.prototype.onchange = function onchange (cb) { + if ( cb === void 0 ) cb = noop; + + on('hashchange', cb); + }; + + HashHistory.prototype.normalize = function normalize () { + var path = this.getCurrentPath(); + + path = replaceSlug(path); + + if (path.charAt(0) === '/') { + return replaceHash(path) + } + replaceHash('/' + path); + }; + + /** + * Parse the url + * @param {string} [path=location.herf] + * @return {object} { path, query } + */ + HashHistory.prototype.parse = function parse (path) { + if ( path === void 0 ) path = location.href; + + var query = ''; + + var hashIndex = path.indexOf('#'); + if (hashIndex >= 0) { + path = path.slice(hashIndex + 1); + } + + var queryIndex = path.indexOf('?'); + if (queryIndex >= 0) { + query = path.slice(queryIndex + 1); + path = path.slice(0, queryIndex); + } + + return { + path: path, + file: this.getFile(path, true), + query: parseQuery(query) + } + }; + + HashHistory.prototype.toURL = function toURL (path, params, currentRoute) { + return '#' + History$$1.prototype.toURL.call(this, path, params, currentRoute) + }; + + return HashHistory; + }(History)); + + var HTML5History = (function (History$$1) { + function HTML5History(config) { + History$$1.call(this, config); + this.mode = 'history'; + } + + if ( History$$1 ) HTML5History.__proto__ = History$$1; + HTML5History.prototype = Object.create( History$$1 && History$$1.prototype ); + HTML5History.prototype.constructor = HTML5History; + + HTML5History.prototype.getCurrentPath = function getCurrentPath () { + var base = this.getBasePath(); + var path = window.location.pathname; + + if (base && path.indexOf(base) === 0) { + path = path.slice(base.length); + } + + return (path || '/') + window.location.search + window.location.hash + }; + + HTML5History.prototype.onchange = function onchange (cb) { + if ( cb === void 0 ) cb = noop; + + on('click', function (e) { + var el = e.target.tagName === 'A' ? e.target : e.target.parentNode; + + if (el.tagName === 'A' && !/_blank/.test(el.target)) { + e.preventDefault(); + var url = el.href; + window.history.pushState({key: url}, '', url); + cb(); + } + }); + + on('popstate', cb); + }; + + /** + * Parse the url + * @param {string} [path=location.href] + * @return {object} { path, query } + */ + HTML5History.prototype.parse = function parse (path) { + if ( path === void 0 ) path = location.href; + + var query = ''; + + var queryIndex = path.indexOf('?'); + if (queryIndex >= 0) { + query = path.slice(queryIndex + 1); + path = path.slice(0, queryIndex); + } + + var base = getPath(location.origin); + var baseIndex = path.indexOf(base); + + if (baseIndex > -1) { + path = path.slice(baseIndex + base.length); + } + + return { + path: path, + file: this.getFile(path), + query: parseQuery(query) + } + }; + + return HTML5History; + }(History)); + + function routerMixin(proto) { + proto.route = {}; + } + + var lastRoute = {}; + + function updateRender(vm) { + vm.router.normalize(); + vm.route = vm.router.parse(); + body.setAttribute('data-page', vm.route.file); + } + + function initRouter(vm) { + var config = vm.config; + var mode = config.routerMode || 'hash'; + var router; + + if (mode === 'history' && supportsPushState) { + router = new HTML5History(config); + } else { + router = new HashHistory(config); + } + + vm.router = router; + updateRender(vm); + lastRoute = vm.route; + + router.onchange(function (_) { + updateRender(vm); + vm._updateRender(); + + if (lastRoute.path === vm.route.path) { + vm.$resetEvents(); return } - - get( - vm.router.getFile(path + file) + qs, - false, - vm.config.requestHeaders - ).then(next, function (_) { return loadNested(path, qs, file, next, vm); }); + + vm.$fetch(); + lastRoute = vm.route; + }); + } + + function eventMixin(proto) { + proto.$resetEvents = function () { + scrollIntoView(this.route.path, this.route.query.id); + + if (this.config.loadNavbar) { + getAndActive(this.router, 'nav'); + } + }; + } + + function initEvent(vm) { + // Bind toggle button + btn('button.sidebar-toggle', vm.router); + collapse('.sidebar', vm.router); + // Bind sticky effect + if (vm.config.coverpage) { + !isMobile && on('scroll', sticky); + } else { + body.classList.add('sticky'); } - - function fetchMixin(proto) { - var last; - - var abort = function () { return last && last.abort && last.abort(); }; - var request = function (url, hasbar, requestHeaders) { - abort(); - last = get(url, true, requestHeaders); - return last - }; - - var get404Path = function (path, config) { - var notFoundPage = config.notFoundPage; - var ext = config.ext; - var defaultPath = '_404' + (ext || '.md'); - var key; - var path404; - - switch (typeof notFoundPage) { - case 'boolean': - path404 = defaultPath; - break - case 'string': - path404 = notFoundPage; - break - - case 'object': - key = Object.keys(notFoundPage) - .sort(function (a, b) { return b.length - a.length; }) - .find(function (key) { return path.match(new RegExp('^' + key)); }); - - path404 = (key && notFoundPage[key]) || defaultPath; - break - - default: - break + } + + function loadNested(path, qs, file, next, vm, first) { + path = first ? path : path.replace(/\/$/, ''); + path = getParentPath(path); + + if (!path) { + return + } + + get( + vm.router.getFile(path + file) + qs, + false, + vm.config.requestHeaders + ).then(next, function (_) { return loadNested(path, qs, file, next, vm); }); + } + + function fetchMixin(proto) { + var last; + + var abort = function () { return last && last.abort && last.abort(); }; + var request = function (url, hasbar, requestHeaders) { + abort(); + last = get(url, true, requestHeaders); + return last + }; + + var get404Path = function (path, config) { + var notFoundPage = config.notFoundPage; + var ext = config.ext; + var defaultPath = '_404' + (ext || '.md'); + var key; + var path404; + + switch (typeof notFoundPage) { + case 'boolean': + path404 = defaultPath; + break + case 'string': + path404 = notFoundPage; + break + + case 'object': + key = Object.keys(notFoundPage) + .sort(function (a, b) { return b.length - a.length; }) + .find(function (key) { return path.match(new RegExp('^' + key)); }); + + path404 = (key && notFoundPage[key]) || defaultPath; + break + + default: + break + } + + return path404 + }; + + proto._loadSideAndNav = function (path, qs, loadSidebar, cb) { + var this$1 = this; + + return function () { + if (!loadSidebar) { + return cb() } - - return path404 - }; - - proto._loadSideAndNav = function (path, qs, loadSidebar, cb) { - var this$1 = this; - - return function () { - if (!loadSidebar) { - return cb() - } - - var fn = function (result) { - this$1._renderSidebar(result); - cb(); - }; - - // Load sidebar - loadNested(path, qs, loadSidebar, fn, this$1, true); - } - }; - - proto._fetch = function (cb) { - var this$1 = this; - if ( cb === void 0 ) cb = noop; - - var ref = this.route; - var path = ref.path; - var query = ref.query; - var qs = stringifyQuery(query, ['id']); - var ref$1 = this.config; - var loadNavbar = ref$1.loadNavbar; - var requestHeaders = ref$1.requestHeaders; - var loadSidebar = ref$1.loadSidebar; - // Abort last request - - var file = this.router.getFile(path); - var req = request(file + qs, true, requestHeaders); - - // Current page is html - this.isHTML = /\.html$/g.test(file); - - // Load main content - req.then( - function (text, opt) { return this$1._renderMain( - text, - opt, - this$1._loadSideAndNav(path, qs, loadSidebar, cb) - ); }, - function (_) { - this$1._fetchFallbackPage(file, qs, cb) || this$1._fetch404(file, qs, cb); - } - ); - - // Load nav - loadNavbar && - loadNested( - path, - qs, - loadNavbar, - function (text) { return this$1._renderNav(text); }, - this, - true - ); - }; - - proto._fetchCover = function () { - var this$1 = this; - - var ref = this.config; - var coverpage = ref.coverpage; - var requestHeaders = ref.requestHeaders; - var query = this.route.query; - var root = getParentPath(this.route.path); - - if (coverpage) { - var path = null; - var routePath = this.route.path; - if (typeof coverpage === 'string') { - if (routePath === '/') { - path = coverpage; - } - } else if (Array.isArray(coverpage)) { - path = coverpage.indexOf(routePath) > -1 && '_coverpage'; - } else { - var cover = coverpage[routePath]; - path = cover === true ? '_coverpage' : cover; - } - - var coverOnly = Boolean(path) && this.config.onlyCover; - if (path) { - path = this.router.getFile(root + path); - this.coverIsHTML = /\.html$/g.test(path); - get(path + stringifyQuery(query, ['id']), false, requestHeaders).then( - function (text) { return this$1._renderCover(text, coverOnly); } - ); - } else { - this._renderCover(null, coverOnly); - } - return coverOnly - } - }; - - proto.$fetch = function (cb) { - var this$1 = this; - if ( cb === void 0 ) cb = noop; - - var done = function () { - callHook(this$1, 'doneEach'); + + var fn = function (result) { + this$1._renderSidebar(result); cb(); }; - - var onlyCover = this._fetchCover(); - - if (onlyCover) { - done(); - } else { - this._fetch(function () { - this$1.$resetEvents(); - done(); - }); + + // Load sidebar + loadNested(path, qs, loadSidebar, fn, this$1, true); + } + }; + + proto._fetch = function (cb) { + var this$1 = this; + if ( cb === void 0 ) cb = noop; + + var ref = this.route; + var path = ref.path; + var query = ref.query; + var qs = stringifyQuery(query, ['id']); + var ref$1 = this.config; + var loadNavbar = ref$1.loadNavbar; + var requestHeaders = ref$1.requestHeaders; + var loadSidebar = ref$1.loadSidebar; + // Abort last request + + var file = this.router.getFile(path); + var req = request(file + qs, true, requestHeaders); + + // Current page is html + this.isHTML = /\.html$/g.test(file); + + // Load main content + req.then( + function (text, opt) { return this$1._renderMain( + text, + opt, + this$1._loadSideAndNav(path, qs, loadSidebar, cb) + ); }, + function (_) { + this$1._fetchFallbackPage(file, qs, cb) || this$1._fetch404(file, qs, cb); } - }; - - proto._fetchFallbackPage = function (path, qs, cb) { - var this$1 = this; - if ( cb === void 0 ) cb = noop; - - var ref = this.config; - var requestHeaders = ref.requestHeaders; - var fallbackLanguages = ref.fallbackLanguages; - var loadSidebar = ref.loadSidebar; - - if (!fallbackLanguages) { - return false - } - - var local = path.split('/')[1]; - - if (fallbackLanguages.indexOf(local) === -1) { - return false - } - var newPath = path.replace(new RegExp(("^/" + local)), ''); - var req = request(newPath + qs, true, requestHeaders); - - req.then( - function (text, opt) { return this$1._renderMain( - text, - opt, - this$1._loadSideAndNav(path, qs, loadSidebar, cb) - ); }, - function () { return this$1._fetch404(path, qs, cb); } + ); + + // Load nav + loadNavbar && + loadNested( + path, + qs, + loadNavbar, + function (text) { return this$1._renderNav(text); }, + this, + true ); - - return true - }; - /** - * Load the 404 page - * @param path - * @param qs - * @param cb - * @returns {*} - * @private - */ - proto._fetch404 = function (path, qs, cb) { - var this$1 = this; - if ( cb === void 0 ) cb = noop; - - var ref = this.config; - var loadSidebar = ref.loadSidebar; - var requestHeaders = ref.requestHeaders; - var notFoundPage = ref.notFoundPage; - - var fnLoadSideAndNav = this._loadSideAndNav(path, qs, loadSidebar, cb); - if (notFoundPage) { - var path404 = get404Path(path, this.config); - - request(this.router.getFile(path404), true, requestHeaders).then( - function (text, opt) { return this$1._renderMain(text, opt, fnLoadSideAndNav); }, - function () { return this$1._renderMain(null, {}, fnLoadSideAndNav); } + }; + + proto._fetchCover = function () { + var this$1 = this; + + var ref = this.config; + var coverpage = ref.coverpage; + var requestHeaders = ref.requestHeaders; + var query = this.route.query; + var root = getParentPath(this.route.path); + + if (coverpage) { + var path = null; + var routePath = this.route.path; + if (typeof coverpage === 'string') { + if (routePath === '/') { + path = coverpage; + } + } else if (Array.isArray(coverpage)) { + path = coverpage.indexOf(routePath) > -1 && '_coverpage'; + } else { + var cover = coverpage[routePath]; + path = cover === true ? '_coverpage' : cover; + } + + var coverOnly = Boolean(path) && this.config.onlyCover; + if (path) { + path = this.router.getFile(root + path); + this.coverIsHTML = /\.html$/g.test(path); + get(path + stringifyQuery(query, ['id']), false, requestHeaders).then( + function (text) { return this$1._renderCover(text, coverOnly); } ); - return true + } else { + this._renderCover(null, coverOnly); } - - this._renderMain(null, {}, fnLoadSideAndNav); - return false + return coverOnly + } + }; + + proto.$fetch = function (cb) { + var this$1 = this; + if ( cb === void 0 ) cb = noop; + + var done = function () { + callHook(this$1, 'doneEach'); + cb(); }; - } - - function initFetch(vm) { - var ref = vm.config; - var loadSidebar = ref.loadSidebar; - - // Server-Side Rendering - if (vm.rendered) { - var activeEl = getAndActive(vm.router, '.sidebar-nav', true, true); - if (loadSidebar && activeEl) { - activeEl.parentNode.innerHTML += window.__SUB_SIDEBAR__; - } - vm._bindEventOnRendered(activeEl); - vm.$resetEvents(); - callHook(vm, 'doneEach'); - callHook(vm, 'ready'); + + var onlyCover = this._fetchCover(); + + if (onlyCover) { + done(); } else { - vm.$fetch(function (_) { return callHook(vm, 'ready'); }); + this._fetch(function () { + this$1.$resetEvents(); + done(); + }); } - } - - function initMixin(proto) { - proto._init = function () { - var vm = this; - vm.config = config(); - - initLifecycle(vm); // Init hooks - initPlugin(vm); // Install plugins - callHook(vm, 'init'); - initRouter(vm); // Add router - initRender(vm); // Render base DOM - initEvent(vm); // Bind events - initFetch(vm); // Fetch data - callHook(vm, 'mounted'); - }; - } - - function initPlugin(vm) { - [].concat(vm.config.plugins).forEach(function (fn) { return isFn(fn) && fn(vm._lifecycle, vm); }); - } - - - - var util = Object.freeze({ - cached: cached, - hyphenate: hyphenate, - hasOwn: hasOwn, - merge: merge, - isPrimitive: isPrimitive, - noop: noop, - isFn: isFn, - inBrowser: inBrowser, - isMobile: isMobile, - supportsPushState: supportsPushState, - parseQuery: parseQuery, - stringifyQuery: stringifyQuery, - isAbsolutePath: isAbsolutePath, - getParentPath: getParentPath, - cleanPath: cleanPath, - resolvePath: resolvePath, - getPath: getPath, - replaceSlug: replaceSlug - }); - - function initGlobalAPI () { - window.Docsify = { - util: util, - dom: dom, - get: get, - slugify: slugify, - version: '4.9.4' - }; - window.DocsifyCompiler = Compiler; - window.marked = marked; - window.Prism = prism; - } - - /** - * Fork https://github.com/bendrucker/document-ready/blob/master/index.js - */ - function ready(callback) { - var state = document.readyState; - - if (state === 'complete' || state === 'interactive') { - return setTimeout(callback, 0) + }; + + proto._fetchFallbackPage = function (path, qs, cb) { + var this$1 = this; + if ( cb === void 0 ) cb = noop; + + var ref = this.config; + var requestHeaders = ref.requestHeaders; + var fallbackLanguages = ref.fallbackLanguages; + var loadSidebar = ref.loadSidebar; + + if (!fallbackLanguages) { + return false } - - document.addEventListener('DOMContentLoaded', callback); - } - - function Docsify() { - this._init(); - } - - var proto = Docsify.prototype; - - initMixin(proto); - routerMixin(proto); - renderMixin(proto); - fetchMixin(proto); - eventMixin(proto); - + + var local = path.split('/')[1]; + + if (fallbackLanguages.indexOf(local) === -1) { + return false + } + var newPath = path.replace(new RegExp(("^/" + local)), ''); + var req = request(newPath + qs, true, requestHeaders); + + req.then( + function (text, opt) { return this$1._renderMain( + text, + opt, + this$1._loadSideAndNav(path, qs, loadSidebar, cb) + ); }, + function () { return this$1._fetch404(path, qs, cb); } + ); + + return true + }; /** - * Global API + * Load the 404 page + * @param path + * @param qs + * @param cb + * @returns {*} + * @private */ - initGlobalAPI(); - - /** - * Run Docsify - */ - ready(function (_) { return new Docsify(); }); - - }()); \ No newline at end of file + proto._fetch404 = function (path, qs, cb) { + var this$1 = this; + if ( cb === void 0 ) cb = noop; + + var ref = this.config; + var loadSidebar = ref.loadSidebar; + var requestHeaders = ref.requestHeaders; + var notFoundPage = ref.notFoundPage; + + var fnLoadSideAndNav = this._loadSideAndNav(path, qs, loadSidebar, cb); + if (notFoundPage) { + var path404 = get404Path(path, this.config); + + request(this.router.getFile(path404), true, requestHeaders).then( + function (text, opt) { return this$1._renderMain(text, opt, fnLoadSideAndNav); }, + function () { return this$1._renderMain(null, {}, fnLoadSideAndNav); } + ); + return true + } + + this._renderMain(null, {}, fnLoadSideAndNav); + return false + }; + } + + function initFetch(vm) { + var ref = vm.config; + var loadSidebar = ref.loadSidebar; + + // Server-Side Rendering + if (vm.rendered) { + var activeEl = getAndActive(vm.router, '.sidebar-nav', true, true); + if (loadSidebar && activeEl) { + activeEl.parentNode.innerHTML += window.__SUB_SIDEBAR__; + } + vm._bindEventOnRendered(activeEl); + vm.$resetEvents(); + callHook(vm, 'doneEach'); + callHook(vm, 'ready'); + } else { + vm.$fetch(function (_) { return callHook(vm, 'ready'); }); + } + } + + function initMixin(proto) { + proto._init = function () { + var vm = this; + vm.config = config(); + + initLifecycle(vm); // Init hooks + initPlugin(vm); // Install plugins + callHook(vm, 'init'); + initRouter(vm); // Add router + initRender(vm); // Render base DOM + initEvent(vm); // Bind events + initFetch(vm); // Fetch data + callHook(vm, 'mounted'); + }; + } + + function initPlugin(vm) { + [].concat(vm.config.plugins).forEach(function (fn) { return isFn(fn) && fn(vm._lifecycle, vm); }); + } + + + + var util = Object.freeze({ + cached: cached, + hyphenate: hyphenate, + hasOwn: hasOwn, + merge: merge, + isPrimitive: isPrimitive, + noop: noop, + isFn: isFn, + inBrowser: inBrowser, + isMobile: isMobile, + supportsPushState: supportsPushState, + parseQuery: parseQuery, + stringifyQuery: stringifyQuery, + isAbsolutePath: isAbsolutePath, + getParentPath: getParentPath, + cleanPath: cleanPath, + resolvePath: resolvePath, + getPath: getPath, + replaceSlug: replaceSlug + }); + + function initGlobalAPI () { + window.Docsify = { + util: util, + dom: dom, + get: get, + slugify: slugify, + version: '4.9.4' + }; + window.DocsifyCompiler = Compiler; + window.marked = marked; + window.Prism = prism; + } + + /** + * Fork https://github.com/bendrucker/document-ready/blob/master/index.js + */ + function ready(callback) { + var state = document.readyState; + + if (state === 'complete' || state === 'interactive') { + return setTimeout(callback, 0) + } + + document.addEventListener('DOMContentLoaded', callback); + } + + function Docsify() { + this._init(); + } + + var proto = Docsify.prototype; + + initMixin(proto); + routerMixin(proto); + renderMixin(proto); + fetchMixin(proto); + eventMixin(proto); + + /** + * Global API + */ + initGlobalAPI(); + + /** + * Run Docsify + */ + ready(function (_) { return new Docsify(); }); + + }()); \ No newline at end of file diff --git a/docs/assets/js/docify.min.js b/docs/assets/js/docify.min.js index 8343c296..26e541f4 100644 --- a/docs/assets/js/docify.min.js +++ b/docs/assets/js/docify.min.js @@ -1,2 +1,441 @@ -!function(){function a(a){var b=Object.create(null);return function(c){var d=e(c)?c:JSON.stringify(c),f=b[d];return f||(b[d]=a(c))}}function e(a){return"string"==typeof a||"number"==typeof a}function f(){}function g(a){return"function"==typeof a}function h(){var g,h,a=d({el:"#app",repo:"",maxLevel:6,subMaxLevel:0,loadSidebar:null,loadNavbar:null,homepage:"README.md",coverpage:"",basePath:"",auto2top:!1,name:"",themeColor:"",nameLink:window.location.pathname,autoHeader:!1,executeScript:null,noEmoji:!1,ga:"",ext:".md",mergeNavbar:!1,formatUpdated:"",externalLinkTarget:"_blank",routerMode:"hash",noCompileLinks:[],relativePath:!1},window.$docsify),f=document.currentScript||[].slice.call(document.getElementsByTagName("script")).filter(function(a){return/docsify\./.test(a.src)})[0];if(f){for(g in a)c.call(a,g)&&(h=f.getAttribute("data-"+b(g)),e(h)&&(a[g]=""===h?!0:h));a.loadSidebar===!0&&(a.loadSidebar="_sidebar"+a.ext),a.loadNavbar===!0&&(a.loadNavbar="_navbar"+a.ext),a.coverpage===!0&&(a.coverpage="_coverpage"+a.ext),a.repo===!0&&(a.repo=""),a.name===!0&&(a.name="")}return window.$docsify=a,a}function i(a){var b=["init","mounted","beforeEach","afterEach","doneEach","ready"];a._hooks={},a._lifecycle={},b.forEach(function(b){var c=a._hooks[b]=[];a._lifecycle[b]=function(a){return c.push(a)}})}function j(a,b,c,d){var e,g;void 0===d&&(d=f),e=a._hooks[b],g=function(a){var f,b=e[a];a>=e.length?d(c):"function"==typeof b?2===b.length?b(c,function(b){c=b,g(a+1)}):(f=b(c),c=void 0===f?c:f,g(a+1)):g(a+1)},g(0)}function o(a,b){if(void 0===b&&(b=!1),"string"==typeof a){if("undefined"!=typeof window.Vue)return s(a);a=b?s(a):n[a]||(n[a]=s(a))}return a}function s(a,b){return null!=a?b?a.querySelector(b):p.querySelector(a):void 0}function t(a,b){return[].slice.call(b?a.querySelectorAll(b):p.querySelectorAll(a))}function u(a,b){return a=p.createElement(a),b&&(a.innerHTML=b),a}function v(a,b){return a.appendChild(b)}function w(a,b){return null!=a?a.insertBefore(b,a.children[0]):void 0}function x(a,b,c){null!=a&&(g(b)?window.addEventListener(a,b):a.addEventListener(b,c))}function y(a,b,c){g(b)?window.removeEventListener(a,b):a.removeEventListener(b,c)}function z(a,b,c){a&&a.classList[c?b:"toggle"](c||b)}function A(a){v(r,u("style",a))}function C(a){return a?(/\/\//.test(a)||(a="https://github.com/"+a),a=a.replace(/^git\+/,""),''+'"+""):""}function D(a){return'",'
    '}function E(){var a=", 100%, 85%",b="linear-gradient(to left bottom, hsl("+(Math.floor(255*Math.random())+a)+") 0%,"+"hsl("+(Math.floor(255*Math.random())+a)+") 100%)";return'
    '+'
    '+'
    '+"
    "}function F(a,b){if(void 0===b&&(b='
      {inner}
    '),!a||!a.length)return"";var c="";return a.forEach(function(a){c+='
  • '+a.title+"
  • ",a.children&&(c+=F(a.children,b))}),b.replace("{inner}",c)}function G(a,b){return'

    '+b.slice(5).trim()+"

    "}function H(a){return""}function K(){var a=u("div");a.classList.add("progress"),v(q,a),I=a}function L(a){var e,b=a.loaded,c=a.total,d=a.step;!I&&K(),d?(e=parseInt(I.style.width||0,10)+d,e=e>80?80:e):e=Math.floor(100*(b/c)),I.style.opacity=1,I.style.width=e>=95?"100%":e+"%",e>=95&&(clearTimeout(J),J=setTimeout(function(){I.style.opacity=0,I.style.width="0%"},200))}function N(a,b,d){var e,g,h,i;if(void 0===b&&(b=!1),void 0===d&&(d={}),e=new XMLHttpRequest,g=function(){e.addEventListener.apply(e,arguments)},h=M[a])return{then:function(a){return a(h.content,h.opt)},abort:f};e.open("GET",a);for(i in d)c.call(d,i)&&e.setRequestHeader(i,d[i]);return e.send(),{then:function(c,d){if(void 0===d&&(d=f),b){var h=setInterval(function(){return L({step:Math.floor(5*Math.random()+1)})},500);g("progress",L),g("loadend",function(a){L(a),clearInterval(h)})}g("error",d),g("load",function(b){var g,f=b.target;f.status>=400?d(f):(g=M[a]={content:f.response,opt:{updatedAt:e.getResponseHeader("last-modified")}},c(g.content,g.opt))})},abort:function(){return 4!==e.readyState&&e.abort()}}}function O(a,b){a.innerHTML=a.innerHTML.replace(/var\(\s*--theme-color.*?\)/g,b)}function P(a){if(!(window.CSS&&window.CSS.supports&&window.CSS.supports("(--v:red)"))){var b=t("style:not(.inserted),link");[].forEach.call(b,function(b){if("STYLE"===b.nodeName)O(b,a);else if("LINK"===b.nodeName){var c=b.getAttribute("href");if(!/\.css$/.test(c))return;N(c).then(function(b){var c=u("style",b);r.appendChild(c),O(c,a)})}})}}function S(a){var b=[],c=0;return a.replace(Q,function(d,e,f){b.push(a.substring(c,f-1)),c=f+=d.length+1,b.push(function(a){return("00"+("string"==typeof R[d]?a[R[d]]():R[d](a))).slice(-d.length)})}),c!==a.length&&b.push(a.substring(c)),function(a){for(var c="",d=0,e=a||new Date;db||(d[f]?d[f].children=(d[f].children||[]).concat(a):c.push(a),d[e]=a)}),c}function $(a){return a.toLowerCase()}function _(a){var b,d;return"string"!=typeof a?"":(b=a.trim().replace(/[A-Z]+/g,$).replace(/<[^>\d]+>/g,"").replace(Z,"").replace(/\s/g,"-").replace(/-+/g,"-").replace(/^(\d)/,"_$1"),d=Y[b],d=c.call(Y,b)?d+1:0,Y[b]=d,d&&(b=b+"-"+d),b)}function ab(a,b){return''+b+''}function bb(a){return a.replace(/<(pre|template|code)[^>]*?>[\s\S]+?<\/(pre|template|code)>/g,function(a){return a.replace(/:/g,"__colon__")}).replace(/:(\w+?):/gi,k&&window.emojify||ab).replace(/__colon__/g,":")}function eb(a){var b={};return(a=a.trim().replace(/^(\?|#|&)/,""))?(a.split("&").forEach(function(a){var c=a.replace(/\+/g," ").split("=");b[c[0]]=c[1]&&cb(c[1])}),b):b}function fb(a,b){var c,d;void 0===b&&(b=[]),c=[];for(d in a)b.indexOf(d)>-1||c.push(a[d]?(db(d)+"="+db(a[d])).toLowerCase():db(d));return c.length?"?"+c.join("&"):""}function kb(){for(var a=[],b=arguments.length;b--;)a[b]=arguments[b];return ib(a.join("/"))}function nb(a){void 0===a&&(a="");var b={};return a&&(a=a.replace(/^'/,"").replace(/'$/,"").replace(/(?:^|\s):([\w-]+)=?([\w-]+)?/g,function(a,c,d){return b[c]=d&&d.replace(/"/g,"")||!0,""}).trim()),{str:a,config:b}}function rb(a){var b=function(){return q.classList.toggle("close")};a=o(a),null!=a&&(x(a,"click",function(a){a.stopPropagation(),b()}),l&&x(q,"click",function(){return q.classList.contains("close")&&b()}))}function sb(a){a=o(a),null!=a&&x(a,"click",function(a){var b=a.target;"A"===b.nodeName&&b.nextSibling&&b.nextSibling.classList.contains("app-sub-sidebar")&&z(b.parentNode,"collapse")})}function tb(){var b,a=o("section.cover");a&&(b=a.getBoundingClientRect().height,window.pageYOffset>=b||a.classList.contains("hidden")?z(q,"add","sticky"):z(q,"remove","sticky"))}function ub(a,b,c,d){var e,f,g;return b=o(b),e=[],null!=b&&(e=t(b,"a")),f=decodeURI(a.toURL(a.getCurrentPath())),e.sort(function(a,b){return b.href.length-a.href.length}).forEach(function(a){var b=a.getAttribute("href"),d=c?a.parentNode:a;0!==f.indexOf(b)||g?z(d,"remove","active"):(g=a,z(d,"add","active"))}),d&&(p.title=g?g.title||g.innerText+" - "+qb:qb),g}function wb(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function Db(a){Ab&&Ab.stop(),Bb=!1,Ab=new xb({start:window.pageYOffset,end:a.getBoundingClientRect().top+window.pageYOffset,duration:500}).on("tick",function(a){return window.scrollTo(0,a)}).on("done",function(){Bb=!0,Ab=null}).begin()}function Eb(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,p,r,u,v;if(Bb){for(b=o(".sidebar"),c=t(".anchor"),d=s(b,".sidebar-nav"),e=s(b,"li.active"),f=document.documentElement,g=(f&&f.scrollTop||document.body.scrollTop)-Cb,i=0,j=c.length;j>i;i+=1){if(k=c[i],k.offsetTop>g){h||(h=k);break}h=k}h&&(l=yb[Fb(decodeURIComponent(a),h.getAttribute("data-id"))],l&&l!==e&&(e&&e.classList.remove("active"),l.classList.add("active"),e=l,!zb&&q.classList.contains("sticky")&&(m=b.clientHeight,n=0,p=e.offsetTop+e.clientHeight+40,r=e.offsetTop>=d.scrollTop&&p<=d.scrollTop+m,u=m>p-n,v=r?d.scrollTop:u?n:p-m,b.scrollTop=v)))}}function Fb(a,b){return a+"?id="+b}function Gb(a){var c,d,e,f,g,h,i,j,k,m,n,b=s(".cover.show");for(Cb=b?b.offsetHeight:0,c=o(".sidebar"),d=[],null!=c&&(d=t(c,"li")),e=0,f=d.length;f>e;e+=1)g=d[e],h=g.querySelector("a"),h&&(i=h.getAttribute("href"),"/"!==i&&(j=a.parse(i),k=j.query.id,m=j.path,k&&(i=Fb(m,k))),i&&(yb[decodeURIComponent(i)]=g));l||(n=a.getCurrentPath(),y("scroll",function(){return Eb(n)}),x("scroll",function(){return Eb(n)}),x(c,"mouseover",function(){zb=!0}),x(c,"mouseleave",function(){zb=!1}))}function Hb(a,b){var c,d,e,f;b&&(c=s("#"+b),c&&Db(c),d=yb[Fb(a,b)],e=o(".sidebar"),f=s(e,"li.active"),f&&f.classList.remove("active"),d&&d.classList.add("active"))}function Jb(a){void 0===a&&(a=0),Ib.scrollTop=a===!0?0:Number(a)}function Lb(a,b){var f,g,h,i,c=a.embedTokens,d=a.compile;if(a.fetch,g=0,h=1,!c.length)return b({});for(;f=c[g++];)i=function(a){return function(c){var e,f,i;c&&("markdown"===a.embed.type?e=d.lexer(c):"code"===a.embed.type?(a.embed.fragment&&(f=a.embed.fragment,i=new RegExp("(?:###|\\/\\/\\/)\\s*\\["+f+"\\]([\\s\\S]*)(?:###|\\/\\/\\/)\\s*\\["+f+"\\]"),c=((c.match(i)||[])[1]||"").trim()),e=d.lexer("```"+a.embed.lang+"\n"+c.replace(/`/g,"@DOCSIFY_QM@")+"\n```\n")):"mermaid"===a.embed.type?(e=[{type:"html",text:'
    \n'+c+"\n
    "}],e.links={}):(e=[{type:"html",text:c}],e.links={})),b({token:a,embedToken:e}),++h>=g&&b({})}}(f),f.embed.url?N(f.embed.url).then(i):i(f.embed.html)}function Mb(a,b){var f,g,h,i,j,k,l,m,n,c=a.compiler,e=a.raw;return void 0===e&&(e=""),f=a.fetch,(g=Kb[e])?(h=g.slice(),h.links=g.links,b(h)):(i=c._marked,j=i.lexer(e),k=[],l=i.InlineLexer.rules.link,m=j.links,j.forEach(function(a,b){"paragraph"===a.type&&(a.text=a.text.replace(new RegExp(l.source,"g"),function(a,d,e,f){var g=c.compileEmbed(e,f);return g&&k.push({index:b,embed:g}),a}))}),n=0,Lb({compile:i,embedTokens:k,fetch:f},function(a){var g,c=a.embedToken,f=a.token;f?(g=f.index+n,d(m,c.links),j=j.slice(0,g).concat(c,j.slice(g+1)),n+=c.length-1):(Kb[e]=j.concat(),j.links=Kb[e].links=m,b(j))}),void 0)}function Nb(){var b,a=t(".markdown-section>script").filter(function(a){return!/template/.test(a.type)})[0];return a?(b=a.innerText.trim())?(setTimeout(function(){window.__EXECUTE_RESULT__=new Function(b)()},0),void 0):!1:!1}function Ob(a,b,c){return b="function"==typeof c?c(b):"string"==typeof c?S(c)(new Date(b)):b,a.replace(/{docsify-updated}/g,b)}function Pb(a){a||(a="

    404 - Not found

    "),this._renderTo(".markdown-section",a),!this.config.loadSidebar&&this._renderSidebar(),this.config.executeScript===!1||"undefined"==typeof window.Vue||Nb()?this.config.executeScript&&Nb():setTimeout(function(){var b=window.__EXECUTE_RESULT__;b&&b.$destroy&&b.$destroy(),window.__EXECUTE_RESULT__=(new window.Vue).$mount("#main")},0)}function Qb(a){var f,b=o(".app-name-link"),c=a.config.nameLink,d=a.route.path;b&&(e(a.config.nameLink)?b.setAttribute("href",c):"object"==typeof c&&(f=Object.keys(c).filter(function(a){return d.indexOf(a)>-1})[0],b.setAttribute("href",c[f])))}function Rb(a){a._renderTo=function(a,b,c){var d=o(a);d&&(d[c?"outerHTML":"innerHTML"]=b)},a._renderSidebar=function(a){var f,b=this.config,c=b.maxLevel,d=b.subMaxLevel,e=b.loadSidebar;this._renderTo(".sidebar-nav",this.compiler.sidebar(a,c)),f=ub(this.router,".sidebar-nav",!0,!0),e&&f?f.parentNode.innerHTML+=this.compiler.subSidebar(d)||"":this.compiler.subSidebar(),this._bindEventOnRendered(f)},a._bindEventOnRendered=function(a){var e,f,g,b=this.config,c=b.autoHeader,d=b.auto2top;Gb(this.router),c&&a&&(e=o("#main"),f=e.children[0],f&&"H1"!==f.tagName&&(g=u("h1"),g.innerText=a.innerText,w(e,g))),d&&Jb(d)},a._renderNav=function(a){a&&this._renderTo("nav",this.compiler.compile(a)),this.config.loadNavbar&&ub(this.router,"nav")},a._renderMain=function(a,b,c){var d=this;return void 0===b&&(b={}),a?(j(this,"beforeEach",a,function(e){var f,g=function(){b.updatedAt&&(f=Ob(f,b.updatedAt,d.config.formatUpdated)),j(d,"afterEach",f,function(a){return completeLoading(),Pb.call(d,a)})};d.isHTML?(f=d.result=a,g(),c()):Mb({compiler:d.compiler,raw:e},function(a){f=d.compiler.compile(a),g(),c()})}),void 0):Pb.call(this,a)},a._renderCover=function(a,b){var d,e,f,c=o(".cover");return z(o("main"),b?"add":"remove","hidden"),a?(z(c,"add","show"),d=this.coverIsHTML?a:this.compiler.cover(a),e=d.trim().match('

    ([^<]*?)

    $'),e&&("color"===e[2]?c.style.background=e[1]+(e[3]||""):(f=e[1],z(c,"add","has-mask"),gb(e[1])||(f=kb(this.router.getBasePath(),e[1])),c.style.backgroundImage="url("+f+")",c.style.backgroundSize="cover",c.style.backgroundPosition="center center"),d=d.replace(e[0],"")),this._renderTo(".cover-main",d),tb(),void 0):(z(c,"remove","show"),void 0)},a._updateRender=function(){Qb(this)}}function Sb(a){var c,d,e,f,g,h,i,j,b=a.config;a.compiler=new pb(b,a.router),k&&(window.__current_docsify_compiler__=a.compiler),c=b.el||"#app",d=s("nav")||u("nav"),e=s(c),f="",g=q,e?(b.repo&&(f+=C(b.repo)),b.coverpage&&(f+=E()),b.logo&&(h=/^data:image/.test(b.logo),i=/(?:http[s]?:)?\/\//.test(b.logo),j=/^\./.test(b.logo),h||i||j||(b.logo=kb(a.router.getBasePath(),b.logo))),f+=D(b),a._renderTo(e,f,!0)):a.rendered=!0,b.mergeNavbar&&l?g=s(".sidebar"):(d.classList.add("app-nav"),b.repo||d.classList.add("no-badge")),b.loadNavbar&&w(g,d),b.themeColor&&(p.head.appendChild(u("div",H(b.themeColor)).firstElementChild),P(b.themeColor)),a._updateRender(),z(q,"ready")}function Ub(a,b,c){var d=Object.keys(b).filter(function(b){var d=Tb[b]||(Tb[b]=new RegExp("^"+b+"$"));return d.test(a)&&a!==c})[0];return d?Ub(a.replace(Tb[d],b[d]),b,a):a}function Vb(a,b){return new RegExp("\\.("+b.replace(/^\./,"")+"|html)$","g").test(a)?a:/\/$/g.test(a)?a+"README"+b:""+a+b}function Xb(a){var b=location.href.indexOf("#");location.replace(location.href.slice(0,b>=0?b:0)+"#"+a)}function $b(a){a.route={}}function ac(a){a.router.normalize(),a.route=a.router.parse(),q.setAttribute("data-page",a.route.file)}function bc(a){var d,b=a.config,c=b.routerMode||"hash";d="history"===c&&m?new Zb(b):new Yb(b),a.router=d,ac(a),_b=a.route,d.onchange(function(){return ac(a),a._updateRender(),_b.path===a.route.path?(a.$resetEvents(),void 0):(a.$fetch(),_b=a.route,void 0)})}function cc(a){a.$resetEvents=function(){Hb(this.route.path,this.route.query.id),this.config.loadNavbar&&ub(this.router,"nav")}}function dc(a){rb("button.sidebar-toggle",a.router),sb(".sidebar",a.router),a.config.coverpage?!l&&x("scroll",tb):q.classList.add("sticky")}function ec(a,b,c,d,e,f){a=f?a:a.replace(/\/$/,""),a=hb(a),a&&N(e.router.getFile(a+c)+b,!1,e.config.requestHeaders).then(d,function(){return ec(a,b,c,d,e)})}function fc(a){var b,c=function(){return b&&b.abort&&b.abort()},d=function(a,d,e){return c(),b=N(a,!0,e)},e=function(a,b){var f,g,c=b.notFoundPage,d=b.ext,e="_404"+(d||".md");switch(typeof c){case"boolean":g=e;break;case"string":g=c;break;case"object":f=Object.keys(c).sort(function(a,b){return b.length-a.length}).find(function(b){return a.match(new RegExp("^"+b))}),g=f&&c[f]||e}return g};a._loadSideAndNav=function(a,b,c,d){var e=this;return function(){if(!c)return d();var f=function(a){e._renderSidebar(a),d()};ec(a,b,c,f,e,!0)}},a._fetch=function(a){var c,e,g,h,i,j,k,l,m,n,b=this;void 0===a&&(a=f),c=this.route,e=c.path,g=c.query,h=fb(g,["id"]),i=this.config,j=i.loadNavbar,k=i.requestHeaders,l=i.loadSidebar,m=this.router.getFile(e),n=d(m+h,!0,k),this.isHTML=/\.html$/g.test(m),n.then(function(c,d){return b._renderMain(c,d,b._loadSideAndNav(e,h,l,a))},function(){b._fetchFallbackPage(m,h,a)||b._fetch404(m,h,a)}),j&&ec(e,h,j,function(a){return b._renderNav(a)},this,!0)},a._fetchCover=function(){var g,h,i,j,a=this,b=this.config,c=b.coverpage,d=b.requestHeaders,e=this.route.query,f=hb(this.route.path);return c?(g=null,h=this.route.path,"string"==typeof c?"/"===h&&(g=c):Array.isArray(c)?g=c.indexOf(h)>-1&&"_coverpage":(i=c[h],g=i===!0?"_coverpage":i),j=Boolean(g)&&this.config.onlyCover,g?(g=this.router.getFile(f+g),this.coverIsHTML=/\.html$/g.test(g),N(g+fb(e,["id"]),!1,d).then(function(b){return a._renderCover(b,j)})):this._renderCover(null,j),j):void 0},a.$fetch=function(a){var c,d,b=this;void 0===a&&(a=f),c=function(){j(b,"doneEach"),a()},d=this._fetchCover(),d?c():this._fetch(function(){b.$resetEvents(),c()})},a._fetchFallbackPage=function(a,b,c){var g,h,i,j,k,l,m,e=this;return void 0===c&&(c=f),g=this.config,h=g.requestHeaders,i=g.fallbackLanguages,j=g.loadSidebar,i?(k=a.split("/")[1],-1===i.indexOf(k)?!1:(l=a.replace(new RegExp("^/"+k),""),m=d(l+b,!0,h),m.then(function(d,f){return e._renderMain(d,f,e._loadSideAndNav(a,b,j,c))},function(){return e._fetch404(a,b,c)}),!0)):!1},a._fetch404=function(a,b,c){var h,i,j,k,l,m,g=this;return void 0===c&&(c=f),h=this.config,i=h.loadSidebar,j=h.requestHeaders,k=h.notFoundPage,l=this._loadSideAndNav(a,b,i,c),k?(m=e(a,this.config),d(this.router.getFile(m),!0,j).then(function(a,b){return g._renderMain(a,b,l)},function(){return g._renderMain(null,{},l)}),!0):(this._renderMain(null,{},l),!1)}}function gc(a){var d,b=a.config,c=b.loadSidebar;a.rendered?(d=ub(a.router,".sidebar-nav",!0,!0),c&&d&&(d.parentNode.innerHTML+=window.__SUB_SIDEBAR__),a._bindEventOnRendered(d),a.$resetEvents(),j(a,"doneEach"),j(a,"ready")):a.$fetch(function(){return j(a,"ready")})}function hc(a){a._init=function(){var a=this;a.config=h(),i(a),ic(a),j(a,"init"),bc(a),Sb(a),dc(a),gc(a),j(a,"mounted")}}function ic(a){[].concat(a.config.plugins).forEach(function(b){return g(b)&&b(a._lifecycle,a)})}function kc(){window.Docsify={util:jc,dom:B,get:N,slugify:_,version:"4.9.4"},window.DocsifyCompiler=pb,window.marked=V,window.Prism=W}function lc(a){var b=document.readyState;return"complete"===b||"interactive"===b?setTimeout(a,0):(document.addEventListener("DOMContentLoaded",a),void 0)}function mc(){this._init()}var I,J,cb,db,gb,hb,ib,jb,lb,mb,ob,pb,qb,vb,xb,yb,zb,Ab,Bb,Cb,Ib,Kb,Tb,Wb,Yb,Zb,_b,jc,nc,b=a(function(a){return a.replace(/([A-Z])/g,function(a){return"-"+a.toLowerCase()})}),c=Object.prototype.hasOwnProperty,d=Object.assign||function(a){var d,e,f,b=arguments;for(d=1;d=0&&"\\"===c[e];)d=!d;return d?"|":" |"}),d=c.split(/ \|/),e=0;if(d.length>b)d.splice(b);else for(;d.lengthAn error occurred:

    "+j(k.message+"",!0)+"
    ";throw k}}var e,n,o,c={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:p,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,nptable:p,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|\\n*|\\n*|)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=\\h*\\n)[\\s\\S]*?(?:\\n{2,}|$)|(?=\\h*\\n)[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,table:p,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading| {0,3}>|<\/?(?:tag)(?: +|\n|\/?>)|<(?:script|pre|style|!--))[^\n]+)*)/,text:/^[^\n]+/};c._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,c._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,c.def=l(c.def).replace("label",c._label).replace("title",c._title).getRegex(),c.bullet=/(?:[*+-]|\d+\.)/,c.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/,c.item=l(c.item,"gm").replace(/bull/g,c.bullet).getRegex(),c.list=l(c.list).replace(/bull/g,c.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+c.def.source+")").getRegex(),c._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",c._comment=//,c.html=l(c.html,"i").replace("comment",c._comment).replace("tag",c._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),c.paragraph=l(c.paragraph).replace("hr",c.hr).replace("heading",c.heading).replace("lheading",c.lheading).replace("tag",c._tag).getRegex(),c.blockquote=l(c.blockquote).replace("paragraph",c.paragraph).getRegex(),c.normal=q({},c),c.gfm=q({},c.normal,{fences:/^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\n? *\1 *(?:\n+|$)/,paragraph:/^/,heading:/^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/}),c.gfm.paragraph=l(c.paragraph).replace("(?!","(?!"+c.gfm.fences.source.replace("\\1","\\2")+"|"+c.list.source.replace("\\1","\\3")+"|").getRegex(),c.tables=q({},c.gfm,{nptable:/^ *([^|\n ].*\|.*)\n *([-:]+ *\|[-| :]*)(?:\n((?:.*[^>\n ].*(?:\n|$))*)\n*|$)/,table:/^ *\|(.+)\n *\|?( *[-:]+[-| :]*)(?:\n((?: *[^>\n ].*(?:\n|$))*)\n*|$)/}),c.pedantic=q({},c.normal,{html:l("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",c._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/}),d.rules=c,d.lex=function(a,b){var c=new d(b);return c.lex(a)},d.prototype.lex=function(a){return a=a.replace(/\r\n|\r/g,"\n").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n"),this.token(a,!0)},d.prototype.token=function(a,b){var e,f,g,h,i,j,k,l,m,n,o,p,q,t,u,v,d=this;for(a=a.replace(/^ +$/gm,"");a;)if((g=d.rules.newline.exec(a))&&(a=a.substring(g[0].length),g[0].length>1&&d.tokens.push({type:"space"})),g=d.rules.code.exec(a))a=a.substring(g[0].length),g=g[0].replace(/^ {4}/gm,""),d.tokens.push({type:"code",text:d.options.pedantic?g:s(g,"\n")});else if(g=d.rules.fences.exec(a))a=a.substring(g[0].length),d.tokens.push({type:"code",lang:g[2],text:g[3]||""});else if(g=d.rules.heading.exec(a))a=a.substring(g[0].length),d.tokens.push({type:"heading",depth:g[1].length,text:g[2]});else if(b&&(g=d.rules.nptable.exec(a))&&(j={type:"table",header:r(g[1].replace(/^ *| *\| *$/g,"")),align:g[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:g[3]?g[3].replace(/\n$/,"").split("\n"):[]},j.header.length===j.align.length)){for(a=a.substring(g[0].length),o=0;o ?/gm,""),d.token(g,b),d.tokens.push({type:"blockquote_end"});else if(g=d.rules.list.exec(a)){for(a=a.substring(g[0].length),h=g[2],t=h.length>1,k={type:"list_start",ordered:t,start:t?+h:"",loose:!1},d.tokens.push(k),g=g[0].match(d.rules.item),l=[],e=!1,q=g.length,o=0;q>o;o++)j=g[o],n=j.length,j=j.replace(/^ *([*+-]|\d+\.) +/,""),~j.indexOf("\n ")&&(n-=j.length,j=d.options.pedantic?j.replace(/^ {1,4}/gm,""):j.replace(new RegExp("^ {1,"+n+"}","gm"),"")),d.options.smartLists&&o!==q-1&&(i=c.bullet.exec(g[o+1])[0],h===i||h.length>1&&i.length>1||(a=g.slice(o+1).join("\n")+a,o=q-1)),f=e||/\n\n(?!\s*$)/.test(j),o!==q-1&&(e="\n"===j.charAt(j.length-1),f||(f=e)),f&&(k.loose=!0),u=/^\[[ xX]\] /.test(j),v=void 0,u&&(v=" "!==j[1],j=j.replace(/^\[[ xX]\] +/,"")),m={type:"list_item_start",task:u,checked:v,loose:f},l.push(m),d.tokens.push(m),d.token(j,!1),d.tokens.push({type:"list_item_end"});if(k.loose)for(q=l.length,o=0;q>o;o++)l[o].loose=!0;d.tokens.push({type:"list_end"})}else if(g=d.rules.html.exec(a))a=a.substring(g[0].length),d.tokens.push({type:d.options.sanitize?"paragraph":"html",pre:!d.options.sanitizer&&("pre"===g[1]||"script"===g[1]||"style"===g[1]),text:g[0]});else if(b&&(g=d.rules.def.exec(a)))a=a.substring(g[0].length),g[3]&&(g[3]=g[3].substring(1,g[3].length-1)),p=g[1].toLowerCase().replace(/\s+/g," "),d.tokens.links[p]||(d.tokens.links[p]={href:g[2],title:g[3]});else if(b&&(g=d.rules.table.exec(a))&&(j={type:"table",header:r(g[1].replace(/^ *| *\| *$/g,"")),align:g[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:g[3]?g[3].replace(/(?: *\| *)?\n$/,"").split("\n"):[]},j.header.length===j.align.length)){for(a=a.substring(g[0].length),o=0;o?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:p,tag:"^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^",link:/^!?\[(label)\]\(href(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,strong:/^__([^\s])__(?!_)|^\*\*([^\s])\*\*(?!\*)|^__([^\s][\s\S]*?[^\s])__(?!_)|^\*\*([^\s][\s\S]*?[^\s])\*\*(?!\*)/,em:/^_([^\s_])_(?!_)|^\*([^\s*"<\[])\*(?!\*)|^_([^\s][\s\S]*?[^\s_])_(?!_)|^_([^\s_][\s\S]*?[^\s])_(?!_)|^\*([^\s"<\[][\s\S]*?[^\s*])\*(?!\*)|^\*([^\s*"<\[][\s\S]*?[^\s])\*(?!\*)/,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:p,text:/^(`+|[^`])[\s\S]*?(?=[\\?@\[\]\\^_`{|}~])/g,e._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,e._email=/[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,e.autolink=l(e.autolink).replace("scheme",e._scheme).replace("email",e._email).getRegex(),e._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,e.tag=l(e.tag).replace("comment",c._comment).replace("attribute",e._attribute).getRegex(),e._label=/(?:\[[^\[\]]*\]|\\[\[\]]?|`[^`]*`|[^\[\]\\])*?/,e._href=/\s*(<(?:\\[<>]?|[^\s<>\\])*>|(?:\\[()]?|\([^\s\x00-\x1f\\]*\)|[^\s\x00-\x1f()\\])*?)/,e._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,e.link=l(e.link).replace("label",e._label).replace("href",e._href).replace("title",e._title).getRegex(),e.reflink=l(e.reflink).replace("label",e._label).getRegex(),e.normal=q({},e),e.pedantic=q({},e.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/,link:l(/^!?\[(label)\]\((.*?)\)/).replace("label",e._label).getRegex(),reflink:l(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",e._label).getRegex()}),e.gfm=q({},e.normal,{escape:l(e.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~+(?=\S)([\s\S]*?\S)~+/,text:l(e.text).replace("]|","~]|").replace("|$","|https?://|ftp://|www\\.|[a-zA-Z0-9.!#$%&'*+/=?^_`{\\|}~-]+@|$").getRegex()}),e.gfm.url=l(e.gfm.url).replace("email",e.gfm._extended_email).getRegex(),e.breaks=q({},e.gfm,{br:l(e.br).replace("{2,}","*").getRegex(),text:l(e.gfm.text).replace("{2,}","*").getRegex()}),f.rules=e,f.output=function(a,b,c){var d=new f(b,c); -return d.output(a)},f.prototype.output=function(a){for(var d,e,g,h,i,k,b=this,c="";a;)if(i=b.rules.escape.exec(a))a=a.substring(i[0].length),c+=i[1];else if(i=b.rules.autolink.exec(a))a=a.substring(i[0].length),"@"===i[2]?(e=j(b.mangle(i[1])),g="mailto:"+e):(e=j(i[1]),g=e),c+=b.renderer.link(g,null,e);else if(b.inLink||!(i=b.rules.url.exec(a))){if(i=b.rules.tag.exec(a))!b.inLink&&/^/i.test(i[0])&&(b.inLink=!1),!b.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(i[0])?b.inRawBlock=!0:b.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(i[0])&&(b.inRawBlock=!1),a=a.substring(i[0].length),c+=b.options.sanitize?b.options.sanitizer?b.options.sanitizer(i[0]):j(i[0]):i[0];else if(i=b.rules.link.exec(a))a=a.substring(i[0].length),b.inLink=!0,g=i[2],b.options.pedantic?(d=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(g),d?(g=d[1],h=d[3]):h=""):h=i[3]?i[3].slice(1,-1):"",g=g.trim().replace(/^<([\s\S]*)>$/,"$1"),c+=b.outputLink(i,{href:f.escapes(g),title:f.escapes(h)}),b.inLink=!1;else if((i=b.rules.reflink.exec(a))||(i=b.rules.nolink.exec(a))){if(a=a.substring(i[0].length),d=(i[2]||i[1]).replace(/\s+/g," "),d=b.links[d.toLowerCase()],!d||!d.href){c+=i[0].charAt(0),a=i[0].substring(1)+a;continue}b.inLink=!0,c+=b.outputLink(i,d),b.inLink=!1}else if(i=b.rules.strong.exec(a))a=a.substring(i[0].length),c+=b.renderer.strong(b.output(i[4]||i[3]||i[2]||i[1]));else if(i=b.rules.em.exec(a))a=a.substring(i[0].length),c+=b.renderer.em(b.output(i[6]||i[5]||i[4]||i[3]||i[2]||i[1]));else if(i=b.rules.code.exec(a))a=a.substring(i[0].length),c+=b.renderer.codespan(j(i[2].trim(),!0));else if(i=b.rules.br.exec(a))a=a.substring(i[0].length),c+=b.renderer.br();else if(i=b.rules.del.exec(a))a=a.substring(i[0].length),c+=b.renderer.del(b.output(i[1]));else if(i=b.rules.text.exec(a))a=a.substring(i[0].length),c+=b.inRawBlock?b.renderer.text(i[0]):b.renderer.text(j(b.smartypants(i[0])));else if(a)throw new Error("Infinite loop on byte: "+a.charCodeAt(0))}else{if("@"===i[2])e=j(i[0]),g="mailto:"+e;else{do k=i[0],i[0]=b.rules._backpedal.exec(i[0])[0];while(k!==i[0]);e=j(i[0]),g="www."===i[1]?"http://"+e:e}a=a.substring(i[0].length),c+=b.renderer.link(g,null,e)}return c},f.escapes=function(a){return a?a.replace(f.rules._escapes,"$1"):a},f.prototype.outputLink=function(a,b){var c=b.href,d=b.title?j(b.title):null;return"!"!==a[0].charAt(0)?this.renderer.link(c,d,this.output(a[1])):this.renderer.image(c,d,j(a[1]))},f.prototype.smartypants=function(a){return this.options.smartypants?a.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014\/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014\/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…"):a},f.prototype.mangle=function(a){if(!this.options.mangle)return a;for(var e,b="",c=a.length,d=0;c>d;d++)e=a.charCodeAt(d),Math.random()>.5&&(e="x"+e.toString(16)),b+="&#"+e+";";return b},g.prototype.code=function(a,b,c){if(this.options.highlight){var d=this.options.highlight(a,b);null!=d&&d!==a&&(c=!0,a=d)}return b?'
    '+(c?a:j(a,!0))+"
    \n":"
    "+(c?a:j(a,!0))+"
    "},g.prototype.blockquote=function(a){return"
    \n"+a+"
    \n"},g.prototype.html=function(a){return a},g.prototype.heading=function(a,b,c){return this.options.headerIds?"'+a+"\n":""+a+"\n"},g.prototype.hr=function(){return this.options.xhtml?"
    \n":"
    \n"},g.prototype.list=function(a,b,c){var d=b?"ol":"ul",e=b&&1!==c?' start="'+c+'"':"";return"<"+d+e+">\n"+a+"\n"},g.prototype.listitem=function(a){return"
  • "+a+"
  • \n"},g.prototype.checkbox=function(a){return" "},g.prototype.paragraph=function(a){return"

    "+a+"

    \n"},g.prototype.table=function(a,b){return b&&(b=""+b+""),"\n\n"+a+"\n"+b+"
    \n"},g.prototype.tablerow=function(a){return"\n"+a+"\n"},g.prototype.tablecell=function(a,b){var c=b.header?"th":"td",d=b.align?"<"+c+' align="'+b.align+'">':"<"+c+">";return d+a+"\n"},g.prototype.strong=function(a){return""+a+""},g.prototype.em=function(a){return""+a+""},g.prototype.codespan=function(a){return""+a+""},g.prototype.br=function(){return this.options.xhtml?"
    ":"
    "},g.prototype.del=function(a){return""+a+""},g.prototype.link=function(a,b,c){var d,f;if(this.options.sanitize){try{d=decodeURIComponent(k(a)).replace(/[^\w:]/g,"").toLowerCase()}catch(e){return c}if(0===d.indexOf("javascript:")||0===d.indexOf("vbscript:")||0===d.indexOf("data:"))return c}this.options.baseUrl&&!o.test(a)&&(a=m(this.options.baseUrl,a));try{a=encodeURI(a).replace(/%25/g,"%")}catch(e){return c}return f='
    "},g.prototype.image=function(a,b,c){this.options.baseUrl&&!o.test(a)&&(a=m(this.options.baseUrl,a));var d=''+c+'":">"},g.prototype.text=function(a){return a},h.prototype.strong=h.prototype.em=h.prototype.codespan=h.prototype.del=h.prototype.text=function(a){return a},h.prototype.link=h.prototype.image=function(a,b,c){return""+c},h.prototype.br=function(){return""},i.parse=function(a,b){var c=new i(b);return c.parse(a)},i.prototype.parse=function(a){var c,b=this;for(this.inline=new f(a.links,this.options),this.inlineText=new f(a.links,q({},this.options,{renderer:new h})),this.tokens=a.reverse(),c="";this.next();)c+=b.tok();return c},i.prototype.next=function(){return this.token=this.tokens.pop()},i.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0},i.prototype.parseText=function(){for(var a=this,b=this.token.text;"text"===this.peek().type;)b+="\n"+a.next().text;return this.inline.output(b)},i.prototype.tok=function(){var d,e,f,g,b,c,h,i,j,a=this;switch(this.token.type){case"space":return"";case"hr":return this.renderer.hr();case"heading":return this.renderer.heading(this.inline.output(this.token.text),this.token.depth,k(this.inlineText.output(this.token.text)));case"code":return this.renderer.code(this.token.text,this.token.lang,this.token.escaped);case"table":for(b="",c="",f="",d=0;d"']/,j.escapeReplace=/[&<>"']/g,j.replacements={"&":"&","<":"<",">":">",'"':""","'":"'"},j.escapeTestNoEncode=/[<>"']|&(?!#?\w+;)/,j.escapeReplaceNoEncode=/[<>"']|&(?!#?\w+;)/g,n={},o=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i,p.exec=p,t.options=t.setOptions=function(a){return q(t.defaults,a),t},t.getDefaults=function(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:new g,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tables:!0,xhtml:!1}},t.defaults=t.getDefaults(),t.Parser=i,t.parser=i.parse,t.Renderer=g,t.TextRenderer=h,t.Lexer=d,t.lexer=d.lex,t.InlineLexer=f,t.inlineLexer=f.output,t.parse=t,a.exports=t}(T||("undefined"!=typeof window?window:T))}),W=U(function(a){var b="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},c=function(){var f,a=/\blang(?:uage)?-([\w-]+)\b/i,c=0,d=b.Prism={manual:b.Prism&&b.Prism.manual,disableWorkerMessageHandler:b.Prism&&b.Prism.disableWorkerMessageHandler,util:{encode:function(a){return a instanceof e?new e(a.type,d.util.encode(a.content),a.alias):"Array"===d.util.type(a)?a.map(d.util.encode):a.replace(/&/g,"&").replace(/a.length)return;if(!(v instanceof i)){if(p&&t!=b.length-1){if(m.lastIndex=u,w=m.exec(a),!w)break;for(x=w.index+(o?w[1].length:0),y=w.index+w[0].length,z=t,A=u,B=b.length;B>z&&(y>A||!b[z].type&&!b[z-1].greedy);++z)A+=b[z].length,x>=A&&(++t,u=A);if(b[t]instanceof i)continue;C=z-t,v=a.slice(u,A),w.index-=u}else m.lastIndex=0,w=m.exec(v),C=1;if(w){if(o&&(q=w[1]?w[1].length:0),x=w.index+q,w=w[0].slice(q),y=x+w.length,D=v.slice(0,x),E=v.slice(y),F=[t,C],D&&(++t,u+=D.length,F.push(D)),G=new i(j,n?d.tokenize(w,n):w,r,w,p),F.push(G),E&&F.push(E),Array.prototype.splice.apply(b,F),1!=C&&d.matchGrammar(a,b,c,t,u,!0,j),g)break}else if(g)break}}}},tokenize:function(a,b){var g,e=[a],f=b.rest;if(f){for(g in f)b[g]=f[g];delete b.rest}return d.matchGrammar(a,e,b,0,0,!1),e},hooks:{all:{},add:function(a,b){var c=d.hooks.all;c[a]=c[a]||[],c[a].push(b)},run:function(a,b){var f,e,c=d.hooks.all[a];if(c&&c.length)for(e=0;f=c[e++];)f(b)}}},e=d.Token=function(a,b,c,d,e){this.type=a,this.content=b,this.alias=c,this.length=0|(d||"").length,this.greedy=!!e};return e.stringify=function(a,b,c){var f,g,h;return"string"==typeof a?a:"Array"===d.util.type(a)?a.map(function(c){return e.stringify(c,b,a)}).join(""):(f={type:a.type,content:e.stringify(a.content,b,c),tag:"span",classes:["token",a.type],attributes:{},language:b,parent:c},a.alias&&(g="Array"===d.util.type(a.alias)?a.alias:[a.alias],Array.prototype.push.apply(f.classes,g)),d.hooks.run("wrap",f),h=Object.keys(f.attributes).map(function(a){return a+'="'+(f.attributes[a]||"").replace(/"/g,""")+'"'}).join(" "),"<"+f.tag+' class="'+f.classes.join(" ")+'"'+(h?" "+h:"")+">"+f.content+"")},b.document?(f=document.currentScript||[].slice.call(document.getElementsByTagName("script")).pop(),f&&(d.filename=f.src,d.manual||f.hasAttribute("data-manual")||("loading"!==document.readyState?window.requestAnimationFrame?window.requestAnimationFrame(d.highlightAll):window.setTimeout(d.highlightAll,16):document.addEventListener("DOMContentLoaded",d.highlightAll))),b.Prism):b.addEventListener?(d.disableWorkerMessageHandler||b.addEventListener("message",function(a){var c=JSON.parse(a.data),e=c.language,f=c.code,g=c.immediateClose;b.postMessage(d.highlight(f,d.languages[e],e)),g&&b.close()},!1),b.Prism):b.Prism}();a.exports&&(a.exports=c),"undefined"!=typeof T&&(T.Prism=c),c.languages.markup={comment://,prolog:/<\?[\s\S]+?\?>/,doctype://i,cdata://i,tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+))?)*\s*\/?>/i,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/i,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"attr-value":{pattern:/=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+)/i,inside:{punctuation:[/^=/,{pattern:/(^|[^\\])["']/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:/&#?[\da-z]{1,8};/i},c.languages.markup["tag"].inside["attr-value"].inside["entity"]=c.languages.markup["entity"],c.hooks.add("wrap",function(a){"entity"===a.type&&(a.attributes["title"]=a.content.replace(/&/,"&"))}),c.languages.xml=c.languages.markup,c.languages.html=c.languages.markup,c.languages.mathml=c.languages.markup,c.languages.svg=c.languages.markup,c.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:/@[\w-]+?.*?(?:;|(?=\s*\{))/i,inside:{rule:/@[\w-]+/}},url:/url\((?:(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,selector:/[^{}\s][^{};]*?(?=\s*\{)/,string:{pattern:/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},property:/[-_a-z\xA0-\uFFFF][-\w\xA0-\uFFFF]*(?=\s*:)/i,important:/\B!important\b/i,"function":/[-a-z0-9]+(?=\()/i,punctuation:/[(){};:]/},c.languages.css["atrule"].inside.rest=c.languages.css,c.languages.markup&&(c.languages.insertBefore("markup","tag",{style:{pattern:/()[\s\S]*?(?=<\/style>)/i,lookbehind:!0,inside:c.languages.css,alias:"language-css",greedy:!0}}),c.languages.insertBefore("inside","attr-value",{"style-attr":{pattern:/\s*style=("|')(?:\\[\s\S]|(?!\1)[^\\])*\1/i,inside:{"attr-name":{pattern:/^\s*style/i,inside:c.languages.markup.tag.inside},punctuation:/^\s*=\s*['"]|['"]\s*$/,"attr-value":{pattern:/.+/i,inside:c.languages.css}},alias:"language-css"}},c.languages.markup.tag)),c.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,"boolean":/\b(?:true|false)\b/,"function":/[a-z0-9_]+(?=\()/i,number:/\b0x[\da-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,punctuation:/[{}[\];(),.:]/},c.languages.javascript=c.languages.extend("clike",{keyword:/\b(?: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|var|void|while|with|yield)\b/,number:/\b(?:0[xX][\dA-Fa-f]+|0[bB][01]+|0[oO][0-7]+|NaN|Infinity)\b|(?:\b\d+\.?\d*|\B\.\d+)(?:[Ee][+-]?\d+)?/,"function":/[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*\()/i,operator:/-[-=]?|\+[+=]?|!=?=?|<>?>?=?|=(?:==?|>)?|&[&=]?|\|[|=]?|\*\*?=?|\/=?|~|\^=?|%=?|\?|\.{3}/}),c.languages.insertBefore("javascript","keyword",{regex:{pattern:/((?:^|[^$\w\xA0-\uFFFF."'\])\s])\s*)\/(\[[^\]\r\n]+]|\\.|[^\/\\\[\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})\]]))/,lookbehind:!0,greedy:!0},"function-variable":{pattern:/[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*=\s*(?:function\b|(?:\([^()]*\)|[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)\s*=>))/i,alias:"function"},constant:/\b[A-Z][A-Z\d_]*\b/}),c.languages.insertBefore("javascript","string",{"template-string":{pattern:/`(?:\\[\s\S]|\${[^}]+}|[^\\`])*`/,greedy:!0,inside:{interpolation:{pattern:/\${[^}]+}/,inside:{"interpolation-punctuation":{pattern:/^\${|}$/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}}}),c.languages.javascript["template-string"].inside["interpolation"].inside.rest=c.languages.javascript,c.languages.markup&&c.languages.insertBefore("markup","tag",{script:{pattern:/()[\s\S]*?(?=<\/script>)/i,lookbehind:!0,inside:c.languages.javascript,alias:"language-javascript",greedy:!0}}),c.languages.js=c.languages.javascript,function(){"undefined"!=typeof self&&self.Prism&&self.document&&document.querySelector&&(self.Prism.fileHighlight=function(){var a={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"};Array.prototype.slice.call(document.querySelectorAll("pre[data-src]")).forEach(function(b){for(var e,h,i,j,d=b.getAttribute("data-src"),f=b,g=/\blang(?:uage)?-([\w-]+)\b/i;f&&!g.test(f.className);)f=f.parentNode;f&&(e=(b.className.match(g)||[,""])[1]),e||(h=(d.match(/\.(\w+)$/)||[,""])[1],e=a[h]||h),i=document.createElement("code"),i.className="language-"+e,b.textContent="",i.textContent="Loading…",b.appendChild(i),j=new XMLHttpRequest,j.open("GET",d,!0),j.onreadystatechange=function(){4==j.readyState&&(j.status<400&&j.responseText?(i.textContent=j.responseText,c.highlightElement(i)):i.textContent=j.status>=400?"✖ Error "+j.status+" while fetching file: "+j.statusText:"✖ Error: File does not exist or is empty")},j.send(null)}),c.plugins.toolbar&&c.plugins.toolbar.registerButton("download-file",function(a){var c,d,b=a.element.parentNode;if(b&&/pre/i.test(b.nodeName)&&b.hasAttribute("data-src")&&b.hasAttribute("data-download-link"))return c=b.getAttribute("data-src"),d=document.createElement("a"),d.textContent=b.getAttribute("data-download-link-label")||"Download",d.setAttribute("download",""),d.href=c,d})},document.addEventListener("DOMContentLoaded",self.Prism.fileHighlight))}()}),Y={},Z=/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,.\/:;<=>?@[\]^`{|}~]/g;_.clear=function(){Y={}},cb=decodeURIComponent,db=encodeURIComponent,gb=a(function(a){return/(:|(\/{2}))/g.test(a)}),hb=a(function(a){return/\/$/g.test(a)?a:(a=a.match(/(\S*\/)[^\/]+$/))?a[1]:""}),ib=a(function(a){return a.replace(/^\/+/,"/").replace(/([^:])\/{2,}/g,"$1/")}),jb=a(function(a){var d,e,f,b=a.replace(/^\//,"").split("/"),c=[];for(d=0,e=b.length;e>d;d++)f=b[d],".."===f?c.pop():"."!==f&&c.push(f);return"/"+c.join("/")}),lb=a(function(a){return a.replace("#","?id=")}),Prism.languages["markup-templating"]={},Object.defineProperties(Prism.languages["markup-templating"],{buildPlaceholders:{value:function(a,b,c,d){a.language===b&&(a.tokenStack=[],a.code=a.code.replace(c,function(c){if("function"==typeof d&&!d(c))return c;for(var e=a.tokenStack.length;-1!==a.code.indexOf("___"+b.toUpperCase()+e+"___");)++e;return a.tokenStack[e]=c,"___"+b.toUpperCase()+e+"___"}),a.grammar=Prism.languages.markup)}},tokenizePlaceholders:{value:function(a,b){var c,d,e;a.language===b&&a.tokenStack&&(a.grammar=Prism.languages[b],c=0,d=Object.keys(a.tokenStack),e=function(f){var g,h,i,j,k,l,m,n,o,p;if(!(c>=d.length))for(g=0;g-1&&(++c,m=k.substring(0,l),n=new Prism.Token(b,Prism.tokenize(j,a.grammar,b),"language-"+b,j),o=k.substring(l+("___"+b.toUpperCase()+i+"___").length),m||o?(p=[m,n,o].filter(function(a){return!!a}),e(p)):p=n,"string"==typeof h?Array.prototype.splice.apply(f,[g,1].concat(p)):h.content=p,c>=d.length))break}else h.content&&"string"!=typeof h.content&&e(h.content)},e(a.tokens))}}}),mb={},ob={markdown:function(a){return{url:a}},mermaid:function(a){return{url:a}},iframe:function(a,b){return{html:'"}},video:function(a,b){return{html:'"}},audio:function(a,b){return{html:'"}},code:function(a,b){var c=a.match(/\.(\w+)$/);return c=b||c&&c[1],"md"===c&&(c="markdown"),{url:a,lang:c}}},pb=function(b,c){var h,i,j,f=this;this.config=b,this.router=c,this.cacheTree={},this.toc=[],this.cacheTOC={},this.linkTarget=b.externalLinkTarget||"_blank",this.contentBase=c.getBasePath(),h=this._initRenderer(),j=b.markdown||{},g(j)?i=j(V,h):(V.setOptions(d(j,{renderer:d(h,j.renderer)})),i=V),this._marked=i,this.compile=function(c){var d=!0,g=a(function(){d=!1;var f="";return c?(f=e(c)?i(c):i.parser(c),f=b.noEmoji?f:bb(f),_.clear(),f):c})(c),h=f.router.parse().file;return d?f.toc=f.cacheTOC[h]:f.cacheTOC[h]=[].concat(f.toc),g}},pb.prototype.compileEmbed=function(a,b){var f,g,h,c=nb(b),d=c.str,e=c.config;return b=d,e.include?(gb(a)||(a=kb(this.contentBase,hb(this.router.getCurrentPath()),a)),e.type&&(g=ob[e.type])?(f=g.call(this,a,b),f.type=e.type):(h="code",/\.(md|markdown)/.test(a)?h="markdown":/\.mmd/.test(a)?h="mermaid":/\.html?/.test(a)?h="iframe":/\.(mp4|ogg)/.test(a)?h="video":/\.mp3/.test(a)&&(h="audio"),f=ob[h].call(this,a,b),f.type=h),f.fragment=e.fragment,f):void 0},pb.prototype._matchNotCompileLink=function(a){var c,d,e,b=this.config.noCompileLinks||[];for(c=0;c'+e+""},g.code=a.code=function(a,b){void 0===b&&(b=""),a=a.replace(/@DOCSIFY_QM@/g,"`");var c=W.highlight(a,W.languages[b]||W.languages.markup);return'
    '+c+"
    "},g.link=a.link=function(a,b,e){var g,h,i,j;return void 0===b&&(b=""),g="",h=nb(b),i=h.str,j=h.config,b=i,gb(a)||f._matchNotCompileLink(a)||j.ignore?g+=0===a.indexOf("mailto:")?"":' target="'+c+'"':(a===f.config.homepage&&(a="README"),a=d.toURL(a,null,d.getCurrentPath())),j.target&&(g+=" target="+j.target),j.disabled&&(g+=" disabled",a="javascript:void(0)"),b&&(g+=' title="'+b+'"'),'"+e+""},g.paragraph=a.paragraph=function(a){var b;return b=/^!>/.test(a)?G("tip",a):/^\?>/.test(a)?G("warn",a):"

    "+a+"

    "},g.image=a.image=function(a,b,c){var k,l,f=a,g="",h=nb(b),i=h.str,j=h.config;return b=i,j["no-zoom"]&&(g+=" data-no-zoom"),b&&(g+=' title="'+b+'"'),k=j.size,k&&(l=k.split("x"),g+=l[1]?"width="+l[0]+" height="+l[1]:"width="+l[0]),gb(a)||(f=kb(e,hb(d.getCurrentPath()),a)),''+c+'"},g.list=a.list=function(a,b,c){var d=/
  • /.test(a.split('class="task-list"')[0]),e=c&&c>1,f=b?"ol":"ul",g=[d?'class="task-list"':"",e?'start="'+c+'"':""].join(" ").trim();return"<"+f+" "+g+">"+a+""},g.listitem=a.listitem=function(a){var b=/^(]*>)/.test(a),c=b?'
  • ":"
  • "+a+"
  • ";return c},a.origin=g,a},pb.prototype.sidebar=function(a,b){var g,h,i,j,c=this,d=c.toc,e=this.router.getCurrentPath(),f="";if(a)f=this.compile(a);else{for(g=0;g{inner}"),this.cacheTree[e]=j}return""},pb.prototype.subSidebar=function(a){var b,c,d,e,f,g;if(!a)return this.toc=[],void 0;for(b=this.router.getCurrentPath(),c=this,d=c.cacheTree,e=c.toc,e[0]&&e[0].ignoreAllSubs&&e.splice(0),e[0]&&1===e[0].level&&e.shift(),f=0;f0&&void 0!==arguments[0]?arguments[0]:{};wb(this,a),this.duration=b.duration||1e3,this.ease=b.easing||this._defaultEase,this.start=b.start,this.end=b.end,this.frame=null,this.next=null,this.isRunning=!1,this.events={},this.direction=this.startthis.end&&a>=this.next}[this.direction]}},{key:"_defaultEase",value:function(a,b,c,d){return(a/=d/2)<1?c/2*a*a+b:-c/2*(--a*(a-2)-1)+b}}]),a}(),yb={},zb=!1,Ab=null,Bb=!0,Cb=0,Ib=p.scrollingElement||p.documentElement,Kb={},Tb={},Wb=function(a){this.config=a},Wb.prototype.getBasePath=function(){return this.config.basePath},Wb.prototype.getFile=function(a,b){var c,d,e,f;return void 0===a&&(a=this.getCurrentPath()),c=this,d=c.config,e=this.getBasePath(),f="string"==typeof d.ext?d.ext:".md",a=d.alias?Ub(a,d.alias):a,a=Vb(a,f),a=a==="/README"+f?d.homepage||a:a,a=gb(a)?a:kb(e,a),b&&(a=a.replace(new RegExp("^"+e),"")),a},Wb.prototype.onchange=function(a){void 0===a&&(a=f),a()},Wb.prototype.getCurrentPath=function(){},Wb.prototype.normalize=function(){},Wb.prototype.parse=function(){},Wb.prototype.toURL=function(a,b,c){var g,h,e=c&&"#"===a[0],f=this.parse(lb(a));return f.query=d({},f.query,b),a=f.path+fb(f.query),a=a.replace(/\.md(\?)|\.md$/,"$1"),e&&(g=c.indexOf("?"),a=(g>0?c.substring(0,g):c)+a),this.config.relativePath&&0!==a.indexOf("/")?(h=c.substring(0,c.lastIndexOf("/")+1),ib(jb(h+a))):ib("/"+a)},Yb=function(a){function b(b){a.call(this,b),this.mode="hash"}return a&&(b.__proto__=a),b.prototype=Object.create(a&&a.prototype),b.prototype.constructor=b,b.prototype.getBasePath=function(){var a=window.location.pathname||"",b=this.config.basePath;return/^(\/|https?:)/g.test(b)?b:ib(a+"/"+b)},b.prototype.getCurrentPath=function(){var a=location.href,b=a.indexOf("#");return-1===b?"":a.slice(b+1)},b.prototype.onchange=function(a){void 0===a&&(a=f),x("hashchange",a)},b.prototype.normalize=function(){var a=this.getCurrentPath();return a=lb(a),"/"===a.charAt(0)?Xb(a):(Xb("/"+a),void 0)},b.prototype.parse=function(a){var b,c,d;return void 0===a&&(a=location.href),b="",c=a.indexOf("#"),c>=0&&(a=a.slice(c+1)),d=a.indexOf("?"),d>=0&&(b=a.slice(d+1),a=a.slice(0,d)),{path:a,file:this.getFile(a,!0),query:eb(b)}},b.prototype.toURL=function(b,c,d){return"#"+a.prototype.toURL.call(this,b,c,d)},b}(Wb),Zb=function(a){function b(b){a.call(this,b),this.mode="history"}return a&&(b.__proto__=a),b.prototype=Object.create(a&&a.prototype),b.prototype.constructor=b,b.prototype.getCurrentPath=function(){var a=this.getBasePath(),b=window.location.pathname;return a&&0===b.indexOf(a)&&(b=b.slice(a.length)),(b||"/")+window.location.search+window.location.hash},b.prototype.onchange=function(a){void 0===a&&(a=f),x("click",function(b){var d,c="A"===b.target.tagName?b.target:b.target.parentNode;"A"!==c.tagName||/_blank/.test(c.target)||(b.preventDefault(),d=c.href,window.history.pushState({key:d},"",d),a())}),x("popstate",a)},b.prototype.parse=function(a){var b,c,d,e;return void 0===a&&(a=location.href),b="",c=a.indexOf("?"),c>=0&&(b=a.slice(c+1),a=a.slice(0,c)),d=kb(location.origin),e=a.indexOf(d),e>-1&&(a=a.slice(e+d.length)),{path:a,file:this.getFile(a),query:eb(b)}},b}(Wb),_b={},jc=Object.freeze({cached:a,hyphenate:b,hasOwn:c,merge:d,isPrimitive:e,noop:f,isFn:g,inBrowser:k,isMobile:l,supportsPushState:m,parseQuery:eb,stringifyQuery:fb,isAbsolutePath:gb,getParentPath:hb,cleanPath:ib,resolvePath:jb,getPath:kb,replaceSlug:lb}),nc=mc.prototype,hc(nc),$b(nc),Rb(nc),fc(nc),cc(nc),kc(),lc(function(){return new mc})}(); \ No newline at end of file +(function(){function cached(fn){var cache=Object.create(null);return function(str){var key=isPrimitive(str)?str:JSON.stringify(str);var hit=cache[key];return hit||(cache[key]=fn(str))}} +var hyphenate=cached(function(str){return str.replace(/([A-Z])/g,function(m){return'-'+m.toLowerCase();})});var hasOwn=Object.prototype.hasOwnProperty;var merge=Object.assign||function(to){var arguments$1=arguments;for(var i=1;i=queue.length){next(data);}else if(typeof hook==='function'){if(hook.length===2){hook(data,function(result){data=result;step(index+1);});}else{var result=hook(data);data=result===undefined?data:result;step(index+1);}}else{step(index+1);}};step(0);} +var inBrowser=!false;var isMobile=inBrowser&&document.body.clientWidth<=600;var supportsPushState=inBrowser&&(function(){return(window.history&&window.history.pushState&&window.history.replaceState&&!navigator.userAgent.match(/((iPod|iPhone|iPad).+\bOS\s+[1-4]\D|WebApps\/.+CFNetwork)/))})();var cacheNode={};function getNode(el,noCache){if(noCache===void 0)noCache=false;if(typeof el==='string'){if(typeof window.Vue!=='undefined'){return find(el)} +el=noCache?find(el):cacheNode[el]||(cacheNode[el]=find(el));} +return el} +var $=inBrowser&&document;var body=inBrowser&&$.body;var head=inBrowser&&$.head;function find(el,node){if(el==null)return;return node?el.querySelector(node):$.querySelector(el)} +function findAll(el,node){return[].slice.call(node?el.querySelectorAll(node):$.querySelectorAll(el))} +function create(node,tpl){node=$.createElement(node);if(tpl){node.innerHTML=tpl;} +return node} +function appendTo(target,el){return target.appendChild(el)} +function before(target,el){if(target==null)return;return target.insertBefore(el,target.children[0])} +function on(el,type,handler){if(el==null)return;isFn(type)?window.addEventListener(el,type):el.addEventListener(type,handler);} +function off(el,type,handler){isFn(type)?window.removeEventListener(el,type):el.removeEventListener(type,handler);} +function toggleClass(el,type,val){el&&el.classList[val?type:'toggle'](val||type);} +function style(content){appendTo(head,create('style',content));} +var dom=Object.freeze({getNode:getNode,$:$,body:body,head:head,find:find,findAll:findAll,create:create,appendTo:appendTo,before:before,on:on,off:off,toggleClass:toggleClass,style:style});function corner(data){if(!data){return''} +if(!/\/\//.test(data)){data='https://github.com/'+data;} +data=data.replace(/^git\+/,'');return(""+''+'')} +function main(config){var aside=''+'';return(("
    ")+'
    '+'
    '+'
    '+'
    ')} +function cover(){var SL=', 100%, 85%';var bgc='linear-gradient(to left bottom, '+"hsl("+(Math.floor(Math.random()*255)+SL)+") 0%,"+"hsl("+(Math.floor(Math.random()*255)+SL)+") 100%)";return("
    "+'
    '+'
    '+'
    ')} +function tree(toc,tpl){if(tpl===void 0)tpl='
      {inner}
    ';if(!toc||!toc.length){return''} +var innerHTML='';toc.forEach(function(node){innerHTML+="
  • "+(node.title)+"
  • ";if(node.children){innerHTML+=tree(node.children,tpl);}});return tpl.replace('{inner}',innerHTML)} +function helper(className,content){return("

    "+(content.slice(5).trim())+"

    ")} +function theme(color){return("")} +var barEl;var timeId;function init(){var div=create('div');div.classList.add('progress');appendTo(body,div);barEl=div;} +function progressbar(ref){var loaded=ref.loaded;var total=ref.total;var step=ref.step;var num;!barEl&&init();if(step){num=parseInt(barEl.style.width||0,10)+step;num=num>80?80:num;}else{num=Math.floor(loaded/total*100);} +barEl.style.opacity=1;barEl.style.width=num>=95?'100%':num+'%';if(num>=95){clearTimeout(timeId);timeId=setTimeout(function(_){barEl.style.opacity=0;barEl.style.width='0%';},200);}} +var cache={};function get(url,hasBar,headers){if(hasBar===void 0)hasBar=false;if(headers===void 0)headers={};var xhr=new XMLHttpRequest();var on=function(){xhr.addEventListener.apply(xhr,arguments);};var cached$$1=cache[url];if(cached$$1){return{then:function(cb){return cb(cached$$1.content,cached$$1.opt);},abort:noop}} +xhr.open('GET',url);for(var i in headers){if(hasOwn.call(headers,i)){xhr.setRequestHeader(i,headers[i]);}} +xhr.send();return{then:function(success,error){if(error===void 0)error=noop;if(hasBar){var id=setInterval(function(_){return progressbar({step:Math.floor(Math.random()*5+1)});},500);on('progress',progressbar);on('loadend',function(evt){progressbar(evt);clearInterval(id);});} +on('error',error);on('load',function(ref){var target=ref.target;if(target.status>=400){error(target);}else{var result=(cache[url]={content:target.response,opt:{updatedAt:xhr.getResponseHeader('last-modified')}});success(result.content,result.opt);}});},abort:function(_){return xhr.readyState!==4&&xhr.abort();}}} +function replaceVar(block,color){block.innerHTML=block.innerHTML.replace(/var\(\s*--theme-color.*?\)/g,color);} +function cssVars(color){if(window.CSS&&window.CSS.supports&&window.CSS.supports('(--v:red)')){return} +var styleBlocks=findAll('style:not(.inserted),link');[].forEach.call(styleBlocks,function(block){if(block.nodeName==='STYLE'){replaceVar(block,color);}else if(block.nodeName==='LINK'){var href=block.getAttribute('href');if(!/\.css$/.test(href)){return} +get(href).then(function(res){var style$$1=create('style',res);head.appendChild(style$$1);replaceVar(style$$1,color);});}});} +var RGX=/([^{]*?)\w(?=\})/g;var dict={YYYY:'getFullYear',YY:'getYear',MM:function(d){return d.getMonth()+1;},DD:'getDate',HH:'getHours',mm:'getMinutes',ss:'getSeconds'};function tinydate(str){var parts=[],offset=0;str.replace(RGX,function(key,_,idx){parts.push(str.substring(offset,idx-1));offset=idx+=key.length+1;parts.push(function(d){return('00'+(typeof dict[key]==='string'?d[dict[key]]():dict[key](d))).slice(-key.length);});});if(offset!==str.length){parts.push(str.substring(offset));} +return function(arg){var out='',i=0,d=arg||new Date();for(;i ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:'^ {0,3}(?:' ++'<(script|pre|style)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)' ++'|comment[^\\n]*(\\n+|$)' ++'|<\\?[\\s\\S]*?\\?>\\n*' ++'|\\n*' ++'|\\n*' ++'|)[\\s\\S]*?(?:\\n{2,}|$)' ++'|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=\\h*\\n)[\\s\\S]*?(?:\\n{2,}|$)' ++'|(?=\\h*\\n)[\\s\\S]*?(?:\\n{2,}|$)' ++')',def:/^ {0,3}\[(label)\]: *\n? *]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,table:noop,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading| {0,3}>|<\/?(?:tag)(?: +|\n|\/?>)|<(?:script|pre|style|!--))[^\n]+)*)/,text:/^[^\n]+/};block._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/;block._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;block.def=edit(block.def).replace('label',block._label).replace('title',block._title).getRegex();block.bullet=/(?:[*+-]|\d+\.)/;block.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/;block.item=edit(block.item,'gm').replace(/bull/g,block.bullet).getRegex();block.list=edit(block.list).replace(/bull/g,block.bullet).replace('hr','\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))').replace('def','\\n+(?='+block.def.source+')').getRegex();block._tag='address|article|aside|base|basefont|blockquote|body|caption' ++'|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption' ++'|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe' ++'|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option' ++'|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr' ++'|track|ul';block._comment=//;block.html=edit(block.html,'i').replace('comment',block._comment).replace('tag',block._tag).replace('attribute',/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();block.paragraph=edit(block.paragraph).replace('hr',block.hr).replace('heading',block.heading).replace('lheading',block.lheading).replace('tag',block._tag).getRegex();block.blockquote=edit(block.blockquote).replace('paragraph',block.paragraph).getRegex();block.normal=merge({},block);block.gfm=merge({},block.normal,{fences:/^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\n? *\1 *(?:\n+|$)/,paragraph:/^/,heading:/^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/});block.gfm.paragraph=edit(block.paragraph).replace('(?!','(?!' ++block.gfm.fences.source.replace('\\1','\\2')+'|' ++block.list.source.replace('\\1','\\3')+'|').getRegex();block.tables=merge({},block.gfm,{nptable:/^ *([^|\n ].*\|.*)\n *([-:]+ *\|[-| :]*)(?:\n((?:.*[^>\n ].*(?:\n|$))*)\n*|$)/,table:/^ *\|(.+)\n *\|?( *[-:]+[-| :]*)(?:\n((?: *[^>\n ].*(?:\n|$))*)\n*|$)/});block.pedantic=merge({},block.normal,{html:edit('^ *(?:comment *(?:\\n|\\s*$)' ++'|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)' ++'|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))').replace('comment',block._comment).replace(/tag/g,'(?!(?:' ++'a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub' ++'|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)' ++'\\b)\\w+(?!:|[^\\w\\s@]*@)\\b').getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/});function Lexer(options){this.tokens=[];this.tokens.links=Object.create(null);this.options=options||marked.defaults;this.rules=block.normal;if(this.options.pedantic){this.rules=block.pedantic;}else if(this.options.gfm){if(this.options.tables){this.rules=block.tables;}else{this.rules=block.gfm;}}} +Lexer.rules=block;Lexer.lex=function(src,options){var lexer=new Lexer(options);return lexer.lex(src);};Lexer.prototype.lex=function(src){src=src.replace(/\r\n|\r/g,'\n').replace(/\t/g,' ').replace(/\u00a0/g,' ').replace(/\u2424/g,'\n');return this.token(src,true);};Lexer.prototype.token=function(src,top){var this$1=this;src=src.replace(/^ +$/gm,'');var next,loose,cap,bull,b,item,listStart,listItems,t,space,i,tag,l,isordered,istask,ischecked;while(src){if(cap=this$1.rules.newline.exec(src)){src=src.substring(cap[0].length);if(cap[0].length>1){this$1.tokens.push({type:'space'});}} +if(cap=this$1.rules.code.exec(src)){src=src.substring(cap[0].length);cap=cap[0].replace(/^ {4}/gm,'');this$1.tokens.push({type:'code',text:!this$1.options.pedantic?rtrim(cap,'\n'):cap});continue;} +if(cap=this$1.rules.fences.exec(src)){src=src.substring(cap[0].length);this$1.tokens.push({type:'code',lang:cap[2],text:cap[3]||''});continue;} +if(cap=this$1.rules.heading.exec(src)){src=src.substring(cap[0].length);this$1.tokens.push({type:'heading',depth:cap[1].length,text:cap[2]});continue;} +if(top&&(cap=this$1.rules.nptable.exec(src))){item={type:'table',header:splitCells(cap[1].replace(/^ *| *\| *$/g,'')),align:cap[2].replace(/^ *|\| *$/g,'').split(/ *\| */),cells:cap[3]?cap[3].replace(/\n$/,'').split('\n'):[]};if(item.header.length===item.align.length){src=src.substring(cap[0].length);for(i=0;i ?/gm,'');this$1.token(cap,top);this$1.tokens.push({type:'blockquote_end'});continue;} +if(cap=this$1.rules.list.exec(src)){src=src.substring(cap[0].length);bull=cap[2];isordered=bull.length>1;listStart={type:'list_start',ordered:isordered,start:isordered?+bull:'',loose:false};this$1.tokens.push(listStart);cap=cap[0].match(this$1.rules.item);listItems=[];next=false;l=cap.length;i=0;for(;i1&&b.length>1)){src=cap.slice(i+1).join('\n')+src;i=l-1;}} +loose=next||/\n\n(?!\s*$)/.test(item);if(i!==l-1){next=item.charAt(item.length-1)==='\n';if(!loose){loose=next;}} +if(loose){listStart.loose=true;} +istask=/^\[[ xX]\] /.test(item);ischecked=undefined;if(istask){ischecked=item[1]!==' ';item=item.replace(/^\[[ xX]\] +/,'');} +t={type:'list_item_start',task:istask,checked:ischecked,loose:loose};listItems.push(t);this$1.tokens.push(t);this$1.token(item,false);this$1.tokens.push({type:'list_item_end'});} +if(listStart.loose){l=listItems.length;i=0;for(;i?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:noop,tag:'^comment' ++'|^' ++'|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>' ++'|^<\\?[\\s\\S]*?\\?>' ++'|^' ++'|^',link:/^!?\[(label)\]\(href(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,strong:/^__([^\s])__(?!_)|^\*\*([^\s])\*\*(?!\*)|^__([^\s][\s\S]*?[^\s])__(?!_)|^\*\*([^\s][\s\S]*?[^\s])\*\*(?!\*)/,em:/^_([^\s_])_(?!_)|^\*([^\s*"<\[])\*(?!\*)|^_([^\s][\s\S]*?[^\s_])_(?!_)|^_([^\s_][\s\S]*?[^\s])_(?!_)|^\*([^\s"<\[][\s\S]*?[^\s*])\*(?!\*)|^\*([^\s*"<\[][\s\S]*?[^\s])\*(?!\*)/,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:noop,text:/^(`+|[^`])[\s\S]*?(?=[\\?@\[\]\\^_`{|}~])/g;inline._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;inline._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/;inline.autolink=edit(inline.autolink).replace('scheme',inline._scheme).replace('email',inline._email).getRegex();inline._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;inline.tag=edit(inline.tag).replace('comment',block._comment).replace('attribute',inline._attribute).getRegex();inline._label=/(?:\[[^\[\]]*\]|\\[\[\]]?|`[^`]*`|[^\[\]\\])*?/;inline._href=/\s*(<(?:\\[<>]?|[^\s<>\\])*>|(?:\\[()]?|\([^\s\x00-\x1f\\]*\)|[^\s\x00-\x1f()\\])*?)/;inline._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;inline.link=edit(inline.link).replace('label',inline._label).replace('href',inline._href).replace('title',inline._title).getRegex();inline.reflink=edit(inline.reflink).replace('label',inline._label).getRegex();inline.normal=merge({},inline);inline.pedantic=merge({},inline.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/,link:edit(/^!?\[(label)\]\((.*?)\)/).replace('label',inline._label).getRegex(),reflink:edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace('label',inline._label).getRegex()});inline.gfm=merge({},inline.normal,{escape:edit(inline.escape).replace('])','~|])').getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~+(?=\S)([\s\S]*?\S)~+/,text:edit(inline.text).replace(']|','~]|').replace('|$','|https?://|ftp://|www\\.|[a-zA-Z0-9.!#$%&\'*+/=?^_`{\\|}~-]+@|$').getRegex()});inline.gfm.url=edit(inline.gfm.url).replace('email',inline.gfm._extended_email).getRegex();inline.breaks=merge({},inline.gfm,{br:edit(inline.br).replace('{2,}','*').getRegex(),text:edit(inline.gfm.text).replace('{2,}','*').getRegex()});function InlineLexer(links,options){this.options=options||marked.defaults;this.links=links;this.rules=inline.normal;this.renderer=this.options.renderer||new Renderer();this.renderer.options=this.options;if(!this.links){throw new Error('Tokens array requires a `links` property.');} +if(this.options.pedantic){this.rules=inline.pedantic;}else if(this.options.gfm){if(this.options.breaks){this.rules=inline.breaks;}else{this.rules=inline.gfm;}}} +InlineLexer.rules=inline;InlineLexer.output=function(src,links,options){var inline=new InlineLexer(links,options);return inline.output(src);};InlineLexer.prototype.output=function(src){var this$1=this;var out='',link,text,href,title,cap,prevCapZero;while(src){if(cap=this$1.rules.escape.exec(src)){src=src.substring(cap[0].length);out+=cap[1];continue;} +if(cap=this$1.rules.autolink.exec(src)){src=src.substring(cap[0].length);if(cap[2]==='@'){text=escape(this$1.mangle(cap[1]));href='mailto:'+text;}else{text=escape(cap[1]);href=text;} +out+=this$1.renderer.link(href,null,text);continue;} +if(!this$1.inLink&&(cap=this$1.rules.url.exec(src))){if(cap[2]==='@'){text=escape(cap[0]);href='mailto:'+text;}else{do{prevCapZero=cap[0];cap[0]=this$1.rules._backpedal.exec(cap[0])[0];}while(prevCapZero!==cap[0]);text=escape(cap[0]);if(cap[1]==='www.'){href='http://'+text;}else{href=text;}} +src=src.substring(cap[0].length);out+=this$1.renderer.link(href,null,text);continue;} +if(cap=this$1.rules.tag.exec(src)){if(!this$1.inLink&&/^/i.test(cap[0])){this$1.inLink=false;} +if(!this$1.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(cap[0])){this$1.inRawBlock=true;}else if(this$1.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(cap[0])){this$1.inRawBlock=false;} +src=src.substring(cap[0].length);out+=this$1.options.sanitize?this$1.options.sanitizer?this$1.options.sanitizer(cap[0]):escape(cap[0]):cap[0];continue;} +if(cap=this$1.rules.link.exec(src)){src=src.substring(cap[0].length);this$1.inLink=true;href=cap[2];if(this$1.options.pedantic){link=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(href);if(link){href=link[1];title=link[3];}else{title='';}}else{title=cap[3]?cap[3].slice(1,-1):'';} +href=href.trim().replace(/^<([\s\S]*)>$/,'$1');out+=this$1.outputLink(cap,{href:InlineLexer.escapes(href),title:InlineLexer.escapes(title)});this$1.inLink=false;continue;} +if((cap=this$1.rules.reflink.exec(src))||(cap=this$1.rules.nolink.exec(src))){src=src.substring(cap[0].length);link=(cap[2]||cap[1]).replace(/\s+/g,' ');link=this$1.links[link.toLowerCase()];if(!link||!link.href){out+=cap[0].charAt(0);src=cap[0].substring(1)+src;continue;} +this$1.inLink=true;out+=this$1.outputLink(cap,link);this$1.inLink=false;continue;} +if(cap=this$1.rules.strong.exec(src)){src=src.substring(cap[0].length);out+=this$1.renderer.strong(this$1.output(cap[4]||cap[3]||cap[2]||cap[1]));continue;} +if(cap=this$1.rules.em.exec(src)){src=src.substring(cap[0].length);out+=this$1.renderer.em(this$1.output(cap[6]||cap[5]||cap[4]||cap[3]||cap[2]||cap[1]));continue;} +if(cap=this$1.rules.code.exec(src)){src=src.substring(cap[0].length);out+=this$1.renderer.codespan(escape(cap[2].trim(),true));continue;} +if(cap=this$1.rules.br.exec(src)){src=src.substring(cap[0].length);out+=this$1.renderer.br();continue;} +if(cap=this$1.rules.del.exec(src)){src=src.substring(cap[0].length);out+=this$1.renderer.del(this$1.output(cap[1]));continue;} +if(cap=this$1.rules.text.exec(src)){src=src.substring(cap[0].length);if(this$1.inRawBlock){out+=this$1.renderer.text(cap[0]);}else{out+=this$1.renderer.text(escape(this$1.smartypants(cap[0])));} +continue;} +if(src){throw new Error('Infinite loop on byte: '+src.charCodeAt(0));}} +return out;};InlineLexer.escapes=function(text){return text?text.replace(InlineLexer.rules._escapes,'$1'):text;};InlineLexer.prototype.outputLink=function(cap,link){var href=link.href,title=link.title?escape(link.title):null;return cap[0].charAt(0)!=='!'?this.renderer.link(href,title,this.output(cap[1])):this.renderer.image(href,title,escape(cap[1]));};InlineLexer.prototype.smartypants=function(text){if(!this.options.smartypants){return text;} +return text.replace(/---/g,'\u2014').replace(/--/g,'\u2013').replace(/(^|[-\u2014/(\[{"\s])'/g,'$1\u2018').replace(/'/g,'\u2019').replace(/(^|[-\u2014/(\[{\u2018\s])"/g,'$1\u201c').replace(/"/g,'\u201d').replace(/\.{3}/g,'\u2026');};InlineLexer.prototype.mangle=function(text){if(!this.options.mangle){return text;} +var out='',l=text.length,i=0,ch;for(;i0.5){ch='x'+ch.toString(16);} +out+='&#'+ch+';';} +return out;};function Renderer(options){this.options=options||marked.defaults;} +Renderer.prototype.code=function(code,lang,escaped){if(this.options.highlight){var out=this.options.highlight(code,lang);if(out!=null&&out!==code){escaped=true;code=out;}} +if(!lang){return'
    '
    ++(escaped?code:escape(code,true))
    ++'
    ';} +return'
    '
    ++(escaped?code:escape(code,true))
    ++'
    \n';};Renderer.prototype.blockquote=function(quote){return'
    \n'+quote+'
    \n';};Renderer.prototype.html=function(html){return html;};Renderer.prototype.heading=function(text,level,raw){if(this.options.headerIds){return'' ++text ++'\n';} +return''+text+'\n';};Renderer.prototype.hr=function(){return this.options.xhtml?'
    \n':'
    \n';};Renderer.prototype.list=function(body,ordered,start){var type=ordered?'ol':'ul',startatt=(ordered&&start!==1)?(' start="'+start+'"'):'';return'<'+type+startatt+'>\n'+body+'\n';};Renderer.prototype.listitem=function(text){return'
  • '+text+'
  • \n';};Renderer.prototype.checkbox=function(checked){return' ';};Renderer.prototype.paragraph=function(text){return'

    '+text+'

    \n';};Renderer.prototype.table=function(header,body){if(body){body=''+body+'';} +return'\n' ++'\n' ++header ++'\n' ++body ++'
    \n';};Renderer.prototype.tablerow=function(content){return'\n'+content+'\n';};Renderer.prototype.tablecell=function(content,flags){var type=flags.header?'th':'td';var tag=flags.align?'<'+type+' align="'+flags.align+'">':'<'+type+'>';return tag+content+'\n';};Renderer.prototype.strong=function(text){return''+text+'';};Renderer.prototype.em=function(text){return''+text+'';};Renderer.prototype.codespan=function(text){return''+text+'';};Renderer.prototype.br=function(){return this.options.xhtml?'
    ':'
    ';};Renderer.prototype.del=function(text){return''+text+'';};Renderer.prototype.link=function(href,title,text){if(this.options.sanitize){try{var prot=decodeURIComponent(unescape(href)).replace(/[^\w:]/g,'').toLowerCase();}catch(e){return text;} +if(prot.indexOf('javascript:')===0||prot.indexOf('vbscript:')===0||prot.indexOf('data:')===0){return text;}} +if(this.options.baseUrl&&!originIndependentUrl.test(href)){href=resolveUrl(this.options.baseUrl,href);} +try{href=encodeURI(href).replace(/%25/g,'%');}catch(e){return text;} +var out='
    ';return out;};Renderer.prototype.image=function(href,title,text){if(this.options.baseUrl&&!originIndependentUrl.test(href)){href=resolveUrl(this.options.baseUrl,href);} +var out=''+text+'':'>';return out;};Renderer.prototype.text=function(text){return text;};function TextRenderer(){} +TextRenderer.prototype.strong=TextRenderer.prototype.em=TextRenderer.prototype.codespan=TextRenderer.prototype.del=TextRenderer.prototype.text=function(text){return text;};TextRenderer.prototype.link=TextRenderer.prototype.image=function(href,title,text){return''+text;};TextRenderer.prototype.br=function(){return'';};function Parser(options){this.tokens=[];this.token=null;this.options=options||marked.defaults;this.options.renderer=this.options.renderer||new Renderer();this.renderer=this.options.renderer;this.renderer.options=this.options;} +Parser.parse=function(src,options){var parser=new Parser(options);return parser.parse(src);};Parser.prototype.parse=function(src){var this$1=this;this.inline=new InlineLexer(src.links,this.options);this.inlineText=new InlineLexer(src.links,merge({},this.options,{renderer:new TextRenderer()}));this.tokens=src.reverse();var out='';while(this.next()){out+=this$1.tok();} +return out;};Parser.prototype.next=function(){return this.token=this.tokens.pop();};Parser.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0;};Parser.prototype.parseText=function(){var this$1=this;var body=this.token.text;while(this.peek().type==='text'){body+='\n'+this$1.next().text;} +return this.inline.output(body);};Parser.prototype.tok=function(){var this$1=this;switch(this.token.type){case'space':{return'';} +case'hr':{return this.renderer.hr();} +case'heading':{return this.renderer.heading(this.inline.output(this.token.text),this.token.depth,unescape(this.inlineText.output(this.token.text)));} +case'code':{return this.renderer.code(this.token.text,this.token.lang,this.token.escaped);} +case'table':{var header='',body='',i,row,cell,j;cell='';for(i=0;i"']/;escape.escapeReplace=/[&<>"']/g;escape.replacements={'&':'&','<':'<','>':'>','"':'"',"'":'''};escape.escapeTestNoEncode=/[<>"']|&(?!#?\w+;)/;escape.escapeReplaceNoEncode=/[<>"']|&(?!#?\w+;)/g;function unescape(html){return html.replace(/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,function(_,n){n=n.toLowerCase();if(n==='colon'){return':';} +if(n.charAt(0)==='#'){return n.charAt(1)==='x'?String.fromCharCode(parseInt(n.substring(2),16)):String.fromCharCode(+n.substring(1));} +return'';});} +function edit(regex,opt){regex=regex.source||regex;opt=opt||'';return{replace:function(name,val){val=val.source||val;val=val.replace(/(^|[^\[])\^/g,'$1');regex=regex.replace(name,val);return this;},getRegex:function(){return new RegExp(regex,opt);}};} +function resolveUrl(base,href){if(!baseUrls[' '+base]){if(/^[^:]+:\/*[^/]*$/.test(base)){baseUrls[' '+base]=base+'/';}else{baseUrls[' '+base]=rtrim(base,'/',true);}} +base=baseUrls[' '+base];if(href.slice(0,2)==='//'){return base.replace(/:[\s\S]*/,':')+href;}else if(href.charAt(0)==='/'){return base.replace(/(:\/*[^/]*)[\s\S]*/,'$1')+href;}else{return base+href;}} +var baseUrls={};var originIndependentUrl=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function noop(){} +noop.exec=noop;function merge(obj){var arguments$1=arguments;var i=1,target,key;for(;i=0&&str[curr]==='\\'){escaped=!escaped;} +if(escaped){return'|';}else{return' |';}}),cells=row.split(/ \|/),i=0;if(cells.length>count){cells.splice(count);}else{while(cells.lengthAn error occurred:

    '
    ++escape(e.message+'',true)
    ++'
    ';} +throw e;}} +marked.options=marked.setOptions=function(opt){merge(marked.defaults,opt);return marked;};marked.getDefaults=function(){return{baseUrl:null,breaks:false,gfm:true,headerIds:true,headerPrefix:'',highlight:null,langPrefix:'language-',mangle:true,pedantic:false,renderer:new Renderer(),sanitize:false,sanitizer:null,silent:false,smartLists:false,smartypants:false,tables:true,xhtml:false};};marked.defaults=marked.getDefaults();marked.Parser=Parser;marked.parser=Parser.parse;marked.Renderer=Renderer;marked.TextRenderer=TextRenderer;marked.Lexer=Lexer;marked.lexer=Lexer.lex;marked.InlineLexer=InlineLexer;marked.inlineLexer=InlineLexer.output;marked.parse=marked;{module.exports=marked;}})(commonjsGlobal||(typeof window!=='undefined'?window:commonjsGlobal));});var prism=createCommonjsModule(function(module){var _self=(typeof window!=='undefined')?window:((typeof WorkerGlobalScope!=='undefined'&&self instanceof WorkerGlobalScope)?self:{});var Prism=(function(){var lang=/\blang(?:uage)?-([\w-]+)\b/i;var uniqueId=0;var _=_self.Prism={manual:_self.Prism&&_self.Prism.manual,disableWorkerMessageHandler:_self.Prism&&_self.Prism.disableWorkerMessageHandler,util:{encode:function(tokens){if(tokens instanceof Token){return new Token(tokens.type,_.util.encode(tokens.content),tokens.alias);}else if(_.util.type(tokens)==='Array'){return tokens.map(_.util.encode);}else{return tokens.replace(/&/g,'&').replace(/text.length){return;} +if(str instanceof Token){continue;} +if(greedy&&i!=strarr.length-1){pattern.lastIndex=pos;var match=pattern.exec(text);if(!match){break;} +var from=match.index+(lookbehind?match[1].length:0),to=match.index+match[0].length,k=i,p=pos;for(var len=strarr.length;k=p){++i;pos=p;}} +if(strarr[i]instanceof Token){continue;} +delNum=k-i;str=text.slice(pos,p);match.index-=pos;}else{pattern.lastIndex=0;var match=pattern.exec(str),delNum=1;} +if(!match){if(oneshot){break;} +continue;} +if(lookbehind){lookbehindLength=match[1]?match[1].length:0;} +var from=match.index+lookbehindLength,match=match[0].slice(lookbehindLength),to=from+match.length,before=str.slice(0,from),after=str.slice(to);var args=[i,delNum];if(before){++i;pos+=before.length;args.push(before);} +var wrapped=new Token(token,inside?_.tokenize(match,inside):match,alias,match,greedy);args.push(wrapped);if(after){args.push(after);} +Array.prototype.splice.apply(strarr,args);if(delNum!=1) +{_.matchGrammar(text,strarr,grammar,i,pos,true,token);} +if(oneshot) +{break;}}}}},tokenize:function(text,grammar,language){var strarr=[text];var rest=grammar.rest;if(rest){for(var token in rest){grammar[token]=rest[token];} +delete grammar.rest;} +_.matchGrammar(text,strarr,grammar,0,0,false);return strarr;},hooks:{all:{},add:function(name,callback){var hooks=_.hooks.all;hooks[name]=hooks[name]||[];hooks[name].push(callback);},run:function(name,env){var callbacks=_.hooks.all[name];if(!callbacks||!callbacks.length){return;} +for(var i=0,callback;callback=callbacks[i++];){callback(env);}}}};var Token=_.Token=function(type,content,alias,matchedStr,greedy){this.type=type;this.content=content;this.alias=alias;this.length=(matchedStr||"").length|0;this.greedy=!!greedy;};Token.stringify=function(o,language,parent){if(typeof o=='string'){return o;} +if(_.util.type(o)==='Array'){return o.map(function(element){return Token.stringify(element,language,o);}).join('');} +var env={type:o.type,content:Token.stringify(o.content,language,parent),tag:'span',classes:['token',o.type],attributes:{},language:language,parent:parent};if(o.alias){var aliases=_.util.type(o.alias)==='Array'?o.alias:[o.alias];Array.prototype.push.apply(env.classes,aliases);} +_.hooks.run('wrap',env);var attributes=Object.keys(env.attributes).map(function(name){return name+'="'+(env.attributes[name]||'').replace(/"/g,'"')+'"';}).join(' ');return'<'+env.tag+' class="'+env.classes.join(' ')+'"'+(attributes?' '+attributes:'')+'>'+env.content+'';};if(!_self.document){if(!_self.addEventListener){return _self.Prism;} +if(!_.disableWorkerMessageHandler){_self.addEventListener('message',function(evt){var message=JSON.parse(evt.data),lang=message.language,code=message.code,immediateClose=message.immediateClose;_self.postMessage(_.highlight(code,_.languages[lang],lang));if(immediateClose){_self.close();}},false);} +return _self.Prism;} +var script=document.currentScript||[].slice.call(document.getElementsByTagName("script")).pop();if(script){_.filename=script.src;if(!_.manual&&!script.hasAttribute('data-manual')){if(document.readyState!=="loading"){if(window.requestAnimationFrame){window.requestAnimationFrame(_.highlightAll);}else{window.setTimeout(_.highlightAll,16);}} +else{document.addEventListener('DOMContentLoaded',_.highlightAll);}}} +return _self.Prism;})();if('object'!=='undefined'&&module.exports){module.exports=Prism;} +if(typeof commonjsGlobal!=='undefined'){commonjsGlobal.Prism=Prism;} +Prism.languages.markup={'comment'://,'prolog':/<\?[\s\S]+?\?>/,'doctype'://i,'cdata'://i,'tag':{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+))?)*\s*\/?>/i,greedy:true,inside:{'tag':{pattern:/^<\/?[^\s>\/]+/i,inside:{'punctuation':/^<\/?/,'namespace':/^[^\s>\/:]+:/}},'attr-value':{pattern:/=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+)/i,inside:{'punctuation':[/^=/,{pattern:/(^|[^\\])["']/,lookbehind:true}]}},'punctuation':/\/?>/,'attr-name':{pattern:/[^\s>\/]+/,inside:{'namespace':/^[^\s>\/:]+:/}}}},'entity':/&#?[\da-z]{1,8};/i};Prism.languages.markup['tag'].inside['attr-value'].inside['entity']=Prism.languages.markup['entity'];Prism.hooks.add('wrap',function(env){if(env.type==='entity'){env.attributes['title']=env.content.replace(/&/,'&');}});Prism.languages.xml=Prism.languages.markup;Prism.languages.html=Prism.languages.markup;Prism.languages.mathml=Prism.languages.markup;Prism.languages.svg=Prism.languages.markup;Prism.languages.css={'comment':/\/\*[\s\S]*?\*\//,'atrule':{pattern:/@[\w-]+?.*?(?:;|(?=\s*\{))/i,inside:{'rule':/@[\w-]+/}},'url':/url\((?:(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,'selector':/[^{}\s][^{};]*?(?=\s*\{)/,'string':{pattern:/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:true},'property':/[-_a-z\xA0-\uFFFF][-\w\xA0-\uFFFF]*(?=\s*:)/i,'important':/\B!important\b/i,'function':/[-a-z0-9]+(?=\()/i,'punctuation':/[(){};:]/};Prism.languages.css['atrule'].inside.rest=Prism.languages.css;if(Prism.languages.markup){Prism.languages.insertBefore('markup','tag',{'style':{pattern:/()[\s\S]*?(?=<\/style>)/i,lookbehind:true,inside:Prism.languages.css,alias:'language-css',greedy:true}});Prism.languages.insertBefore('inside','attr-value',{'style-attr':{pattern:/\s*style=("|')(?:\\[\s\S]|(?!\1)[^\\])*\1/i,inside:{'attr-name':{pattern:/^\s*style/i,inside:Prism.languages.markup.tag.inside},'punctuation':/^\s*=\s*['"]|['"]\s*$/,'attr-value':{pattern:/.+/i,inside:Prism.languages.css}},alias:'language-css'}},Prism.languages.markup.tag);} +Prism.languages.clike={'comment':[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:true},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:true,greedy:true}],'string':{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:true},'class-name':{pattern:/((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[\w.\\]+/i,lookbehind:true,inside:{punctuation:/[.\\]/}},'keyword':/\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,'boolean':/\b(?:true|false)\b/,'function':/[a-z0-9_]+(?=\()/i,'number':/\b0x[\da-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?/i,'operator':/--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,'punctuation':/[{}[\];(),.:]/};Prism.languages.javascript=Prism.languages.extend('clike',{'keyword':/\b(?: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|var|void|while|with|yield)\b/,'number':/\b(?:0[xX][\dA-Fa-f]+|0[bB][01]+|0[oO][0-7]+|NaN|Infinity)\b|(?:\b\d+\.?\d*|\B\.\d+)(?:[Ee][+-]?\d+)?/,'function':/[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*\()/i,'operator':/-[-=]?|\+[+=]?|!=?=?|<>?>?=?|=(?:==?|>)?|&[&=]?|\|[|=]?|\*\*?=?|\/=?|~|\^=?|%=?|\?|\.{3}/});Prism.languages.insertBefore('javascript','keyword',{'regex':{pattern:/((?:^|[^$\w\xA0-\uFFFF."'\])\s])\s*)\/(\[[^\]\r\n]+]|\\.|[^/\\\[\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})\]]))/,lookbehind:true,greedy:true},'function-variable':{pattern:/[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*=\s*(?:function\b|(?:\([^()]*\)|[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)\s*=>))/i,alias:'function'},'constant':/\b[A-Z][A-Z\d_]*\b/});Prism.languages.insertBefore('javascript','string',{'template-string':{pattern:/`(?:\\[\s\S]|\${[^}]+}|[^\\`])*`/,greedy:true,inside:{'interpolation':{pattern:/\${[^}]+}/,inside:{'interpolation-punctuation':{pattern:/^\${|}$/,alias:'punctuation'},rest:null}},'string':/[\s\S]+/}}});Prism.languages.javascript['template-string'].inside['interpolation'].inside.rest=Prism.languages.javascript;if(Prism.languages.markup){Prism.languages.insertBefore('markup','tag',{'script':{pattern:/()[\s\S]*?(?=<\/script>)/i,lookbehind:true,inside:Prism.languages.javascript,alias:'language-javascript',greedy:true}});} +Prism.languages.js=Prism.languages.javascript;(function(){if(typeof self==='undefined'||!self.Prism||!self.document||!document.querySelector){return;} +self.Prism.fileHighlight=function(){var Extensions={'js':'javascript','py':'python','rb':'ruby','ps1':'powershell','psm1':'powershell','sh':'bash','bat':'batch','h':'c','tex':'latex'};Array.prototype.slice.call(document.querySelectorAll('pre[data-src]')).forEach(function(pre){var src=pre.getAttribute('data-src');var language,parent=pre;var lang=/\blang(?:uage)?-([\w-]+)\b/i;while(parent&&!lang.test(parent.className)){parent=parent.parentNode;} +if(parent){language=(pre.className.match(lang)||[,''])[1];} +if(!language){var extension=(src.match(/\.(\w+)$/)||[,''])[1];language=Extensions[extension]||extension;} +var code=document.createElement('code');code.className='language-'+language;pre.textContent='';code.textContent='Loading…';pre.appendChild(code);var xhr=new XMLHttpRequest();xhr.open('GET',src,true);xhr.onreadystatechange=function(){if(xhr.readyState==4){if(xhr.status<400&&xhr.responseText){code.textContent=xhr.responseText;Prism.highlightElement(code);} +else if(xhr.status>=400){code.textContent='✖ Error '+xhr.status+' while fetching file: '+xhr.statusText;} +else{code.textContent='✖ Error: File does not exist or is empty';}}};xhr.send(null);});if(Prism.plugins.toolbar){Prism.plugins.toolbar.registerButton('download-file',function(env){var pre=env.element.parentNode;if(!pre||!/pre/i.test(pre.nodeName)||!pre.hasAttribute('data-src')||!pre.hasAttribute('data-download-link')){return;} +var src=pre.getAttribute('data-src');var a=document.createElement('a');a.textContent=pre.getAttribute('data-download-link-label')||'Download';a.setAttribute('download','');a.href=src;return a;});}};document.addEventListener('DOMContentLoaded',self.Prism.fileHighlight);})();});function genTree(toc,maxLevel){var headlines=[];var last={};toc.forEach(function(headline){var level=headline.level||1;var len=level-1;if(level>maxLevel){return} +if(last[len]){last[len].children=(last[len].children||[]).concat(headline);}else{headlines.push(headline);} +last[level]=headline;});return headlines} +var cache$1={};var re=/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g;function lower(string){return string.toLowerCase()} +function slugify(str){if(typeof str!=='string'){return''} +var slug=str.trim().replace(/[A-Z]+/g,lower).replace(/<[^>\d]+>/g,'').replace(re,'').replace(/\s/g,'-').replace(/-+/g,'-').replace(/^(\d)/,'_$1');var count=cache$1[slug];count=hasOwn.call(cache$1,slug)?count+1:0;cache$1[slug]=count;if(count){slug=slug+'-'+count;} +return slug} +slugify.clear=function(){cache$1={};};function replace(m,$1){return''+$1+''} +function emojify(text){return text.replace(/<(pre|template|code)[^>]*?>[\s\S]+?<\/(pre|template|code)>/g,function(m){return m.replace(/:/g,'__colon__');}).replace(/:(\w+?):/ig,(inBrowser&&window.emojify)||replace).replace(/__colon__/g,':')} +var decode=decodeURIComponent;var encode=encodeURIComponent;function parseQuery(query){var res={};query=query.trim().replace(/^(\?|#|&)/,'');if(!query){return res} +query.split('&').forEach(function(param){var parts=param.replace(/\+/g,' ').split('=');res[parts[0]]=parts[1]&&decode(parts[1]);});return res} +function stringifyQuery(obj,ignores){if(ignores===void 0)ignores=[];var qs=[];for(var key in obj){if(ignores.indexOf(key)>-1){continue} +qs.push(obj[key]?((encode(key))+"="+(encode(obj[key]))).toLowerCase():encode(key));} +return qs.length?("?"+(qs.join('&'))):''} +var isAbsolutePath=cached(function(path){return/(:|(\/{2}))/g.test(path)});var getParentPath=cached(function(path){return/\/$/g.test(path)?path:(path=path.match(/(\S*\/)[^/]+$/))?path[1]:''});var cleanPath=cached(function(path){return path.replace(/^\/+/,'/').replace(/([^:])\/{2,}/g,'$1/')});var resolvePath=cached(function(path){var segments=path.replace(/^\//,'').split('/');var resolved=[];for(var i=0,len=segments.length;i=keys.length){return;} +for(var i=0;i-1){++j;var before=s.substring(0,index);var middle=new Prism.Token(language,Prism.tokenize(t,env.grammar,language),'language-'+language,t);var after=s.substring(index+('___'+language.toUpperCase()+k+'___').length);var replacement;if(before||after){replacement=[before,middle,after].filter(function(v){return!!v;});walkTokens(replacement);}else{replacement=middle;} +if(typeof token==='string'){Array.prototype.splice.apply(tokens,[i,1].concat(replacement));}else{token.content=replacement;} +if(j>=keys.length){break;}}}else if(token.content&&typeof token.content!=='string'){walkTokens(token.content);}}};walkTokens(env.tokens);}}});var cachedLinks={};function getAndRemoveConfig(str){if(str===void 0)str='';var config={};if(str){str=str.replace(/^'/,'').replace(/'$/,'').replace(/(?:^|\s):([\w-]+)=?([\w-]+)?/g,function(m,key,value){config[key]=(value&&value.replace(/"/g,''))||true;return''}).trim();} +return{str:str,config:config}} +var compileMedia={markdown:function markdown(url){return{url:url}},mermaid:function mermaid(url){return{url:url}},iframe:function iframe(url,title){return{html:("")}},video:function video(url,title){return{html:("")}},audio:function audio(url,title){return{html:("")}},code:function code(url,title){var lang=url.match(/\.(\w+)$/);lang=title||(lang&&lang[1]);if(lang==='md'){lang='markdown';} +return{url:url,lang:lang}}};var Compiler=function Compiler(config,router){var this$1=this;this.config=config;this.router=router;this.cacheTree={};this.toc=[];this.cacheTOC={};this.linkTarget=config.externalLinkTarget||'_blank';this.contentBase=router.getBasePath();var renderer=this._initRenderer();var compile;var mdConf=config.markdown||{};if(isFn(mdConf)){compile=mdConf(marked,renderer);}else{marked.setOptions(merge(mdConf,{renderer:merge(renderer,mdConf.renderer)}));compile=marked;} +this._marked=compile;this.compile=function(text){var isCached=true;var result=cached(function(_){isCached=false;var html='';if(!text){return text} +if(isPrimitive(text)){html=compile(text);}else{html=compile.parser(text);} +html=config.noEmoji?html:emojify(html);slugify.clear();return html})(text);var curFileName=this$1.router.parse().file;if(isCached){this$1.toc=this$1.cacheTOC[curFileName];}else{this$1.cacheTOC[curFileName]=[].concat(this$1.toc);} +return result};};Compiler.prototype.compileEmbed=function compileEmbed(href,title){var ref=getAndRemoveConfig(title);var str=ref.str;var config=ref.config;var embed;title=str;if(config.include){if(!isAbsolutePath(href)){href=getPath(this.contentBase,getParentPath(this.router.getCurrentPath()),href);} +var media;if(config.type&&(media=compileMedia[config.type])){embed=media.call(this,href,title);embed.type=config.type;}else{var type='code';if(/\.(md|markdown)/.test(href)){type='markdown';}else if(/\.mmd/.test(href)){type='mermaid';}else if(/\.html?/.test(href)){type='iframe';}else if(/\.(mp4|ogg)/.test(href)){type='video';}else if(/\.mp3/.test(href)){type='audio';} +embed=compileMedia[type].call(this,href,title);embed.type=type;} +embed.fragment=config.fragment;return embed}};Compiler.prototype._matchNotCompileLink=function _matchNotCompileLink(link){var links=this.config.noCompileLinks||[];for(var i=0;i
    "+str+"")};origin.code=renderer.code=function(code,lang){if(lang===void 0)lang='';code=code.replace(/@DOCSIFY_QM@/g,'`');var hl=prism.highlight(code,prism.languages[lang]||prism.languages.markup);return("
    "+hl+"
    ")};origin.link=renderer.link=function(href,title,text){if(title===void 0)title='';var attrs='';var ref=getAndRemoveConfig(title);var str=ref.str;var config=ref.config;title=str;if(!isAbsolutePath(href)&&!_self._matchNotCompileLink(href)&&!config.ignore){if(href===_self.config.homepage){href='README';} +href=router.toURL(href,null,router.getCurrentPath());}else{attrs+=href.indexOf('mailto:')===0?'':(" target=\""+linkTarget+"\"");} +if(config.target){attrs+=' target='+config.target;} +if(config.disabled){attrs+=' disabled';href='javascript:void(0)';} +if(title){attrs+=" title=\""+title+"\"";} +return(""+text+"")};origin.paragraph=renderer.paragraph=function(text){var result;if(/^!>/.test(text)){result=helper('tip',text);}else if(/^\?>/.test(text)){result=helper('warn',text);}else{result="

    "+text+"

    ";} +return result};origin.image=renderer.image=function(href,title,text){var url=href;var attrs='';var ref=getAndRemoveConfig(title);var str=ref.str;var config=ref.config;title=str;if(config['no-zoom']){attrs+=' data-no-zoom';} +if(title){attrs+=" title=\""+title+"\"";} +var size=config.size;if(size){var sizes=size.split('x');if(sizes[1]){attrs+='width='+sizes[0]+' height='+sizes[1];}else{attrs+='width='+sizes[0];}} +if(!isAbsolutePath(href)){url=getPath(contentBase,getParentPath(router.getCurrentPath()),href);} +return("\""+text+"\""+attrs+"")};origin.list=renderer.list=function(body,ordered,start){var isTaskList=/
  • /.test(body.split('class="task-list"')[0]);var isStartReq=start&&start>1;var tag=ordered?'ol':'ul';var tagAttrs=[(isTaskList?'class="task-list"':''),(isStartReq?("start=\""+start+"\""):'')].join(' ').trim();return("<"+tag+" "+tagAttrs+">"+body+"")};origin.listitem=renderer.listitem=function(text){var isTaskItem=/^(]*>)/.test(text);var html=isTaskItem?("
  • "):("
  • "+text+"
  • ");return html};renderer.origin=origin;return renderer};Compiler.prototype.sidebar=function sidebar(text,level){var ref=this;var toc=ref.toc;var currentPath=this.router.getCurrentPath();var html='';if(text){html=this.compile(text);}else{for(var i=0;i{inner}');this.cacheTree[currentPath]=tree$$1;} +return'';};Compiler.prototype.subSidebar=function subSidebar(level){if(!level){this.toc=[];return} +var currentPath=this.router.getCurrentPath();var ref=this;var cacheTree=ref.cacheTree;var toc=ref.toc;toc[0]&&toc[0].ignoreAllSubs&&toc.splice(0);toc[0]&&toc[0].level===1&&toc.shift();for(var i=0;i=coverHeight||cover.classList.contains('hidden')){toggleClass(body,'add','sticky');}else{toggleClass(body,'remove','sticky');}} +function getAndActive(router,el,isParent,autoTitle){el=getNode(el);var links=[];if(el!=null){links=findAll(el,'a');} +var hash=decodeURI(router.toURL(router.getCurrentPath()));var target;links.sort(function(a,b){return b.href.length-a.href.length;}).forEach(function(a){var href=a.getAttribute('href');var node=isParent?a.parentNode:a;if(hash.indexOf(href)===0&&!target){target=a;toggleClass(node,'add','active');}else{toggleClass(node,'remove','active');}});if(autoTitle){$.title=target?(target.title||((target.innerText)+" - "+title)):title;} +return target} +var _createClass=function(){function defineProperties(target,props){for(var i=0;i0&&arguments[0]!==undefined?arguments[0]:{};_classCallCheck(this,Tweezer);this.duration=opts.duration||1000;this.ease=opts.easing||this._defaultEase;this.start=opts.start;this.end=opts.end;this.frame=null;this.next=null;this.isRunning=false;this.events={};this.direction=this.startthis.end&&lastTick>=this.next}[this.direction];}},{key:'_defaultEase',value:function _defaultEase(t,b,c,d){if((t/=d/2)<1){return c/2*t*t+b;} +return-c/2*(--t*(t-2)-1)+b;}}]);return Tweezer;}();var nav={};var hoverOver=false;var scroller=null;var enableScrollEvent=true;var coverHeight=0;function scrollTo(el){if(scroller){scroller.stop();} +enableScrollEvent=false;scroller=new Tweezer({start:window.pageYOffset,end:el.getBoundingClientRect().top+window.pageYOffset,duration:500}).on('tick',function(v){return window.scrollTo(0,v);}).on('done',function(){enableScrollEvent=true;scroller=null;}).begin();} +function highlight(path){if(!enableScrollEvent){return} +var sidebar=getNode('.sidebar');var anchors=findAll('.anchor');var wrap=find(sidebar,'.sidebar-nav');var active=find(sidebar,'li.active');var doc=document.documentElement;var top=((doc&&doc.scrollTop)||document.body.scrollTop)-coverHeight;var last;for(var i=0,len=anchors.length;itop){if(!last){last=node;} +break}else{last=node;}} +if(!last){return} +var li=nav[getNavKey(decodeURIComponent(path),last.getAttribute('data-id'))];if(!li||li===active){return} +active&&active.classList.remove('active');li.classList.add('active');active=li;if(!hoverOver&&body.classList.contains('sticky')){var height=sidebar.clientHeight;var curOffset=0;var cur=active.offsetTop+active.clientHeight+40;var isInView=active.offsetTop>=wrap.scrollTop&&cur<=wrap.scrollTop+height;var notThan=cur-curOffset\n"+text+"\n")}];embedToken.links={};}else{embedToken=[{type:'html',text:text}];embedToken.links={};}} +cb({token:token,embedToken:embedToken});if(++count>=step){cb({});}}})(token);if(token.embed.url){{get(token.embed.url).then(next);}}else{next(token.embed.html);}}} +function prerenderEmbed(ref,done){var compiler=ref.compiler;var raw=ref.raw;if(raw===void 0)raw='';var fetch=ref.fetch;var hit=cached$1[raw];if(hit){var copy=hit.slice();copy.links=hit.links;return done(copy)} +var compile=compiler._marked;var tokens=compile.lexer(raw);var embedTokens=[];var linkRE=compile.InlineLexer.rules.link;var links=tokens.links;tokens.forEach(function(token,index){if(token.type==='paragraph'){token.text=token.text.replace(new RegExp(linkRE.source,'g'),function(src,filename,href,title){var embed=compiler.compileEmbed(href,title);if(embed){embedTokens.push({index:index,embed:embed});} +return src});}});var moveIndex=0;walkFetchEmbed({compile:compile,embedTokens:embedTokens,fetch:fetch},function(ref){var embedToken=ref.embedToken;var token=ref.token;if(token){var index=token.index+moveIndex;merge(links,embedToken.links);tokens=tokens.slice(0,index).concat(embedToken,tokens.slice(index+1));moveIndex+=embedToken.length-1;}else{cached$1[raw]=tokens.concat();tokens.links=cached$1[raw].links=links;done(tokens);}});} +function executeScript(){var script=findAll('.markdown-section>script').filter(function(s){return!/template/.test(s.type);})[0];if(!script){return false} +var code=script.innerText.trim();if(!code){return false} +setTimeout(function(_){window.__EXECUTE_RESULT__=new Function(code)();},0);} +function formatUpdated(html,updated,fn){updated=typeof fn==='function'?fn(updated):typeof fn==='string'?tinydate(fn)(new Date(updated)):updated;return html.replace(/{docsify-updated}/g,updated)} +function renderMain(html){if(!html){html='

    404 - Not found

    ';} +this._renderTo('.markdown-section',html);!this.config.loadSidebar&&this._renderSidebar();if(this.config.executeScript!==false&&typeof window.Vue!=='undefined'&&!executeScript()){setTimeout(function(_){var vueVM=window.__EXECUTE_RESULT__;vueVM&&vueVM.$destroy&&vueVM.$destroy();window.__EXECUTE_RESULT__=new window.Vue().$mount('#main');},0);}else{this.config.executeScript&&executeScript();}} +function renderNameLink(vm){var el=getNode('.app-name-link');var nameLink=vm.config.nameLink;var path=vm.route.path;if(!el){return} +if(isPrimitive(vm.config.nameLink)){el.setAttribute('href',nameLink);}else if(typeof nameLink==='object'){var match=Object.keys(nameLink).filter(function(key){return path.indexOf(key)>-1;})[0];el.setAttribute('href',nameLink[match]);}} +function renderMixin(proto){proto._renderTo=function(el,content,replace){var node=getNode(el);if(node){node[replace?'outerHTML':'innerHTML']=content;}};proto._renderSidebar=function(text){var ref=this.config;var maxLevel=ref.maxLevel;var subMaxLevel=ref.subMaxLevel;var loadSidebar=ref.loadSidebar;this._renderTo('.sidebar-nav',this.compiler.sidebar(text,maxLevel));var activeEl=getAndActive(this.router,'.sidebar-nav',true,true);if(loadSidebar&&activeEl){activeEl.parentNode.innerHTML+=this.compiler.subSidebar(subMaxLevel)||'';}else{this.compiler.subSidebar();} +this._bindEventOnRendered(activeEl);};proto._bindEventOnRendered=function(activeEl){var ref=this.config;var autoHeader=ref.autoHeader;var auto2top=ref.auto2top;scrollActiveSidebar(this.router);if(autoHeader&&activeEl){var main$$1=getNode('#main');var firstNode=main$$1.children[0];if(firstNode&&firstNode.tagName!=='H1'){var h1=create('h1');h1.innerText=activeEl.innerText;before(main$$1,h1);}} +auto2top&&scroll2Top(auto2top);};proto._renderMain=function(text,opt,next){var this$1=this;if(opt===void 0)opt={};if(!text){return renderMain.call(this,text)} +callHook(this,'beforeEach',text,function(result){var html;var callback=function(){if(opt.updatedAt){html=formatUpdated(html,opt.updatedAt,this$1.config.formatUpdated);} +callHook(this$1,'afterEach',html,function(text){completeLoading();return renderMain.call(this$1,text);});};if(this$1.isHTML){html=this$1.result=text;callback();next();}else{prerenderEmbed({compiler:this$1.compiler,raw:result},function(tokens){html=this$1.compiler.compile(tokens);callback();next();});}});};proto._updateRender=function(){renderNameLink(this);};} +function initRender(vm){var config=vm.config;vm.compiler=new Compiler(config,vm.router);if(inBrowser){window.__current_docsify_compiler__=vm.compiler;} +var id=config.el||'#app';var navEl=find('nav')||create('nav');var el=find(id);var html='';var navAppendToTarget=body;if(el){if(config.repo){html+=corner(config.repo);} +if(config.coverpage){html+=cover();} +if(config.logo){var isBase64=/^data:image/.test(config.logo);var isExternal=/(?:http[s]?:)?\/\//.test(config.logo);var isRelative=/^\./.test(config.logo);if(!isBase64&&!isExternal&&!isRelative){config.logo=getPath(vm.router.getBasePath(),config.logo);}} +html+=main(config);vm._renderTo(el,html,true);}else{vm.rendered=true;} +if(config.mergeNavbar&&isMobile){navAppendToTarget=find('.sidebar');}else{navEl.classList.add('app-nav');if(!config.repo){navEl.classList.add('no-badge');}} +if(config.loadNavbar){before(navAppendToTarget,navEl);} +if(config.themeColor){$.head.appendChild(create('div',theme(config.themeColor)).firstElementChild);cssVars(config.themeColor);} +vm._updateRender();toggleClass(body,'ready');} +var cached$2={};function getAlias(path,alias,last){var match=Object.keys(alias).filter(function(key){var re=cached$2[key]||(cached$2[key]=new RegExp(("^"+key+"$")));return re.test(path)&&path!==last})[0];return match?getAlias(path.replace(cached$2[match],alias[match]),alias,path):path} +function getFileName(path,ext){return new RegExp(("\\.("+(ext.replace(/^\./,''))+"|html)$"),'g').test(path)?path:/\/$/g.test(path)?(path+"README"+ext):(""+path+ext)} +var History=function History(config){this.config=config;};History.prototype.getBasePath=function getBasePath(){return this.config.basePath};History.prototype.getFile=function getFile(path,isRelative){if(path===void 0)path=this.getCurrentPath();var ref=this;var config=ref.config;var base=this.getBasePath();var ext=typeof config.ext==='string'?config.ext:'.md';path=config.alias?getAlias(path,config.alias):path;path=getFileName(path,ext);path=path===("/README"+ext)?config.homepage||path:path;path=isAbsolutePath(path)?path:getPath(base,path);if(isRelative){path=path.replace(new RegExp(("^"+base)),'');} +return path};History.prototype.onchange=function onchange(cb){if(cb===void 0)cb=noop;cb();};History.prototype.getCurrentPath=function getCurrentPath(){};History.prototype.normalize=function normalize(){};History.prototype.parse=function parse(){};History.prototype.toURL=function toURL(path,params,currentRoute){var local=currentRoute&&path[0]==='#';var route=this.parse(replaceSlug(path));route.query=merge({},route.query,params);path=route.path+stringifyQuery(route.query);path=path.replace(/\.md(\?)|\.md$/,'$1');if(local){var idIndex=currentRoute.indexOf('?');path=(idIndex>0?currentRoute.substring(0,idIndex):currentRoute)+path;} +if(this.config.relativePath&&path.indexOf('/')!==0){var currentDir=currentRoute.substring(0,currentRoute.lastIndexOf('/')+1);return cleanPath(resolvePath(currentDir+path))} +return cleanPath('/'+path)};function replaceHash(path){var i=location.href.indexOf('#');location.replace(location.href.slice(0,i>=0?i:0)+'#'+path);} +var HashHistory=(function(History$$1){function HashHistory(config){History$$1.call(this,config);this.mode='hash';} +if(History$$1)HashHistory.__proto__=History$$1;HashHistory.prototype=Object.create(History$$1&&History$$1.prototype);HashHistory.prototype.constructor=HashHistory;HashHistory.prototype.getBasePath=function getBasePath(){var path=window.location.pathname||'';var base=this.config.basePath;return/^(\/|https?:)/g.test(base)?base:cleanPath(path+'/'+base)};HashHistory.prototype.getCurrentPath=function getCurrentPath(){var href=location.href;var index=href.indexOf('#');return index===-1?'':href.slice(index+1)};HashHistory.prototype.onchange=function onchange(cb){if(cb===void 0)cb=noop;on('hashchange',cb);};HashHistory.prototype.normalize=function normalize(){var path=this.getCurrentPath();path=replaceSlug(path);if(path.charAt(0)==='/'){return replaceHash(path)} +replaceHash('/'+path);};HashHistory.prototype.parse=function parse(path){if(path===void 0)path=location.href;var query='';var hashIndex=path.indexOf('#');if(hashIndex>=0){path=path.slice(hashIndex+1);} +var queryIndex=path.indexOf('?');if(queryIndex>=0){query=path.slice(queryIndex+1);path=path.slice(0,queryIndex);} +return{path:path,file:this.getFile(path,true),query:parseQuery(query)}};HashHistory.prototype.toURL=function toURL(path,params,currentRoute){return'#'+History$$1.prototype.toURL.call(this,path,params,currentRoute)};return HashHistory;}(History));var HTML5History=(function(History$$1){function HTML5History(config){History$$1.call(this,config);this.mode='history';} +if(History$$1)HTML5History.__proto__=History$$1;HTML5History.prototype=Object.create(History$$1&&History$$1.prototype);HTML5History.prototype.constructor=HTML5History;HTML5History.prototype.getCurrentPath=function getCurrentPath(){var base=this.getBasePath();var path=window.location.pathname;if(base&&path.indexOf(base)===0){path=path.slice(base.length);} +return(path||'/')+window.location.search+window.location.hash};HTML5History.prototype.onchange=function onchange(cb){if(cb===void 0)cb=noop;on('click',function(e){var el=e.target.tagName==='A'?e.target:e.target.parentNode;if(el.tagName==='A'&&!/_blank/.test(el.target)){e.preventDefault();var url=el.href;window.history.pushState({key:url},'',url);cb();}});on('popstate',cb);};HTML5History.prototype.parse=function parse(path){if(path===void 0)path=location.href;var query='';var queryIndex=path.indexOf('?');if(queryIndex>=0){query=path.slice(queryIndex+1);path=path.slice(0,queryIndex);} +var base=getPath(location.origin);var baseIndex=path.indexOf(base);if(baseIndex>-1){path=path.slice(baseIndex+base.length);} +return{path:path,file:this.getFile(path),query:parseQuery(query)}};return HTML5History;}(History));function routerMixin(proto){proto.route={};} +var lastRoute={};function updateRender(vm){vm.router.normalize();vm.route=vm.router.parse();body.setAttribute('data-page',vm.route.file);} +function initRouter(vm){var config=vm.config;var mode=config.routerMode||'hash';var router;if(mode==='history'&&supportsPushState){router=new HTML5History(config);}else{router=new HashHistory(config);} +vm.router=router;updateRender(vm);lastRoute=vm.route;router.onchange(function(_){updateRender(vm);vm._updateRender();if(lastRoute.path===vm.route.path){vm.$resetEvents();return} +vm.$fetch();lastRoute=vm.route;});} +function eventMixin(proto){proto.$resetEvents=function(){scrollIntoView(this.route.path,this.route.query.id);if(this.config.loadNavbar){getAndActive(this.router,'nav');}};} +function initEvent(vm){btn('button.sidebar-toggle',vm.router);collapse('.sidebar',vm.router);if(vm.config.coverpage){!isMobile&&on('scroll',sticky);}else{body.classList.add('sticky');}} +function loadNested(path,qs,file,next,vm,first){path=first?path:path.replace(/\/$/,'');path=getParentPath(path);if(!path){return} +get(vm.router.getFile(path+file)+qs,false,vm.config.requestHeaders).then(next,function(_){return loadNested(path,qs,file,next,vm);});} +function fetchMixin(proto){var last;var abort=function(){return last&&last.abort&&last.abort();};var request=function(url,hasbar,requestHeaders){abort();last=get(url,true,requestHeaders);return last};var get404Path=function(path,config){var notFoundPage=config.notFoundPage;var ext=config.ext;var defaultPath='_404'+(ext||'.md');var key;var path404;switch(typeof notFoundPage){case'boolean':path404=defaultPath;break +case'string':path404=notFoundPage;break +case'object':key=Object.keys(notFoundPage).sort(function(a,b){return b.length-a.length;}).find(function(key){return path.match(new RegExp('^'+key));});path404=(key&¬FoundPage[key])||defaultPath;break +default:break} +return path404};proto._loadSideAndNav=function(path,qs,loadSidebar,cb){var this$1=this;return function(){if(!loadSidebar){return cb()} +var fn=function(result){this$1._renderSidebar(result);cb();};loadNested(path,qs,loadSidebar,fn,this$1,true);}};proto._fetch=function(cb){var this$1=this;if(cb===void 0)cb=noop;var ref=this.route;var path=ref.path;var query=ref.query;var qs=stringifyQuery(query,['id']);var ref$1=this.config;var loadNavbar=ref$1.loadNavbar;var requestHeaders=ref$1.requestHeaders;var loadSidebar=ref$1.loadSidebar;var file=this.router.getFile(path);var req=request(file+qs,true,requestHeaders);this.isHTML=/\.html$/g.test(file);req.then(function(text,opt){return this$1._renderMain(text,opt,this$1._loadSideAndNav(path,qs,loadSidebar,cb));},function(_){this$1._fetchFallbackPage(file,qs,cb)||this$1._fetch404(file,qs,cb);});loadNavbar&&loadNested(path,qs,loadNavbar,function(text){return this$1._renderNav(text);},this,true);};proto._fetchCover=function(){var this$1=this;var ref=this.config;var coverpage=ref.coverpage;var requestHeaders=ref.requestHeaders;var query=this.route.query;var root=getParentPath(this.route.path);if(coverpage){var path=null;var routePath=this.route.path;if(typeof coverpage==='string'){if(routePath==='/'){path=coverpage;}}else if(Array.isArray(coverpage)){path=coverpage.indexOf(routePath)>-1&&'_coverpage';}else{var cover=coverpage[routePath];path=cover===true?'_coverpage':cover;} +var coverOnly=Boolean(path)&&this.config.onlyCover;if(path){path=this.router.getFile(root+path);this.coverIsHTML=/\.html$/g.test(path);get(path+stringifyQuery(query,['id']),false,requestHeaders).then(function(text){return this$1._renderCover(text,coverOnly);});}else{this._renderCover(null,coverOnly);} +return coverOnly}};proto.$fetch=function(cb){var this$1=this;if(cb===void 0)cb=noop;var done=function(){callHook(this$1,'doneEach');cb();};var onlyCover=this._fetchCover();if(onlyCover){done();}else{this._fetch(function(){this$1.$resetEvents();done();});}};proto._fetchFallbackPage=function(path,qs,cb){var this$1=this;if(cb===void 0)cb=noop;var ref=this.config;var requestHeaders=ref.requestHeaders;var fallbackLanguages=ref.fallbackLanguages;var loadSidebar=ref.loadSidebar;if(!fallbackLanguages){return false} +var local=path.split('/')[1];if(fallbackLanguages.indexOf(local)===-1){return false} +var newPath=path.replace(new RegExp(("^/"+local)),'');var req=request(newPath+qs,true,requestHeaders);req.then(function(text,opt){return this$1._renderMain(text,opt,this$1._loadSideAndNav(path,qs,loadSidebar,cb));},function(){return this$1._fetch404(path,qs,cb);});return true};proto._fetch404=function(path,qs,cb){var this$1=this;if(cb===void 0)cb=noop;var ref=this.config;var loadSidebar=ref.loadSidebar;var requestHeaders=ref.requestHeaders;var notFoundPage=ref.notFoundPage;var fnLoadSideAndNav=this._loadSideAndNav(path,qs,loadSidebar,cb);if(notFoundPage){var path404=get404Path(path,this.config);request(this.router.getFile(path404),true,requestHeaders).then(function(text,opt){return this$1._renderMain(text,opt,fnLoadSideAndNav);},function(){return this$1._renderMain(null,{},fnLoadSideAndNav);});return true} +this._renderMain(null,{},fnLoadSideAndNav);return false};} +function initFetch(vm){var ref=vm.config;var loadSidebar=ref.loadSidebar;if(vm.rendered){var activeEl=getAndActive(vm.router,'.sidebar-nav',true,true);if(loadSidebar&&activeEl){activeEl.parentNode.innerHTML+=window.__SUB_SIDEBAR__;} +vm._bindEventOnRendered(activeEl);vm.$resetEvents();callHook(vm,'doneEach');callHook(vm,'ready');}else{vm.$fetch(function(_){return callHook(vm,'ready');});}} +function initMixin(proto){proto._init=function(){var vm=this;vm.config=config();initLifecycle(vm);initPlugin(vm);callHook(vm,'init');initRouter(vm);initRender(vm);initEvent(vm);initFetch(vm);callHook(vm,'mounted');};} +function initPlugin(vm){[].concat(vm.config.plugins).forEach(function(fn){return isFn(fn)&&fn(vm._lifecycle,vm);});} +var util=Object.freeze({cached:cached,hyphenate:hyphenate,hasOwn:hasOwn,merge:merge,isPrimitive:isPrimitive,noop:noop,isFn:isFn,inBrowser:inBrowser,isMobile:isMobile,supportsPushState:supportsPushState,parseQuery:parseQuery,stringifyQuery:stringifyQuery,isAbsolutePath:isAbsolutePath,getParentPath:getParentPath,cleanPath:cleanPath,resolvePath:resolvePath,getPath:getPath,replaceSlug:replaceSlug});function initGlobalAPI(){window.Docsify={util:util,dom:dom,get:get,slugify:slugify,version:'4.9.4'};window.DocsifyCompiler=Compiler;window.marked=marked;window.Prism=prism;} +function ready(callback){var state=document.readyState;if(state==='complete'||state==='interactive'){return setTimeout(callback,0)} +document.addEventListener('DOMContentLoaded',callback);} +function Docsify(){this._init();} +var proto=Docsify.prototype;initMixin(proto);routerMixin(proto);renderMixin(proto);fetchMixin(proto);eventMixin(proto);initGlobalAPI();ready(function(_){return new Docsify();});}()); \ No newline at end of file diff --git a/docs/en/core/atom_lite.md b/docs/en/core/atom_lite.md index a683402c..85abc334 100644 --- a/docs/en/core/atom_lite.md +++ b/docs/en/core/atom_lite.md @@ -1,6 +1,6 @@ # ATOM Lite{docsify-ignore-all} - + ## Description diff --git a/docs/en/core/atom_matrix.md b/docs/en/core/atom_matrix.md index ed3a04f1..65688036 100644 --- a/docs/en/core/atom_matrix.md +++ b/docs/en/core/atom_matrix.md @@ -1,6 +1,6 @@ # ATOM Matrix {docsify-ignore-all} - + ## Description @@ -12,9 +12,6 @@ - - - ## Product Features - USB Type-C diff --git a/docs/en/hat/hat-8servos.md b/docs/en/hat/hat-8servos.md index bde0251a..d469d3b4 100644 --- a/docs/en/hat/hat-8servos.md +++ b/docs/en/hat/hat-8servos.md @@ -53,7 +53,7 @@
    - +

    Description:

    This test program will test whether the drive servo function of each port of the 8Servos HAT module is normal.

    diff --git a/docs/index.html b/docs/index.html index 431ee559..76a37575 100755 --- a/docs/index.html +++ b/docs/index.html @@ -1,473 +1,69 @@ - - +M5Stack - A series of modular stackable development devices - - - - - - - - - - -
    - -
    -
    - M5Stack Docs
    - -
    - -
    loading...
    - - - - - - - - - - - - - - - + window.addEventListener('hashchange', function(event) { + var loadingMask = document.getElementById('loading'); + let url = window.location.href.split('#')[1]; + if (url.length < 2 || url == '/zh_CN/' || url == '/en/') { - \ No newline at end of file + }else if(url.indexOf("?id=") < 0 ){ + loadingMask.style.display = 'block'; + } + }) +
    loading...
    \ No newline at end of file diff --git a/docs/index_source.html b/docs/index_source.html index 8daed37d..c751b17d 100644 --- a/docs/index_source.html +++ b/docs/index_source.html @@ -47,6 +47,9 @@ + + + @@ -93,6 +96,7 @@ +
    loading...
    @@ -360,7 +364,7 @@ var Label2 = 'here is the anchor_name'; function anchor_create(anchor_name,anchor_id){ var Part_A = Label1.replace(/here is the anchor_id/, anchor_id); - var Part_B = Label2.replace(/here is the anchor_name/, anchor_name); + var Part_B = Label2.replace(/here is the anchor_name/, anchor_name.toUpperCase()); if((anchor_name == "DESCRIPTION")||(anchor_name == "描述")){ $(".anchor-box").append(Part_A+description_icon+Part_B); } @@ -373,11 +377,21 @@ else if((anchor_name == "VIDEO")||(anchor_name == "相关视频")){ $(".anchor-box").append(Part_A+video_icon+Part_B); } - else if((anchor_name == "QUICK START")||(anchor_name == "快速上手")){ - $(".anchor-box").append(Part_A+quickstart_icon+Part_B); - } else if(icon_list.hasOwnProperty(anchor_name)){ $(".anchor-box").append(Part_A+""+Part_B); + if (anchor_name == "EASYLOADER"){ + if(("#example_video").length >0) + $("#play-btn").on("click",function(ev){ + ev.stopPropagation(); + $(".easyloader-mask").toggleClass('video_play'); + $("#example_video")[0].play(); + }) + $("#example_video").on("click",function(ev){ + ev.preventDefault(); + $(".easyloader-mask").toggleClass('video_play'); + $("#example_video")[0].pause(); + }) + } } } function anchor_search(purchase_link="none",quickstart_link="none"){ @@ -399,8 +413,8 @@ var quickstart_name = "快速上手" } else { - var purchase_name = "Purchase" - var quickstart_name = "Quick Start" + var purchase_name = "PURCHASE" + var quickstart_name = "QUICK START" } } if(purchase_link!="none"){ @@ -457,4 +471,54 @@ window.onscroll = scrollFunc; + + + \ No newline at end of file diff --git a/docs/zh_CN/core/atom_lite.md b/docs/zh_CN/core/atom_lite.md index e1aea023..e997311c 100644 --- a/docs/zh_CN/core/atom_lite.md +++ b/docs/zh_CN/core/atom_lite.md @@ -58,7 +58,7 @@
    - +

    案例描述:

    通过变色呼吸灯程序,测试RGB LED与按键是否工作正常.

    diff --git a/docs/zh_CN/core/atom_matrix.md b/docs/zh_CN/core/atom_matrix.md index 6475a5a5..6ca0eaf9 100644 --- a/docs/zh_CN/core/atom_matrix.md +++ b/docs/zh_CN/core/atom_matrix.md @@ -61,7 +61,7 @@
    - +

    案例描述:

    通过矩阵屏幕文字滚屏显示与按键计数功能,测试RGB LED与按键是否工作正常.

    diff --git a/docs/zh_CN/core/basic.md b/docs/zh_CN/core/basic.md index 7c95ea18..4afb1bd9 100644 --- a/docs/zh_CN/core/basic.md +++ b/docs/zh_CN/core/basic.md @@ -59,16 +59,29 @@ M5Stack Basic 由两个可分离部分堆叠组成. 顶部放置了电路板, ## EasyLoader - - - - ->1.EasyLoader是一个简洁快速的程序烧录器,每一个产品页面里的EasyLoader都提供了一个与产品相关的案例程序.**(目前EasyLoader仅适用于Windows操作系统)** - ->2.下载软件后,双击运行应用程序,将M5设备通过数据线连接至电脑,选择端口参数,点击 **"Burn"** 即可开始烧录 - -!>3.EasyLoader烧录前需要安装有CP210X(USB驱动程序),[点击此处查看驱动安装教程](zh_CN/related_documents/M5Burner#安装串口驱动) +>EasyLoader是一个简洁快速的程序烧录器,每一个产品页面里的EasyLoader都提供了一个与产品相关的案例程序,通过简单步骤将其烧录至主控,能够进行一系列的功能验证.**(目前EasyLoader仅适用于Windows操作系统)** +
    +
    +
    +
    + Windows + +
    +
    +
    + +
    + + +

    案例描述:

    +

    该案例将执行喇叭,wifi,按键,加速计,SD卡,屏幕等硬件运行测试.

    +
    +
    +
    ## 外设的管脚映射 diff --git a/docs/zh_CN/core/face_kit.md b/docs/zh_CN/core/face_kit.md index 6713a6d5..309e5237 100644 --- a/docs/zh_CN/core/face_kit.md +++ b/docs/zh_CN/core/face_kit.md @@ -79,18 +79,31 @@ - ## EasyLoader - +>EasyLoader是一个简洁快速的程序烧录器,每一个产品页面里的EasyLoader都提供了一个与产品相关的案例程序,通过简单步骤将其烧录至主控,能够进行一系列的功能验证.**(烧录前请安装CP210X驱动程序)** - - ->1.EasyLoader是一个简洁快速的程序烧录器,每一个产品页面里的EasyLoader都提供了一个与产品相关的案例程序.**(目前EasyLoader仅适用于Windows操作系统)** - ->2.下载软件后,双击运行应用程序,将M5设备通过数据线连接至电脑,选择端口参数,点击 **"Burn"** 即可开始烧录 - -!>3.EasyLoader烧录前需要安装有CP210X(USB驱动程序),[点击此处查看驱动安装教程](zh_CN/related_documents/M5Burner#安装串口驱动),在为Faces烧录固件前,请点击"Erase"进行一次内存擦除. +
    +
    +
    +
    + Windows + +
    +
    +
    + +
    + + +

    案例描述:

    +

    该案例将默认运行FACES键盘输入测试程序,重启选择程序列表可以切换不同的面板测试项.

    +
    +
    +
    ### 相关链接 diff --git a/docs/zh_CN/core/m5stickt.md b/docs/zh_CN/core/m5stickt.md index 695e1b86..a2f08f85 100644 --- a/docs/zh_CN/core/m5stickt.md +++ b/docs/zh_CN/core/m5stickt.md @@ -1,8 +1,6 @@ # M5StickT {docsify-ignore-all} - - - + @@ -104,7 +102,7 @@ M5StickT仅支持WIN10&Linux&MAC(10.15以下)免驱,其余操作系统则需
    - +

    案例描述:

    热成像操作说明:A键切换跟踪模式,B键切换显示模式,拨轮调整灵敏度.