From 8ad835ca26d4d0b2da1d2d18f7981f91747cff13 Mon Sep 17 00:00:00 2001
From: "qingwei.li"
Date: Tue, 28 Feb 2017 20:56:11 +0800
Subject: [PATCH 1/9] feat(render) nameLink for each route, fixed #99
---
src/core/render/compiler.js | 1 -
src/core/render/index.js | 19 +++++++++++++++++++
src/core/render/tpl.js | 2 +-
src/core/route/index.js | 1 +
4 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/src/core/render/compiler.js b/src/core/render/compiler.js
index 785f70c35..fbc3f083c 100644
--- a/src/core/render/compiler.js
+++ b/src/core/render/compiler.js
@@ -34,7 +34,6 @@ markdown.renderer = renderer
markdown.init = function (config = {}, base = window.location.pathname) {
contentBase = getBasePath(base)
- currentPath = parse().path
if (isFn(config)) {
markdownCompiler = config(marked, renderer)
diff --git a/src/core/render/index.js b/src/core/render/index.js
index 4144adad9..d6b689336 100644
--- a/src/core/render/index.js
+++ b/src/core/render/index.js
@@ -6,6 +6,7 @@ import * as tpl from './tpl'
import { markdown, sidebar, subSidebar, cover } from './compiler'
import { callHook } from '../init/lifecycle'
import { getBasePath, getPath, isAbsolutePath } from '../route/util'
+import { isPrimitive } from '../util/core'
function executeScript () {
const script = dom.findAll('.markdown-section>script')
@@ -47,6 +48,22 @@ function renderMain (html) {
}
}
+function renderNameLink (vm) {
+ const el = dom.getNode('.app-name-link')
+ const nameLink = vm.config.nameLink
+ const path = vm.route.path
+
+ if (!el) return
+
+ if (isPrimitive(vm.config.nameLink)) {
+ el.setAttribute('href', nameLink)
+ } else if (typeof nameLink === 'object') {
+ const match = Object.keys(nameLink).find(key => path.indexOf(key) > -1)
+
+ el.setAttribute('href', nameLink[match])
+ }
+}
+
export function renderMixin (proto) {
proto._renderTo = function (el, content, replace) {
const node = dom.getNode(el)
@@ -120,6 +137,8 @@ export function renderMixin (proto) {
proto._updateRender = function () {
markdown.update()
+ // render name link
+ renderNameLink(this)
}
}
diff --git a/src/core/render/tpl.js b/src/core/render/tpl.js
index 6f7915945..e2f1ec759 100644
--- a/src/core/render/tpl.js
+++ b/src/core/render/tpl.js
@@ -31,7 +31,7 @@ export function main (config) {
'' +
'')
diff --git a/src/core/route/index.js b/src/core/route/index.js
index 7c4061ea2..09a14f929 100644
--- a/src/core/route/index.js
+++ b/src/core/route/index.js
@@ -34,6 +34,7 @@ let lastRoute = {}
export function initRoute (vm) {
normalize()
lastRoute = vm.route = parse()
+ vm._updateRender()
on('hashchange', _ => {
normalize()
From 07a2a91296291810a3e4ab30478284dfffcc4566 Mon Sep 17 00:00:00 2001
From: "qingwei.li"
Date: Tue, 28 Feb 2017 20:57:32 +0800
Subject: [PATCH 2/9] docs(configuration): nameLink
---
docs/configuration.md | 8 +++++++-
docs/zh-cn/configuration.md | 8 +++++++-
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/docs/configuration.md b/docs/configuration.md
index 26e3f0df8..5c997af2f 100644
--- a/docs/configuration.md
+++ b/docs/configuration.md
@@ -206,7 +206,13 @@ The name of the link.
```js
window.$docsify = {
- nameLink: '/'
+ nameLink: '/',
+
+ // For each route
+ nameLink: {
+ '/zh-cn/': '/zh-cn/',
+ '/': '/'
+ }
}
```
diff --git a/docs/zh-cn/configuration.md b/docs/zh-cn/configuration.md
index 28c0af9b3..a474f7d38 100644
--- a/docs/zh-cn/configuration.md
+++ b/docs/zh-cn/configuration.md
@@ -206,7 +206,13 @@ window.$docsify = {
```js
window.$docsify = {
- nameLink: '/'
+ nameLink: '/',
+
+ // 按照路由切换
+ nameLink: {
+ '/zh-cn/': '/zh-cn/',
+ '/': '/'
+ }
}
```
From f3fc5969512941416fb5082654f146153943715b Mon Sep 17 00:00:00 2001
From: "qingwei.li"
Date: Tue, 28 Feb 2017 21:16:10 +0800
Subject: [PATCH 3/9] fix(fetch): load sidebar and navbar for parent path,
fixed #100
---
src/core/fetch/index.js | 26 ++++++++++++++------------
src/core/route/util.js | 8 ++++++--
2 files changed, 20 insertions(+), 14 deletions(-)
diff --git a/src/core/fetch/index.js b/src/core/fetch/index.js
index 61577ac28..0f2380af2 100644
--- a/src/core/fetch/index.js
+++ b/src/core/fetch/index.js
@@ -1,14 +1,23 @@
import { get } from './ajax'
import { callHook } from '../init/lifecycle'
-import { getRoot } from '../route/util'
+import { getParentPath } from '../route/util'
import { noop } from '../util/core'
+function loadNested (path, file, next, vm, first) {
+ path = first ? path : path.replace(/\/$/, '')
+ path = getParentPath(path)
+
+ if (!path) return
+
+ get(vm.$getFile(path + file))
+ .then(next, _ => loadNested(path, file, next, vm))
+}
+
export function fetchMixin (proto) {
let last
proto._fetch = function (cb = noop) {
const { path } = this.route
const { loadNavbar, loadSidebar } = this.config
- const root = getRoot(path)
// Abort last request
last && last.abort && last.abort()
@@ -26,25 +35,18 @@ export function fetchMixin (proto) {
const fn = result => { this._renderSidebar(result); cb() }
// Load sidebar
- get(this.$getFile(root + loadSidebar))
- // fallback root navbar when fail
- .then(fn, _ => get(loadSidebar).then(fn))
+ loadNested(path, loadSidebar, fn, this, true)
},
_ => this._renderMain(null))
// Load nav
loadNavbar &&
- get(this.$getFile(root + loadNavbar))
- .then(
- text => this._renderNav(text),
- // fallback root navbar when fail
- _ => get(loadNavbar).then(text => this._renderNav(text))
- )
+ loadNested(path, loadNavbar, text => this._renderNav(text), this, true)
}
proto._fetchCover = function () {
const { coverpage } = this.config
- const root = getRoot(this.route.path)
+ const root = getParentPath(this.route.path)
const path = this.$getFile(root + coverpage)
if (this.route.path !== '/' || !coverpage) {
diff --git a/src/core/route/util.js b/src/core/route/util.js
index 3f742c86b..cfdd2a9ee 100644
--- a/src/core/route/util.js
+++ b/src/core/route/util.js
@@ -45,8 +45,12 @@ export const isAbsolutePath = cached(path => {
return /(:|(\/{2}))/.test(path)
})
-export const getRoot = cached(path => {
- return /\/$/g.test(path) ? path : path.match(/(\S*\/)[^\/]+$/)[1]
+export const getParentPath = cached(path => {
+ return /\/$/g.test(path)
+ ? path
+ : (path = path.match(/(\S*\/)[^\/]+$/))
+ ? path[1]
+ : ''
})
export const cleanPath = cached(path => {
From d3c9fbd124b4cec16293e93a6c2f000d767e163a Mon Sep 17 00:00:00 2001
From: "qingwei.li"
Date: Tue, 28 Feb 2017 21:27:07 +0800
Subject: [PATCH 4/9] feat(search): Localization for no data tip, close #103
---
docs/plugins.md | 8 ++++++++
docs/zh-cn/plugins.md | 8 ++++++++
src/plugins/search/component.js | 13 ++++++++++++-
src/plugins/search/index.js | 2 ++
4 files changed, 30 insertions(+), 1 deletion(-)
diff --git a/docs/plugins.md b/docs/plugins.md
index 29f434874..3142694cd 100644
--- a/docs/plugins.md
+++ b/docs/plugins.md
@@ -27,6 +27,14 @@ By default, the hyperlink on the current page is recognized and the content is s
placeholder: {
'/zh-cn/': '搜索',
'/': 'Type to search'
+ },
+
+ noData: 'No Results!',
+
+ // Localization
+ noData: {
+ '/zh-cn/': '找不到结果',
+ '/': 'No Results'
}
}
}
diff --git a/docs/zh-cn/plugins.md b/docs/zh-cn/plugins.md
index aa29eab90..5fa1530a4 100644
--- a/docs/zh-cn/plugins.md
+++ b/docs/zh-cn/plugins.md
@@ -27,6 +27,14 @@
placeholder: {
'/zh-cn/': '搜索',
'/': 'Type to search'
+ },
+
+ noData: 'No Results!',
+
+ // 支持本地化
+ noData: {
+ '/zh-cn/': '找不到结果',
+ '/': 'No Results'
}
}
}
diff --git a/src/plugins/search/component.js b/src/plugins/search/component.js
index 524448c8e..219fc8dcd 100644
--- a/src/plugins/search/component.js
+++ b/src/plugins/search/component.js
@@ -1,6 +1,7 @@
import { search } from './search'
let dom
+let NO_DATA_TEXT = ''
function style () {
const code = `
@@ -98,7 +99,7 @@ function bindEvents () {
})
$panel.classList.add('show')
- $panel.innerHTML = html || 'No Results!
'
+ $panel.innerHTML = html || `${NO_DATA_TEXT}
`
}
let timeId
@@ -122,6 +123,15 @@ function updatePlaceholder (text, path) {
}
}
+function updateNoData (text, path) {
+ if (typeof text === 'string') {
+ NO_DATA_TEXT = text
+ } else {
+ const match = Object.keys(text).find(key => path.indexOf(key) > -1)
+ NO_DATA_TEXT = text[match]
+ }
+}
+
export function init (opts) {
dom = Docsify.dom
style()
@@ -131,5 +141,6 @@ export function init (opts) {
export function update (opts, vm) {
updatePlaceholder(opts.placeholder, vm.route.path)
+ updateNoData(opts.noData, vm.route.path)
}
diff --git a/src/plugins/search/index.js b/src/plugins/search/index.js
index e1962793f..6b9d3e167 100644
--- a/src/plugins/search/index.js
+++ b/src/plugins/search/index.js
@@ -3,6 +3,7 @@ import { init as initSearch } from './search'
const CONFIG = {
placeholder: 'Type to search',
+ noData: 'No Results!',
paths: 'auto',
maxAge: 86400000 // 1 day
}
@@ -17,6 +18,7 @@ const install = function (hook, vm) {
CONFIG.paths = Array.isArray(opts.paths) ? opts.paths : 'auto'
CONFIG.maxAge = util.isPrimitive(opts.maxAge) ? opts.maxAge : CONFIG.maxAge
CONFIG.placeholder = opts.placeholder || CONFIG.placeholder
+ CONFIG.noData = opts.noData || CONFIG.noData
}
const isAuto = CONFIG.paths === 'auto'
From 0aead898eb4f0ea7313fc114c832f2cbad4f019e Mon Sep 17 00:00:00 2001
From: "qingwei.li"
Date: Tue, 28 Feb 2017 21:28:25 +0800
Subject: [PATCH 5/9] docs: updates
---
docs/_sidebar.md | 2 +-
docs/zh-cn/_sidebar.md | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/docs/_sidebar.md b/docs/_sidebar.md
index e747a918d..cf254be95 100644
--- a/docs/_sidebar.md
+++ b/docs/_sidebar.md
@@ -17,6 +17,6 @@
- [Helpers](/helpers)
- [Vue compatibility](/vue)
- [CDN](/cdn)
- - [Offline Mode(PWA)new](/pwa)
+ - [Offline Mode(PWA)](/pwa)
- [Changelog](/changelog)
\ No newline at end of file
diff --git a/docs/zh-cn/_sidebar.md b/docs/zh-cn/_sidebar.md
index 47d970e50..d9376b4a1 100644
--- a/docs/zh-cn/_sidebar.md
+++ b/docs/zh-cn/_sidebar.md
@@ -17,6 +17,6 @@
- [文档助手](zh-cn/helpers)
- [兼容 Vue](zh-cn/vue)
- [CDN](zh-cn/cdn)
- - [离线模式(PWA)new](zh-cn/pwa)
+ - [离线模式(PWA)](zh-cn/pwa)
- [Changelog](zh-cn/changelog)
\ No newline at end of file
From 0d59ee939fac6b0a8980c0e24d2da5f654227052 Mon Sep 17 00:00:00 2001
From: "qingwei.li"
Date: Tue, 28 Feb 2017 22:00:53 +0800
Subject: [PATCH 6/9] fix(render): Toc rendering error, fixed #106
---
src/core/render/compiler.js | 3 ++-
src/core/render/index.js | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/core/render/compiler.js b/src/core/render/compiler.js
index fbc3f083c..78250f257 100644
--- a/src/core/render/compiler.js
+++ b/src/core/render/compiler.js
@@ -106,8 +106,9 @@ export function sidebar (text, level) {
html = markdown(text)
html = html.match(/]*>([\s\S]+)<\/ul>/g)[0]
} else {
- const tree = genTree(toc, level)
+ const tree = cacheTree[currentPath] || genTree(toc, level)
html = treeTpl(tree, '')
+ cacheTree[currentPath] = tree
}
return html
diff --git a/src/core/render/index.js b/src/core/render/index.js
index d6b689336..de7a6fa28 100644
--- a/src/core/render/index.js
+++ b/src/core/render/index.js
@@ -75,7 +75,7 @@ export function renderMixin (proto) {
this._renderTo('.sidebar-nav', sidebar(text, maxLevel))
const active = getAndActive('.sidebar-nav', true, true)
- loadSidebar && subSidebar(active, subMaxLevel)
+ subSidebar(loadSidebar ? active : '', subMaxLevel)
// bind event
this.activeLink = active
scrollActiveSidebar()
From b927a30cc603df5937fdc7e7f0c995ea61e153a3 Mon Sep 17 00:00:00 2001
From: "qingwei.li"
Date: Tue, 28 Feb 2017 22:02:20 +0800
Subject: [PATCH 7/9] docs(changelog): 3.2
---
CHANGELOG.md | 8 ++++++++
docs/_coverpage.md | 2 +-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f2778c019..52a907610 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,12 @@
+3.2.0 / 2017-02-28
+==================
+
+ * fix(render): Toc rendering error, fixed #106
+ * feat(search): Localization for no data tip, close #103
+ * fix(fetch): load sidebar and navbar for parent path, fixed #100
+ * feat(render) nameLink for each route, fixed #99
+
3.1.2 / 2017-02-27
==================
diff --git a/docs/_coverpage.md b/docs/_coverpage.md
index 292a9523b..0f74e8ffa 100644
--- a/docs/_coverpage.md
+++ b/docs/_coverpage.md
@@ -1,6 +1,6 @@

-# docsify 3.1
+# docsify 3.2
> A magical documentation site generator.
From 61e0aacb434b3f48dac22a43518aba3ead9c27d7 Mon Sep 17 00:00:00 2001
From: "qingwei.li"
Date: Tue, 28 Feb 2017 22:03:47 +0800
Subject: [PATCH 8/9] bump: 3.2
---
lib/docsify.js | 61 +++++++++++++++++++++++++++------------
lib/docsify.min.js | 4 +--
lib/plugins/search.js | 15 +++++++++-
lib/plugins/search.min.js | 2 +-
4 files changed, 60 insertions(+), 22 deletions(-)
diff --git a/lib/docsify.js b/lib/docsify.js
index 54d5f0666..776c9acc7 100644
--- a/lib/docsify.js
+++ b/lib/docsify.js
@@ -300,8 +300,12 @@ var isAbsolutePath = cached(function (path) {
return /(:|(\/{2}))/.test(path)
});
-var getRoot = cached(function (path) {
- return /\/$/g.test(path) ? path : path.match(/(\S*\/)[^\/]+$/)[1]
+var getParentPath = cached(function (path) {
+ return /\/$/g.test(path)
+ ? path
+ : (path = path.match(/(\S*\/)[^\/]+$/))
+ ? path[1]
+ : ''
});
var cleanPath = cached(function (path) {
@@ -393,7 +397,7 @@ var route = Object.freeze({
getBasePath: getBasePath,
getPath: getPath,
isAbsolutePath: isAbsolutePath,
- getRoot: getRoot,
+ getParentPath: getParentPath,
cleanPath: cleanPath
});
@@ -711,7 +715,7 @@ function main (config) {
'' +
'');
@@ -2966,7 +2970,6 @@ markdown.init = function (config, base) {
if ( base === void 0 ) base = window.location.pathname;
contentBase = getBasePath(base);
- currentPath = parse().path;
if (isFn(config)) {
markdownCompiler = config(marked, renderer);
@@ -3041,8 +3044,9 @@ function sidebar (text, level) {
html = markdown(text);
html = html.match(/]*>([\s\S]+)<\/ul>/g)[0];
} else {
- var tree$$1 = genTree(toc, level);
+ var tree$$1 = cacheTree[currentPath] || genTree(toc, level);
html = tree(tree$$1, '');
+ cacheTree[currentPath] = tree$$1;
}
return html
@@ -3121,6 +3125,22 @@ function renderMain (html) {
}
}
+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).find(function (key) { return path.indexOf(key) > -1; });
+
+ el.setAttribute('href', nameLink[match]);
+ }
+}
+
function renderMixin (proto) {
proto._renderTo = function (el, content, replace) {
var node = getNode(el);
@@ -3136,7 +3156,7 @@ function renderMixin (proto) {
this._renderTo('.sidebar-nav', sidebar(text, maxLevel));
var active = getAndActive('.sidebar-nav', true, true);
- loadSidebar && subSidebar(active, subMaxLevel);
+ subSidebar(loadSidebar ? active : '', subMaxLevel);
// bind event
this.activeLink = active;
scrollActiveSidebar();
@@ -3200,6 +3220,8 @@ function renderMixin (proto) {
proto._updateRender = function () {
markdown.update();
+ // render name link
+ renderNameLink(this);
};
}
@@ -3278,6 +3300,7 @@ var lastRoute = {};
function initRoute (vm) {
normalize();
lastRoute = vm.route = parse();
+ vm._updateRender();
on('hashchange', function (_) {
normalize();
@@ -3312,6 +3335,16 @@ function initEvent (vm) {
}
}
+function loadNested (path, file, next, vm, first) {
+ path = first ? path : path.replace(/\/$/, '');
+ path = getParentPath(path);
+
+ if (!path) { return }
+
+ get(vm.$getFile(path + file))
+ .then(next, function (_) { return loadNested(path, file, next, vm); });
+}
+
function fetchMixin (proto) {
var last;
proto._fetch = function (cb) {
@@ -3323,7 +3356,6 @@ function fetchMixin (proto) {
var ref$1 = this.config;
var loadNavbar = ref$1.loadNavbar;
var loadSidebar = ref$1.loadSidebar;
- var root = getRoot(path);
// Abort last request
last && last.abort && last.abort();
@@ -3341,20 +3373,13 @@ function fetchMixin (proto) {
var fn = function (result) { this$1._renderSidebar(result); cb(); };
// Load sidebar
- get(this$1.$getFile(root + loadSidebar))
- // fallback root navbar when fail
- .then(fn, function (_) { return get(loadSidebar).then(fn); });
+ loadNested(path, loadSidebar, fn, this$1, true);
},
function (_) { return this$1._renderMain(null); });
// Load nav
loadNavbar &&
- get(this.$getFile(root + loadNavbar))
- .then(
- function (text) { return this$1._renderNav(text); },
- // fallback root navbar when fail
- function (_) { return get(loadNavbar).then(function (text) { return this$1._renderNav(text); }); }
- );
+ loadNested(path, loadNavbar, function (text) { return this$1._renderNav(text); }, this, true);
};
proto._fetchCover = function () {
@@ -3362,7 +3387,7 @@ function fetchMixin (proto) {
var ref = this.config;
var coverpage = ref.coverpage;
- var root = getRoot(this.route.path);
+ var root = getParentPath(this.route.path);
var path = this.$getFile(root + coverpage);
if (this.route.path !== '/' || !coverpage) {
diff --git a/lib/docsify.min.js b/lib/docsify.min.js
index c7f1a66cc..1837ca313 100644
--- a/lib/docsify.min.js
+++ b/lib/docsify.min.js
@@ -1,2 +1,2 @@
-!function(){"use strict";function e(e){var t=Object.create(null);return function(n){var r=t[n];return r||(t[n]=e(n))}}function t(e){return"string"==typeof e||"number"==typeof e}function n(){}function r(e){return"function"==typeof e}function i(e){var t=["init","mounted","beforeEach","afterEach","doneEach","ready"];e._hooks={},e._lifecycle={},t.forEach(function(t){var n=e._hooks[t]=[];e._lifecycle[t]=function(e){return n.push(e)}})}function a(e,t,r,i){void 0===i&&(i=n);var a=r,o=e._hooks[t],s=function(e){var t=o[e];if(e>=o.length)i(a);else if("function"==typeof t)if(2===t.length)t(r,function(t){a=t,s(e+1)});else{var n=t(r);a=void 0!==n?n:a,s(e+1)}else s(e+1)};s(0)}function o(e,t){return void 0===t&&(t=!1),"string"==typeof e&&(e=t?s(e):me[e]||s(e)),e}function s(e,t){return t?e.querySelector(t):ve.querySelector(e)}function l(e,t){return[].slice.call(t?e.querySelectorAll(t):ve.querySelectorAll(e))}function u(e,t){return e=ve.createElement(e),t&&(e.innerHTML=t),e}function c(e,t){return e.appendChild(t)}function p(e,t){return e.insertBefore(t,e.children[0])}function h(e,t,n){r(t)?window.addEventListener(e,t):e.addEventListener(t,n)}function d(e,t,n){r(t)?window.removeEventListener(e,t):e.removeEventListener(t,n)}function g(e,t,n){e&&e.classList[n?t:"toggle"](n||t)}function f(e){var t={};return(e=e.trim().replace(/^(\?|#|&)/,""))?(e.split("&").forEach(function(e){var n=e.replace(/\+/g," ").split("=");t[n[0]]=Le(n[1])}),t):t}function m(e){var t=[];for(var n in e)t.push((Se(n)+"="+Se(e[n])).toLowerCase());return t.length?"?"+t.join("&"):""}function v(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return Te(e.join("/"))}function b(e){var t=window.location.href.indexOf("#");window.location.replace(window.location.href.slice(0,t>=0?t:0)+"#"+e)}function y(){var e=k();return e=Ae(e),"/"===e.charAt(0)?b(e):void b("/"+e)}function k(){var e=window.location.href,t=e.indexOf("#");return t===-1?"":e.slice(t+1)}function w(e){void 0===e&&(e=window.location.href);var t="",n=e.indexOf("?");n>=0&&(t=e.slice(n+1),e=e.slice(0,n));var r=e.indexOf("#");return r&&(e=e.slice(r+1)),{path:e,query:f(t)}}function x(e,t){var n=w(Ae(e));return n.query=ue({},n.query,t),e=n.path+m(n.query),Te("#/"+e)}function _(e){var t=function(){return be.classList.toggle("close")};e=o(e),h(e,"click",t);var n=o(".sidebar");h(n,"click",function(){_e&&t(),setTimeout(function(){return S(n,!0,!0)},0)})}function L(){var e=o("section.cover");if(e){var t=e.getBoundingClientRect().height;window.pageYOffset>=t||e.classList.contains("hidden")?g(be,"add","sticky"):g(be,"remove","sticky")}}function S(e,t,n){e=o(e);var r,i=l(e,"a"),a="#"+k();return i.sort(function(e,t){return t.href.length-e.href.length}).forEach(function(e){var n=e.getAttribute("href"),i=t?e.parentNode:e;0!==a.indexOf(n)||r?g(i,"remove","active"):(r=e,g(i,"add","active"))}),n&&(ve.title=r?r.innerText+" - "+Me:Me),r}function C(){for(var e,t=o(".sidebar"),n=l(".anchor"),r=s(t,".sidebar-nav"),i=s(t,"li.active"),a=be.scrollTop,u=0,c=n.length;ua){e||(e=p);break}e=p}if(e){var h=Oe[e.getAttribute("data-id")];if(h&&h!==i&&(i&&i.classList.remove("active"),h.classList.add("active"),i=h,!qe&&be.classList.contains("sticky"))){var d=t.clientHeight,g=0,f=i.offsetTop+i.clientHeight+40,m=i.offsetTop>=r.scrollTop&&f<=r.scrollTop+d,v=f-g=400?a(n):(Fe[e]=n.response,r(n.response))})},abort:function(e){return 4!==r.readyState&&r.abort()}})}function M(e,t){e.innerHTML=e.innerHTML.replace(/var\(\s*--theme-color.*?\)/g,t)}function O(e){return e?(/\/\//.test(e)||(e="https://github.com/"+e),e=e.replace(/^git\+/,""),''):""}function q(e){var t='';return(_e?t+"":""+t)+''}function P(){var e=", 100%, 85%",t="linear-gradient(to left bottom, hsl("+(Math.floor(255*Math.random())+e)+") 0%,hsl("+(Math.floor(255*Math.random())+e)+") 100%)";return''}function N(e,t){return void 0===t&&(t=""),e&&e.length?(e.forEach(function(e){t+='- '+e.title+"
",e.children&&(t+='
")}),t):""}function F(e,t){return''+t.slice(5).trim()+"
"}function I(e){return""}function z(e,t){return t={exports:{}},e(t,t.exports),t.exports}function H(e,t){var n=[],r={};return e.forEach(function(e){var i=e.level||1,a=i-1;i>t||(r[a]?r[a].children=(r[a].children||[]).concat(e):n.push(e),r[i]=e)}),n}function R(e){if("string"!=typeof e)return"";var t=e.toLowerCase().trim().replace(/<[^>\d]+>/g,"").replace(Be,"").replace(/\s/g,"-").replace(/-+/g,"-").replace(/^(\d)/,"_$1"),n=We[t];return n=We.hasOwnProperty(t)?n+1:0,We[t]=n,n&&(t=t+"-"+n),t}function W(e,t){return'
'}function B(e){return e.replace(/<(pre|template|code)[^>]*?>[\s\S]+?<\/(pre|template|code)>/g,function(e){return e.replace(/:/g,"__colon__")}).replace(/:(\w+?):/gi,window.emojify||W).replace(/__colon__/g,":")}function D(e,t){var n="";if(e)n=Ye(e),n=n.match(/]*>([\s\S]+)<\/ul>/g)[0];else{var r=H(Ve,t);n=N(r,"")}return n}function U(e,t){if(e){Ve[0]&&1===Ve[0].level&&Ve.shift();var n=Ze[Ge]||H(Ve,t);e.parentNode.innerHTML+=N(n,'
"+a(e.message+"",!0)+"
";throw e}}var p={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:l,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:l,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,blockquote:/^( *>[^\n]+(\n(?!def)[^\n]+)*\n*)+/,list:/^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment *(?:\n|\s*$)|closed *(?:\n{2,}|\s*$)|closing *(?:\n{2,}|\s*$))/,def:/^ *\[([^\]]+)\]: *([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,table:l,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/};p.bullet=/(?:[*+-]|\d+\.)/,p.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/,p.item=s(p.item,"gm")(/bull/g,p.bullet)(),p.list=s(p.list)(/bull/g,p.bullet)("hr","\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))")("def","\\n+(?="+p.def.source+")")(),p.blockquote=s(p.blockquote)("def",p.def)(),p._tag="(?!(?: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",p.html=s(p.html)("comment",//)("closed",/<(tag)[\s\S]+?<\/\1>/)("closing",/])*?>/)(/tag/g,p._tag)(),p.paragraph=s(p.paragraph)("hr",p.hr)("heading",p.heading)("lheading",p.lheading)("blockquote",p.blockquote)("tag","<"+p._tag)("def",p.def)(),p.normal=u({},p),p.gfm=u({},p.normal,{fences:/^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\s*\1 *(?:\n+|$)/,paragraph:/^/,heading:/^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/}),p.gfm.paragraph=s(p.paragraph)("(?!","(?!"+p.gfm.fences.source.replace("\\1","\\2")+"|"+p.list.source.replace("\\1","\\3")+"|")(),p.tables=u({},p.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/}),t.rules=p,t.lex=function(e,n){var r=new t(n);return r.lex(e)},t.prototype.lex=function(e){return e=e.replace(/\r\n|\r/g,"\n").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n"),this.token(e,!0)},t.prototype.token=function(e,t,n){for(var r,i,a,o,s,l,u,c,h,d=this,e=e.replace(/^ +$/gm,"");e;)if((a=d.rules.newline.exec(e))&&(e=e.substring(a[0].length),a[0].length>1&&d.tokens.push({type:"space"})),a=d.rules.code.exec(e))e=e.substring(a[0].length),a=a[0].replace(/^ {4}/gm,""),d.tokens.push({type:"code",text:d.options.pedantic?a:a.replace(/\n+$/,"")});else if(a=d.rules.fences.exec(e))e=e.substring(a[0].length),d.tokens.push({type:"code",lang:a[2],text:a[3]||""});else if(a=d.rules.heading.exec(e))e=e.substring(a[0].length),d.tokens.push({type:"heading",depth:a[1].length,text:a[2]});else if(t&&(a=d.rules.nptable.exec(e))){for(e=e.substring(a[0].length),l={type:"table",header:a[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:a[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:a[3].replace(/\n$/,"").split("\n")},c=0;c ?/gm,""),d.token(a,t,!0),d.tokens.push({type:"blockquote_end"});else if(a=d.rules.list.exec(e)){for(e=e.substring(a[0].length),o=a[2],d.tokens.push({type:"list_start",ordered:o.length>1}),a=a[0].match(d.rules.item),r=!1,h=a.length,c=0;c1&&s.length>1||(e=a.slice(c+1).join("\n")+e,c=h-1)),i=r||/\n\n(?!\s*$)/.test(l),c!==h-1&&(r="\n"===l.charAt(l.length-1),i||(i=r)),d.tokens.push({type:i?"loose_item_start":"list_item_start"}),d.token(l,!1,n),d.tokens.push({type:"list_item_end"});d.tokens.push({type:"list_end"})}else if(a=d.rules.html.exec(e))e=e.substring(a[0].length),d.tokens.push({type:d.options.sanitize?"paragraph":"html",pre:!d.options.sanitizer&&("pre"===a[1]||"script"===a[1]||"style"===a[1]),text:a[0]});else if(!n&&t&&(a=d.rules.def.exec(e)))e=e.substring(a[0].length),d.tokens.links[a[1].toLowerCase()]={href:a[2],title:a[3]};else if(t&&(a=d.rules.table.exec(e))){for(e=e.substring(a[0].length),l={type:"table",header:a[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:a[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:a[3].replace(/(?: *\| *)?\n$/,"").split("\n")},c=0;c])/,autolink:/^<([^ >]+(@|:\/)[^ >]+)>/,url:l,tag:/^|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^\b_((?:[^_]|__)+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,code:/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:l,text:/^[\s\S]+?(?=[\\?(?:\s+['"]([\s\S]*?)['"])?\s*/,h.link=s(h.link)("inside",h._inside)("href",h._href)(),h.reflink=s(h.reflink)("inside",h._inside)(),h.normal=u({},h),h.pedantic=u({},h.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/}),h.gfm=u({},h.normal,{escape:s(h.escape)("])","~|])")(),url:/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:s(h.text)("]|","~]|")("|","|https?://|")()}),h.breaks=u({},h.gfm,{br:s(h.br)("{2,}","*")(),text:s(h.gfm.text)("{2,}","*")()}),n.rules=h,n.output=function(e,t,r){var i=new n(t,r);return i.output(e)},n.prototype.output=function(e){for(var t,n,r,i,o=this,s="";e;)if(i=o.rules.escape.exec(e))e=e.substring(i[0].length),s+=i[1];else if(i=o.rules.autolink.exec(e))e=e.substring(i[0].length),"@"===i[2]?(n=":"===i[1].charAt(6)?o.mangle(i[1].substring(7)):o.mangle(i[1]),r=o.mangle("mailto:")+n):(n=a(i[1]),r=n),s+=o.renderer.link(r,null,n);else if(o.inLink||!(i=o.rules.url.exec(e))){if(i=o.rules.tag.exec(e))!o.inLink&&/^/i.test(i[0])&&(o.inLink=!1),e=e.substring(i[0].length),s+=o.options.sanitize?o.options.sanitizer?o.options.sanitizer(i[0]):a(i[0]):i[0];else if(i=o.rules.link.exec(e))e=e.substring(i[0].length),o.inLink=!0,s+=o.outputLink(i,{href:i[2],title:i[3]}),o.inLink=!1;else if((i=o.rules.reflink.exec(e))||(i=o.rules.nolink.exec(e))){if(e=e.substring(i[0].length),t=(i[2]||i[1]).replace(/\s+/g," "),t=o.links[t.toLowerCase()],!t||!t.href){s+=i[0].charAt(0),e=i[0].substring(1)+e;continue}o.inLink=!0,s+=o.outputLink(i,t),o.inLink=!1}else if(i=o.rules.strong.exec(e))e=e.substring(i[0].length),s+=o.renderer.strong(o.output(i[2]||i[1]));else if(i=o.rules.em.exec(e))e=e.substring(i[0].length),s+=o.renderer.em(o.output(i[2]||i[1]));else if(i=o.rules.code.exec(e))e=e.substring(i[0].length),s+=o.renderer.codespan(a(i[2],!0));else if(i=o.rules.br.exec(e))e=e.substring(i[0].length),s+=o.renderer.br();else if(i=o.rules.del.exec(e))e=e.substring(i[0].length),s+=o.renderer.del(o.output(i[1]));else if(i=o.rules.text.exec(e))e=e.substring(i[0].length),s+=o.renderer.text(a(o.smartypants(i[0])));else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0))}else e=e.substring(i[0].length),n=a(i[1]),r=n,s+=o.renderer.link(r,null,n);return s},n.prototype.outputLink=function(e,t){var n=a(t.href),r=t.title?a(t.title):null;return"!"!==e[0].charAt(0)?this.renderer.link(n,r,this.output(e[1])):this.renderer.image(n,r,a(e[1]))},n.prototype.smartypants=function(e){return this.options.smartypants?e.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014\/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014\/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…"):e},n.prototype.mangle=function(e){if(!this.options.mangle)return e;for(var t,n="",r=e.length,i=0;i.5&&(t="x"+t.toString(16)),n+=""+t+";";return n},r.prototype.code=function(e,t,n){if(this.options.highlight){var r=this.options.highlight(e,t);null!=r&&r!==e&&(n=!0,e=r)}return t?''+(n?e:a(e,!0))+"\n
\n":""+(n?e:a(e,!0))+"\n
"},r.prototype.blockquote=function(e){return"\n"+e+"
\n"},r.prototype.html=function(e){return e},r.prototype.heading=function(e,t,n){return"\n"},r.prototype.hr=function(){return this.options.xhtml?"
\n":"
\n"},r.prototype.list=function(e,t){var n=t?"ol":"ul";return"<"+n+">\n"+e+""+n+">\n"},r.prototype.listitem=function(e){return""+e+"\n"},r.prototype.paragraph=function(e){return""+e+"
\n"},r.prototype.table=function(e,t){return"\n"},r.prototype.tablerow=function(e){return"\n"+e+"
\n"},r.prototype.tablecell=function(e,t){var n=t.header?"th":"td",r=t.align?"<"+n+' style="text-align:'+t.align+'">':"<"+n+">";return r+e+""+n+">\n"},r.prototype.strong=function(e){return""+e+""},r.prototype.em=function(e){return""+e+""},r.prototype.codespan=function(e){return""+e+"
"},r.prototype.br=function(){return this.options.xhtml?"
":"
"},r.prototype.del=function(e){return""+e+""},r.prototype.link=function(e,t,n){if(this.options.sanitize){try{var r=decodeURIComponent(o(e)).replace(/[^\w:]/g,"").toLowerCase()}catch(e){return""}if(0===r.indexOf("javascript:")||0===r.indexOf("vbscript:"))return""}var i='"+n+""},r.prototype.image=function(e,t,n){var r='
":">"},r.prototype.text=function(e){return e},i.parse=function(e,t,n){var r=new i(t,n);return r.parse(e)},i.prototype.parse=function(e){var t=this;this.inline=new n(e.links,this.options,this.renderer),this.tokens=e.reverse();for(var r="";this.next();)r+=t.tok();return r},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 e=this,t=this.token.text;"text"===this.peek().type;)t+="\n"+e.next().text;return this.inline.output(t)},i.prototype.tok=function(){var e=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,this.token.text);case"code":return this.renderer.code(this.token.text,this.token.lang,this.token.escaped);case"table":var t,n,r,i,a,o="",s="";for(r="",t=0;te.length)break e;if(!(y instanceof i)){c.lastIndex=0;var k=c.exec(y),w=1;if(!k&&d&&v!=a.length-1){if(c.lastIndex=b,k=c.exec(e),!k)break;for(var x=k.index+(h?k[1].length:0),_=k.index+k[0].length,L=v,S=b,C=a.length;L=S&&(++v,b=S);if(a[v]instanceof i||a[L-1].greedy)continue;w=L-v,y=e.slice(b,S),k.index-=b}if(k){h&&(g=k[1].length);var x=k.index+g,k=k[0].slice(g),_=x+k.length,E=y.slice(0,x),$=y.slice(_),T=[v,w];E&&T.push(E);var A=new i(s,p?r.tokenize(k,p):k,f,k,d);T.push(A),$&&T.push($),Array.prototype.splice.apply(a,T)}}}}}return a},hooks:{all:{},add:function(e,t){var n=r.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=r.hooks.all[e];if(n&&n.length)for(var i,a=0;i=n[a++];)i(t)}}},i=r.Token=function(e,t,n,r,i){this.type=e,this.content=t,this.alias=n,this.length=0|(r||"").length,this.greedy=!!i};if(i.stringify=function(e,t,n){if("string"==typeof e)return e;if("Array"===r.util.type(e))return e.map(function(n){return i.stringify(n,t,e)}).join("");var a={type:e.type,content:i.stringify(e.content,t,n),tag:"span",classes:["token",e.type],attributes:{},language:t,parent:n};if("comment"==a.type&&(a.attributes.spellcheck="true"),e.alias){var o="Array"===r.util.type(e.alias)?e.alias:[e.alias];Array.prototype.push.apply(a.classes,o)}r.hooks.run("wrap",a);var s=Object.keys(a.attributes).map(function(e){return e+'="'+(a.attributes[e]||"").replace(/"/g,""")+'"'}).join(" ");return"<"+a.tag+' class="'+a.classes.join(" ")+'"'+(s?" "+s:"")+">"+a.content+""+a.tag+">"},!t.document)return t.addEventListener?(t.addEventListener("message",function(e){var n=JSON.parse(e.data),i=n.language,a=n.code,o=n.immediateClose;t.postMessage(r.highlight(a,r.languages[i],i)),o&&t.close()},!1),t.Prism):t.Prism;var a=document.currentScript||[].slice.call(document.getElementsByTagName("script")).pop();return a&&(r.filename=a.src,document.addEventListener&&!a.hasAttribute("data-manual")&&("loading"!==document.readyState?window.requestAnimationFrame?window.requestAnimationFrame(r.highlightAll):window.setTimeout(r.highlightAll,16):document.addEventListener("DOMContentLoaded",r.highlightAll))),t.Prism}();e.exports&&(e.exports=n),"undefined"!=typeof ze&&(ze.Prism=n),n.languages.markup={comment://,prolog:/<\?[\w\W]+?\?>/,doctype://i,cdata://i,tag:{pattern:/<\/?(?!\d)[^\s>\/=$<]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\\1|\\?(?!\1)[\w\W])*\1|[^\s'">=]+))?)*\s*\/?>/i,inside:{tag:{pattern:/^<\/?[^\s>\/]+/i,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"attr-value":{pattern:/=(?:('|")[\w\W]*?(\1)|[^\s>]+)/i,inside:{punctuation:/[=>"']/}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:/?[\da-z]{1,8};/i},n.hooks.add("wrap",function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&/,"&"))}),n.languages.xml=n.languages.markup,n.languages.html=n.languages.markup,n.languages.mathml=n.languages.markup,n.languages.svg=n.languages.markup,n.languages.css={comment:/\/\*[\w\W]*?\*\//,atrule:{pattern:/@[\w-]+?.*?(;|(?=\s*\{))/i,inside:{rule:/@[\w-]+/}},url:/url\((?:(["'])(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,selector:/[^\{\}\s][^\{\};]*?(?=\s*\{)/,string:{pattern:/("|')(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1/,greedy:!0},property:/(\b|\B)[\w-]+(?=\s*:)/i,important:/\B!important\b/i,function:/[-a-z0-9]+(?=\()/i,punctuation:/[(){};:]/},n.languages.css.atrule.inside.rest=n.util.clone(n.languages.css),n.languages.markup&&(n.languages.insertBefore("markup","tag",{style:{pattern:/("}function z(e,t){return t={exports:{}},e(t,t.exports),t.exports}function H(e,t){var n=[],r={};return e.forEach(function(e){var i=e.level||1,a=i-1;i>t||(r[a]?r[a].children=(r[a].children||[]).concat(e):n.push(e),r[i]=e)}),n}function R(e){if("string"!=typeof e)return"";var t=e.toLowerCase().trim().replace(/<[^>\d]+>/g,"").replace(Ue,"").replace(/\s/g,"-").replace(/-+/g,"-").replace(/^(\d)/,"_$1"),n=De[t];return n=De.hasOwnProperty(t)?n+1:0,De[t]=n,n&&(t=t+"-"+n),t}function W(e,t){return'
'}function B(e){return e.replace(/<(pre|template|code)[^>]*?>[\s\S]+?<\/(pre|template|code)>/g,function(e){return e.replace(/:/g,"__colon__")}).replace(/:(\w+?):/gi,window.emojify||W).replace(/__colon__/g,":")}function D(e,t){var n="";if(e)n=Qe(e),n=n.match(/]*>([\s\S]+)<\/ul>/g)[0];else{var r=Ye[Ze]||H(Je,t);n=N(r,""),Ye[Ze]=r}return n}function U(e,t){if(e){Je[0]&&1===Je[0].level&&Je.shift();var n=Ye[Ze]||H(Je,t);e.parentNode.innerHTML+=N(n,'